1/* Copyright 2012 Mozilla Foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15(function (root, factory) { 16 'use strict'; 17 if (typeof define === 'function' && define.amd) { 18 define('pdfjs-dist/build/pdf.worker', ['exports'], factory); 19 } else if (typeof exports !== 'undefined') { 20 factory(exports); 21 } else { 22 factory(root['pdfjsDistBuildPdfWorker'] = {}); 23 } 24}(this, function (exports) { 25 'use strict'; 26 var pdfjsVersion = '1.7.254'; 27 var pdfjsBuild = 'ec26a7e5'; 28 var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; 29 var pdfjsLibs = {}; 30 (function pdfjsWrapper() { 31 (function (root, factory) { 32 factory(root.pdfjsCoreArithmeticDecoder = {}); 33 }(this, function (exports) { 34 var ArithmeticDecoder = function ArithmeticDecoderClosure() { 35 var QeTable = [ 36 { 37 qe: 0x5601, 38 nmps: 1, 39 nlps: 1, 40 switchFlag: 1 41 }, 42 { 43 qe: 0x3401, 44 nmps: 2, 45 nlps: 6, 46 switchFlag: 0 47 }, 48 { 49 qe: 0x1801, 50 nmps: 3, 51 nlps: 9, 52 switchFlag: 0 53 }, 54 { 55 qe: 0x0AC1, 56 nmps: 4, 57 nlps: 12, 58 switchFlag: 0 59 }, 60 { 61 qe: 0x0521, 62 nmps: 5, 63 nlps: 29, 64 switchFlag: 0 65 }, 66 { 67 qe: 0x0221, 68 nmps: 38, 69 nlps: 33, 70 switchFlag: 0 71 }, 72 { 73 qe: 0x5601, 74 nmps: 7, 75 nlps: 6, 76 switchFlag: 1 77 }, 78 { 79 qe: 0x5401, 80 nmps: 8, 81 nlps: 14, 82 switchFlag: 0 83 }, 84 { 85 qe: 0x4801, 86 nmps: 9, 87 nlps: 14, 88 switchFlag: 0 89 }, 90 { 91 qe: 0x3801, 92 nmps: 10, 93 nlps: 14, 94 switchFlag: 0 95 }, 96 { 97 qe: 0x3001, 98 nmps: 11, 99 nlps: 17, 100 switchFlag: 0 101 }, 102 { 103 qe: 0x2401, 104 nmps: 12, 105 nlps: 18, 106 switchFlag: 0 107 }, 108 { 109 qe: 0x1C01, 110 nmps: 13, 111 nlps: 20, 112 switchFlag: 0 113 }, 114 { 115 qe: 0x1601, 116 nmps: 29, 117 nlps: 21, 118 switchFlag: 0 119 }, 120 { 121 qe: 0x5601, 122 nmps: 15, 123 nlps: 14, 124 switchFlag: 1 125 }, 126 { 127 qe: 0x5401, 128 nmps: 16, 129 nlps: 14, 130 switchFlag: 0 131 }, 132 { 133 qe: 0x5101, 134 nmps: 17, 135 nlps: 15, 136 switchFlag: 0 137 }, 138 { 139 qe: 0x4801, 140 nmps: 18, 141 nlps: 16, 142 switchFlag: 0 143 }, 144 { 145 qe: 0x3801, 146 nmps: 19, 147 nlps: 17, 148 switchFlag: 0 149 }, 150 { 151 qe: 0x3401, 152 nmps: 20, 153 nlps: 18, 154 switchFlag: 0 155 }, 156 { 157 qe: 0x3001, 158 nmps: 21, 159 nlps: 19, 160 switchFlag: 0 161 }, 162 { 163 qe: 0x2801, 164 nmps: 22, 165 nlps: 19, 166 switchFlag: 0 167 }, 168 { 169 qe: 0x2401, 170 nmps: 23, 171 nlps: 20, 172 switchFlag: 0 173 }, 174 { 175 qe: 0x2201, 176 nmps: 24, 177 nlps: 21, 178 switchFlag: 0 179 }, 180 { 181 qe: 0x1C01, 182 nmps: 25, 183 nlps: 22, 184 switchFlag: 0 185 }, 186 { 187 qe: 0x1801, 188 nmps: 26, 189 nlps: 23, 190 switchFlag: 0 191 }, 192 { 193 qe: 0x1601, 194 nmps: 27, 195 nlps: 24, 196 switchFlag: 0 197 }, 198 { 199 qe: 0x1401, 200 nmps: 28, 201 nlps: 25, 202 switchFlag: 0 203 }, 204 { 205 qe: 0x1201, 206 nmps: 29, 207 nlps: 26, 208 switchFlag: 0 209 }, 210 { 211 qe: 0x1101, 212 nmps: 30, 213 nlps: 27, 214 switchFlag: 0 215 }, 216 { 217 qe: 0x0AC1, 218 nmps: 31, 219 nlps: 28, 220 switchFlag: 0 221 }, 222 { 223 qe: 0x09C1, 224 nmps: 32, 225 nlps: 29, 226 switchFlag: 0 227 }, 228 { 229 qe: 0x08A1, 230 nmps: 33, 231 nlps: 30, 232 switchFlag: 0 233 }, 234 { 235 qe: 0x0521, 236 nmps: 34, 237 nlps: 31, 238 switchFlag: 0 239 }, 240 { 241 qe: 0x0441, 242 nmps: 35, 243 nlps: 32, 244 switchFlag: 0 245 }, 246 { 247 qe: 0x02A1, 248 nmps: 36, 249 nlps: 33, 250 switchFlag: 0 251 }, 252 { 253 qe: 0x0221, 254 nmps: 37, 255 nlps: 34, 256 switchFlag: 0 257 }, 258 { 259 qe: 0x0141, 260 nmps: 38, 261 nlps: 35, 262 switchFlag: 0 263 }, 264 { 265 qe: 0x0111, 266 nmps: 39, 267 nlps: 36, 268 switchFlag: 0 269 }, 270 { 271 qe: 0x0085, 272 nmps: 40, 273 nlps: 37, 274 switchFlag: 0 275 }, 276 { 277 qe: 0x0049, 278 nmps: 41, 279 nlps: 38, 280 switchFlag: 0 281 }, 282 { 283 qe: 0x0025, 284 nmps: 42, 285 nlps: 39, 286 switchFlag: 0 287 }, 288 { 289 qe: 0x0015, 290 nmps: 43, 291 nlps: 40, 292 switchFlag: 0 293 }, 294 { 295 qe: 0x0009, 296 nmps: 44, 297 nlps: 41, 298 switchFlag: 0 299 }, 300 { 301 qe: 0x0005, 302 nmps: 45, 303 nlps: 42, 304 switchFlag: 0 305 }, 306 { 307 qe: 0x0001, 308 nmps: 45, 309 nlps: 43, 310 switchFlag: 0 311 }, 312 { 313 qe: 0x5601, 314 nmps: 46, 315 nlps: 46, 316 switchFlag: 0 317 } 318 ]; 319 function ArithmeticDecoder(data, start, end) { 320 this.data = data; 321 this.bp = start; 322 this.dataEnd = end;
323 this.chigh = data[start]; 324 this.clow = 0; 325 this.byteIn(); 326 this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F; 327 this.clow = this.clow << 7 & 0xFFFF; 328 this.ct -= 7; 329 this.a = 0x8000; 330 } 331 ArithmeticDecoder.prototype = { 332 byteIn: function ArithmeticDecoder_byteIn() { 333 var data = this.data; 334 var bp = this.bp; 335 if (data[bp] === 0xFF) { 336 var b1 = data[bp + 1]; 337 if (b1 > 0x8F) { 338 this.clow += 0xFF00; 339 this.ct = 8; 340 } else { 341 bp++; 342 this.clow += data[bp] << 9; 343 this.ct = 7; 344 this.bp = bp; 345 } 346 } else { 347 bp++; 348 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00; 349 this.ct = 8; 350 this.bp = bp; 351 } 352 if (this.clow > 0xFFFF) { 353 this.chigh += this.clow >> 16; 354 this.clow &= 0xFFFF; 355 } 356 }, 357 readBit: function ArithmeticDecoder_readBit(contexts, pos) { 358 var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1; 359 var qeTableIcx = QeTable[cx_index]; 360 var qeIcx = qeTableIcx.qe; 361 var d; 362 var a = this.a - qeIcx; 363 if (this.chigh < qeIcx) { 364 if (a < qeIcx) { 365 a = qeIcx; 366 d = cx_mps; 367 cx_index = qeTableIcx.nmps; 368 } else { 369 a = qeIcx; 370 d = 1 ^ cx_mps; 371 if (qeTableIcx.switchFlag === 1) { 372 cx_mps = d; 373 } 374 cx_index = qeTableIcx.nlps; 375 } 376 } else { 377 this.chigh -= qeIcx; 378 if ((a & 0x8000) !== 0) { 379 this.a = a; 380 return cx_mps; 381 } 382 if (a < qeIcx) { 383 d = 1 ^ cx_mps; 384 if (qeTableIcx.switchFlag === 1) { 385 cx_mps = d; 386 } 387 cx_index = qeTableIcx.nlps; 388 } else { 389 d = cx_mps; 390 cx_index = qeTableIcx.nmps; 391 } 392 } 393 do { 394 if (this.ct === 0) { 395 this.byteIn(); 396 } 397 a <<= 1; 398 this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1; 399 this.clow = this.clow << 1 & 0xFFFF; 400 this.ct--; 401 } while ((a & 0x8000) === 0); 402 this.a = a; 403 contexts[pos] = cx_index << 1 | cx_mps; 404 return d; 405 } 406 }; 407 return ArithmeticDecoder; 408 }(); 409 exports.ArithmeticDecoder = ArithmeticDecoder; 410 })); 411 (function (root, factory) { 412 factory(root.pdfjsCoreCharsets = {}); 413 }(this, function (exports) { 414 var ISOAdobeCharset = [ 415 '.notdef', 416 'space', 417 'exclam', 418 'quotedbl', 419 'numbersign', 420 'dollar', 421 'percent', 422 'ampersand', 423 'quoteright', 424 'parenleft', 425 'parenright', 426 'asterisk', 427 'plus', 428 'comma', 429 'hyphen', 430 'period', 431 'slash', 432 'zero', 433 'one', 434 'two', 435 'three', 436 'four', 437 'five', 438 'six', 439 'seven', 440 'eight', 441 'nine', 442 'colon', 443 'semicolon', 444 'less', 445 'equal', 446 'greater', 447 'question', 448 'at', 449 'A', 450 'B', 451 'C', 452 'D', 453 'E', 454 'F', 455 'G', 456 'H', 457 'I', 458 'J', 459 'K', 460 'L', 461 'M', 462 'N', 463 'O', 464 'P', 465 'Q', 466 'R', 467 'S', 468 'T', 469 'U', 470 'V', 471 'W', 472 'X', 473 'Y', 474 'Z', 475 'bracketleft', 476 'backslash', 477 'bracketright', 478 'asciicircum', 479 'underscore', 480 'quoteleft', 481 'a', 482 'b', 483 'c', 484 'd', 485 'e', 486 'f', 487 'g', 488 'h', 489 'i', 490 'j', 491 'k', 492 'l', 493 'm', 494 'n', 495 'o', 496 'p', 497 'q', 498 'r', 499 's', 500 't', 501 'u', 502 'v', 503 'w', 504 'x', 505 'y', 506 'z', 507 'braceleft', 508 'bar', 509 'braceright', 510 'asciitilde', 511 'exclamdown', 512 'cent', 513 'sterling', 514 'fraction', 515 'yen', 516 'florin', 517 'section', 518 'currency', 519 'quotesingle', 520 'quotedblleft', 521 'guillemotleft', 522 'guilsinglleft', 523 'guilsinglright', 524 'fi', 525 'fl', 526 'endash', 527 'dagger', 528 'daggerdbl',
529 'periodcentered', 530 'paragraph', 531 'bullet', 532 'quotesinglbase', 533 'quotedblbase', 534 'quotedblright', 535 'guillemotright', 536 'ellipsis', 537 'perthousand', 538 'questiondown', 539 'grave', 540 'acute', 541 'circumflex', 542 'tilde', 543 'macron', 544 'breve', 545 'dotaccent', 546 'dieresis', 547 'ring', 548 'cedilla', 549 'hungarumlaut', 550 'ogonek', 551 'caron', 552 'emdash', 553 'AE', 554 'ordfeminine', 555 'Lslash', 556 'Oslash', 557 'OE', 558 'ordmasculine', 559 'ae', 560 'dotlessi', 561 'lslash', 562 'oslash', 563 'oe', 564 'germandbls', 565 'onesuperior', 566 'logicalnot', 567 'mu', 568 'trademark', 569 'Eth', 570 'onehalf', 571 'plusminus', 572 'Thorn', 573 'onequarter', 574 'divide', 575 'brokenbar', 576 'degree', 577 'thorn', 578 'threequarters', 579 'twosuperior', 580 'registered', 581 'minus', 582 'eth', 583 'multiply', 584 'threesuperior', 585 'copyright', 586 'Aacute', 587 'Acircumflex', 588 'Adieresis', 589 'Agrave', 590 'Aring', 591 'Atilde', 592 'Ccedilla', 593 'Eacute', 594 'Ecircumflex', 595 'Edieresis', 596 'Egrave', 597 'Iacute', 598 'Icircumflex', 599 'Idieresis', 600 'Igrave', 601 'Ntilde', 602 'Oacute', 603 'Ocircumflex', 604 'Odieresis', 605 'Ograve', 606 'Otilde', 607 'Scaron', 608 'Uacute', 609 'Ucircumflex', 610 'Udieresis', 611 'Ugrave', 612 'Yacute', 613 'Ydieresis', 614 'Zcaron', 615 'aacute', 616 'acircumflex', 617 'adieresis', 618 'agrave', 619 'aring', 620 'atilde', 621 'ccedilla', 622 'eacute', 623 'ecircumflex', 624 'edieresis', 625 'egrave', 626 'iacute', 627 'icircumflex', 628 'idieresis', 629 'igrave', 630 'ntilde', 631 'oacute', 632 'ocircumflex', 633 'odieresis', 634 'ograve', 635 'otilde', 636 'scaron', 637 'uacute', 638 'ucircumflex', 639 'udieresis', 640 'ugrave', 641 'yacute', 642 'ydieresis', 643 'zcaron' 644 ]; 645 var ExpertCharset = [ 646 '.notdef', 647 'space', 648 'exclamsmall', 649 'Hungarumlautsmall', 650 'dollaroldstyle', 651 'dollarsuperior', 652 'ampersandsmall', 653 'Acutesmall', 654 'parenleftsuperior', 655 'parenrightsuperior', 656 'twodotenleader', 657 'onedotenleader', 658 'comma', 659 'hyphen', 660 'period', 661 'fraction', 662 'zerooldstyle', 663 'oneoldstyle', 664 'twooldstyle', 665 'threeoldstyle', 666 'fouroldstyle', 667 'fiveoldstyle', 668 'sixoldstyle', 669 'sevenoldstyle', 670 'eightoldstyle', 671 'nineoldstyle', 672 'colon', 673 'semicolon', 674 'commasuperior', 675 'threequartersemdash', 676 'periodsuperior', 677 'questionsmall', 678 'asuperior', 679 'bsuperior', 680 'centsuperior', 681 'dsuperior', 682 'esuperior', 683 'isuperior', 684 'lsuperior', 685 'msuperior', 686 'nsuperior', 687 'osuperior', 688 'rsuperior', 689 'ssuperior', 690 'tsuperior', 691 'ff', 692 'fi', 693 'fl', 694 'ffi', 695 'ffl', 696 'parenleftinferior', 697 'parenrightinferior', 698 'Circumflexsmall', 699 'hyphensuperior', 700 'Gravesmall', 701 'Asmall', 702 'Bsmall', 703 'Csmall', 704 'Dsmall', 705 'Esmall', 706 'Fsmall', 707 'Gsmall', 708 'Hsmall', 709 'Ismall', 710 'Jsmall', 711 'Ksmall', 712 'Lsmall', 713 'Msmall', 714 'Nsmall', 715 'Osmall', 716 'Psmall', 717 'Qsmall', 718 'Rsmall', 719 'Ssmall', 720 'Tsmall', 721 'Usmall', 722 'Vsmall', 723 'Wsmall', 724 'Xsmall', 725 'Ysmall', 726 'Zsmall', 727 'colonmonetary', 728 'onefitted', 729 'rupiah', 730 'Tildesmall', 731 'exclamdownsmall', 732 'centoldstyle', 733 'Lslashsmall', 734 'Scaronsmall', 735 'Zcaronsmall', 736 'Dieresissmall', 737 'Brevesmall', 738 'Caronsmall', 739 'Dotaccentsmall', 740 'Macronsmall', 741 'figuredash', 742 'hypheninferior', 743 'Ogoneksmall', 744 'Ringsmall', 745 'Cedillasmall', 746 'onequarter', 747 'onehalf', 748 'threequarters', 749 'questiondownsmall', 750 'oneeighth', 751 'threeeighths', 752 'fiveeighths', 753 'seveneighths', 754 'onethird', 755 'twothirds', 756 'zerosuperior', 757 'onesuperior', 758 'twosuperior', 759 'threesuperior', 760 'foursuperior', 761 'fivesuperior', 762 'sixsuperior', 763 'sevensuperior', 764 'eightsuperior', 765 'ninesuperior', 766 'zeroinferior', 767 'oneinferior', 768 'twoinferior', 769 'threeinferior', 770 'fourinferior', 771 'fiveinferior', 772 'sixinferior', 773 'seveninferior', 774 'eightinferior', 775 'nineinferior', 776 'centinferior', 777 'dollarinferior', 778 'periodinferior', 779 'commainferior', 780 'Agravesmall', 781 'Aacutesmall', 782 'Acircumflexsmall', 783 'Atildesmall', 784 'Adieresissmall', 785 'Aringsmall', 786 'AEsmall', 787 'Ccedillasmall', 788 'Egravesmall', 789 'Eacutesmall', 790 'Ecircumflexsmall', 791 'Edieresissmall', 792 'Igravesmall', 793 'Iacutesmall', 794 'Icircumflexsmall', 795 'Idieresissmall', 796 'Ethsmall', 797 'Ntildesmall', 798 'Ogravesmall', 799 'Oacutesmall', 800 'Ocircumflexsmall', 801 'Otildesmall', 802 'Odieresissmall', 803 'OEsmall', 804 'Oslashsmall', 805 'Ugravesmall', 806 'Uacutesmall', 807 'Ucircumflexsmall', 808 'Udieresissmall', 809 'Yacutesmall', 810 'Thornsmall', 811 'Ydieresissmall' 812 ]; 813 var ExpertSubsetCharset = [ 814 '.notdef', 815 'space', 816 'dollaroldstyle', 817 'dollarsuperior', 818 'parenleftsuperior', 819 'parenrightsuperior', 820 'twodotenleader', 821 'onedotenleader', 822 'comma', 823 'hyphen', 824 'period', 825 'fraction', 826 'zerooldstyle', 827 'oneoldstyle', 828 'twooldstyle', 829 'threeoldstyle', 830 'fouroldstyle', 831 'fiveoldstyle', 832 'sixoldstyle', 833 'sevenoldstyle', 834 'eightoldstyle', 835 'nineoldstyle', 836 'colon', 837 'semicolon', 838 'commasuperior', 839 'threequartersemdash', 840 'periodsuperior', 841 'asuperior', 842 'bsuperior', 843 'centsuperior', 844 'dsuperior', 845 'esuperior', 846 'isuperior', 847 'lsuperior', 848 'msuperior', 849 'nsuperior', 850 'osuperior', 851 'rsuperior', 852 'ssuperior', 853 'tsuperior', 854 'ff', 855 'fi', 856 'fl', 857 'ffi', 858 'ffl', 859 'parenleftinferior', 860 'parenrightinferior', 861 'hyphensuperior', 862 'colonmonetary', 863 'onefitted', 864 'rupiah', 865 'centoldstyle', 866 'figuredash', 867 'hypheninferior', 868 'onequarter', 869 'onehalf', 870 'threequarters', 871 'oneeighth', 872 'threeeighths', 873 'fiveeighths', 874 'seveneighths', 875 'onethird', 876 'twothirds', 877 'zerosuperior', 878 'onesuperior', 879 'twosuperior', 880 'threesuperior', 881 'foursuperior', 882 'fivesuperior', 883 'sixsuperior', 884 'sevensuperior', 885 'eightsuperior', 886 'ninesuperior', 887 'zeroinferior', 888 'oneinferior', 889 'twoinferior', 890 'threeinferior', 891 'fourinferior', 892 'fiveinferior', 893 'sixinferior', 894 'seveninferior', 895 'eightinferior', 896 'nineinferior', 897 'centinferior', 898 'dollarinferior', 899 'periodinferior', 900 'commainferior' 901 ]; 902 exports.ISOAdobeCharset = ISOAdobeCharset; 903 exports.ExpertCharset = ExpertCharset; 904 exports.ExpertSubsetCharset = ExpertSubsetCharset; 905 })); 906 (function (root, factory) { 907 factory(root.pdfjsCoreEncodings = {}); 908 }(this, function (exports) { 909 var ExpertEncoding = [ 910 '', 911 '', 912 '', 913 '', 914 '', 915 '', 916 '', 917 '', 918 '', 919 '', 920 '', 921 '', 922 '', 923 '', 924 '', 925 '', 926 '', 927 '', 928 '', 929 '', 930 '', 931 '', 932 '', 933 '', 934 '', 935 '', 936 '', 937 '', 938 '', 939 '', 940 '', 941 '', 942 'space', 943 'exclamsmall', 944 'Hungarumlautsmall', 945 '', 946 'dollaroldstyle', 947 'dollarsuperior', 948 'ampersandsmall', 949 'Acutesmall', 950 'parenleftsuperior', 951 'parenrightsuperior', 952 'twodotenleader', 953 'onedotenleader', 954 'comma', 955 'hyphen', 956 'period', 957 'fraction', 958 'zerooldstyle', 959 'oneoldstyle', 960 'twooldstyle', 961 'threeoldstyle', 962 'fouroldstyle', 963 'fiveoldstyle', 964 'sixoldstyle', 965 'sevenoldstyle', 966 'eightoldstyle', 967 'nineoldstyle', 968 'colon', 969 'semicolon', 970 'commasuperior', 971 'threequartersemdash', 972 'periodsuperior', 973 'questionsmall', 974 '', 975 'asuperior', 976 'bsuperior', 977 'centsuperior', 978 'dsuperior', 979 'esuperior', 980 '', 981 '', 982 'isuperior', 983 '', 984 '', 985 'lsuperior', 986 'msuperior', 987 'nsuperior', 988 'osuperior', 989 '', 990 '', 991 'rsuperior', 992 'ssuperior', 993 'tsuperior', 994 '', 995 'ff', 996 'fi', 997 'fl', 998 'ffi', 999 'ffl', 1000 'parenleftinferior', 1001 '', 1002 'parenrightinferior', 1003 'Circumflexsmall', 1004 'hyphensuperior', 1005 'Gravesmall', 1006 'Asmall', 1007 'Bsmall', 1008 'Csmall', 1009 'Dsmall', 1010 'Esmall', 1011 'Fsmall', 1012 'Gsmall', 1013 'Hsmall', 1014 'Ismall', 1015 'Jsmall', 1016 'Ksmall', 1017 'Lsmall', 1018 'Msmall', 1019 'Nsmall', 1020 'Osmall',
1021 'Psmall', 1022 'Qsmall', 1023 'Rsmall', 1024 'Ssmall', 1025 'Tsmall', 1026 'Usmall', 1027 'Vsmall', 1028 'Wsmall', 1029 'Xsmall', 1030 'Ysmall', 1031 'Zsmall', 1032 'colonmonetary', 1033 'onefitted', 1034 'rupiah', 1035 'Tildesmall', 1036 '', 1037 '', 1038 '', 1039 '', 1040 '', 1041 '', 1042 '', 1043 '', 1044 '', 1045 '', 1046 '', 1047 '', 1048 '', 1049 '', 1050 '', 1051 '', 1052 '', 1053 '', 1054 '', 1055 '', 1056 '', 1057 '', 1058 '', 1059 '', 1060 '', 1061 '', 1062 '', 1063 '', 1064 '', 1065 '', 1066 '', 1067 '', 1068 '', 1069 '', 1070 'exclamdownsmall', 1071 'centoldstyle', 1072 'Lslashsmall', 1073 '', 1074 '', 1075 'Scaronsmall', 1076 'Zcaronsmall', 1077 'Dieresissmall', 1078 'Brevesmall', 1079 'Caronsmall', 1080 '', 1081 'Dotaccentsmall', 1082 '', 1083 '', 1084 'Macronsmall', 1085 '', 1086 '', 1087 'figuredash', 1088 'hypheninferior', 1089 '', 1090 '', 1091 'Ogoneksmall', 1092 'Ringsmall', 1093 'Cedillasmall', 1094 '', 1095 '', 1096 '', 1097 'onequarter', 1098 'onehalf', 1099 'threequarters', 1100 'questiondownsmall', 1101 'oneeighth', 1102 'threeeighths', 1103 'fiveeighths', 1104 'seveneighths', 1105 'onethird', 1106 'twothirds', 1107 '', 1108 '', 1109 'zerosuperior', 1110 'onesuperior', 1111 'twosuperior', 1112 'threesuperior', 1113 'foursuperior', 1114 'fivesuperior', 1115 'sixsuperior', 1116 'sevensuperior', 1117 'eightsuperior', 1118 'ninesuperior', 1119 'zeroinferior', 1120 'oneinferior', 1121 'twoinferior', 1122 'threeinferior', 1123 'fourinferior', 1124 'fiveinferior', 1125 'sixinferior', 1126 'seveninferior', 1127 'eightinferior', 1128 'nineinferior', 1129 'centinferior', 1130 'dollarinferior', 1131 'periodinferior', 1132 'commainferior', 1133 'Agravesmall', 1134 'Aacutesmall', 1135 'Acircumflexsmall', 1136 'Atildesmall', 1137 'Adieresissmall', 1138 'Aringsmall', 1139 'AEsmall', 1140 'Ccedillasmall', 1141 'Egravesmall', 1142 'Eacutesmall', 1143 'Ecircumflexsmall', 1144 'Edieresissmall', 1145 'Igravesmall', 1146 'Iacutesmall', 1147 'Icircumflexsmall', 1148 'Idieresissmall', 1149 'Ethsmall', 1150 'Ntildesmall', 1151 'Ogravesmall', 1152 'Oacutesmall', 1153 'Ocircumflexsmall', 1154 'Otildesmall', 1155 'Odieresissmall', 1156 'OEsmall', 1157 'Oslashsmall', 1158 'Ugravesmall', 1159 'Uacutesmall', 1160 'Ucircumflexsmall', 1161 'Udieresissmall', 1162 'Yacutesmall', 1163 'Thornsmall', 1164 'Ydieresissmall' 1165 ]; 1166 var MacExpertEncoding = [ 1167 '', 1168 '', 1169 '', 1170 '', 1171 '', 1172 '', 1173 '', 1174 '', 1175 '', 1176 '', 1177 '', 1178 '', 1179 '', 1180 '', 1181 '', 1182 '', 1183 '', 1184 '', 1185 '', 1186 '', 1187 '', 1188 '', 1189 '', 1190 '', 1191 '', 1192 '', 1193 '', 1194 '', 1195 '', 1196 '', 1197 '', 1198 '', 1199 'space', 1200 'exclamsmall', 1201 'Hungarumlautsmall', 1202 'centoldstyle', 1203 'dollaroldstyle', 1204 'dollarsuperior', 1205 'ampersandsmall', 1206 'Acutesmall', 1207 'parenleftsuperior', 1208 'parenrightsuperior', 1209 'twodotenleader', 1210 'onedotenleader', 1211 'comma', 1212 'hyphen', 1213 'period', 1214 'fraction', 1215 'zerooldstyle', 1216 'oneoldstyle', 1217 'twooldstyle', 1218 'threeoldstyle', 1219 'fouroldstyle', 1220 'fiveoldstyle', 1221 'sixoldstyle', 1222 'sevenoldstyle', 1223 'eightoldstyle', 1224 'nineoldstyle', 1225 'colon', 1226 'semicolon', 1227 '', 1228 'threequartersemdash', 1229 '', 1230 'questionsmall', 1231 '', 1232 '', 1233 '', 1234 '', 1235 'Ethsmall', 1236 '', 1237 '', 1238 'onequarter', 1239 'onehalf', 1240 'threequarters', 1241 'oneeighth', 1242 'threeeighths', 1243 'fiveeighths', 1244 'seveneighths', 1245 'onethird', 1246 'twothirds', 1247 '', 1248 '', 1249 '', 1250 '', 1251 '', 1252 '', 1253 'ff', 1254 'fi', 1255 'fl', 1256 'ffi', 1257 'ffl', 1258 'parenleftinferior', 1259 '', 1260 'parenrightinferior', 1261 'Circumflexsmall', 1262 'hypheninferior', 1263 'Gravesmall', 1264 'Asmall', 1265 'Bsmall', 1266 'Csmall', 1267 'Dsmall', 1268 'Esmall', 1269 'Fsmall', 1270 'Gsmall', 1271 'Hsmall', 1272 'Ismall', 1273 'Jsmall', 1274 'Ksmall', 1275 'Lsmall', 1276 'Msmall', 1277 'Nsmall', 1278 'Osmall', 1279 'Psmall', 1280 'Qsmall', 1281 'Rsmall', 1282 'Ssmall', 1283 'Tsmall', 1284 'Usmall', 1285 'Vsmall', 1286 'Wsmall', 1287 'Xsmall', 1288 'Ysmall', 1289 'Zsmall', 1290 'colonmonetary', 1291 'onefitted', 1292 'rupiah', 1293 'Tildesmall', 1294 '', 1295 '', 1296 'asuperior', 1297 'centsuperior', 1298 '', 1299 '', 1300 '', 1301 '', 1302 'Aacutesmall', 1303 'Agravesmall', 1304 'Acircumflexsmall', 1305 'Adieresissmall', 1306 'Atildesmall', 1307 'Aringsmall', 1308 'Ccedillasmall', 1309 'Eacutesmall', 1310 'Egravesmall', 1311 'Ecircumflexsmall', 1312 'Edieresissmall', 1313 'Iacutesmall', 1314 'Igravesmall', 1315 'Icircumflexsmall', 1316 'Idieresissmall', 1317 'Ntildesmall', 1318 'Oacutesmall', 1319 'Ogravesmall', 1320 'Ocircumflexsmall', 1321 'Odieresissmall', 1322 'Otildesmall', 1323 'Uacutesmall', 1324 'Ugravesmall', 1325 'Ucircumflexsmall', 1326 'Udieresissmall', 1327 '', 1328 'eightsuperior', 1329 'fourinferior', 1330 'threeinferior', 1331 'sixinferior', 1332 'eightinferior', 1333 'seveninferior', 1334 'Scaronsmall', 1335 '', 1336 'centinferior', 1337 'twoinferior', 1338 '', 1339 'Dieresissmall', 1340 '', 1341 'Caronsmall', 1342 'osuperior', 1343 'fiveinferior', 1344 '', 1345 'commainferior', 1346 'periodinferior', 1347 'Yacutesmall', 1348 '', 1349 'dollarinferior', 1350 '', 1351 'Thornsmall', 1352 '', 1353 'nineinferior', 1354 'zeroinferior', 1355 'Zcaronsmall', 1356 'AEsmall', 1357 'Oslashsmall', 1358 'questiondownsmall', 1359 'oneinferior', 1360 'Lslashsmall', 1361 '', 1362 '', 1363 '', 1364 '', 1365 '', 1366 '', 1367 'Cedillasmall', 1368 '', 1369 '', 1370 '', 1371 '', 1372 '', 1373 'OEsmall', 1374 'figuredash', 1375 'hyphensuperior', 1376 '', 1377 '', 1378 '', 1379 '', 1380 'exclamdownsmall', 1381 '', 1382 'Ydieresissmall', 1383 '', 1384 'onesuperior', 1385 'twosuperior', 1386 'threesuperior', 1387 'foursuperior', 1388 'fivesuperior', 1389 'sixsuperior', 1390 'sevensuperior', 1391 'ninesuperior', 1392 'zerosuperior', 1393 '', 1394 'esuperior', 1395 'rsuperior', 1396 'tsuperior', 1397 '', 1398 '', 1399 'isuperior', 1400 'ssuperior', 1401 'dsuperior', 1402 '', 1403 '', 1404 '', 1405 '', 1406 '', 1407 'lsuperior', 1408 'Ogoneksmall', 1409 'Brevesmall', 1410 'Macronsmall', 1411 'bsuperior', 1412 'nsuperior', 1413 'msuperior', 1414 'commasuperior', 1415 'periodsuperior', 1416 'Dotaccentsmall', 1417 'Ringsmall' 1418 ]; 1419 var MacRomanEncoding = [ 1420 '', 1421 '', 1422 '', 1423 '', 1424 '', 1425 '', 1426 '', 1427 '', 1428 '', 1429 '', 1430 '', 1431 '', 1432 '', 1433 '', 1434 '', 1435 '', 1436 '', 1437 '', 1438 '', 1439 '', 1440 '', 1441 '', 1442 '', 1443 '', 1444 '', 1445 '', 1446 '', 1447 '', 1448 '', 1449 '', 1450 '', 1451 '', 1452 'space', 1453 'exclam', 1454 'quotedbl', 1455 'numbersign', 1456 'dollar', 1457 'percent', 1458 'ampersand', 1459 'quotesingle', 1460 'parenleft', 1461 'parenright', 1462 'asterisk', 1463 'plus', 1464 'comma', 1465 'hyphen', 1466 'period', 1467 'slash', 1468 'zero', 1469 'one', 1470 'two', 1471 'three', 1472 'four', 1473 'five', 1474 'six', 1475 'seven', 1476 'eight', 1477 'nine', 1478 'colon', 1479 'semicolon', 1480 'less', 1481 'equal', 1482 'greater', 1483 'question', 1484 'at', 1485 'A', 1486 'B', 1487 'C', 1488 'D', 1489 'E', 1490 'F', 1491 'G', 1492 'H', 1493 'I', 1494 'J', 1495 'K', 1496 'L', 1497 'M', 1498 'N', 1499 'O', 1500 'P', 1501 'Q', 1502 'R', 1503 'S', 1504 'T', 1505 'U', 1506 'V', 1507 'W', 1508 'X', 1509 'Y', 1510 'Z', 1511 'bracketleft', 1512 'backslash', 1513 'bracketright', 1514 'asciicircum', 1515 'underscore', 1516 'grave', 1517 'a', 1518 'b', 1519 'c', 1520 'd', 1521 'e', 1522 'f', 1523 'g', 1524 'h', 1525 'i', 1526 'j', 1527 'k', 1528 'l', 1529 'm', 1530 'n', 1531 'o', 1532 'p', 1533 'q', 1534 'r', 1535 's', 1536 't', 1537 'u', 1538 'v', 1539 'w', 1540 'x', 1541 'y', 1542 'z', 1543 'braceleft', 1544 'bar', 1545 'braceright', 1546 'asciitilde', 1547 '', 1548 'Adieresis', 1549 'Aring', 1550 'Ccedilla', 1551 'Eacute', 1552 'Ntilde', 1553 'Odieresis', 1554 'Udieresis', 1555 'aacute', 1556 'agrave', 1557 'acircumflex', 1558 'adieresis', 1559 'atilde', 1560 'aring', 1561 'ccedilla', 1562 'eacute', 1563 'egrave', 1564 'ecircumflex', 1565 'edieresis', 1566 'iacute', 1567 'igrave', 1568 'icircumflex', 1569 'idieresis', 1570 'ntilde', 1571 'oacute', 1572 'ograve', 1573 'ocircumflex', 1574 'odieresis', 1575 'otilde', 1576 'uacute', 1577 'ugrave', 1578 'ucircumflex', 1579 'udieresis', 1580 'dagger', 1581 'degree', 1582 'cent', 1583 'sterling', 1584 'section', 1585 'bullet', 1586 'paragraph', 1587 'germandbls', 1588 'registered', 1589 'copyright', 1590 'trademark', 1591 'acute', 1592 'dieresis', 1593 'notequal', 1594 'AE', 1595 'Oslash', 1596 'infinity', 1597 'plusminus', 1598 'lessequal', 1599 'greaterequal', 1600 'yen', 1601 'mu', 1602 'partialdiff', 1603 'summation', 1604 'product', 1605 'pi', 1606 'integral', 1607 'ordfeminine', 1608 'ordmasculine', 1609 'Omega', 1610 'ae', 1611 'oslash', 1612 'questiondown', 1613 'exclamdown', 1614 'logicalnot', 1615 'radical', 1616 'florin', 1617 'approxequal', 1618 'Delta', 1619 'guillemotleft', 1620 'guillemotright', 1621 'ellipsis', 1622 'space', 1623 'Agrave', 1624 'Atilde', 1625 'Otilde', 1626 'OE', 1627 'oe', 1628 'endash', 1629 'emdash', 1630 'quotedblleft', 1631 'quotedblright', 1632 'quoteleft', 1633 'quoteright', 1634 'divide', 1635 'lozenge', 1636 'ydieresis', 1637 'Ydieresis', 1638 'fraction', 1639 'currency', 1640 'guilsinglleft', 1641 'guilsinglright', 1642 'fi', 1643 'fl', 1644 'daggerdbl',
1645 'periodcentered', 1646 'quotesinglbase', 1647 'quotedblbase', 1648 'perthousand', 1649 'Acircumflex', 1650 'Ecircumflex', 1651 'Aacute', 1652 'Edieresis', 1653 'Egrave', 1654 'Iacute', 1655 'Icircumflex', 1656 'Idieresis', 1657 'Igrave', 1658 'Oacute', 1659 'Ocircumflex', 1660 'apple', 1661 'Ograve', 1662 'Uacute', 1663 'Ucircumflex', 1664 'Ugrave', 1665 'dotlessi', 1666 'circumflex', 1667 'tilde', 1668 'macron', 1669 'breve', 1670 'dotaccent', 1671 'ring', 1672 'cedilla', 1673 'hungarumlaut', 1674 'ogonek', 1675 'caron' 1676 ]; 1677 var StandardEncoding = [ 1678 '', 1679 '', 1680 '', 1681 '', 1682 '', 1683 '', 1684 '', 1685 '', 1686 '', 1687 '', 1688 '', 1689 '', 1690 '', 1691 '', 1692 '', 1693 '', 1694 '', 1695 '', 1696 '', 1697 '', 1698 '', 1699 '', 1700 '', 1701 '', 1702 '', 1703 '', 1704 '', 1705 '', 1706 '', 1707 '', 1708 '', 1709 '', 1710 'space', 1711 'exclam', 1712 'quotedbl', 1713 'numbersign', 1714 'dollar', 1715 'percent', 1716 'ampersand', 1717 'quoteright', 1718 'parenleft', 1719 'parenright', 1720 'asterisk', 1721 'plus', 1722 'comma', 1723 'hyphen', 1724 'period', 1725 'slash', 1726 'zero', 1727 'one', 1728 'two', 1729 'three', 1730 'four', 1731 'five', 1732 'six', 1733 'seven', 1734 'eight', 1735 'nine', 1736 'colon', 1737 'semicolon', 1738 'less', 1739 'equal', 1740 'greater', 1741 'question', 1742 'at', 1743 'A', 1744 'B', 1745 'C', 1746 'D', 1747 'E', 1748 'F', 1749 'G', 1750 'H', 1751 'I', 1752 'J', 1753 'K', 1754 'L', 1755 'M', 1756 'N', 1757 'O', 1758 'P', 1759 'Q', 1760 'R', 1761 'S', 1762 'T', 1763 'U', 1764 'V', 1765 'W', 1766 'X', 1767 'Y', 1768 'Z', 1769 'bracketleft', 1770 'backslash', 1771 'bracketright', 1772 'asciicircum', 1773 'underscore', 1774 'quoteleft', 1775 'a', 1776 'b', 1777 'c', 1778 'd', 1779 'e', 1780 'f', 1781 'g', 1782 'h', 1783 'i', 1784 'j', 1785 'k', 1786 'l', 1787 'm', 1788 'n', 1789 'o', 1790 'p', 1791 'q', 1792 'r', 1793 's', 1794 't', 1795 'u', 1796 'v', 1797 'w', 1798 'x', 1799 'y', 1800 'z', 1801 'braceleft', 1802 'bar', 1803 'braceright', 1804 'asciitilde', 1805 '', 1806 '', 1807 '', 1808 '', 1809 '', 1810 '', 1811 '', 1812 '', 1813 '', 1814 '', 1815 '', 1816 '', 1817 '', 1818 '', 1819 '', 1820 '', 1821 '', 1822 '', 1823 '', 1824 '', 1825 '', 1826 '', 1827 '', 1828 '', 1829 '', 1830 '', 1831 '', 1832 '', 1833 '', 1834 '', 1835 '', 1836 '', 1837 '', 1838 '', 1839 'exclamdown', 1840 'cent', 1841 'sterling', 1842 'fraction', 1843 'yen', 1844 'florin', 1845 'section', 1846 'currency', 1847 'quotesingle', 1848 'quotedblleft', 1849 'guillemotleft', 1850 'guilsinglleft', 1851 'guilsinglright', 1852 'fi', 1853 'fl', 1854 '', 1855 'endash', 1856 'dagger', 1857 'daggerdbl',
1858 'periodcentered', 1859 '', 1860 'paragraph', 1861 'bullet', 1862 'quotesinglbase', 1863 'quotedblbase', 1864 'quotedblright', 1865 'guillemotright', 1866 'ellipsis', 1867 'perthousand', 1868 '', 1869 'questiondown', 1870 '', 1871 'grave', 1872 'acute', 1873 'circumflex', 1874 'tilde', 1875 'macron', 1876 'breve', 1877 'dotaccent', 1878 'dieresis', 1879 '', 1880 'ring', 1881 'cedilla', 1882 '', 1883 'hungarumlaut', 1884 'ogonek', 1885 'caron', 1886 'emdash', 1887 '', 1888 '', 1889 '', 1890 '', 1891 '', 1892 '', 1893 '', 1894 '', 1895 '', 1896 '', 1897 '', 1898 '', 1899 '', 1900 '', 1901 '', 1902 '', 1903 'AE', 1904 '', 1905 'ordfeminine', 1906 '', 1907 '', 1908 '', 1909 '', 1910 'Lslash', 1911 'Oslash', 1912 'OE', 1913 'ordmasculine', 1914 '', 1915 '', 1916 '', 1917 '', 1918 '', 1919 'ae', 1920 '', 1921 '', 1922 '', 1923 'dotlessi', 1924 '', 1925 '', 1926 'lslash', 1927 'oslash', 1928 'oe', 1929 'germandbls' 1930 ]; 1931 var WinAnsiEncoding = [ 1932 '', 1933 '', 1934 '', 1935 '', 1936 '', 1937 '', 1938 '', 1939 '', 1940 '', 1941 '', 1942 '', 1943 '', 1944 '', 1945 '', 1946 '', 1947 '', 1948 '', 1949 '', 1950 '', 1951 '', 1952 '', 1953 '', 1954 '', 1955 '', 1956 '', 1957 '', 1958 '', 1959 '', 1960 '', 1961 '', 1962 '', 1963 '', 1964 'space', 1965 'exclam', 1966 'quotedbl', 1967 'numbersign', 1968 'dollar', 1969 'percent', 1970 'ampersand', 1971 'quotesingle', 1972 'parenleft', 1973 'parenright', 1974 'asterisk', 1975 'plus', 1976 'comma', 1977 'hyphen', 1978 'period', 1979 'slash', 1980 'zero', 1981 'one', 1982 'two', 1983 'three', 1984 'four', 1985 'five', 1986 'six', 1987 'seven', 1988 'eight', 1989 'nine', 1990 'colon', 1991 'semicolon', 1992 'less', 1993 'equal', 1994 'greater', 1995 'question', 1996 'at', 1997 'A', 1998 'B', 1999 'C', 2000 'D', 2001 'E', 2002 'F', 2003 'G', 2004 'H', 2005 'I', 2006 'J', 2007 'K', 2008 'L', 2009 'M', 2010 'N', 2011 'O', 2012 'P', 2013 'Q', 2014 'R', 2015 'S', 2016 'T', 2017 'U', 2018 'V', 2019 'W', 2020 'X', 2021 'Y', 2022 'Z', 2023 'bracketleft', 2024 'backslash', 2025 'bracketright', 2026 'asciicircum', 2027 'underscore', 2028 'grave', 2029 'a', 2030 'b', 2031 'c', 2032 'd', 2033 'e', 2034 'f', 2035 'g', 2036 'h', 2037 'i', 2038 'j', 2039 'k', 2040 'l', 2041 'm', 2042 'n', 2043 'o', 2044 'p', 2045 'q', 2046 'r', 2047 's', 2048 't', 2049 'u', 2050 'v', 2051 'w', 2052 'x', 2053 'y', 2054 'z', 2055 'braceleft', 2056 'bar', 2057 'braceright', 2058 'asciitilde', 2059 'bullet', 2060 'Euro', 2061 'bullet', 2062 'quotesinglbase', 2063 'florin', 2064 'quotedblbase', 2065 'ellipsis', 2066 'dagger', 2067 'daggerdbl', 2068 'circumflex', 2069 'perthousand', 2070 'Scaron', 2071 'guilsinglleft', 2072 'OE', 2073 'bullet', 2074 'Zcaron', 2075 'bullet', 2076 'bullet', 2077 'quoteleft', 2078 'quoteright', 2079 'quotedblleft', 2080 'quotedblright', 2081 'bullet', 2082 'endash', 2083 'emdash', 2084 'tilde', 2085 'trademark', 2086 'scaron', 2087 'guilsinglright', 2088 'oe', 2089 'bullet', 2090 'zcaron', 2091 'Ydieresis', 2092 'space', 2093 'exclamdown', 2094 'cent', 2095 'sterling', 2096 'currency', 2097 'yen', 2098 'brokenbar', 2099 'section', 2100 'dieresis', 2101 'copyright', 2102 'ordfeminine', 2103 'guillemotleft', 2104 'logicalnot', 2105 'hyphen', 2106 'registered', 2107 'macron', 2108 'degree', 2109 'plusminus', 2110 'twosuperior', 2111 'threesuperior', 2112 'acute', 2113 'mu', 2114 'paragraph',
2115 'periodcentered', 2116 'cedilla', 2117 'onesuperior', 2118 'ordmasculine', 2119 'guillemotright', 2120 'onequarter', 2121 'onehalf', 2122 'threequarters', 2123 'questiondown', 2124 'Agrave', 2125 'Aacute', 2126 'Acircumflex', 2127 'Atilde', 2128 'Adieresis', 2129 'Aring', 2130 'AE', 2131 'Ccedilla', 2132 'Egrave', 2133 'Eacute', 2134 'Ecircumflex', 2135 'Edieresis', 2136 'Igrave', 2137 'Iacute', 2138 'Icircumflex', 2139 'Idieresis', 2140 'Eth', 2141 'Ntilde', 2142 'Ograve', 2143 'Oacute', 2144 'Ocircumflex', 2145 'Otilde', 2146 'Odieresis', 2147 'multiply', 2148 'Oslash', 2149 'Ugrave', 2150 'Uacute', 2151 'Ucircumflex', 2152 'Udieresis', 2153 'Yacute', 2154 'Thorn', 2155 'germandbls', 2156 'agrave', 2157 'aacute', 2158 'acircumflex', 2159 'atilde', 2160 'adieresis', 2161 'aring', 2162 'ae', 2163 'ccedilla', 2164 'egrave', 2165 'eacute', 2166 'ecircumflex', 2167 'edieresis', 2168 'igrave', 2169 'iacute', 2170 'icircumflex', 2171 'idieresis', 2172 'eth', 2173 'ntilde', 2174 'ograve', 2175 'oacute', 2176 'ocircumflex', 2177 'otilde', 2178 'odieresis', 2179 'divide', 2180 'oslash', 2181 'ugrave', 2182 'uacute', 2183 'ucircumflex', 2184 'udieresis', 2185 'yacute', 2186 'thorn', 2187 'ydieresis' 2188 ]; 2189 var SymbolSetEncoding = [ 2190 '', 2191 '', 2192 '', 2193 '', 2194 '', 2195 '', 2196 '', 2197 '', 2198 '', 2199 '', 2200 '', 2201 '', 2202 '', 2203 '', 2204 '', 2205 '', 2206 '', 2207 '', 2208 '', 2209 '', 2210 '', 2211 '', 2212 '', 2213 '', 2214 '', 2215 '', 2216 '', 2217 '', 2218 '', 2219 '', 2220 '', 2221 '', 2222 'space', 2223 'exclam', 2224 'universal', 2225 'numbersign', 2226 'existential', 2227 'percent', 2228 'ampersand', 2229 'suchthat', 2230 'parenleft', 2231 'parenright', 2232 'asteriskmath', 2233 'plus', 2234 'comma', 2235 'minus', 2236 'period', 2237 'slash', 2238 'zero', 2239 'one', 2240 'two', 2241 'three', 2242 'four', 2243 'five', 2244 'six', 2245 'seven', 2246 'eight', 2247 'nine', 2248 'colon', 2249 'semicolon', 2250 'less', 2251 'equal', 2252 'greater', 2253 'question', 2254 'congruent', 2255 'Alpha', 2256 'Beta', 2257 'Chi', 2258 'Delta', 2259 'Epsilon', 2260 'Phi', 2261 'Gamma', 2262 'Eta', 2263 'Iota', 2264 'theta1', 2265 'Kappa', 2266 'Lambda', 2267 'Mu', 2268 'Nu', 2269 'Omicron', 2270 'Pi', 2271 'Theta', 2272 'Rho', 2273 'Sigma', 2274 'Tau', 2275 'Upsilon', 2276 'sigma1', 2277 'Omega', 2278 'Xi', 2279 'Psi', 2280 'Zeta', 2281 'bracketleft', 2282 'therefore', 2283 'bracketright', 2284 'perpendicular', 2285 'underscore', 2286 'radicalex', 2287 'alpha', 2288 'beta', 2289 'chi', 2290 'delta', 2291 'epsilon', 2292 'phi', 2293 'gamma', 2294 'eta', 2295 'iota', 2296 'phi1', 2297 'kappa', 2298 'lambda', 2299 'mu', 2300 'nu', 2301 'omicron', 2302 'pi', 2303 'theta', 2304 'rho', 2305 'sigma', 2306 'tau', 2307 'upsilon', 2308 'omega1', 2309 'omega', 2310 'xi', 2311 'psi', 2312 'zeta', 2313 'braceleft', 2314 'bar', 2315 'braceright', 2316 'similar', 2317 '', 2318 '', 2319 '', 2320 '', 2321 '', 2322 '', 2323 '', 2324 '', 2325 '', 2326 '', 2327 '', 2328 '', 2329 '', 2330 '', 2331 '', 2332 '', 2333 '', 2334 '', 2335 '', 2336 '', 2337 '', 2338 '', 2339 '', 2340 '', 2341 '', 2342 '', 2343 '', 2344 '', 2345 '', 2346 '', 2347 '', 2348 '', 2349 '', 2350 'Euro', 2351 'Upsilon1', 2352 'minute', 2353 'lessequal', 2354 'fraction', 2355 'infinity', 2356 'florin', 2357 'club', 2358 'diamond', 2359 'heart', 2360 'spade', 2361 'arrowboth', 2362 'arrowleft', 2363 'arrowup', 2364 'arrowright', 2365 'arrowdown', 2366 'degree', 2367 'plusminus', 2368 'second', 2369 'greaterequal', 2370 'multiply', 2371 'proportional', 2372 'partialdiff', 2373 'bullet', 2374 'divide', 2375 'notequal', 2376 'equivalence', 2377 'approxequal', 2378 'ellipsis', 2379 'arrowvertex', 2380 'arrowhorizex', 2381 'carriagereturn', 2382 'aleph', 2383 'Ifraktur', 2384 'Rfraktur', 2385 'weierstrass', 2386 'circlemultiply', 2387 'circleplus', 2388 'emptyset', 2389 'intersection', 2390 'union', 2391 'propersuperset', 2392 'reflexsuperset', 2393 'notsubset', 2394 'propersubset', 2395 'reflexsubset', 2396 'element', 2397 'notelement', 2398 'angle', 2399 'gradient', 2400 'registerserif', 2401 'copyrightserif', 2402 'trademarkserif', 2403 'product', 2404 'radical', 2405 'dotmath', 2406 'logicalnot', 2407 'logicaland', 2408 'logicalor', 2409 'arrowdblboth', 2410 'arrowdblleft', 2411 'arrowdblup', 2412 'arrowdblright', 2413 'arrowdbldown', 2414 'lozenge', 2415 'angleleft', 2416 'registersans', 2417 'copyrightsans', 2418 'trademarksans', 2419 'summation', 2420 'parenlefttp', 2421 'parenleftex', 2422 'parenleftbt', 2423 'bracketlefttp', 2424 'bracketleftex', 2425 'bracketleftbt', 2426 'bracelefttp', 2427 'braceleftmid', 2428 'braceleftbt', 2429 'braceex', 2430 '', 2431 'angleright', 2432 'integral', 2433 'integraltp', 2434 'integralex', 2435 'integralbt', 2436 'parenrighttp', 2437 'parenrightex', 2438 'parenrightbt', 2439 'bracketrighttp', 2440 'bracketrightex', 2441 'bracketrightbt', 2442 'bracerighttp', 2443 'bracerightmid', 2444 'bracerightbt' 2445 ]; 2446 var ZapfDingbatsEncoding = [ 2447 '', 2448 '', 2449 '', 2450 '', 2451 '', 2452 '', 2453 '', 2454 '', 2455 '', 2456 '', 2457 '', 2458 '', 2459 '', 2460 '', 2461 '', 2462 '', 2463 '', 2464 '', 2465 '', 2466 '', 2467 '', 2468 '', 2469 '', 2470 '', 2471 '', 2472 '', 2473 '', 2474 '', 2475 '', 2476 '', 2477 '', 2478 '', 2479 'space', 2480 'a1', 2481 'a2', 2482 'a202', 2483 'a3', 2484 'a4', 2485 'a5', 2486 'a119', 2487 'a118', 2488 'a117', 2489 'a11', 2490 'a12', 2491 'a13', 2492 'a14', 2493 'a15', 2494 'a16', 2495 'a105', 2496 'a17', 2497 'a18', 2498 'a19', 2499 'a20', 2500 'a21', 2501 'a22', 2502 'a23', 2503 'a24', 2504 'a25', 2505 'a26', 2506 'a27', 2507 'a28', 2508 'a6', 2509 'a7', 2510 'a8', 2511 'a9', 2512 'a10', 2513 'a29', 2514 'a30', 2515 'a31', 2516 'a32', 2517 'a33', 2518 'a34', 2519 'a35', 2520 'a36', 2521 'a37', 2522 'a38', 2523 'a39', 2524 'a40', 2525 'a41', 2526 'a42', 2527 'a43', 2528 'a44', 2529 'a45', 2530 'a46', 2531 'a47', 2532 'a48', 2533 'a49', 2534 'a50', 2535 'a51', 2536 'a52', 2537 'a53', 2538 'a54', 2539 'a55', 2540 'a56', 2541 'a57', 2542 'a58', 2543 'a59', 2544 'a60', 2545 'a61', 2546 'a62', 2547 'a63', 2548 'a64', 2549 'a65', 2550 'a66', 2551 'a67', 2552 'a68', 2553 'a69', 2554 'a70', 2555 'a71', 2556 'a72', 2557 'a73', 2558 'a74', 2559 'a203', 2560 'a75', 2561 'a204', 2562 'a76', 2563 'a77', 2564 'a78', 2565 'a79', 2566 'a81', 2567 'a82', 2568 'a83', 2569 'a84', 2570 'a97', 2571 'a98', 2572 'a99', 2573 'a100', 2574 '', 2575 'a89', 2576 'a90', 2577 'a93', 2578 'a94', 2579 'a91', 2580 'a92', 2581 'a205', 2582 'a85', 2583 'a206', 2584 'a86', 2585 'a87', 2586 'a88', 2587 'a95', 2588 'a96', 2589 '', 2590 '', 2591 '', 2592 '', 2593 '', 2594 '', 2595 '', 2596 '', 2597 '', 2598 '', 2599 '', 2600 '', 2601 '', 2602 '', 2603 '', 2604 '', 2605 '', 2606 '', 2607 '', 2608 'a101', 2609 'a102', 2610 'a103', 2611 'a104', 2612 'a106', 2613 'a107', 2614 'a108', 2615 'a112', 2616 'a111', 2617 'a110', 2618 'a109', 2619 'a120', 2620 'a121', 2621 'a122', 2622 'a123', 2623 'a124', 2624 'a125', 2625 'a126', 2626 'a127', 2627 'a128', 2628 'a129', 2629 'a130', 2630 'a131', 2631 'a132', 2632 'a133', 2633 'a134', 2634 'a135', 2635 'a136', 2636 'a137', 2637 'a138', 2638 'a139', 2639 'a140', 2640 'a141', 2641 'a142', 2642 'a143', 2643 'a144', 2644 'a145', 2645 'a146', 2646 'a147', 2647 'a148', 2648 'a149', 2649 'a150', 2650 'a151', 2651 'a152', 2652 'a153', 2653 'a154', 2654 'a155', 2655 'a156', 2656 'a157', 2657 'a158', 2658 'a159', 2659 'a160', 2660 'a161', 2661 'a163', 2662 'a164', 2663 'a196', 2664 'a165', 2665 'a192', 2666 'a166', 2667 'a167', 2668 'a168', 2669 'a169', 2670 'a170', 2671 'a171', 2672 'a172', 2673 'a173', 2674 'a162', 2675 'a174', 2676 'a175', 2677 'a176', 2678 'a177', 2679 'a178', 2680 'a179', 2681 'a193', 2682 'a180', 2683 'a199', 2684 'a181', 2685 'a200', 2686 'a182', 2687 '', 2688 'a201', 2689 'a183', 2690 'a184', 2691 'a197', 2692 'a185', 2693 'a194', 2694 'a198', 2695 'a186', 2696 'a195', 2697 'a187', 2698 'a188', 2699 'a189', 2700 'a190', 2701 'a191' 2702 ]; 2703 function getEncoding(encodingName) { 2704 switch (encodingName) { 2705 case 'WinAnsiEncoding': 2706 return WinAnsiEncoding; 2707 case 'StandardEncoding': 2708 return StandardEncoding; 2709 case 'MacRomanEncoding': 2710 return MacRomanEncoding; 2711 case 'SymbolSetEncoding': 2712 return SymbolSetEncoding; 2713 case 'ZapfDingbatsEncoding': 2714 return ZapfDingbatsEncoding; 2715 case 'ExpertEncoding': 2716 return ExpertEncoding; 2717 case 'MacExpertEncoding': 2718 return MacExpertEncoding; 2719 default: 2720 return null; 2721 } 2722 } 2723 exports.WinAnsiEncoding = WinAnsiEncoding; 2724 exports.StandardEncoding = StandardEncoding; 2725 exports.MacRomanEncoding = MacRomanEncoding; 2726 exports.SymbolSetEncoding = SymbolSetEncoding; 2727 exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding; 2728 exports.ExpertEncoding = ExpertEncoding; 2729 exports.getEncoding = getEncoding; 2730 })); 2731 (function (root, factory) { 2732 factory(root.pdfjsSharedUtil = {}); 2733 }(this, function (exports) { 2734 var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this; 2735 var FONT_IDENTITY_MATRIX = [ 2736 0.001, 2737 0, 2738 0, 2739 0.001, 2740 0, 2741 0 2742 ]; 2743 var TextRenderingMode = { 2744 FILL: 0, 2745 STROKE: 1, 2746 FILL_STROKE: 2, 2747 INVISIBLE: 3, 2748 FILL_ADD_TO_PATH: 4, 2749 STROKE_ADD_TO_PATH: 5, 2750 FILL_STROKE_ADD_TO_PATH: 6, 2751 ADD_TO_PATH: 7, 2752 FILL_STROKE_MASK: 3, 2753 ADD_TO_PATH_FLAG: 4 2754 }; 2755 var ImageKind = { 2756 GRAYSCALE_1BPP: 1, 2757 RGB_24BPP: 2, 2758 RGBA_32BPP: 3 2759 }; 2760 var AnnotationType = { 2761 TEXT: 1, 2762 LINK: 2, 2763 FREETEXT: 3, 2764 LINE: 4, 2765 SQUARE: 5, 2766 CIRCLE: 6, 2767 POLYGON: 7, 2768 POLYLINE: 8, 2769 HIGHLIGHT: 9, 2770 UNDERLINE: 10, 2771 SQUIGGLY: 11, 2772 STRIKEOUT: 12, 2773 STAMP: 13, 2774 CARET: 14, 2775 INK: 15, 2776 POPUP: 16, 2777 FILEATTACHMENT: 17, 2778 SOUND: 18, 2779 MOVIE: 19, 2780 WIDGET: 20, 2781 SCREEN: 21, 2782 PRINTERMARK: 22, 2783 TRAPNET: 23, 2784 WATERMARK: 24, 2785 THREED: 25, 2786 REDACT: 26 2787 }; 2788 var AnnotationFlag = { 2789 INVISIBLE: 0x01, 2790 HIDDEN: 0x02, 2791 PRINT: 0x04, 2792 NOZOOM: 0x08,
2793 NOROTATE: 0x10, 2794 NOVIEW: 0x20, 2795 READONLY: 0x40, 2796 LOCKED: 0x80, 2797 TOGGLENOVIEW: 0x100, 2798 LOCKEDCONTENTS: 0x200 2799 }; 2800 var AnnotationFieldFlag = { 2801 READONLY: 0x0000001, 2802 REQUIRED: 0x0000002, 2803 NOEXPORT: 0x0000004, 2804 MULTILINE: 0x0001000, 2805 PASSWORD: 0x0002000, 2806 NOTOGGLETOOFF: 0x0004000, 2807 RADIO: 0x0008000, 2808 PUSHBUTTON: 0x0010000, 2809 COMBO: 0x0020000, 2810 EDIT: 0x0040000, 2811 SORT: 0x0080000, 2812 FILESELECT: 0x0100000, 2813 MULTISELECT: 0x0200000, 2814 DONOTSPELLCHECK: 0x0400000, 2815 DONOTSCROLL: 0x0800000, 2816 COMB: 0x1000000, 2817 RICHTEXT: 0x2000000, 2818 RADIOSINUNISON: 0x2000000, 2819 COMMITONSELCHANGE: 0x4000000 2820 }; 2821 var AnnotationBorderStyleType = { 2822 SOLID: 1, 2823 DASHED: 2, 2824 BEVELED: 3, 2825 INSET: 4, 2826 UNDERLINE: 5 2827 }; 2828 var StreamType = { 2829 UNKNOWN: 0, 2830 FLATE: 1, 2831 LZW: 2, 2832 DCT: 3, 2833 JPX: 4, 2834 JBIG: 5, 2835 A85: 6, 2836 AHX: 7, 2837 CCF: 8, 2838 RL: 9 2839 }; 2840 var FontType = { 2841 UNKNOWN: 0, 2842 TYPE1: 1, 2843 TYPE1C: 2, 2844 CIDFONTTYPE0: 3, 2845 CIDFONTTYPE0C: 4, 2846 TRUETYPE: 5, 2847 CIDFONTTYPE2: 6, 2848 TYPE3: 7, 2849 OPENTYPE: 8, 2850 TYPE0: 9, 2851 MMTYPE1: 10 2852 }; 2853 var VERBOSITY_LEVELS = { 2854 errors: 0, 2855 warnings: 1, 2856 infos: 5 2857 }; 2858 var OPS = { 2859 dependency: 1, 2860 setLineWidth: 2, 2861 setLineCap: 3, 2862 setLineJoin: 4, 2863 setMiterLimit: 5, 2864 setDash: 6, 2865 setRenderingIntent: 7, 2866 setFlatness: 8, 2867 setGState: 9, 2868 save: 10, 2869 restore: 11, 2870 transform: 12, 2871 moveTo: 13, 2872 lineTo: 14, 2873 curveTo: 15, 2874 curveTo2: 16, 2875 curveTo3: 17, 2876 closePath: 18, 2877 rectangle: 19, 2878 stroke: 20, 2879 closeStroke: 21, 2880 fill: 22, 2881 eoFill: 23, 2882 fillStroke: 24, 2883 eoFillStroke: 25, 2884 closeFillStroke: 26, 2885 closeEOFillStroke: 27, 2886 endPath: 28, 2887 clip: 29, 2888 eoClip: 30, 2889 beginText: 31, 2890 endText: 32, 2891 setCharSpacing: 33, 2892 setWordSpacing: 34, 2893 setHScale: 35, 2894 setLeading: 36, 2895 setFont: 37, 2896 setTextRenderingMode: 38, 2897 setTextRise: 39, 2898 moveText: 40, 2899 setLeadingMoveText: 41, 2900 setTextMatrix: 42, 2901 nextLine: 43, 2902 showText: 44, 2903 showSpacedText: 45, 2904 nextLineShowText: 46, 2905 nextLineSetSpacingShowText: 47, 2906 setCharWidth: 48, 2907 setCharWidthAndBounds: 49, 2908 setStrokeColorSpace: 50, 2909 setFillColorSpace: 51, 2910 setStrokeColor: 52, 2911 setStrokeColorN: 53, 2912 setFillColor: 54, 2913 setFillColorN: 55, 2914 setStrokeGray: 56, 2915 setFillGray: 57, 2916 setStrokeRGBColor: 58, 2917 setFillRGBColor: 59, 2918 setStrokeCMYKColor: 60, 2919 setFillCMYKColor: 61, 2920 shadingFill: 62, 2921 beginInlineImage: 63, 2922 beginImageData: 64, 2923 endInlineImage: 65, 2924 paintXObject: 66, 2925 markPoint: 67, 2926 markPointProps: 68, 2927 beginMarkedContent: 69, 2928 beginMarkedContentProps: 70, 2929 endMarkedContent: 71, 2930 beginCompat: 72, 2931 endCompat: 73, 2932 paintFormXObjectBegin: 74, 2933 paintFormXObjectEnd: 75, 2934 beginGroup: 76, 2935 endGroup: 77, 2936 beginAnnotations: 78, 2937 endAnnotations: 79, 2938 beginAnnotation: 80, 2939 endAnnotation: 81, 2940 paintJpegXObject: 82, 2941 paintImageMaskXObject: 83, 2942 paintImageMaskXObjectGroup: 84, 2943 paintImageXObject: 85, 2944 paintInlineImageXObject: 86, 2945 paintInlineImageXObjectGroup: 87, 2946 paintImageXObjectRepeat: 88, 2947 paintImageMaskXObjectRepeat: 89, 2948 paintSolidColorImageMask: 90, 2949 constructPath: 91 2950 }; 2951 var verbosity = VERBOSITY_LEVELS.warnings; 2952 function setVerbosityLevel(level) { 2953 verbosity = level; 2954 } 2955 function getVerbosityLevel() { 2956 return verbosity; 2957 } 2958 function info(msg) { 2959 if (verbosity >= VERBOSITY_LEVELS.infos) { 2960 console.log('Info: ' + msg); 2961 } 2962 } 2963 function warn(msg) { 2964 if (verbosity >= VERBOSITY_LEVELS.warnings) { 2965 console.log('Warning: ' + msg); 2966 } 2967 } 2968 function deprecated(details) { 2969 console.log('Deprecated API usage: ' + details); 2970 } 2971 function error(msg) { 2972 if (verbosity >= VERBOSITY_LEVELS.errors) { 2973 console.log('Error: ' + msg); 2974 console.log(backtrace()); 2975 } 2976 throw new Error(msg); 2977 } 2978 function backtrace() { 2979 try { 2980 throw new Error(); 2981 } catch (e) { 2982 return e.stack ? e.stack.split('\n').slice(2).join('\n') : ''; 2983 } 2984 } 2985 function assert(cond, msg) { 2986 if (!cond) { 2987 error(msg); 2988 } 2989 } 2990 var UNSUPPORTED_FEATURES = { 2991 unknown: 'unknown', 2992 forms: 'forms', 2993 javaScript: 'javaScript', 2994 smask: 'smask', 2995 shadingPattern: 'shadingPattern', 2996 font: 'font' 2997 }; 2998 function isSameOrigin(baseUrl, otherUrl) { 2999 try { 3000 var base = new URL(baseUrl); 3001 if (!base.origin || base.origin === 'null') { 3002 return false;
3003 } 3004 } catch (e) { 3005 return false; 3006 } 3007 var other = new URL(otherUrl, base); 3008 return base.origin === other.origin; 3009 } 3010 function isValidProtocol(url) { 3011 if (!url) { 3012 return false; 3013 } 3014 switch (url.protocol) { 3015 case 'http:': 3016 case 'https:': 3017 case 'ftp:': 3018 case 'mailto:': 3019 case 'tel:': 3020 return true; 3021 default: 3022 return false; 3023 } 3024 } 3025 function createValidAbsoluteUrl(url, baseUrl) { 3026 if (!url) { 3027 return null; 3028 } 3029 try { 3030 var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 3031 if (isValidProtocol(absoluteUrl)) { 3032 return absoluteUrl; 3033 } 3034 } catch (ex) { 3035 } 3036 return null; 3037 } 3038 function shadow(obj, prop, value) { 3039 Object.defineProperty(obj, prop, { 3040 value: value, 3041 enumerable: true, 3042 configurable: true, 3043 writable: false 3044 }); 3045 return value; 3046 } 3047 function getLookupTableFactory(initializer) { 3048 var lookup; 3049 return function () { 3050 if (initializer) { 3051 lookup = Object.create(null); 3052 initializer(lookup); 3053 initializer = null; 3054 } 3055 return lookup; 3056 }; 3057 } 3058 var PasswordResponses = { 3059 NEED_PASSWORD: 1, 3060 INCORRECT_PASSWORD: 2 3061 }; 3062 var PasswordException = function PasswordExceptionClosure() { 3063 function PasswordException(msg, code) { 3064 this.name = 'PasswordException'; 3065 this.message = msg; 3066 this.code = code; 3067 } 3068 PasswordException.prototype = new Error(); 3069 PasswordException.constructor = PasswordException; 3070 return PasswordException; 3071 }(); 3072 var UnknownErrorException = function UnknownErrorExceptionClosure() { 3073 function UnknownErrorException(msg, details) { 3074 this.name = 'UnknownErrorException'; 3075 this.message = msg; 3076 this.details = details; 3077 } 3078 UnknownErrorException.prototype = new Error(); 3079 UnknownErrorException.constructor = UnknownErrorException; 3080 return UnknownErrorException; 3081 }(); 3082 var InvalidPDFException = function InvalidPDFExceptionClosure() { 3083 function InvalidPDFException(msg) { 3084 this.name = 'InvalidPDFException'; 3085 this.message = msg; 3086 } 3087 InvalidPDFException.prototype = new Error(); 3088 InvalidPDFException.constructor = InvalidPDFException; 3089 return InvalidPDFException; 3090 }(); 3091 var MissingPDFException = function MissingPDFExceptionClosure() { 3092 function MissingPDFException(msg) { 3093 this.name = 'MissingPDFException'; 3094 this.message = msg; 3095 } 3096 MissingPDFException.prototype = new Error(); 3097 MissingPDFException.constructor = MissingPDFException; 3098 return MissingPDFException; 3099 }(); 3100 var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() { 3101 function UnexpectedResponseException(msg, status) { 3102 this.name = 'UnexpectedResponseException'; 3103 this.message = msg; 3104 this.status = status; 3105 } 3106 UnexpectedResponseException.prototype = new Error(); 3107 UnexpectedResponseException.constructor = UnexpectedResponseException; 3108 return UnexpectedResponseException; 3109 }(); 3110 var NotImplementedException = function NotImplementedExceptionClosure() { 3111 function NotImplementedException(msg) { 3112 this.message = msg; 3113 } 3114 NotImplementedException.prototype = new Error(); 3115 NotImplementedException.prototype.name = 'NotImplementedException'; 3116 NotImplementedException.constructor = NotImplementedException; 3117 return NotImplementedException; 3118 }(); 3119 var MissingDataException = function MissingDataExceptionClosure() { 3120 function MissingDataException(begin, end) { 3121 this.begin = begin; 3122 this.end = end; 3123 this.message = 'Missing data [' + begin + ', ' + end + ')'; 3124 } 3125 MissingDataException.prototype = new Error(); 3126 MissingDataException.prototype.name = 'MissingDataException'; 3127 MissingDataException.constructor = MissingDataException; 3128 return MissingDataException; 3129 }(); 3130 var XRefParseException = function XRefParseExceptionClosure() { 3131 function XRefParseException(msg) { 3132 this.message = msg; 3133 } 3134 XRefParseException.prototype = new Error(); 3135 XRefParseException.prototype.name = 'XRefParseException'; 3136 XRefParseException.constructor = XRefParseException; 3137 return XRefParseException; 3138 }(); 3139 var NullCharactersRegExp = /\x00/g; 3140 function removeNullCharacters(str) { 3141 if (typeof str !== 'string') { 3142 warn('The argument for removeNullCharacters must be a string.'); 3143 return str; 3144 } 3145 return str.replace(NullCharactersRegExp, ''); 3146 } 3147 function bytesToString(bytes) { 3148 assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString'); 3149 var length = bytes.length; 3150 var MAX_ARGUMENT_COUNT = 8192; 3151 if (length < MAX_ARGUMENT_COUNT) { 3152 return String.fromCharCode.apply(null, bytes); 3153 } 3154 var strBuf = []; 3155 for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 3156 var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 3157 var chunk = bytes.subarray(i, chunkEnd); 3158 strBuf.push(String.fromCharCode.apply(null, chunk)); 3159 } 3160 return strBuf.join(''); 3161 } 3162 function stringToBytes(str) { 3163 assert(typeof str === 'string', 'Invalid argument for stringToBytes'); 3164 var length = str.length; 3165 var bytes = new Uint8Array(length); 3166 for (var i = 0; i < length; ++i) { 3167 bytes[i] = str.charCodeAt(i) & 0xFF; 3168 } 3169 return bytes; 3170 } 3171 function arrayByteLength(arr) { 3172 if (arr.length !== undefined) { 3173 return arr.length; 3174 } 3175 assert(arr.byteLength !== undefined); 3176 return arr.byteLength; 3177 } 3178 function arraysToBytes(arr) { 3179 if (arr.length === 1 && arr[0] instanceof Uint8Array) { 3180 return arr[0]; 3181 } 3182 var resultLength = 0; 3183 var i, ii = arr.length; 3184 var item, itemLength; 3185 for (i = 0; i < ii; i++) { 3186 item = arr[i]; 3187 itemLength = arrayByteLength(item); 3188 resultLength += itemLength; 3189 } 3190 var pos = 0; 3191 var data = new Uint8Array(resultLength); 3192 for (i = 0; i < ii; i++) { 3193 item = arr[i]; 3194 if (!(item instanceof Uint8Array)) { 3195 if (typeof item === 'string') { 3196 item = stringToBytes(item); 3197 } else { 3198 item = new Uint8Array(item); 3199 } 3200 } 3201 itemLength = item.byteLength; 3202 data.set(item, pos); 3203 pos += itemLength; 3204 } 3205 return data; 3206 } 3207 function string32(value) { 3208 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 3209 } 3210 function log2(x) { 3211 var n = 1, i = 0; 3212 while (x > n) { 3213 n <<= 1; 3214 i++; 3215 } 3216 return i; 3217 } 3218 function readInt8(data, start) { 3219 return data[start] << 24 >> 24; 3220 } 3221 function readUint16(data, offset) { 3222 return data[offset] << 8 | data[offset + 1]; 3223 } 3224 function readUint32(data, offset) { 3225 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 3226 } 3227 function isLittleEndian() { 3228 var buffer8 = new Uint8Array(2); 3229 buffer8[0] = 1; 3230 var buffer16 = new Uint16Array(buffer8.buffer); 3231 return buffer16[0] === 1; 3232 } 3233 function isEvalSupported() { 3234 try { 3235 new Function(''); 3236 return true; 3237 } catch (e) { 3238 return false;
3239 } 3240 } 3241 var Uint32ArrayView = function Uint32ArrayViewClosure() { 3242 function Uint32ArrayView(buffer, length) { 3243 this.buffer = buffer; 3244 this.byteLength = buffer.length; 3245 this.length = length === undefined ? this.byteLength >> 2 : length; 3246 ensureUint32ArrayViewProps(this.length); 3247 } 3248 Uint32ArrayView.prototype = Object.create(null); 3249 var uint32ArrayViewSetters = 0; 3250 function createUint32ArrayProp(index) { 3251 return { 3252 get: function () { 3253 var buffer = this.buffer, offset = index << 2; 3254 return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0; 3255 }, 3256 set: function (value) { 3257 var buffer = this.buffer, offset = index << 2; 3258 buffer[offset] = value & 255; 3259 buffer[offset + 1] = value >> 8 & 255; 3260 buffer[offset + 2] = value >> 16 & 255; 3261 buffer[offset + 3] = value >>> 24 & 255; 3262 } 3263 }; 3264 } 3265 function ensureUint32ArrayViewProps(length) { 3266 while (uint32ArrayViewSetters < length) { 3267 Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters)); 3268 uint32ArrayViewSetters++; 3269 } 3270 } 3271 return Uint32ArrayView; 3272 }(); 3273 exports.Uint32ArrayView = Uint32ArrayView; 3274 var IDENTITY_MATRIX = [ 3275 1, 3276 0, 3277 0, 3278 1, 3279 0, 3280 0 3281 ]; 3282 var Util = function UtilClosure() { 3283 function Util() { 3284 } 3285 var rgbBuf = [ 3286 'rgb(', 3287 0, 3288 ',', 3289 0, 3290 ',', 3291 0, 3292 ')' 3293 ]; 3294 Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { 3295 rgbBuf[1] = r; 3296 rgbBuf[3] = g; 3297 rgbBuf[5] = b; 3298 return rgbBuf.join(''); 3299 }; 3300 Util.transform = function Util_transform(m1, m2) { 3301 return [ 3302 m1[0] * m2[0] + m1[2] * m2[1], 3303 m1[1] * m2[0] + m1[3] * m2[1], 3304 m1[0] * m2[2] + m1[2] * m2[3], 3305 m1[1] * m2[2] + m1[3] * m2[3], 3306 m1[0] * m2[4] + m1[2] * m2[5] + m1[4], 3307 m1[1] * m2[4] + m1[3] * m2[5] + m1[5] 3308 ]; 3309 }; 3310 Util.applyTransform = function Util_applyTransform(p, m) { 3311 var xt = p[0] * m[0] + p[1] * m[2] + m[4]; 3312 var yt = p[0] * m[1] + p[1] * m[3] + m[5]; 3313 return [ 3314 xt, 3315 yt 3316 ]; 3317 }; 3318 Util.applyInverseTransform = function Util_applyInverseTransform(p, m) { 3319 var d = m[0] * m[3] - m[1] * m[2]; 3320 var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 3321 var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 3322 return [ 3323 xt, 3324 yt 3325 ]; 3326 }; 3327 Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) { 3328 var p1 = Util.applyTransform(r, m); 3329 var p2 = Util.applyTransform(r.slice(2, 4), m); 3330 var p3 = Util.applyTransform([ 3331 r[0], 3332 r[3] 3333 ], m); 3334 var p4 = Util.applyTransform([ 3335 r[2], 3336 r[1] 3337 ], m); 3338 return [ 3339 Math.min(p1[0], p2[0], p3[0], p4[0]), 3340 Math.min(p1[1], p2[1], p3[1], p4[1]), 3341 Math.max(p1[0], p2[0], p3[0], p4[0]), 3342 Math.max(p1[1], p2[1], p3[1], p4[1]) 3343 ]; 3344 }; 3345 Util.inverseTransform = function Util_inverseTransform(m) { 3346 var d = m[0] * m[3] - m[1] * m[2]; 3347 return [ 3348 m[3] / d, 3349 -m[1] / d, 3350 -m[2] / d, 3351 m[0] / d, 3352 (m[2] * m[5] - m[4] * m[3]) / d, 3353 (m[4] * m[1] - m[5] * m[0]) / d 3354 ]; 3355 }; 3356 Util.apply3dTransform = function Util_apply3dTransform(m, v) { 3357 return [ 3358 m[0] * v[0] + m[1] * v[1] + m[2] * v[2], 3359 m[3] * v[0] + m[4] * v[1] + m[5] * v[2], 3360 m[6] * v[0] + m[7] * v[1] + m[8] * v[2] 3361 ]; 3362 }; 3363 Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) { 3364 var transpose = [ 3365 m[0], 3366 m[2], 3367 m[1], 3368 m[3] 3369 ]; 3370 var a = m[0] * transpose[0] + m[1] * transpose[2]; 3371 var b = m[0] * transpose[1] + m[1] * transpose[3]; 3372 var c = m[2] * transpose[0] + m[3] * transpose[2]; 3373 var d = m[2] * transpose[1] + m[3] * transpose[3]; 3374 var first = (a + d) / 2; 3375 var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; 3376 var sx = first + second || 1; 3377 var sy = first - second || 1; 3378 return [ 3379 Math.sqrt(sx), 3380 Math.sqrt(sy) 3381 ]; 3382 }; 3383 Util.normalizeRect = function Util_normalizeRect(rect) { 3384 var r = rect.slice(0); 3385 if (rect[0] > rect[2]) { 3386 r[0] = rect[2]; 3387 r[2] = rect[0]; 3388 } 3389 if (rect[1] > rect[3]) { 3390 r[1] = rect[3]; 3391 r[3] = rect[1]; 3392 } 3393 return r; 3394 }; 3395 Util.intersect = function Util_intersect(rect1, rect2) { 3396 function compare(a, b) { 3397 return a - b; 3398 } 3399 var orderedX = [ 3400 rect1[0], 3401 rect1[2], 3402 rect2[0], 3403 rect2[2] 3404 ].sort(compare), orderedY = [ 3405 rect1[1], 3406 rect1[3], 3407 rect2[1], 3408 rect2[3] 3409 ].sort(compare), result = []; 3410 rect1 = Util.normalizeRect(rect1); 3411 rect2 = Util.normalizeRect(rect2); 3412 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 3413 result[0] = orderedX[1]; 3414 result[2] = orderedX[2]; 3415 } else { 3416 return false;
3417 } 3418 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 3419 result[1] = orderedY[1]; 3420 result[3] = orderedY[2]; 3421 } else { 3422 return false; 3423 } 3424 return result; 3425 }; 3426 Util.sign = function Util_sign(num) { 3427 return num < 0 ? -1 : 1; 3428 }; 3429 var ROMAN_NUMBER_MAP = [ 3430 '', 3431 'C', 3432 'CC', 3433 'CCC', 3434 'CD', 3435 'D', 3436 'DC', 3437 'DCC', 3438 'DCCC', 3439 'CM', 3440 '', 3441 'X', 3442 'XX', 3443 'XXX', 3444 'XL', 3445 'L', 3446 'LX', 3447 'LXX', 3448 'LXXX', 3449 'XC', 3450 '', 3451 'I', 3452 'II', 3453 'III', 3454 'IV', 3455 'V', 3456 'VI', 3457 'VII', 3458 'VIII', 3459 'IX' 3460 ]; 3461 Util.toRoman = function Util_toRoman(number, lowerCase) { 3462 assert(isInt(number) && number > 0, 'The number should be a positive integer.'); 3463 var pos, romanBuf = []; 3464 while (number >= 1000) { 3465 number -= 1000; 3466 romanBuf.push('M'); 3467 } 3468 pos = number / 100 | 0; 3469 number %= 100; 3470 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 3471 pos = number / 10 | 0; 3472 number %= 10; 3473 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 3474 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 3475 var romanStr = romanBuf.join(''); 3476 return lowerCase ? romanStr.toLowerCase() : romanStr; 3477 }; 3478 Util.appendToArray = function Util_appendToArray(arr1, arr2) { 3479 Array.prototype.push.apply(arr1, arr2); 3480 }; 3481 Util.prependToArray = function Util_prependToArray(arr1, arr2) { 3482 Array.prototype.unshift.apply(arr1, arr2); 3483 }; 3484 Util.extendObj = function extendObj(obj1, obj2) { 3485 for (var key in obj2) { 3486 obj1[key] = obj2[key]; 3487 } 3488 }; 3489 Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) { 3490 while (dict && !dict.has(name)) { 3491 dict = dict.get('Parent'); 3492 } 3493 if (!dict) { 3494 return null; 3495 } 3496 return getArray ? dict.getArray(name) : dict.get(name); 3497 }; 3498 Util.inherit = function Util_inherit(sub, base, prototype) { 3499 sub.prototype = Object.create(base.prototype); 3500 sub.prototype.constructor = sub; 3501 for (var prop in prototype) { 3502 sub.prototype[prop] = prototype[prop]; 3503 } 3504 }; 3505 Util.loadScript = function Util_loadScript(src, callback) { 3506 var script = document.createElement('script'); 3507 var loaded = false; 3508 script.setAttribute('src', src); 3509 if (callback) { 3510 script.onload = function () { 3511 if (!loaded) { 3512 callback(); 3513 } 3514 loaded = true; 3515 }; 3516 } 3517 document.getElementsByTagName('head')[0].appendChild(script); 3518 }; 3519 return Util; 3520 }(); 3521 var PageViewport = function PageViewportClosure() { 3522 function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { 3523 this.viewBox = viewBox; 3524 this.scale = scale; 3525 this.rotation = rotation; 3526 this.offsetX = offsetX; 3527 this.offsetY = offsetY; 3528 var centerX = (viewBox[2] + viewBox[0]) / 2; 3529 var centerY = (viewBox[3] + viewBox[1]) / 2; 3530 var rotateA, rotateB, rotateC, rotateD; 3531 rotation = rotation % 360; 3532 rotation = rotation < 0 ? rotation + 360 : rotation; 3533 switch (rotation) { 3534 case 180: 3535 rotateA = -1; 3536 rotateB = 0; 3537 rotateC = 0; 3538 rotateD = 1; 3539 break; 3540 case 90: 3541 rotateA = 0; 3542 rotateB = 1; 3543 rotateC = 1; 3544 rotateD = 0; 3545 break; 3546 case 270: 3547 rotateA = 0; 3548 rotateB = -1; 3549 rotateC = -1; 3550 rotateD = 0; 3551 break; 3552 default: 3553 rotateA = 1; 3554 rotateB = 0; 3555 rotateC = 0; 3556 rotateD = -1; 3557 break; 3558 } 3559 if (dontFlip) { 3560 rotateC = -rotateC; 3561 rotateD = -rotateD; 3562 } 3563 var offsetCanvasX, offsetCanvasY; 3564 var width, height; 3565 if (rotateA === 0) { 3566 offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; 3567 offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; 3568 width = Math.abs(viewBox[3] - viewBox[1]) * scale; 3569 height = Math.abs(viewBox[2] - viewBox[0]) * scale; 3570 } else { 3571 offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; 3572 offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; 3573 width = Math.abs(viewBox[2] - viewBox[0]) * scale; 3574 height = Math.abs(viewBox[3] - viewBox[1]) * scale; 3575 } 3576 this.transform = [ 3577 rotateA * scale, 3578 rotateB * scale, 3579 rotateC * scale, 3580 rotateD * scale, 3581 offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, 3582 offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY 3583 ]; 3584 this.width = width; 3585 this.height = height; 3586 this.fontScale = scale; 3587 } 3588 PageViewport.prototype = { 3589 clone: function PageViewPort_clone(args) { 3590 args = args || {}; 3591 var scale = 'scale' in args ? args.scale : this.scale; 3592 var rotation = 'rotation' in args ? args.rotation : this.rotation; 3593 return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip); 3594 }, 3595 convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) { 3596 return Util.applyTransform([ 3597 x, 3598 y 3599 ], this.transform); 3600 }, 3601 convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) { 3602 var tl = Util.applyTransform([ 3603 rect[0], 3604 rect[1] 3605 ], this.transform); 3606 var br = Util.applyTransform([ 3607 rect[2], 3608 rect[3] 3609 ], this.transform); 3610 return [ 3611 tl[0], 3612 tl[1], 3613 br[0], 3614 br[1] 3615 ]; 3616 }, 3617 convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { 3618 return Util.applyInverseTransform([ 3619 x, 3620 y 3621 ], this.transform); 3622 } 3623 }; 3624 return PageViewport; 3625 }(); 3626 var PDFStringTranslateTable = [ 3627 0, 3628 0, 3629 0, 3630 0, 3631 0, 3632 0, 3633 0, 3634 0, 3635 0, 3636 0, 3637 0, 3638 0, 3639 0, 3640 0, 3641 0, 3642 0, 3643 0, 3644 0, 3645 0, 3646 0, 3647 0, 3648 0, 3649 0, 3650 0, 3651 0x2D8, 3652 0x2C7, 3653 0x2C6, 3654 0x2D9, 3655 0x2DD, 3656 0x2DB, 3657 0x2DA, 3658 0x2DC, 3659 0, 3660 0, 3661 0, 3662 0, 3663 0, 3664 0, 3665 0, 3666 0, 3667 0, 3668 0, 3669 0, 3670 0, 3671 0, 3672 0, 3673 0, 3674 0, 3675 0, 3676 0, 3677 0, 3678 0, 3679 0, 3680 0, 3681 0, 3682 0, 3683 0, 3684 0, 3685 0, 3686 0, 3687 0, 3688 0, 3689 0, 3690 0, 3691 0, 3692 0, 3693 0, 3694 0, 3695 0, 3696 0, 3697 0, 3698 0, 3699 0, 3700 0, 3701 0, 3702 0, 3703 0, 3704 0, 3705 0, 3706 0, 3707 0, 3708 0, 3709 0, 3710 0, 3711 0, 3712 0, 3713 0, 3714 0, 3715 0, 3716 0, 3717 0, 3718 0, 3719 0, 3720 0, 3721 0, 3722 0, 3723 0, 3724 0, 3725 0, 3726 0, 3727 0, 3728 0, 3729 0, 3730 0, 3731 0, 3732 0, 3733 0, 3734 0, 3735 0, 3736 0, 3737 0, 3738 0, 3739 0, 3740 0, 3741 0, 3742 0, 3743 0, 3744 0, 3745 0, 3746 0, 3747 0, 3748 0, 3749 0, 3750 0, 3751 0, 3752 0, 3753 0, 3754 0, 3755 0x2022, 3756 0x2020, 3757 0x2021, 3758 0x2026, 3759 0x2014, 3760 0x2013, 3761 0x192, 3762 0x2044, 3763 0x2039, 3764 0x203A, 3765 0x2212, 3766 0x2030, 3767 0x201E, 3768 0x201C, 3769 0x201D, 3770 0x2018, 3771 0x2019, 3772 0x201A, 3773 0x2122,
3774 0xFB01, 3775 0xFB02, 3776 0x141, 3777 0x152, 3778 0x160, 3779 0x178, 3780 0x17D, 3781 0x131, 3782 0x142, 3783 0x153, 3784 0x161, 3785 0x17E, 3786 0, 3787 0x20AC 3788 ]; 3789 function stringToPDFString(str) { 3790 var i, n = str.length, strBuf = []; 3791 if (str[0] === '\xFE' && str[1] === '\xFF') { 3792 for (i = 2; i < n; i += 2) { 3793 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 3794 } 3795 } else { 3796 for (i = 0; i < n; ++i) { 3797 var code = PDFStringTranslateTable[str.charCodeAt(i)]; 3798 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 3799 } 3800 } 3801 return strBuf.join(''); 3802 } 3803 function stringToUTF8String(str) { 3804 return decodeURIComponent(escape(str)); 3805 } 3806 function utf8StringToString(str) { 3807 return unescape(encodeURIComponent(str)); 3808 } 3809 function isEmptyObj(obj) { 3810 for (var key in obj) { 3811 return false; 3812 } 3813 return true; 3814 } 3815 function isBool(v) { 3816 return typeof v === 'boolean'; 3817 } 3818 function isInt(v) { 3819 return typeof v === 'number' && (v | 0) === v; 3820 } 3821 function isNum(v) { 3822 return typeof v === 'number'; 3823 } 3824 function isString(v) { 3825 return typeof v === 'string'; 3826 } 3827 function isArray(v) { 3828 return v instanceof Array; 3829 } 3830 function isArrayBuffer(v) { 3831 return typeof v === 'object' && v !== null && v.byteLength !== undefined; 3832 } 3833 function isSpace(ch) { 3834 return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; 3835 } 3836 function createPromiseCapability() { 3837 var capability = {}; 3838 capability.promise = new Promise(function (resolve, reject) { 3839 capability.resolve = resolve; 3840 capability.reject = reject; 3841 }); 3842 return capability; 3843 } 3844 (function PromiseClosure() { 3845 if (globalScope.Promise) { 3846 if (typeof globalScope.Promise.all !== 'function') { 3847 globalScope.Promise.all = function (iterable) { 3848 var count = 0, results = [], resolve, reject; 3849 var promise = new globalScope.Promise(function (resolve_, reject_) { 3850 resolve = resolve_; 3851 reject = reject_; 3852 }); 3853 iterable.forEach(function (p, i) { 3854 count++; 3855 p.then(function (result) { 3856 results[i] = result; 3857 count--; 3858 if (count === 0) { 3859 resolve(results); 3860 } 3861 }, reject); 3862 }); 3863 if (count === 0) { 3864 resolve(results); 3865 } 3866 return promise; 3867 }; 3868 } 3869 if (typeof globalScope.Promise.resolve !== 'function') { 3870 globalScope.Promise.resolve = function (value) { 3871 return new globalScope.Promise(function (resolve) { 3872 resolve(value); 3873 }); 3874 }; 3875 } 3876 if (typeof globalScope.Promise.reject !== 'function') { 3877 globalScope.Promise.reject = function (reason) { 3878 return new globalScope.Promise(function (resolve, reject) { 3879 reject(reason); 3880 }); 3881 }; 3882 } 3883 if (typeof globalScope.Promise.prototype.catch !== 'function') { 3884 globalScope.Promise.prototype.catch = function (onReject) { 3885 return globalScope.Promise.prototype.then(undefined, onReject); 3886 }; 3887 } 3888 return; 3889 } 3890 var STATUS_PENDING = 0; 3891 var STATUS_RESOLVED = 1; 3892 var STATUS_REJECTED = 2; 3893 var REJECTION_TIMEOUT = 500; 3894 var HandlerManager = { 3895 handlers: [], 3896 running: false, 3897 unhandledRejections: [], 3898 pendingRejectionCheck: false, 3899 scheduleHandlers: function scheduleHandlers(promise) { 3900 if (promise._status === STATUS_PENDING) { 3901 return; 3902 } 3903 this.handlers = this.handlers.concat(promise._handlers); 3904 promise._handlers = []; 3905 if (this.running) { 3906 return; 3907 } 3908 this.running = true; 3909 setTimeout(this.runHandlers.bind(this), 0); 3910 }, 3911 runHandlers: function runHandlers() { 3912 var RUN_TIMEOUT = 1; 3913 var timeoutAt = Date.now() + RUN_TIMEOUT; 3914 while (this.handlers.length > 0) { 3915 var handler = this.handlers.shift(); 3916 var nextStatus = handler.thisPromise._status; 3917 var nextValue = handler.thisPromise._value; 3918 try { 3919 if (nextStatus === STATUS_RESOLVED) { 3920 if (typeof handler.onResolve === 'function') {
3921 nextValue = handler.onResolve(nextValue); 3922 } 3923 } else if (typeof handler.onReject === 'function') { 3924 nextValue = handler.onReject(nextValue); 3925 nextStatus = STATUS_RESOLVED; 3926 if (handler.thisPromise._unhandledRejection) { 3927 this.removeUnhandeledRejection(handler.thisPromise); 3928 } 3929 } 3930 } catch (ex) { 3931 nextStatus = STATUS_REJECTED; 3932 nextValue = ex; 3933 } 3934 handler.nextPromise._updateStatus(nextStatus, nextValue); 3935 if (Date.now() >= timeoutAt) { 3936 break; 3937 } 3938 } 3939 if (this.handlers.length > 0) { 3940 setTimeout(this.runHandlers.bind(this), 0); 3941 return; 3942 } 3943 this.running = false; 3944 }, 3945 addUnhandledRejection: function addUnhandledRejection(promise) { 3946 this.unhandledRejections.push({ 3947 promise: promise, 3948 time: Date.now() 3949 }); 3950 this.scheduleRejectionCheck(); 3951 }, 3952 removeUnhandeledRejection: function removeUnhandeledRejection(promise) { 3953 promise._unhandledRejection = false; 3954 for (var i = 0; i < this.unhandledRejections.length; i++) { 3955 if (this.unhandledRejections[i].promise === promise) { 3956 this.unhandledRejections.splice(i); 3957 i--; 3958 } 3959 } 3960 }, 3961 scheduleRejectionCheck: function scheduleRejectionCheck() { 3962 if (this.pendingRejectionCheck) { 3963 return; 3964 } 3965 this.pendingRejectionCheck = true; 3966 setTimeout(function rejectionCheck() { 3967 this.pendingRejectionCheck = false; 3968 var now = Date.now(); 3969 for (var i = 0; i < this.unhandledRejections.length; i++) { 3970 if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { 3971 var unhandled = this.unhandledRejections[i].promise._value; 3972 var msg = 'Unhandled rejection: ' + unhandled; 3973 if (unhandled.stack) { 3974 msg += '\n' + unhandled.stack; 3975 } 3976 warn(msg); 3977 this.unhandledRejections.splice(i); 3978 i--; 3979 } 3980 } 3981 if (this.unhandledRejections.length) { 3982 this.scheduleRejectionCheck(); 3983 } 3984 }.bind(this), REJECTION_TIMEOUT); 3985 } 3986 }; 3987 var Promise = function Promise(resolver) { 3988 this._status = STATUS_PENDING; 3989 this._handlers = []; 3990 try { 3991 resolver.call(this, this._resolve.bind(this), this._reject.bind(this)); 3992 } catch (e) { 3993 this._reject(e); 3994 } 3995 }; 3996 Promise.all = function Promise_all(promises) { 3997 var resolveAll, rejectAll; 3998 var deferred = new Promise(function (resolve, reject) { 3999 resolveAll = resolve; 4000 rejectAll = reject; 4001 }); 4002 var unresolved = promises.length; 4003 var results = []; 4004 if (unresolved === 0) { 4005 resolveAll(results); 4006 return deferred; 4007 } 4008 function reject(reason) { 4009 if (deferred._status === STATUS_REJECTED) { 4010 return; 4011 } 4012 results = []; 4013 rejectAll(reason); 4014 } 4015 for (var i = 0, ii = promises.length; i < ii; ++i) { 4016 var promise = promises[i]; 4017 var resolve = function (i) { 4018 return function (value) { 4019 if (deferred._status === STATUS_REJECTED) { 4020 return; 4021 } 4022 results[i] = value; 4023 unresolved--; 4024 if (unresolved === 0) { 4025 resolveAll(results); 4026 } 4027 }; 4028 }(i); 4029 if (Promise.isPromise(promise)) { 4030 promise.then(resolve, reject); 4031 } else { 4032 resolve(promise); 4033 } 4034 } 4035 return deferred; 4036 }; 4037 Promise.isPromise = function Promise_isPromise(value) { 4038 return value && typeof value.then === 'function'; 4039 }; 4040 Promise.resolve = function Promise_resolve(value) { 4041 return new Promise(function (resolve) { 4042 resolve(value); 4043 }); 4044 }; 4045 Promise.reject = function Promise_reject(reason) { 4046 return new Promise(function (resolve, reject) { 4047 reject(reason); 4048 }); 4049 }; 4050 Promise.prototype = { 4051 _status: null, 4052 _value: null, 4053 _handlers: null, 4054 _unhandledRejection: null, 4055 _updateStatus: function Promise__updateStatus(status, value) { 4056 if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) { 4057 return; 4058 } 4059 if (status === STATUS_RESOLVED && Promise.isPromise(value)) { 4060 value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED)); 4061 return; 4062 } 4063 this._status = status; 4064 this._value = value; 4065 if (status === STATUS_REJECTED && this._handlers.length === 0) { 4066 this._unhandledRejection = true; 4067 HandlerManager.addUnhandledRejection(this); 4068 } 4069 HandlerManager.scheduleHandlers(this); 4070 }, 4071 _resolve: function Promise_resolve(value) { 4072 this._updateStatus(STATUS_RESOLVED, value); 4073 }, 4074 _reject: function Promise_reject(reason) { 4075 this._updateStatus(STATUS_REJECTED, reason); 4076 }, 4077 then: function Promise_then(onResolve, onReject) { 4078 var nextPromise = new Promise(function (resolve, reject) { 4079 this.resolve = resolve; 4080 this.reject = reject; 4081 }); 4082 this._handlers.push({ 4083 thisPromise: this, 4084 onResolve: onResolve, 4085 onReject: onReject, 4086 nextPromise: nextPromise 4087 }); 4088 HandlerManager.scheduleHandlers(this); 4089 return nextPromise; 4090 },
4091 catch: function Promise_catch(onReject) { 4092 return this.then(undefined, onReject); 4093 } 4094 }; 4095 globalScope.Promise = Promise; 4096 }()); 4097 (function WeakMapClosure() { 4098 if (globalScope.WeakMap) { 4099 return; 4100 } 4101 var id = 0; 4102 function WeakMap() { 4103 this.id = '$weakmap' + id++; 4104 } 4105 WeakMap.prototype = { 4106 has: function (obj) { 4107 return !!Object.getOwnPropertyDescriptor(obj, this.id); 4108 }, 4109 get: function (obj, defaultValue) { 4110 return this.has(obj) ? obj[this.id] : defaultValue; 4111 }, 4112 set: function (obj, value) { 4113 Object.defineProperty(obj, this.id, { 4114 value: value, 4115 enumerable: false, 4116 configurable: true 4117 }); 4118 }, 4119 delete: function (obj) { 4120 delete obj[this.id]; 4121 } 4122 }; 4123 globalScope.WeakMap = WeakMap; 4124 }()); 4125 var StatTimer = function StatTimerClosure() { 4126 function rpad(str, pad, length) { 4127 while (str.length < length) { 4128 str += pad; 4129 } 4130 return str; 4131 } 4132 function StatTimer() { 4133 this.started = Object.create(null); 4134 this.times = []; 4135 this.enabled = true; 4136 } 4137 StatTimer.prototype = { 4138 time: function StatTimer_time(name) { 4139 if (!this.enabled) { 4140 return; 4141 } 4142 if (name in this.started) { 4143 warn('Timer is already running for ' + name); 4144 } 4145 this.started[name] = Date.now(); 4146 }, 4147 timeEnd: function StatTimer_timeEnd(name) { 4148 if (!this.enabled) { 4149 return; 4150 } 4151 if (!(name in this.started)) { 4152 warn('Timer has not been started for ' + name); 4153 } 4154 this.times.push({ 4155 'name': name, 4156 'start': this.started[name], 4157 'end': Date.now() 4158 }); 4159 delete this.started[name]; 4160 }, 4161 toString: function StatTimer_toString() { 4162 var i, ii; 4163 var times = this.times; 4164 var out = ''; 4165 var longest = 0; 4166 for (i = 0, ii = times.length; i < ii; ++i) { 4167 var name = times[i]['name']; 4168 if (name.length > longest) { 4169 longest = name.length; 4170 } 4171 } 4172 for (i = 0, ii = times.length; i < ii; ++i) { 4173 var span = times[i]; 4174 var duration = span.end - span.start; 4175 out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; 4176 } 4177 return out; 4178 } 4179 }; 4180 return StatTimer; 4181 }(); 4182 var createBlob = function createBlob(data, contentType) { 4183 if (typeof Blob !== 'undefined') { 4184 return new Blob([data], { type: contentType }); 4185 } 4186 warn('The "Blob" constructor is not supported.'); 4187 }; 4188 var createObjectURL = function createObjectURLClosure() { 4189 var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 4190 return function createObjectURL(data, contentType, forceDataSchema) { 4191 if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) { 4192 var blob = createBlob(data, contentType); 4193 return URL.createObjectURL(blob); 4194 } 4195 var buffer = 'data:' + contentType + ';base64,'; 4196 for (var i = 0, ii = data.length; i < ii; i += 3) { 4197 var b1 = data[i] & 0xFF; 4198 var b2 = data[i + 1] & 0xFF; 4199 var b3 = data[i + 2] & 0xFF; 4200 var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; 4201 var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; 4202 var d4 = i + 2 < ii ? b3 & 0x3F : 64; 4203 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 4204 } 4205 return buffer; 4206 }; 4207 }(); 4208 function MessageHandler(sourceName, targetName, comObj) { 4209 this.sourceName = sourceName; 4210 this.targetName = targetName; 4211 this.comObj = comObj; 4212 this.callbackIndex = 1; 4213 this.postMessageTransfers = true; 4214 var callbacksCapabilities = this.callbacksCapabilities = Object.create(null); 4215 var ah = this.actionHandler = Object.create(null); 4216 this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) { 4217 var data = event.data; 4218 if (data.targetName !== this.sourceName) { 4219 return; 4220 } 4221 if (data.isReply) { 4222 var callbackId = data.callbackId; 4223 if (data.callbackId in callbacksCapabilities) { 4224 var callback = callbacksCapabilities[callbackId]; 4225 delete callbacksCapabilities[callbackId]; 4226 if ('error' in data) { 4227 callback.reject(data.error); 4228 } else { 4229 callback.resolve(data.data); 4230 } 4231 } else { 4232 error('Cannot resolve callback ' + callbackId); 4233 } 4234 } else if (data.action in ah) { 4235 var action = ah[data.action]; 4236 if (data.callbackId) { 4237 var sourceName = this.sourceName; 4238 var targetName = data.sourceName; 4239 Promise.resolve().then(function () { 4240 return action[0].call(action[1], data.data); 4241 }).then(function (result) { 4242 comObj.postMessage({ 4243 sourceName: sourceName, 4244 targetName: targetName, 4245 isReply: true, 4246 callbackId: data.callbackId, 4247 data: result 4248 }); 4249 }, function (reason) { 4250 if (reason instanceof Error) { 4251 reason = reason + ''; 4252 } 4253 comObj.postMessage({ 4254 sourceName: sourceName, 4255 targetName: targetName, 4256 isReply: true, 4257 callbackId: data.callbackId, 4258 error: reason 4259 }); 4260 }); 4261 } else { 4262 action[0].call(action[1], data.data); 4263 } 4264 } else { 4265 error('Unknown action from worker: ' + data.action); 4266 } 4267 }.bind(this); 4268 comObj.addEventListener('message', this._onComObjOnMessage); 4269 } 4270 MessageHandler.prototype = { 4271 on: function messageHandlerOn(actionName, handler, scope) { 4272 var ah = this.actionHandler; 4273 if (ah[actionName]) { 4274 error('There is already an actionName called "' + actionName + '"'); 4275 } 4276 ah[actionName] = [ 4277 handler, 4278 scope 4279 ]; 4280 }, 4281 send: function messageHandlerSend(actionName, data, transfers) { 4282 var message = { 4283 sourceName: this.sourceName, 4284 targetName: this.targetName, 4285 action: actionName, 4286 data: data 4287 }; 4288 this.postMessage(message, transfers); 4289 },
4290 sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) { 4291 var callbackId = this.callbackIndex++; 4292 var message = { 4293 sourceName: this.sourceName, 4294 targetName: this.targetName, 4295 action: actionName, 4296 data: data, 4297 callbackId: callbackId 4298 }; 4299 var capability = createPromiseCapability(); 4300 this.callbacksCapabilities[callbackId] = capability; 4301 try { 4302 this.postMessage(message, transfers); 4303 } catch (e) { 4304 capability.reject(e); 4305 } 4306 return capability.promise; 4307 }, 4308 postMessage: function (message, transfers) { 4309 if (transfers && this.postMessageTransfers) { 4310 this.comObj.postMessage(message, transfers); 4311 } else { 4312 this.comObj.postMessage(message); 4313 } 4314 }, 4315 destroy: function () { 4316 this.comObj.removeEventListener('message', this._onComObjOnMessage); 4317 } 4318 }; 4319 function loadJpegStream(id, imageUrl, objs) { 4320 var img = new Image(); 4321 img.onload = function loadJpegStream_onloadClosure() { 4322 objs.resolve(id, img); 4323 }; 4324 img.onerror = function loadJpegStream_onerrorClosure() { 4325 objs.resolve(id, null); 4326 warn('Error during JPEG image loading'); 4327 }; 4328 img.src = imageUrl; 4329 } 4330 /* Any copyright is dedicated to the Public Domain. 4331 * http://creativecommons.org/publicdomain/zero/1.0/ */ 4332 (function checkURLConstructor(scope) { 4333 var hasWorkingUrl = false; 4334 try { 4335 if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) { 4336 var u = new URL('b', 'http://a'); 4337 u.pathname = 'c%20d'; 4338 hasWorkingUrl = u.href === 'http://a/c%20d'; 4339 } 4340 } catch (e) { 4341 } 4342 if (hasWorkingUrl) { 4343 return; 4344 } 4345 var relative = Object.create(null); 4346 relative['ftp'] = 21; 4347 relative['file'] = 0; 4348 relative['gopher'] = 70; 4349 relative['http'] = 80; 4350 relative['https'] = 443; 4351 relative['ws'] = 80; 4352 relative['wss'] = 443; 4353 var relativePathDotMapping = Object.create(null); 4354 relativePathDotMapping['%2e'] = '.'; 4355 relativePathDotMapping['.%2e'] = '..'; 4356 relativePathDotMapping['%2e.'] = '..'; 4357 relativePathDotMapping['%2e%2e'] = '..'; 4358 function isRelativeScheme(scheme) { 4359 return relative[scheme] !== undefined; 4360 }
4361 function invalid() { 4362 clear.call(this); 4363 this._isInvalid = true; 4364 } 4365 function IDNAToASCII(h) { 4366 if (h === '') { 4367 invalid.call(this); 4368 } 4369 return h.toLowerCase(); 4370 } 4371 function percentEscape(c) { 4372 var unicode = c.charCodeAt(0); 4373 if (unicode > 0x20 && unicode < 0x7F && [ 4374 0x22, 4375 0x23, 4376 0x3C, 4377 0x3E, 4378 0x3F, 4379 0x60 4380 ].indexOf(unicode) === -1) { 4381 return c; 4382 } 4383 return encodeURIComponent(c); 4384 } 4385 function percentEscapeQuery(c) { 4386 var unicode = c.charCodeAt(0); 4387 if (unicode > 0x20 && unicode < 0x7F && [ 4388 0x22, 4389 0x23, 4390 0x3C, 4391 0x3E, 4392 0x60 4393 ].indexOf(unicode) === -1) { 4394 return c; 4395 } 4396 return encodeURIComponent(c); 4397 } 4398 var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; 4399 function parse(input, stateOverride, base) { 4400 function err(message) { 4401 errors.push(message); 4402 } 4403 var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = []; 4404 loop: 4405 while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) { 4406 var c = input[cursor]; 4407 switch (state) { 4408 case 'scheme start': 4409 if (c && ALPHA.test(c)) { 4410 buffer += c.toLowerCase(); 4411 state = 'scheme'; 4412 } else if (!stateOverride) { 4413 buffer = ''; 4414 state = 'no scheme'; 4415 continue; 4416 } else { 4417 err('Invalid scheme.'); 4418 break loop; 4419 } 4420 break; 4421 case 'scheme': 4422 if (c && ALPHANUMERIC.test(c)) { 4423 buffer += c.toLowerCase(); 4424 } else if (c === ':') { 4425 this._scheme = buffer; 4426 buffer = ''; 4427 if (stateOverride) { 4428 break loop; 4429 } 4430 if (isRelativeScheme(this._scheme)) { 4431 this._isRelative = true; 4432 } 4433 if (this._scheme === 'file') { 4434 state = 'relative'; 4435 } else if (this._isRelative && base && base._scheme === this._scheme) { 4436 state = 'relative or authority'; 4437 } else if (this._isRelative) { 4438 state = 'authority first slash'; 4439 } else { 4440 state = 'scheme data'; 4441 } 4442 } else if (!stateOverride) { 4443 buffer = ''; 4444 cursor = 0; 4445 state = 'no scheme'; 4446 continue; 4447 } else if (EOF === c) { 4448 break loop; 4449 } else { 4450 err('Code point not allowed in scheme: ' + c); 4451 break loop; 4452 } 4453 break; 4454 case 'scheme data': 4455 if (c === '?') { 4456 this._query = '?'; 4457 state = 'query'; 4458 } else if (c === '#') { 4459 this._fragment = '#'; 4460 state = 'fragment'; 4461 } else { 4462 if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { 4463 this._schemeData += percentEscape(c); 4464 } 4465 } 4466 break; 4467 case 'no scheme': 4468 if (!base || !isRelativeScheme(base._scheme)) { 4469 err('Missing scheme.'); 4470 invalid.call(this); 4471 } else { 4472 state = 'relative'; 4473 continue; 4474 } 4475 break; 4476 case 'relative or authority': 4477 if (c === '/' && input[cursor + 1] === '/') { 4478 state = 'authority ignore slashes'; 4479 } else { 4480 err('Expected /, got: ' + c); 4481 state = 'relative'; 4482 continue; 4483 } 4484 break; 4485 case 'relative': 4486 this._isRelative = true; 4487 if ('file' !== this._scheme) { 4488 this._scheme = base._scheme; 4489 } 4490 if (EOF === c) { 4491 this._host = base._host; 4492 this._port = base._port; 4493 this._path = base._path.slice(); 4494 this._query = base._query; 4495 this._username = base._username; 4496 this._password = base._password; 4497 break loop; 4498 } else if (c === '/' || c === '\\') { 4499 if (c === '\\') { 4500 err('\\ is an invalid code point.'); 4501 } 4502 state = 'relative slash'; 4503 } else if (c === '?') { 4504 this._host = base._host; 4505 this._port = base._port; 4506 this._path = base._path.slice(); 4507 this._query = '?'; 4508 this._username = base._username; 4509 this._password = base._password; 4510 state = 'query'; 4511 } else if (c === '#') { 4512 this._host = base._host; 4513 this._port = base._port; 4514 this._path = base._path.slice(); 4515 this._query = base._query; 4516 this._fragment = '#'; 4517 this._username = base._username; 4518 this._password = base._password; 4519 state = 'fragment'; 4520 } else { 4521 var nextC = input[cursor + 1]; 4522 var nextNextC = input[cursor + 2]; 4523 if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) { 4524 this._host = base._host; 4525 this._port = base._port; 4526 this._username = base._username; 4527 this._password = base._password; 4528 this._path = base._path.slice(); 4529 this._path.pop(); 4530 } 4531 state = 'relative path'; 4532 continue; 4533 } 4534 break; 4535 case 'relative slash': 4536 if (c === '/' || c === '\\') { 4537 if (c === '\\') {
4538 err('\\ is an invalid code point.'); 4539 } 4540 if (this._scheme === 'file') { 4541 state = 'file host'; 4542 } else { 4543 state = 'authority ignore slashes'; 4544 } 4545 } else { 4546 if ('file' !== this._scheme) { 4547 this._host = base._host; 4548 this._port = base._port; 4549 this._username = base._username; 4550 this._password = base._password; 4551 } 4552 state = 'relative path'; 4553 continue; 4554 } 4555 break; 4556 case 'authority first slash': 4557 if (c === '/') { 4558 state = 'authority second slash'; 4559 } else { 4560 err('Expected \'/\', got: ' + c); 4561 state = 'authority ignore slashes'; 4562 continue; 4563 } 4564 break; 4565 case 'authority second slash': 4566 state = 'authority ignore slashes'; 4567 if ('/' !== c) { 4568 err('Expected \'/\', got: ' + c); 4569 continue; 4570 } 4571 break; 4572 case 'authority ignore slashes': 4573 if ('/' !== c && '\\' !== c) { 4574 state = 'authority'; 4575 continue; 4576 } else { 4577 err('Expected authority, got: ' + c); 4578 } 4579 break; 4580 case 'authority': 4581 if (c === '@') { 4582 if (seenAt) { 4583 err('@ already seen.'); 4584 buffer += '%40'; 4585 } 4586 seenAt = true; 4587 for (var i = 0; i < buffer.length; i++) { 4588 var cp = buffer[i]; 4589 if (cp === '\t' || cp === '\n' || cp === '\r') { 4590 err('Invalid whitespace in authority.'); 4591 continue; 4592 } 4593 if (cp === ':' && this._password === null) { 4594 this._password = ''; 4595 continue; 4596 } 4597 var tempC = percentEscape(cp); 4598 if (null !== this._password) { 4599 this._password += tempC; 4600 } else { 4601 this._username += tempC; 4602 } 4603 } 4604 buffer = ''; 4605 } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { 4606 cursor -= buffer.length; 4607 buffer = ''; 4608 state = 'host'; 4609 continue; 4610 } else { 4611 buffer += c; 4612 } 4613 break; 4614 case 'file host': 4615 if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { 4616 if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) { 4617 state = 'relative path'; 4618 } else if (buffer.length === 0) { 4619 state = 'relative path start'; 4620 } else { 4621 this._host = IDNAToASCII.call(this, buffer); 4622 buffer = ''; 4623 state = 'relative path start'; 4624 } 4625 continue; 4626 } else if (c === '\t' || c === '\n' || c === '\r') { 4627 err('Invalid whitespace in file host.'); 4628 } else { 4629 buffer += c; 4630 } 4631 break; 4632 case 'host': 4633 case 'hostname': 4634 if (c === ':' && !seenBracket) { 4635 this._host = IDNAToASCII.call(this, buffer); 4636 buffer = ''; 4637 state = 'port'; 4638 if (stateOverride === 'hostname') { 4639 break loop; 4640 } 4641 } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { 4642 this._host = IDNAToASCII.call(this, buffer); 4643 buffer = ''; 4644 state = 'relative path start'; 4645 if (stateOverride) { 4646 break loop; 4647 } 4648 continue; 4649 } else if ('\t' !== c && '\n' !== c && '\r' !== c) { 4650 if (c === '[') { 4651 seenBracket = true; 4652 } else if (c === ']') { 4653 seenBracket = false; 4654 } 4655 buffer += c; 4656 } else { 4657 err('Invalid code point in host/hostname: ' + c); 4658 } 4659 break; 4660 case 'port': 4661 if (/[0-9]/.test(c)) { 4662 buffer += c; 4663 } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) { 4664 if ('' !== buffer) { 4665 var temp = parseInt(buffer, 10); 4666 if (temp !== relative[this._scheme]) { 4667 this._port = temp + ''; 4668 } 4669 buffer = ''; 4670 } 4671 if (stateOverride) { 4672 break loop; 4673 } 4674 state = 'relative path start'; 4675 continue; 4676 } else if (c === '\t' || c === '\n' || c === '\r') { 4677 err('Invalid code point in port: ' + c); 4678 } else { 4679 invalid.call(this); 4680 } 4681 break; 4682 case 'relative path start': 4683 if (c === '\\') { 4684 err('\'\\\' not allowed in path.'); 4685 } 4686 state = 'relative path'; 4687 if ('/' !== c && '\\' !== c) { 4688 continue; 4689 } 4690 break; 4691 case 'relative path': 4692 if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) { 4693 if (c === '\\') { 4694 err('\\ not allowed in relative path.'); 4695 } 4696 var tmp; 4697 if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { 4698 buffer = tmp; 4699 } 4700 if (buffer === '..') { 4701 this._path.pop(); 4702 if ('/' !== c && '\\' !== c) { 4703 this._path.push(''); 4704 } 4705 } else if (buffer === '.' && '/' !== c && '\\' !== c) { 4706 this._path.push(''); 4707 } else if ('.' !== buffer) { 4708 if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') { 4709 buffer = buffer[0] + ':'; 4710 } 4711 this._path.push(buffer); 4712 } 4713 buffer = ''; 4714 if (c === '?') { 4715 this._query = '?'; 4716 state = 'query'; 4717 } else if (c === '#') { 4718 this._fragment = '#'; 4719 state = 'fragment'; 4720 } 4721 } else if ('\t' !== c && '\n' !== c && '\r' !== c) { 4722 buffer += percentEscape(c); 4723 } 4724 break; 4725 case 'query': 4726 if (!stateOverride && c === '#') { 4727 this._fragment = '#'; 4728 state = 'fragment'; 4729 }
4729 else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { 4730 this._query += percentEscapeQuery(c); 4731 } 4732 break; 4733 case 'fragment': 4734 if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { 4735 this._fragment += c; 4736 } 4737 break; 4738 } 4739 cursor++; 4740 } 4741 } 4742 function clear() { 4743 this._scheme = ''; 4744 this._schemeData = ''; 4745 this._username = ''; 4746 this._password = null; 4747 this._host = ''; 4748 this._port = ''; 4749 this._path = []; 4750 this._query = ''; 4751 this._fragment = ''; 4752 this._isInvalid = false; 4753 this._isRelative = false; 4754 } 4755 function JURL(url, base) 4756 { 4757 if (base !== undefined && !(base instanceof JURL)) { 4758 base = new JURL(String(base)); 4759 } 4760 this._url = url; 4761 clear.call(this); 4762 var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, ''); 4763 parse.call(this, input, null, base); 4764 } 4765 JURL.prototype = { 4766 toString: function () { 4767 return this.href; 4768 }, 4769 get href() { 4770 if (this._isInvalid) { 4771 return this._url; 4772 } 4773 var authority = ''; 4774 if ('' !== this._username || null !== this._password) { 4775 authority = this._username + (null !== this._password ? ':' + this._password : '') + '@'; 4776 } 4777 return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment; 4778 }, 4779 set href(href) { 4780 clear.call(this); 4781 parse.call(this, href); 4782 }, 4783 get protocol() { 4784 return this._scheme + ':'; 4785 }, 4786 set protocol(protocol) { 4787 if (this._isInvalid) { 4788 return; 4789 } 4790 parse.call(this, protocol + ':', 'scheme start'); 4791 }, 4792 get host() { 4793 return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host; 4794 }, 4795 set host(host) { 4796 if (this._isInvalid || !this._isRelative) { 4797 return; 4798 } 4799 parse.call(this, host, 'host'); 4800 }, 4801 get hostname() { 4802 return this._host; 4803 }, 4804 set hostname(hostname) { 4805 if (this._isInvalid || !this._isRelative) { 4806 return; 4807 } 4808 parse.call(this, hostname, 'hostname'); 4809 }, 4810 get port() { 4811 return this._port; 4812 }, 4813 set port(port) { 4814 if (this._isInvalid || !this._isRelative) { 4815 return; 4816 } 4817 parse.call(this, port, 'port'); 4818 }, 4819 get pathname() { 4820 return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData; 4821 }, 4822 set pathname(pathname) { 4823 if (this._isInvalid || !this._isRelative) { 4824 return; 4825 } 4826 this._path = []; 4827 parse.call(this, pathname, 'relative path start'); 4828 }, 4829 get search() { 4830 return this._isInvalid || !this._query || this._query === '?' ? '' : this._query; 4831 }, 4832 set search(search) { 4833 if (this._isInvalid || !this._isRelative) { 4834 return; 4835 } 4836 this._query = '?'; 4837 if (search[0] === '?') { 4838 search = search.slice(1); 4839 } 4840 parse.call(this, search, 'query'); 4841 }, 4842 get hash() { 4843 return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment; 4844 }, 4845 set hash(hash) { 4846 if (this._isInvalid) { 4847 return; 4848 } 4849 this._fragment = '#'; 4850 if (hash[0] === '#') { 4851 hash = hash.slice(1); 4852 } 4853 parse.call(this, hash, 'fragment'); 4854 }, 4855 get origin() { 4856 var host; 4857 if (this._isInvalid || !this._scheme) { 4858 return ''; 4859 } 4860 switch (this._scheme) { 4861 case 'data': 4862 case 'file': 4863 case 'javascript': 4864 case 'mailto': 4865 return 'null'; 4866 } 4867 host = this.host; 4868 if (!host) { 4869 return ''; 4870 } 4871 return this._scheme + '://' + host; 4872 } 4873 }; 4874 var OriginalURL = scope.URL; 4875 if (OriginalURL) { 4876 JURL.createObjectURL = function (blob) { 4877 return OriginalURL.createObjectURL.apply(OriginalURL, arguments); 4878 }; 4879 JURL.revokeObjectURL = function (url) { 4880 OriginalURL.revokeObjectURL(url); 4881 }; 4882 } 4883 scope.URL = JURL; 4884 }(globalScope)); 4885 exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 4886 exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 4887 exports.OPS = OPS; 4888 exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS; 4889 exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 4890 exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 4891 exports.AnnotationFieldFlag = AnnotationFieldFlag; 4892 exports.AnnotationFlag = AnnotationFlag; 4893 exports.AnnotationType = AnnotationType; 4894 exports.FontType = FontType; 4895 exports.ImageKind = ImageKind; 4896 exports.InvalidPDFException = InvalidPDFException; 4897 exports.MessageHandler = MessageHandler; 4898 exports.MissingDataException = MissingDataException; 4899 exports.MissingPDFException = MissingPDFException; 4900 exports.NotImplementedException = NotImplementedException; 4901 exports.PageViewport = PageViewport; 4902 exports.PasswordException = PasswordException; 4903 exports.PasswordResponses = PasswordResponses; 4904 exports.StatTimer = StatTimer; 4905 exports.StreamType = StreamType; 4906 exports.TextRenderingMode = TextRenderingMode; 4907 exports.UnexpectedResponseException = UnexpectedResponseException; 4908 exports.UnknownErrorException = UnknownErrorException; 4909 exports.Util = Util; 4910 exports.XRefParseException = XRefParseException; 4911 exports.arrayByteLength = arrayByteLength; 4912 exports.arraysToBytes = arraysToBytes; 4913 exports.assert = assert; 4914 exports.bytesToString = bytesToString; 4915 exports.createBlob = createBlob; 4916 exports.createPromiseCapability = createPromiseCapability; 4917 exports.createObjectURL = createObjectURL; 4918 exports.deprecated = deprecated; 4919 exports.error = error; 4920 exports.getLookupTableFactory = getLookupTableFactory; 4921 exports.getVerbosityLevel = getVerbosityLevel; 4922 exports.globalScope = globalScope; 4923 exports.info = info; 4924 exports.isArray = isArray; 4925 exports.isArrayBuffer = isArrayBuffer; 4926 exports.isBool = isBool; 4927 exports.isEmptyObj = isEmptyObj; 4928 exports.isInt = isInt; 4929 exports.isNum = isNum; 4930 exports.isString = isString; 4931 exports.isSpace = isSpace; 4932 exports.isSameOrigin = isSameOrigin; 4933 exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 4934 exports.isLittleEndian = isLittleEndian; 4935 exports.isEvalSupported = isEvalSupported; 4936 exports.loadJpegStream = loadJpegStream; 4937 exports.log2 = log2; 4938 exports.readInt8 = readInt8; 4939 exports.readUint16 = readUint16; 4940 exports.readUint32 = readUint32; 4941 exports.removeNullCharacters = removeNullCharacters; 4942 exports.setVerbosityLevel = setVerbosityLevel; 4943 exports.shadow = shadow; 4944 exports.string32 = string32; 4945 exports.stringToBytes = stringToBytes; 4946 exports.stringToPDFString = stringToPDFString; 4947 exports.stringToUTF8String = stringToUTF8String; 4948 exports.utf8StringToString = utf8StringToString; 4949 exports.warn = warn; 4950 })); 4951 (function (root, factory) { 4952 factory(root.pdfjsCoreBidi = {}, root.pdfjsSharedUtil); 4953 }(this, function (exports, sharedUtil) { 4954 var warn = sharedUtil.warn; 4955 var baseTypes = [ 4956 'BN', 4957 'BN', 4958 'BN', 4959 'BN', 4960 'BN', 4961 'BN', 4962 'BN', 4963 'BN', 4964 'BN', 4965 'S', 4966 'B', 4967 'S', 4968 'WS', 4969 'B', 4970 'BN', 4971 'BN', 4972 'BN', 4973 'BN', 4974 'BN', 4975 'BN', 4976 'BN', 4977 'BN', 4978 'BN', 4979 'BN', 4980 'BN', 4981 'BN', 4982 'BN', 4983 'BN', 4984 'B', 4985 'B', 4986 'B', 4987 'S', 4988 'WS', 4989 'ON', 4990 'ON', 4991 'ET', 4992 'ET', 4993 'ET', 4994 'ON', 4995 'ON', 4996 'ON', 4997 'ON', 4998 'ON', 4999 'ES', 5000 'CS', 5001 'ES', 5002 'CS', 5003 'CS', 5004 'EN', 5005 'EN', 5006 'EN', 5007 'EN', 5008 'EN', 5009 'EN', 5010 'EN', 5011 'EN', 5012 'EN', 5013 'EN', 5014 'CS', 5015 'ON', 5016 'ON', 5017 'ON', 5018 'ON', 5019 'ON', 5020 'ON', 5021 'L', 5022 'L', 5023 'L', 5024 'L', 5025 'L', 5026 'L', 5027 'L', 5028 'L', 5029 'L', 5030 'L', 5031 'L', 5032 'L', 5033 'L', 5034 'L', 5035 'L', 5036 'L', 5037 'L', 5038 'L', 5039 'L', 5040 'L', 5041 'L', 5042 'L', 5043 'L', 5044 'L', 5045 'L', 5046 'L', 5047 'ON', 5048 'ON', 5049 'ON', 5050 'ON', 5051 'ON', 5052 'ON', 5053 'L', 5054 'L', 5055 'L', 5056 'L', 5057 'L', 5058 'L', 5059 'L', 5060 'L', 5061 'L', 5062 'L', 5063 'L', 5064 'L', 5065 'L', 5066 'L', 5067 'L', 5068 'L', 5069 'L', 5070 'L', 5071 'L', 5072 'L', 5073 'L', 5074 'L', 5075 'L', 5076 'L', 5077 'L', 5078 'L', 5079 'ON', 5080 'ON', 5081 'ON', 5082 'ON', 5083 'BN', 5084 'BN', 5085 'BN', 5086 'BN', 5087 'BN', 5088 'BN', 5089 'B', 5090 'BN', 5091 'BN', 5092 'BN', 5093 'BN', 5094 'BN', 5095 'BN', 5096 'BN', 5097 'BN', 5098 'BN', 5099 'BN', 5100 'BN', 5101 'BN', 5102 'BN', 5103 'BN', 5104 'BN', 5105 'BN', 5106 'BN', 5107 'BN', 5108 'BN', 5109 'BN', 5110 'BN', 5111 'BN', 5112 'BN', 5113 'BN', 5114 'BN', 5115 'BN', 5116 'CS', 5117 'ON', 5118 'ET', 5119 'ET', 5120 'ET', 5121 'ET', 5122 'ON', 5123 'ON', 5124 'ON', 5125 'ON', 5126 'L', 5127 'ON', 5128 'ON', 5129 'BN', 5130 'ON', 5131 'ON', 5132 'ET', 5133 'ET', 5134 'EN', 5135 'EN', 5136 'ON', 5137 'L', 5138 'ON', 5139 'ON', 5140 'ON', 5141 'EN', 5142 'L', 5143 'ON', 5144 'ON', 5145 'ON', 5146 'ON', 5147 'ON', 5148 'L', 5149 'L', 5150 'L', 5151 'L', 5152 'L', 5153 'L', 5154 'L', 5155 'L', 5156 'L', 5157 'L', 5158 'L', 5159 'L', 5160 'L', 5161 'L', 5162 'L', 5163 'L', 5164 'L', 5165 'L', 5166 'L', 5167 'L', 5168 'L', 5169 'L', 5170 'L', 5171 'ON', 5172 'L', 5173 'L', 5174 'L', 5175 'L', 5176 'L', 5177 'L', 5178 'L', 5179 'L', 5180 'L', 5181 'L', 5182 'L', 5183 'L', 5184 'L', 5185 'L', 5186 'L', 5187 'L', 5188 'L', 5189 'L', 5190 'L', 5191 'L', 5192 'L', 5193 'L', 5194 'L', 5195 'L', 5196 'L', 5197 'L', 5198 'L', 5199 'L', 5200 'L', 5201 'L', 5202 'L', 5203 'ON', 5204 'L', 5205 'L', 5206 'L', 5207 'L', 5208 'L', 5209 'L', 5210 'L', 5211 'L'
5212 ]; 5213 var arabicTypes = [ 5214 'AN', 5215 'AN', 5216 'AN', 5217 'AN', 5218 'AN', 5219 'AN', 5220 'ON', 5221 'ON', 5222 'AL', 5223 'ET', 5224 'ET', 5225 'AL', 5226 'CS', 5227 'AL', 5228 'ON', 5229 'ON', 5230 'NSM', 5231 'NSM', 5232 'NSM', 5233 'NSM', 5234 'NSM', 5235 'NSM', 5236 'NSM', 5237 'NSM', 5238 'NSM', 5239 'NSM', 5240 'NSM', 5241 'AL', 5242 'AL', 5243 '', 5244 'AL', 5245 'AL', 5246 'AL', 5247 'AL', 5248 'AL', 5249 'AL', 5250 'AL', 5251 'AL', 5252 'AL', 5253 'AL', 5254 'AL', 5255 'AL', 5256 'AL', 5257 'AL', 5258 'AL', 5259 'AL', 5260 'AL', 5261 'AL', 5262 'AL', 5263 'AL', 5264 'AL', 5265 'AL', 5266 'AL', 5267 'AL', 5268 'AL', 5269 'AL', 5270 'AL', 5271 'AL', 5272 'AL', 5273 'AL', 5274 'AL', 5275 'AL', 5276 'AL', 5277 'AL', 5278 'AL', 5279 'AL', 5280 'AL', 5281 'AL', 5282 'AL', 5283 'AL', 5284 'AL', 5285 'AL', 5286 'AL', 5287 'AL', 5288 'AL', 5289 'NSM', 5290 'NSM', 5291 'NSM', 5292 'NSM', 5293 'NSM', 5294 'NSM', 5295 'NSM', 5296 'NSM', 5297 'NSM', 5298 'NSM', 5299 'NSM', 5300 'NSM', 5301 'NSM', 5302 'NSM', 5303 'NSM', 5304 'NSM', 5305 'NSM', 5306 'NSM', 5307 'NSM', 5308 'NSM', 5309 'NSM', 5310 'AN', 5311 'AN', 5312 'AN', 5313 'AN', 5314 'AN', 5315 'AN', 5316 'AN', 5317 'AN', 5318 'AN', 5319 'AN', 5320 'ET', 5321 'AN', 5322 'AN', 5323 'AL', 5324 'AL', 5325 'AL', 5326 'NSM', 5327 'AL', 5328 'AL', 5329 'AL', 5330 'AL', 5331 'AL', 5332 'AL', 5333 'AL', 5334 'AL', 5335 'AL', 5336 'AL', 5337 'AL', 5338 'AL', 5339 'AL', 5340 'AL', 5341 'AL', 5342 'AL', 5343 'AL', 5344 'AL', 5345 'AL', 5346 'AL', 5347 'AL', 5348 'AL', 5349 'AL', 5350 'AL', 5351 'AL', 5352 'AL', 5353 'AL', 5354 'AL', 5355 'AL', 5356 'AL', 5357 'AL', 5358 'AL', 5359 'AL', 5360 'AL', 5361 'AL', 5362 'AL', 5363 'AL', 5364 'AL', 5365 'AL', 5366 'AL', 5367 'AL', 5368 'AL', 5369 'AL', 5370 'AL', 5371 'AL', 5372 'AL', 5373 'AL', 5374 'AL', 5375 'AL', 5376 'AL', 5377 'AL', 5378 'AL', 5379 'AL', 5380 'AL', 5381 'AL', 5382 'AL', 5383 'AL', 5384 'AL', 5385 'AL', 5386 'AL', 5387 'AL', 5388 'AL', 5389 'AL', 5390 'AL', 5391 'AL', 5392 'AL', 5393 'AL', 5394 'AL', 5395 'AL', 5396 'AL', 5397 'AL', 5398 'AL', 5399 'AL', 5400 'AL', 5401 'AL', 5402 'AL', 5403 'AL', 5404 'AL', 5405 'AL', 5406 'AL', 5407 'AL', 5408 'AL', 5409 'AL', 5410 'AL', 5411 'AL', 5412 'AL', 5413 'AL', 5414 'AL', 5415 'AL', 5416 'AL', 5417 'AL', 5418 'AL', 5419 'AL', 5420 'AL', 5421 'AL', 5422 'AL', 5423 'AL', 5424 'AL', 5425 'AL', 5426 'AL', 5427 'AL', 5428 'NSM', 5429 'NSM', 5430 'NSM', 5431 'NSM', 5432 'NSM', 5433 'NSM', 5434 'NSM', 5435 'AN', 5436 'ON', 5437 'NSM', 5438 'NSM', 5439 'NSM', 5440 'NSM', 5441 'NSM', 5442 'NSM', 5443 'AL', 5444 'AL', 5445 'NSM', 5446 'NSM', 5447 'ON', 5448 'NSM', 5449 'NSM', 5450 'NSM', 5451 'NSM', 5452 'AL', 5453 'AL', 5454 'EN', 5455 'EN', 5456 'EN', 5457 'EN', 5458 'EN', 5459 'EN', 5460 'EN', 5461 'EN', 5462 'EN', 5463 'EN', 5464 'AL', 5465 'AL', 5466 'AL', 5467 'AL', 5468 'AL', 5469 'AL' 5470 ]; 5471 function isOdd(i) { 5472 return (i & 1) !== 0; 5473 } 5474 function isEven(i) { 5475 return (i & 1) === 0; 5476 } 5477 function findUnequal(arr, start, value) { 5478 for (var j = start, jj = arr.length; j < jj; ++j) { 5479 if (arr[j] !== value) { 5480 return j; 5481 } 5482 } 5483 return j; 5484 } 5485 function setValues(arr, start, end, value) { 5486 for (var j = start; j < end; ++j) { 5487 arr[j] = value; 5488 } 5489 } 5490 function reverseValues(arr, start, end) { 5491 for (var i = start, j = end - 1; i < j; ++i, --j) { 5492 var temp = arr[i]; 5493 arr[i] = arr[j]; 5494 arr[j] = temp; 5495 } 5496 } 5497 function createBidiText(str, isLTR, vertical) { 5498 return { 5499 str: str, 5500 dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl' 5501 }; 5502 } 5503 var chars = []; 5504 var types = []; 5505 function bidi(str, startLevel, vertical) { 5506 var isLTR = true; 5507 var strLength = str.length; 5508 if (strLength === 0 || vertical) { 5509 return createBidiText(str, isLTR, vertical); 5510 } 5511 chars.length = strLength; 5512 types.length = strLength; 5513 var numBidi = 0; 5514 var i, ii; 5515 for (i = 0; i < strLength; ++i) { 5516 chars[i] = str.charAt(i); 5517 var charCode = str.charCodeAt(i); 5518 var charType = 'L'; 5519 if (charCode <= 0x00ff) { 5520 charType = baseTypes[charCode]; 5521 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 5522 charType = 'R'; 5523 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 5524 charType = arabicTypes[charCode & 0xff]; 5525 if (!charType) {
5526 warn('Bidi: invalid Unicode character ' + charCode.toString(16)); 5527 } 5528 } else if (0x0700 <= charCode && charCode <= 0x08AC) { 5529 charType = 'AL'; 5530 } 5531 if (charType === 'R' || charType === 'AL' || charType === 'AN') { 5532 numBidi++; 5533 } 5534 types[i] = charType; 5535 } 5536 if (numBidi === 0) { 5537 isLTR = true; 5538 return createBidiText(str, isLTR); 5539 } 5540 if (startLevel === -1) { 5541 if (numBidi / strLength < 0.3) { 5542 isLTR = true; 5543 startLevel = 0; 5544 } else { 5545 isLTR = false; 5546 startLevel = 1; 5547 } 5548 } 5549 var levels = []; 5550 for (i = 0; i < strLength; ++i) { 5551 levels[i] = startLevel; 5552 } 5553 var e = isOdd(startLevel) ? 'R' : 'L'; 5554 var sor = e; 5555 var eor = sor; 5556 var lastType = sor; 5557 for (i = 0; i < strLength; ++i) { 5558 if (types[i] === 'NSM') { 5559 types[i] = lastType; 5560 } else { 5561 lastType = types[i]; 5562 } 5563 } 5564 lastType = sor; 5565 var t; 5566 for (i = 0; i < strLength; ++i) { 5567 t = types[i]; 5568 if (t === 'EN') { 5569 types[i] = lastType === 'AL' ? 'AN' : 'EN'; 5570 } else if (t === 'R' || t === 'L' || t === 'AL') { 5571 lastType = t; 5572 } 5573 } 5574 for (i = 0; i < strLength; ++i) { 5575 t = types[i]; 5576 if (t === 'AL') { 5577 types[i] = 'R'; 5578 } 5579 } 5580 for (i = 1; i < strLength - 1; ++i) { 5581 if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') { 5582 types[i] = 'EN'; 5583 } 5584 if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) { 5585 types[i] = types[i - 1]; 5586 } 5587 } 5588 for (i = 0; i < strLength; ++i) { 5589 if (types[i] === 'EN') { 5590 var j; 5591 for (j = i - 1; j >= 0; --j) { 5592 if (types[j] !== 'ET') { 5593 break; 5594 } 5595 types[j] = 'EN'; 5596 } 5597 for (j = i + 1; j < strLength; ++j) { 5598 if (types[j] !== 'ET') { 5599 break; 5600 } 5601 types[j] = 'EN'; 5602 } 5603 } 5604 } 5605 for (i = 0; i < strLength; ++i) { 5606 t = types[i]; 5607 if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') { 5608 types[i] = 'ON'; 5609 } 5610 } 5611 lastType = sor; 5612 for (i = 0; i < strLength; ++i) { 5613 t = types[i]; 5614 if (t === 'EN') { 5615 types[i] = lastType === 'L' ? 'L' : 'EN'; 5616 } else if (t === 'R' || t === 'L') { 5617 lastType = t; 5618 } 5619 } 5620 for (i = 0; i < strLength; ++i) { 5621 if (types[i] === 'ON') { 5622 var end = findUnequal(types, i + 1, 'ON'); 5623 var before = sor; 5624 if (i > 0) { 5625 before = types[i - 1]; 5626 } 5627 var after = eor; 5628 if (end + 1 < strLength) { 5629 after = types[end + 1]; 5630 } 5631 if (before !== 'L') { 5632 before = 'R'; 5633 } 5634 if (after !== 'L') { 5635 after = 'R'; 5636 } 5637 if (before === after) { 5638 setValues(types, i, end, before); 5639 } 5640 i = end - 1; 5641 } 5642 } 5643 for (i = 0; i < strLength; ++i) { 5644 if (types[i] === 'ON') { 5645 types[i] = e; 5646 } 5647 } 5648 for (i = 0; i < strLength; ++i) { 5649 t = types[i]; 5650 if (isEven(levels[i])) { 5651 if (t === 'R') { 5652 levels[i] += 1; 5653 } else if (t === 'AN' || t === 'EN') { 5654 levels[i] += 2; 5655 } 5656 } else { 5657 if (t === 'L' || t === 'AN' || t === 'EN') { 5658 levels[i] += 1; 5659 } 5660 } 5661 } 5662 var highestLevel = -1; 5663 var lowestOddLevel = 99; 5664 var level; 5665 for (i = 0, ii = levels.length; i < ii; ++i) { 5666 level = levels[i]; 5667 if (highestLevel < level) { 5668 highestLevel = level; 5669 } 5670 if (lowestOddLevel > level && isOdd(level)) { 5671 lowestOddLevel = level; 5672 } 5673 } 5674 for (level = highestLevel; level >= lowestOddLevel; --level) { 5675 var start = -1; 5676 for (i = 0, ii = levels.length; i < ii; ++i) { 5677 if (levels[i] < level) { 5678 if (start >= 0) { 5679 reverseValues(chars, start, i); 5680 start = -1; 5681 } 5682 } else if (start < 0) { 5683 start = i; 5684 } 5685 } 5686 if (start >= 0) { 5687 reverseValues(chars, start, levels.length); 5688 } 5689 } 5690 for (i = 0, ii = chars.length; i < ii; ++i) { 5691 var ch = chars[i]; 5692 if (ch === '<' || ch === '>') { 5693 chars[i] = ''; 5694 } 5695 } 5696 return createBidiText(chars.join(''), isLTR); 5697 } 5698 exports.bidi = bidi; 5699 })); 5700 (function (root, factory) { 5701 factory(root.pdfjsCoreCFFParser = {}, root.pdfjsSharedUtil, root.pdfjsCoreCharsets, root.pdfjsCoreEncodings); 5702 }(this, function (exports, sharedUtil, coreCharsets, coreEncodings) { 5703 var error = sharedUtil.error; 5704 var info = sharedUtil.info; 5705 var bytesToString = sharedUtil.bytesToString; 5706 var warn = sharedUtil.warn; 5707 var isArray = sharedUtil.isArray; 5708 var Util = sharedUtil.Util; 5709 var stringToBytes = sharedUtil.stringToBytes; 5710 var assert = sharedUtil.assert; 5711 var ISOAdobeCharset = coreCharsets.ISOAdobeCharset; 5712 var ExpertCharset = coreCharsets.ExpertCharset; 5713 var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset; 5714 var StandardEncoding = coreEncodings.StandardEncoding; 5715 var ExpertEncoding = coreEncodings.ExpertEncoding; 5716 var MAX_SUBR_NESTING = 10; 5717 var CFFStandardStrings = [ 5718 '.notdef', 5719 'space', 5720 'exclam', 5721 'quotedbl', 5722 'numbersign', 5723 'dollar', 5724 'percent', 5725 'ampersand', 5726 'quoteright', 5727 'parenleft', 5728 'parenright', 5729 'asterisk', 5730 'plus', 5731 'comma', 5732 'hyphen', 5733 'period', 5734 'slash', 5735 'zero', 5736 'one', 5737 'two', 5738 'three', 5739 'four', 5740 'five', 5741 'six', 5742 'seven', 5743 'eight', 5744 'nine', 5745 'colon', 5746 'semicolon', 5747 'less', 5748 'equal', 5749 'greater', 5750 'question', 5751 'at', 5752 'A', 5753 'B', 5754 'C', 5755 'D', 5756 'E', 5757 'F', 5758 'G', 5759 'H', 5760 'I', 5761 'J', 5762 'K', 5763 'L', 5764 'M', 5765 'N', 5766 'O', 5767 'P', 5768 'Q', 5769 'R', 5770 'S', 5771 'T', 5772 'U', 5773 'V', 5774 'W', 5775 'X', 5776 'Y', 5777 'Z', 5778 'bracketleft', 5779 'backslash', 5780 'bracketright', 5781 'asciicircum', 5782 'underscore', 5783 'quoteleft', 5784 'a', 5785 'b', 5786 'c', 5787 'd', 5788 'e', 5789 'f', 5790 'g', 5791 'h', 5792 'i', 5793 'j', 5794 'k', 5795 'l', 5796 'm', 5797 'n', 5798 'o', 5799 'p', 5800 'q', 5801 'r', 5802 's', 5803 't', 5804 'u', 5805 'v', 5806 'w', 5807 'x', 5808 'y', 5809 'z', 5810 'braceleft', 5811 'bar', 5812 'braceright', 5813 'asciitilde', 5814 'exclamdown', 5815 'cent', 5816 'sterling', 5817 'fraction', 5818 'yen', 5819 'florin', 5820 'section', 5821 'currency', 5822 'quotesingle', 5823 'quotedblleft', 5824 'guillemotleft', 5825 'guilsinglleft', 5826 'guilsinglright', 5827 'fi', 5828 'fl', 5829 'endash', 5830 'dagger', 5831 'daggerdbl',
5832 'periodcentered', 5833 'paragraph', 5834 'bullet', 5835 'quotesinglbase', 5836 'quotedblbase', 5837 'quotedblright', 5838 'guillemotright', 5839 'ellipsis', 5840 'perthousand', 5841 'questiondown', 5842 'grave', 5843 'acute', 5844 'circumflex', 5845 'tilde', 5846 'macron', 5847 'breve', 5848 'dotaccent', 5849 'dieresis', 5850 'ring', 5851 'cedilla', 5852 'hungarumlaut', 5853 'ogonek', 5854 'caron', 5855 'emdash', 5856 'AE', 5857 'ordfeminine', 5858 'Lslash', 5859 'Oslash', 5860 'OE', 5861 'ordmasculine', 5862 'ae', 5863 'dotlessi', 5864 'lslash', 5865 'oslash', 5866 'oe', 5867 'germandbls', 5868 'onesuperior', 5869 'logicalnot', 5870 'mu', 5871 'trademark', 5872 'Eth', 5873 'onehalf', 5874 'plusminus', 5875 'Thorn', 5876 'onequarter', 5877 'divide', 5878 'brokenbar', 5879 'degree', 5880 'thorn', 5881 'threequarters', 5882 'twosuperior', 5883 'registered', 5884 'minus', 5885 'eth', 5886 'multiply', 5887 'threesuperior', 5888 'copyright', 5889 'Aacute', 5890 'Acircumflex', 5891 'Adieresis', 5892 'Agrave', 5893 'Aring', 5894 'Atilde', 5895 'Ccedilla', 5896 'Eacute', 5897 'Ecircumflex', 5898 'Edieresis', 5899 'Egrave', 5900 'Iacute', 5901 'Icircumflex', 5902 'Idieresis', 5903 'Igrave', 5904 'Ntilde', 5905 'Oacute', 5906 'Ocircumflex', 5907 'Odieresis', 5908 'Ograve', 5909 'Otilde', 5910 'Scaron', 5911 'Uacute', 5912 'Ucircumflex', 5913 'Udieresis', 5914 'Ugrave', 5915 'Yacute', 5916 'Ydieresis', 5917 'Zcaron', 5918 'aacute', 5919 'acircumflex', 5920 'adieresis', 5921 'agrave', 5922 'aring', 5923 'atilde', 5924 'ccedilla', 5925 'eacute', 5926 'ecircumflex', 5927 'edieresis', 5928 'egrave', 5929 'iacute', 5930 'icircumflex', 5931 'idieresis', 5932 'igrave', 5933 'ntilde', 5934 'oacute', 5935 'ocircumflex', 5936 'odieresis', 5937 'ograve', 5938 'otilde', 5939 'scaron', 5940 'uacute', 5941 'ucircumflex', 5942 'udieresis', 5943 'ugrave', 5944 'yacute', 5945 'ydieresis', 5946 'zcaron', 5947 'exclamsmall', 5948 'Hungarumlautsmall', 5949 'dollaroldstyle', 5950 'dollarsuperior', 5951 'ampersandsmall', 5952 'Acutesmall', 5953 'parenleftsuperior', 5954 'parenrightsuperior', 5955 'twodotenleader', 5956 'onedotenleader', 5957 'zerooldstyle', 5958 'oneoldstyle', 5959 'twooldstyle', 5960 'threeoldstyle', 5961 'fouroldstyle', 5962 'fiveoldstyle', 5963 'sixoldstyle', 5964 'sevenoldstyle', 5965 'eightoldstyle', 5966 'nineoldstyle', 5967 'commasuperior', 5968 'threequartersemdash', 5969 'periodsuperior', 5970 'questionsmall', 5971 'asuperior', 5972 'bsuperior', 5973 'centsuperior', 5974 'dsuperior', 5975 'esuperior', 5976 'isuperior', 5977 'lsuperior', 5978 'msuperior', 5979 'nsuperior', 5980 'osuperior', 5981 'rsuperior', 5982 'ssuperior', 5983 'tsuperior', 5984 'ff', 5985 'ffi', 5986 'ffl', 5987 'parenleftinferior', 5988 'parenrightinferior', 5989 'Circumflexsmall', 5990 'hyphensuperior', 5991 'Gravesmall', 5992 'Asmall', 5993 'Bsmall', 5994 'Csmall', 5995 'Dsmall', 5996 'Esmall', 5997 'Fsmall', 5998 'Gsmall', 5999 'Hsmall', 6000 'Ismall', 6001 'Jsmall', 6002 'Ksmall', 6003 'Lsmall', 6004 'Msmall', 6005 'Nsmall', 6006 'Osmall', 6007 'Psmall', 6008 'Qsmall', 6009 'Rsmall', 6010 'Ssmall', 6011 'Tsmall', 6012 'Usmall', 6013 'Vsmall', 6014 'Wsmall', 6015 'Xsmall', 6016 'Ysmall', 6017 'Zsmall', 6018 'colonmonetary', 6019 'onefitted', 6020 'rupiah', 6021 'Tildesmall', 6022 'exclamdownsmall', 6023 'centoldstyle', 6024 'Lslashsmall', 6025 'Scaronsmall', 6026 'Zcaronsmall', 6027 'Dieresissmall', 6028 'Brevesmall', 6029 'Caronsmall', 6030 'Dotaccentsmall', 6031 'Macronsmall', 6032 'figuredash', 6033 'hypheninferior', 6034 'Ogoneksmall', 6035 'Ringsmall', 6036 'Cedillasmall', 6037 'questiondownsmall', 6038 'oneeighth', 6039 'threeeighths', 6040 'fiveeighths', 6041 'seveneighths', 6042 'onethird', 6043 'twothirds', 6044 'zerosuperior', 6045 'foursuperior', 6046 'fivesuperior', 6047 'sixsuperior', 6048 'sevensuperior', 6049 'eightsuperior', 6050 'ninesuperior', 6051 'zeroinferior', 6052 'oneinferior', 6053 'twoinferior', 6054 'threeinferior', 6055 'fourinferior', 6056 'fiveinferior', 6057 'sixinferior', 6058 'seveninferior', 6059 'eightinferior', 6060 'nineinferior', 6061 'centinferior', 6062 'dollarinferior', 6063 'periodinferior', 6064 'commainferior', 6065 'Agravesmall', 6066 'Aacutesmall', 6067 'Acircumflexsmall', 6068 'Atildesmall', 6069 'Adieresissmall', 6070 'Aringsmall', 6071 'AEsmall', 6072 'Ccedillasmall', 6073 'Egravesmall', 6074 'Eacutesmall', 6075 'Ecircumflexsmall', 6076 'Edieresissmall', 6077 'Igravesmall', 6078 'Iacutesmall', 6079 'Icircumflexsmall', 6080 'Idieresissmall', 6081 'Ethsmall', 6082 'Ntildesmall', 6083 'Ogravesmall', 6084 'Oacutesmall', 6085 'Ocircumflexsmall', 6086 'Otildesmall', 6087 'Odieresissmall', 6088 'OEsmall', 6089 'Oslashsmall', 6090 'Ugravesmall', 6091 'Uacutesmall', 6092 'Ucircumflexsmall', 6093 'Udieresissmall', 6094 'Yacutesmall', 6095 'Thornsmall', 6096 'Ydieresissmall', 6097 '001.000', 6098 '001.001', 6099 '001.002', 6100 '001.003', 6101 'Black', 6102 'Bold', 6103 'Book', 6104 'Light', 6105 'Medium', 6106 'Regular', 6107 'Roman', 6108 'Semibold' 6109 ]; 6110 var CFFParser = function CFFParserClosure() { 6111 var CharstringValidationData = [ 6112 null, 6113 { 6114 id: 'hstem', 6115 min: 2, 6116 stackClearing: true, 6117 stem: true 6118 }, 6119 null, 6120 { 6121 id: 'vstem', 6122 min: 2, 6123 stackClearing: true, 6124 stem: true 6125 }, 6126 { 6127 id: 'vmoveto', 6128 min: 1, 6129 stackClearing: true 6130 }, 6131 { 6132 id: 'rlineto', 6133 min: 2, 6134 resetStack: true 6135 }, 6136 { 6137 id: 'hlineto', 6138 min: 1, 6139 resetStack: true 6140 }, 6141 { 6142 id: 'vlineto', 6143 min: 1, 6144 resetStack: true 6145 }, 6146 { 6147 id: 'rrcurveto', 6148 min: 6, 6149 resetStack: true 6150 }, 6151 null, 6152 { 6153 id: 'callsubr', 6154 min: 1, 6155 undefStack: true 6156 }, 6157 { 6158 id: 'return', 6159 min: 0, 6160 undefStack: true 6161 }, 6162 null, 6163 null, 6164 { 6165 id: 'endchar', 6166 min: 0, 6167 stackClearing: true 6168 }, 6169 null, 6170 null, 6171 null, 6172 { 6173 id: 'hstemhm', 6174 min: 2, 6175 stackClearing: true, 6176 stem: true 6177 }, 6178 { 6179 id: 'hintmask', 6180 min: 0, 6181 stackClearing: true 6182 }, 6183 { 6184 id: 'cntrmask', 6185 min: 0, 6186 stackClearing: true 6187 }, 6188 { 6189 id: 'rmoveto', 6190 min: 2, 6191 stackClearing: true 6192 }, 6193 { 6194 id: 'hmoveto', 6195 min: 1, 6196 stackClearing: true 6197 }, 6198 { 6199 id: 'vstemhm', 6200 min: 2, 6201 stackClearing: true, 6202 stem: true 6203 }, 6204 { 6205 id: 'rcurveline', 6206 min: 8, 6207 resetStack: true 6208 }, 6209 { 6210 id: 'rlinecurve', 6211 min: 8, 6212 resetStack: true 6213 }, 6214 { 6215 id: 'vvcurveto', 6216 min: 4, 6217 resetStack: true 6218 }, 6219 { 6220 id: 'hhcurveto', 6221 min: 4, 6222 resetStack: true 6223 }, 6224 null, 6225 { 6226 id: 'callgsubr', 6227 min: 1, 6228 undefStack: true 6229 }, 6230 { 6231 id: 'vhcurveto', 6232 min: 4, 6233 resetStack: true 6234 }, 6235 { 6236 id: 'hvcurveto', 6237 min: 4, 6238 resetStack: true 6239 } 6240 ]; 6241 var CharstringValidationData12 = [ 6242 null, 6243 null, 6244 null, 6245 { 6246 id: 'and', 6247 min: 2, 6248 stackDelta: -1 6249 }, 6250 { 6251 id: 'or', 6252 min: 2, 6253 stackDelta: -1 6254 }, 6255 { 6256 id: 'not', 6257 min: 1, 6258 stackDelta: 0 6259 }, 6260 null, 6261 null, 6262 null, 6263 { 6264 id: 'abs', 6265 min: 1, 6266 stackDelta: 0 6267 }, 6268 { 6269 id: 'add', 6270 min: 2, 6271 stackDelta: -1, 6272 stackFn: function stack_div(stack, index) { 6273 stack[index - 2] = stack[index - 2] + stack[index - 1]; 6274 } 6275 }, 6276 { 6277 id: 'sub', 6278 min: 2, 6279 stackDelta: -1, 6280 stackFn: function stack_div(stack, index) { 6281 stack[index - 2] = stack[index - 2] - stack[index - 1]; 6282 } 6283 }, 6284 { 6285 id: 'div', 6286 min: 2, 6287 stackDelta: -1, 6288 stackFn: function stack_div(stack, index) { 6289 stack[index - 2] = stack[index - 2] / stack[index - 1]; 6290 } 6291 }, 6292 null, 6293 { 6294 id: 'neg', 6295 min: 1, 6296 stackDelta: 0, 6297 stackFn: function stack_div(stack, index) { 6298 stack[index - 1] = -stack[index - 1]; 6299 } 6300 }, 6301 { 6302 id: 'eq', 6303 min: 2, 6304 stackDelta: -1 6305 }, 6306 null, 6307 null, 6308 { 6309 id: 'drop', 6310 min: 1, 6311 stackDelta: -1 6312 }, 6313 null, 6314 { 6315 id: 'put', 6316 min: 2, 6317 stackDelta: -2 6318 }, 6319 { 6320 id: 'get', 6321 min: 1, 6322 stackDelta: 0 6323 }, 6324 { 6325 id: 'ifelse', 6326 min: 4, 6327 stackDelta: -3 6328 }, 6329 { 6330 id: 'random', 6331 min: 0, 6332 stackDelta: 1 6333 }, 6334 { 6335 id: 'mul', 6336 min: 2, 6337 stackDelta: -1, 6338 stackFn: function stack_div(stack, index) { 6339 stack[index - 2] = stack[index - 2] * stack[index - 1]; 6340 } 6341 }, 6342 null, 6343 { 6344 id: 'sqrt', 6345 min: 1, 6346 stackDelta: 0 6347 }, 6348 { 6349 id: 'dup', 6350 min: 1, 6351 stackDelta: 1 6352 }, 6353 { 6354 id: 'exch', 6355 min: 2, 6356 stackDelta: 0 6357 }, 6358 { 6359 id: 'index', 6360 min: 2, 6361 stackDelta: 0 6362 }, 6363 { 6364 id: 'roll', 6365 min: 3, 6366 stackDelta: -2 6367 }, 6368 null, 6369 null, 6370 null, 6371 { 6372 id: 'hflex', 6373 min: 7, 6374 resetStack: true 6375 }, 6376 { 6377 id: 'flex', 6378 min: 13, 6379 resetStack: true 6380 }, 6381 { 6382 id: 'hflex1', 6383 min: 9, 6384 resetStack: true 6385 }, 6386 { 6387 id: 'flex1', 6388 min: 11, 6389 resetStack: true 6390 } 6391 ]; 6392 function CFFParser(file, properties, seacAnalysisEnabled) { 6393 this.bytes = file.getBytes(); 6394 this.properties = properties; 6395 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 6396 } 6397 CFFParser.prototype = { 6398 parse: function CFFParser_parse() { 6399 var properties = this.properties; 6400 var cff = new CFF(); 6401 this.cff = cff; 6402 var header = this.parseHeader(); 6403 var nameIndex = this.parseIndex(header.endPos); 6404 var topDictIndex = this.parseIndex(nameIndex.endPos); 6405 var stringIndex = this.parseIndex(topDictIndex.endPos); 6406 var globalSubrIndex = this.parseIndex(stringIndex.endPos); 6407 var topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 6408 var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 6409 cff.header = header.obj; 6410 cff.names = this.parseNameIndex(nameIndex.obj); 6411 cff.strings = this.parseStringIndex(stringIndex.obj); 6412 cff.topDict = topDict; 6413 cff.globalSubrIndex = globalSubrIndex.obj; 6414 this.parsePrivateDict(cff.topDict); 6415 cff.isCIDFont = topDict.hasName('ROS'); 6416 var charStringOffset = topDict.getByName('CharStrings'); 6417 var charStringIndex = this.parseIndex(charStringOffset).obj; 6418 var fontMatrix = topDict.getByName('FontMatrix'); 6419 if (fontMatrix) { 6420 properties.fontMatrix = fontMatrix; 6421 } 6422 var fontBBox = topDict.getByName('FontBBox'); 6423 if (fontBBox) { 6424 properties.ascent = fontBBox[3]; 6425 properties.descent = fontBBox[1]; 6426 properties.ascentScaled = true; 6427 } 6428 var charset, encoding; 6429 if (cff.isCIDFont) { 6430 var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj; 6431 for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 6432 var dictRaw = fdArrayIndex.get(i); 6433 var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 6434 this.parsePrivateDict(fontDict); 6435 cff.fdArray.push(fontDict); 6436 } 6437 encoding = null; 6438 charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true); 6439 cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count); 6440 } else { 6441 charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false); 6442 encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset); 6443 } 6444 cff.charset = charset; 6445 cff.encoding = encoding; 6446 var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray); 6447 cff.charStrings = charStringsAndSeacs.charStrings; 6448 cff.seacs = charStringsAndSeacs.seacs; 6449 cff.widths = charStringsAndSeacs.widths; 6450 return cff; 6451 }, 6452 parseHeader: function CFFParser_parseHeader() { 6453 var bytes = this.bytes; 6454 var bytesLength = bytes.length; 6455 var offset = 0; 6456 while (offset < bytesLength && bytes[offset] !== 1) { 6457 ++offset; 6458 } 6459 if (offset >= bytesLength) { 6460 error('Invalid CFF header'); 6461 } else if (offset !== 0) { 6462 info('cff data is shifted'); 6463 bytes = bytes.subarray(offset); 6464 this.bytes = bytes; 6465 } 6466 var major = bytes[0]; 6467 var minor = bytes[1]; 6468 var hdrSize = bytes[2]; 6469 var offSize = bytes[3]; 6470 var header = new CFFHeader(major, minor, hdrSize, offSize); 6471 return { 6472 obj: header, 6473 endPos: hdrSize 6474 }; 6475 }, 6476 parseDict: function CFFParser_parseDict(dict) { 6477 var pos = 0; 6478 function parseOperand() { 6479 var value = dict[pos++]; 6480 if (value === 30) { 6481 return parseFloatOperand(); 6482 } else if (value === 28) { 6483 value = dict[pos++]; 6484 value = (value << 24 | dict[pos++] << 16) >> 16; 6485 return value; 6486 } else if (value === 29) { 6487 value = dict[pos++]; 6488 value = value << 8 | dict[pos++]; 6489 value = value << 8 | dict[pos++]; 6490 value = value << 8 | dict[pos++]; 6491 return value; 6492 } else if (value >= 32 && value <= 246) { 6493 return value - 139; 6494 } else if (value >= 247 && value <= 250) { 6495 return (value - 247) * 256 + dict[pos++] + 108; 6496 } else if (value >= 251 && value <= 254) { 6497 return -((value - 251) * 256) - dict[pos++] - 108; 6498 } 6499 warn('CFFParser_parseDict: "' + value + '" is a reserved command.'); 6500 return NaN; 6501 } 6502 function parseFloatOperand() { 6503 var str = ''; 6504 var eof = 15; 6505 var lookup = [ 6506 '0', 6507 '1', 6508 '2', 6509 '3', 6510 '4', 6511 '5', 6512 '6', 6513 '7', 6514 '8', 6515 '9', 6516 '.', 6517 'E', 6518 'E-', 6519 null,
6520 '-' 6521 ]; 6522 var length = dict.length; 6523 while (pos < length) { 6524 var b = dict[pos++]; 6525 var b1 = b >> 4; 6526 var b2 = b & 15; 6527 if (b1 === eof) { 6528 break; 6529 } 6530 str += lookup[b1]; 6531 if (b2 === eof) { 6532 break; 6533 } 6534 str += lookup[b2]; 6535 } 6536 return parseFloat(str); 6537 } 6538 var operands = []; 6539 var entries = []; 6540 pos = 0; 6541 var end = dict.length; 6542 while (pos < end) { 6543 var b = dict[pos]; 6544 if (b <= 21) { 6545 if (b === 12) { 6546 b = b << 8 | dict[++pos]; 6547 } 6548 entries.push([ 6549 b, 6550 operands 6551 ]); 6552 operands = []; 6553 ++pos; 6554 } else { 6555 operands.push(parseOperand()); 6556 } 6557 } 6558 return entries; 6559 }, 6560 parseIndex: function CFFParser_parseIndex(pos) { 6561 var cffIndex = new CFFIndex(); 6562 var bytes = this.bytes; 6563 var count = bytes[pos++] << 8 | bytes[pos++]; 6564 var offsets = []; 6565 var end = pos; 6566 var i, ii; 6567 if (count !== 0) { 6568 var offsetSize = bytes[pos++]; 6569 var startPos = pos + (count + 1) * offsetSize - 1; 6570 for (i = 0, ii = count + 1; i < ii; ++i) { 6571 var offset = 0; 6572 for (var j = 0; j < offsetSize; ++j) { 6573 offset <<= 8; 6574 offset += bytes[pos++]; 6575 } 6576 offsets.push(startPos + offset); 6577 } 6578 end = offsets[count]; 6579 } 6580 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 6581 var offsetStart = offsets[i]; 6582 var offsetEnd = offsets[i + 1]; 6583 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 6584 } 6585 return { 6586 obj: cffIndex, 6587 endPos: end 6588 }; 6589 }, 6590 parseNameIndex: function CFFParser_parseNameIndex(index) { 6591 var names = []; 6592 for (var i = 0, ii = index.count; i < ii; ++i) { 6593 var name = index.get(i); 6594 var length = Math.min(name.length, 127); 6595 var data = []; 6596 for (var j = 0; j < length; ++j) { 6597 var c = name[j]; 6598 if (j === 0 && c === 0) { 6599 data[j] = c; 6600 continue; 6601 } 6602 if (c < 33 || c > 126 || c === 91 || c === 93 || c === 40 || c === 41 || c === 123 || c === 125 || c === 60 || c === 62 || c === 47 || c === 37 || c === 35) 6603 { 6604 data[j] = 95; 6605 continue; 6606 } 6607 data[j] = c; 6608 } 6609 names.push(bytesToString(data)); 6610 } 6611 return names; 6612 }, 6613 parseStringIndex: function CFFParser_parseStringIndex(index) { 6614 var strings = new CFFStrings(); 6615 for (var i = 0, ii = index.count; i < ii; ++i) { 6616 var data = index.get(i); 6617 strings.add(bytesToString(data)); 6618 } 6619 return strings; 6620 }, 6621 createDict: function CFFParser_createDict(Type, dict, strings) { 6622 var cffDict = new Type(strings); 6623 for (var i = 0, ii = dict.length; i < ii; ++i) { 6624 var pair = dict[i]; 6625 var key = pair[0]; 6626 var value = pair[1]; 6627 cffDict.setByKey(key, value); 6628 } 6629 return cffDict; 6630 }, 6631 parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) { 6632 if (state.callDepth > MAX_SUBR_NESTING) { 6633 return false; 6634 } 6635 var stackSize = state.stackSize; 6636 var stack = state.stack; 6637 var length = data.length; 6638 for (var j = 0; j < length;) { 6639 var value = data[j++]; 6640 var validationCommand = null; 6641 if (value === 12) { 6642 var q = data[j++]; 6643 if (q === 0) { 6644 data[j - 2] = 139; 6645 data[j - 1] = 22; 6646 stackSize = 0; 6647 } else { 6648 validationCommand = CharstringValidationData12[q]; 6649 } 6650 } else if (value === 28) { 6651 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 6652 j += 2; 6653 stackSize++; 6654 } else if (value === 14) { 6655 if (stackSize >= 4) { 6656 stackSize -= 4; 6657 if (this.seacAnalysisEnabled) { 6658 state.seac = stack.slice(stackSize, stackSize + 4); 6659 return false; 6660 } 6661 } 6662 validationCommand = CharstringValidationData[value]; 6663 } else if (value >= 32 && value <= 246) { 6664 stack[stackSize] = value - 139; 6665 stackSize++; 6666 } else if (value >= 247 && value <= 254) { 6667 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 6668 j++; 6669 stackSize++; 6670 }
6670 else if (value === 255) { 6671 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 6672 j += 4; 6673 stackSize++; 6674 } else if (value === 19 || value === 20) { 6675 state.hints += stackSize >> 1; 6676 j += state.hints + 7 >> 3; 6677 stackSize %= 2; 6678 validationCommand = CharstringValidationData[value]; 6679 } else if (value === 10 || value === 29) { 6680 var subrsIndex; 6681 if (value === 10) { 6682 subrsIndex = localSubrIndex; 6683 } else { 6684 subrsIndex = globalSubrIndex; 6685 } 6686 if (!subrsIndex) { 6687 validationCommand = CharstringValidationData[value]; 6688 warn('Missing subrsIndex for ' + validationCommand.id); 6689 return false; 6690 } 6691 var bias = 32768; 6692 if (subrsIndex.count < 1240) { 6693 bias = 107; 6694 } else if (subrsIndex.count < 33900) { 6695 bias = 1131; 6696 } 6697 var subrNumber = stack[--stackSize] + bias; 6698 if (subrNumber < 0 || subrNumber >= subrsIndex.count) { 6699 validationCommand = CharstringValidationData[value]; 6700 warn('Out of bounds subrIndex for ' + validationCommand.id); 6701 return false; 6702 } 6703 state.stackSize = stackSize; 6704 state.callDepth++; 6705 var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 6706 if (!valid) { 6707 return false; 6708 } 6709 state.callDepth--; 6710 stackSize = state.stackSize; 6711 continue; 6712 } else if (value === 11) { 6713 state.stackSize = stackSize; 6714 return true; 6715 } else { 6716 validationCommand = CharstringValidationData[value]; 6717 } 6718 if (validationCommand) { 6719 if (validationCommand.stem) { 6720 state.hints += stackSize >> 1; 6721 } 6722 if ('min' in validationCommand) { 6723 if (!state.undefStack && stackSize < validationCommand.min) { 6724 warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min); 6725 return false; 6726 } 6727 } 6728 if (state.firstStackClearing && validationCommand.stackClearing) { 6729 state.firstStackClearing = false; 6730 stackSize -= validationCommand.min; 6731 if (stackSize >= 2 && validationCommand.stem) { 6732 stackSize %= 2; 6733 } else if (stackSize > 1) { 6734 warn('Found too many parameters for stack-clearing command'); 6735 } 6736 if (stackSize > 0 && stack[stackSize - 1] >= 0) { 6737 state.width = stack[stackSize - 1]; 6738 } 6739 } 6740 if ('stackDelta' in validationCommand) { 6741 if ('stackFn' in validationCommand) { 6742 validationCommand.stackFn(stack, stackSize); 6743 } 6744 stackSize += validationCommand.stackDelta; 6745 } else if (validationCommand.stackClearing) { 6746 stackSize = 0; 6747 } else if (validationCommand.resetStack) { 6748 stackSize = 0; 6749 state.undefStack = false; 6750 } else if (validationCommand.undefStack) { 6751 stackSize = 0; 6752 state.undefStack = true; 6753 state.firstStackClearing = false; 6754 } 6755 } 6756 } 6757 state.stackSize = stackSize; 6758 return true; 6759 }, 6760 parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) { 6761 var seacs = []; 6762 var widths = []; 6763 var count = charStrings.count; 6764 for (var i = 0; i < count; i++) { 6765 var charstring = charStrings.get(i); 6766 var state = { 6767 callDepth: 0, 6768 stackSize: 0, 6769 stack: [], 6770 undefStack: true, 6771 hints: 0, 6772 firstStackClearing: true, 6773 seac: null, 6774 width: null 6775 }; 6776 var valid = true; 6777 var localSubrToUse = null; 6778 if (fdSelect && fdArray.length) { 6779 var fdIndex = fdSelect.getFDIndex(i); 6780 if (fdIndex === -1) { 6781 warn('Glyph index is not in fd select.'); 6782 valid = false; 6783 } 6784 if (fdIndex >= fdArray.length) { 6785 warn('Invalid fd index for glyph index.'); 6786 valid = false;
6787 } 6788 if (valid) { 6789 localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex; 6790 } 6791 } else if (localSubrIndex) { 6792 localSubrToUse = localSubrIndex; 6793 } 6794 if (valid) { 6795 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 6796 } 6797 if (state.width !== null) { 6798 widths[i] = state.width; 6799 } 6800 if (state.seac !== null) { 6801 seacs[i] = state.seac; 6802 } 6803 if (!valid) { 6804 charStrings.set(i, new Uint8Array([14])); 6805 } 6806 } 6807 return { 6808 charStrings: charStrings, 6809 seacs: seacs, 6810 widths: widths 6811 }; 6812 }, 6813 emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) { 6814 var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 6815 parentDict.setByKey(18, [ 6816 0, 6817 0 6818 ]); 6819 parentDict.privateDict = privateDict; 6820 }, 6821 parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) { 6822 if (!parentDict.hasName('Private')) { 6823 this.emptyPrivateDictionary(parentDict); 6824 return; 6825 } 6826 var privateOffset = parentDict.getByName('Private'); 6827 if (!isArray(privateOffset) || privateOffset.length !== 2) { 6828 parentDict.removeByName('Private'); 6829 return; 6830 } 6831 var size = privateOffset[0]; 6832 var offset = privateOffset[1]; 6833 if (size === 0 || offset >= this.bytes.length) { 6834 this.emptyPrivateDictionary(parentDict); 6835 return; 6836 } 6837 var privateDictEnd = offset + size; 6838 var dictData = this.bytes.subarray(offset, privateDictEnd); 6839 var dict = this.parseDict(dictData); 6840 var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 6841 parentDict.privateDict = privateDict; 6842 if (!privateDict.getByName('Subrs')) { 6843 return; 6844 } 6845 var subrsOffset = privateDict.getByName('Subrs'); 6846 var relativeOffset = offset + subrsOffset; 6847 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 6848 this.emptyPrivateDictionary(parentDict); 6849 return; 6850 } 6851 var subrsIndex = this.parseIndex(relativeOffset); 6852 privateDict.subrsIndex = subrsIndex.obj; 6853 }, 6854 parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) { 6855 if (pos === 0) { 6856 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset); 6857 } else if (pos === 1) { 6858 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset); 6859 } else if (pos === 2) { 6860 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset); 6861 } 6862 var bytes = this.bytes; 6863 var start = pos; 6864 var format = bytes[pos++]; 6865 var charset = ['.notdef']; 6866 var id, count, i; 6867 length -= 1; 6868 switch (format) { 6869 case 0: 6870 for (i = 0; i < length; i++) { 6871 id = bytes[pos++] << 8 | bytes[pos++]; 6872 charset.push(cid ? id : strings.get(id)); 6873 } 6874 break; 6875 case 1: 6876 while (charset.length <= length) { 6877 id = bytes[pos++] << 8 | bytes[pos++]; 6878 count = bytes[pos++]; 6879 for (i = 0; i <= count; i++) { 6880 charset.push(cid ? id++ : strings.get(id++)); 6881 } 6882 } 6883 break; 6884 case 2: 6885 while (charset.length <= length) { 6886 id = bytes[pos++] << 8 | bytes[pos++]; 6887 count = bytes[pos++] << 8 | bytes[pos++]; 6888 for (i = 0; i <= count; i++) { 6889 charset.push(cid ? id++ : strings.get(id++)); 6890 } 6891 } 6892 break; 6893 default: 6894 error('Unknown charset format'); 6895 } 6896 var end = pos; 6897 var raw = bytes.subarray(start, end); 6898 return new CFFCharset(false, format, charset, raw); 6899 }, 6900 parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) { 6901 var encoding = Object.create(null); 6902 var bytes = this.bytes; 6903 var predefined = false; 6904 var format, i, ii; 6905 var raw = null; 6906 function readSupplement() { 6907 var supplementsCount = bytes[pos++]; 6908 for (i = 0; i < supplementsCount; i++) { 6909 var code = bytes[pos++]; 6910 var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 6911 encoding[code] = charset.indexOf(strings.get(sid)); 6912 } 6913 } 6914 if (pos === 0 || pos === 1) { 6915 predefined = true; 6916 format = pos; 6917 var baseEncoding = pos ? ExpertEncoding : StandardEncoding; 6918 for (i = 0, ii = charset.length; i < ii; i++) { 6919 var index = baseEncoding.indexOf(charset[i]); 6920 if (index !== -1) { 6921 encoding[index] = i; 6922 } 6923 } 6924 } else { 6925 var dataStart = pos; 6926 format = bytes[pos++]; 6927 switch (format & 0x7f) { 6928 case 0: 6929 var glyphsCount = bytes[pos++]; 6930 for (i = 1; i <= glyphsCount; i++) { 6931 encoding[bytes[pos++]] = i; 6932 } 6933 break; 6934 case 1: 6935 var rangesCount = bytes[pos++]; 6936 var gid = 1; 6937 for (i = 0; i < rangesCount; i++) { 6938 var start = bytes[pos++]; 6939 var left = bytes[pos++]; 6940 for (var j = start; j <= start + left; j++) { 6941 encoding[j] = gid++; 6942 } 6943 } 6944 break; 6945 default: 6946 error('Unknown encoding format: ' + format + ' in CFF'); 6947 break; 6948 } 6949 var dataEnd = pos; 6950 if (format & 0x80) { 6951 bytes[dataStart] &= 0x7f; 6952 readSupplement(); 6953 } 6954 raw = bytes.subarray(dataStart, dataEnd); 6955 } 6956 format = format & 0x7f; 6957 return new CFFEncoding(predefined, format, encoding, raw); 6958 }, 6959 parseFDSelect: function CFFParser_parseFDSelect(pos, length) { 6960 var start = pos; 6961 var bytes = this.bytes; 6962 var format = bytes[pos++]; 6963 var fdSelect = [], rawBytes; 6964 var i, invalidFirstGID = false;
6965 switch (format) { 6966 case 0: 6967 for (i = 0; i < length; ++i) { 6968 var id = bytes[pos++]; 6969 fdSelect.push(id); 6970 } 6971 rawBytes = bytes.subarray(start, pos); 6972 break; 6973 case 3: 6974 var rangesCount = bytes[pos++] << 8 | bytes[pos++]; 6975 for (i = 0; i < rangesCount; ++i) { 6976 var first = bytes[pos++] << 8 | bytes[pos++]; 6977 if (i === 0 && first !== 0) { 6978 warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.'); 6979 invalidFirstGID = true; 6980 first = 0; 6981 } 6982 var fdIndex = bytes[pos++]; 6983 var next = bytes[pos] << 8 | bytes[pos + 1]; 6984 for (var j = first; j < next; ++j) { 6985 fdSelect.push(fdIndex); 6986 } 6987 } 6988 pos += 2; 6989 rawBytes = bytes.subarray(start, pos); 6990 if (invalidFirstGID) { 6991 rawBytes[3] = rawBytes[4] = 0; 6992 } 6993 break; 6994 default: 6995 error('parseFDSelect: Unknown format "' + format + '".'); 6996 break; 6997 } 6998 assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.'); 6999 return new CFFFDSelect(fdSelect, rawBytes); 7000 } 7001 }; 7002 return CFFParser; 7003 }(); 7004 var CFF = function CFFClosure() { 7005 function CFF() { 7006 this.header = null; 7007 this.names = []; 7008 this.topDict = null; 7009 this.strings = new CFFStrings(); 7010 this.globalSubrIndex = null; 7011 this.encoding = null; 7012 this.charset = null; 7013 this.charStrings = null; 7014 this.fdArray = []; 7015 this.fdSelect = null; 7016 this.isCIDFont = false; 7017 } 7018 return CFF; 7019 }(); 7020 var CFFHeader = function CFFHeaderClosure() { 7021 function CFFHeader(major, minor, hdrSize, offSize) { 7022 this.major = major; 7023 this.minor = minor; 7024 this.hdrSize = hdrSize; 7025 this.offSize = offSize; 7026 } 7027 return CFFHeader; 7028 }(); 7029 var CFFStrings = function CFFStringsClosure() { 7030 function CFFStrings() { 7031 this.strings = []; 7032 } 7033 CFFStrings.prototype = { 7034 get: function CFFStrings_get(index) { 7035 if (index >= 0 && index <= 390) { 7036 return CFFStandardStrings[index]; 7037 } 7038 if (index - 391 <= this.strings.length) { 7039 return this.strings[index - 391]; 7040 } 7041 return CFFStandardStrings[0]; 7042 }, 7043 add: function CFFStrings_add(value) { 7044 this.strings.push(value); 7045 }, 7046 get count() { 7047 return this.strings.length; 7048 } 7049 }; 7050 return CFFStrings; 7051 }(); 7052 var CFFIndex = function CFFIndexClosure() { 7053 function CFFIndex() { 7054 this.objects = []; 7055 this.length = 0; 7056 } 7057 CFFIndex.prototype = { 7058 add: function CFFIndex_add(data) { 7059 this.length += data.length; 7060 this.objects.push(data); 7061 }, 7062 set: function CFFIndex_set(index, data) { 7063 this.length += data.length - this.objects[index].length; 7064 this.objects[index] = data; 7065 }, 7066 get: function CFFIndex_get(index) { 7067 return this.objects[index]; 7068 }, 7069 get count() { 7070 return this.objects.length; 7071 } 7072 }; 7073 return CFFIndex; 7074 }(); 7075 var CFFDict = function CFFDictClosure() { 7076 function CFFDict(tables, strings) { 7077 this.keyToNameMap = tables.keyToNameMap; 7078 this.nameToKeyMap = tables.nameToKeyMap; 7079 this.defaults = tables.defaults; 7080 this.types = tables.types; 7081 this.opcodes = tables.opcodes; 7082 this.order = tables.order; 7083 this.strings = strings; 7084 this.values = Object.create(null); 7085 } 7086 CFFDict.prototype = { 7087 setByKey: function CFFDict_setByKey(key, value) { 7088 if (!(key in this.keyToNameMap)) { 7089 return false; 7090 } 7091 var valueLength = value.length; 7092 if (valueLength === 0) { 7093 return true; 7094 } 7095 for (var i = 0; i < valueLength; i++) { 7096 if (isNaN(value[i])) { 7097 warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); 7098 return true; 7099 } 7100 } 7101 var type = this.types[key]; 7102 if (type === 'num' || type === 'sid' || type === 'offset') { 7103 value = value[0]; 7104 } 7105 this.values[key] = value; 7106 return true; 7107 }, 7108 setByName: function CFFDict_setByName(name, value) { 7109 if (!(name in this.nameToKeyMap)) { 7110 error('Invalid dictionary name "' + name + '"'); 7111 } 7112 this.values[this.nameToKeyMap[name]] = value; 7113 }, 7114 hasName: function CFFDict_hasName(name) { 7115 return this.nameToKeyMap[name] in this.values; 7116 }, 7117 getByName: function CFFDict_getByName(name) { 7118 if (!(name in this.nameToKeyMap)) { 7119 error('Invalid dictionary name "' + name + '"'); 7120 } 7121 var key = this.nameToKeyMap[name]; 7122 if (!(key in this.values)) { 7123 return this.defaults[key]; 7124 } 7125 return this.values[key]; 7126 }, 7127 removeByName: function CFFDict_removeByName(name) { 7128 delete this.values[this.nameToKeyMap[name]]; 7129 } 7130 }; 7131 CFFDict.createTables = function CFFDict_createTables(layout) { 7132 var tables = { 7133 keyToNameMap: {}, 7134 nameToKeyMap: {}, 7135 defaults: {}, 7136 types: {}, 7137 opcodes: {}, 7138 order: [] 7139 }; 7140 for (var i = 0, ii = layout.length; i < ii; ++i) { 7141 var entry = layout[i]; 7142 var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 7143 tables.keyToNameMap[key] = entry[1]; 7144 tables.nameToKeyMap[entry[1]] = key; 7145 tables.types[key] = entry[2]; 7146 tables.defaults[key] = entry[3]; 7147 tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]]; 7148 tables.order.push(key); 7149 } 7150 return tables; 7151 }; 7152 return CFFDict; 7153 }(); 7154 var CFFTopDict = function CFFTopDictClosure() { 7155 var layout = [ 7156 [ 7157 [ 7158 12, 7159 30 7160 ], 7161 'ROS', 7162 [ 7163 'sid', 7164 'sid', 7165 'num' 7166 ], 7167 null 7168 ], 7169 [ 7170 [ 7171 12, 7172 20 7173 ], 7174 'SyntheticBase', 7175 'num', 7176 null 7177 ], 7178 [ 7179 0, 7180 'version', 7181 'sid', 7182 null 7183 ], 7184 [ 7185 1, 7186 'Notice', 7187 'sid', 7188 null 7189 ], 7190 [ 7191 [ 7192 12, 7193 0 7194 ], 7195 'Copyright', 7196 'sid', 7197 null 7198 ], 7199 [ 7200 2, 7201 'FullName', 7202 'sid', 7203 null 7204 ], 7205 [ 7206 3, 7207 'FamilyName', 7208 'sid', 7209 null 7210 ], 7211 [ 7212 4, 7213 'Weight', 7214 'sid', 7215 null 7216 ], 7217 [ 7218 [ 7219 12, 7220 1 7221 ], 7222 'isFixedPitch', 7223 'num', 7224 0 7225 ], 7226 [ 7227 [ 7228 12, 7229 2 7230 ], 7231 'ItalicAngle', 7232 'num', 7233 0 7234 ], 7235 [ 7236 [ 7237 12, 7238 3 7239 ], 7240 'UnderlinePosition', 7241 'num', 7242 -100 7243 ], 7244 [ 7245 [ 7246 12, 7247 4 7248 ], 7249 'UnderlineThickness', 7250 'num', 7251 50 7252 ], 7253 [ 7254 [ 7255 12, 7256 5 7257 ], 7258 'PaintType', 7259 'num', 7260 0 7261 ], 7262 [ 7263 [ 7264 12, 7265 6 7266 ], 7267 'CharstringType', 7268 'num', 7269 2 7270 ], 7271 [ 7272 [ 7273 12, 7274 7 7275 ], 7276 'FontMatrix', 7277 [ 7278 'num', 7279 'num', 7280 'num', 7281 'num', 7282 'num', 7283 'num' 7284 ], 7285 [ 7286 0.001, 7287 0, 7288 0, 7289 0.001, 7290 0, 7291 0 7292 ] 7293 ], 7294 [ 7295 13, 7296 'UniqueID', 7297 'num', 7298 null 7299 ], 7300 [ 7301 5, 7302 'FontBBox', 7303 [ 7304 'num', 7305 'num', 7306 'num', 7307 'num' 7308 ], 7309 [ 7310 0, 7311 0, 7312 0, 7313 0 7314 ] 7315 ], 7316 [ 7317 [ 7318 12, 7319 8 7320 ], 7321 'StrokeWidth', 7322 'num', 7323 0 7324 ], 7325 [ 7326 14, 7327 'XUID', 7328 'array', 7329 null 7330 ], 7331 [ 7332 15, 7333 'charset', 7334 'offset', 7335 0 7336 ], 7337 [ 7338 16, 7339 'Encoding', 7340 'offset', 7341 0 7342 ], 7343 [ 7344 17, 7345 'CharStrings', 7346 'offset', 7347 0 7348 ], 7349 [ 7350 18, 7351 'Private', 7352 [ 7353 'offset', 7354 'offset' 7355 ], 7356 null 7357 ], 7358 [ 7359 [ 7360 12, 7361 21 7362 ], 7363 'PostScript', 7364 'sid', 7365 null 7366 ], 7367 [ 7368 [ 7369 12, 7370 22 7371 ], 7372 'BaseFontName', 7373 'sid', 7374 null 7375 ], 7376 [ 7377 [ 7378 12, 7379 23 7380 ], 7381 'BaseFontBlend', 7382 'delta', 7383 null 7384 ], 7385 [ 7386 [ 7387 12, 7388 31 7389 ], 7390 'CIDFontVersion', 7391 'num', 7392 0 7393 ], 7394 [ 7395 [ 7396 12, 7397 32 7398 ], 7399 'CIDFontRevision', 7400 'num', 7401 0 7402 ], 7403 [ 7404 [ 7405 12, 7406 33 7407 ], 7408 'CIDFontType', 7409 'num', 7410 0 7411 ], 7412 [ 7413 [ 7414 12, 7415 34 7416 ], 7417 'CIDCount', 7418 'num', 7419 8720 7420 ], 7421 [ 7422 [ 7423 12, 7424 35 7425 ], 7426 'UIDBase', 7427 'num', 7428 null 7429 ], 7430 [ 7431 [ 7432 12, 7433 37 7434 ], 7435 'FDSelect', 7436 'offset', 7437 null 7438 ], 7439 [ 7440 [ 7441 12, 7442 36 7443 ], 7444 'FDArray', 7445 'offset', 7446 null 7447 ], 7448 [ 7449 [ 7450 12, 7451 38 7452 ], 7453 'FontName', 7454 'sid', 7455 null 7456 ] 7457 ]; 7458 var tables = null; 7459 function CFFTopDict(strings) { 7460 if (tables === null) { 7461 tables = CFFDict.createTables(layout); 7462 } 7463 CFFDict.call(this, tables, strings); 7464 this.privateDict = null; 7465 } 7466 CFFTopDict.prototype = Object.create(CFFDict.prototype); 7467 return CFFTopDict; 7468 }();
7469 var CFFPrivateDict = function CFFPrivateDictClosure() { 7470 var layout = [ 7471 [ 7472 6, 7473 'BlueValues', 7474 'delta', 7475 null 7476 ], 7477 [ 7478 7, 7479 'OtherBlues', 7480 'delta', 7481 null 7482 ], 7483 [ 7484 8, 7485 'FamilyBlues', 7486 'delta', 7487 null 7488 ], 7489 [ 7490 9, 7491 'FamilyOtherBlues', 7492 'delta', 7493 null 7494 ], 7495 [ 7496 [ 7497 12, 7498 9 7499 ], 7500 'BlueScale', 7501 'num', 7502 0.039625 7503 ], 7504 [ 7505 [ 7506 12, 7507 10 7508 ], 7509 'BlueShift', 7510 'num', 7511 7 7512 ], 7513 [ 7514 [ 7515 12, 7516 11 7517 ], 7518 'BlueFuzz', 7519 'num', 7520 1 7521 ], 7522 [ 7523 10, 7524 'StdHW', 7525 'num', 7526 null 7527 ], 7528 [ 7529 11, 7530 'StdVW', 7531 'num', 7532 null 7533 ], 7534 [ 7535 [ 7536 12, 7537 12 7538 ], 7539 'StemSnapH', 7540 'delta', 7541 null 7542 ], 7543 [ 7544 [ 7545 12, 7546 13 7547 ], 7548 'StemSnapV', 7549 'delta', 7550 null 7551 ], 7552 [ 7553 [ 7554 12, 7555 14 7556 ], 7557 'ForceBold', 7558 'num', 7559 0 7560 ], 7561 [ 7562 [ 7563 12, 7564 17 7565 ], 7566 'LanguageGroup', 7567 'num', 7568 0 7569 ], 7570 [ 7571 [ 7572 12, 7573 18 7574 ], 7575 'ExpansionFactor', 7576 'num', 7577 0.06 7578 ], 7579 [ 7580 [ 7581 12, 7582 19 7583 ], 7584 'initialRandomSeed', 7585 'num', 7586 0 7587 ], 7588 [ 7589 20, 7590 'defaultWidthX', 7591 'num', 7592 0 7593 ], 7594 [ 7595 21, 7596 'nominalWidthX', 7597 'num', 7598 0 7599 ], 7600 [ 7601 19, 7602 'Subrs', 7603 'offset', 7604 null 7605 ] 7606 ]; 7607 var tables = null; 7608 function CFFPrivateDict(strings) { 7609 if (tables === null) { 7610 tables = CFFDict.createTables(layout); 7611 } 7612 CFFDict.call(this, tables, strings); 7613 this.subrsIndex = null; 7614 } 7615 CFFPrivateDict.prototype = Object.create(CFFDict.prototype); 7616 return CFFPrivateDict; 7617 }(); 7618 var CFFCharsetPredefinedTypes = { 7619 ISO_ADOBE: 0, 7620 EXPERT: 1, 7621 EXPERT_SUBSET: 2 7622 }; 7623 var CFFCharset = function CFFCharsetClosure() { 7624 function CFFCharset(predefined, format, charset, raw) { 7625 this.predefined = predefined; 7626 this.format = format; 7627 this.charset = charset; 7628 this.raw = raw; 7629 } 7630 return CFFCharset; 7631 }(); 7632 var CFFEncoding = function CFFEncodingClosure() { 7633 function CFFEncoding(predefined, format, encoding, raw) { 7634 this.predefined = predefined; 7635 this.format = format; 7636 this.encoding = encoding; 7637 this.raw = raw; 7638 } 7639 return CFFEncoding; 7640 }(); 7641 var CFFFDSelect = function CFFFDSelectClosure() { 7642 function CFFFDSelect(fdSelect, raw) { 7643 this.fdSelect = fdSelect; 7644 this.raw = raw; 7645 } 7646 CFFFDSelect.prototype = { 7647 getFDIndex: function CFFFDSelect_get(glyphIndex) { 7648 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 7649 return -1; 7650 } 7651 return this.fdSelect[glyphIndex]; 7652 } 7653 }; 7654 return CFFFDSelect; 7655 }(); 7656 var CFFOffsetTracker = function CFFOffsetTrackerClosure() { 7657 function CFFOffsetTracker() { 7658 this.offsets = Object.create(null); 7659 } 7660 CFFOffsetTracker.prototype = { 7661 isTracking: function CFFOffsetTracker_isTracking(key) { 7662 return key in this.offsets; 7663 }, 7664 track: function CFFOffsetTracker_track(key, location) { 7665 if (key in this.offsets) { 7666 error('Already tracking location of ' + key); 7667 } 7668 this.offsets[key] = location; 7669 }, 7670 offset: function CFFOffsetTracker_offset(value) { 7671 for (var key in this.offsets) { 7672 this.offsets[key] += value; 7673 } 7674 }, 7675 setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) { 7676 if (!(key in this.offsets)) { 7677 error('Not tracking location of ' + key); 7678 } 7679 var data = output.data; 7680 var dataOffset = this.offsets[key]; 7681 var size = 5; 7682 for (var i = 0, ii = values.length; i < ii; ++i) { 7683 var offset0 = i * size + dataOffset; 7684 var offset1 = offset0 + 1; 7685 var offset2 = offset0 + 2; 7686 var offset3 = offset0 + 3; 7687 var offset4 = offset0 + 4; 7688 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 7689 error('writing to an offset that is not empty'); 7690 } 7691 var value = values[i]; 7692 data[offset0] = 0x1d; 7693 data[offset1] = value >> 24 & 0xFF; 7694 data[offset2] = value >> 16 & 0xFF; 7695 data[offset3] = value >> 8 & 0xFF; 7696 data[offset4] = value & 0xFF; 7697 } 7698 } 7699 }; 7700 return CFFOffsetTracker; 7701 }(); 7702 var CFFCompiler = function CFFCompilerClosure() { 7703 function CFFCompiler(cff) { 7704 this.cff = cff; 7705 } 7706 CFFCompiler.prototype = { 7707 compile: function CFFCompiler_compile() { 7708 var cff = this.cff; 7709 var output = { 7710 data: [], 7711 length: 0, 7712 add: function CFFCompiler_add(data) { 7713 this.data = this.data.concat(data); 7714 this.length = this.data.length; 7715 } 7716 }; 7717 var header = this.compileHeader(cff.header); 7718 output.add(header);
7719 var nameIndex = this.compileNameIndex(cff.names); 7720 output.add(nameIndex); 7721 if (cff.isCIDFont) { 7722 if (cff.topDict.hasName('FontMatrix')) { 7723 var base = cff.topDict.getByName('FontMatrix'); 7724 cff.topDict.removeByName('FontMatrix'); 7725 for (var i = 0, ii = cff.fdArray.length; i < ii; i++) { 7726 var subDict = cff.fdArray[i]; 7727 var matrix = base.slice(0); 7728 if (subDict.hasName('FontMatrix')) { 7729 matrix = Util.transform(matrix, subDict.getByName('FontMatrix')); 7730 } 7731 subDict.setByName('FontMatrix', matrix); 7732 } 7733 } 7734 } 7735 var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 7736 output.add(compiled.output); 7737 var topDictTracker = compiled.trackers[0]; 7738 var stringIndex = this.compileStringIndex(cff.strings.strings); 7739 output.add(stringIndex); 7740 var globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 7741 output.add(globalSubrIndex); 7742 if (cff.encoding && cff.topDict.hasName('Encoding')) { 7743 if (cff.encoding.predefined) { 7744 topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output); 7745 } else { 7746 var encoding = this.compileEncoding(cff.encoding); 7747 topDictTracker.setEntryLocation('Encoding', [output.length], output); 7748 output.add(encoding); 7749 } 7750 } 7751 if (cff.charset && cff.topDict.hasName('charset')) { 7752 if (cff.charset.predefined) { 7753 topDictTracker.setEntryLocation('charset', [cff.charset.format], output); 7754 } else { 7755 var charset = this.compileCharset(cff.charset); 7756 topDictTracker.setEntryLocation('charset', [output.length], output); 7757 output.add(charset); 7758 } 7759 } 7760 var charStrings = this.compileCharStrings(cff.charStrings); 7761 topDictTracker.setEntryLocation('CharStrings', [output.length], output); 7762 output.add(charStrings); 7763 if (cff.isCIDFont) { 7764 topDictTracker.setEntryLocation('FDSelect', [output.length], output); 7765 var fdSelect = this.compileFDSelect(cff.fdSelect.raw); 7766 output.add(fdSelect); 7767 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 7768 topDictTracker.setEntryLocation('FDArray', [output.length], output); 7769 output.add(compiled.output); 7770 var fontDictTrackers = compiled.trackers; 7771 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 7772 } 7773 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 7774 output.add([0]); 7775 return output.data; 7776 }, 7777 encodeNumber: function CFFCompiler_encodeNumber(value) { 7778 if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) { 7779 return this.encodeInteger(value); 7780 } 7781 return this.encodeFloat(value); 7782 }, 7783 encodeFloat: function CFFCompiler_encodeFloat(num) { 7784 var value = num.toString(); 7785 var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value); 7786 if (m) { 7787 var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length)); 7788 value = (Math.round(num * epsilon) / epsilon).toString(); 7789 } 7790 var nibbles = ''; 7791 var i, ii; 7792 for (i = 0, ii = value.length; i < ii; ++i) { 7793 var a = value[i]; 7794 if (a === 'e') { 7795 nibbles += value[++i] === '-' ? 'c' : 'b'; 7796 } else if (a === '.') { 7797 nibbles += 'a'; 7798 } else if (a === '-') { 7799 nibbles += 'e'; 7800 } else { 7801 nibbles += a; 7802 } 7803 } 7804 nibbles += nibbles.length & 1 ? 'f' : 'ff'; 7805 var out = [30]; 7806 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 7807 out.push(parseInt(nibbles.substr(i, 2), 16)); 7808 } 7809 return out; 7810 }, 7811 encodeInteger: function CFFCompiler_encodeInteger(value) { 7812 var code; 7813 if (value >= -107 && value <= 107) { 7814 code = [value + 139]; 7815 } else if (value >= 108 && value <= 1131) { 7816 value = value - 108; 7817 code = [ 7818 (value >> 8) + 247, 7819 value & 0xFF 7820 ]; 7821 } else if (value >= -1131 && value <= -108) { 7822 value = -value - 108; 7823 code = [ 7824 (value >> 8) + 251, 7825 value & 0xFF 7826 ]; 7827 } else if (value >= -32768 && value <= 32767) { 7828 code = [ 7829 0x1c, 7830 value >> 8 & 0xFF, 7831 value & 0xFF 7832 ]; 7833 } else { 7834 code = [ 7835 0x1d, 7836 value >> 24 & 0xFF, 7837 value >> 16 & 0xFF, 7838 value >> 8 & 0xFF, 7839 value & 0xFF 7840 ]; 7841 } 7842 return code; 7843 }, 7844 compileHeader: function CFFCompiler_compileHeader(header) { 7845 return [ 7846 header.major, 7847 header.minor, 7848 header.hdrSize, 7849 header.offSize 7850 ]; 7851 }, 7852 compileNameIndex: function CFFCompiler_compileNameIndex(names) { 7853 var nameIndex = new CFFIndex(); 7854 for (var i = 0, ii = names.length; i < ii; ++i) { 7855 nameIndex.add(stringToBytes(names[i])); 7856 } 7857 return this.compileIndex(nameIndex); 7858 }, 7859 compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) { 7860 var fontDictTrackers = []; 7861 var fdArrayIndex = new CFFIndex(); 7862 for (var i = 0, ii = dicts.length; i < ii; ++i) { 7863 var fontDict = dicts[i]; 7864 if (removeCidKeys) { 7865 fontDict.removeByName('CIDFontVersion'); 7866 fontDict.removeByName('CIDFontRevision'); 7867 fontDict.removeByName('CIDFontType'); 7868 fontDict.removeByName('CIDCount'); 7869 fontDict.removeByName('UIDBase'); 7870 } 7871 var fontDictTracker = new CFFOffsetTracker(); 7872 var fontDictData = this.compileDict(fontDict, fontDictTracker); 7873 fontDictTrackers.push(fontDictTracker); 7874 fdArrayIndex.add(fontDictData); 7875 fontDictTracker.offset(length); 7876 } 7877 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 7878 return { 7879 trackers: fontDictTrackers, 7880 output: fdArrayIndex 7881 }; 7882 }, 7883 compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) { 7884 for (var i = 0, ii = dicts.length; i < ii; ++i) { 7885 var fontDict = dicts[i]; 7886 assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.'); 7887 var privateDict = fontDict.privateDict; 7888 var privateDictTracker = new CFFOffsetTracker(); 7889 var privateDictData = this.compileDict(privateDict, privateDictTracker); 7890 var outputLength = output.length; 7891 privateDictTracker.offset(outputLength); 7892 if (!privateDictData.length) { 7893 outputLength = 0; 7894 } 7895 trackers[i].setEntryLocation('Private', [ 7896 privateDictData.length, 7897 outputLength 7898 ], output); 7899 output.add(privateDictData); 7900 if (privateDict.subrsIndex && privateDict.hasName('Subrs')) { 7901 var subrs = this.compileIndex(privateDict.subrsIndex); 7902 privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output); 7903 output.add(subrs); 7904 } 7905 } 7906 }, 7907 compileDict: function CFFCompiler_compileDict(dict, offsetTracker) { 7908 var out = []; 7909 var order = dict.order; 7910 for (var i = 0; i < order.length; ++i) { 7911 var key = order[i]; 7912 if (!(key in dict.values)) { 7913 continue; 7914 } 7915 var values = dict.values[key]; 7916 var types = dict.types[key]; 7917 if (!isArray(types)) { 7918 types = [types]; 7919 } 7920 if (!isArray(values)) { 7921 values = [values]; 7922 } 7923 if (values.length === 0) { 7924 continue; 7925 } 7926 for (var j = 0, jj = types.length; j < jj; ++j) { 7927 var type = types[j]; 7928 var value = values[j]; 7929 switch (type) { 7930 case 'num': 7931 case 'sid': 7932 out = out.concat(this.encodeNumber(value)); 7933 break; 7934 case 'offset': 7935 var name = dict.keyToNameMap[key]; 7936 if (!offsetTracker.isTracking(name)) { 7937 offsetTracker.track(name, out.length); 7938 } 7939 out = out.concat([ 7940 0x1d, 7941 0, 7942 0, 7943 0, 7944 0 7945 ]); 7946 break; 7947 case 'array': 7948 case 'delta': 7949 out = out.concat(this.encodeNumber(value)); 7950 for (var k = 1, kk = values.length; k < kk; ++k) { 7951 out = out.concat(this.encodeNumber(values[k])); 7952 } 7953 break; 7954 default: 7955 error('Unknown data type of ' + type); 7956 break; 7957 } 7958 } 7959 out = out.concat(dict.opcodes[key]); 7960 } 7961 return out; 7962 }, 7963 compileStringIndex: function CFFCompiler_compileStringIndex(strings) { 7964 var stringIndex = new CFFIndex(); 7965 for (var i = 0, ii = strings.length; i < ii; ++i) {
7966 stringIndex.add(stringToBytes(strings[i])); 7967 } 7968 return this.compileIndex(stringIndex); 7969 }, 7970 compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() { 7971 var globalSubrIndex = this.cff.globalSubrIndex; 7972 this.out.writeByteArray(this.compileIndex(globalSubrIndex)); 7973 }, 7974 compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) { 7975 return this.compileIndex(charStrings); 7976 }, 7977 compileCharset: function CFFCompiler_compileCharset(charset) { 7978 return this.compileTypedArray(charset.raw); 7979 }, 7980 compileEncoding: function CFFCompiler_compileEncoding(encoding) { 7981 return this.compileTypedArray(encoding.raw); 7982 }, 7983 compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) { 7984 return this.compileTypedArray(fdSelect); 7985 }, 7986 compileTypedArray: function CFFCompiler_compileTypedArray(data) { 7987 var out = []; 7988 for (var i = 0, ii = data.length; i < ii; ++i) { 7989 out[i] = data[i]; 7990 } 7991 return out; 7992 }, 7993 compileIndex: function CFFCompiler_compileIndex(index, trackers) { 7994 trackers = trackers || []; 7995 var objects = index.objects; 7996 var count = objects.length; 7997 if (count === 0) { 7998 return [ 7999 0, 8000 0, 8001 0 8002 ]; 8003 } 8004 var data = [ 8005 count >> 8 & 0xFF, 8006 count & 0xff 8007 ]; 8008 var lastOffset = 1, i; 8009 for (i = 0; i < count; ++i) { 8010 lastOffset += objects[i].length; 8011 } 8012 var offsetSize; 8013 if (lastOffset < 0x100) { 8014 offsetSize = 1; 8015 } else if (lastOffset < 0x10000) { 8016 offsetSize = 2; 8017 } else if (lastOffset < 0x1000000) { 8018 offsetSize = 3; 8019 } else { 8020 offsetSize = 4; 8021 } 8022 data.push(offsetSize); 8023 var relativeOffset = 1; 8024 for (i = 0; i < count + 1; i++) { 8025 if (offsetSize === 1) { 8026 data.push(relativeOffset & 0xFF); 8027 } else if (offsetSize === 2) { 8028 data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF); 8029 } else if (offsetSize === 3) { 8030 data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF); 8031 } else { 8032 data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF); 8033 } 8034 if (objects[i]) { 8035 relativeOffset += objects[i].length; 8036 } 8037 } 8038 for (i = 0; i < count; i++) { 8039 if (trackers[i]) { 8040 trackers[i].offset(data.length); 8041 } 8042 for (var j = 0, jj = objects[i].length; j < jj; j++) { 8043 data.push(objects[i][j]); 8044 } 8045 } 8046 return data; 8047 } 8048 }; 8049 return CFFCompiler; 8050 }(); 8051 exports.CFFStandardStrings = CFFStandardStrings; 8052 exports.CFFParser = CFFParser; 8053 exports.CFF = CFF; 8054 exports.CFFHeader = CFFHeader; 8055 exports.CFFStrings = CFFStrings; 8056 exports.CFFIndex = CFFIndex; 8057 exports.CFFCharset = CFFCharset; 8058 exports.CFFTopDict = CFFTopDict; 8059 exports.CFFPrivateDict = CFFPrivateDict; 8060 exports.CFFCompiler = CFFCompiler; 8061 })); 8062 (function (root, factory) { 8063 factory(root.pdfjsCoreChunkedStream = {}, root.pdfjsSharedUtil); 8064 }(this, function (exports, sharedUtil) { 8065 var MissingDataException = sharedUtil.MissingDataException; 8066 var arrayByteLength = sharedUtil.arrayByteLength; 8067 var arraysToBytes = sharedUtil.arraysToBytes; 8068 var assert = sharedUtil.assert; 8069 var createPromiseCapability = sharedUtil.createPromiseCapability; 8070 var isInt = sharedUtil.isInt; 8071 var isEmptyObj = sharedUtil.isEmptyObj; 8072 var ChunkedStream = function ChunkedStreamClosure() { 8073 function ChunkedStream(length, chunkSize, manager) { 8074 this.bytes = new Uint8Array(length); 8075 this.start = 0; 8076 this.pos = 0; 8077 this.end = length; 8078 this.chunkSize = chunkSize; 8079 this.loadedChunks = []; 8080 this.numChunksLoaded = 0; 8081 this.numChunks = Math.ceil(length / chunkSize); 8082 this.manager = manager; 8083 this.progressiveDataLength = 0; 8084 this.lastSuccessfulEnsureByteChunk = -1; 8085 } 8086 ChunkedStream.prototype = { 8087 getMissingChunks: function ChunkedStream_getMissingChunks() { 8088 var chunks = []; 8089 for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 8090 if (!this.loadedChunks[chunk]) { 8091 chunks.push(chunk); 8092 } 8093 } 8094 return chunks; 8095 }, 8096 getBaseStreams: function ChunkedStream_getBaseStreams() { 8097 return [this]; 8098 }, 8099 allChunksLoaded: function ChunkedStream_allChunksLoaded() { 8100 return this.numChunksLoaded === this.numChunks; 8101 }, 8102 onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) { 8103 var end = begin + chunk.byteLength; 8104 assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin); 8105 var length = this.bytes.length; 8106 assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end); 8107 this.bytes.set(new Uint8Array(chunk), begin); 8108 var chunkSize = this.chunkSize; 8109 var beginChunk = Math.floor(begin / chunkSize); 8110 var endChunk = Math.floor((end - 1) / chunkSize) + 1; 8111 var curChunk; 8112 for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 8113 if (!this.loadedChunks[curChunk]) { 8114 this.loadedChunks[curChunk] = true; 8115 ++this.numChunksLoaded; 8116 } 8117 } 8118 }, 8119 onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) { 8120 var position = this.progressiveDataLength; 8121 var beginChunk = Math.floor(position / this.chunkSize); 8122 this.bytes.set(new Uint8Array(data), position); 8123 position += data.byteLength; 8124 this.progressiveDataLength = position; 8125 var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 8126 var curChunk; 8127 for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 8128 if (!this.loadedChunks[curChunk]) { 8129 this.loadedChunks[curChunk] = true; 8130 ++this.numChunksLoaded; 8131 } 8132 } 8133 }, 8134 ensureByte: function ChunkedStream_ensureByte(pos) { 8135 var chunk = Math.floor(pos / this.chunkSize); 8136 if (chunk === this.lastSuccessfulEnsureByteChunk) { 8137 return; 8138 } 8139 if (!this.loadedChunks[chunk]) { 8140 throw new MissingDataException(pos, pos + 1); 8141 } 8142 this.lastSuccessfulEnsureByteChunk = chunk; 8143 }, 8144 ensureRange: function ChunkedStream_ensureRange(begin, end) { 8145 if (begin >= end) { 8146 return; 8147 } 8148 if (end <= this.progressiveDataLength) { 8149 return; 8150 } 8151 var chunkSize = this.chunkSize; 8152 var beginChunk = Math.floor(begin / chunkSize); 8153 var endChunk = Math.floor((end - 1) / chunkSize) + 1; 8154 for (var chunk = beginChunk; chunk < endChunk; ++chunk) { 8155 if (!this.loadedChunks[chunk]) { 8156 throw new MissingDataException(begin, end); 8157 } 8158 } 8159 }, 8160 nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) { 8161 var chunk, numChunks = this.numChunks; 8162 for (var i = 0; i < numChunks; ++i) { 8163 chunk = (beginChunk + i) % numChunks; 8164 if (!this.loadedChunks[chunk]) { 8165 return chunk; 8166 } 8167 } 8168 return null; 8169 }, 8170 hasChunk: function ChunkedStream_hasChunk(chunk) { 8171 return !!this.loadedChunks[chunk]; 8172 }, 8173 get length() {
8174 return this.end - this.start; 8175 }, 8176 get isEmpty() { 8177 return this.length === 0; 8178 }, 8179 getByte: function ChunkedStream_getByte() { 8180 var pos = this.pos; 8181 if (pos >= this.end) { 8182 return -1; 8183 } 8184 this.ensureByte(pos); 8185 return this.bytes[this.pos++]; 8186 }, 8187 getUint16: function ChunkedStream_getUint16() { 8188 var b0 = this.getByte(); 8189 var b1 = this.getByte(); 8190 if (b0 === -1 || b1 === -1) { 8191 return -1; 8192 } 8193 return (b0 << 8) + b1; 8194 }, 8195 getInt32: function ChunkedStream_getInt32() { 8196 var b0 = this.getByte(); 8197 var b1 = this.getByte(); 8198 var b2 = this.getByte(); 8199 var b3 = this.getByte(); 8200 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 8201 }, 8202 getBytes: function ChunkedStream_getBytes(length) { 8203 var bytes = this.bytes; 8204 var pos = this.pos; 8205 var strEnd = this.end; 8206 if (!length) { 8207 this.ensureRange(pos, strEnd); 8208 return bytes.subarray(pos, strEnd); 8209 } 8210 var end = pos + length; 8211 if (end > strEnd) { 8212 end = strEnd; 8213 } 8214 this.ensureRange(pos, end); 8215 this.pos = end; 8216 return bytes.subarray(pos, end); 8217 }, 8218 peekByte: function ChunkedStream_peekByte() { 8219 var peekedByte = this.getByte(); 8220 this.pos--; 8221 return peekedByte; 8222 }, 8223 peekBytes: function ChunkedStream_peekBytes(length) { 8224 var bytes = this.getBytes(length); 8225 this.pos -= bytes.length; 8226 return bytes; 8227 }, 8228 getByteRange: function ChunkedStream_getBytes(begin, end) { 8229 this.ensureRange(begin, end); 8230 return this.bytes.subarray(begin, end); 8231 }, 8232 skip: function ChunkedStream_skip(n) { 8233 if (!n) { 8234 n = 1; 8235 } 8236 this.pos += n; 8237 }, 8238 reset: function ChunkedStream_reset() { 8239 this.pos = this.start; 8240 }, 8241 moveStart: function ChunkedStream_moveStart() { 8242 this.start = this.pos; 8243 }, 8244 makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) { 8245 this.ensureRange(start, start + length); 8246 function ChunkedStreamSubstream() { 8247 } 8248 ChunkedStreamSubstream.prototype = Object.create(this); 8249 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 8250 var chunkSize = this.chunkSize; 8251 var beginChunk = Math.floor(this.start / chunkSize); 8252 var endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 8253 var missingChunks = []; 8254 for (var chunk = beginChunk; chunk < endChunk; ++chunk) { 8255 if (!this.loadedChunks[chunk]) { 8256 missingChunks.push(chunk); 8257 } 8258 } 8259 return missingChunks; 8260 }; 8261 var subStream = new ChunkedStreamSubstream(); 8262 subStream.pos = subStream.start = start; 8263 subStream.end = start + length || this.end; 8264 subStream.dict = dict; 8265 return subStream; 8266 } 8267 }; 8268 return ChunkedStream; 8269 }(); 8270 var ChunkedStreamManager = function ChunkedStreamManagerClosure() { 8271 function ChunkedStreamManager(pdfNetworkStream, args) { 8272 var chunkSize = args.rangeChunkSize; 8273 var length = args.length; 8274 this.stream = new ChunkedStream(length, chunkSize, this); 8275 this.length = length; 8276 this.chunkSize = chunkSize; 8277 this.pdfNetworkStream = pdfNetworkStream; 8278 this.url = args.url; 8279 this.disableAutoFetch = args.disableAutoFetch; 8280 this.msgHandler = args.msgHandler; 8281 this.currRequestId = 0; 8282 this.chunksNeededByRequest = Object.create(null); 8283 this.requestsByChunk = Object.create(null); 8284 this.promisesByRequest = Object.create(null); 8285 this.progressiveDataLength = 0; 8286 this.aborted = false; 8287 this._loadedStreamCapability = createPromiseCapability(); 8288 } 8289 ChunkedStreamManager.prototype = {
8290 onLoadedStream: function ChunkedStreamManager_getLoadedStream() { 8291 return this._loadedStreamCapability.promise; 8292 }, 8293 sendRequest: function ChunkedStreamManager_sendRequest(begin, end) { 8294 var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 8295 if (!rangeReader.isStreamingSupported) { 8296 rangeReader.onProgress = this.onProgress.bind(this); 8297 } 8298 var chunks = [], loaded = 0; 8299 var manager = this; 8300 var promise = new Promise(function (resolve, reject) { 8301 var readChunk = function (chunk) { 8302 try { 8303 if (!chunk.done) { 8304 var data = chunk.value; 8305 chunks.push(data); 8306 loaded += arrayByteLength(data); 8307 if (rangeReader.isStreamingSupported) { 8308 manager.onProgress({ loaded: loaded }); 8309 } 8310 rangeReader.read().then(readChunk, reject); 8311 return; 8312 } 8313 var chunkData = arraysToBytes(chunks); 8314 chunks = null; 8315 resolve(chunkData); 8316 } catch (e) { 8317 reject(e); 8318 } 8319 }; 8320 rangeReader.read().then(readChunk, reject); 8321 }); 8322 promise.then(function (data) { 8323 if (this.aborted) { 8324 return; 8325 } 8326 this.onReceiveData({ 8327 chunk: data, 8328 begin: begin 8329 }); 8330 }.bind(this)); 8331 }, 8332 requestAllChunks: function ChunkedStreamManager_requestAllChunks() { 8333 var missingChunks = this.stream.getMissingChunks(); 8334 this._requestChunks(missingChunks); 8335 return this._loadedStreamCapability.promise; 8336 }, 8337 _requestChunks: function ChunkedStreamManager_requestChunks(chunks) { 8338 var requestId = this.currRequestId++; 8339 var i, ii; 8340 var chunksNeeded = Object.create(null); 8341 this.chunksNeededByRequest[requestId] = chunksNeeded; 8342 for (i = 0, ii = chunks.length; i < ii; i++) { 8343 if (!this.stream.hasChunk(chunks[i])) { 8344 chunksNeeded[chunks[i]] = true; 8345 } 8346 } 8347 if (isEmptyObj(chunksNeeded)) { 8348 return Promise.resolve(); 8349 } 8350 var capability = createPromiseCapability(); 8351 this.promisesByRequest[requestId] = capability; 8352 var chunksToRequest = []; 8353 for (var chunk in chunksNeeded) { 8354 chunk = chunk | 0; 8355 if (!(chunk in this.requestsByChunk)) { 8356 this.requestsByChunk[chunk] = []; 8357 chunksToRequest.push(chunk); 8358 } 8359 this.requestsByChunk[chunk].push(requestId); 8360 } 8361 if (!chunksToRequest.length) { 8362 return capability.promise; 8363 } 8364 var groupedChunksToRequest = this.groupChunks(chunksToRequest); 8365 for (i = 0; i < groupedChunksToRequest.length; ++i) { 8366 var groupedChunk = groupedChunksToRequest[i]; 8367 var begin = groupedChunk.beginChunk * this.chunkSize; 8368 var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 8369 this.sendRequest(begin, end); 8370 } 8371 return capability.promise; 8372 }, 8373 getStream: function ChunkedStreamManager_getStream() { 8374 return this.stream; 8375 }, 8376 requestRange: function ChunkedStreamManager_requestRange(begin, end) { 8377 end = Math.min(end, this.length); 8378 var beginChunk = this.getBeginChunk(begin); 8379 var endChunk = this.getEndChunk(end); 8380 var chunks = []; 8381 for (var chunk = beginChunk; chunk < endChunk; ++chunk) { 8382 chunks.push(chunk); 8383 } 8384 return this._requestChunks(chunks); 8385 }, 8386 requestRanges: function ChunkedStreamManager_requestRanges(ranges) { 8387 ranges = ranges || []; 8388 var chunksToRequest = []; 8389 for (var i = 0; i < ranges.length; i++) { 8390 var beginChunk = this.getBeginChunk(ranges[i].begin); 8391 var endChunk = this.getEndChunk(ranges[i].end); 8392 for (var chunk = beginChunk; chunk < endChunk; ++chunk) { 8393 if (chunksToRequest.indexOf(chunk) < 0) { 8394 chunksToRequest.push(chunk); 8395 } 8396 } 8397 } 8398 chunksToRequest.sort(function (a, b) { 8399 return a - b; 8400 }); 8401 return this._requestChunks(chunksToRequest); 8402 }, 8403 groupChunks: function ChunkedStreamManager_groupChunks(chunks) { 8404 var groupedChunks = []; 8405 var beginChunk = -1; 8406 var prevChunk = -1; 8407 for (var i = 0; i < chunks.length; ++i) { 8408 var chunk = chunks[i]; 8409 if (beginChunk < 0) { 8410 beginChunk = chunk; 8411 } 8412 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 8413 groupedChunks.push({ 8414 beginChunk: beginChunk, 8415 endChunk: prevChunk + 1 8416 }); 8417 beginChunk = chunk; 8418 } 8419 if (i + 1 === chunks.length) { 8420 groupedChunks.push({ 8421 beginChunk: beginChunk, 8422 endChunk: chunk + 1 8423 }); 8424 } 8425 prevChunk = chunk; 8426 } 8427 return groupedChunks; 8428 }, 8429 onProgress: function ChunkedStreamManager_onProgress(args) { 8430 var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded; 8431 this.msgHandler.send('DocProgress', { 8432 loaded: bytesLoaded, 8433 total: this.length 8434 }); 8435 }, 8436 onReceiveData: function ChunkedStreamManager_onReceiveData(args) { 8437 var chunk = args.chunk; 8438 var isProgressive = args.begin === undefined; 8439 var begin = isProgressive ? this.progressiveDataLength : args.begin; 8440 var end = begin + chunk.byteLength; 8441 var beginChunk = Math.floor(begin / this.chunkSize); 8442 var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 8443 if (isProgressive) { 8444 this.stream.onReceiveProgressiveData(chunk); 8445 this.progressiveDataLength = end; 8446 } else { 8447 this.stream.onReceiveData(begin, chunk); 8448 } 8449 if (this.stream.allChunksLoaded()) { 8450 this._loadedStreamCapability.resolve(this.stream); 8451 } 8452 var loadedRequests = []; 8453 var i, requestId; 8454 for (chunk = beginChunk; chunk < endChunk; ++chunk) { 8455 var requestIds = this.requestsByChunk[chunk] || []; 8456 delete this.requestsByChunk[chunk]; 8457 for (i = 0; i < requestIds.length; ++i) { 8458 requestId = requestIds[i]; 8459 var chunksNeeded = this.chunksNeededByRequest[requestId]; 8460 if (chunk in chunksNeeded) { 8461 delete chunksNeeded[chunk]; 8462 } 8463 if (!isEmptyObj(chunksNeeded)) { 8464 continue; 8465 } 8466 loadedRequests.push(requestId); 8467 } 8468 } 8469 if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) { 8470 var nextEmptyChunk; 8471 if (this.stream.numChunksLoaded === 1) { 8472 var lastChunk = this.stream.numChunks - 1; 8473 if (!this.stream.hasChunk(lastChunk)) { 8474 nextEmptyChunk = lastChunk; 8475 } 8476 } else { 8477 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 8478 } 8479 if (isInt(nextEmptyChunk)) { 8480 this._requestChunks([nextEmptyChunk]); 8481 } 8482 } 8483 for (i = 0; i < loadedRequests.length; ++i) { 8484 requestId = loadedRequests[i]; 8485 var capability = this.promisesByRequest[requestId]; 8486 delete this.promisesByRequest[requestId]; 8487 capability.resolve(); 8488 } 8489 this.msgHandler.send('DocProgress', { 8490 loaded: this.stream.numChunksLoaded * this.chunkSize, 8491 total: this.length 8492 }); 8493 }, 8494 onError: function ChunkedStreamManager_onError(err) { 8495 this._loadedStreamCapability.reject(err); 8496 }, 8497 getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) { 8498 var chunk = Math.floor(begin / this.chunkSize); 8499 return chunk; 8500 },
8501 getEndChunk: function ChunkedStreamManager_getEndChunk(end) { 8502 var chunk = Math.floor((end - 1) / this.chunkSize) + 1; 8503 return chunk; 8504 }, 8505 abort: function ChunkedStreamManager_abort() { 8506 this.aborted = true; 8507 if (this.pdfNetworkStream) { 8508 this.pdfNetworkStream.cancelAllRequests('abort'); 8509 } 8510 for (var requestId in this.promisesByRequest) { 8511 var capability = this.promisesByRequest[requestId]; 8512 capability.reject(new Error('Request was aborted')); 8513 } 8514 } 8515 }; 8516 return ChunkedStreamManager; 8517 }(); 8518 exports.ChunkedStream = ChunkedStream; 8519 exports.ChunkedStreamManager = ChunkedStreamManager; 8520 })); 8521 (function (root, factory) { 8522 factory(root.pdfjsCoreGlyphList = {}, root.pdfjsSharedUtil); 8523 }(this, function (exports, sharedUtil) { 8524 var getLookupTableFactory = sharedUtil.getLookupTableFactory; 8525 var getGlyphsUnicode = getLookupTableFactory(function (t) { 8526 t['A'] = 0x0041; 8527 t['AE'] = 0x00C6; 8528 t['AEacute'] = 0x01FC; 8529 t['AEmacron'] = 0x01E2; 8530 t['AEsmall'] = 0xF7E6; 8531 t['Aacute'] = 0x00C1; 8532 t['Aacutesmall'] = 0xF7E1; 8533 t['Abreve'] = 0x0102; 8534 t['Abreveacute'] = 0x1EAE; 8535 t['Abrevecyrillic'] = 0x04D0; 8536 t['Abrevedotbelow'] = 0x1EB6; 8537 t['Abrevegrave'] = 0x1EB0; 8538 t['Abrevehookabove'] = 0x1EB2; 8539 t['Abrevetilde'] = 0x1EB4; 8540 t['Acaron'] = 0x01CD; 8541 t['Acircle'] = 0x24B6; 8542 t['Acircumflex'] = 0x00C2; 8543 t['Acircumflexacute'] = 0x1EA4; 8544 t['Acircumflexdotbelow'] = 0x1EAC; 8545 t['Acircumflexgrave'] = 0x1EA6; 8546 t['Acircumflexhookabove'] = 0x1EA8; 8547 t['Acircumflexsmall'] = 0xF7E2; 8548 t['Acircumflextilde'] = 0x1EAA; 8549 t['Acute'] = 0xF6C9; 8550 t['Acutesmall'] = 0xF7B4; 8551 t['Acyrillic'] = 0x0410; 8552 t['Adblgrave'] = 0x0200; 8553 t['Adieresis'] = 0x00C4; 8554 t['Adieresiscyrillic'] = 0x04D2; 8555 t['Adieresismacron'] = 0x01DE; 8556 t['Adieresissmall'] = 0xF7E4; 8557 t['Adotbelow'] = 0x1EA0; 8558 t['Adotmacron'] = 0x01E0; 8559 t['Agrave'] = 0x00C0; 8560 t['Agravesmall'] = 0xF7E0; 8561 t['Ahookabove'] = 0x1EA2; 8562 t['Aiecyrillic'] = 0x04D4; 8563 t['Ainvertedbreve'] = 0x0202; 8564 t['Alpha'] = 0x0391; 8565 t['Alphatonos'] = 0x0386; 8566 t['Amacron'] = 0x0100; 8567 t['Amonospace'] = 0xFF21; 8568 t['Aogonek'] = 0x0104; 8569 t['Aring'] = 0x00C5; 8570 t['Aringacute'] = 0x01FA; 8571 t['Aringbelow'] = 0x1E00; 8572 t['Aringsmall'] = 0xF7E5; 8573 t['Asmall'] = 0xF761; 8574 t['Atilde'] = 0x00C3; 8575 t['Atildesmall'] = 0xF7E3; 8576 t['Aybarmenian'] = 0x0531; 8577 t['B'] = 0x0042; 8578 t['Bcircle'] = 0x24B7; 8579 t['Bdotaccent'] = 0x1E02; 8580 t['Bdotbelow'] = 0x1E04; 8581 t['Becyrillic'] = 0x0411; 8582 t['Benarmenian'] = 0x0532; 8583 t['Beta'] = 0x0392; 8584 t['Bhook'] = 0x0181; 8585 t['Blinebelow'] = 0x1E06; 8586 t['Bmonospace'] = 0xFF22; 8587 t['Brevesmall'] = 0xF6F4; 8588 t['Bsmall'] = 0xF762; 8589 t['Btopbar'] = 0x0182; 8590 t['C'] = 0x0043; 8591 t['Caarmenian'] = 0x053E; 8592 t['Cacute'] = 0x0106; 8593 t['Caron'] = 0xF6CA; 8594 t['Caronsmall'] = 0xF6F5; 8595 t['Ccaron'] = 0x010C; 8596 t['Ccedilla'] = 0x00C7; 8597 t['Ccedillaacute'] = 0x1E08; 8598 t['Ccedillasmall'] = 0xF7E7; 8599 t['Ccircle'] = 0x24B8; 8600 t['Ccircumflex'] = 0x0108; 8601 t['Cdot'] = 0x010A; 8602 t['Cdotaccent'] = 0x010A; 8603 t['Cedillasmall'] = 0xF7B8; 8604 t['Chaarmenian'] = 0x0549; 8605 t['Cheabkhasiancyrillic'] = 0x04BC; 8606 t['Checyrillic'] = 0x0427; 8607 t['Chedescenderabkhasiancyrillic'] = 0x04BE; 8608 t['Chedescendercyrillic'] = 0x04B6; 8609 t['Chedieresiscyrillic'] = 0x04F4; 8610 t['Cheharmenian'] = 0x0543; 8611 t['Chekhakassiancyrillic'] = 0x04CB; 8612 t['Cheverticalstrokecyrillic'] = 0x04B8; 8613 t['Chi'] = 0x03A7; 8614 t['Chook'] = 0x0187; 8615 t['Circumflexsmall'] = 0xF6F6; 8616 t['Cmonospace'] = 0xFF23; 8617 t['Coarmenian'] = 0x0551; 8618 t['Csmall'] = 0xF763; 8619 t['D'] = 0x0044; 8620 t['DZ'] = 0x01F1; 8621 t['DZcaron'] = 0x01C4; 8622 t['Daarmenian'] = 0x0534; 8623 t['Dafrican'] = 0x0189; 8624 t['Dcaron'] = 0x010E; 8625 t['Dcedilla'] = 0x1E10; 8626 t['Dcircle'] = 0x24B9; 8627 t['Dcircumflexbelow'] = 0x1E12; 8628 t['Dcroat'] = 0x0110; 8629 t['Ddotaccent'] = 0x1E0A; 8630 t['Ddotbelow'] = 0x1E0C; 8631 t['Decyrillic'] = 0x0414; 8632 t['Deicoptic'] = 0x03EE; 8633 t['Delta'] = 0x2206; 8634 t['Deltagreek'] = 0x0394; 8635 t['Dhook'] = 0x018A; 8636 t['Dieresis'] = 0xF6CB; 8637 t['DieresisAcute'] = 0xF6CC; 8638 t['DieresisGrave'] = 0xF6CD; 8639 t['Dieresissmall'] = 0xF7A8; 8640 t['Digammagreek'] = 0x03DC; 8641 t['Djecyrillic'] = 0x0402; 8642 t['Dlinebelow'] = 0x1E0E; 8643 t['Dmonospace'] = 0xFF24; 8644 t['Dotaccentsmall'] = 0xF6F7; 8645 t['Dslash'] = 0x0110; 8646 t['Dsmall'] = 0xF764; 8647 t['Dtopbar'] = 0x018B; 8648 t['Dz'] = 0x01F2; 8649 t['Dzcaron'] = 0x01C5; 8650 t['Dzeabkhasiancyrillic'] = 0x04E0; 8651 t['Dzecyrillic'] = 0x0405; 8652 t['Dzhecyrillic'] = 0x040F; 8653 t['E'] = 0x0045; 8654 t['Eacute'] = 0x00C9; 8655 t['Eacutesmall'] = 0xF7E9; 8656 t['Ebreve'] = 0x0114; 8657 t['Ecaron'] = 0x011A; 8658 t['Ecedillabreve'] = 0x1E1C; 8659 t['Echarmenian'] = 0x0535; 8660 t['Ecircle'] = 0x24BA; 8661 t['Ecircumflex'] = 0x00CA; 8662 t['Ecircumflexacute'] = 0x1EBE; 8663 t['Ecircumflexbelow'] = 0x1E18; 8664 t['Ecircumflexdotbelow'] = 0x1EC6; 8665 t['Ecircumflexgrave'] = 0x1EC0; 8666 t['Ecircumflexhookabove'] = 0x1EC2; 8667 t['Ecircumflexsmall'] = 0xF7EA; 8668 t['Ecircumflextilde'] = 0x1EC4; 8669 t['Ecyrillic'] = 0x0404; 8670 t['Edblgrave'] = 0x0204; 8671 t['Edieresis'] = 0x00CB; 8672 t['Edieresissmall'] = 0xF7EB; 8673 t['Edot'] = 0x0116; 8674 t['Edotaccent'] = 0x0116; 8675 t['Edotbelow'] = 0x1EB8;
8676 t['Efcyrillic'] = 0x0424; 8677 t['Egrave'] = 0x00C8; 8678 t['Egravesmall'] = 0xF7E8; 8679 t['Eharmenian'] = 0x0537; 8680 t['Ehookabove'] = 0x1EBA; 8681 t['Eightroman'] = 0x2167; 8682 t['Einvertedbreve'] = 0x0206; 8683 t['Eiotifiedcyrillic'] = 0x0464; 8684 t['Elcyrillic'] = 0x041B; 8685 t['Elevenroman'] = 0x216A; 8686 t['Emacron'] = 0x0112; 8687 t['Emacronacute'] = 0x1E16; 8688 t['Emacrongrave'] = 0x1E14; 8689 t['Emcyrillic'] = 0x041C; 8690 t['Emonospace'] = 0xFF25; 8691 t['Encyrillic'] = 0x041D; 8692 t['Endescendercyrillic'] = 0x04A2; 8693 t['Eng'] = 0x014A; 8694 t['Enghecyrillic'] = 0x04A4; 8695 t['Enhookcyrillic'] = 0x04C7; 8696 t['Eogonek'] = 0x0118; 8697 t['Eopen'] = 0x0190; 8698 t['Epsilon'] = 0x0395; 8699 t['Epsilontonos'] = 0x0388; 8700 t['Ercyrillic'] = 0x0420; 8701 t['Ereversed'] = 0x018E; 8702 t['Ereversedcyrillic'] = 0x042D; 8703 t['Escyrillic'] = 0x0421; 8704 t['Esdescendercyrillic'] = 0x04AA; 8705 t['Esh'] = 0x01A9; 8706 t['Esmall'] = 0xF765; 8707 t['Eta'] = 0x0397; 8708 t['Etarmenian'] = 0x0538; 8709 t['Etatonos'] = 0x0389; 8710 t['Eth'] = 0x00D0; 8711 t['Ethsmall'] = 0xF7F0; 8712 t['Etilde'] = 0x1EBC; 8713 t['Etildebelow'] = 0x1E1A; 8714 t['Euro'] = 0x20AC; 8715 t['Ezh'] = 0x01B7; 8716 t['Ezhcaron'] = 0x01EE; 8717 t['Ezhreversed'] = 0x01B8; 8718 t['F'] = 0x0046; 8719 t['Fcircle'] = 0x24BB; 8720 t['Fdotaccent'] = 0x1E1E; 8721 t['Feharmenian'] = 0x0556; 8722 t['Feicoptic'] = 0x03E4; 8723 t['Fhook'] = 0x0191; 8724 t['Fitacyrillic'] = 0x0472; 8725 t['Fiveroman'] = 0x2164; 8726 t['Fmonospace'] = 0xFF26; 8727 t['Fourroman'] = 0x2163; 8728 t['Fsmall'] = 0xF766; 8729 t['G'] = 0x0047; 8730 t['GBsquare'] = 0x3387; 8731 t['Gacute'] = 0x01F4; 8732 t['Gamma'] = 0x0393; 8733 t['Gammaafrican'] = 0x0194; 8734 t['Gangiacoptic'] = 0x03EA; 8735 t['Gbreve'] = 0x011E; 8736 t['Gcaron'] = 0x01E6; 8737 t['Gcedilla'] = 0x0122; 8738 t['Gcircle'] = 0x24BC; 8739 t['Gcircumflex'] = 0x011C; 8740 t['Gcommaaccent'] = 0x0122; 8741 t['Gdot'] = 0x0120; 8742 t['Gdotaccent'] = 0x0120; 8743 t['Gecyrillic'] = 0x0413; 8744 t['Ghadarmenian'] = 0x0542; 8745 t['Ghemiddlehookcyrillic'] = 0x0494; 8746 t['Ghestrokecyrillic'] = 0x0492; 8747 t['Gheupturncyrillic'] = 0x0490; 8748 t['Ghook'] = 0x0193; 8749 t['Gimarmenian'] = 0x0533; 8750 t['Gjecyrillic'] = 0x0403; 8751 t['Gmacron'] = 0x1E20; 8752 t['Gmonospace'] = 0xFF27; 8753 t['Grave'] = 0xF6CE; 8754 t['Gravesmall'] = 0xF760; 8755 t['Gsmall'] = 0xF767; 8756 t['Gsmallhook'] = 0x029B; 8757 t['Gstroke'] = 0x01E4; 8758 t['H'] = 0x0048; 8759 t['H18533'] = 0x25CF; 8760 t['H18543'] = 0x25AA; 8761 t['H18551'] = 0x25AB; 8762 t['H22073'] = 0x25A1; 8763 t['HPsquare'] = 0x33CB; 8764 t['Haabkhasiancyrillic'] = 0x04A8; 8765 t['Hadescendercyrillic'] = 0x04B2; 8766 t['Hardsigncyrillic'] = 0x042A; 8767 t['Hbar'] = 0x0126; 8768 t['Hbrevebelow'] = 0x1E2A; 8769 t['Hcedilla'] = 0x1E28; 8770 t['Hcircle'] = 0x24BD; 8771 t['Hcircumflex'] = 0x0124; 8772 t['Hdieresis'] = 0x1E26; 8773 t['Hdotaccent'] = 0x1E22; 8774 t['Hdotbelow'] = 0x1E24; 8775 t['Hmonospace'] = 0xFF28; 8776 t['Hoarmenian'] = 0x0540; 8777 t['Horicoptic'] = 0x03E8; 8778 t['Hsmall'] = 0xF768; 8779 t['Hungarumlaut'] = 0xF6CF; 8780 t['Hungarumlautsmall'] = 0xF6F8; 8781 t['Hzsquare'] = 0x3390; 8782 t['I'] = 0x0049; 8783 t['IAcyrillic'] = 0x042F; 8784 t['IJ'] = 0x0132; 8785 t['IUcyrillic'] = 0x042E; 8786 t['Iacute'] = 0x00CD; 8787 t['Iacutesmall'] = 0xF7ED; 8788 t['Ibreve'] = 0x012C; 8789 t['Icaron'] = 0x01CF; 8790 t['Icircle'] = 0x24BE; 8791 t['Icircumflex'] = 0x00CE; 8792 t['Icircumflexsmall'] = 0xF7EE; 8793 t['Icyrillic'] = 0x0406; 8794 t['Idblgrave'] = 0x0208; 8795 t['Idieresis'] = 0x00CF; 8796 t['Idieresisacute'] = 0x1E2E; 8797 t['Idieresiscyrillic'] = 0x04E4; 8798 t['Idieresissmall'] = 0xF7EF; 8799 t['Idot'] = 0x0130; 8800 t['Idotaccent'] = 0x0130; 8801 t['Idotbelow'] = 0x1ECA; 8802 t['Iebrevecyrillic'] = 0x04D6; 8803 t['Iecyrillic'] = 0x0415; 8804 t['Ifraktur'] = 0x2111; 8805 t['Igrave'] = 0x00CC; 8806 t['Igravesmall'] = 0xF7EC; 8807 t['Ihookabove'] = 0x1EC8; 8808 t['Iicyrillic'] = 0x0418; 8809 t['Iinvertedbreve'] = 0x020A; 8810 t['Iishortcyrillic'] = 0x0419; 8811 t['Imacron'] = 0x012A; 8812 t['Imacroncyrillic'] = 0x04E2; 8813 t['Imonospace'] = 0xFF29; 8814 t['Iniarmenian'] = 0x053B; 8815 t['Iocyrillic'] = 0x0401; 8816 t['Iogonek'] = 0x012E; 8817 t['Iota'] = 0x0399; 8818 t['Iotaafrican'] = 0x0196; 8819 t['Iotadieresis'] = 0x03AA;
8820 t['Iotatonos'] = 0x038A; 8821 t['Ismall'] = 0xF769; 8822 t['Istroke'] = 0x0197; 8823 t['Itilde'] = 0x0128; 8824 t['Itildebelow'] = 0x1E2C; 8825 t['Izhitsacyrillic'] = 0x0474; 8826 t['Izhitsadblgravecyrillic'] = 0x0476; 8827 t['J'] = 0x004A; 8828 t['Jaarmenian'] = 0x0541; 8829 t['Jcircle'] = 0x24BF; 8830 t['Jcircumflex'] = 0x0134; 8831 t['Jecyrillic'] = 0x0408; 8832 t['Jheharmenian'] = 0x054B; 8833 t['Jmonospace'] = 0xFF2A; 8834 t['Jsmall'] = 0xF76A; 8835 t['K'] = 0x004B; 8836 t['KBsquare'] = 0x3385; 8837 t['KKsquare'] = 0x33CD; 8838 t['Kabashkircyrillic'] = 0x04A0; 8839 t['Kacute'] = 0x1E30; 8840 t['Kacyrillic'] = 0x041A; 8841 t['Kadescendercyrillic'] = 0x049A; 8842 t['Kahookcyrillic'] = 0x04C3; 8843 t['Kappa'] = 0x039A; 8844 t['Kastrokecyrillic'] = 0x049E; 8845 t['Kaverticalstrokecyrillic'] = 0x049C; 8846 t['Kcaron'] = 0x01E8; 8847 t['Kcedilla'] = 0x0136; 8848 t['Kcircle'] = 0x24C0; 8849 t['Kcommaaccent'] = 0x0136; 8850 t['Kdotbelow'] = 0x1E32; 8851 t['Keharmenian'] = 0x0554; 8852 t['Kenarmenian'] = 0x053F; 8853 t['Khacyrillic'] = 0x0425; 8854 t['Kheicoptic'] = 0x03E6; 8855 t['Khook'] = 0x0198; 8856 t['Kjecyrillic'] = 0x040C; 8857 t['Klinebelow'] = 0x1E34; 8858 t['Kmonospace'] = 0xFF2B; 8859 t['Koppacyrillic'] = 0x0480; 8860 t['Koppagreek'] = 0x03DE; 8861 t['Ksicyrillic'] = 0x046E; 8862 t['Ksmall'] = 0xF76B; 8863 t['L'] = 0x004C; 8864 t['LJ'] = 0x01C7; 8865 t['LL'] = 0xF6BF; 8866 t['Lacute'] = 0x0139; 8867 t['Lambda'] = 0x039B; 8868 t['Lcaron'] = 0x013D; 8869 t['Lcedilla'] = 0x013B; 8870 t['Lcircle'] = 0x24C1; 8871 t['Lcircumflexbelow'] = 0x1E3C; 8872 t['Lcommaaccent'] = 0x013B; 8873 t['Ldot'] = 0x013F; 8874 t['Ldotaccent'] = 0x013F; 8875 t['Ldotbelow'] = 0x1E36; 8876 t['Ldotbelowmacron'] = 0x1E38; 8877 t['Liwnarmenian'] = 0x053C; 8878 t['Lj'] = 0x01C8; 8879 t['Ljecyrillic'] = 0x0409; 8880 t['Llinebelow'] = 0x1E3A; 8881 t['Lmonospace'] = 0xFF2C; 8882 t['Lslash'] = 0x0141; 8883 t['Lslashsmall'] = 0xF6F9; 8884 t['Lsmall'] = 0xF76C; 8885 t['M'] = 0x004D; 8886 t['MBsquare'] = 0x3386; 8887 t['Macron'] = 0xF6D0; 8888 t['Macronsmall'] = 0xF7AF; 8889 t['Macute'] = 0x1E3E; 8890 t['Mcircle'] = 0x24C2; 8891 t['Mdotaccent'] = 0x1E40; 8892 t['Mdotbelow'] = 0x1E42; 8893 t['Menarmenian'] = 0x0544; 8894 t['Mmonospace'] = 0xFF2D; 8895 t['Msmall'] = 0xF76D; 8896 t['Mturned'] = 0x019C; 8897 t['Mu'] = 0x039C; 8898 t['N'] = 0x004E; 8899 t['NJ'] = 0x01CA; 8900 t['Nacute'] = 0x0143; 8901 t['Ncaron'] = 0x0147; 8902 t['Ncedilla'] = 0x0145; 8903 t['Ncircle'] = 0x24C3; 8904 t['Ncircumflexbelow'] = 0x1E4A; 8905 t['Ncommaaccent'] = 0x0145; 8906 t['Ndotaccent'] = 0x1E44; 8907 t['Ndotbelow'] = 0x1E46; 8908 t['Nhookleft'] = 0x019D; 8909 t['Nineroman'] = 0x2168; 8910 t['Nj'] = 0x01CB; 8911 t['Njecyrillic'] = 0x040A; 8912 t['Nlinebelow'] = 0x1E48; 8913 t['Nmonospace'] = 0xFF2E; 8914 t['Nowarmenian'] = 0x0546; 8915 t['Nsmall'] = 0xF76E; 8916 t['Ntilde'] = 0x00D1; 8917 t['Ntildesmall'] = 0xF7F1; 8918 t['Nu'] = 0x039D; 8919 t['O'] = 0x004F; 8920 t['OE'] = 0x0152; 8921 t['OEsmall'] = 0xF6FA; 8922 t['Oacute'] = 0x00D3; 8923 t['Oacutesmall'] = 0xF7F3; 8924 t['Obarredcyrillic'] = 0x04E8; 8925 t['Obarreddieresiscyrillic'] = 0x04EA; 8926 t['Obreve'] = 0x014E; 8927 t['Ocaron'] = 0x01D1; 8928 t['Ocenteredtilde'] = 0x019F; 8929 t['Ocircle'] = 0x24C4; 8930 t['Ocircumflex'] = 0x00D4; 8931 t['Ocircumflexacute'] = 0x1ED0; 8932 t['Ocircumflexdotbelow'] = 0x1ED8; 8933 t['Ocircumflexgrave'] = 0x1ED2; 8934 t['Ocircumflexhookabove'] = 0x1ED4; 8935 t['Ocircumflexsmall'] = 0xF7F4; 8936 t['Ocircumflextilde'] = 0x1ED6; 8937 t['Ocyrillic'] = 0x041E; 8938 t['Odblacute'] = 0x0150; 8939 t['Odblgrave'] = 0x020C; 8940 t['Odieresis'] = 0x00D6; 8941 t['Odieresiscyrillic'] = 0x04E6; 8942 t['Odieresissmall'] = 0xF7F6; 8943 t['Odotbelow'] = 0x1ECC; 8944 t['Ogoneksmall'] = 0xF6FB; 8945 t['Ograve'] = 0x00D2; 8946 t['Ogravesmall'] = 0xF7F2; 8947 t['Oharmenian'] = 0x0555; 8948 t['Ohm'] = 0x2126; 8949 t['Ohookabove'] = 0x1ECE; 8950 t['Ohorn'] = 0x01A0; 8951 t['Ohornacute'] = 0x1EDA; 8952 t['Ohorndotbelow'] = 0x1EE2; 8953 t['Ohorngrave'] = 0x1EDC; 8954 t['Ohornhookabove'] = 0x1EDE; 8955 t['Ohorntilde'] = 0x1EE0; 8956 t['Ohungarumlaut'] = 0x0150; 8957 t['Oi'] = 0x01A2; 8958 t['Oinvertedbreve'] = 0x020E; 8959 t['Omacron'] = 0x014C; 8960 t['Omacronacute'] = 0x1E52; 8961 t['Omacrongrave'] = 0x1E50; 8962 t['Omega'] = 0x2126; 8963 t['Omegacyrillic'] = 0x0460; 8964 t['Omegagreek'] = 0x03A9; 8965 t['Omegaroundcyrillic'] = 0x047A; 8966 t['Omegatitlocyrillic'] = 0x047C;
8967 t['Omegatonos'] = 0x038F; 8968 t['Omicron'] = 0x039F; 8969 t['Omicrontonos'] = 0x038C; 8970 t['Omonospace'] = 0xFF2F; 8971 t['Oneroman'] = 0x2160; 8972 t['Oogonek'] = 0x01EA; 8973 t['Oogonekmacron'] = 0x01EC; 8974 t['Oopen'] = 0x0186; 8975 t['Oslash'] = 0x00D8; 8976 t['Oslashacute'] = 0x01FE; 8977 t['Oslashsmall'] = 0xF7F8; 8978 t['Osmall'] = 0xF76F; 8979 t['Ostrokeacute'] = 0x01FE; 8980 t['Otcyrillic'] = 0x047E; 8981 t['Otilde'] = 0x00D5; 8982 t['Otildeacute'] = 0x1E4C; 8983 t['Otildedieresis'] = 0x1E4E; 8984 t['Otildesmall'] = 0xF7F5; 8985 t['P'] = 0x0050; 8986 t['Pacute'] = 0x1E54; 8987 t['Pcircle'] = 0x24C5; 8988 t['Pdotaccent'] = 0x1E56; 8989 t['Pecyrillic'] = 0x041F; 8990 t['Peharmenian'] = 0x054A; 8991 t['Pemiddlehookcyrillic'] = 0x04A6; 8992 t['Phi'] = 0x03A6; 8993 t['Phook'] = 0x01A4; 8994 t['Pi'] = 0x03A0; 8995 t['Piwrarmenian'] = 0x0553; 8996 t['Pmonospace'] = 0xFF30; 8997 t['Psi'] = 0x03A8; 8998 t['Psicyrillic'] = 0x0470; 8999 t['Psmall'] = 0xF770; 9000 t['Q'] = 0x0051; 9001 t['Qcircle'] = 0x24C6; 9002 t['Qmonospace'] = 0xFF31; 9003 t['Qsmall'] = 0xF771; 9004 t['R'] = 0x0052; 9005 t['Raarmenian'] = 0x054C; 9006 t['Racute'] = 0x0154; 9007 t['Rcaron'] = 0x0158; 9008 t['Rcedilla'] = 0x0156; 9009 t['Rcircle'] = 0x24C7; 9010 t['Rcommaaccent'] = 0x0156; 9011 t['Rdblgrave'] = 0x0210; 9012 t['Rdotaccent'] = 0x1E58; 9013 t['Rdotbelow'] = 0x1E5A; 9014 t['Rdotbelowmacron'] = 0x1E5C; 9015 t['Reharmenian'] = 0x0550; 9016 t['Rfraktur'] = 0x211C; 9017 t['Rho'] = 0x03A1; 9018 t['Ringsmall'] = 0xF6FC; 9019 t['Rinvertedbreve'] = 0x0212; 9020 t['Rlinebelow'] = 0x1E5E; 9021 t['Rmonospace'] = 0xFF32; 9022 t['Rsmall'] = 0xF772; 9023 t['Rsmallinverted'] = 0x0281; 9024 t['Rsmallinvertedsuperior'] = 0x02B6; 9025 t['S'] = 0x0053; 9026 t['SF010000'] = 0x250C; 9027 t['SF020000'] = 0x2514; 9028 t['SF030000'] = 0x2510; 9029 t['SF040000'] = 0x2518; 9030 t['SF050000'] = 0x253C; 9031 t['SF060000'] = 0x252C; 9032 t['SF070000'] = 0x2534; 9033 t['SF080000'] = 0x251C; 9034 t['SF090000'] = 0x2524; 9035 t['SF100000'] = 0x2500; 9036 t['SF110000'] = 0x2502; 9037 t['SF190000'] = 0x2561; 9038 t['SF200000'] = 0x2562; 9039 t['SF210000'] = 0x2556; 9040 t['SF220000'] = 0x2555; 9041 t['SF230000'] = 0x2563; 9042 t['SF240000'] = 0x2551; 9043 t['SF250000'] = 0x2557; 9044 t['SF260000'] = 0x255D; 9045 t['SF270000'] = 0x255C; 9046 t['SF280000'] = 0x255B; 9047 t['SF360000'] = 0x255E; 9048 t['SF370000'] = 0x255F; 9049 t['SF380000'] = 0x255A; 9050 t['SF390000'] = 0x2554; 9051 t['SF400000'] = 0x2569; 9052 t['SF410000'] = 0x2566; 9053 t['SF420000'] = 0x2560; 9054 t['SF430000'] = 0x2550; 9055 t['SF440000'] = 0x256C; 9056 t['SF450000'] = 0x2567; 9057 t['SF460000'] = 0x2568; 9058 t['SF470000'] = 0x2564; 9059 t['SF480000'] = 0x2565; 9060 t['SF490000'] = 0x2559; 9061 t['SF500000'] = 0x2558; 9062 t['SF510000'] = 0x2552; 9063 t['SF520000'] = 0x2553; 9064 t['SF530000'] = 0x256B; 9065 t['SF540000'] = 0x256A; 9066 t['Sacute'] = 0x015A; 9067 t['Sacutedotaccent'] = 0x1E64; 9068 t['Sampigreek'] = 0x03E0; 9069 t['Scaron'] = 0x0160; 9070 t['Scarondotaccent'] = 0x1E66; 9071 t['Scaronsmall'] = 0xF6FD; 9072 t['Scedilla'] = 0x015E; 9073 t['Schwa'] = 0x018F; 9074 t['Schwacyrillic'] = 0x04D8; 9075 t['Schwadieresiscyrillic'] = 0x04DA; 9076 t['Scircle'] = 0x24C8; 9077 t['Scircumflex'] = 0x015C; 9078 t['Scommaaccent'] = 0x0218; 9079 t['Sdotaccent'] = 0x1E60; 9080 t['Sdotbelow'] = 0x1E62; 9081 t['Sdotbelowdotaccent'] = 0x1E68; 9082 t['Seharmenian'] = 0x054D; 9083 t['Sevenroman'] = 0x2166; 9084 t['Shaarmenian'] = 0x0547; 9085 t['Shacyrillic'] = 0x0428; 9086 t['Shchacyrillic'] = 0x0429; 9087 t['Sheicoptic'] = 0x03E2; 9088 t['Shhacyrillic'] = 0x04BA; 9089 t['Shimacoptic'] = 0x03EC; 9090 t['Sigma'] = 0x03A3; 9091 t['Sixroman'] = 0x2165; 9092 t['Smonospace'] = 0xFF33; 9093 t['Softsigncyrillic'] = 0x042C; 9094 t['Ssmall'] = 0xF773; 9095 t['Stigmagreek'] = 0x03DA; 9096 t['T'] = 0x0054; 9097 t['Tau'] = 0x03A4; 9098 t['Tbar'] = 0x0166; 9099 t['Tcaron'] = 0x0164; 9100 t['Tcedilla'] = 0x0162; 9101 t['Tcircle'] = 0x24C9; 9102 t['Tcircumflexbelow'] = 0x1E70; 9103 t['Tcommaaccent'] = 0x0162; 9104 t['Tdotaccent'] = 0x1E6A; 9105 t['Tdotbelow'] = 0x1E6C; 9106 t['Tecyrillic'] = 0x0422; 9107 t['Tedescendercyrillic'] = 0x04AC; 9108 t['Tenroman'] = 0x2169;
9109 t['Tetsecyrillic'] = 0x04B4; 9110 t['Theta'] = 0x0398; 9111 t['Thook'] = 0x01AC; 9112 t['Thorn'] = 0x00DE; 9113 t['Thornsmall'] = 0xF7FE; 9114 t['Threeroman'] = 0x2162; 9115 t['Tildesmall'] = 0xF6FE; 9116 t['Tiwnarmenian'] = 0x054F; 9117 t['Tlinebelow'] = 0x1E6E; 9118 t['Tmonospace'] = 0xFF34; 9119 t['Toarmenian'] = 0x0539; 9120 t['Tonefive'] = 0x01BC; 9121 t['Tonesix'] = 0x0184; 9122 t['Tonetwo'] = 0x01A7; 9123 t['Tretroflexhook'] = 0x01AE; 9124 t['Tsecyrillic'] = 0x0426; 9125 t['Tshecyrillic'] = 0x040B; 9126 t['Tsmall'] = 0xF774; 9127 t['Twelveroman'] = 0x216B; 9128 t['Tworoman'] = 0x2161; 9129 t['U'] = 0x0055; 9130 t['Uacute'] = 0x00DA; 9131 t['Uacutesmall'] = 0xF7FA; 9132 t['Ubreve'] = 0x016C; 9133 t['Ucaron'] = 0x01D3; 9134 t['Ucircle'] = 0x24CA; 9135 t['Ucircumflex'] = 0x00DB; 9136 t['Ucircumflexbelow'] = 0x1E76; 9137 t['Ucircumflexsmall'] = 0xF7FB; 9138 t['Ucyrillic'] = 0x0423; 9139 t['Udblacute'] = 0x0170; 9140 t['Udblgrave'] = 0x0214; 9141 t['Udieresis'] = 0x00DC; 9142 t['Udieresisacute'] = 0x01D7; 9143 t['Udieresisbelow'] = 0x1E72; 9144 t['Udieresiscaron'] = 0x01D9; 9145 t['Udieresiscyrillic'] = 0x04F0; 9146 t['Udieresisgrave'] = 0x01DB; 9147 t['Udieresismacron'] = 0x01D5; 9148 t['Udieresissmall'] = 0xF7FC; 9149 t['Udotbelow'] = 0x1EE4; 9150 t['Ugrave'] = 0x00D9; 9151 t['Ugravesmall'] = 0xF7F9; 9152 t['Uhookabove'] = 0x1EE6; 9153 t['Uhorn'] = 0x01AF; 9154 t['Uhornacute'] = 0x1EE8; 9155 t['Uhorndotbelow'] = 0x1EF0; 9156 t['Uhorngrave'] = 0x1EEA; 9157 t['Uhornhookabove'] = 0x1EEC; 9158 t['Uhorntilde'] = 0x1EEE; 9159 t['Uhungarumlaut'] = 0x0170; 9160 t['Uhungarumlautcyrillic'] = 0x04F2; 9161 t['Uinvertedbreve'] = 0x0216; 9162 t['Ukcyrillic'] = 0x0478; 9163 t['Umacron'] = 0x016A; 9164 t['Umacroncyrillic'] = 0x04EE; 9165 t['Umacrondieresis'] = 0x1E7A; 9166 t['Umonospace'] = 0xFF35; 9167 t['Uogonek'] = 0x0172; 9168 t['Upsilon'] = 0x03A5; 9169 t['Upsilon1'] = 0x03D2; 9170 t['Upsilonacutehooksymbolgreek'] = 0x03D3; 9171 t['Upsilonafrican'] = 0x01B1; 9172 t['Upsilondieresis'] = 0x03AB; 9173 t['Upsilondieresishooksymbolgreek'] = 0x03D4; 9174 t['Upsilonhooksymbol'] = 0x03D2; 9175 t['Upsilontonos'] = 0x038E; 9176 t['Uring'] = 0x016E; 9177 t['Ushortcyrillic'] = 0x040E; 9178 t['Usmall'] = 0xF775; 9179 t['Ustraightcyrillic'] = 0x04AE; 9180 t['Ustraightstrokecyrillic'] = 0x04B0; 9181 t['Utilde'] = 0x0168; 9182 t['Utildeacute'] = 0x1E78; 9183 t['Utildebelow'] = 0x1E74; 9184 t['V'] = 0x0056; 9185 t['Vcircle'] = 0x24CB; 9186 t['Vdotbelow'] = 0x1E7E; 9187 t['Vecyrillic'] = 0x0412; 9188 t['Vewarmenian'] = 0x054E; 9189 t['Vhook'] = 0x01B2; 9190 t['Vmonospace'] = 0xFF36; 9191 t['Voarmenian'] = 0x0548; 9192 t['Vsmall'] = 0xF776; 9193 t['Vtilde'] = 0x1E7C; 9194 t['W'] = 0x0057; 9195 t['Wacute'] = 0x1E82; 9196 t['Wcircle'] = 0x24CC; 9197 t['Wcircumflex'] = 0x0174; 9198 t['Wdieresis'] = 0x1E84; 9199 t['Wdotaccent'] = 0x1E86; 9200 t['Wdotbelow'] = 0x1E88; 9201 t['Wgrave'] = 0x1E80; 9202 t['Wmonospace'] = 0xFF37; 9203 t['Wsmall'] = 0xF777; 9204 t['X'] = 0x0058; 9205 t['Xcircle'] = 0x24CD; 9206 t['Xdieresis'] = 0x1E8C; 9207 t['Xdotaccent'] = 0x1E8A; 9208 t['Xeharmenian'] = 0x053D; 9209 t['Xi'] = 0x039E; 9210 t['Xmonospace'] = 0xFF38; 9211 t['Xsmall'] = 0xF778; 9212 t['Y'] = 0x0059; 9213 t['Yacute'] = 0x00DD; 9214 t['Yacutesmall'] = 0xF7FD; 9215 t['Yatcyrillic'] = 0x0462; 9216 t['Ycircle'] = 0x24CE; 9217 t['Ycircumflex'] = 0x0176; 9218 t['Ydieresis'] = 0x0178; 9219 t['Ydieresissmall'] = 0xF7FF; 9220 t['Ydotaccent'] = 0x1E8E; 9221 t['Ydotbelow'] = 0x1EF4; 9222 t['Yericyrillic'] = 0x042B; 9223 t['Yerudieresiscyrillic'] = 0x04F8; 9224 t['Ygrave'] = 0x1EF2; 9225 t['Yhook'] = 0x01B3; 9226 t['Yhookabove'] = 0x1EF6; 9227 t['Yiarmenian'] = 0x0545; 9228 t['Yicyrillic'] = 0x0407; 9229 t['Yiwnarmenian'] = 0x0552; 9230 t['Ymonospace'] = 0xFF39; 9231 t['Ysmall'] = 0xF779; 9232 t['Ytilde'] = 0x1EF8; 9233 t['Yusbigcyrillic'] = 0x046A; 9234 t['Yusbigiotifiedcyrillic'] = 0x046C; 9235 t['Yuslittlecyrillic'] = 0x0466; 9236 t['Yuslittleiotifiedcyrillic'] = 0x0468; 9237 t['Z'] = 0x005A; 9238 t['Zaarmenian'] = 0x0536; 9239 t['Zacute'] = 0x0179; 9240 t['Zcaron'] = 0x017D; 9241 t['Zcaronsmall'] = 0xF6FF; 9242 t['Zcircle'] = 0x24CF; 9243 t['Zcircumflex'] = 0x1E90; 9244 t['Zdot'] = 0x017B; 9245 t['Zdotaccent'] = 0x017B; 9246 t['Zdotbelow'] = 0x1E92; 9247 t['Zecyrillic'] = 0x0417; 9248 t['Zedescendercyrillic'] = 0x0498; 9249 t['Zedieresiscyrillic'] = 0x04DE; 9250 t['Zeta'] = 0x0396; 9251 t['Zhearmenian'] = 0x053A; 9252 t['Zhebrevecyrillic'] = 0x04C1; 9253 t['Zhecyrillic'] = 0x0416; 9254 t['Zhedescendercyrillic'] = 0x0496; 9255 t['Zhedieresiscyrillic'] = 0x04DC; 9256 t['Zlinebelow'] = 0x1E94; 9257 t['Zmonospace'] = 0xFF3A; 9258 t['Zsmall'] = 0xF77A; 9259 t['Zstroke'] = 0x01B5; 9260 t['a'] = 0x0061; 9261 t['aabengali'] = 0x0986; 9262 t['aacute'] = 0x00E1; 9263 t['aadeva'] = 0x0906; 9264 t['aagujarati'] = 0x0A86; 9265 t['aagurmukhi'] = 0x0A06; 9266 t['aamatragurmukhi'] = 0x0A3E; 9267 t['aarusquare'] = 0x3303; 9268 t['aavowelsignbengali'] = 0x09BE; 9269 t['aavowelsigndeva'] = 0x093E; 9270 t['aavowelsigngujarati'] = 0x0ABE; 9271 t['abbreviationmarkarmenian'] = 0x055F; 9272 t['abbreviationsigndeva'] = 0x0970; 9273 t['abengali'] = 0x0985; 9274 t['abopomofo'] = 0x311A; 9275 t['abreve'] = 0x0103; 9276 t['abreveacute'] = 0x1EAF; 9277 t['abrevecyrillic'] = 0x04D1; 9278 t['abrevedotbelow'] = 0x1EB7; 9279 t['abrevegrave'] = 0x1EB1; 9280 t['abrevehookabove'] = 0x1EB3; 9281 t['abrevetilde'] = 0x1EB5; 9282 t['acaron'] = 0x01CE; 9283 t['acircle'] = 0x24D0; 9284 t['acircumflex'] = 0x00E2; 9285 t['acircumflexacute'] = 0x1EA5; 9286 t['acircumflexdotbelow'] = 0x1EAD; 9287 t['acircumflexgrave'] = 0x1EA7; 9288 t['acircumflexhookabove'] = 0x1EA9; 9289 t['acircumflextilde'] = 0x1EAB; 9290 t['acute'] = 0x00B4; 9291 t['acutebelowcmb'] = 0x0317; 9292 t['acutecmb'] = 0x0301; 9293 t['acutecomb'] = 0x0301; 9294 t['acutedeva'] = 0x0954; 9295 t['acutelowmod'] = 0x02CF; 9296 t['acutetonecmb'] = 0x0341; 9297 t['acyrillic'] = 0x0430; 9298 t['adblgrave'] = 0x0201; 9299 t['addakgurmukhi'] = 0x0A71; 9300 t['adeva'] = 0x0905; 9301 t['adieresis'] = 0x00E4; 9302 t['adieresiscyrillic'] = 0x04D3; 9303 t['adieresismacron'] = 0x01DF; 9304 t['adotbelow'] = 0x1EA1; 9305 t['adotmacron'] = 0x01E1; 9306 t['ae'] = 0x00E6; 9307 t['aeacute'] = 0x01FD; 9308 t['aekorean'] = 0x3150; 9309 t['aemacron'] = 0x01E3; 9310 t['afii00208'] = 0x2015; 9311 t['afii08941'] = 0x20A4; 9312 t['afii10017'] = 0x0410; 9313 t['afii10018'] = 0x0411; 9314 t['afii10019'] = 0x0412; 9315 t['afii10020'] = 0x0413;
9316 t['afii10021'] = 0x0414; 9317 t['afii10022'] = 0x0415; 9318 t['afii10023'] = 0x0401; 9319 t['afii10024'] = 0x0416; 9320 t['afii10025'] = 0x0417; 9321 t['afii10026'] = 0x0418; 9322 t['afii10027'] = 0x0419; 9323 t['afii10028'] = 0x041A; 9324 t['afii10029'] = 0x041B; 9325 t['afii10030'] = 0x041C; 9326 t['afii10031'] = 0x041D; 9327 t['afii10032'] = 0x041E; 9328 t['afii10033'] = 0x041F; 9329 t['afii10034'] = 0x0420; 9330 t['afii10035'] = 0x0421; 9331 t['afii10036'] = 0x0422; 9332 t['afii10037'] = 0x0423; 9333 t['afii10038'] = 0x0424; 9334 t['afii10039'] = 0x0425; 9335 t['afii10040'] = 0x0426; 9336 t['afii10041'] = 0x0427; 9337 t['afii10042'] = 0x0428; 9338 t['afii10043'] = 0x0429; 9339 t['afii10044'] = 0x042A; 9340 t['afii10045'] = 0x042B; 9341 t['afii10046'] = 0x042C; 9342 t['afii10047'] = 0x042D; 9343 t['afii10048'] = 0x042E; 9344 t['afii10049'] = 0x042F; 9345 t['afii10050'] = 0x0490; 9346 t['afii10051'] = 0x0402; 9347 t['afii10052'] = 0x0403; 9348 t['afii10053'] = 0x0404; 9349 t['afii10054'] = 0x0405; 9350 t['afii10055'] = 0x0406; 9351 t['afii10056'] = 0x0407; 9352 t['afii10057'] = 0x0408; 9353 t['afii10058'] = 0x0409; 9354 t['afii10059'] = 0x040A; 9355 t['afii10060'] = 0x040B; 9356 t['afii10061'] = 0x040C; 9357 t['afii10062'] = 0x040E; 9358 t['afii10063'] = 0xF6C4; 9359 t['afii10064'] = 0xF6C5; 9360 t['afii10065'] = 0x0430; 9361 t['afii10066'] = 0x0431; 9362 t['afii10067'] = 0x0432; 9363 t['afii10068'] = 0x0433; 9364 t['afii10069'] = 0x0434; 9365 t['afii10070'] = 0x0435; 9366 t['afii10071'] = 0x0451; 9367 t['afii10072'] = 0x0436; 9368 t['afii10073'] = 0x0437; 9369 t['afii10074'] = 0x0438; 9370 t['afii10075'] = 0x0439; 9371 t['afii10076'] = 0x043A; 9372 t['afii10077'] = 0x043B; 9373 t['afii10078'] = 0x043C; 9374 t['afii10079'] = 0x043D; 9375 t['afii10080'] = 0x043E; 9376 t['afii10081'] = 0x043F; 9377 t['afii10082'] = 0x0440; 9378 t['afii10083'] = 0x0441; 9379 t['afii10084'] = 0x0442; 9380 t['afii10085'] = 0x0443; 9381 t['afii10086'] = 0x0444; 9382 t['afii10087'] = 0x0445; 9383 t['afii10088'] = 0x0446; 9384 t['afii10089'] = 0x0447; 9385 t['afii10090'] = 0x0448; 9386 t['afii10091'] = 0x0449; 9387 t['afii10092'] = 0x044A; 9388 t['afii10093'] = 0x044B; 9389 t['afii10094'] = 0x044C; 9390 t['afii10095'] = 0x044D; 9391 t['afii10096'] = 0x044E; 9392 t['afii10097'] = 0x044F; 9393 t['afii10098'] = 0x0491; 9394 t['afii10099'] = 0x0452; 9395 t['afii10100'] = 0x0453; 9396 t['afii10101'] = 0x0454; 9397 t['afii10102'] = 0x0455; 9398 t['afii10103'] = 0x0456; 9399 t['afii10104'] = 0x0457; 9400 t['afii10105'] = 0x0458; 9401 t['afii10106'] = 0x0459; 9402 t['afii10107'] = 0x045A; 9403 t['afii10108'] = 0x045B; 9404 t['afii10109'] = 0x045C; 9405 t['afii10110'] = 0x045E; 9406 t['afii10145'] = 0x040F; 9407 t['afii10146'] = 0x0462; 9408 t['afii10147'] = 0x0472; 9409 t['afii10148'] = 0x0474; 9410 t['afii10192'] = 0xF6C6; 9411 t['afii10193'] = 0x045F; 9412 t['afii10194'] = 0x0463; 9413 t['afii10195'] = 0x0473; 9414 t['afii10196'] = 0x0475; 9415 t['afii10831'] = 0xF6C7; 9416 t['afii10832'] = 0xF6C8; 9417 t['afii10846'] = 0x04D9; 9418 t['afii299'] = 0x200E; 9419 t['afii300'] = 0x200F; 9420 t['afii301'] = 0x200D; 9421 t['afii57381'] = 0x066A; 9422 t['afii57388'] = 0x060C; 9423 t['afii57392'] = 0x0660; 9424 t['afii57393'] = 0x0661; 9425 t['afii57394'] = 0x0662; 9426 t['afii57395'] = 0x0663; 9427 t['afii57396'] = 0x0664; 9428 t['afii57397'] = 0x0665; 9429 t['afii57398'] = 0x0666; 9430 t['afii57399'] = 0x0667; 9431 t['afii57400'] = 0x0668; 9432 t['afii57401'] = 0x0669; 9433 t['afii57403'] = 0x061B; 9434 t['afii57407'] = 0x061F; 9435 t['afii57409'] = 0x0621; 9436 t['afii57410'] = 0x0622; 9437 t['afii57411'] = 0x0623; 9438 t['afii57412'] = 0x0624; 9439 t['afii57413'] = 0x0625; 9440 t['afii57414'] = 0x0626; 9441 t['afii57415'] = 0x0627; 9442 t['afii57416'] = 0x0628; 9443 t['afii57417'] = 0x0629; 9444 t['afii57418'] = 0x062A; 9445 t['afii57419'] = 0x062B; 9446 t['afii57420'] = 0x062C; 9447 t['afii57421'] = 0x062D; 9448 t['afii57422'] = 0x062E; 9449 t['afii57423'] = 0x062F; 9450 t['afii57424'] = 0x0630; 9451 t['afii57425'] = 0x0631; 9452 t['afii57426'] = 0x0632; 9453 t['afii57427'] = 0x0633; 9454 t['afii57428'] = 0x0634; 9455 t['afii57429'] = 0x0635; 9456 t['afii57430'] = 0x0636; 9457 t['afii57431'] = 0x0637; 9458 t['afii57432'] = 0x0638; 9459 t['afii57433'] = 0x0639; 9460 t['afii57434'] = 0x063A; 9461 t['afii57440'] = 0x0640; 9462 t['afii57441'] = 0x0641; 9463 t['afii57442'] = 0x0642; 9464 t['afii57443'] = 0x0643; 9465 t['afii57444'] = 0x0644;
9466 t['afii57445'] = 0x0645; 9467 t['afii57446'] = 0x0646; 9468 t['afii57448'] = 0x0648; 9469 t['afii57449'] = 0x0649; 9470 t['afii57450'] = 0x064A; 9471 t['afii57451'] = 0x064B; 9472 t['afii57452'] = 0x064C; 9473 t['afii57453'] = 0x064D; 9474 t['afii57454'] = 0x064E; 9475 t['afii57455'] = 0x064F; 9476 t['afii57456'] = 0x0650; 9477 t['afii57457'] = 0x0651; 9478 t['afii57458'] = 0x0652; 9479 t['afii57470'] = 0x0647; 9480 t['afii57505'] = 0x06A4; 9481 t['afii57506'] = 0x067E; 9482 t['afii57507'] = 0x0686; 9483 t['afii57508'] = 0x0698; 9484 t['afii57509'] = 0x06AF; 9485 t['afii57511'] = 0x0679; 9486 t['afii57512'] = 0x0688; 9487 t['afii57513'] = 0x0691; 9488 t['afii57514'] = 0x06BA; 9489 t['afii57519'] = 0x06D2; 9490 t['afii57534'] = 0x06D5; 9491 t['afii57636'] = 0x20AA; 9492 t['afii57645'] = 0x05BE; 9493 t['afii57658'] = 0x05C3; 9494 t['afii57664'] = 0x05D0; 9495 t['afii57665'] = 0x05D1; 9496 t['afii57666'] = 0x05D2; 9497 t['afii57667'] = 0x05D3; 9498 t['afii57668'] = 0x05D4; 9499 t['afii57669'] = 0x05D5; 9500 t['afii57670'] = 0x05D6; 9501 t['afii57671'] = 0x05D7; 9502 t['afii57672'] = 0x05D8; 9503 t['afii57673'] = 0x05D9; 9504 t['afii57674'] = 0x05DA; 9505 t['afii57675'] = 0x05DB; 9506 t['afii57676'] = 0x05DC; 9507 t['afii57677'] = 0x05DD; 9508 t['afii57678'] = 0x05DE; 9509 t['afii57679'] = 0x05DF; 9510 t['afii57680'] = 0x05E0; 9511 t['afii57681'] = 0x05E1; 9512 t['afii57682'] = 0x05E2; 9513 t['afii57683'] = 0x05E3; 9514 t['afii57684'] = 0x05E4; 9515 t['afii57685'] = 0x05E5; 9516 t['afii57686'] = 0x05E6; 9517 t['afii57687'] = 0x05E7; 9518 t['afii57688'] = 0x05E8; 9519 t['afii57689'] = 0x05E9; 9520 t['afii57690'] = 0x05EA; 9521 t['afii57694'] = 0xFB2A; 9522 t['afii57695'] = 0xFB2B; 9523 t['afii57700'] = 0xFB4B; 9524 t['afii57705'] = 0xFB1F; 9525 t['afii57716'] = 0x05F0; 9526 t['afii57717'] = 0x05F1; 9527 t['afii57718'] = 0x05F2; 9528 t['afii57723'] = 0xFB35; 9529 t['afii57793'] = 0x05B4; 9530 t['afii57794'] = 0x05B5; 9531 t['afii57795'] = 0x05B6; 9532 t['afii57796'] = 0x05BB; 9533 t['afii57797'] = 0x05B8; 9534 t['afii57798'] = 0x05B7; 9535 t['afii57799'] = 0x05B0; 9536 t['afii57800'] = 0x05B2; 9537 t['afii57801'] = 0x05B1; 9538 t['afii57802'] = 0x05B3; 9539 t['afii57803'] = 0x05C2; 9540 t['afii57804'] = 0x05C1; 9541 t['afii57806'] = 0x05B9; 9542 t['afii57807'] = 0x05BC; 9543 t['afii57839'] = 0x05BD; 9544 t['afii57841'] = 0x05BF; 9545 t['afii57842'] = 0x05C0; 9546 t['afii57929'] = 0x02BC; 9547 t['afii61248'] = 0x2105; 9548 t['afii61289'] = 0x2113; 9549 t['afii61352'] = 0x2116; 9550 t['afii61573'] = 0x202C; 9551 t['afii61574'] = 0x202D; 9552 t['afii61575'] = 0x202E; 9553 t['afii61664'] = 0x200C; 9554 t['afii63167'] = 0x066D; 9555 t['afii64937'] = 0x02BD; 9556 t['agrave'] = 0x00E0; 9557 t['agujarati'] = 0x0A85; 9558 t['agurmukhi'] = 0x0A05; 9559 t['ahiragana'] = 0x3042; 9560 t['ahookabove'] = 0x1EA3; 9561 t['aibengali'] = 0x0990; 9562 t['aibopomofo'] = 0x311E; 9563 t['aideva'] = 0x0910; 9564 t['aiecyrillic'] = 0x04D5; 9565 t['aigujarati'] = 0x0A90; 9566 t['aigurmukhi'] = 0x0A10; 9567 t['aimatragurmukhi'] = 0x0A48; 9568 t['ainarabic'] = 0x0639; 9569 t['ainfinalarabic'] = 0xFECA; 9570 t['aininitialarabic'] = 0xFECB; 9571 t['ainmedialarabic'] = 0xFECC; 9572 t['ainvertedbreve'] = 0x0203; 9573 t['aivowelsignbengali'] = 0x09C8; 9574 t['aivowelsigndeva'] = 0x0948; 9575 t['aivowelsigngujarati'] = 0x0AC8; 9576 t['akatakana'] = 0x30A2; 9577 t['akatakanahalfwidth'] = 0xFF71; 9578 t['akorean'] = 0x314F; 9579 t['alef'] = 0x05D0; 9580 t['alefarabic'] = 0x0627; 9581 t['alefdageshhebrew'] = 0xFB30; 9582 t['aleffinalarabic'] = 0xFE8E; 9583 t['alefhamzaabovearabic'] = 0x0623; 9584 t['alefhamzaabovefinalarabic'] = 0xFE84; 9585 t['alefhamzabelowarabic'] = 0x0625; 9586 t['alefhamzabelowfinalarabic'] = 0xFE88; 9587 t['alefhebrew'] = 0x05D0; 9588 t['aleflamedhebrew'] = 0xFB4F; 9589 t['alefmaddaabovearabic'] = 0x0622; 9590 t['alefmaddaabovefinalarabic'] = 0xFE82; 9591 t['alefmaksuraarabic'] = 0x0649; 9592 t['alefmaksurafinalarabic'] = 0xFEF0; 9593 t['alefmaksurainitialarabic'] = 0xFEF3; 9594 t['alefmaksuramedialarabic'] = 0xFEF4; 9595 t['alefpatahhebrew'] = 0xFB2E; 9596 t['alefqamatshebrew'] = 0xFB2F; 9597 t['aleph'] = 0x2135; 9598 t['allequal'] = 0x224C; 9599 t['alpha'] = 0x03B1;
9600 t['alphatonos'] = 0x03AC; 9601 t['amacron'] = 0x0101; 9602 t['amonospace'] = 0xFF41; 9603 t['ampersand'] = 0x0026; 9604 t['ampersandmonospace'] = 0xFF06; 9605 t['ampersandsmall'] = 0xF726; 9606 t['amsquare'] = 0x33C2; 9607 t['anbopomofo'] = 0x3122; 9608 t['angbopomofo'] = 0x3124; 9609 t['angbracketleft'] = 0x3008; 9610 t['angbracketright'] = 0x3009; 9611 t['angkhankhuthai'] = 0x0E5A; 9612 t['angle'] = 0x2220; 9613 t['anglebracketleft'] = 0x3008; 9614 t['anglebracketleftvertical'] = 0xFE3F; 9615 t['anglebracketright'] = 0x3009; 9616 t['anglebracketrightvertical'] = 0xFE40; 9617 t['angleleft'] = 0x2329; 9618 t['angleright'] = 0x232A; 9619 t['angstrom'] = 0x212B; 9620 t['anoteleia'] = 0x0387; 9621 t['anudattadeva'] = 0x0952; 9622 t['anusvarabengali'] = 0x0982; 9623 t['anusvaradeva'] = 0x0902; 9624 t['anusvaragujarati'] = 0x0A82; 9625 t['aogonek'] = 0x0105; 9626 t['apaatosquare'] = 0x3300; 9627 t['aparen'] = 0x249C; 9628 t['apostrophearmenian'] = 0x055A; 9629 t['apostrophemod'] = 0x02BC; 9630 t['apple'] = 0xF8FF; 9631 t['approaches'] = 0x2250; 9632 t['approxequal'] = 0x2248; 9633 t['approxequalorimage'] = 0x2252; 9634 t['approximatelyequal'] = 0x2245; 9635 t['araeaekorean'] = 0x318E; 9636 t['araeakorean'] = 0x318D; 9637 t['arc'] = 0x2312; 9638 t['arighthalfring'] = 0x1E9A; 9639 t['aring'] = 0x00E5; 9640 t['aringacute'] = 0x01FB; 9641 t['aringbelow'] = 0x1E01; 9642 t['arrowboth'] = 0x2194; 9643 t['arrowdashdown'] = 0x21E3; 9644 t['arrowdashleft'] = 0x21E0; 9645 t['arrowdashright'] = 0x21E2; 9646 t['arrowdashup'] = 0x21E1; 9647 t['arrowdblboth'] = 0x21D4; 9648 t['arrowdbldown'] = 0x21D3; 9649 t['arrowdblleft'] = 0x21D0; 9650 t['arrowdblright'] = 0x21D2; 9651 t['arrowdblup'] = 0x21D1; 9652 t['arrowdown'] = 0x2193; 9653 t['arrowdownleft'] = 0x2199; 9654 t['arrowdownright'] = 0x2198; 9655 t['arrowdownwhite'] = 0x21E9; 9656 t['arrowheaddownmod'] = 0x02C5; 9657 t['arrowheadleftmod'] = 0x02C2; 9658 t['arrowheadrightmod'] = 0x02C3; 9659 t['arrowheadupmod'] = 0x02C4; 9660 t['arrowhorizex'] = 0xF8E7; 9661 t['arrowleft'] = 0x2190; 9662 t['arrowleftdbl'] = 0x21D0; 9663 t['arrowleftdblstroke'] = 0x21CD; 9664 t['arrowleftoverright'] = 0x21C6; 9665 t['arrowleftwhite'] = 0x21E6; 9666 t['arrowright'] = 0x2192; 9667 t['arrowrightdblstroke'] = 0x21CF; 9668 t['arrowrightheavy'] = 0x279E; 9669 t['arrowrightoverleft'] = 0x21C4; 9670 t['arrowrightwhite'] = 0x21E8; 9671 t['arrowtableft'] = 0x21E4; 9672 t['arrowtabright'] = 0x21E5; 9673 t['arrowup'] = 0x2191; 9674 t['arrowupdn'] = 0x2195; 9675 t['arrowupdnbse'] = 0x21A8; 9676 t['arrowupdownbase'] = 0x21A8; 9677 t['arrowupleft'] = 0x2196; 9678 t['arrowupleftofdown'] = 0x21C5; 9679 t['arrowupright'] = 0x2197; 9680 t['arrowupwhite'] = 0x21E7; 9681 t['arrowvertex'] = 0xF8E6; 9682 t['asciicircum'] = 0x005E; 9683 t['asciicircummonospace'] = 0xFF3E; 9684 t['asciitilde'] = 0x007E; 9685 t['asciitildemonospace'] = 0xFF5E; 9686 t['ascript'] = 0x0251; 9687 t['ascriptturned'] = 0x0252; 9688 t['asmallhiragana'] = 0x3041; 9689 t['asmallkatakana'] = 0x30A1; 9690 t['asmallkatakanahalfwidth'] = 0xFF67; 9691 t['asterisk'] = 0x002A; 9692 t['asteriskaltonearabic'] = 0x066D; 9693 t['asteriskarabic'] = 0x066D; 9694 t['asteriskmath'] = 0x2217; 9695 t['asteriskmonospace'] = 0xFF0A; 9696 t['asterisksmall'] = 0xFE61; 9697 t['asterism'] = 0x2042; 9698 t['asuperior'] = 0xF6E9; 9699 t['asymptoticallyequal'] = 0x2243; 9700 t['at'] = 0x0040; 9701 t['atilde'] = 0x00E3; 9702 t['atmonospace'] = 0xFF20; 9703 t['atsmall'] = 0xFE6B; 9704 t['aturned'] = 0x0250; 9705 t['aubengali'] = 0x0994; 9706 t['aubopomofo'] = 0x3120; 9707 t['audeva'] = 0x0914; 9708 t['augujarati'] = 0x0A94; 9709 t['augurmukhi'] = 0x0A14; 9710 t['aulengthmarkbengali'] = 0x09D7; 9711 t['aumatragurmukhi'] = 0x0A4C; 9712 t['auvowelsignbengali'] = 0x09CC; 9713 t['auvowelsigndeva'] = 0x094C; 9714 t['auvowelsigngujarati'] = 0x0ACC; 9715 t['avagrahadeva'] = 0x093D; 9716 t['aybarmenian'] = 0x0561; 9717 t['ayin'] = 0x05E2; 9718 t['ayinaltonehebrew'] = 0xFB20; 9719 t['ayinhebrew'] = 0x05E2; 9720 t['b'] = 0x0062; 9721 t['babengali'] = 0x09AC; 9722 t['backslash'] = 0x005C; 9723 t['backslashmonospace'] = 0xFF3C; 9724 t['badeva'] = 0x092C; 9725 t['bagujarati'] = 0x0AAC; 9726 t['bagurmukhi'] = 0x0A2C; 9727 t['bahiragana'] = 0x3070; 9728 t['bahtthai'] = 0x0E3F; 9729 t['bakatakana'] = 0x30D0; 9730 t['bar'] = 0x007C; 9731 t['barmonospace'] = 0xFF5C; 9732 t['bbopomofo'] = 0x3105; 9733 t['bcircle'] = 0x24D1; 9734 t['bdotaccent'] = 0x1E03; 9735 t['bdotbelow'] = 0x1E05; 9736 t['beamedsixteenthnotes'] = 0x266C; 9737 t['because'] = 0x2235; 9738 t['becyrillic'] = 0x0431; 9739 t['beharabic'] = 0x0628; 9740 t['behfinalarabic'] = 0xFE90; 9741 t['behinitialarabic'] = 0xFE91; 9742 t['behiragana'] = 0x3079; 9743 t['behmedialarabic'] = 0xFE92; 9744 t['behmeeminitialarabic'] = 0xFC9F; 9745 t['behmeemisolatedarabic'] = 0xFC08; 9746 t['behnoonfinalarabic'] = 0xFC6D; 9747 t['bekatakana'] = 0x30D9; 9748 t['benarmenian'] = 0x0562; 9749 t['bet'] = 0x05D1; 9750 t['beta'] = 0x03B2; 9751 t['betasymbolgreek'] = 0x03D0; 9752 t['betdagesh'] = 0xFB31; 9753 t['betdageshhebrew'] = 0xFB31; 9754 t['bethebrew'] = 0x05D1; 9755 t['betrafehebrew'] = 0xFB4C; 9756 t['bhabengali'] = 0x09AD; 9757 t['bhadeva'] = 0x092D; 9758 t['bhagujarati'] = 0x0AAD; 9759 t['bhagurmukhi'] = 0x0A2D; 9760 t['bhook'] = 0x0253; 9761 t['bihiragana'] = 0x3073; 9762 t['bikatakana'] = 0x30D3;
9763 t['bilabialclick'] = 0x0298; 9764 t['bindigurmukhi'] = 0x0A02; 9765 t['birusquare'] = 0x3331; 9766 t['blackcircle'] = 0x25CF; 9767 t['blackdiamond'] = 0x25C6; 9768 t['blackdownpointingtriangle'] = 0x25BC; 9769 t['blackleftpointingpointer'] = 0x25C4; 9770 t['blackleftpointingtriangle'] = 0x25C0; 9771 t['blacklenticularbracketleft'] = 0x3010; 9772 t['blacklenticularbracketleftvertical'] = 0xFE3B; 9773 t['blacklenticularbracketright'] = 0x3011; 9774 t['blacklenticularbracketrightvertical'] = 0xFE3C; 9775 t['blacklowerlefttriangle'] = 0x25E3; 9776 t['blacklowerrighttriangle'] = 0x25E2; 9777 t['blackrectangle'] = 0x25AC; 9778 t['blackrightpointingpointer'] = 0x25BA; 9779 t['blackrightpointingtriangle'] = 0x25B6; 9780 t['blacksmallsquare'] = 0x25AA; 9781 t['blacksmilingface'] = 0x263B; 9782 t['blacksquare'] = 0x25A0; 9783 t['blackstar'] = 0x2605; 9784 t['blackupperlefttriangle'] = 0x25E4; 9785 t['blackupperrighttriangle'] = 0x25E5; 9786 t['blackuppointingsmalltriangle'] = 0x25B4; 9787 t['blackuppointingtriangle'] = 0x25B2; 9788 t['blank'] = 0x2423; 9789 t['blinebelow'] = 0x1E07; 9790 t['block'] = 0x2588; 9791 t['bmonospace'] = 0xFF42; 9792 t['bobaimaithai'] = 0x0E1A; 9793 t['bohiragana'] = 0x307C; 9794 t['bokatakana'] = 0x30DC; 9795 t['bparen'] = 0x249D; 9796 t['bqsquare'] = 0x33C3; 9797 t['braceex'] = 0xF8F4; 9798 t['braceleft'] = 0x007B; 9799 t['braceleftbt'] = 0xF8F3; 9800 t['braceleftmid'] = 0xF8F2; 9801 t['braceleftmonospace'] = 0xFF5B; 9802 t['braceleftsmall'] = 0xFE5B; 9803 t['bracelefttp'] = 0xF8F1; 9804 t['braceleftvertical'] = 0xFE37; 9805 t['braceright'] = 0x007D; 9806 t['bracerightbt'] = 0xF8FE; 9807 t['bracerightmid'] = 0xF8FD; 9808 t['bracerightmonospace'] = 0xFF5D; 9809 t['bracerightsmall'] = 0xFE5C; 9810 t['bracerighttp'] = 0xF8FC; 9811 t['bracerightvertical'] = 0xFE38; 9812 t['bracketleft'] = 0x005B; 9813 t['bracketleftbt'] = 0xF8F0; 9814 t['bracketleftex'] = 0xF8EF; 9815 t['bracketleftmonospace'] = 0xFF3B; 9816 t['bracketlefttp'] = 0xF8EE; 9817 t['bracketright'] = 0x005D; 9818 t['bracketrightbt'] = 0xF8FB; 9819 t['bracketrightex'] = 0xF8FA; 9820 t['bracketrightmonospace'] = 0xFF3D; 9821 t['bracketrighttp'] = 0xF8F9; 9822 t['breve'] = 0x02D8; 9823 t['brevebelowcmb'] = 0x032E; 9824 t['brevecmb'] = 0x0306; 9825 t['breveinvertedbelowcmb'] = 0x032F; 9826 t['breveinvertedcmb'] = 0x0311; 9827 t['breveinverteddoublecmb'] = 0x0361; 9828 t['bridgebelowcmb'] = 0x032A; 9829 t['bridgeinvertedbelowcmb'] = 0x033A; 9830 t['brokenbar'] = 0x00A6; 9831 t['bstroke'] = 0x0180; 9832 t['bsuperior'] = 0xF6EA; 9833 t['btopbar'] = 0x0183; 9834 t['buhiragana'] = 0x3076; 9835 t['bukatakana'] = 0x30D6; 9836 t['bullet'] = 0x2022; 9837 t['bulletinverse'] = 0x25D8; 9838 t['bulletoperator'] = 0x2219; 9839 t['bullseye'] = 0x25CE; 9840 t['c'] = 0x0063; 9841 t['caarmenian'] = 0x056E; 9842 t['cabengali'] = 0x099A; 9843 t['cacute'] = 0x0107; 9844 t['cadeva'] = 0x091A; 9845 t['cagujarati'] = 0x0A9A; 9846 t['cagurmukhi'] = 0x0A1A; 9847 t['calsquare'] = 0x3388; 9848 t['candrabindubengali'] = 0x0981; 9849 t['candrabinducmb'] = 0x0310; 9850 t['candrabindudeva'] = 0x0901; 9851 t['candrabindugujarati'] = 0x0A81; 9852 t['capslock'] = 0x21EA; 9853 t['careof'] = 0x2105; 9854 t['caron'] = 0x02C7; 9855 t['caronbelowcmb'] = 0x032C; 9856 t['caroncmb'] = 0x030C; 9857 t['carriagereturn'] = 0x21B5; 9858 t['cbopomofo'] = 0x3118; 9859 t['ccaron'] = 0x010D; 9860 t['ccedilla'] = 0x00E7; 9861 t['ccedillaacute'] = 0x1E09; 9862 t['ccircle'] = 0x24D2; 9863 t['ccircumflex'] = 0x0109; 9864 t['ccurl'] = 0x0255; 9865 t['cdot'] = 0x010B; 9866 t['cdotaccent'] = 0x010B; 9867 t['cdsquare'] = 0x33C5; 9868 t['cedilla'] = 0x00B8; 9869 t['cedillacmb'] = 0x0327; 9870 t['cent'] = 0x00A2; 9871 t['centigrade'] = 0x2103; 9872 t['centinferior'] = 0xF6DF; 9873 t['centmonospace'] = 0xFFE0; 9874 t['centoldstyle'] = 0xF7A2; 9875 t['centsuperior'] = 0xF6E0; 9876 t['chaarmenian'] = 0x0579; 9877 t['chabengali'] = 0x099B; 9878 t['chadeva'] = 0x091B; 9879 t['chagujarati'] = 0x0A9B; 9880 t['chagurmukhi'] = 0x0A1B; 9881 t['chbopomofo'] = 0x3114; 9882 t['cheabkhasiancyrillic'] = 0x04BD; 9883 t['checkmark'] = 0x2713; 9884 t['checyrillic'] = 0x0447; 9885 t['chedescenderabkhasiancyrillic'] = 0x04BF; 9886 t['chedescendercyrillic'] = 0x04B7; 9887 t['chedieresiscyrillic'] = 0x04F5; 9888 t['cheharmenian'] = 0x0573; 9889 t['chekhakassiancyrillic'] = 0x04CC; 9890 t['cheverticalstrokecyrillic'] = 0x04B9; 9891 t['chi'] = 0x03C7; 9892 t['chieuchacirclekorean'] = 0x3277; 9893 t['chieuchaparenkorean'] = 0x3217; 9894 t['chieuchcirclekorean'] = 0x3269; 9895 t['chieuchkorean'] = 0x314A; 9896 t['chieuchparenkorean'] = 0x3209; 9897 t['chochangthai'] = 0x0E0A; 9898 t['chochanthai'] = 0x0E08; 9899 t['chochingthai'] = 0x0E09;
9900 t['chochoethai'] = 0x0E0C; 9901 t['chook'] = 0x0188; 9902 t['cieucacirclekorean'] = 0x3276; 9903 t['cieucaparenkorean'] = 0x3216; 9904 t['cieuccirclekorean'] = 0x3268; 9905 t['cieuckorean'] = 0x3148; 9906 t['cieucparenkorean'] = 0x3208; 9907 t['cieucuparenkorean'] = 0x321C; 9908 t['circle'] = 0x25CB; 9909 t['circlecopyrt'] = 0x00A9; 9910 t['circlemultiply'] = 0x2297; 9911 t['circleot'] = 0x2299; 9912 t['circleplus'] = 0x2295; 9913 t['circlepostalmark'] = 0x3036; 9914 t['circlewithlefthalfblack'] = 0x25D0; 9915 t['circlewithrighthalfblack'] = 0x25D1; 9916 t['circumflex'] = 0x02C6; 9917 t['circumflexbelowcmb'] = 0x032D; 9918 t['circumflexcmb'] = 0x0302; 9919 t['clear'] = 0x2327; 9920 t['clickalveolar'] = 0x01C2; 9921 t['clickdental'] = 0x01C0; 9922 t['clicklateral'] = 0x01C1; 9923 t['clickretroflex'] = 0x01C3; 9924 t['club'] = 0x2663; 9925 t['clubsuitblack'] = 0x2663; 9926 t['clubsuitwhite'] = 0x2667; 9927 t['cmcubedsquare'] = 0x33A4; 9928 t['cmonospace'] = 0xFF43; 9929 t['cmsquaredsquare'] = 0x33A0; 9930 t['coarmenian'] = 0x0581; 9931 t['colon'] = 0x003A; 9932 t['colonmonetary'] = 0x20A1; 9933 t['colonmonospace'] = 0xFF1A; 9934 t['colonsign'] = 0x20A1; 9935 t['colonsmall'] = 0xFE55; 9936 t['colontriangularhalfmod'] = 0x02D1; 9937 t['colontriangularmod'] = 0x02D0; 9938 t['comma'] = 0x002C; 9939 t['commaabovecmb'] = 0x0313; 9940 t['commaaboverightcmb'] = 0x0315; 9941 t['commaaccent'] = 0xF6C3; 9942 t['commaarabic'] = 0x060C; 9943 t['commaarmenian'] = 0x055D; 9944 t['commainferior'] = 0xF6E1; 9945 t['commamonospace'] = 0xFF0C; 9946 t['commareversedabovecmb'] = 0x0314; 9947 t['commareversedmod'] = 0x02BD; 9948 t['commasmall'] = 0xFE50; 9949 t['commasuperior'] = 0xF6E2; 9950 t['commaturnedabovecmb'] = 0x0312; 9951 t['commaturnedmod'] = 0x02BB; 9952 t['compass'] = 0x263C; 9953 t['congruent'] = 0x2245; 9954 t['contourintegral'] = 0x222E; 9955 t['control'] = 0x2303; 9956 t['controlACK'] = 0x0006; 9957 t['controlBEL'] = 0x0007; 9958 t['controlBS'] = 0x0008; 9959 t['controlCAN'] = 0x0018; 9960 t['controlCR'] = 0x000D; 9961 t['controlDC1'] = 0x0011; 9962 t['controlDC2'] = 0x0012; 9963 t['controlDC3'] = 0x0013; 9964 t['controlDC4'] = 0x0014; 9965 t['controlDEL'] = 0x007F; 9966 t['controlDLE'] = 0x0010; 9967 t['controlEM'] = 0x0019; 9968 t['controlENQ'] = 0x0005; 9969 t['controlEOT'] = 0x0004; 9970 t['controlESC'] = 0x001B; 9971 t['controlETB'] = 0x0017; 9972 t['controlETX'] = 0x0003; 9973 t['controlFF'] = 0x000C; 9974 t['controlFS'] = 0x001C; 9975 t['controlGS'] = 0x001D; 9976 t['controlHT'] = 0x0009; 9977 t['controlLF'] = 0x000A; 9978 t['controlNAK'] = 0x0015; 9979 t['controlNULL'] = 0x0000; 9980 t['controlRS'] = 0x001E; 9981 t['controlSI'] = 0x000F; 9982 t['controlSO'] = 0x000E; 9983 t['controlSOT'] = 0x0002; 9984 t['controlSTX'] = 0x0001; 9985 t['controlSUB'] = 0x001A; 9986 t['controlSYN'] = 0x0016; 9987 t['controlUS'] = 0x001F; 9988 t['controlVT'] = 0x000B; 9989 t['copyright'] = 0x00A9; 9990 t['copyrightsans'] = 0xF8E9; 9991 t['copyrightserif'] = 0xF6D9; 9992 t['cornerbracketleft'] = 0x300C; 9993 t['cornerbracketlefthalfwidth'] = 0xFF62; 9994 t['cornerbracketleftvertical'] = 0xFE41; 9995 t['cornerbracketright'] = 0x300D; 9996 t['cornerbracketrighthalfwidth'] = 0xFF63; 9997 t['cornerbracketrightvertical'] = 0xFE42; 9998 t['corporationsquare'] = 0x337F; 9999 t['cosquare'] = 0x33C7; 10000 t['coverkgsquare'] = 0x33C6; 10001 t['cparen'] = 0x249E; 10002 t['cruzeiro'] = 0x20A2; 10003 t['cstretched'] = 0x0297; 10004 t['curlyand'] = 0x22CF; 10005 t['curlyor'] = 0x22CE; 10006 t['currency'] = 0x00A4; 10007 t['cyrBreve'] = 0xF6D1; 10008 t['cyrFlex'] = 0xF6D2; 10009 t['cyrbreve'] = 0xF6D4; 10010 t['cyrflex'] = 0xF6D5; 10011 t['d'] = 0x0064; 10012 t['daarmenian'] = 0x0564; 10013 t['dabengali'] = 0x09A6; 10014 t['dadarabic'] = 0x0636; 10015 t['dadeva'] = 0x0926; 10016 t['dadfinalarabic'] = 0xFEBE; 10017 t['dadinitialarabic'] = 0xFEBF; 10018 t['dadmedialarabic'] = 0xFEC0; 10019 t['dagesh'] = 0x05BC; 10020 t['dageshhebrew'] = 0x05BC; 10021 t['dagger'] = 0x2020; 10022 t['daggerdbl'] = 0x2021; 10023 t['dagujarati'] = 0x0AA6; 10024 t['dagurmukhi'] = 0x0A26; 10025 t['dahiragana'] = 0x3060; 10026 t['dakatakana'] = 0x30C0; 10027 t['dalarabic'] = 0x062F; 10028 t['dalet'] = 0x05D3; 10029 t['daletdagesh'] = 0xFB33; 10030 t['daletdageshhebrew'] = 0xFB33; 10031 t['dalethebrew'] = 0x05D3; 10032 t['dalfinalarabic'] = 0xFEAA; 10033 t['dammaarabic'] = 0x064F; 10034 t['dammalowarabic'] = 0x064F; 10035 t['dammatanaltonearabic'] = 0x064C; 10036 t['dammatanarabic'] = 0x064C; 10037 t['danda'] = 0x0964; 10038 t['dargahebrew'] = 0x05A7; 10039 t['dargalefthebrew'] = 0x05A7; 10040 t['dasiapneumatacyrilliccmb'] = 0x0485; 10041 t['dblGrave'] = 0xF6D3; 10042 t['dblanglebracketleft'] = 0x300A; 10043 t['dblanglebracketleftvertical'] = 0xFE3D; 10044 t['dblanglebracketright'] = 0x300B; 10045 t['dblanglebracketrightvertical'] = 0xFE3E; 10046 t['dblarchinvertedbelowcmb'] = 0x032B; 10047 t['dblarrowleft'] = 0x21D4; 10048 t['dblarrowright'] = 0x21D2; 10049 t['dbldanda'] = 0x0965; 10050 t['dblgrave'] = 0xF6D6; 10051 t['dblgravecmb'] = 0x030F; 10052 t['dblintegral'] = 0x222C; 10053 t['dbllowline'] = 0x2017; 10054 t['dbllowlinecmb'] = 0x0333; 10055 t['dbloverlinecmb'] = 0x033F; 10056 t['dblprimemod'] = 0x02BA; 10057 t['dblverticalbar'] = 0x2016; 10058 t['dblverticallineabovecmb'] = 0x030E; 10059 t['dbopomofo'] = 0x3109; 10060 t['dbsquare'] = 0x33C8; 10061 t['dcaron'] = 0x010F; 10062 t['dcedilla'] = 0x1E11; 10063 t['dcircle'] = 0x24D3; 10064 t['dcircumflexbelow'] = 0x1E13; 10065 t['dcroat'] = 0x0111; 10066 t['ddabengali'] = 0x09A1; 10067 t['ddadeva'] = 0x0921; 10068 t['ddagujarati'] = 0x0AA1; 10069 t['ddagurmukhi'] = 0x0A21; 10070 t['ddalarabic'] = 0x0688; 10071 t['ddalfinalarabic'] = 0xFB89; 10072 t['dddhadeva'] = 0x095C; 10073 t['ddhabengali'] = 0x09A2; 10074 t['ddhadeva'] = 0x0922; 10075 t['ddhagujarati'] = 0x0AA2; 10076 t['ddhagurmukhi'] = 0x0A22; 10077 t['ddotaccent'] = 0x1E0B; 10078 t['ddotbelow'] = 0x1E0D; 10079 t['decimalseparatorarabic'] = 0x066B; 10080 t['decimalseparatorpersian'] = 0x066B; 10081 t['decyrillic'] = 0x0434; 10082 t['degree'] = 0x00B0; 10083 t['dehihebrew'] = 0x05AD; 10084 t['dehiragana'] = 0x3067; 10085 t['deicoptic'] = 0x03EF; 10086 t['dekatakana'] = 0x30C7; 10087 t['deleteleft'] = 0x232B; 10088 t['deleteright'] = 0x2326; 10089 t['delta'] = 0x03B4; 10090 t['deltaturned'] = 0x018D; 10091 t['denominatorminusonenumeratorbengali'] = 0x09F8; 10092 t['dezh'] = 0x02A4; 10093 t['dhabengali'] = 0x09A7; 10094 t['dhadeva'] = 0x0927; 10095 t['dhagujarati'] = 0x0AA7; 10096 t['dhagurmukhi'] = 0x0A27; 10097 t['dhook'] = 0x0257;
10098 t['dialytikatonos'] = 0x0385; 10099 t['dialytikatonoscmb'] = 0x0344; 10100 t['diamond'] = 0x2666; 10101 t['diamondsuitwhite'] = 0x2662; 10102 t['dieresis'] = 0x00A8; 10103 t['dieresisacute'] = 0xF6D7; 10104 t['dieresisbelowcmb'] = 0x0324; 10105 t['dieresiscmb'] = 0x0308; 10106 t['dieresisgrave'] = 0xF6D8; 10107 t['dieresistonos'] = 0x0385; 10108 t['dihiragana'] = 0x3062; 10109 t['dikatakana'] = 0x30C2; 10110 t['dittomark'] = 0x3003; 10111 t['divide'] = 0x00F7; 10112 t['divides'] = 0x2223; 10113 t['divisionslash'] = 0x2215; 10114 t['djecyrillic'] = 0x0452; 10115 t['dkshade'] = 0x2593; 10116 t['dlinebelow'] = 0x1E0F; 10117 t['dlsquare'] = 0x3397; 10118 t['dmacron'] = 0x0111; 10119 t['dmonospace'] = 0xFF44; 10120 t['dnblock'] = 0x2584; 10121 t['dochadathai'] = 0x0E0E; 10122 t['dodekthai'] = 0x0E14; 10123 t['dohiragana'] = 0x3069; 10124 t['dokatakana'] = 0x30C9; 10125 t['dollar'] = 0x0024; 10126 t['dollarinferior'] = 0xF6E3; 10127 t['dollarmonospace'] = 0xFF04; 10128 t['dollaroldstyle'] = 0xF724; 10129 t['dollarsmall'] = 0xFE69; 10130 t['dollarsuperior'] = 0xF6E4; 10131 t['dong'] = 0x20AB; 10132 t['dorusquare'] = 0x3326; 10133 t['dotaccent'] = 0x02D9; 10134 t['dotaccentcmb'] = 0x0307; 10135 t['dotbelowcmb'] = 0x0323; 10136 t['dotbelowcomb'] = 0x0323; 10137 t['dotkatakana'] = 0x30FB; 10138 t['dotlessi'] = 0x0131; 10139 t['dotlessj'] = 0xF6BE; 10140 t['dotlessjstrokehook'] = 0x0284; 10141 t['dotmath'] = 0x22C5; 10142 t['dottedcircle'] = 0x25CC; 10143 t['doubleyodpatah'] = 0xFB1F; 10144 t['doubleyodpatahhebrew'] = 0xFB1F; 10145 t['downtackbelowcmb'] = 0x031E; 10146 t['downtackmod'] = 0x02D5; 10147 t['dparen'] = 0x249F; 10148 t['dsuperior'] = 0xF6EB; 10149 t['dtail'] = 0x0256; 10150 t['dtopbar'] = 0x018C; 10151 t['duhiragana'] = 0x3065; 10152 t['dukatakana'] = 0x30C5; 10153 t['dz'] = 0x01F3; 10154 t['dzaltone'] = 0x02A3; 10155 t['dzcaron'] = 0x01C6; 10156 t['dzcurl'] = 0x02A5; 10157 t['dzeabkhasiancyrillic'] = 0x04E1; 10158 t['dzecyrillic'] = 0x0455; 10159 t['dzhecyrillic'] = 0x045F; 10160 t['e'] = 0x0065; 10161 t['eacute'] = 0x00E9; 10162 t['earth'] = 0x2641; 10163 t['ebengali'] = 0x098F; 10164 t['ebopomofo'] = 0x311C; 10165 t['ebreve'] = 0x0115; 10166 t['ecandradeva'] = 0x090D; 10167 t['ecandragujarati'] = 0x0A8D; 10168 t['ecandravowelsigndeva'] = 0x0945; 10169 t['ecandravowelsigngujarati'] = 0x0AC5; 10170 t['ecaron'] = 0x011B; 10171 t['ecedillabreve'] = 0x1E1D; 10172 t['echarmenian'] = 0x0565; 10173 t['echyiwnarmenian'] = 0x0587; 10174 t['ecircle'] = 0x24D4; 10175 t['ecircumflex'] = 0x00EA; 10176 t['ecircumflexacute'] = 0x1EBF; 10177 t['ecircumflexbelow'] = 0x1E19; 10178 t['ecircumflexdotbelow'] = 0x1EC7; 10179 t['ecircumflexgrave'] = 0x1EC1; 10180 t['ecircumflexhookabove'] = 0x1EC3; 10181 t['ecircumflextilde'] = 0x1EC5; 10182 t['ecyrillic'] = 0x0454; 10183 t['edblgrave'] = 0x0205; 10184 t['edeva'] = 0x090F; 10185 t['edieresis'] = 0x00EB; 10186 t['edot'] = 0x0117; 10187 t['edotaccent'] = 0x0117; 10188 t['edotbelow'] = 0x1EB9; 10189 t['eegurmukhi'] = 0x0A0F; 10190 t['eematragurmukhi'] = 0x0A47; 10191 t['efcyrillic'] = 0x0444; 10192 t['egrave'] = 0x00E8; 10193 t['egujarati'] = 0x0A8F; 10194 t['eharmenian'] = 0x0567; 10195 t['ehbopomofo'] = 0x311D; 10196 t['ehiragana'] = 0x3048; 10197 t['ehookabove'] = 0x1EBB; 10198 t['eibopomofo'] = 0x311F; 10199 t['eight'] = 0x0038; 10200 t['eightarabic'] = 0x0668; 10201 t['eightbengali'] = 0x09EE; 10202 t['eightcircle'] = 0x2467; 10203 t['eightcircleinversesansserif'] = 0x2791; 10204 t['eightdeva'] = 0x096E; 10205 t['eighteencircle'] = 0x2471; 10206 t['eighteenparen'] = 0x2485; 10207 t['eighteenperiod'] = 0x2499; 10208 t['eightgujarati'] = 0x0AEE; 10209 t['eightgurmukhi'] = 0x0A6E; 10210 t['eighthackarabic'] = 0x0668; 10211 t['eighthangzhou'] = 0x3028; 10212 t['eighthnotebeamed'] = 0x266B; 10213 t['eightideographicparen'] = 0x3227; 10214 t['eightinferior'] = 0x2088; 10215 t['eightmonospace'] = 0xFF18; 10216 t['eightoldstyle'] = 0xF738; 10217 t['eightparen'] = 0x247B; 10218 t['eightperiod'] = 0x248F; 10219 t['eightpersian'] = 0x06F8; 10220 t['eightroman'] = 0x2177; 10221 t['eightsuperior'] = 0x2078; 10222 t['eightthai'] = 0x0E58; 10223 t['einvertedbreve'] = 0x0207; 10224 t['eiotifiedcyrillic'] = 0x0465; 10225 t['ekatakana'] = 0x30A8; 10226 t['ekatakanahalfwidth'] = 0xFF74; 10227 t['ekonkargurmukhi'] = 0x0A74; 10228 t['ekorean'] = 0x3154; 10229 t['elcyrillic'] = 0x043B; 10230 t['element'] = 0x2208; 10231 t['elevencircle'] = 0x246A; 10232 t['elevenparen'] = 0x247E; 10233 t['elevenperiod'] = 0x2492; 10234 t['elevenroman'] = 0x217A; 10235 t['ellipsis'] = 0x2026; 10236 t['ellipsisvertical'] = 0x22EE; 10237 t['emacron'] = 0x0113; 10238 t['emacronacute'] = 0x1E17; 10239 t['emacrongrave'] = 0x1E15;
10240 t['emcyrillic'] = 0x043C; 10241 t['emdash'] = 0x2014; 10242 t['emdashvertical'] = 0xFE31; 10243 t['emonospace'] = 0xFF45; 10244 t['emphasismarkarmenian'] = 0x055B; 10245 t['emptyset'] = 0x2205; 10246 t['enbopomofo'] = 0x3123; 10247 t['encyrillic'] = 0x043D; 10248 t['endash'] = 0x2013; 10249 t['endashvertical'] = 0xFE32; 10250 t['endescendercyrillic'] = 0x04A3; 10251 t['eng'] = 0x014B; 10252 t['engbopomofo'] = 0x3125; 10253 t['enghecyrillic'] = 0x04A5; 10254 t['enhookcyrillic'] = 0x04C8; 10255 t['enspace'] = 0x2002; 10256 t['eogonek'] = 0x0119; 10257 t['eokorean'] = 0x3153; 10258 t['eopen'] = 0x025B; 10259 t['eopenclosed'] = 0x029A; 10260 t['eopenreversed'] = 0x025C; 10261 t['eopenreversedclosed'] = 0x025E; 10262 t['eopenreversedhook'] = 0x025D; 10263 t['eparen'] = 0x24A0; 10264 t['epsilon'] = 0x03B5; 10265 t['epsilontonos'] = 0x03AD; 10266 t['equal'] = 0x003D; 10267 t['equalmonospace'] = 0xFF1D; 10268 t['equalsmall'] = 0xFE66; 10269 t['equalsuperior'] = 0x207C; 10270 t['equivalence'] = 0x2261; 10271 t['erbopomofo'] = 0x3126; 10272 t['ercyrillic'] = 0x0440; 10273 t['ereversed'] = 0x0258; 10274 t['ereversedcyrillic'] = 0x044D; 10275 t['escyrillic'] = 0x0441; 10276 t['esdescendercyrillic'] = 0x04AB; 10277 t['esh'] = 0x0283; 10278 t['eshcurl'] = 0x0286; 10279 t['eshortdeva'] = 0x090E; 10280 t['eshortvowelsigndeva'] = 0x0946; 10281 t['eshreversedloop'] = 0x01AA; 10282 t['eshsquatreversed'] = 0x0285; 10283 t['esmallhiragana'] = 0x3047; 10284 t['esmallkatakana'] = 0x30A7; 10285 t['esmallkatakanahalfwidth'] = 0xFF6A; 10286 t['estimated'] = 0x212E; 10287 t['esuperior'] = 0xF6EC; 10288 t['eta'] = 0x03B7; 10289 t['etarmenian'] = 0x0568; 10290 t['etatonos'] = 0x03AE; 10291 t['eth'] = 0x00F0; 10292 t['etilde'] = 0x1EBD; 10293 t['etildebelow'] = 0x1E1B; 10294 t['etnahtafoukhhebrew'] = 0x0591; 10295 t['etnahtafoukhlefthebrew'] = 0x0591; 10296 t['etnahtahebrew'] = 0x0591; 10297 t['etnahtalefthebrew'] = 0x0591; 10298 t['eturned'] = 0x01DD; 10299 t['eukorean'] = 0x3161; 10300 t['euro'] = 0x20AC; 10301 t['evowelsignbengali'] = 0x09C7; 10302 t['evowelsigndeva'] = 0x0947; 10303 t['evowelsigngujarati'] = 0x0AC7; 10304 t['exclam'] = 0x0021; 10305 t['exclamarmenian'] = 0x055C; 10306 t['exclamdbl'] = 0x203C; 10307 t['exclamdown'] = 0x00A1; 10308 t['exclamdownsmall'] = 0xF7A1; 10309 t['exclammonospace'] = 0xFF01; 10310 t['exclamsmall'] = 0xF721; 10311 t['existential'] = 0x2203; 10312 t['ezh'] = 0x0292; 10313 t['ezhcaron'] = 0x01EF; 10314 t['ezhcurl'] = 0x0293; 10315 t['ezhreversed'] = 0x01B9; 10316 t['ezhtail'] = 0x01BA; 10317 t['f'] = 0x0066; 10318 t['fadeva'] = 0x095E; 10319 t['fagurmukhi'] = 0x0A5E; 10320 t['fahrenheit'] = 0x2109; 10321 t['fathaarabic'] = 0x064E; 10322 t['fathalowarabic'] = 0x064E; 10323 t['fathatanarabic'] = 0x064B; 10324 t['fbopomofo'] = 0x3108; 10325 t['fcircle'] = 0x24D5; 10326 t['fdotaccent'] = 0x1E1F; 10327 t['feharabic'] = 0x0641; 10328 t['feharmenian'] = 0x0586; 10329 t['fehfinalarabic'] = 0xFED2; 10330 t['fehinitialarabic'] = 0xFED3; 10331 t['fehmedialarabic'] = 0xFED4; 10332 t['feicoptic'] = 0x03E5; 10333 t['female'] = 0x2640; 10334 t['ff'] = 0xFB00; 10335 t['ffi'] = 0xFB03; 10336 t['ffl'] = 0xFB04; 10337 t['fi'] = 0xFB01; 10338 t['fifteencircle'] = 0x246E; 10339 t['fifteenparen'] = 0x2482; 10340 t['fifteenperiod'] = 0x2496; 10341 t['figuredash'] = 0x2012; 10342 t['filledbox'] = 0x25A0; 10343 t['filledrect'] = 0x25AC; 10344 t['finalkaf'] = 0x05DA; 10345 t['finalkafdagesh'] = 0xFB3A; 10346 t['finalkafdageshhebrew'] = 0xFB3A; 10347 t['finalkafhebrew'] = 0x05DA; 10348 t['finalmem'] = 0x05DD; 10349 t['finalmemhebrew'] = 0x05DD; 10350 t['finalnun'] = 0x05DF; 10351 t['finalnunhebrew'] = 0x05DF; 10352 t['finalpe'] = 0x05E3; 10353 t['finalpehebrew'] = 0x05E3; 10354 t['finaltsadi'] = 0x05E5; 10355 t['finaltsadihebrew'] = 0x05E5; 10356 t['firsttonechinese'] = 0x02C9; 10357 t['fisheye'] = 0x25C9; 10358 t['fitacyrillic'] = 0x0473; 10359 t['five'] = 0x0035; 10360 t['fivearabic'] = 0x0665; 10361 t['fivebengali'] = 0x09EB; 10362 t['fivecircle'] = 0x2464; 10363 t['fivecircleinversesansserif'] = 0x278E; 10364 t['fivedeva'] = 0x096B; 10365 t['fiveeighths'] = 0x215D; 10366 t['fivegujarati'] = 0x0AEB; 10367 t['fivegurmukhi'] = 0x0A6B; 10368 t['fivehackarabic'] = 0x0665; 10369 t['fivehangzhou'] = 0x3025; 10370 t['fiveideographicparen'] = 0x3224; 10371 t['fiveinferior'] = 0x2085; 10372 t['fivemonospace'] = 0xFF15; 10373 t['fiveoldstyle'] = 0xF735; 10374 t['fiveparen'] = 0x2478; 10375 t['fiveperiod'] = 0x248C; 10376 t['fivepersian'] = 0x06F5; 10377 t['fiveroman'] = 0x2174; 10378 t['fivesuperior'] = 0x2075; 10379 t['fivethai'] = 0x0E55; 10380 t['fl'] = 0xFB02; 10381 t['florin'] = 0x0192; 10382 t['fmonospace'] = 0xFF46; 10383 t['fmsquare'] = 0x3399; 10384 t['fofanthai'] = 0x0E1F; 10385 t['fofathai'] = 0x0E1D; 10386 t['fongmanthai'] = 0x0E4F; 10387 t['forall'] = 0x2200; 10388 t['four'] = 0x0034; 10389 t['fourarabic'] = 0x0664; 10390 t['fourbengali'] = 0x09EA;
10391 t['fourcircle'] = 0x2463; 10392 t['fourcircleinversesansserif'] = 0x278D; 10393 t['fourdeva'] = 0x096A; 10394 t['fourgujarati'] = 0x0AEA; 10395 t['fourgurmukhi'] = 0x0A6A; 10396 t['fourhackarabic'] = 0x0664; 10397 t['fourhangzhou'] = 0x3024; 10398 t['fourideographicparen'] = 0x3223; 10399 t['fourinferior'] = 0x2084; 10400 t['fourmonospace'] = 0xFF14; 10401 t['fournumeratorbengali'] = 0x09F7; 10402 t['fouroldstyle'] = 0xF734; 10403 t['fourparen'] = 0x2477; 10404 t['fourperiod'] = 0x248B; 10405 t['fourpersian'] = 0x06F4; 10406 t['fourroman'] = 0x2173; 10407 t['foursuperior'] = 0x2074; 10408 t['fourteencircle'] = 0x246D; 10409 t['fourteenparen'] = 0x2481; 10410 t['fourteenperiod'] = 0x2495; 10411 t['fourthai'] = 0x0E54; 10412 t['fourthtonechinese'] = 0x02CB; 10413 t['fparen'] = 0x24A1; 10414 t['fraction'] = 0x2044; 10415 t['franc'] = 0x20A3; 10416 t['g'] = 0x0067; 10417 t['gabengali'] = 0x0997; 10418 t['gacute'] = 0x01F5; 10419 t['gadeva'] = 0x0917; 10420 t['gafarabic'] = 0x06AF; 10421 t['gaffinalarabic'] = 0xFB93; 10422 t['gafinitialarabic'] = 0xFB94; 10423 t['gafmedialarabic'] = 0xFB95; 10424 t['gagujarati'] = 0x0A97; 10425 t['gagurmukhi'] = 0x0A17; 10426 t['gahiragana'] = 0x304C; 10427 t['gakatakana'] = 0x30AC; 10428 t['gamma'] = 0x03B3; 10429 t['gammalatinsmall'] = 0x0263; 10430 t['gammasuperior'] = 0x02E0; 10431 t['gangiacoptic'] = 0x03EB; 10432 t['gbopomofo'] = 0x310D; 10433 t['gbreve'] = 0x011F; 10434 t['gcaron'] = 0x01E7; 10435 t['gcedilla'] = 0x0123; 10436 t['gcircle'] = 0x24D6; 10437 t['gcircumflex'] = 0x011D; 10438 t['gcommaaccent'] = 0x0123; 10439 t['gdot'] = 0x0121; 10440 t['gdotaccent'] = 0x0121; 10441 t['gecyrillic'] = 0x0433; 10442 t['gehiragana'] = 0x3052; 10443 t['gekatakana'] = 0x30B2; 10444 t['geometricallyequal'] = 0x2251; 10445 t['gereshaccenthebrew'] = 0x059C; 10446 t['gereshhebrew'] = 0x05F3; 10447 t['gereshmuqdamhebrew'] = 0x059D; 10448 t['germandbls'] = 0x00DF; 10449 t['gershayimaccenthebrew'] = 0x059E; 10450 t['gershayimhebrew'] = 0x05F4; 10451 t['getamark'] = 0x3013; 10452 t['ghabengali'] = 0x0998; 10453 t['ghadarmenian'] = 0x0572; 10454 t['ghadeva'] = 0x0918; 10455 t['ghagujarati'] = 0x0A98; 10456 t['ghagurmukhi'] = 0x0A18; 10457 t['ghainarabic'] = 0x063A; 10458 t['ghainfinalarabic'] = 0xFECE; 10459 t['ghaininitialarabic'] = 0xFECF; 10460 t['ghainmedialarabic'] = 0xFED0; 10461 t['ghemiddlehookcyrillic'] = 0x0495; 10462 t['ghestrokecyrillic'] = 0x0493; 10463 t['gheupturncyrillic'] = 0x0491; 10464 t['ghhadeva'] = 0x095A; 10465 t['ghhagurmukhi'] = 0x0A5A; 10466 t['ghook'] = 0x0260; 10467 t['ghzsquare'] = 0x3393; 10468 t['gihiragana'] = 0x304E; 10469 t['gikatakana'] = 0x30AE; 10470 t['gimarmenian'] = 0x0563; 10471 t['gimel'] = 0x05D2; 10472 t['gimeldagesh'] = 0xFB32; 10473 t['gimeldageshhebrew'] = 0xFB32; 10474 t['gimelhebrew'] = 0x05D2; 10475 t['gjecyrillic'] = 0x0453; 10476 t['glottalinvertedstroke'] = 0x01BE; 10477 t['glottalstop'] = 0x0294; 10478 t['glottalstopinverted'] = 0x0296; 10479 t['glottalstopmod'] = 0x02C0; 10480 t['glottalstopreversed'] = 0x0295; 10481 t['glottalstopreversedmod'] = 0x02C1; 10482 t['glottalstopreversedsuperior'] = 0x02E4; 10483 t['glottalstopstroke'] = 0x02A1; 10484 t['glottalstopstrokereversed'] = 0x02A2; 10485 t['gmacron'] = 0x1E21; 10486 t['gmonospace'] = 0xFF47; 10487 t['gohiragana'] = 0x3054; 10488 t['gokatakana'] = 0x30B4; 10489 t['gparen'] = 0x24A2; 10490 t['gpasquare'] = 0x33AC; 10491 t['gradient'] = 0x2207; 10492 t['grave'] = 0x0060; 10493 t['gravebelowcmb'] = 0x0316; 10494 t['gravecmb'] = 0x0300; 10495 t['gravecomb'] = 0x0300; 10496 t['gravedeva'] = 0x0953; 10497 t['gravelowmod'] = 0x02CE; 10498 t['gravemonospace'] = 0xFF40; 10499 t['gravetonecmb'] = 0x0340; 10500 t['greater'] = 0x003E; 10501 t['greaterequal'] = 0x2265; 10502 t['greaterequalorless'] = 0x22DB; 10503 t['greatermonospace'] = 0xFF1E; 10504 t['greaterorequivalent'] = 0x2273; 10505 t['greaterorless'] = 0x2277; 10506 t['greateroverequal'] = 0x2267; 10507 t['greatersmall'] = 0xFE65; 10508 t['gscript'] = 0x0261; 10509 t['gstroke'] = 0x01E5; 10510 t['guhiragana'] = 0x3050; 10511 t['guillemotleft'] = 0x00AB; 10512 t['guillemotright'] = 0x00BB; 10513 t['guilsinglleft'] = 0x2039; 10514 t['guilsinglright'] = 0x203A; 10515 t['gukatakana'] = 0x30B0; 10516 t['guramusquare'] = 0x3318; 10517 t['gysquare'] = 0x33C9; 10518 t['h'] = 0x0068; 10519 t['haabkhasiancyrillic'] = 0x04A9; 10520 t['haaltonearabic'] = 0x06C1; 10521 t['habengali'] = 0x09B9; 10522 t['hadescendercyrillic'] = 0x04B3; 10523 t['hadeva'] = 0x0939; 10524 t['hagujarati'] = 0x0AB9; 10525 t['hagurmukhi'] = 0x0A39; 10526 t['haharabic'] = 0x062D; 10527 t['hahfinalarabic'] = 0xFEA2; 10528 t['hahinitialarabic'] = 0xFEA3; 10529 t['hahiragana'] = 0x306F; 10530 t['hahmedialarabic'] = 0xFEA4; 10531 t['haitusquare'] = 0x332A; 10532 t['hakatakana'] = 0x30CF; 10533 t['hakatakanahalfwidth'] = 0xFF8A; 10534 t['halantgurmukhi'] = 0x0A4D; 10535 t['hamzaarabic'] = 0x0621; 10536 t['hamzalowarabic'] = 0x0621; 10537 t['hangulfiller'] = 0x3164; 10538 t['hardsigncyrillic'] = 0x044A; 10539 t['harpoonleftbarbup'] = 0x21BC; 10540 t['harpoonrightbarbup'] = 0x21C0; 10541 t['hasquare'] = 0x33CA; 10542 t['hatafpatah'] = 0x05B2; 10543 t['hatafpatah16'] = 0x05B2; 10544 t['hatafpatah23'] = 0x05B2; 10545 t['hatafpatah2f'] = 0x05B2; 10546 t['hatafpatahhebrew'] = 0x05B2; 10547 t['hatafpatahnarrowhebrew'] = 0x05B2; 10548 t['hatafpatahquarterhebrew'] = 0x05B2; 10549 t['hatafpatahwidehebrew'] = 0x05B2; 10550 t['hatafqamats'] = 0x05B3; 10551 t['hatafqamats1b'] = 0x05B3; 10552 t['hatafqamats28'] = 0x05B3; 10553 t['hatafqamats34'] = 0x05B3; 10554 t['hatafqamatshebrew'] = 0x05B3; 10555 t['hatafqamatsnarrowhebrew'] = 0x05B3; 10556 t['hatafqamatsquarterhebrew'] = 0x05B3; 10557 t['hatafqamatswidehebrew'] = 0x05B3; 10558 t['hatafsegol'] = 0x05B1; 10559 t['hatafsegol17'] = 0x05B1; 10560 t['hatafsegol24'] = 0x05B1; 10561 t['hatafsegol30'] = 0x05B1; 10562 t['hatafsegolhebrew'] = 0x05B1; 10563 t['hatafsegolnarrowhebrew'] = 0x05B1; 10564 t['hatafsegolquarterhebrew'] = 0x05B1; 10565 t['hatafsegolwidehebrew'] = 0x05B1; 10566 t['hbar'] = 0x0127; 10567 t['hbopomofo'] = 0x310F; 10568 t['hbrevebelow'] = 0x1E2B; 10569 t['hcedilla'] = 0x1E29; 10570 t['hcircle'] = 0x24D7; 10571 t['hcircumflex'] = 0x0125; 10572 t['hdieresis'] = 0x1E27; 10573 t['hdotaccent'] = 0x1E23; 10574 t['hdotbelow'] = 0x1E25; 10575 t['he'] = 0x05D4; 10576 t['heart'] = 0x2665; 10577 t['heartsuitblack'] = 0x2665; 10578 t['heartsuitwhite'] = 0x2661; 10579 t['hedagesh'] = 0xFB34; 10580 t['hedageshhebrew'] = 0xFB34; 10581 t['hehaltonearabic'] = 0x06C1; 10582 t['heharabic'] = 0x0647; 10583 t['hehebrew'] = 0x05D4; 10584 t['hehfinalaltonearabic'] = 0xFBA7; 10585 t['hehfinalalttwoarabic'] = 0xFEEA; 10586 t['hehfinalarabic'] = 0xFEEA; 10587 t['hehhamzaabovefinalarabic'] = 0xFBA5; 10588 t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
10589 t['hehinitialaltonearabic'] = 0xFBA8; 10590 t['hehinitialarabic'] = 0xFEEB; 10591 t['hehiragana'] = 0x3078; 10592 t['hehmedialaltonearabic'] = 0xFBA9; 10593 t['hehmedialarabic'] = 0xFEEC; 10594 t['heiseierasquare'] = 0x337B; 10595 t['hekatakana'] = 0x30D8; 10596 t['hekatakanahalfwidth'] = 0xFF8D; 10597 t['hekutaarusquare'] = 0x3336; 10598 t['henghook'] = 0x0267; 10599 t['herutusquare'] = 0x3339; 10600 t['het'] = 0x05D7; 10601 t['hethebrew'] = 0x05D7; 10602 t['hhook'] = 0x0266; 10603 t['hhooksuperior'] = 0x02B1; 10604 t['hieuhacirclekorean'] = 0x327B; 10605 t['hieuhaparenkorean'] = 0x321B; 10606 t['hieuhcirclekorean'] = 0x326D; 10607 t['hieuhkorean'] = 0x314E; 10608 t['hieuhparenkorean'] = 0x320D; 10609 t['hihiragana'] = 0x3072; 10610 t['hikatakana'] = 0x30D2; 10611 t['hikatakanahalfwidth'] = 0xFF8B; 10612 t['hiriq'] = 0x05B4; 10613 t['hiriq14'] = 0x05B4; 10614 t['hiriq21'] = 0x05B4; 10615 t['hiriq2d'] = 0x05B4; 10616 t['hiriqhebrew'] = 0x05B4; 10617 t['hiriqnarrowhebrew'] = 0x05B4; 10618 t['hiriqquarterhebrew'] = 0x05B4; 10619 t['hiriqwidehebrew'] = 0x05B4; 10620 t['hlinebelow'] = 0x1E96; 10621 t['hmonospace'] = 0xFF48; 10622 t['hoarmenian'] = 0x0570; 10623 t['hohipthai'] = 0x0E2B; 10624 t['hohiragana'] = 0x307B; 10625 t['hokatakana'] = 0x30DB; 10626 t['hokatakanahalfwidth'] = 0xFF8E; 10627 t['holam'] = 0x05B9; 10628 t['holam19'] = 0x05B9; 10629 t['holam26'] = 0x05B9; 10630 t['holam32'] = 0x05B9; 10631 t['holamhebrew'] = 0x05B9; 10632 t['holamnarrowhebrew'] = 0x05B9; 10633 t['holamquarterhebrew'] = 0x05B9; 10634 t['holamwidehebrew'] = 0x05B9; 10635 t['honokhukthai'] = 0x0E2E; 10636 t['hookabovecomb'] = 0x0309; 10637 t['hookcmb'] = 0x0309; 10638 t['hookpalatalizedbelowcmb'] = 0x0321; 10639 t['hookretroflexbelowcmb'] = 0x0322; 10640 t['hoonsquare'] = 0x3342; 10641 t['horicoptic'] = 0x03E9; 10642 t['horizontalbar'] = 0x2015; 10643 t['horncmb'] = 0x031B; 10644 t['hotsprings'] = 0x2668; 10645 t['house'] = 0x2302; 10646 t['hparen'] = 0x24A3; 10647 t['hsuperior'] = 0x02B0; 10648 t['hturned'] = 0x0265; 10649 t['huhiragana'] = 0x3075; 10650 t['huiitosquare'] = 0x3333; 10651 t['hukatakana'] = 0x30D5; 10652 t['hukatakanahalfwidth'] = 0xFF8C; 10653 t['hungarumlaut'] = 0x02DD; 10654 t['hungarumlautcmb'] = 0x030B; 10655 t['hv'] = 0x0195; 10656 t['hyphen'] = 0x002D; 10657 t['hypheninferior'] = 0xF6E5; 10658 t['hyphenmonospace'] = 0xFF0D; 10659 t['hyphensmall'] = 0xFE63; 10660 t['hyphensuperior'] = 0xF6E6; 10661 t['hyphentwo'] = 0x2010; 10662 t['i'] = 0x0069; 10663 t['iacute'] = 0x00ED; 10664 t['iacyrillic'] = 0x044F; 10665 t['ibengali'] = 0x0987; 10666 t['ibopomofo'] = 0x3127; 10667 t['ibreve'] = 0x012D; 10668 t['icaron'] = 0x01D0; 10669 t['icircle'] = 0x24D8; 10670 t['icircumflex'] = 0x00EE; 10671 t['icyrillic'] = 0x0456; 10672 t['idblgrave'] = 0x0209; 10673 t['ideographearthcircle'] = 0x328F; 10674 t['ideographfirecircle'] = 0x328B; 10675 t['ideographicallianceparen'] = 0x323F; 10676 t['ideographiccallparen'] = 0x323A; 10677 t['ideographiccentrecircle'] = 0x32A5; 10678 t['ideographicclose'] = 0x3006; 10679 t['ideographiccomma'] = 0x3001; 10680 t['ideographiccommaleft'] = 0xFF64; 10681 t['ideographiccongratulationparen'] = 0x3237; 10682 t['ideographiccorrectcircle'] = 0x32A3; 10683 t['ideographicearthparen'] = 0x322F; 10684 t['ideographicenterpriseparen'] = 0x323D; 10685 t['ideographicexcellentcircle'] = 0x329D; 10686 t['ideographicfestivalparen'] = 0x3240; 10687 t['ideographicfinancialcircle'] = 0x3296; 10688 t['ideographicfinancialparen'] = 0x3236; 10689 t['ideographicfireparen'] = 0x322B; 10690 t['ideographichaveparen'] = 0x3232; 10691 t['ideographichighcircle'] = 0x32A4; 10692 t['ideographiciterationmark'] = 0x3005; 10693 t['ideographiclaborcircle'] = 0x3298; 10694 t['ideographiclaborparen'] = 0x3238; 10695 t['ideographicleftcircle'] = 0x32A7; 10696 t['ideographiclowcircle'] = 0x32A6; 10697 t['ideographicmedicinecircle'] = 0x32A9; 10698 t['ideographicmetalparen'] = 0x322E; 10699 t['ideographicmoonparen'] = 0x322A; 10700 t['ideographicnameparen'] = 0x3234; 10701 t['ideographicperiod'] = 0x3002; 10702 t['ideographicprintcircle'] = 0x329E; 10703 t['ideographicreachparen'] = 0x3243; 10704 t['ideographicrepresentparen'] = 0x3239; 10705 t['ideographicresourceparen'] = 0x323E; 10706 t['ideographicrightcircle'] = 0x32A8; 10707 t['ideographicsecretcircle'] = 0x3299; 10708 t['ideographicselfparen'] = 0x3242; 10709 t['ideographicsocietyparen'] = 0x3233; 10710 t['ideographicspace'] = 0x3000; 10711 t['ideographicspecialparen'] = 0x3235; 10712 t['ideographicstockparen'] = 0x3231; 10713 t['ideographicstudyparen'] = 0x323B; 10714 t['ideographicsunparen'] = 0x3230; 10715 t['ideographicsuperviseparen'] = 0x323C; 10716 t['ideographicwaterparen'] = 0x322C; 10717 t['ideographicwoodparen'] = 0x322D; 10718 t['ideographiczero'] = 0x3007; 10719 t['ideographmetalcircle'] = 0x328E; 10720 t['ideographmooncircle'] = 0x328A; 10721 t['ideographnamecircle'] = 0x3294; 10722 t['ideographsuncircle'] = 0x3290; 10723 t['ideographwatercircle'] = 0x328C; 10724 t['ideographwoodcircle'] = 0x328D; 10725 t['ideva'] = 0x0907; 10726 t['idieresis'] = 0x00EF; 10727 t['idieresisacute'] = 0x1E2F; 10728 t['idieresiscyrillic'] = 0x04E5; 10729 t['idotbelow'] = 0x1ECB; 10730 t['iebrevecyrillic'] = 0x04D7; 10731 t['iecyrillic'] = 0x0435; 10732 t['ieungacirclekorean'] = 0x3275; 10733 t['ieungaparenkorean'] = 0x3215; 10734 t['ieungcirclekorean'] = 0x3267; 10735 t['ieungkorean'] = 0x3147; 10736 t['ieungparenkorean'] = 0x3207; 10737 t['igrave'] = 0x00EC; 10738 t['igujarati'] = 0x0A87; 10739 t['igurmukhi'] = 0x0A07; 10740 t['ihiragana'] = 0x3044; 10741 t['ihookabove'] = 0x1EC9; 10742 t['iibengali'] = 0x0988; 10743 t['iicyrillic'] = 0x0438; 10744 t['iideva'] = 0x0908; 10745 t['iigujarati'] = 0x0A88; 10746 t['iigurmukhi'] = 0x0A08; 10747 t['iimatragurmukhi'] = 0x0A40; 10748 t['iinvertedbreve'] = 0x020B; 10749 t['iishortcyrillic'] = 0x0439; 10750 t['iivowelsignbengali'] = 0x09C0; 10751 t['iivowelsigndeva'] = 0x0940; 10752 t['iivowelsigngujarati'] = 0x0AC0; 10753 t['ij'] = 0x0133; 10754 t['ikatakana'] = 0x30A4; 10755 t['ikatakanahalfwidth'] = 0xFF72; 10756 t['ikorean'] = 0x3163; 10757 t['ilde'] = 0x02DC; 10758 t['iluyhebrew'] = 0x05AC; 10759 t['imacron'] = 0x012B; 10760 t['imacroncyrillic'] = 0x04E3; 10761 t['imageorapproximatelyequal'] = 0x2253; 10762 t['imatragurmukhi'] = 0x0A3F; 10763 t['imonospace'] = 0xFF49; 10764 t['increment'] = 0x2206; 10765 t['infinity'] = 0x221E; 10766 t['iniarmenian'] = 0x056B; 10767 t['integral'] = 0x222B; 10768 t['integralbottom'] = 0x2321; 10769 t['integralbt'] = 0x2321; 10770 t['integralex'] = 0xF8F5; 10771 t['integraltop'] = 0x2320; 10772 t['integraltp'] = 0x2320; 10773 t['intersection'] = 0x2229; 10774 t['intisquare'] = 0x3305; 10775 t['invbullet'] = 0x25D8; 10776 t['invcircle'] = 0x25D9; 10777 t['invsmileface'] = 0x263B; 10778 t['iocyrillic'] = 0x0451; 10779 t['iogonek'] = 0x012F; 10780 t['iota'] = 0x03B9; 10781 t['iotadieresis'] = 0x03CA;
10782 t['iotadieresistonos'] = 0x0390; 10783 t['iotalatin'] = 0x0269; 10784 t['iotatonos'] = 0x03AF; 10785 t['iparen'] = 0x24A4; 10786 t['irigurmukhi'] = 0x0A72; 10787 t['ismallhiragana'] = 0x3043; 10788 t['ismallkatakana'] = 0x30A3; 10789 t['ismallkatakanahalfwidth'] = 0xFF68; 10790 t['issharbengali'] = 0x09FA; 10791 t['istroke'] = 0x0268; 10792 t['isuperior'] = 0xF6ED; 10793 t['iterationhiragana'] = 0x309D; 10794 t['iterationkatakana'] = 0x30FD; 10795 t['itilde'] = 0x0129; 10796 t['itildebelow'] = 0x1E2D; 10797 t['iubopomofo'] = 0x3129; 10798 t['iucyrillic'] = 0x044E; 10799 t['ivowelsignbengali'] = 0x09BF; 10800 t['ivowelsigndeva'] = 0x093F; 10801 t['ivowelsigngujarati'] = 0x0ABF; 10802 t['izhitsacyrillic'] = 0x0475; 10803 t['izhitsadblgravecyrillic'] = 0x0477; 10804 t['j'] = 0x006A; 10805 t['jaarmenian'] = 0x0571; 10806 t['jabengali'] = 0x099C; 10807 t['jadeva'] = 0x091C; 10808 t['jagujarati'] = 0x0A9C; 10809 t['jagurmukhi'] = 0x0A1C; 10810 t['jbopomofo'] = 0x3110; 10811 t['jcaron'] = 0x01F0; 10812 t['jcircle'] = 0x24D9; 10813 t['jcircumflex'] = 0x0135; 10814 t['jcrossedtail'] = 0x029D; 10815 t['jdotlessstroke'] = 0x025F; 10816 t['jecyrillic'] = 0x0458; 10817 t['jeemarabic'] = 0x062C; 10818 t['jeemfinalarabic'] = 0xFE9E; 10819 t['jeeminitialarabic'] = 0xFE9F; 10820 t['jeemmedialarabic'] = 0xFEA0; 10821 t['jeharabic'] = 0x0698; 10822 t['jehfinalarabic'] = 0xFB8B; 10823 t['jhabengali'] = 0x099D; 10824 t['jhadeva'] = 0x091D; 10825 t['jhagujarati'] = 0x0A9D; 10826 t['jhagurmukhi'] = 0x0A1D; 10827 t['jheharmenian'] = 0x057B; 10828 t['jis'] = 0x3004; 10829 t['jmonospace'] = 0xFF4A; 10830 t['jparen'] = 0x24A5; 10831 t['jsuperior'] = 0x02B2; 10832 t['k'] = 0x006B; 10833 t['kabashkircyrillic'] = 0x04A1; 10834 t['kabengali'] = 0x0995; 10835 t['kacute'] = 0x1E31; 10836 t['kacyrillic'] = 0x043A; 10837 t['kadescendercyrillic'] = 0x049B; 10838 t['kadeva'] = 0x0915; 10839 t['kaf'] = 0x05DB; 10840 t['kafarabic'] = 0x0643; 10841 t['kafdagesh'] = 0xFB3B; 10842 t['kafdageshhebrew'] = 0xFB3B; 10843 t['kaffinalarabic'] = 0xFEDA; 10844 t['kafhebrew'] = 0x05DB; 10845 t['kafinitialarabic'] = 0xFEDB; 10846 t['kafmedialarabic'] = 0xFEDC; 10847 t['kafrafehebrew'] = 0xFB4D; 10848 t['kagujarati'] = 0x0A95; 10849 t['kagurmukhi'] = 0x0A15; 10850 t['kahiragana'] = 0x304B; 10851 t['kahookcyrillic'] = 0x04C4; 10852 t['kakatakana'] = 0x30AB; 10853 t['kakatakanahalfwidth'] = 0xFF76; 10854 t['kappa'] = 0x03BA; 10855 t['kappasymbolgreek'] = 0x03F0; 10856 t['kapyeounmieumkorean'] = 0x3171; 10857 t['kapyeounphieuphkorean'] = 0x3184; 10858 t['kapyeounpieupkorean'] = 0x3178; 10859 t['kapyeounssangpieupkorean'] = 0x3179; 10860 t['karoriisquare'] = 0x330D; 10861 t['kashidaautoarabic'] = 0x0640; 10862 t['kashidaautonosidebearingarabic'] = 0x0640; 10863 t['kasmallkatakana'] = 0x30F5; 10864 t['kasquare'] = 0x3384; 10865 t['kasraarabic'] = 0x0650; 10866 t['kasratanarabic'] = 0x064D; 10867 t['kastrokecyrillic'] = 0x049F; 10868 t['katahiraprolongmarkhalfwidth'] = 0xFF70; 10869 t['kaverticalstrokecyrillic'] = 0x049D; 10870 t['kbopomofo'] = 0x310E; 10871 t['kcalsquare'] = 0x3389; 10872 t['kcaron'] = 0x01E9; 10873 t['kcedilla'] = 0x0137; 10874 t['kcircle'] = 0x24DA; 10875 t['kcommaaccent'] = 0x0137; 10876 t['kdotbelow'] = 0x1E33; 10877 t['keharmenian'] = 0x0584; 10878 t['kehiragana'] = 0x3051; 10879 t['kekatakana'] = 0x30B1; 10880 t['kekatakanahalfwidth'] = 0xFF79; 10881 t['kenarmenian'] = 0x056F; 10882 t['kesmallkatakana'] = 0x30F6; 10883 t['kgreenlandic'] = 0x0138; 10884 t['khabengali'] = 0x0996; 10885 t['khacyrillic'] = 0x0445; 10886 t['khadeva'] = 0x0916; 10887 t['khagujarati'] = 0x0A96; 10888 t['khagurmukhi'] = 0x0A16; 10889 t['khaharabic'] = 0x062E; 10890 t['khahfinalarabic'] = 0xFEA6; 10891 t['khahinitialarabic'] = 0xFEA7; 10892 t['khahmedialarabic'] = 0xFEA8; 10893 t['kheicoptic'] = 0x03E7; 10894 t['khhadeva'] = 0x0959; 10895 t['khhagurmukhi'] = 0x0A59; 10896 t['khieukhacirclekorean'] = 0x3278; 10897 t['khieukhaparenkorean'] = 0x3218; 10898 t['khieukhcirclekorean'] = 0x326A; 10899 t['khieukhkorean'] = 0x314B; 10900 t['khieukhparenkorean'] = 0x320A; 10901 t['khokhaithai'] = 0x0E02; 10902 t['khokhonthai'] = 0x0E05; 10903 t['khokhuatthai'] = 0x0E03; 10904 t['khokhwaithai'] = 0x0E04; 10905 t['khomutthai'] = 0x0E5B; 10906 t['khook'] = 0x0199; 10907 t['khorakhangthai'] = 0x0E06; 10908 t['khzsquare'] = 0x3391; 10909 t['kihiragana'] = 0x304D; 10910 t['kikatakana'] = 0x30AD; 10911 t['kikatakanahalfwidth'] = 0xFF77; 10912 t['kiroguramusquare'] = 0x3315; 10913 t['kiromeetorusquare'] = 0x3316; 10914 t['kirosquare'] = 0x3314; 10915 t['kiyeokacirclekorean'] = 0x326E; 10916 t['kiyeokaparenkorean'] = 0x320E; 10917 t['kiyeokcirclekorean'] = 0x3260; 10918 t['kiyeokkorean'] = 0x3131; 10919 t['kiyeokparenkorean'] = 0x3200; 10920 t['kiyeoksioskorean'] = 0x3133; 10921 t['kjecyrillic'] = 0x045C; 10922 t['klinebelow'] = 0x1E35; 10923 t['klsquare'] = 0x3398; 10924 t['kmcubedsquare'] = 0x33A6; 10925 t['kmonospace'] = 0xFF4B; 10926 t['kmsquaredsquare'] = 0x33A2; 10927 t['kohiragana'] = 0x3053; 10928 t['kohmsquare'] = 0x33C0; 10929 t['kokaithai'] = 0x0E01; 10930 t['kokatakana'] = 0x30B3; 10931 t['kokatakanahalfwidth'] = 0xFF7A;
10932 t['kooposquare'] = 0x331E; 10933 t['koppacyrillic'] = 0x0481; 10934 t['koreanstandardsymbol'] = 0x327F; 10935 t['koroniscmb'] = 0x0343; 10936 t['kparen'] = 0x24A6; 10937 t['kpasquare'] = 0x33AA; 10938 t['ksicyrillic'] = 0x046F; 10939 t['ktsquare'] = 0x33CF; 10940 t['kturned'] = 0x029E; 10941 t['kuhiragana'] = 0x304F; 10942 t['kukatakana'] = 0x30AF; 10943 t['kukatakanahalfwidth'] = 0xFF78; 10944 t['kvsquare'] = 0x33B8; 10945 t['kwsquare'] = 0x33BE; 10946 t['l'] = 0x006C; 10947 t['labengali'] = 0x09B2; 10948 t['lacute'] = 0x013A; 10949 t['ladeva'] = 0x0932; 10950 t['lagujarati'] = 0x0AB2; 10951 t['lagurmukhi'] = 0x0A32; 10952 t['lakkhangyaothai'] = 0x0E45; 10953 t['lamaleffinalarabic'] = 0xFEFC; 10954 t['lamalefhamzaabovefinalarabic'] = 0xFEF8; 10955 t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7; 10956 t['lamalefhamzabelowfinalarabic'] = 0xFEFA; 10957 t['lamalefhamzabelowisolatedarabic'] = 0xFEF9; 10958 t['lamalefisolatedarabic'] = 0xFEFB; 10959 t['lamalefmaddaabovefinalarabic'] = 0xFEF6; 10960 t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5; 10961 t['lamarabic'] = 0x0644; 10962 t['lambda'] = 0x03BB; 10963 t['lambdastroke'] = 0x019B; 10964 t['lamed'] = 0x05DC; 10965 t['lameddagesh'] = 0xFB3C; 10966 t['lameddageshhebrew'] = 0xFB3C; 10967 t['lamedhebrew'] = 0x05DC; 10968 t['lamfinalarabic'] = 0xFEDE; 10969 t['lamhahinitialarabic'] = 0xFCCA; 10970 t['laminitialarabic'] = 0xFEDF; 10971 t['lamjeeminitialarabic'] = 0xFCC9; 10972 t['lamkhahinitialarabic'] = 0xFCCB; 10973 t['lamlamhehisolatedarabic'] = 0xFDF2; 10974 t['lammedialarabic'] = 0xFEE0; 10975 t['lammeemhahinitialarabic'] = 0xFD88; 10976 t['lammeeminitialarabic'] = 0xFCCC; 10977 t['largecircle'] = 0x25EF; 10978 t['lbar'] = 0x019A; 10979 t['lbelt'] = 0x026C; 10980 t['lbopomofo'] = 0x310C; 10981 t['lcaron'] = 0x013E; 10982 t['lcedilla'] = 0x013C; 10983 t['lcircle'] = 0x24DB; 10984 t['lcircumflexbelow'] = 0x1E3D; 10985 t['lcommaaccent'] = 0x013C; 10986 t['ldot'] = 0x0140; 10987 t['ldotaccent'] = 0x0140; 10988 t['ldotbelow'] = 0x1E37; 10989 t['ldotbelowmacron'] = 0x1E39; 10990 t['leftangleabovecmb'] = 0x031A; 10991 t['lefttackbelowcmb'] = 0x0318; 10992 t['less'] = 0x003C; 10993 t['lessequal'] = 0x2264; 10994 t['lessequalorgreater'] = 0x22DA; 10995 t['lessmonospace'] = 0xFF1C; 10996 t['lessorequivalent'] = 0x2272; 10997 t['lessorgreater'] = 0x2276; 10998 t['lessoverequal'] = 0x2266; 10999 t['lesssmall'] = 0xFE64; 11000 t['lezh'] = 0x026E; 11001 t['lfblock'] = 0x258C; 11002 t['lhookretroflex'] = 0x026D; 11003 t['lira'] = 0x20A4; 11004 t['liwnarmenian'] = 0x056C; 11005 t['lj'] = 0x01C9; 11006 t['ljecyrillic'] = 0x0459; 11007 t['ll'] = 0xF6C0; 11008 t['lladeva'] = 0x0933; 11009 t['llagujarati'] = 0x0AB3; 11010 t['llinebelow'] = 0x1E3B; 11011 t['llladeva'] = 0x0934; 11012 t['llvocalicbengali'] = 0x09E1; 11013 t['llvocalicdeva'] = 0x0961; 11014 t['llvocalicvowelsignbengali'] = 0x09E3; 11015 t['llvocalicvowelsigndeva'] = 0x0963; 11016 t['lmiddletilde'] = 0x026B; 11017 t['lmonospace'] = 0xFF4C; 11018 t['lmsquare'] = 0x33D0; 11019 t['lochulathai'] = 0x0E2C; 11020 t['logicaland'] = 0x2227; 11021 t['logicalnot'] = 0x00AC; 11022 t['logicalnotreversed'] = 0x2310; 11023 t['logicalor'] = 0x2228; 11024 t['lolingthai'] = 0x0E25; 11025 t['longs'] = 0x017F; 11026 t['lowlinecenterline'] = 0xFE4E; 11027 t['lowlinecmb'] = 0x0332; 11028 t['lowlinedashed'] = 0xFE4D; 11029 t['lozenge'] = 0x25CA; 11030 t['lparen'] = 0x24A7; 11031 t['lslash'] = 0x0142; 11032 t['lsquare'] = 0x2113; 11033 t['lsuperior'] = 0xF6EE; 11034 t['ltshade'] = 0x2591; 11035 t['luthai'] = 0x0E26; 11036 t['lvocalicbengali'] = 0x098C; 11037 t['lvocalicdeva'] = 0x090C; 11038 t['lvocalicvowelsignbengali'] = 0x09E2; 11039 t['lvocalicvowelsigndeva'] = 0x0962; 11040 t['lxsquare'] = 0x33D3; 11041 t['m'] = 0x006D; 11042 t['mabengali'] = 0x09AE; 11043 t['macron'] = 0x00AF; 11044 t['macronbelowcmb'] = 0x0331; 11045 t['macroncmb'] = 0x0304; 11046 t['macronlowmod'] = 0x02CD; 11047 t['macronmonospace'] = 0xFFE3; 11048 t['macute'] = 0x1E3F; 11049 t['madeva'] = 0x092E; 11050 t['magujarati'] = 0x0AAE; 11051 t['magurmukhi'] = 0x0A2E; 11052 t['mahapakhhebrew'] = 0x05A4; 11053 t['mahapakhlefthebrew'] = 0x05A4; 11054 t['mahiragana'] = 0x307E; 11055 t['maichattawalowleftthai'] = 0xF895; 11056 t['maichattawalowrightthai'] = 0xF894; 11057 t['maichattawathai'] = 0x0E4B;
11058 t['maichattawaupperleftthai'] = 0xF893; 11059 t['maieklowleftthai'] = 0xF88C; 11060 t['maieklowrightthai'] = 0xF88B; 11061 t['maiekthai'] = 0x0E48; 11062 t['maiekupperleftthai'] = 0xF88A; 11063 t['maihanakatleftthai'] = 0xF884; 11064 t['maihanakatthai'] = 0x0E31; 11065 t['maitaikhuleftthai'] = 0xF889; 11066 t['maitaikhuthai'] = 0x0E47; 11067 t['maitholowleftthai'] = 0xF88F; 11068 t['maitholowrightthai'] = 0xF88E; 11069 t['maithothai'] = 0x0E49; 11070 t['maithoupperleftthai'] = 0xF88D; 11071 t['maitrilowleftthai'] = 0xF892; 11072 t['maitrilowrightthai'] = 0xF891; 11073 t['maitrithai'] = 0x0E4A; 11074 t['maitriupperleftthai'] = 0xF890; 11075 t['maiyamokthai'] = 0x0E46; 11076 t['makatakana'] = 0x30DE; 11077 t['makatakanahalfwidth'] = 0xFF8F; 11078 t['male'] = 0x2642; 11079 t['mansyonsquare'] = 0x3347; 11080 t['maqafhebrew'] = 0x05BE; 11081 t['mars'] = 0x2642; 11082 t['masoracirclehebrew'] = 0x05AF; 11083 t['masquare'] = 0x3383; 11084 t['mbopomofo'] = 0x3107; 11085 t['mbsquare'] = 0x33D4; 11086 t['mcircle'] = 0x24DC; 11087 t['mcubedsquare'] = 0x33A5; 11088 t['mdotaccent'] = 0x1E41; 11089 t['mdotbelow'] = 0x1E43; 11090 t['meemarabic'] = 0x0645; 11091 t['meemfinalarabic'] = 0xFEE2; 11092 t['meeminitialarabic'] = 0xFEE3; 11093 t['meemmedialarabic'] = 0xFEE4; 11094 t['meemmeeminitialarabic'] = 0xFCD1; 11095 t['meemmeemisolatedarabic'] = 0xFC48; 11096 t['meetorusquare'] = 0x334D; 11097 t['mehiragana'] = 0x3081; 11098 t['meizierasquare'] = 0x337E; 11099 t['mekatakana'] = 0x30E1; 11100 t['mekatakanahalfwidth'] = 0xFF92; 11101 t['mem'] = 0x05DE; 11102 t['memdagesh'] = 0xFB3E; 11103 t['memdageshhebrew'] = 0xFB3E; 11104 t['memhebrew'] = 0x05DE; 11105 t['menarmenian'] = 0x0574; 11106 t['merkhahebrew'] = 0x05A5; 11107 t['merkhakefulahebrew'] = 0x05A6; 11108 t['merkhakefulalefthebrew'] = 0x05A6; 11109 t['merkhalefthebrew'] = 0x05A5; 11110 t['mhook'] = 0x0271; 11111 t['mhzsquare'] = 0x3392; 11112 t['middledotkatakanahalfwidth'] = 0xFF65; 11113 t['middot'] = 0x00B7; 11114 t['mieumacirclekorean'] = 0x3272; 11115 t['mieumaparenkorean'] = 0x3212; 11116 t['mieumcirclekorean'] = 0x3264; 11117 t['mieumkorean'] = 0x3141; 11118 t['mieumpansioskorean'] = 0x3170; 11119 t['mieumparenkorean'] = 0x3204; 11120 t['mieumpieupkorean'] = 0x316E; 11121 t['mieumsioskorean'] = 0x316F; 11122 t['mihiragana'] = 0x307F; 11123 t['mikatakana'] = 0x30DF; 11124 t['mikatakanahalfwidth'] = 0xFF90; 11125 t['minus'] = 0x2212; 11126 t['minusbelowcmb'] = 0x0320; 11127 t['minuscircle'] = 0x2296; 11128 t['minusmod'] = 0x02D7; 11129 t['minusplus'] = 0x2213; 11130 t['minute'] = 0x2032; 11131 t['miribaarusquare'] = 0x334A; 11132 t['mirisquare'] = 0x3349; 11133 t['mlonglegturned'] = 0x0270; 11134 t['mlsquare'] = 0x3396; 11135 t['mmcubedsquare'] = 0x33A3; 11136 t['mmonospace'] = 0xFF4D; 11137 t['mmsquaredsquare'] = 0x339F; 11138 t['mohiragana'] = 0x3082; 11139 t['mohmsquare'] = 0x33C1; 11140 t['mokatakana'] = 0x30E2; 11141 t['mokatakanahalfwidth'] = 0xFF93; 11142 t['molsquare'] = 0x33D6; 11143 t['momathai'] = 0x0E21; 11144 t['moverssquare'] = 0x33A7; 11145 t['moverssquaredsquare'] = 0x33A8; 11146 t['mparen'] = 0x24A8; 11147 t['mpasquare'] = 0x33AB; 11148 t['mssquare'] = 0x33B3; 11149 t['msuperior'] = 0xF6EF; 11150 t['mturned'] = 0x026F; 11151 t['mu'] = 0x00B5; 11152 t['mu1'] = 0x00B5; 11153 t['muasquare'] = 0x3382; 11154 t['muchgreater'] = 0x226B; 11155 t['muchless'] = 0x226A; 11156 t['mufsquare'] = 0x338C; 11157 t['mugreek'] = 0x03BC; 11158 t['mugsquare'] = 0x338D; 11159 t['muhiragana'] = 0x3080; 11160 t['mukatakana'] = 0x30E0; 11161 t['mukatakanahalfwidth'] = 0xFF91; 11162 t['mulsquare'] = 0x3395; 11163 t['multiply'] = 0x00D7; 11164 t['mumsquare'] = 0x339B; 11165 t['munahhebrew'] = 0x05A3; 11166 t['munahlefthebrew'] = 0x05A3; 11167 t['musicalnote'] = 0x266A; 11168 t['musicalnotedbl'] = 0x266B; 11169 t['musicflatsign'] = 0x266D; 11170 t['musicsharpsign'] = 0x266F; 11171 t['mussquare'] = 0x33B2; 11172 t['muvsquare'] = 0x33B6; 11173 t['muwsquare'] = 0x33BC; 11174 t['mvmegasquare'] = 0x33B9; 11175 t['mvsquare'] = 0x33B7; 11176 t['mwmegasquare'] = 0x33BF; 11177 t['mwsquare'] = 0x33BD; 11178 t['n'] = 0x006E; 11179 t['nabengali'] = 0x09A8; 11180 t['nabla'] = 0x2207; 11181 t['nacute'] = 0x0144; 11182 t['nadeva'] = 0x0928; 11183 t['nagujarati'] = 0x0AA8; 11184 t['nagurmukhi'] = 0x0A28; 11185 t['nahiragana'] = 0x306A; 11186 t['nakatakana'] = 0x30CA; 11187 t['nakatakanahalfwidth'] = 0xFF85; 11188 t['napostrophe'] = 0x0149; 11189 t['nasquare'] = 0x3381; 11190 t['nbopomofo'] = 0x310B; 11191 t['nbspace'] = 0x00A0; 11192 t['ncaron'] = 0x0148; 11193 t['ncedilla'] = 0x0146; 11194 t['ncircle'] = 0x24DD; 11195 t['ncircumflexbelow'] = 0x1E4B; 11196 t['ncommaaccent'] = 0x0146; 11197 t['ndotaccent'] = 0x1E45; 11198 t['ndotbelow'] = 0x1E47; 11199 t['nehiragana'] = 0x306D; 11200 t['nekatakana'] = 0x30CD; 11201 t['nekatakanahalfwidth'] = 0xFF88; 11202 t['newsheqelsign'] = 0x20AA; 11203 t['nfsquare'] = 0x338B; 11204 t['ngabengali'] = 0x0999; 11205 t['ngadeva'] = 0x0919; 11206 t['ngagujarati'] = 0x0A99; 11207 t['ngagurmukhi'] = 0x0A19; 11208 t['ngonguthai'] = 0x0E07; 11209 t['nhiragana'] = 0x3093; 11210 t['nhookleft'] = 0x0272; 11211 t['nhookretroflex'] = 0x0273; 11212 t['nieunacirclekorean'] = 0x326F; 11213 t['nieunaparenkorean'] = 0x320F; 11214 t['nieuncieuckorean'] = 0x3135; 11215 t['nieuncirclekorean'] = 0x3261; 11216 t['nieunhieuhkorean'] = 0x3136; 11217 t['nieunkorean'] = 0x3134;
11218 t['nieunpansioskorean'] = 0x3168; 11219 t['nieunparenkorean'] = 0x3201; 11220 t['nieunsioskorean'] = 0x3167; 11221 t['nieuntikeutkorean'] = 0x3166; 11222 t['nihiragana'] = 0x306B; 11223 t['nikatakana'] = 0x30CB; 11224 t['nikatakanahalfwidth'] = 0xFF86; 11225 t['nikhahitleftthai'] = 0xF899; 11226 t['nikhahitthai'] = 0x0E4D; 11227 t['nine'] = 0x0039; 11228 t['ninearabic'] = 0x0669; 11229 t['ninebengali'] = 0x09EF; 11230 t['ninecircle'] = 0x2468; 11231 t['ninecircleinversesansserif'] = 0x2792; 11232 t['ninedeva'] = 0x096F; 11233 t['ninegujarati'] = 0x0AEF; 11234 t['ninegurmukhi'] = 0x0A6F; 11235 t['ninehackarabic'] = 0x0669; 11236 t['ninehangzhou'] = 0x3029; 11237 t['nineideographicparen'] = 0x3228; 11238 t['nineinferior'] = 0x2089; 11239 t['ninemonospace'] = 0xFF19; 11240 t['nineoldstyle'] = 0xF739; 11241 t['nineparen'] = 0x247C; 11242 t['nineperiod'] = 0x2490; 11243 t['ninepersian'] = 0x06F9; 11244 t['nineroman'] = 0x2178; 11245 t['ninesuperior'] = 0x2079; 11246 t['nineteencircle'] = 0x2472; 11247 t['nineteenparen'] = 0x2486; 11248 t['nineteenperiod'] = 0x249A; 11249 t['ninethai'] = 0x0E59; 11250 t['nj'] = 0x01CC; 11251 t['njecyrillic'] = 0x045A; 11252 t['nkatakana'] = 0x30F3; 11253 t['nkatakanahalfwidth'] = 0xFF9D; 11254 t['nlegrightlong'] = 0x019E; 11255 t['nlinebelow'] = 0x1E49; 11256 t['nmonospace'] = 0xFF4E; 11257 t['nmsquare'] = 0x339A; 11258 t['nnabengali'] = 0x09A3; 11259 t['nnadeva'] = 0x0923; 11260 t['nnagujarati'] = 0x0AA3; 11261 t['nnagurmukhi'] = 0x0A23; 11262 t['nnnadeva'] = 0x0929; 11263 t['nohiragana'] = 0x306E; 11264 t['nokatakana'] = 0x30CE; 11265 t['nokatakanahalfwidth'] = 0xFF89; 11266 t['nonbreakingspace'] = 0x00A0; 11267 t['nonenthai'] = 0x0E13; 11268 t['nonuthai'] = 0x0E19; 11269 t['noonarabic'] = 0x0646; 11270 t['noonfinalarabic'] = 0xFEE6; 11271 t['noonghunnaarabic'] = 0x06BA; 11272 t['noonghunnafinalarabic'] = 0xFB9F; 11273 t['nooninitialarabic'] = 0xFEE7; 11274 t['noonjeeminitialarabic'] = 0xFCD2; 11275 t['noonjeemisolatedarabic'] = 0xFC4B; 11276 t['noonmedialarabic'] = 0xFEE8; 11277 t['noonmeeminitialarabic'] = 0xFCD5; 11278 t['noonmeemisolatedarabic'] = 0xFC4E; 11279 t['noonnoonfinalarabic'] = 0xFC8D; 11280 t['notcontains'] = 0x220C; 11281 t['notelement'] = 0x2209; 11282 t['notelementof'] = 0x2209; 11283 t['notequal'] = 0x2260; 11284 t['notgreater'] = 0x226F; 11285 t['notgreaternorequal'] = 0x2271; 11286 t['notgreaternorless'] = 0x2279; 11287 t['notidentical'] = 0x2262; 11288 t['notless'] = 0x226E; 11289 t['notlessnorequal'] = 0x2270; 11290 t['notparallel'] = 0x2226; 11291 t['notprecedes'] = 0x2280; 11292 t['notsubset'] = 0x2284; 11293 t['notsucceeds'] = 0x2281; 11294 t['notsuperset'] = 0x2285; 11295 t['nowarmenian'] = 0x0576; 11296 t['nparen'] = 0x24A9; 11297 t['nssquare'] = 0x33B1; 11298 t['nsuperior'] = 0x207F; 11299 t['ntilde'] = 0x00F1; 11300 t['nu'] = 0x03BD; 11301 t['nuhiragana'] = 0x306C; 11302 t['nukatakana'] = 0x30CC; 11303 t['nukatakanahalfwidth'] = 0xFF87; 11304 t['nuktabengali'] = 0x09BC; 11305 t['nuktadeva'] = 0x093C; 11306 t['nuktagujarati'] = 0x0ABC; 11307 t['nuktagurmukhi'] = 0x0A3C; 11308 t['numbersign'] = 0x0023; 11309 t['numbersignmonospace'] = 0xFF03; 11310 t['numbersignsmall'] = 0xFE5F; 11311 t['numeralsigngreek'] = 0x0374; 11312 t['numeralsignlowergreek'] = 0x0375; 11313 t['numero'] = 0x2116; 11314 t['nun'] = 0x05E0; 11315 t['nundagesh'] = 0xFB40; 11316 t['nundageshhebrew'] = 0xFB40; 11317 t['nunhebrew'] = 0x05E0; 11318 t['nvsquare'] = 0x33B5; 11319 t['nwsquare'] = 0x33BB; 11320 t['nyabengali'] = 0x099E; 11321 t['nyadeva'] = 0x091E; 11322 t['nyagujarati'] = 0x0A9E; 11323 t['nyagurmukhi'] = 0x0A1E; 11324 t['o'] = 0x006F; 11325 t['oacute'] = 0x00F3; 11326 t['oangthai'] = 0x0E2D; 11327 t['obarred'] = 0x0275; 11328 t['obarredcyrillic'] = 0x04E9; 11329 t['obarreddieresiscyrillic'] = 0x04EB; 11330 t['obengali'] = 0x0993; 11331 t['obopomofo'] = 0x311B; 11332 t['obreve'] = 0x014F; 11333 t['ocandradeva'] = 0x0911; 11334 t['ocandragujarati'] = 0x0A91; 11335 t['ocandravowelsigndeva'] = 0x0949; 11336 t['ocandravowelsigngujarati'] = 0x0AC9; 11337 t['ocaron'] = 0x01D2; 11338 t['ocircle'] = 0x24DE; 11339 t['ocircumflex'] = 0x00F4; 11340 t['ocircumflexacute'] = 0x1ED1; 11341 t['ocircumflexdotbelow'] = 0x1ED9; 11342 t['ocircumflexgrave'] = 0x1ED3; 11343 t['ocircumflexhookabove'] = 0x1ED5; 11344 t['ocircumflextilde'] = 0x1ED7; 11345 t['ocyrillic'] = 0x043E; 11346 t['odblacute'] = 0x0151; 11347 t['odblgrave'] = 0x020D; 11348 t['odeva'] = 0x0913; 11349 t['odieresis'] = 0x00F6; 11350 t['odieresiscyrillic'] = 0x04E7; 11351 t['odotbelow'] = 0x1ECD; 11352 t['oe'] = 0x0153; 11353 t['oekorean'] = 0x315A; 11354 t['ogonek'] = 0x02DB; 11355 t['ogonekcmb'] = 0x0328; 11356 t['ograve'] = 0x00F2; 11357 t['ogujarati'] = 0x0A93; 11358 t['oharmenian'] = 0x0585; 11359 t['ohiragana'] = 0x304A; 11360 t['ohookabove'] = 0x1ECF; 11361 t['ohorn'] = 0x01A1; 11362 t['ohornacute'] = 0x1EDB; 11363 t['ohorndotbelow'] = 0x1EE3; 11364 t['ohorngrave'] = 0x1EDD; 11365 t['ohornhookabove'] = 0x1EDF; 11366 t['ohorntilde'] = 0x1EE1; 11367 t['ohungarumlaut'] = 0x0151; 11368 t['oi'] = 0x01A3; 11369 t['oinvertedbreve'] = 0x020F; 11370 t['okatakana'] = 0x30AA; 11371 t['okatakanahalfwidth'] = 0xFF75; 11372 t['okorean'] = 0x3157; 11373 t['olehebrew'] = 0x05AB; 11374 t['omacron'] = 0x014D; 11375 t['omacronacute'] = 0x1E53; 11376 t['omacrongrave'] = 0x1E51; 11377 t['omdeva'] = 0x0950; 11378 t['omega'] = 0x03C9; 11379 t['omega1'] = 0x03D6; 11380 t['omegacyrillic'] = 0x0461; 11381 t['omegalatinclosed'] = 0x0277; 11382 t['omegaroundcyrillic'] = 0x047B; 11383 t['omegatitlocyrillic'] = 0x047D;
11384 t['omegatonos'] = 0x03CE; 11385 t['omgujarati'] = 0x0AD0; 11386 t['omicron'] = 0x03BF; 11387 t['omicrontonos'] = 0x03CC; 11388 t['omonospace'] = 0xFF4F; 11389 t['one'] = 0x0031; 11390 t['onearabic'] = 0x0661; 11391 t['onebengali'] = 0x09E7; 11392 t['onecircle'] = 0x2460; 11393 t['onecircleinversesansserif'] = 0x278A; 11394 t['onedeva'] = 0x0967; 11395 t['onedotenleader'] = 0x2024; 11396 t['oneeighth'] = 0x215B; 11397 t['onefitted'] = 0xF6DC; 11398 t['onegujarati'] = 0x0AE7; 11399 t['onegurmukhi'] = 0x0A67; 11400 t['onehackarabic'] = 0x0661; 11401 t['onehalf'] = 0x00BD; 11402 t['onehangzhou'] = 0x3021; 11403 t['oneideographicparen'] = 0x3220; 11404 t['oneinferior'] = 0x2081; 11405 t['onemonospace'] = 0xFF11; 11406 t['onenumeratorbengali'] = 0x09F4; 11407 t['oneoldstyle'] = 0xF731; 11408 t['oneparen'] = 0x2474; 11409 t['oneperiod'] = 0x2488; 11410 t['onepersian'] = 0x06F1; 11411 t['onequarter'] = 0x00BC; 11412 t['oneroman'] = 0x2170; 11413 t['onesuperior'] = 0x00B9; 11414 t['onethai'] = 0x0E51; 11415 t['onethird'] = 0x2153; 11416 t['oogonek'] = 0x01EB; 11417 t['oogonekmacron'] = 0x01ED; 11418 t['oogurmukhi'] = 0x0A13; 11419 t['oomatragurmukhi'] = 0x0A4B; 11420 t['oopen'] = 0x0254; 11421 t['oparen'] = 0x24AA; 11422 t['openbullet'] = 0x25E6; 11423 t['option'] = 0x2325; 11424 t['ordfeminine'] = 0x00AA; 11425 t['ordmasculine'] = 0x00BA; 11426 t['orthogonal'] = 0x221F; 11427 t['oshortdeva'] = 0x0912; 11428 t['oshortvowelsigndeva'] = 0x094A; 11429 t['oslash'] = 0x00F8; 11430 t['oslashacute'] = 0x01FF; 11431 t['osmallhiragana'] = 0x3049; 11432 t['osmallkatakana'] = 0x30A9; 11433 t['osmallkatakanahalfwidth'] = 0xFF6B; 11434 t['ostrokeacute'] = 0x01FF; 11435 t['osuperior'] = 0xF6F0; 11436 t['otcyrillic'] = 0x047F; 11437 t['otilde'] = 0x00F5; 11438 t['otildeacute'] = 0x1E4D; 11439 t['otildedieresis'] = 0x1E4F; 11440 t['oubopomofo'] = 0x3121; 11441 t['overline'] = 0x203E; 11442 t['overlinecenterline'] = 0xFE4A; 11443 t['overlinecmb'] = 0x0305; 11444 t['overlinedashed'] = 0xFE49; 11445 t['overlinedblwavy'] = 0xFE4C; 11446 t['overlinewavy'] = 0xFE4B; 11447 t['overscore'] = 0x00AF; 11448 t['ovowelsignbengali'] = 0x09CB; 11449 t['ovowelsigndeva'] = 0x094B; 11450 t['ovowelsigngujarati'] = 0x0ACB; 11451 t['p'] = 0x0070; 11452 t['paampssquare'] = 0x3380; 11453 t['paasentosquare'] = 0x332B; 11454 t['pabengali'] = 0x09AA; 11455 t['pacute'] = 0x1E55; 11456 t['padeva'] = 0x092A; 11457 t['pagedown'] = 0x21DF; 11458 t['pageup'] = 0x21DE; 11459 t['pagujarati'] = 0x0AAA; 11460 t['pagurmukhi'] = 0x0A2A; 11461 t['pahiragana'] = 0x3071; 11462 t['paiyannoithai'] = 0x0E2F; 11463 t['pakatakana'] = 0x30D1; 11464 t['palatalizationcyrilliccmb'] = 0x0484; 11465 t['palochkacyrillic'] = 0x04C0; 11466 t['pansioskorean'] = 0x317F; 11467 t['paragraph'] = 0x00B6; 11468 t['parallel'] = 0x2225; 11469 t['parenleft'] = 0x0028; 11470 t['parenleftaltonearabic'] = 0xFD3E; 11471 t['parenleftbt'] = 0xF8ED; 11472 t['parenleftex'] = 0xF8EC; 11473 t['parenleftinferior'] = 0x208D; 11474 t['parenleftmonospace'] = 0xFF08; 11475 t['parenleftsmall'] = 0xFE59; 11476 t['parenleftsuperior'] = 0x207D; 11477 t['parenlefttp'] = 0xF8EB; 11478 t['parenleftvertical'] = 0xFE35; 11479 t['parenright'] = 0x0029; 11480 t['parenrightaltonearabic'] = 0xFD3F; 11481 t['parenrightbt'] = 0xF8F8; 11482 t['parenrightex'] = 0xF8F7; 11483 t['parenrightinferior'] = 0x208E; 11484 t['parenrightmonospace'] = 0xFF09; 11485 t['parenrightsmall'] = 0xFE5A; 11486 t['parenrightsuperior'] = 0x207E; 11487 t['parenrighttp'] = 0xF8F6; 11488 t['parenrightvertical'] = 0xFE36; 11489 t['partialdiff'] = 0x2202; 11490 t['paseqhebrew'] = 0x05C0; 11491 t['pashtahebrew'] = 0x0599; 11492 t['pasquare'] = 0x33A9; 11493 t['patah'] = 0x05B7; 11494 t['patah11'] = 0x05B7; 11495 t['patah1d'] = 0x05B7; 11496 t['patah2a'] = 0x05B7; 11497 t['patahhebrew'] = 0x05B7; 11498 t['patahnarrowhebrew'] = 0x05B7; 11499 t['patahquarterhebrew'] = 0x05B7; 11500 t['patahwidehebrew'] = 0x05B7; 11501 t['pazerhebrew'] = 0x05A1; 11502 t['pbopomofo'] = 0x3106; 11503 t['pcircle'] = 0x24DF; 11504 t['pdotaccent'] = 0x1E57; 11505 t['pe'] = 0x05E4; 11506 t['pecyrillic'] = 0x043F; 11507 t['pedagesh'] = 0xFB44; 11508 t['pedageshhebrew'] = 0xFB44; 11509 t['peezisquare'] = 0x333B; 11510 t['pefinaldageshhebrew'] = 0xFB43; 11511 t['peharabic'] = 0x067E; 11512 t['peharmenian'] = 0x057A; 11513 t['pehebrew'] = 0x05E4; 11514 t['pehfinalarabic'] = 0xFB57; 11515 t['pehinitialarabic'] = 0xFB58; 11516 t['pehiragana'] = 0x307A; 11517 t['pehmedialarabic'] = 0xFB59; 11518 t['pekatakana'] = 0x30DA; 11519 t['pemiddlehookcyrillic'] = 0x04A7; 11520 t['perafehebrew'] = 0xFB4E; 11521 t['percent'] = 0x0025; 11522 t['percentarabic'] = 0x066A; 11523 t['percentmonospace'] = 0xFF05; 11524 t['percentsmall'] = 0xFE6A; 11525 t['period'] = 0x002E; 11526 t['periodarmenian'] = 0x0589;
11527 t['periodcentered'] = 0x00B7; 11528 t['periodhalfwidth'] = 0xFF61; 11529 t['periodinferior'] = 0xF6E7; 11530 t['periodmonospace'] = 0xFF0E; 11531 t['periodsmall'] = 0xFE52; 11532 t['periodsuperior'] = 0xF6E8; 11533 t['perispomenigreekcmb'] = 0x0342; 11534 t['perpendicular'] = 0x22A5; 11535 t['perthousand'] = 0x2030; 11536 t['peseta'] = 0x20A7; 11537 t['pfsquare'] = 0x338A; 11538 t['phabengali'] = 0x09AB; 11539 t['phadeva'] = 0x092B; 11540 t['phagujarati'] = 0x0AAB; 11541 t['phagurmukhi'] = 0x0A2B; 11542 t['phi'] = 0x03C6; 11543 t['phi1'] = 0x03D5; 11544 t['phieuphacirclekorean'] = 0x327A; 11545 t['phieuphaparenkorean'] = 0x321A; 11546 t['phieuphcirclekorean'] = 0x326C; 11547 t['phieuphkorean'] = 0x314D; 11548 t['phieuphparenkorean'] = 0x320C; 11549 t['philatin'] = 0x0278; 11550 t['phinthuthai'] = 0x0E3A; 11551 t['phisymbolgreek'] = 0x03D5; 11552 t['phook'] = 0x01A5; 11553 t['phophanthai'] = 0x0E1E; 11554 t['phophungthai'] = 0x0E1C; 11555 t['phosamphaothai'] = 0x0E20; 11556 t['pi'] = 0x03C0; 11557 t['pieupacirclekorean'] = 0x3273; 11558 t['pieupaparenkorean'] = 0x3213; 11559 t['pieupcieuckorean'] = 0x3176; 11560 t['pieupcirclekorean'] = 0x3265; 11561 t['pieupkiyeokkorean'] = 0x3172; 11562 t['pieupkorean'] = 0x3142; 11563 t['pieupparenkorean'] = 0x3205; 11564 t['pieupsioskiyeokkorean'] = 0x3174; 11565 t['pieupsioskorean'] = 0x3144; 11566 t['pieupsiostikeutkorean'] = 0x3175; 11567 t['pieupthieuthkorean'] = 0x3177; 11568 t['pieuptikeutkorean'] = 0x3173; 11569 t['pihiragana'] = 0x3074; 11570 t['pikatakana'] = 0x30D4; 11571 t['pisymbolgreek'] = 0x03D6; 11572 t['piwrarmenian'] = 0x0583; 11573 t['plus'] = 0x002B; 11574 t['plusbelowcmb'] = 0x031F; 11575 t['pluscircle'] = 0x2295; 11576 t['plusminus'] = 0x00B1; 11577 t['plusmod'] = 0x02D6; 11578 t['plusmonospace'] = 0xFF0B; 11579 t['plussmall'] = 0xFE62; 11580 t['plussuperior'] = 0x207A; 11581 t['pmonospace'] = 0xFF50; 11582 t['pmsquare'] = 0x33D8; 11583 t['pohiragana'] = 0x307D; 11584 t['pointingindexdownwhite'] = 0x261F; 11585 t['pointingindexleftwhite'] = 0x261C; 11586 t['pointingindexrightwhite'] = 0x261E; 11587 t['pointingindexupwhite'] = 0x261D; 11588 t['pokatakana'] = 0x30DD; 11589 t['poplathai'] = 0x0E1B; 11590 t['postalmark'] = 0x3012; 11591 t['postalmarkface'] = 0x3020; 11592 t['pparen'] = 0x24AB; 11593 t['precedes'] = 0x227A; 11594 t['prescription'] = 0x211E; 11595 t['primemod'] = 0x02B9; 11596 t['primereversed'] = 0x2035; 11597 t['product'] = 0x220F; 11598 t['projective'] = 0x2305; 11599 t['prolongedkana'] = 0x30FC; 11600 t['propellor'] = 0x2318; 11601 t['propersubset'] = 0x2282; 11602 t['propersuperset'] = 0x2283; 11603 t['proportion'] = 0x2237; 11604 t['proportional'] = 0x221D; 11605 t['psi'] = 0x03C8; 11606 t['psicyrillic'] = 0x0471; 11607 t['psilipneumatacyrilliccmb'] = 0x0486; 11608 t['pssquare'] = 0x33B0; 11609 t['puhiragana'] = 0x3077; 11610 t['pukatakana'] = 0x30D7; 11611 t['pvsquare'] = 0x33B4; 11612 t['pwsquare'] = 0x33BA; 11613 t['q'] = 0x0071; 11614 t['qadeva'] = 0x0958; 11615 t['qadmahebrew'] = 0x05A8; 11616 t['qafarabic'] = 0x0642; 11617 t['qaffinalarabic'] = 0xFED6; 11618 t['qafinitialarabic'] = 0xFED7; 11619 t['qafmedialarabic'] = 0xFED8; 11620 t['qamats'] = 0x05B8; 11621 t['qamats10'] = 0x05B8; 11622 t['qamats1a'] = 0x05B8; 11623 t['qamats1c'] = 0x05B8; 11624 t['qamats27'] = 0x05B8; 11625 t['qamats29'] = 0x05B8; 11626 t['qamats33'] = 0x05B8; 11627 t['qamatsde'] = 0x05B8; 11628 t['qamatshebrew'] = 0x05B8; 11629 t['qamatsnarrowhebrew'] = 0x05B8; 11630 t['qamatsqatanhebrew'] = 0x05B8; 11631 t['qamatsqatannarrowhebrew'] = 0x05B8; 11632 t['qamatsqatanquarterhebrew'] = 0x05B8; 11633 t['qamatsqatanwidehebrew'] = 0x05B8; 11634 t['qamatsquarterhebrew'] = 0x05B8; 11635 t['qamatswidehebrew'] = 0x05B8; 11636 t['qarneyparahebrew'] = 0x059F; 11637 t['qbopomofo'] = 0x3111; 11638 t['qcircle'] = 0x24E0; 11639 t['qhook'] = 0x02A0; 11640 t['qmonospace'] = 0xFF51; 11641 t['qof'] = 0x05E7; 11642 t['qofdagesh'] = 0xFB47; 11643 t['qofdageshhebrew'] = 0xFB47; 11644 t['qofhebrew'] = 0x05E7; 11645 t['qparen'] = 0x24AC; 11646 t['quarternote'] = 0x2669; 11647 t['qubuts'] = 0x05BB; 11648 t['qubuts18'] = 0x05BB; 11649 t['qubuts25'] = 0x05BB; 11650 t['qubuts31'] = 0x05BB; 11651 t['qubutshebrew'] = 0x05BB; 11652 t['qubutsnarrowhebrew'] = 0x05BB; 11653 t['qubutsquarterhebrew'] = 0x05BB; 11654 t['qubutswidehebrew'] = 0x05BB; 11655 t['question'] = 0x003F; 11656 t['questionarabic'] = 0x061F; 11657 t['questionarmenian'] = 0x055E; 11658 t['questiondown'] = 0x00BF; 11659 t['questiondownsmall'] = 0xF7BF; 11660 t['questiongreek'] = 0x037E; 11661 t['questionmonospace'] = 0xFF1F; 11662 t['questionsmall'] = 0xF73F; 11663 t['quotedbl'] = 0x0022; 11664 t['quotedblbase'] = 0x201E; 11665 t['quotedblleft'] = 0x201C; 11666 t['quotedblmonospace'] = 0xFF02; 11667 t['quotedblprime'] = 0x301E; 11668 t['quotedblprimereversed'] = 0x301D; 11669 t['quotedblright'] = 0x201D; 11670 t['quoteleft'] = 0x2018; 11671 t['quoteleftreversed'] = 0x201B; 11672 t['quotereversed'] = 0x201B; 11673 t['quoteright'] = 0x2019; 11674 t['quoterightn'] = 0x0149; 11675 t['quotesinglbase'] = 0x201A; 11676 t['quotesingle'] = 0x0027; 11677 t['quotesinglemonospace'] = 0xFF07; 11678 t['r'] = 0x0072; 11679 t['raarmenian'] = 0x057C; 11680 t['rabengali'] = 0x09B0; 11681 t['racute'] = 0x0155; 11682 t['radeva'] = 0x0930; 11683 t['radical'] = 0x221A;
11684 t['radicalex'] = 0xF8E5; 11685 t['radoverssquare'] = 0x33AE; 11686 t['radoverssquaredsquare'] = 0x33AF; 11687 t['radsquare'] = 0x33AD; 11688 t['rafe'] = 0x05BF; 11689 t['rafehebrew'] = 0x05BF; 11690 t['ragujarati'] = 0x0AB0; 11691 t['ragurmukhi'] = 0x0A30; 11692 t['rahiragana'] = 0x3089; 11693 t['rakatakana'] = 0x30E9; 11694 t['rakatakanahalfwidth'] = 0xFF97; 11695 t['ralowerdiagonalbengali'] = 0x09F1; 11696 t['ramiddlediagonalbengali'] = 0x09F0; 11697 t['ramshorn'] = 0x0264; 11698 t['ratio'] = 0x2236; 11699 t['rbopomofo'] = 0x3116; 11700 t['rcaron'] = 0x0159; 11701 t['rcedilla'] = 0x0157; 11702 t['rcircle'] = 0x24E1; 11703 t['rcommaaccent'] = 0x0157; 11704 t['rdblgrave'] = 0x0211; 11705 t['rdotaccent'] = 0x1E59; 11706 t['rdotbelow'] = 0x1E5B; 11707 t['rdotbelowmacron'] = 0x1E5D; 11708 t['referencemark'] = 0x203B; 11709 t['reflexsubset'] = 0x2286; 11710 t['reflexsuperset'] = 0x2287; 11711 t['registered'] = 0x00AE; 11712 t['registersans'] = 0xF8E8; 11713 t['registerserif'] = 0xF6DA; 11714 t['reharabic'] = 0x0631; 11715 t['reharmenian'] = 0x0580; 11716 t['rehfinalarabic'] = 0xFEAE; 11717 t['rehiragana'] = 0x308C; 11718 t['rekatakana'] = 0x30EC; 11719 t['rekatakanahalfwidth'] = 0xFF9A; 11720 t['resh'] = 0x05E8; 11721 t['reshdageshhebrew'] = 0xFB48; 11722 t['reshhebrew'] = 0x05E8; 11723 t['reversedtilde'] = 0x223D; 11724 t['reviahebrew'] = 0x0597; 11725 t['reviamugrashhebrew'] = 0x0597; 11726 t['revlogicalnot'] = 0x2310; 11727 t['rfishhook'] = 0x027E; 11728 t['rfishhookreversed'] = 0x027F; 11729 t['rhabengali'] = 0x09DD; 11730 t['rhadeva'] = 0x095D; 11731 t['rho'] = 0x03C1; 11732 t['rhook'] = 0x027D; 11733 t['rhookturned'] = 0x027B; 11734 t['rhookturnedsuperior'] = 0x02B5; 11735 t['rhosymbolgreek'] = 0x03F1; 11736 t['rhotichookmod'] = 0x02DE; 11737 t['rieulacirclekorean'] = 0x3271; 11738 t['rieulaparenkorean'] = 0x3211; 11739 t['rieulcirclekorean'] = 0x3263; 11740 t['rieulhieuhkorean'] = 0x3140; 11741 t['rieulkiyeokkorean'] = 0x313A; 11742 t['rieulkiyeoksioskorean'] = 0x3169; 11743 t['rieulkorean'] = 0x3139; 11744 t['rieulmieumkorean'] = 0x313B; 11745 t['rieulpansioskorean'] = 0x316C; 11746 t['rieulparenkorean'] = 0x3203; 11747 t['rieulphieuphkorean'] = 0x313F; 11748 t['rieulpieupkorean'] = 0x313C; 11749 t['rieulpieupsioskorean'] = 0x316B; 11750 t['rieulsioskorean'] = 0x313D; 11751 t['rieulthieuthkorean'] = 0x313E; 11752 t['rieultikeutkorean'] = 0x316A; 11753 t['rieulyeorinhieuhkorean'] = 0x316D; 11754 t['rightangle'] = 0x221F; 11755 t['righttackbelowcmb'] = 0x0319; 11756 t['righttriangle'] = 0x22BF; 11757 t['rihiragana'] = 0x308A; 11758 t['rikatakana'] = 0x30EA; 11759 t['rikatakanahalfwidth'] = 0xFF98; 11760 t['ring'] = 0x02DA; 11761 t['ringbelowcmb'] = 0x0325; 11762 t['ringcmb'] = 0x030A; 11763 t['ringhalfleft'] = 0x02BF; 11764 t['ringhalfleftarmenian'] = 0x0559; 11765 t['ringhalfleftbelowcmb'] = 0x031C; 11766 t['ringhalfleftcentered'] = 0x02D3; 11767 t['ringhalfright'] = 0x02BE; 11768 t['ringhalfrightbelowcmb'] = 0x0339; 11769 t['ringhalfrightcentered'] = 0x02D2; 11770 t['rinvertedbreve'] = 0x0213; 11771 t['rittorusquare'] = 0x3351; 11772 t['rlinebelow'] = 0x1E5F; 11773 t['rlongleg'] = 0x027C; 11774 t['rlonglegturned'] = 0x027A; 11775 t['rmonospace'] = 0xFF52; 11776 t['rohiragana'] = 0x308D; 11777 t['rokatakana'] = 0x30ED; 11778 t['rokatakanahalfwidth'] = 0xFF9B; 11779 t['roruathai'] = 0x0E23; 11780 t['rparen'] = 0x24AD; 11781 t['rrabengali'] = 0x09DC; 11782 t['rradeva'] = 0x0931; 11783 t['rragurmukhi'] = 0x0A5C; 11784 t['rreharabic'] = 0x0691; 11785 t['rrehfinalarabic'] = 0xFB8D; 11786 t['rrvocalicbengali'] = 0x09E0; 11787 t['rrvocalicdeva'] = 0x0960; 11788 t['rrvocalicgujarati'] = 0x0AE0; 11789 t['rrvocalicvowelsignbengali'] = 0x09C4; 11790 t['rrvocalicvowelsigndeva'] = 0x0944; 11791 t['rrvocalicvowelsigngujarati'] = 0x0AC4; 11792 t['rsuperior'] = 0xF6F1; 11793 t['rtblock'] = 0x2590; 11794 t['rturned'] = 0x0279; 11795 t['rturnedsuperior'] = 0x02B4; 11796 t['ruhiragana'] = 0x308B; 11797 t['rukatakana'] = 0x30EB; 11798 t['rukatakanahalfwidth'] = 0xFF99; 11799 t['rupeemarkbengali'] = 0x09F2; 11800 t['rupeesignbengali'] = 0x09F3; 11801 t['rupiah'] = 0xF6DD; 11802 t['ruthai'] = 0x0E24; 11803 t['rvocalicbengali'] = 0x098B; 11804 t['rvocalicdeva'] = 0x090B; 11805 t['rvocalicgujarati'] = 0x0A8B; 11806 t['rvocalicvowelsignbengali'] = 0x09C3; 11807 t['rvocalicvowelsigndeva'] = 0x0943; 11808 t['rvocalicvowelsigngujarati'] = 0x0AC3; 11809 t['s'] = 0x0073; 11810 t['sabengali'] = 0x09B8; 11811 t['sacute'] = 0x015B; 11812 t['sacutedotaccent'] = 0x1E65; 11813 t['sadarabic'] = 0x0635; 11814 t['sadeva'] = 0x0938; 11815 t['sadfinalarabic'] = 0xFEBA; 11816 t['sadinitialarabic'] = 0xFEBB; 11817 t['sadmedialarabic'] = 0xFEBC; 11818 t['sagujarati'] = 0x0AB8; 11819 t['sagurmukhi'] = 0x0A38; 11820 t['sahiragana'] = 0x3055; 11821 t['sakatakana'] = 0x30B5;
11822 t['sakatakanahalfwidth'] = 0xFF7B; 11823 t['sallallahoualayhewasallamarabic'] = 0xFDFA; 11824 t['samekh'] = 0x05E1; 11825 t['samekhdagesh'] = 0xFB41; 11826 t['samekhdageshhebrew'] = 0xFB41; 11827 t['samekhhebrew'] = 0x05E1; 11828 t['saraaathai'] = 0x0E32; 11829 t['saraaethai'] = 0x0E41; 11830 t['saraaimaimalaithai'] = 0x0E44; 11831 t['saraaimaimuanthai'] = 0x0E43; 11832 t['saraamthai'] = 0x0E33; 11833 t['saraathai'] = 0x0E30; 11834 t['saraethai'] = 0x0E40; 11835 t['saraiileftthai'] = 0xF886; 11836 t['saraiithai'] = 0x0E35; 11837 t['saraileftthai'] = 0xF885; 11838 t['saraithai'] = 0x0E34; 11839 t['saraothai'] = 0x0E42; 11840 t['saraueeleftthai'] = 0xF888; 11841 t['saraueethai'] = 0x0E37; 11842 t['saraueleftthai'] = 0xF887; 11843 t['sarauethai'] = 0x0E36; 11844 t['sarauthai'] = 0x0E38; 11845 t['sarauuthai'] = 0x0E39; 11846 t['sbopomofo'] = 0x3119; 11847 t['scaron'] = 0x0161; 11848 t['scarondotaccent'] = 0x1E67; 11849 t['scedilla'] = 0x015F; 11850 t['schwa'] = 0x0259; 11851 t['schwacyrillic'] = 0x04D9; 11852 t['schwadieresiscyrillic'] = 0x04DB; 11853 t['schwahook'] = 0x025A; 11854 t['scircle'] = 0x24E2; 11855 t['scircumflex'] = 0x015D; 11856 t['scommaaccent'] = 0x0219; 11857 t['sdotaccent'] = 0x1E61; 11858 t['sdotbelow'] = 0x1E63; 11859 t['sdotbelowdotaccent'] = 0x1E69; 11860 t['seagullbelowcmb'] = 0x033C; 11861 t['second'] = 0x2033; 11862 t['secondtonechinese'] = 0x02CA; 11863 t['section'] = 0x00A7; 11864 t['seenarabic'] = 0x0633; 11865 t['seenfinalarabic'] = 0xFEB2; 11866 t['seeninitialarabic'] = 0xFEB3; 11867 t['seenmedialarabic'] = 0xFEB4; 11868 t['segol'] = 0x05B6; 11869 t['segol13'] = 0x05B6; 11870 t['segol1f'] = 0x05B6; 11871 t['segol2c'] = 0x05B6; 11872 t['segolhebrew'] = 0x05B6; 11873 t['segolnarrowhebrew'] = 0x05B6; 11874 t['segolquarterhebrew'] = 0x05B6; 11875 t['segoltahebrew'] = 0x0592; 11876 t['segolwidehebrew'] = 0x05B6; 11877 t['seharmenian'] = 0x057D; 11878 t['sehiragana'] = 0x305B; 11879 t['sekatakana'] = 0x30BB; 11880 t['sekatakanahalfwidth'] = 0xFF7E; 11881 t['semicolon'] = 0x003B; 11882 t['semicolonarabic'] = 0x061B; 11883 t['semicolonmonospace'] = 0xFF1B; 11884 t['semicolonsmall'] = 0xFE54; 11885 t['semivoicedmarkkana'] = 0x309C; 11886 t['semivoicedmarkkanahalfwidth'] = 0xFF9F; 11887 t['sentisquare'] = 0x3322; 11888 t['sentosquare'] = 0x3323; 11889 t['seven'] = 0x0037; 11890 t['sevenarabic'] = 0x0667; 11891 t['sevenbengali'] = 0x09ED; 11892 t['sevencircle'] = 0x2466; 11893 t['sevencircleinversesansserif'] = 0x2790; 11894 t['sevendeva'] = 0x096D; 11895 t['seveneighths'] = 0x215E; 11896 t['sevengujarati'] = 0x0AED; 11897 t['sevengurmukhi'] = 0x0A6D; 11898 t['sevenhackarabic'] = 0x0667; 11899 t['sevenhangzhou'] = 0x3027; 11900 t['sevenideographicparen'] = 0x3226; 11901 t['seveninferior'] = 0x2087; 11902 t['sevenmonospace'] = 0xFF17; 11903 t['sevenoldstyle'] = 0xF737; 11904 t['sevenparen'] = 0x247A; 11905 t['sevenperiod'] = 0x248E; 11906 t['sevenpersian'] = 0x06F7; 11907 t['sevenroman'] = 0x2176; 11908 t['sevensuperior'] = 0x2077; 11909 t['seventeencircle'] = 0x2470; 11910 t['seventeenparen'] = 0x2484; 11911 t['seventeenperiod'] = 0x2498; 11912 t['seventhai'] = 0x0E57; 11913 t['sfthyphen'] = 0x00AD; 11914 t['shaarmenian'] = 0x0577; 11915 t['shabengali'] = 0x09B6; 11916 t['shacyrillic'] = 0x0448; 11917 t['shaddaarabic'] = 0x0651; 11918 t['shaddadammaarabic'] = 0xFC61; 11919 t['shaddadammatanarabic'] = 0xFC5E; 11920 t['shaddafathaarabic'] = 0xFC60; 11921 t['shaddakasraarabic'] = 0xFC62; 11922 t['shaddakasratanarabic'] = 0xFC5F; 11923 t['shade'] = 0x2592; 11924 t['shadedark'] = 0x2593; 11925 t['shadelight'] = 0x2591; 11926 t['shademedium'] = 0x2592; 11927 t['shadeva'] = 0x0936; 11928 t['shagujarati'] = 0x0AB6; 11929 t['shagurmukhi'] = 0x0A36; 11930 t['shalshelethebrew'] = 0x0593; 11931 t['shbopomofo'] = 0x3115; 11932 t['shchacyrillic'] = 0x0449; 11933 t['sheenarabic'] = 0x0634; 11934 t['sheenfinalarabic'] = 0xFEB6; 11935 t['sheeninitialarabic'] = 0xFEB7; 11936 t['sheenmedialarabic'] = 0xFEB8; 11937 t['sheicoptic'] = 0x03E3; 11938 t['sheqel'] = 0x20AA; 11939 t['sheqelhebrew'] = 0x20AA; 11940 t['sheva'] = 0x05B0; 11941 t['sheva115'] = 0x05B0; 11942 t['sheva15'] = 0x05B0; 11943 t['sheva22'] = 0x05B0; 11944 t['sheva2e'] = 0x05B0; 11945 t['shevahebrew'] = 0x05B0; 11946 t['shevanarrowhebrew'] = 0x05B0; 11947 t['shevaquarterhebrew'] = 0x05B0; 11948 t['shevawidehebrew'] = 0x05B0; 11949 t['shhacyrillic'] = 0x04BB; 11950 t['shimacoptic'] = 0x03ED; 11951 t['shin'] = 0x05E9; 11952 t['shindagesh'] = 0xFB49; 11953 t['shindageshhebrew'] = 0xFB49; 11954 t['shindageshshindot'] = 0xFB2C; 11955 t['shindageshshindothebrew'] = 0xFB2C; 11956 t['shindageshsindot'] = 0xFB2D; 11957 t['shindageshsindothebrew'] = 0xFB2D; 11958 t['shindothebrew'] = 0x05C1; 11959 t['shinhebrew'] = 0x05E9; 11960 t['shinshindot'] = 0xFB2A; 11961 t['shinshindothebrew'] = 0xFB2A; 11962 t['shinsindot'] = 0xFB2B; 11963 t['shinsindothebrew'] = 0xFB2B; 11964 t['shook'] = 0x0282;
11965 t['sigma'] = 0x03C3; 11966 t['sigma1'] = 0x03C2; 11967 t['sigmafinal'] = 0x03C2; 11968 t['sigmalunatesymbolgreek'] = 0x03F2; 11969 t['sihiragana'] = 0x3057; 11970 t['sikatakana'] = 0x30B7; 11971 t['sikatakanahalfwidth'] = 0xFF7C; 11972 t['siluqhebrew'] = 0x05BD; 11973 t['siluqlefthebrew'] = 0x05BD; 11974 t['similar'] = 0x223C; 11975 t['sindothebrew'] = 0x05C2; 11976 t['siosacirclekorean'] = 0x3274; 11977 t['siosaparenkorean'] = 0x3214; 11978 t['sioscieuckorean'] = 0x317E; 11979 t['sioscirclekorean'] = 0x3266; 11980 t['sioskiyeokkorean'] = 0x317A; 11981 t['sioskorean'] = 0x3145; 11982 t['siosnieunkorean'] = 0x317B; 11983 t['siosparenkorean'] = 0x3206; 11984 t['siospieupkorean'] = 0x317D; 11985 t['siostikeutkorean'] = 0x317C; 11986 t['six'] = 0x0036; 11987 t['sixarabic'] = 0x0666; 11988 t['sixbengali'] = 0x09EC; 11989 t['sixcircle'] = 0x2465; 11990 t['sixcircleinversesansserif'] = 0x278F; 11991 t['sixdeva'] = 0x096C; 11992 t['sixgujarati'] = 0x0AEC; 11993 t['sixgurmukhi'] = 0x0A6C; 11994 t['sixhackarabic'] = 0x0666; 11995 t['sixhangzhou'] = 0x3026; 11996 t['sixideographicparen'] = 0x3225; 11997 t['sixinferior'] = 0x2086; 11998 t['sixmonospace'] = 0xFF16; 11999 t['sixoldstyle'] = 0xF736; 12000 t['sixparen'] = 0x2479; 12001 t['sixperiod'] = 0x248D; 12002 t['sixpersian'] = 0x06F6; 12003 t['sixroman'] = 0x2175; 12004 t['sixsuperior'] = 0x2076; 12005 t['sixteencircle'] = 0x246F; 12006 t['sixteencurrencydenominatorbengali'] = 0x09F9; 12007 t['sixteenparen'] = 0x2483; 12008 t['sixteenperiod'] = 0x2497; 12009 t['sixthai'] = 0x0E56; 12010 t['slash'] = 0x002F; 12011 t['slashmonospace'] = 0xFF0F; 12012 t['slong'] = 0x017F; 12013 t['slongdotaccent'] = 0x1E9B; 12014 t['smileface'] = 0x263A; 12015 t['smonospace'] = 0xFF53; 12016 t['sofpasuqhebrew'] = 0x05C3; 12017 t['softhyphen'] = 0x00AD; 12018 t['softsigncyrillic'] = 0x044C; 12019 t['sohiragana'] = 0x305D; 12020 t['sokatakana'] = 0x30BD; 12021 t['sokatakanahalfwidth'] = 0xFF7F; 12022 t['soliduslongoverlaycmb'] = 0x0338; 12023 t['solidusshortoverlaycmb'] = 0x0337; 12024 t['sorusithai'] = 0x0E29; 12025 t['sosalathai'] = 0x0E28; 12026 t['sosothai'] = 0x0E0B; 12027 t['sosuathai'] = 0x0E2A; 12028 t['space'] = 0x0020; 12029 t['spacehackarabic'] = 0x0020; 12030 t['spade'] = 0x2660; 12031 t['spadesuitblack'] = 0x2660; 12032 t['spadesuitwhite'] = 0x2664; 12033 t['sparen'] = 0x24AE; 12034 t['squarebelowcmb'] = 0x033B; 12035 t['squarecc'] = 0x33C4; 12036 t['squarecm'] = 0x339D; 12037 t['squarediagonalcrosshatchfill'] = 0x25A9; 12038 t['squarehorizontalfill'] = 0x25A4; 12039 t['squarekg'] = 0x338F; 12040 t['squarekm'] = 0x339E; 12041 t['squarekmcapital'] = 0x33CE; 12042 t['squareln'] = 0x33D1; 12043 t['squarelog'] = 0x33D2; 12044 t['squaremg'] = 0x338E; 12045 t['squaremil'] = 0x33D5; 12046 t['squaremm'] = 0x339C; 12047 t['squaremsquared'] = 0x33A1; 12048 t['squareorthogonalcrosshatchfill'] = 0x25A6; 12049 t['squareupperlefttolowerrightfill'] = 0x25A7; 12050 t['squareupperrighttolowerleftfill'] = 0x25A8; 12051 t['squareverticalfill'] = 0x25A5; 12052 t['squarewhitewithsmallblack'] = 0x25A3; 12053 t['srsquare'] = 0x33DB; 12054 t['ssabengali'] = 0x09B7; 12055 t['ssadeva'] = 0x0937; 12056 t['ssagujarati'] = 0x0AB7; 12057 t['ssangcieuckorean'] = 0x3149; 12058 t['ssanghieuhkorean'] = 0x3185; 12059 t['ssangieungkorean'] = 0x3180; 12060 t['ssangkiyeokkorean'] = 0x3132; 12061 t['ssangnieunkorean'] = 0x3165; 12062 t['ssangpieupkorean'] = 0x3143; 12063 t['ssangsioskorean'] = 0x3146; 12064 t['ssangtikeutkorean'] = 0x3138; 12065 t['ssuperior'] = 0xF6F2; 12066 t['sterling'] = 0x00A3; 12067 t['sterlingmonospace'] = 0xFFE1; 12068 t['strokelongoverlaycmb'] = 0x0336; 12069 t['strokeshortoverlaycmb'] = 0x0335; 12070 t['subset'] = 0x2282; 12071 t['subsetnotequal'] = 0x228A; 12072 t['subsetorequal'] = 0x2286; 12073 t['succeeds'] = 0x227B; 12074 t['suchthat'] = 0x220B; 12075 t['suhiragana'] = 0x3059; 12076 t['sukatakana'] = 0x30B9; 12077 t['sukatakanahalfwidth'] = 0xFF7D; 12078 t['sukunarabic'] = 0x0652; 12079 t['summation'] = 0x2211; 12080 t['sun'] = 0x263C; 12081 t['superset'] = 0x2283; 12082 t['supersetnotequal'] = 0x228B; 12083 t['supersetorequal'] = 0x2287; 12084 t['svsquare'] = 0x33DC; 12085 t['syouwaerasquare'] = 0x337C; 12086 t['t'] = 0x0074; 12087 t['tabengali'] = 0x09A4; 12088 t['tackdown'] = 0x22A4; 12089 t['tackleft'] = 0x22A3; 12090 t['tadeva'] = 0x0924; 12091 t['tagujarati'] = 0x0AA4; 12092 t['tagurmukhi'] = 0x0A24; 12093 t['taharabic'] = 0x0637; 12094 t['tahfinalarabic'] = 0xFEC2; 12095 t['tahinitialarabic'] = 0xFEC3; 12096 t['tahiragana'] = 0x305F; 12097 t['tahmedialarabic'] = 0xFEC4; 12098 t['taisyouerasquare'] = 0x337D; 12099 t['takatakana'] = 0x30BF; 12100 t['takatakanahalfwidth'] = 0xFF80; 12101 t['tatweelarabic'] = 0x0640; 12102 t['tau'] = 0x03C4; 12103 t['tav'] = 0x05EA; 12104 t['tavdages'] = 0xFB4A; 12105 t['tavdagesh'] = 0xFB4A; 12106 t['tavdageshhebrew'] = 0xFB4A; 12107 t['tavhebrew'] = 0x05EA; 12108 t['tbar'] = 0x0167; 12109 t['tbopomofo'] = 0x310A; 12110 t['tcaron'] = 0x0165; 12111 t['tccurl'] = 0x02A8; 12112 t['tcedilla'] = 0x0163; 12113 t['tcheharabic'] = 0x0686; 12114 t['tchehfinalarabic'] = 0xFB7B; 12115 t['tchehinitialarabic'] = 0xFB7C; 12116 t['tchehmedialarabic'] = 0xFB7D; 12117 t['tcircle'] = 0x24E3; 12118 t['tcircumflexbelow'] = 0x1E71; 12119 t['tcommaaccent'] = 0x0163; 12120 t['tdieresis'] = 0x1E97; 12121 t['tdotaccent'] = 0x1E6B; 12122 t['tdotbelow'] = 0x1E6D; 12123 t['tecyrillic'] = 0x0442; 12124 t['tedescendercyrillic'] = 0x04AD; 12125 t['teharabic'] = 0x062A; 12126 t['tehfinalarabic'] = 0xFE96; 12127 t['tehhahinitialarabic'] = 0xFCA2; 12128 t['tehhahisolatedarabic'] = 0xFC0C; 12129 t['tehinitialarabic'] = 0xFE97; 12130 t['tehiragana'] = 0x3066; 12131 t['tehjeeminitialarabic'] = 0xFCA1; 12132 t['tehjeemisolatedarabic'] = 0xFC0B; 12133 t['tehmarbutaarabic'] = 0x0629; 12134 t['tehmarbutafinalarabic'] = 0xFE94; 12135 t['tehmedialarabic'] = 0xFE98; 12136 t['tehmeeminitialarabic'] = 0xFCA4; 12137 t['tehmeemisolatedarabic'] = 0xFC0E; 12138 t['tehnoonfinalarabic'] = 0xFC73; 12139 t['tekatakana'] = 0x30C6; 12140 t['tekatakanahalfwidth'] = 0xFF83; 12141 t['telephone'] = 0x2121; 12142 t['telephoneblack'] = 0x260E; 12143 t['telishagedolahebrew'] = 0x05A0; 12144 t['telishaqetanahebrew'] = 0x05A9; 12145 t['tencircle'] = 0x2469; 12146 t['tenideographicparen'] = 0x3229; 12147 t['tenparen'] = 0x247D; 12148 t['tenperiod'] = 0x2491; 12149 t['tenroman'] = 0x2179; 12150 t['tesh'] = 0x02A7; 12151 t['tet'] = 0x05D8; 12152 t['tetdagesh'] = 0xFB38; 12153 t['tetdageshhebrew'] = 0xFB38; 12154 t['tethebrew'] = 0x05D8; 12155 t['tetsecyrillic'] = 0x04B5; 12156 t['tevirhebrew'] = 0x059B; 12157 t['tevirlefthebrew'] = 0x059B; 12158 t['thabengali'] = 0x09A5; 12159 t['thadeva'] = 0x0925; 12160 t['thagujarati'] = 0x0AA5; 12161 t['thagurmukhi'] = 0x0A25; 12162 t['thalarabic'] = 0x0630; 12163 t['thalfinalarabic'] = 0xFEAC;
12164 t['thanthakhatlowleftthai'] = 0xF898; 12165 t['thanthakhatlowrightthai'] = 0xF897; 12166 t['thanthakhatthai'] = 0x0E4C; 12167 t['thanthakhatupperleftthai'] = 0xF896; 12168 t['theharabic'] = 0x062B; 12169 t['thehfinalarabic'] = 0xFE9A; 12170 t['thehinitialarabic'] = 0xFE9B; 12171 t['thehmedialarabic'] = 0xFE9C; 12172 t['thereexists'] = 0x2203; 12173 t['therefore'] = 0x2234; 12174 t['theta'] = 0x03B8; 12175 t['theta1'] = 0x03D1; 12176 t['thetasymbolgreek'] = 0x03D1; 12177 t['thieuthacirclekorean'] = 0x3279; 12178 t['thieuthaparenkorean'] = 0x3219; 12179 t['thieuthcirclekorean'] = 0x326B; 12180 t['thieuthkorean'] = 0x314C; 12181 t['thieuthparenkorean'] = 0x320B; 12182 t['thirteencircle'] = 0x246C; 12183 t['thirteenparen'] = 0x2480; 12184 t['thirteenperiod'] = 0x2494; 12185 t['thonangmonthothai'] = 0x0E11; 12186 t['thook'] = 0x01AD; 12187 t['thophuthaothai'] = 0x0E12; 12188 t['thorn'] = 0x00FE; 12189 t['thothahanthai'] = 0x0E17; 12190 t['thothanthai'] = 0x0E10; 12191 t['thothongthai'] = 0x0E18; 12192 t['thothungthai'] = 0x0E16; 12193 t['thousandcyrillic'] = 0x0482; 12194 t['thousandsseparatorarabic'] = 0x066C; 12195 t['thousandsseparatorpersian'] = 0x066C; 12196 t['three'] = 0x0033; 12197 t['threearabic'] = 0x0663; 12198 t['threebengali'] = 0x09E9; 12199 t['threecircle'] = 0x2462; 12200 t['threecircleinversesansserif'] = 0x278C; 12201 t['threedeva'] = 0x0969; 12202 t['threeeighths'] = 0x215C; 12203 t['threegujarati'] = 0x0AE9; 12204 t['threegurmukhi'] = 0x0A69; 12205 t['threehackarabic'] = 0x0663; 12206 t['threehangzhou'] = 0x3023; 12207 t['threeideographicparen'] = 0x3222; 12208 t['threeinferior'] = 0x2083; 12209 t['threemonospace'] = 0xFF13; 12210 t['threenumeratorbengali'] = 0x09F6; 12211 t['threeoldstyle'] = 0xF733; 12212 t['threeparen'] = 0x2476; 12213 t['threeperiod'] = 0x248A; 12214 t['threepersian'] = 0x06F3; 12215 t['threequarters'] = 0x00BE; 12216 t['threequartersemdash'] = 0xF6DE; 12217 t['threeroman'] = 0x2172; 12218 t['threesuperior'] = 0x00B3; 12219 t['threethai'] = 0x0E53; 12220 t['thzsquare'] = 0x3394; 12221 t['tihiragana'] = 0x3061; 12222 t['tikatakana'] = 0x30C1; 12223 t['tikatakanahalfwidth'] = 0xFF81; 12224 t['tikeutacirclekorean'] = 0x3270; 12225 t['tikeutaparenkorean'] = 0x3210; 12226 t['tikeutcirclekorean'] = 0x3262; 12227 t['tikeutkorean'] = 0x3137; 12228 t['tikeutparenkorean'] = 0x3202; 12229 t['tilde'] = 0x02DC; 12230 t['tildebelowcmb'] = 0x0330; 12231 t['tildecmb'] = 0x0303; 12232 t['tildecomb'] = 0x0303; 12233 t['tildedoublecmb'] = 0x0360; 12234 t['tildeoperator'] = 0x223C; 12235 t['tildeoverlaycmb'] = 0x0334; 12236 t['tildeverticalcmb'] = 0x033E; 12237 t['timescircle'] = 0x2297; 12238 t['tipehahebrew'] = 0x0596; 12239 t['tipehalefthebrew'] = 0x0596; 12240 t['tippigurmukhi'] = 0x0A70; 12241 t['titlocyrilliccmb'] = 0x0483; 12242 t['tiwnarmenian'] = 0x057F; 12243 t['tlinebelow'] = 0x1E6F; 12244 t['tmonospace'] = 0xFF54; 12245 t['toarmenian'] = 0x0569; 12246 t['tohiragana'] = 0x3068; 12247 t['tokatakana'] = 0x30C8; 12248 t['tokatakanahalfwidth'] = 0xFF84; 12249 t['tonebarextrahighmod'] = 0x02E5; 12250 t['tonebarextralowmod'] = 0x02E9; 12251 t['tonebarhighmod'] = 0x02E6; 12252 t['tonebarlowmod'] = 0x02E8; 12253 t['tonebarmidmod'] = 0x02E7; 12254 t['tonefive'] = 0x01BD; 12255 t['tonesix'] = 0x0185; 12256 t['tonetwo'] = 0x01A8; 12257 t['tonos'] = 0x0384; 12258 t['tonsquare'] = 0x3327; 12259 t['topatakthai'] = 0x0E0F; 12260 t['tortoiseshellbracketleft'] = 0x3014; 12261 t['tortoiseshellbracketleftsmall'] = 0xFE5D; 12262 t['tortoiseshellbracketleftvertical'] = 0xFE39; 12263 t['tortoiseshellbracketright'] = 0x3015; 12264 t['tortoiseshellbracketrightsmall'] = 0xFE5E; 12265 t['tortoiseshellbracketrightvertical'] = 0xFE3A; 12266 t['totaothai'] = 0x0E15; 12267 t['tpalatalhook'] = 0x01AB; 12268 t['tparen'] = 0x24AF; 12269 t['trademark'] = 0x2122; 12270 t['trademarksans'] = 0xF8EA; 12271 t['trademarkserif'] = 0xF6DB; 12272 t['tretroflexhook'] = 0x0288; 12273 t['triagdn'] = 0x25BC; 12274 t['triaglf'] = 0x25C4; 12275 t['triagrt'] = 0x25BA; 12276 t['triagup'] = 0x25B2; 12277 t['ts'] = 0x02A6; 12278 t['tsadi'] = 0x05E6; 12279 t['tsadidagesh'] = 0xFB46; 12280 t['tsadidageshhebrew'] = 0xFB46; 12281 t['tsadihebrew'] = 0x05E6; 12282 t['tsecyrillic'] = 0x0446; 12283 t['tsere'] = 0x05B5; 12284 t['tsere12'] = 0x05B5; 12285 t['tsere1e'] = 0x05B5; 12286 t['tsere2b'] = 0x05B5; 12287 t['tserehebrew'] = 0x05B5; 12288 t['tserenarrowhebrew'] = 0x05B5; 12289 t['tserequarterhebrew'] = 0x05B5; 12290 t['tserewidehebrew'] = 0x05B5; 12291 t['tshecyrillic'] = 0x045B; 12292 t['tsuperior'] = 0xF6F3; 12293 t['ttabengali'] = 0x099F; 12294 t['ttadeva'] = 0x091F; 12295 t['ttagujarati'] = 0x0A9F; 12296 t['ttagurmukhi'] = 0x0A1F; 12297 t['tteharabic'] = 0x0679; 12298 t['ttehfinalarabic'] = 0xFB67; 12299 t['ttehinitialarabic'] = 0xFB68; 12300 t['ttehmedialarabic'] = 0xFB69;
12301 t['tthabengali'] = 0x09A0; 12302 t['tthadeva'] = 0x0920; 12303 t['tthagujarati'] = 0x0AA0; 12304 t['tthagurmukhi'] = 0x0A20; 12305 t['tturned'] = 0x0287; 12306 t['tuhiragana'] = 0x3064; 12307 t['tukatakana'] = 0x30C4; 12308 t['tukatakanahalfwidth'] = 0xFF82; 12309 t['tusmallhiragana'] = 0x3063; 12310 t['tusmallkatakana'] = 0x30C3; 12311 t['tusmallkatakanahalfwidth'] = 0xFF6F; 12312 t['twelvecircle'] = 0x246B; 12313 t['twelveparen'] = 0x247F; 12314 t['twelveperiod'] = 0x2493; 12315 t['twelveroman'] = 0x217B; 12316 t['twentycircle'] = 0x2473; 12317 t['twentyhangzhou'] = 0x5344; 12318 t['twentyparen'] = 0x2487; 12319 t['twentyperiod'] = 0x249B; 12320 t['two'] = 0x0032; 12321 t['twoarabic'] = 0x0662; 12322 t['twobengali'] = 0x09E8; 12323 t['twocircle'] = 0x2461; 12324 t['twocircleinversesansserif'] = 0x278B; 12325 t['twodeva'] = 0x0968; 12326 t['twodotenleader'] = 0x2025; 12327 t['twodotleader'] = 0x2025; 12328 t['twodotleadervertical'] = 0xFE30; 12329 t['twogujarati'] = 0x0AE8; 12330 t['twogurmukhi'] = 0x0A68; 12331 t['twohackarabic'] = 0x0662; 12332 t['twohangzhou'] = 0x3022; 12333 t['twoideographicparen'] = 0x3221; 12334 t['twoinferior'] = 0x2082; 12335 t['twomonospace'] = 0xFF12; 12336 t['twonumeratorbengali'] = 0x09F5; 12337 t['twooldstyle'] = 0xF732; 12338 t['twoparen'] = 0x2475; 12339 t['twoperiod'] = 0x2489; 12340 t['twopersian'] = 0x06F2; 12341 t['tworoman'] = 0x2171; 12342 t['twostroke'] = 0x01BB; 12343 t['twosuperior'] = 0x00B2; 12344 t['twothai'] = 0x0E52; 12345 t['twothirds'] = 0x2154; 12346 t['u'] = 0x0075; 12347 t['uacute'] = 0x00FA; 12348 t['ubar'] = 0x0289; 12349 t['ubengali'] = 0x0989; 12350 t['ubopomofo'] = 0x3128; 12351 t['ubreve'] = 0x016D; 12352 t['ucaron'] = 0x01D4; 12353 t['ucircle'] = 0x24E4; 12354 t['ucircumflex'] = 0x00FB; 12355 t['ucircumflexbelow'] = 0x1E77; 12356 t['ucyrillic'] = 0x0443; 12357 t['udattadeva'] = 0x0951; 12358 t['udblacute'] = 0x0171; 12359 t['udblgrave'] = 0x0215; 12360 t['udeva'] = 0x0909; 12361 t['udieresis'] = 0x00FC; 12362 t['udieresisacute'] = 0x01D8; 12363 t['udieresisbelow'] = 0x1E73; 12364 t['udieresiscaron'] = 0x01DA; 12365 t['udieresiscyrillic'] = 0x04F1; 12366 t['udieresisgrave'] = 0x01DC; 12367 t['udieresismacron'] = 0x01D6; 12368 t['udotbelow'] = 0x1EE5; 12369 t['ugrave'] = 0x00F9; 12370 t['ugujarati'] = 0x0A89; 12371 t['ugurmukhi'] = 0x0A09; 12372 t['uhiragana'] = 0x3046; 12373 t['uhookabove'] = 0x1EE7; 12374 t['uhorn'] = 0x01B0; 12375 t['uhornacute'] = 0x1EE9; 12376 t['uhorndotbelow'] = 0x1EF1; 12377 t['uhorngrave'] = 0x1EEB; 12378 t['uhornhookabove'] = 0x1EED; 12379 t['uhorntilde'] = 0x1EEF; 12380 t['uhungarumlaut'] = 0x0171; 12381 t['uhungarumlautcyrillic'] = 0x04F3; 12382 t['uinvertedbreve'] = 0x0217; 12383 t['ukatakana'] = 0x30A6; 12384 t['ukatakanahalfwidth'] = 0xFF73; 12385 t['ukcyrillic'] = 0x0479; 12386 t['ukorean'] = 0x315C; 12387 t['umacron'] = 0x016B; 12388 t['umacroncyrillic'] = 0x04EF; 12389 t['umacrondieresis'] = 0x1E7B; 12390 t['umatragurmukhi'] = 0x0A41; 12391 t['umonospace'] = 0xFF55; 12392 t['underscore'] = 0x005F; 12393 t['underscoredbl'] = 0x2017; 12394 t['underscoremonospace'] = 0xFF3F; 12395 t['underscorevertical'] = 0xFE33; 12396 t['underscorewavy'] = 0xFE4F; 12397 t['union'] = 0x222A; 12398 t['universal'] = 0x2200; 12399 t['uogonek'] = 0x0173; 12400 t['uparen'] = 0x24B0; 12401 t['upblock'] = 0x2580; 12402 t['upperdothebrew'] = 0x05C4; 12403 t['upsilon'] = 0x03C5; 12404 t['upsilondieresis'] = 0x03CB; 12405 t['upsilondieresistonos'] = 0x03B0; 12406 t['upsilonlatin'] = 0x028A; 12407 t['upsilontonos'] = 0x03CD; 12408 t['uptackbelowcmb'] = 0x031D; 12409 t['uptackmod'] = 0x02D4; 12410 t['uragurmukhi'] = 0x0A73; 12411 t['uring'] = 0x016F; 12412 t['ushortcyrillic'] = 0x045E; 12413 t['usmallhiragana'] = 0x3045; 12414 t['usmallkatakana'] = 0x30A5; 12415 t['usmallkatakanahalfwidth'] = 0xFF69; 12416 t['ustraightcyrillic'] = 0x04AF; 12417 t['ustraightstrokecyrillic'] = 0x04B1; 12418 t['utilde'] = 0x0169; 12419 t['utildeacute'] = 0x1E79; 12420 t['utildebelow'] = 0x1E75; 12421 t['uubengali'] = 0x098A; 12422 t['uudeva'] = 0x090A; 12423 t['uugujarati'] = 0x0A8A; 12424 t['uugurmukhi'] = 0x0A0A; 12425 t['uumatragurmukhi'] = 0x0A42; 12426 t['uuvowelsignbengali'] = 0x09C2; 12427 t['uuvowelsigndeva'] = 0x0942; 12428 t['uuvowelsigngujarati'] = 0x0AC2; 12429 t['uvowelsignbengali'] = 0x09C1; 12430 t['uvowelsigndeva'] = 0x0941; 12431 t['uvowelsigngujarati'] = 0x0AC1; 12432 t['v'] = 0x0076; 12433 t['vadeva'] = 0x0935; 12434 t['vagujarati'] = 0x0AB5; 12435 t['vagurmukhi'] = 0x0A35; 12436 t['vakatakana'] = 0x30F7; 12437 t['vav'] = 0x05D5; 12438 t['vavdagesh'] = 0xFB35; 12439 t['vavdagesh65'] = 0xFB35; 12440 t['vavdageshhebrew'] = 0xFB35; 12441 t['vavhebrew'] = 0x05D5; 12442 t['vavholam'] = 0xFB4B; 12443 t['vavholamhebrew'] = 0xFB4B; 12444 t['vavvavhebrew'] = 0x05F0; 12445 t['vavyodhebrew'] = 0x05F1; 12446 t['vcircle'] = 0x24E5; 12447 t['vdotbelow'] = 0x1E7F; 12448 t['vecyrillic'] = 0x0432; 12449 t['veharabic'] = 0x06A4; 12450 t['vehfinalarabic'] = 0xFB6B; 12451 t['vehinitialarabic'] = 0xFB6C; 12452 t['vehmedialarabic'] = 0xFB6D; 12453 t['vekatakana'] = 0x30F9; 12454 t['venus'] = 0x2640; 12455 t['verticalbar'] = 0x007C; 12456 t['verticallineabovecmb'] = 0x030D; 12457 t['verticallinebelowcmb'] = 0x0329; 12458 t['verticallinelowmod'] = 0x02CC; 12459 t['verticallinemod'] = 0x02C8; 12460 t['vewarmenian'] = 0x057E; 12461 t['vhook'] = 0x028B; 12462 t['vikatakana'] = 0x30F8; 12463 t['viramabengali'] = 0x09CD; 12464 t['viramadeva'] = 0x094D; 12465 t['viramagujarati'] = 0x0ACD; 12466 t['visargabengali'] = 0x0983; 12467 t['visargadeva'] = 0x0903; 12468 t['visargagujarati'] = 0x0A83; 12469 t['vmonospace'] = 0xFF56; 12470 t['voarmenian'] = 0x0578; 12471 t['voicediterationhiragana'] = 0x309E; 12472 t['voicediterationkatakana'] = 0x30FE; 12473 t['voicedmarkkana'] = 0x309B; 12474 t['voicedmarkkanahalfwidth'] = 0xFF9E; 12475 t['vokatakana'] = 0x30FA; 12476 t['vparen'] = 0x24B1; 12477 t['vtilde'] = 0x1E7D; 12478 t['vturned'] = 0x028C; 12479 t['vuhiragana'] = 0x3094;
12480 t['vukatakana'] = 0x30F4; 12481 t['w'] = 0x0077; 12482 t['wacute'] = 0x1E83; 12483 t['waekorean'] = 0x3159; 12484 t['wahiragana'] = 0x308F; 12485 t['wakatakana'] = 0x30EF; 12486 t['wakatakanahalfwidth'] = 0xFF9C; 12487 t['wakorean'] = 0x3158; 12488 t['wasmallhiragana'] = 0x308E; 12489 t['wasmallkatakana'] = 0x30EE; 12490 t['wattosquare'] = 0x3357; 12491 t['wavedash'] = 0x301C; 12492 t['wavyunderscorevertical'] = 0xFE34; 12493 t['wawarabic'] = 0x0648; 12494 t['wawfinalarabic'] = 0xFEEE; 12495 t['wawhamzaabovearabic'] = 0x0624; 12496 t['wawhamzaabovefinalarabic'] = 0xFE86; 12497 t['wbsquare'] = 0x33DD; 12498 t['wcircle'] = 0x24E6; 12499 t['wcircumflex'] = 0x0175; 12500 t['wdieresis'] = 0x1E85; 12501 t['wdotaccent'] = 0x1E87; 12502 t['wdotbelow'] = 0x1E89; 12503 t['wehiragana'] = 0x3091; 12504 t['weierstrass'] = 0x2118; 12505 t['wekatakana'] = 0x30F1; 12506 t['wekorean'] = 0x315E; 12507 t['weokorean'] = 0x315D; 12508 t['wgrave'] = 0x1E81; 12509 t['whitebullet'] = 0x25E6; 12510 t['whitecircle'] = 0x25CB; 12511 t['whitecircleinverse'] = 0x25D9; 12512 t['whitecornerbracketleft'] = 0x300E; 12513 t['whitecornerbracketleftvertical'] = 0xFE43; 12514 t['whitecornerbracketright'] = 0x300F; 12515 t['whitecornerbracketrightvertical'] = 0xFE44; 12516 t['whitediamond'] = 0x25C7; 12517 t['whitediamondcontainingblacksmalldiamond'] = 0x25C8; 12518 t['whitedownpointingsmalltriangle'] = 0x25BF; 12519 t['whitedownpointingtriangle'] = 0x25BD; 12520 t['whiteleftpointingsmalltriangle'] = 0x25C3; 12521 t['whiteleftpointingtriangle'] = 0x25C1; 12522 t['whitelenticularbracketleft'] = 0x3016; 12523 t['whitelenticularbracketright'] = 0x3017; 12524 t['whiterightpointingsmalltriangle'] = 0x25B9; 12525 t['whiterightpointingtriangle'] = 0x25B7; 12526 t['whitesmallsquare'] = 0x25AB; 12527 t['whitesmilingface'] = 0x263A; 12528 t['whitesquare'] = 0x25A1; 12529 t['whitestar'] = 0x2606; 12530 t['whitetelephone'] = 0x260F; 12531 t['whitetortoiseshellbracketleft'] = 0x3018; 12532 t['whitetortoiseshellbracketright'] = 0x3019; 12533 t['whiteuppointingsmalltriangle'] = 0x25B5; 12534 t['whiteuppointingtriangle'] = 0x25B3; 12535 t['wihiragana'] = 0x3090; 12536 t['wikatakana'] = 0x30F0; 12537 t['wikorean'] = 0x315F; 12538 t['wmonospace'] = 0xFF57; 12539 t['wohiragana'] = 0x3092; 12540 t['wokatakana'] = 0x30F2; 12541 t['wokatakanahalfwidth'] = 0xFF66; 12542 t['won'] = 0x20A9; 12543 t['wonmonospace'] = 0xFFE6; 12544 t['wowaenthai'] = 0x0E27; 12545 t['wparen'] = 0x24B2; 12546 t['wring'] = 0x1E98; 12547 t['wsuperior'] = 0x02B7; 12548 t['wturned'] = 0x028D; 12549 t['wynn'] = 0x01BF; 12550 t['x'] = 0x0078; 12551 t['xabovecmb'] = 0x033D; 12552 t['xbopomofo'] = 0x3112; 12553 t['xcircle'] = 0x24E7; 12554 t['xdieresis'] = 0x1E8D; 12555 t['xdotaccent'] = 0x1E8B; 12556 t['xeharmenian'] = 0x056D; 12557 t['xi'] = 0x03BE; 12558 t['xmonospace'] = 0xFF58; 12559 t['xparen'] = 0x24B3; 12560 t['xsuperior'] = 0x02E3; 12561 t['y'] = 0x0079; 12562 t['yaadosquare'] = 0x334E; 12563 t['yabengali'] = 0x09AF; 12564 t['yacute'] = 0x00FD; 12565 t['yadeva'] = 0x092F; 12566 t['yaekorean'] = 0x3152; 12567 t['yagujarati'] = 0x0AAF; 12568 t['yagurmukhi'] = 0x0A2F; 12569 t['yahiragana'] = 0x3084; 12570 t['yakatakana'] = 0x30E4; 12571 t['yakatakanahalfwidth'] = 0xFF94; 12572 t['yakorean'] = 0x3151; 12573 t['yamakkanthai'] = 0x0E4E; 12574 t['yasmallhiragana'] = 0x3083; 12575 t['yasmallkatakana'] = 0x30E3; 12576 t['yasmallkatakanahalfwidth'] = 0xFF6C; 12577 t['yatcyrillic'] = 0x0463; 12578 t['ycircle'] = 0x24E8; 12579 t['ycircumflex'] = 0x0177; 12580 t['ydieresis'] = 0x00FF; 12581 t['ydotaccent'] = 0x1E8F; 12582 t['ydotbelow'] = 0x1EF5; 12583 t['yeharabic'] = 0x064A; 12584 t['yehbarreearabic'] = 0x06D2; 12585 t['yehbarreefinalarabic'] = 0xFBAF; 12586 t['yehfinalarabic'] = 0xFEF2; 12587 t['yehhamzaabovearabic'] = 0x0626; 12588 t['yehhamzaabovefinalarabic'] = 0xFE8A; 12589 t['yehhamzaaboveinitialarabic'] = 0xFE8B; 12590 t['yehhamzaabovemedialarabic'] = 0xFE8C; 12591 t['yehinitialarabic'] = 0xFEF3; 12592 t['yehmedialarabic'] = 0xFEF4; 12593 t['yehmeeminitialarabic'] = 0xFCDD; 12594 t['yehmeemisolatedarabic'] = 0xFC58; 12595 t['yehnoonfinalarabic'] = 0xFC94; 12596 t['yehthreedotsbelowarabic'] = 0x06D1; 12597 t['yekorean'] = 0x3156; 12598 t['yen'] = 0x00A5; 12599 t['yenmonospace'] = 0xFFE5; 12600 t['yeokorean'] = 0x3155; 12601 t['yeorinhieuhkorean'] = 0x3186; 12602 t['yerahbenyomohebrew'] = 0x05AA; 12603 t['yerahbenyomolefthebrew'] = 0x05AA; 12604 t['yericyrillic'] = 0x044B; 12605 t['yerudieresiscyrillic'] = 0x04F9; 12606 t['yesieungkorean'] = 0x3181; 12607 t['yesieungpansioskorean'] = 0x3183; 12608 t['yesieungsioskorean'] = 0x3182; 12609 t['yetivhebrew'] = 0x059A; 12610 t['ygrave'] = 0x1EF3; 12611 t['yhook'] = 0x01B4; 12612 t['yhookabove'] = 0x1EF7; 12613 t['yiarmenian'] = 0x0575; 12614 t['yicyrillic'] = 0x0457; 12615 t['yikorean'] = 0x3162; 12616 t['yinyang'] = 0x262F; 12617 t['yiwnarmenian'] = 0x0582; 12618 t['ymonospace'] = 0xFF59; 12619 t['yod'] = 0x05D9; 12620 t['yoddagesh'] = 0xFB39; 12621 t['yoddageshhebrew'] = 0xFB39; 12622 t['yodhebrew'] = 0x05D9; 12623 t['yodyodhebrew'] = 0x05F2; 12624 t['yodyodpatahhebrew'] = 0xFB1F; 12625 t['yohiragana'] = 0x3088; 12626 t['yoikorean'] = 0x3189; 12627 t['yokatakana'] = 0x30E8; 12628 t['yokatakanahalfwidth'] = 0xFF96; 12629 t['yokorean'] = 0x315B; 12630 t['yosmallhiragana'] = 0x3087; 12631 t['yosmallkatakana'] = 0x30E7; 12632 t['yosmallkatakanahalfwidth'] = 0xFF6E; 12633 t['yotgreek'] = 0x03F3; 12634 t['yoyaekorean'] = 0x3188; 12635 t['yoyakorean'] = 0x3187; 12636 t['yoyakthai'] = 0x0E22; 12637 t['yoyingthai'] = 0x0E0D; 12638 t['yparen'] = 0x24B4; 12639 t['ypogegrammeni'] = 0x037A; 12640 t['ypogegrammenigreekcmb'] = 0x0345; 12641 t['yr'] = 0x01A6; 12642 t['yring'] = 0x1E99; 12643 t['ysuperior'] = 0x02B8; 12644 t['ytilde'] = 0x1EF9; 12645 t['yturned'] = 0x028E; 12646 t['yuhiragana'] = 0x3086; 12647 t['yuikorean'] = 0x318C; 12648 t['yukatakana'] = 0x30E6; 12649 t['yukatakanahalfwidth'] = 0xFF95; 12650 t['yukorean'] = 0x3160; 12651 t['yusbigcyrillic'] = 0x046B; 12652 t['yusbigiotifiedcyrillic'] = 0x046D; 12653 t['yuslittlecyrillic'] = 0x0467; 12654 t['yuslittleiotifiedcyrillic'] = 0x0469; 12655 t['yusmallhiragana'] = 0x3085; 12656 t['yusmallkatakana'] = 0x30E5; 12657 t['yusmallkatakanahalfwidth'] = 0xFF6D; 12658 t['yuyekorean'] = 0x318B; 12659 t['yuyeokorean'] = 0x318A; 12660 t['yyabengali'] = 0x09DF; 12661 t['yyadeva'] = 0x095F; 12662 t['z'] = 0x007A; 12663 t['zaarmenian'] = 0x0566; 12664 t['zacute'] = 0x017A; 12665 t['zadeva'] = 0x095B; 12666 t['zagurmukhi'] = 0x0A5B; 12667 t['zaharabic'] = 0x0638; 12668 t['zahfinalarabic'] = 0xFEC6; 12669 t['zahinitialarabic'] = 0xFEC7; 12670 t['zahiragana'] = 0x3056; 12671 t['zahmedialarabic'] = 0xFEC8; 12672 t['zainarabic'] = 0x0632; 12673 t['zainfinalarabic'] = 0xFEB0; 12674 t['zakatakana'] = 0x30B6; 12675 t['zaqefgadolhebrew'] = 0x0595; 12676 t['zaqefqatanhebrew'] = 0x0594; 12677 t['zarqahebrew'] = 0x0598; 12678 t['zayin'] = 0x05D6; 12679 t['zayindagesh'] = 0xFB36; 12680 t['zayindageshhebrew'] = 0xFB36; 12681 t['zayinhebrew'] = 0x05D6; 12682 t['zbopomofo'] = 0x3117; 12683 t['zcaron'] = 0x017E; 12684 t['zcircle'] = 0x24E9; 12685 t['zcircumflex'] = 0x1E91; 12686 t['zcurl'] = 0x0291; 12687 t['zdot'] = 0x017C; 12688 t['zdotaccent'] = 0x017C; 12689 t['zdotbelow'] = 0x1E93; 12690 t['zecyrillic'] = 0x0437; 12691 t['zedescendercyrillic'] = 0x0499; 12692 t['zedieresiscyrillic'] = 0x04DF; 12693 t['zehiragana'] = 0x305C; 12694 t['zekatakana'] = 0x30BC; 12695 t['zero'] = 0x0030; 12696 t['zeroarabic'] = 0x0660; 12697 t['zerobengali'] = 0x09E6; 12698 t['zerodeva'] = 0x0966;
12699 t['zerogujarati'] = 0x0AE6; 12700 t['zerogurmukhi'] = 0x0A66; 12701 t['zerohackarabic'] = 0x0660; 12702 t['zeroinferior'] = 0x2080; 12703 t['zeromonospace'] = 0xFF10; 12704 t['zerooldstyle'] = 0xF730; 12705 t['zeropersian'] = 0x06F0; 12706 t['zerosuperior'] = 0x2070; 12707 t['zerothai'] = 0x0E50; 12708 t['zerowidthjoiner'] = 0xFEFF; 12709 t['zerowidthnonjoiner'] = 0x200C; 12710 t['zerowidthspace'] = 0x200B; 12711 t['zeta'] = 0x03B6; 12712 t['zhbopomofo'] = 0x3113; 12713 t['zhearmenian'] = 0x056A; 12714 t['zhebrevecyrillic'] = 0x04C2; 12715 t['zhecyrillic'] = 0x0436; 12716 t['zhedescendercyrillic'] = 0x0497; 12717 t['zhedieresiscyrillic'] = 0x04DD; 12718 t['zihiragana'] = 0x3058; 12719 t['zikatakana'] = 0x30B8; 12720 t['zinorhebrew'] = 0x05AE; 12721 t['zlinebelow'] = 0x1E95; 12722 t['zmonospace'] = 0xFF5A; 12723 t['zohiragana'] = 0x305E; 12724 t['zokatakana'] = 0x30BE; 12725 t['zparen'] = 0x24B5; 12726 t['zretroflexhook'] = 0x0290; 12727 t['zstroke'] = 0x01B6; 12728 t['zuhiragana'] = 0x305A; 12729 t['zukatakana'] = 0x30BA; 12730 t['.notdef'] = 0x0000; 12731 t['angbracketleftbig'] = 0x2329; 12732 t['angbracketleftBig'] = 0x2329; 12733 t['angbracketleftbigg'] = 0x2329; 12734 t['angbracketleftBigg'] = 0x2329; 12735 t['angbracketrightBig'] = 0x232A; 12736 t['angbracketrightbig'] = 0x232A; 12737 t['angbracketrightBigg'] = 0x232A; 12738 t['angbracketrightbigg'] = 0x232A; 12739 t['arrowhookleft'] = 0x21AA; 12740 t['arrowhookright'] = 0x21A9; 12741 t['arrowlefttophalf'] = 0x21BC; 12742 t['arrowleftbothalf'] = 0x21BD; 12743 t['arrownortheast'] = 0x2197; 12744 t['arrownorthwest'] = 0x2196; 12745 t['arrowrighttophalf'] = 0x21C0; 12746 t['arrowrightbothalf'] = 0x21C1; 12747 t['arrowsoutheast'] = 0x2198; 12748 t['arrowsouthwest'] = 0x2199; 12749 t['backslashbig'] = 0x2216; 12750 t['backslashBig'] = 0x2216; 12751 t['backslashBigg'] = 0x2216; 12752 t['backslashbigg'] = 0x2216; 12753 t['bardbl'] = 0x2016; 12754 t['bracehtipdownleft'] = 0xFE37; 12755 t['bracehtipdownright'] = 0xFE37; 12756 t['bracehtipupleft'] = 0xFE38; 12757 t['bracehtipupright'] = 0xFE38; 12758 t['braceleftBig'] = 0x007B; 12759 t['braceleftbig'] = 0x007B; 12760 t['braceleftbigg'] = 0x007B; 12761 t['braceleftBigg'] = 0x007B; 12762 t['bracerightBig'] = 0x007D; 12763 t['bracerightbig'] = 0x007D; 12764 t['bracerightbigg'] = 0x007D; 12765 t['bracerightBigg'] = 0x007D; 12766 t['bracketleftbig'] = 0x005B; 12767 t['bracketleftBig'] = 0x005B; 12768 t['bracketleftbigg'] = 0x005B; 12769 t['bracketleftBigg'] = 0x005B; 12770 t['bracketrightBig'] = 0x005D; 12771 t['bracketrightbig'] = 0x005D; 12772 t['bracketrightbigg'] = 0x005D; 12773 t['bracketrightBigg'] = 0x005D; 12774 t['ceilingleftbig'] = 0x2308; 12775 t['ceilingleftBig'] = 0x2308; 12776 t['ceilingleftBigg'] = 0x2308; 12777 t['ceilingleftbigg'] = 0x2308; 12778 t['ceilingrightbig'] = 0x2309; 12779 t['ceilingrightBig'] = 0x2309; 12780 t['ceilingrightbigg'] = 0x2309; 12781 t['ceilingrightBigg'] = 0x2309; 12782 t['circledotdisplay'] = 0x2299; 12783 t['circledottext'] = 0x2299; 12784 t['circlemultiplydisplay'] = 0x2297; 12785 t['circlemultiplytext'] = 0x2297; 12786 t['circleplusdisplay'] = 0x2295; 12787 t['circleplustext'] = 0x2295; 12788 t['contintegraldisplay'] = 0x222E; 12789 t['contintegraltext'] = 0x222E; 12790 t['coproductdisplay'] = 0x2210; 12791 t['coproducttext'] = 0x2210; 12792 t['floorleftBig'] = 0x230A; 12793 t['floorleftbig'] = 0x230A; 12794 t['floorleftbigg'] = 0x230A; 12795 t['floorleftBigg'] = 0x230A; 12796 t['floorrightbig'] = 0x230B; 12797 t['floorrightBig'] = 0x230B; 12798 t['floorrightBigg'] = 0x230B; 12799 t['floorrightbigg'] = 0x230B; 12800 t['hatwide'] = 0x0302; 12801 t['hatwider'] = 0x0302; 12802 t['hatwidest'] = 0x0302; 12803 t['intercal'] = 0x1D40; 12804 t['integraldisplay'] = 0x222B; 12805 t['integraltext'] = 0x222B; 12806 t['intersectiondisplay'] = 0x22C2; 12807 t['intersectiontext'] = 0x22C2; 12808 t['logicalanddisplay'] = 0x2227; 12809 t['logicalandtext'] = 0x2227; 12810 t['logicalordisplay'] = 0x2228; 12811 t['logicalortext'] = 0x2228; 12812 t['parenleftBig'] = 0x0028; 12813 t['parenleftbig'] = 0x0028; 12814 t['parenleftBigg'] = 0x0028; 12815 t['parenleftbigg'] = 0x0028; 12816 t['parenrightBig'] = 0x0029; 12817 t['parenrightbig'] = 0x0029; 12818 t['parenrightBigg'] = 0x0029; 12819 t['parenrightbigg'] = 0x0029; 12820 t['prime'] = 0x2032; 12821 t['productdisplay'] = 0x220F; 12822 t['producttext'] = 0x220F; 12823 t['radicalbig'] = 0x221A; 12824 t['radicalBig'] = 0x221A; 12825 t['radicalBigg'] = 0x221A; 12826 t['radicalbigg'] = 0x221A; 12827 t['radicalbt'] = 0x221A; 12828 t['radicaltp'] = 0x221A; 12829 t['radicalvertex'] = 0x221A; 12830 t['slashbig'] = 0x002F; 12831 t['slashBig'] = 0x002F; 12832 t['slashBigg'] = 0x002F; 12833 t['slashbigg'] = 0x002F; 12834 t['summationdisplay'] = 0x2211; 12835 t['summationtext'] = 0x2211; 12836 t['tildewide'] = 0x02DC; 12837 t['tildewider'] = 0x02DC; 12838 t['tildewidest'] = 0x02DC; 12839 t['uniondisplay'] = 0x22C3; 12840 t['unionmultidisplay'] = 0x228E; 12841 t['unionmultitext'] = 0x228E; 12842 t['unionsqdisplay'] = 0x2294; 12843 t['unionsqtext'] = 0x2294; 12844 t['uniontext'] = 0x22C3; 12845 t['vextenddouble'] = 0x2225; 12846 t['vextendsingle'] = 0x2223; 12847 }); 12848 var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { 12849 t['space'] = 0x0020; 12850 t['a1'] = 0x2701; 12851 t['a2'] = 0x2702; 12852 t['a202'] = 0x2703; 12853 t['a3'] = 0x2704; 12854 t['a4'] = 0x260E; 12855 t['a5'] = 0x2706; 12856 t['a119'] = 0x2707; 12857 t['a118'] = 0x2708; 12858 t['a117'] = 0x2709; 12859 t['a11'] = 0x261B; 12860 t['a12'] = 0x261E; 12861 t['a13'] = 0x270C; 12862 t['a14'] = 0x270D; 12863 t['a15'] = 0x270E; 12864 t['a16'] = 0x270F; 12865 t['a105'] = 0x2710; 12866 t['a17'] = 0x2711; 12867 t['a18'] = 0x2712; 12868 t['a19'] = 0x2713; 12869 t['a20'] = 0x2714; 12870 t['a21'] = 0x2715; 12871 t['a22'] = 0x2716; 12872 t['a23'] = 0x2717; 12873 t['a24'] = 0x2718; 12874 t['a25'] = 0x2719; 12875 t['a26'] = 0x271A; 12876 t['a27'] = 0x271B; 12877 t['a28'] = 0x271C; 12878 t['a6'] = 0x271D; 12879 t['a7'] = 0x271E; 12880 t['a8'] = 0x271F; 12881 t['a9'] = 0x2720; 12882 t['a10'] = 0x2721; 12883 t['a29'] = 0x2722; 12884 t['a30'] = 0x2723; 12885 t['a31'] = 0x2724; 12886 t['a32'] = 0x2725; 12887 t['a33'] = 0x2726; 12888 t['a34'] = 0x2727; 12889 t['a35'] = 0x2605; 12890 t['a36'] = 0x2729; 12891 t['a37'] = 0x272A; 12892 t['a38'] = 0x272B; 12893 t['a39'] = 0x272C; 12894 t['a40'] = 0x272D; 12895 t['a41'] = 0x272E; 12896 t['a42'] = 0x272F; 12897 t['a43'] = 0x2730; 12898 t['a44'] = 0x2731; 12899 t['a45'] = 0x2732; 12900 t['a46'] = 0x2733; 12901 t['a47'] = 0x2734; 12902 t['a48'] = 0x2735; 12903 t['a49'] = 0x2736; 12904 t['a50'] = 0x2737; 12905 t['a51'] = 0x2738; 12906 t['a52'] = 0x2739; 12907 t['a53'] = 0x273A; 12908 t['a54'] = 0x273B; 12909 t['a55'] = 0x273C; 12910 t['a56'] = 0x273D; 12911 t['a57'] = 0x273E; 12912 t['a58'] = 0x273F; 12913 t['a59'] = 0x2740; 12914 t['a60'] = 0x2741; 12915 t['a61'] = 0x2742; 12916 t['a62'] = 0x2743; 12917 t['a63'] = 0x2744; 12918 t['a64'] = 0x2745; 12919 t['a65'] = 0x2746; 12920 t['a66'] = 0x2747; 12921 t['a67'] = 0x2748; 12922 t['a68'] = 0x2749; 12923 t['a69'] = 0x274A; 12924 t['a70'] = 0x274B; 12925 t['a71'] = 0x25CF; 12926 t['a72'] = 0x274D; 12927 t['a73'] = 0x25A0; 12928 t['a74'] = 0x274F; 12929 t['a203'] = 0x2750; 12930 t['a75'] = 0x2751; 12931 t['a204'] = 0x2752; 12932 t['a76'] = 0x25B2; 12933 t['a77'] = 0x25BC; 12934 t['a78'] = 0x25C6; 12935 t['a79'] = 0x2756; 12936 t['a81'] = 0x25D7; 12937 t['a82'] = 0x2758; 12938 t['a83'] = 0x2759; 12939 t['a84'] = 0x275A; 12940 t['a97'] = 0x275B; 12941 t['a98'] = 0x275C; 12942 t['a99'] = 0x275D; 12943 t['a100'] = 0x275E; 12944 t['a101'] = 0x2761; 12945 t['a102'] = 0x2762; 12946 t['a103'] = 0x2763; 12947 t['a104'] = 0x2764; 12948 t['a106'] = 0x2765; 12949 t['a107'] = 0x2766; 12950 t['a108'] = 0x2767; 12951 t['a112'] = 0x2663; 12952 t['a111'] = 0x2666; 12953 t['a110'] = 0x2665; 12954 t['a109'] = 0x2660; 12955 t['a120'] = 0x2460; 12956 t['a121'] = 0x2461; 12957 t['a122'] = 0x2462; 12958 t['a123'] = 0x2463; 12959 t['a124'] = 0x2464; 12960 t['a125'] = 0x2465; 12961 t['a126'] = 0x2466; 12962 t['a127'] = 0x2467; 12963 t['a128'] = 0x2468; 12964 t['a129'] = 0x2469; 12965 t['a130'] = 0x2776; 12966 t['a131'] = 0x2777; 12967 t['a132'] = 0x2778; 12968 t['a133'] = 0x2779; 12969 t['a134'] = 0x277A;
12970 t['a135'] = 0x277B; 12971 t['a136'] = 0x277C; 12972 t['a137'] = 0x277D; 12973 t['a138'] = 0x277E; 12974 t['a139'] = 0x277F; 12975 t['a140'] = 0x2780; 12976 t['a141'] = 0x2781; 12977 t['a142'] = 0x2782; 12978 t['a143'] = 0x2783; 12979 t['a144'] = 0x2784; 12980 t['a145'] = 0x2785; 12981 t['a146'] = 0x2786; 12982 t['a147'] = 0x2787; 12983 t['a148'] = 0x2788; 12984 t['a149'] = 0x2789; 12985 t['a150'] = 0x278A; 12986 t['a151'] = 0x278B; 12987 t['a152'] = 0x278C; 12988 t['a153'] = 0x278D; 12989 t['a154'] = 0x278E; 12990 t['a155'] = 0x278F; 12991 t['a156'] = 0x2790; 12992 t['a157'] = 0x2791; 12993 t['a158'] = 0x2792; 12994 t['a159'] = 0x2793; 12995 t['a160'] = 0x2794; 12996 t['a161'] = 0x2192; 12997 t['a163'] = 0x2194; 12998 t['a164'] = 0x2195; 12999 t['a196'] = 0x2798; 13000 t['a165'] = 0x2799; 13001 t['a192'] = 0x279A; 13002 t['a166'] = 0x279B; 13003 t['a167'] = 0x279C; 13004 t['a168'] = 0x279D; 13005 t['a169'] = 0x279E; 13006 t['a170'] = 0x279F; 13007 t['a171'] = 0x27A0; 13008 t['a172'] = 0x27A1; 13009 t['a173'] = 0x27A2; 13010 t['a162'] = 0x27A3; 13011 t['a174'] = 0x27A4; 13012 t['a175'] = 0x27A5; 13013 t['a176'] = 0x27A6; 13014 t['a177'] = 0x27A7; 13015 t['a178'] = 0x27A8; 13016 t['a179'] = 0x27A9; 13017 t['a193'] = 0x27AA; 13018 t['a180'] = 0x27AB; 13019 t['a199'] = 0x27AC; 13020 t['a181'] = 0x27AD; 13021 t['a200'] = 0x27AE; 13022 t['a182'] = 0x27AF; 13023 t['a201'] = 0x27B1; 13024 t['a183'] = 0x27B2; 13025 t['a184'] = 0x27B3; 13026 t['a197'] = 0x27B4; 13027 t['a185'] = 0x27B5; 13028 t['a194'] = 0x27B6; 13029 t['a198'] = 0x27B7; 13030 t['a186'] = 0x27B8; 13031 t['a195'] = 0x27B9; 13032 t['a187'] = 0x27BA; 13033 t['a188'] = 0x27BB; 13034 t['a189'] = 0x27BC; 13035 t['a190'] = 0x27BD; 13036 t['a191'] = 0x27BE; 13037 t['a89'] = 0x2768; 13038 t['a90'] = 0x2769; 13039 t['a93'] = 0x276A; 13040 t['a94'] = 0x276B; 13041 t['a91'] = 0x276C; 13042 t['a92'] = 0x276D; 13043 t['a205'] = 0x276E; 13044 t['a85'] = 0x276F; 13045 t['a206'] = 0x2770; 13046 t['a86'] = 0x2771; 13047 t['a87'] = 0x2772; 13048 t['a88'] = 0x2773; 13049 t['a95'] = 0x2774; 13050 t['a96'] = 0x2775; 13051 t['.notdef'] = 0x0000; 13052 }); 13053 exports.getGlyphsUnicode = getGlyphsUnicode; 13054 exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; 13055 })); 13056 (function (root, factory) { 13057 factory(root.pdfjsCoreJbig2 = {}, root.pdfjsSharedUtil, root.pdfjsCoreArithmeticDecoder); 13058 }(this, function (exports, sharedUtil, coreArithmeticDecoder) { 13059 var error = sharedUtil.error; 13060 var log2 = sharedUtil.log2; 13061 var readInt8 = sharedUtil.readInt8; 13062 var readUint16 = sharedUtil.readUint16; 13063 var readUint32 = sharedUtil.readUint32; 13064 var shadow = sharedUtil.shadow; 13065 var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder; 13066 var Jbig2Image = function Jbig2ImageClosure() { 13067 function ContextCache() { 13068 } 13069 ContextCache.prototype = { 13070 getContexts: function (id) { 13071 if (id in this) { 13072 return this[id]; 13073 } 13074 return this[id] = new Int8Array(1 << 16); 13075 } 13076 }; 13077 function DecodingContext(data, start, end) { 13078 this.data = data; 13079 this.start = start; 13080 this.end = end; 13081 } 13082 DecodingContext.prototype = { 13083 get decoder() { 13084 var decoder = new ArithmeticDecoder(this.data, this.start, this.end); 13085 return shadow(this, 'decoder', decoder); 13086 }, 13087 get contextCache() { 13088 var cache = new ContextCache(); 13089 return shadow(this, 'contextCache', cache); 13090 } 13091 }; 13092 function decodeInteger(contextCache, procedure, decoder) { 13093 var contexts = contextCache.getContexts(procedure); 13094 var prev = 1; 13095 function readBits(length) { 13096 var v = 0; 13097 for (var i = 0; i < length; i++) { 13098 var bit = decoder.readBit(contexts, prev); 13099 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 13100 v = v << 1 | bit; 13101 } 13102 return v >>> 0; 13103 } 13104 var sign = readBits(1); 13105 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); 13106 return sign === 0 ? value : value > 0 ? -value : null; 13107 } 13108 function decodeIAID(contextCache, decoder, codeLength) { 13109 var contexts = contextCache.getContexts('IAID'); 13110 var prev = 1; 13111 for (var i = 0; i < codeLength; i++) { 13112 var bit = decoder.readBit(contexts, prev); 13113 prev = prev << 1 | bit; 13114 } 13115 if (codeLength < 31) { 13116 return prev & (1 << codeLength) - 1; 13117 } 13118 return prev & 0x7FFFFFFF; 13119 } 13120 var SegmentTypes = [ 13121 'SymbolDictionary', 13122 null, 13123 null, 13124 null, 13125 'IntermediateTextRegion', 13126 null, 13127 'ImmediateTextRegion', 13128 'ImmediateLosslessTextRegion', 13129 null, 13130 null, 13131 null, 13132 null, 13133 null, 13134 null, 13135 null, 13136 null, 13137 'patternDictionary', 13138 null, 13139 null, 13140 null, 13141 'IntermediateHalftoneRegion', 13142 null, 13143 'ImmediateHalftoneRegion', 13144 'ImmediateLosslessHalftoneRegion', 13145 null, 13146 null, 13147 null, 13148 null, 13149 null, 13150 null, 13151 null, 13152 null, 13153 null, 13154 null, 13155 null, 13156 null, 13157 'IntermediateGenericRegion', 13158 null, 13159 'ImmediateGenericRegion', 13160 'ImmediateLosslessGenericRegion', 13161 'IntermediateGenericRefinementRegion', 13162 null, 13163 'ImmediateGenericRefinementRegion', 13164 'ImmediateLosslessGenericRefinementRegion', 13165 null, 13166 null, 13167 null, 13168 null, 13169 'PageInformation', 13170 'EndOfPage', 13171 'EndOfStripe', 13172 'EndOfFile', 13173 'Profiles', 13174 'Tables', 13175 null, 13176 null, 13177 null, 13178 null, 13179 null, 13180 null, 13181 null, 13182 null, 13183 'Extension' 13184 ]; 13185 var CodingTemplates = [ 13186 [ 13187 { 13188 x: -1, 13189 y: -2 13190 }, 13191 { 13192 x: 0, 13193 y: -2 13194 }, 13195 { 13196 x: 1, 13197 y: -2 13198 }, 13199 { 13200 x: -2, 13201 y: -1 13202 }, 13203 { 13204 x: -1, 13205 y: -1 13206 }, 13207 { 13208 x: 0, 13209 y: -1 13210 }, 13211 { 13212 x: 1, 13213 y: -1 13214 }, 13215 { 13216 x: 2, 13217 y: -1 13218 }, 13219 { 13220 x: -4, 13221 y: 0 13222 }, 13223 { 13224 x: -3, 13225 y: 0 13226 }, 13227 { 13228 x: -2, 13229 y: 0 13230 }, 13231 { 13232 x: -1, 13233 y: 0 13234 } 13235 ], 13236 [ 13237 { 13238 x: -1, 13239 y: -2 13240 }, 13241 { 13242 x: 0, 13243 y: -2 13244 }, 13245 { 13246 x: 1, 13247 y: -2 13248 }, 13249 { 13250 x: 2, 13251 y: -2 13252 }, 13253 { 13254 x: -2, 13255 y: -1 13256 }, 13257 { 13258 x: -1, 13259 y: -1 13260 }, 13261 { 13262 x: 0, 13263 y: -1 13264 }, 13265 { 13266 x: 1, 13267 y: -1 13268 }, 13269 { 13270 x: 2, 13271 y: -1 13272 }, 13273 { 13274 x: -3, 13275 y: 0 13276 }, 13277 { 13278 x: -2, 13279 y: 0 13280 }, 13281 { 13282 x: -1, 13283 y: 0 13284 } 13285 ], 13286 [ 13287 { 13288 x: -1, 13289 y: -2 13290 }, 13291 { 13292 x: 0, 13293 y: -2 13294 }, 13295 { 13296 x: 1, 13297 y: -2 13298 }, 13299 { 13300 x: -2, 13301 y: -1 13302 }, 13303 { 13304 x: -1, 13305 y: -1 13306 }, 13307 { 13308 x: 0, 13309 y: -1 13310 }, 13311 { 13312 x: 1, 13313 y: -1 13314 }, 13315 { 13316 x: -2, 13317 y: 0 13318 }, 13319 { 13320 x: -1, 13321 y: 0 13322 } 13323 ], 13324 [ 13325 { 13326 x: -3, 13327 y: -1 13328 }, 13329 { 13330 x: -2, 13331 y: -1 13332 }, 13333 { 13334 x: -1, 13335 y: -1 13336 }, 13337 { 13338 x: 0, 13339 y: -1 13340 }, 13341 { 13342 x: 1, 13343 y: -1 13344 }, 13345 { 13346 x: -4, 13347 y: 0 13348 }, 13349 { 13350 x: -3, 13351 y: 0 13352 }, 13353 { 13354 x: -2, 13355 y: 0 13356 }, 13357 { 13358 x: -1, 13359 y: 0 13360 } 13361 ] 13362 ]; 13363 var RefinementTemplates = [ 13364 { 13365 coding: [ 13366 { 13367 x: 0, 13368 y: -1 13369 }, 13370 { 13371 x: 1, 13372 y: -1 13373 }, 13374 { 13375 x: -1, 13376 y: 0 13377 } 13378 ], 13379 reference: [ 13380 { 13381 x: 0, 13382 y: -1 13383 }, 13384 { 13385 x: 1, 13386 y: -1 13387 }, 13388 { 13389 x: -1, 13390 y: 0 13391 }, 13392 { 13393 x: 0, 13394 y: 0 13395 }, 13396 { 13397 x: 1, 13398 y: 0 13399 }, 13400 { 13401 x: -1, 13402 y: 1 13403 }, 13404 { 13405 x: 0, 13406 y: 1 13407 }, 13408 { 13409 x: 1, 13410 y: 1 13411 } 13412 ] 13413 }, 13414 { 13415 coding: [ 13416 { 13417 x: -1, 13418 y: -1 13419 }, 13420 { 13421 x: 0, 13422 y: -1 13423 }, 13424 { 13425 x: 1, 13426 y: -1 13427 }, 13428 { 13429 x: -1, 13430 y: 0 13431 } 13432 ], 13433 reference: [ 13434 { 13435 x: 0, 13436 y: -1 13437 }, 13438 { 13439 x: -1, 13440 y: 0 13441 }, 13442 { 13443 x: 0, 13444 y: 0 13445 }, 13446 { 13447 x: 1, 13448 y: 0 13449 }, 13450 { 13451 x: 0, 13452 y: 1 13453 }, 13454 { 13455 x: 1, 13456 y: 1 13457 } 13458 ] 13459 } 13460 ]; 13461 var ReusedContexts = [ 13462 0x9B25, 13463 0x0795, 13464 0x00E5, 13465 0x0195 13466 ]; 13467 var RefinementReusedContexts = [ 13468 0x0020, 13469 0x0008 13470 ]; 13471 function decodeBitmapTemplate0(width, height, decodingContext) { 13472 var decoder = decodingContext.decoder; 13473 var contexts = decodingContext.contextCache.getContexts('GB'); 13474 var contextLabel, i, j, pixel, row, row1, row2, bitmap = []; 13475 var OLD_PIXEL_MASK = 0x7BF7; 13476 for (i = 0; i < height; i++) { 13477 row = bitmap[i] = new Uint8Array(width); 13478 row1 = i < 1 ? row : bitmap[i - 1]; 13479 row2 = i < 2 ? row : bitmap[i - 2]; 13480 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 13481 for (j = 0; j < width; j++) { 13482 row[j] = pixel = decoder.readBit(contexts, contextLabel); 13483 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 13484 } 13485 } 13486 return bitmap; 13487 } 13488 function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 13489 if (mmr) { 13490 error('JBIG2 error: MMR encoding is not supported'); 13491 } 13492 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) { 13493 return decodeBitmapTemplate0(width, height, decodingContext); 13494 } 13495 var useskip = !!skip; 13496 var template = CodingTemplates[templateIndex].concat(at); 13497 template.sort(function (a, b) { 13498 return a.y - b.y || a.x - b.x; 13499 }); 13500 var templateLength = template.length; 13501 var templateX = new Int8Array(templateLength); 13502 var templateY = new Int8Array(templateLength); 13503 var changingTemplateEntries = []; 13504 var reuseMask = 0, minX = 0, maxX = 0, minY = 0; 13505 var c, k; 13506 for (k = 0; k < templateLength; k++) { 13507 templateX[k] = template[k].x; 13508 templateY[k] = template[k].y; 13509 minX = Math.min(minX, template[k].x); 13510 maxX = Math.max(maxX, template[k].x); 13511 minY = Math.min(minY, template[k].y); 13512 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 13513 reuseMask |= 1 << templateLength - 1 - k; 13514 } else { 13515 changingTemplateEntries.push(k); 13516 } 13517 } 13518 var changingEntriesLength = changingTemplateEntries.length; 13519 var changingTemplateX = new Int8Array(changingEntriesLength); 13520 var changingTemplateY = new Int8Array(changingEntriesLength); 13521 var changingTemplateBit = new Uint16Array(changingEntriesLength); 13522 for (c = 0; c < changingEntriesLength; c++) { 13523 k = changingTemplateEntries[c]; 13524 changingTemplateX[c] = template[k].x; 13525 changingTemplateY[c] = template[k].y; 13526 changingTemplateBit[c] = 1 << templateLength - 1 - k; 13527 } 13528 var sbb_left = -minX; 13529 var sbb_top = -minY; 13530 var sbb_right = width - maxX; 13531 var pseudoPixelContext = ReusedContexts[templateIndex]; 13532 var row = new Uint8Array(width); 13533 var bitmap = []; 13534 var decoder = decodingContext.decoder; 13535 var contexts = decodingContext.contextCache.getContexts('GB'); 13536 var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift; 13537 for (var i = 0; i < height; i++) { 13538 if (prediction) { 13539 var sltp = decoder.readBit(contexts, pseudoPixelContext); 13540 ltp ^= sltp; 13541 if (ltp) { 13542 bitmap.push(row); 13543 continue; 13544 } 13545 } 13546 row = new Uint8Array(row); 13547 bitmap.push(row); 13548 for (j = 0; j < width; j++) { 13549 if (useskip && skip[i][j]) { 13550 row[j] = 0; 13551 continue; 13552 } 13553 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 13554 contextLabel = contextLabel << 1 & reuseMask; 13555 for (k = 0; k < changingEntriesLength; k++) { 13556 i0 = i + changingTemplateY[k]; 13557 j0 = j + changingTemplateX[k];
13558 bit = bitmap[i0][j0]; 13559 if (bit) { 13560 bit = changingTemplateBit[k]; 13561 contextLabel |= bit; 13562 } 13563 } 13564 } else { 13565 contextLabel = 0; 13566 shift = templateLength - 1; 13567 for (k = 0; k < templateLength; k++, shift--) { 13568 j0 = j + templateX[k]; 13569 if (j0 >= 0 && j0 < width) { 13570 i0 = i + templateY[k]; 13571 if (i0 >= 0) { 13572 bit = bitmap[i0][j0]; 13573 if (bit) { 13574 contextLabel |= bit << shift; 13575 } 13576 } 13577 } 13578 } 13579 } 13580 var pixel = decoder.readBit(contexts, contextLabel); 13581 row[j] = pixel; 13582 } 13583 } 13584 return bitmap; 13585 } 13586 function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 13587 var codingTemplate = RefinementTemplates[templateIndex].coding; 13588 if (templateIndex === 0) { 13589 codingTemplate = codingTemplate.concat([at[0]]); 13590 } 13591 var codingTemplateLength = codingTemplate.length; 13592 var codingTemplateX = new Int32Array(codingTemplateLength); 13593 var codingTemplateY = new Int32Array(codingTemplateLength); 13594 var k; 13595 for (k = 0; k < codingTemplateLength; k++) { 13596 codingTemplateX[k] = codingTemplate[k].x; 13597 codingTemplateY[k] = codingTemplate[k].y; 13598 } 13599 var referenceTemplate = RefinementTemplates[templateIndex].reference; 13600 if (templateIndex === 0) { 13601 referenceTemplate = referenceTemplate.concat([at[1]]); 13602 } 13603 var referenceTemplateLength = referenceTemplate.length; 13604 var referenceTemplateX = new Int32Array(referenceTemplateLength); 13605 var referenceTemplateY = new Int32Array(referenceTemplateLength); 13606 for (k = 0; k < referenceTemplateLength; k++) { 13607 referenceTemplateX[k] = referenceTemplate[k].x; 13608 referenceTemplateY[k] = referenceTemplate[k].y; 13609 } 13610 var referenceWidth = referenceBitmap[0].length; 13611 var referenceHeight = referenceBitmap.length; 13612 var pseudoPixelContext = RefinementReusedContexts[templateIndex]; 13613 var bitmap = []; 13614 var decoder = decodingContext.decoder; 13615 var contexts = decodingContext.contextCache.getContexts('GR'); 13616 var ltp = 0; 13617 for (var i = 0; i < height; i++) { 13618 if (prediction) { 13619 var sltp = decoder.readBit(contexts, pseudoPixelContext); 13620 ltp ^= sltp; 13621 if (ltp) { 13622 error('JBIG2 error: prediction is not supported'); 13623 } 13624 } 13625 var row = new Uint8Array(width); 13626 bitmap.push(row); 13627 for (var j = 0; j < width; j++) { 13628 var i0, j0; 13629 var contextLabel = 0; 13630 for (k = 0; k < codingTemplateLength; k++) { 13631 i0 = i + codingTemplateY[k]; 13632 j0 = j + codingTemplateX[k]; 13633 if (i0 < 0 || j0 < 0 || j0 >= width) { 13634 contextLabel <<= 1; 13635 } else 13636 { 13637 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 13638 } 13639 } 13640 for (k = 0; k < referenceTemplateLength; k++) { 13641 i0 = i + referenceTemplateY[k] + offsetY; 13642 j0 = j + referenceTemplateX[k] + offsetX; 13643 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 13644 contextLabel <<= 1; 13645 } else 13646 { 13647 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 13648 } 13649 } 13650 var pixel = decoder.readBit(contexts, contextLabel); 13651 row[j] = pixel; 13652 } 13653 } 13654 return bitmap; 13655 } 13656 function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) { 13657 if (huffman) { 13658 error('JBIG2 error: huffman is not supported'); 13659 } 13660 var newSymbols = []; 13661 var currentHeight = 0; 13662 var symbolCodeLength = log2(symbols.length + numberOfNewSymbols); 13663 var decoder = decodingContext.decoder; 13664 var contextCache = decodingContext.contextCache; 13665 while (newSymbols.length < numberOfNewSymbols) { 13666 var deltaHeight = decodeInteger(contextCache, 'IADH', decoder); 13667 currentHeight += deltaHeight; 13668 var currentWidth = 0; 13669 while (true) { 13670 var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); 13671 if (deltaWidth === null) { 13672 break; 13673 } 13674 currentWidth += deltaWidth; 13675 var bitmap; 13676 if (refinement) { 13677 var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder); 13678 if (numberOfInstances > 1) { 13679 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext); 13680 } else { 13681 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 13682 var rdx = decodeInteger(contextCache, 'IARDX', decoder); 13683 var rdy = decodeInteger(contextCache, 'IARDY', decoder); 13684 var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 13685 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 13686 } 13687 } else { 13688 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 13689 } 13690 newSymbols.push(bitmap); 13691 } 13692 } 13693 var exportedSymbols = []; 13694 var flags = [], currentFlag = false;
13695 var totalSymbolsLength = symbols.length + numberOfNewSymbols; 13696 while (flags.length < totalSymbolsLength) { 13697 var runLength = decodeInteger(contextCache, 'IAEX', decoder); 13698 while (runLength--) { 13699 flags.push(currentFlag); 13700 } 13701 currentFlag = !currentFlag; 13702 } 13703 for (var i = 0, ii = symbols.length; i < ii; i++) { 13704 if (flags[i]) { 13705 exportedSymbols.push(symbols[i]); 13706 } 13707 } 13708 for (var j = 0; j < numberOfNewSymbols; i++, j++) { 13709 if (flags[i]) { 13710 exportedSymbols.push(newSymbols[j]); 13711 } 13712 } 13713 return exportedSymbols; 13714 } 13715 function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) { 13716 if (huffman) { 13717 error('JBIG2 error: huffman is not supported'); 13718 } 13719 var bitmap = []; 13720 var i, row; 13721 for (i = 0; i < height; i++) { 13722 row = new Uint8Array(width); 13723 if (defaultPixelValue) { 13724 for (var j = 0; j < width; j++) { 13725 row[j] = defaultPixelValue; 13726 } 13727 } 13728 bitmap.push(row); 13729 } 13730 var decoder = decodingContext.decoder; 13731 var contextCache = decodingContext.contextCache; 13732 var stripT = -decodeInteger(contextCache, 'IADT', decoder); 13733 var firstS = 0; 13734 i = 0; 13735 while (i < numberOfSymbolInstances) { 13736 var deltaT = decodeInteger(contextCache, 'IADT', decoder); 13737 stripT += deltaT; 13738 var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder); 13739 firstS += deltaFirstS; 13740 var currentS = firstS; 13741 do { 13742 var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder); 13743 var t = stripSize * stripT + currentT; 13744 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 13745 var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder); 13746 var symbolBitmap = inputSymbols[symbolId];
13747 var symbolWidth = symbolBitmap[0].length; 13748 var symbolHeight = symbolBitmap.length; 13749 if (applyRefinement) { 13750 var rdw = decodeInteger(contextCache, 'IARDW', decoder); 13751 var rdh = decodeInteger(contextCache, 'IARDH', decoder); 13752 var rdx = decodeInteger(contextCache, 'IARDX', decoder); 13753 var rdy = decodeInteger(contextCache, 'IARDY', decoder); 13754 symbolWidth += rdw; 13755 symbolHeight += rdh; 13756 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 13757 } 13758 var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight); 13759 var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0); 13760 var s2, t2, symbolRow; 13761 if (transposed) { 13762 for (s2 = 0; s2 < symbolHeight; s2++) { 13763 row = bitmap[offsetS + s2]; 13764 if (!row) { 13765 continue; 13766 } 13767 symbolRow = symbolBitmap[s2]; 13768 var maxWidth = Math.min(width - offsetT, symbolWidth); 13769 switch (combinationOperator) { 13770 case 0: 13771 for (t2 = 0; t2 < maxWidth; t2++) { 13772 row[offsetT + t2] |= symbolRow[t2]; 13773 } 13774 break; 13775 case 2: 13776 for (t2 = 0; t2 < maxWidth; t2++) { 13777 row[offsetT + t2] ^= symbolRow[t2]; 13778 } 13779 break; 13780 default: 13781 error('JBIG2 error: operator ' + combinationOperator + ' is not supported'); 13782 } 13783 } 13784 currentS += symbolHeight - 1; 13785 } else { 13786 for (t2 = 0; t2 < symbolHeight; t2++) { 13787 row = bitmap[offsetT + t2]; 13788 if (!row) { 13789 continue; 13790 } 13791 symbolRow = symbolBitmap[t2]; 13792 switch (combinationOperator) { 13793 case 0: 13794 for (s2 = 0; s2 < symbolWidth; s2++) { 13795 row[offsetS + s2] |= symbolRow[s2]; 13796 } 13797 break; 13798 case 2: 13799 for (s2 = 0; s2 < symbolWidth; s2++) { 13800 row[offsetS + s2] ^= symbolRow[s2]; 13801 } 13802 break; 13803 default: 13804 error('JBIG2 error: operator ' + combinationOperator + ' is not supported'); 13805 } 13806 } 13807 currentS += symbolWidth - 1; 13808 } 13809 i++; 13810 var deltaS = decodeInteger(contextCache, 'IADS', decoder); 13811 if (deltaS === null) { 13812 break; 13813 } 13814 currentS += deltaS + dsOffset; 13815 } while (true); 13816 } 13817 return bitmap; 13818 } 13819 function readSegmentHeader(data, start) { 13820 var segmentHeader = {}; 13821 segmentHeader.number = readUint32(data, start); 13822 var flags = data[start + 4]; 13823 var segmentType = flags & 0x3F; 13824 if (!SegmentTypes[segmentType]) { 13825 error('JBIG2 error: invalid segment type: ' + segmentType); 13826 } 13827 segmentHeader.type = segmentType; 13828 segmentHeader.typeName = SegmentTypes[segmentType]; 13829 segmentHeader.deferredNonRetain = !!(flags & 0x80); 13830 var pageAssociationFieldSize = !!(flags & 0x40); 13831 var referredFlags = data[start + 5]; 13832 var referredToCount = referredFlags >> 5 & 7; 13833 var retainBits = [referredFlags & 31]; 13834 var position = start + 6; 13835 if (referredFlags === 7) { 13836 referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF; 13837 position += 3; 13838 var bytes = referredToCount + 7 >> 3; 13839 retainBits[0] = data[position++]; 13840 while (--bytes > 0) { 13841 retainBits.push(data[position++]); 13842 } 13843 } else if (referredFlags === 5 || referredFlags === 6) { 13844 error('JBIG2 error: invalid referred-to flags'); 13845 } 13846 segmentHeader.retainBits = retainBits; 13847 var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4; 13848 var referredTo = []; 13849 var i, ii; 13850 for (i = 0; i < referredToCount; i++) { 13851 var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position); 13852 referredTo.push(number); 13853 position += referredToSegmentNumberSize; 13854 } 13855 segmentHeader.referredTo = referredTo; 13856 if (!pageAssociationFieldSize) { 13857 segmentHeader.pageAssociation = data[position++]; 13858 } else { 13859 segmentHeader.pageAssociation = readUint32(data, position); 13860 position += 4; 13861 } 13862 segmentHeader.length = readUint32(data, position); 13863 position += 4; 13864 if (segmentHeader.length === 0xFFFFFFFF) { 13865 if (segmentType === 38) { 13866 var genericRegionInfo = readRegionSegmentInformation(data, position); 13867 var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 13868 var genericRegionMmr = !!(genericRegionSegmentFlags & 1); 13869 var searchPatternLength = 6; 13870 var searchPattern = new Uint8Array(searchPatternLength); 13871 if (!genericRegionMmr) { 13872 searchPattern[0] = 0xFF; 13873 searchPattern[1] = 0xAC; 13874 } 13875 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF; 13876 searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF; 13877 searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF; 13878 searchPattern[5] = genericRegionInfo.height & 0xFF; 13879 for (i = position, ii = data.length; i < ii; i++) { 13880 var j = 0; 13881 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 13882 j++; 13883 } 13884 if (j === searchPatternLength) { 13885 segmentHeader.length = i + searchPatternLength; 13886 break; 13887 } 13888 } 13889 if (segmentHeader.length === 0xFFFFFFFF) { 13890 error('JBIG2 error: segment end was not found'); 13891 } 13892 } else { 13893 error('JBIG2 error: invalid unknown segment length'); 13894 } 13895 } 13896 segmentHeader.headerEnd = position; 13897 return segmentHeader; 13898 } 13899 function readSegments(header, data, start, end) { 13900 var segments = []; 13901 var position = start; 13902 while (position < end) { 13903 var segmentHeader = readSegmentHeader(data, position); 13904 position = segmentHeader.headerEnd; 13905 var segment = { 13906 header: segmentHeader, 13907 data: data 13908 }; 13909 if (!header.randomAccess) { 13910 segment.start = position; 13911 position += segmentHeader.length; 13912 segment.end = position; 13913 } 13914 segments.push(segment); 13915 if (segmentHeader.type === 51) { 13916 break; 13917 } 13918 } 13919 if (header.randomAccess) { 13920 for (var i = 0, ii = segments.length; i < ii; i++) { 13921 segments[i].start = position; 13922 position += segments[i].header.length; 13923 segments[i].end = position; 13924 } 13925 } 13926 return segments; 13927 } 13928 function readRegionSegmentInformation(data, start) { 13929 return { 13930 width: readUint32(data, start), 13931 height: readUint32(data, start + 4), 13932 x: readUint32(data, start + 8), 13933 y: readUint32(data, start + 12), 13934 combinationOperator: data[start + 16] & 7 13935 }; 13936 } 13937 var RegionSegmentInformationFieldLength = 17; 13938 function processSegment(segment, visitor) { 13939 var header = segment.header; 13940 var data = segment.data, position = segment.start, end = segment.end; 13941 var args, at, i, atLength; 13942 switch (header.type) {
13943 case 0: 13944 var dictionary = {}; 13945 var dictionaryFlags = readUint16(data, position); 13946 dictionary.huffman = !!(dictionaryFlags & 1); 13947 dictionary.refinement = !!(dictionaryFlags & 2); 13948 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 13949 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 13950 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 13951 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 13952 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 13953 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 13954 dictionary.template = dictionaryFlags >> 10 & 3; 13955 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 13956 position += 2; 13957 if (!dictionary.huffman) { 13958 atLength = dictionary.template === 0 ? 4 : 1; 13959 at = []; 13960 for (i = 0; i < atLength; i++) { 13961 at.push({ 13962 x: readInt8(data, position), 13963 y: readInt8(data, position + 1) 13964 }); 13965 position += 2; 13966 } 13967 dictionary.at = at; 13968 } 13969 if (dictionary.refinement && !dictionary.refinementTemplate) { 13970 at = []; 13971 for (i = 0; i < 2; i++) { 13972 at.push({ 13973 x: readInt8(data, position), 13974 y: readInt8(data, position + 1) 13975 }); 13976 position += 2; 13977 } 13978 dictionary.refinementAt = at; 13979 } 13980 dictionary.numberOfExportedSymbols = readUint32(data, position); 13981 position += 4; 13982 dictionary.numberOfNewSymbols = readUint32(data, position); 13983 position += 4; 13984 args = [ 13985 dictionary, 13986 header.number, 13987 header.referredTo, 13988 data, 13989 position, 13990 end 13991 ]; 13992 break; 13993 case 6: 13994 case 7: 13995 var textRegion = {}; 13996 textRegion.info = readRegionSegmentInformation(data, position); 13997 position += RegionSegmentInformationFieldLength; 13998 var textRegionSegmentFlags = readUint16(data, position); 13999 position += 2; 14000 textRegion.huffman = !!(textRegionSegmentFlags & 1); 14001 textRegion.refinement = !!(textRegionSegmentFlags & 2); 14002 textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3); 14003 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 14004 textRegion.transposed = !!(textRegionSegmentFlags & 64); 14005 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 14006 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 14007 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 14008 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 14009 if (textRegion.huffman) { 14010 var textRegionHuffmanFlags = readUint16(data, position); 14011 position += 2; 14012 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 14013 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 14014 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 14015 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 14016 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 14017 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 14018 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 14019 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14); 14020 } 14021 if (textRegion.refinement && !textRegion.refinementTemplate) { 14022 at = []; 14023 for (i = 0; i < 2; i++) { 14024 at.push({ 14025 x: readInt8(data, position), 14026 y: readInt8(data, position + 1) 14027 }); 14028 position += 2; 14029 } 14030 textRegion.refinementAt = at; 14031 } 14032 textRegion.numberOfSymbolInstances = readUint32(data, position); 14033 position += 4; 14034 if (textRegion.huffman) { 14035 error('JBIG2 error: huffman is not supported'); 14036 } 14037 args = [ 14038 textRegion, 14039 header.referredTo, 14040 data, 14041 position, 14042 end 14043 ]; 14044 break; 14045 case 38: 14046 case 39: 14047 var genericRegion = {}; 14048 genericRegion.info = readRegionSegmentInformation(data, position); 14049 position += RegionSegmentInformationFieldLength; 14050 var genericRegionSegmentFlags = data[position++]; 14051 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 14052 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 14053 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 14054 if (!genericRegion.mmr) { 14055 atLength = genericRegion.template === 0 ? 4 : 1; 14056 at = []; 14057 for (i = 0; i < atLength; i++) { 14058 at.push({ 14059 x: readInt8(data, position), 14060 y: readInt8(data, position + 1) 14061 }); 14062 position += 2; 14063 } 14064 genericRegion.at = at; 14065 } 14066 args = [ 14067 genericRegion, 14068 data, 14069 position, 14070 end 14071 ]; 14072 break; 14073 case 48: 14074 var pageInfo = { 14075 width: readUint32(data, position), 14076 height: readUint32(data, position + 4), 14077 resolutionX: readUint32(data, position + 8), 14078 resolutionY: readUint32(data, position + 12) 14079 }; 14080 if (pageInfo.height === 0xFFFFFFFF) { 14081 delete pageInfo.height; 14082 } 14083 var pageSegmentFlags = data[position + 16]; 14084 readUint16(data, position + 17); 14085 pageInfo.lossless = !!(pageSegmentFlags & 1); 14086 pageInfo.refinement = !!(pageSegmentFlags & 2); 14087 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 14088 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 14089 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 14090 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 14091 args = [pageInfo]; 14092 break; 14093 case 49: 14094 break; 14095 case 50: 14096 break; 14097 case 51: 14098 break; 14099 case 62: 14100 break; 14101 default: 14102 error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented'); 14103 } 14104 var callbackName = 'on' + header.typeName; 14105 if (callbackName in visitor) { 14106 visitor[callbackName].apply(visitor, args); 14107 } 14108 } 14109 function processSegments(segments, visitor) { 14110 for (var i = 0, ii = segments.length; i < ii; i++) { 14111 processSegment(segments[i], visitor); 14112 } 14113 } 14114 function parseJbig2(data, start, end) { 14115 var position = start; 14116 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) { 14117 error('JBIG2 error: invalid header'); 14118 } 14119 var header = {}; 14120 position += 8; 14121 var flags = data[position++]; 14122 header.randomAccess = !(flags & 1); 14123 if (!(flags & 2)) { 14124 header.numberOfPages = readUint32(data, position); 14125 position += 4; 14126 } 14127 readSegments(header, data, position, end); 14128 error('Not implemented'); 14129 } 14130 function parseJbig2Chunks(chunks) { 14131 var visitor = new SimpleSegmentVisitor(); 14132 for (var i = 0, ii = chunks.length; i < ii; i++) { 14133 var chunk = chunks[i]; 14134 var segments = readSegments({}, chunk.data, chunk.start, chunk.end); 14135 processSegments(segments, visitor); 14136 } 14137 return visitor.buffer; 14138 } 14139 function SimpleSegmentVisitor() { 14140 } 14141 SimpleSegmentVisitor.prototype = { 14142 onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) { 14143 this.currentPageInfo = info; 14144 var rowSize = info.width + 7 >> 3; 14145 var buffer = new Uint8Array(rowSize * info.height); 14146 if (info.defaultPixelValue) { 14147 for (var i = 0, ii = buffer.length; i < ii; i++) { 14148 buffer[i] = 0xFF; 14149 } 14150 } 14151 this.buffer = buffer; 14152 }, 14153 drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) { 14154 var pageInfo = this.currentPageInfo; 14155 var width = regionInfo.width, height = regionInfo.height; 14156 var rowSize = pageInfo.width + 7 >> 3; 14157 var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 14158 var buffer = this.buffer; 14159 var mask0 = 128 >> (regionInfo.x & 7); 14160 var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 14161 var i, j, mask, offset; 14162 switch (combinationOperator) { 14163 case 0: 14164 for (i = 0; i < height; i++) { 14165 mask = mask0; 14166 offset = offset0; 14167 for (j = 0; j < width; j++) { 14168 if (bitmap[i][j]) { 14169 buffer[offset] |= mask; 14170 } 14171 mask >>= 1; 14172 if (!mask) { 14173 mask = 128; 14174 offset++; 14175 } 14176 } 14177 offset0 += rowSize; 14178 } 14179 break; 14180 case 2: 14181 for (i = 0; i < height; i++) { 14182 mask = mask0; 14183 offset = offset0; 14184 for (j = 0; j < width; j++) { 14185 if (bitmap[i][j]) { 14186 buffer[offset] ^= mask; 14187 } 14188 mask >>= 1; 14189 if (!mask) { 14190 mask = 128; 14191 offset++; 14192 } 14193 } 14194 offset0 += rowSize; 14195 } 14196 break; 14197 default: 14198 error('JBIG2 error: operator ' + combinationOperator + ' is not supported'); 14199 } 14200 }, 14201 onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) { 14202 var regionInfo = region.info; 14203 var decodingContext = new DecodingContext(data, start, end); 14204 var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 14205 this.drawBitmap(regionInfo, bitmap); 14206 }, 14207 onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() { 14208 this.onImmediateGenericRegion.apply(this, arguments); 14209 }, 14210 onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 14211 var huffmanTables; 14212 if (dictionary.huffman) { 14213 error('JBIG2 error: huffman is not supported'); 14214 } 14215 var symbols = this.symbols; 14216 if (!symbols) { 14217 this.symbols = symbols = {}; 14218 } 14219 var inputSymbols = []; 14220 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 14221 inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]); 14222 } 14223 var decodingContext = new DecodingContext(data, start, end); 14224 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext); 14225 }, 14226 onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) { 14227 var regionInfo = region.info; 14228 var huffmanTables; 14229 var symbols = this.symbols; 14230 var inputSymbols = []; 14231 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 14232 inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]); 14233 } 14234 var symbolCodeLength = log2(inputSymbols.length); 14235 var decodingContext = new DecodingContext(data, start, end); 14236 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); 14237 this.drawBitmap(regionInfo, bitmap); 14238 }, 14239 onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() { 14240 this.onImmediateTextRegion.apply(this, arguments); 14241 } 14242 }; 14243 function Jbig2Image() { 14244 } 14245 Jbig2Image.prototype = { 14246 parseChunks: function Jbig2Image_parseChunks(chunks) { 14247 return parseJbig2Chunks(chunks); 14248 } 14249 }; 14250 return Jbig2Image; 14251 }(); 14252 exports.Jbig2Image = Jbig2Image; 14253 })); 14254 (function (root, factory) { 14255 factory(root.pdfjsCoreJpg = {}, root.pdfjsSharedUtil); 14256 }(this, function (exports, sharedUtil) { 14257 var error = sharedUtil.error; 14258 var JpegImage = function JpegImageClosure() { 14259 var dctZigZag = new Uint8Array([ 14260 0, 14261 1, 14262 8, 14263 16, 14264 9, 14265 2, 14266 3, 14267 10, 14268 17, 14269 24, 14270 32, 14271 25, 14272 18, 14273 11, 14274 4, 14275 5, 14276 12, 14277 19, 14278 26, 14279 33, 14280 40, 14281 48, 14282 41, 14283 34, 14284 27, 14285 20, 14286 13, 14287 6, 14288 7, 14289 14, 14290 21, 14291 28, 14292 35, 14293 42, 14294 49, 14295 56, 14296 57, 14297 50, 14298 43, 14299 36, 14300 29, 14301 22, 14302 15, 14303 23, 14304 30, 14305 37, 14306 44, 14307 51, 14308 58, 14309 59, 14310 52, 14311 45, 14312 38, 14313 31, 14314 39, 14315 46, 14316 53, 14317 60, 14318 61, 14319 54, 14320 47, 14321 55, 14322 62, 14323 63 14324 ]); 14325 var dctCos1 = 4017; 14326 var dctSin1 = 799; 14327 var dctCos3 = 3406; 14328 var dctSin3 = 2276; 14329 var dctCos6 = 1567; 14330 var dctSin6 = 3784; 14331 var dctSqrt2 = 5793; 14332 var dctSqrt1d2 = 2896; 14333 function JpegImage() { 14334 this.decodeTransform = null; 14335 this.colorTransform = -1; 14336 } 14337 function buildHuffmanTable(codeLengths, values) { 14338 var k = 0, code = [], i, j, length = 16; 14339 while (length > 0 && !codeLengths[length - 1]) { 14340 length--; 14341 } 14342 code.push({ 14343 children: [], 14344 index: 0 14345 }); 14346 var p = code[0], q; 14347 for (i = 0; i < length; i++) { 14348 for (j = 0; j < codeLengths[i]; j++) { 14349 p = code.pop(); 14350 p.children[p.index] = values[k]; 14351 while (p.index > 0) { 14352 p = code.pop(); 14353 } 14354 p.index++; 14355 code.push(p); 14356 while (code.length <= i) { 14357 code.push(q = { 14358 children: [], 14359 index: 0 14360 }); 14361 p.children[p.index] = q.children; 14362 p = q; 14363 } 14364 k++; 14365 } 14366 if (i + 1 < length) { 14367 code.push(q = { 14368 children: [], 14369 index: 0 14370 }); 14371 p.children[p.index] = q.children; 14372 p = q; 14373 } 14374 } 14375 return code[0].children; 14376 } 14377 function getBlockBufferOffset(component, row, col) { 14378 return 64 * ((component.blocksPerLine + 1) * row + col); 14379 } 14380 function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) { 14381 var mcusPerLine = frame.mcusPerLine; 14382 var progressive = frame.progressive; 14383 var startOffset = offset, bitsData = 0, bitsCount = 0; 14384 function readBit() { 14385 if (bitsCount > 0) { 14386 bitsCount--; 14387 return bitsData >> bitsCount & 1; 14388 } 14389 bitsData = data[offset++]; 14390 if (bitsData === 0xFF) { 14391 var nextByte = data[offset++]; 14392 if (nextByte) { 14393 error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16)); 14394 } 14395 } 14396 bitsCount = 7; 14397 return bitsData >>> 7; 14398 } 14399 function decodeHuffman(tree) { 14400 var node = tree; 14401 while (true) { 14402 node = node[readBit()]; 14403 if (typeof node === 'number') { 14404 return node; 14405 } 14406 if (typeof node !== 'object') { 14407 error('JPEG error: invalid huffman sequence'); 14408 } 14409 } 14410 } 14411 function receive(length) { 14412 var n = 0; 14413 while (length > 0) { 14414 n = n << 1 | readBit(); 14415 length--; 14416 } 14417 return n; 14418 } 14419 function receiveAndExtend(length) { 14420 if (length === 1) { 14421 return readBit() === 1 ? 1 : -1; 14422 } 14423 var n = receive(length); 14424 if (n >= 1 << length - 1) { 14425 return n; 14426 } 14427 return n + (-1 << length) + 1; 14428 } 14429 function decodeBaseline(component, offset) { 14430 var t = decodeHuffman(component.huffmanTableDC); 14431 var diff = t === 0 ? 0 : receiveAndExtend(t); 14432 component.blockData[offset] = component.pred += diff; 14433 var k = 1; 14434 while (k < 64) { 14435 var rs = decodeHuffman(component.huffmanTableAC); 14436 var s = rs & 15, r = rs >> 4; 14437 if (s === 0) { 14438 if (r < 15) { 14439 break; 14440 } 14441 k += 16; 14442 continue; 14443 } 14444 k += r; 14445 var z = dctZigZag[k]; 14446 component.blockData[offset + z] = receiveAndExtend(s); 14447 k++; 14448 } 14449 } 14450 function decodeDCFirst(component, offset) { 14451 var t = decodeHuffman(component.huffmanTableDC); 14452 var diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 14453 component.blockData[offset] = component.pred += diff; 14454 } 14455 function decodeDCSuccessive(component, offset) { 14456 component.blockData[offset] |= readBit() << successive; 14457 }
14458 var eobrun = 0; 14459 function decodeACFirst(component, offset) { 14460 if (eobrun > 0) { 14461 eobrun--; 14462 return; 14463 } 14464 var k = spectralStart, e = spectralEnd; 14465 while (k <= e) { 14466 var rs = decodeHuffman(component.huffmanTableAC); 14467 var s = rs & 15, r = rs >> 4; 14468 if (s === 0) { 14469 if (r < 15) { 14470 eobrun = receive(r) + (1 << r) - 1; 14471 break; 14472 } 14473 k += 16; 14474 continue; 14475 } 14476 k += r; 14477 var z = dctZigZag[k]; 14478 component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive); 14479 k++; 14480 } 14481 } 14482 var successiveACState = 0, successiveACNextValue; 14483 function decodeACSuccessive(component, offset) { 14484 var k = spectralStart; 14485 var e = spectralEnd; 14486 var r = 0; 14487 var s; 14488 var rs; 14489 while (k <= e) { 14490 var z = dctZigZag[k]; 14491 switch (successiveACState) { 14492 case 0: 14493 rs = decodeHuffman(component.huffmanTableAC); 14494 s = rs & 15; 14495 r = rs >> 4; 14496 if (s === 0) { 14497 if (r < 15) { 14498 eobrun = receive(r) + (1 << r); 14499 successiveACState = 4; 14500 } else { 14501 r = 16; 14502 successiveACState = 1; 14503 } 14504 } else { 14505 if (s !== 1) { 14506 error('JPEG error: invalid ACn encoding'); 14507 } 14508 successiveACNextValue = receiveAndExtend(s); 14509 successiveACState = r ? 2 : 3; 14510 } 14511 continue; 14512 case 1: 14513 case 2: 14514 if (component.blockData[offset + z]) { 14515 component.blockData[offset + z] += readBit() << successive; 14516 } else { 14517 r--; 14518 if (r === 0) { 14519 successiveACState = successiveACState === 2 ? 3 : 0; 14520 } 14521 } 14522 break; 14523 case 3: 14524 if (component.blockData[offset + z]) { 14525 component.blockData[offset + z] += readBit() << successive; 14526 } else { 14527 component.blockData[offset + z] = successiveACNextValue << successive; 14528 successiveACState = 0; 14529 } 14530 break; 14531 case 4: 14532 if (component.blockData[offset + z]) { 14533 component.blockData[offset + z] += readBit() << successive; 14534 } 14535 break; 14536 } 14537 k++; 14538 } 14539 if (successiveACState === 4) { 14540 eobrun--; 14541 if (eobrun === 0) { 14542 successiveACState = 0; 14543 } 14544 } 14545 } 14546 function decodeMcu(component, decode, mcu, row, col) { 14547 var mcuRow = mcu / mcusPerLine | 0; 14548 var mcuCol = mcu % mcusPerLine; 14549 var blockRow = mcuRow * component.v + row; 14550 var blockCol = mcuCol * component.h + col; 14551 var offset = getBlockBufferOffset(component, blockRow, blockCol); 14552 decode(component, offset); 14553 } 14554 function decodeBlock(component, decode, mcu) { 14555 var blockRow = mcu / component.blocksPerLine | 0; 14556 var blockCol = mcu % component.blocksPerLine; 14557 var offset = getBlockBufferOffset(component, blockRow, blockCol); 14558 decode(component, offset); 14559 } 14560 var componentsLength = components.length; 14561 var component, i, j, k, n; 14562 var decodeFn; 14563 if (progressive) { 14564 if (spectralStart === 0) { 14565 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 14566 } else { 14567 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 14568 } 14569 } else { 14570 decodeFn = decodeBaseline; 14571 } 14572 var mcu = 0, marker; 14573 var mcuExpected; 14574 if (componentsLength === 1) { 14575 mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; 14576 } else { 14577 mcuExpected = mcusPerLine * frame.mcusPerColumn; 14578 } 14579 if (!resetInterval) { 14580 resetInterval = mcuExpected; 14581 } 14582 var h, v; 14583 while (mcu < mcuExpected) { 14584 for (i = 0; i < componentsLength; i++) { 14585 components[i].pred = 0; 14586 } 14587 eobrun = 0; 14588 if (componentsLength === 1) { 14589 component = components[0]; 14590 for (n = 0; n < resetInterval; n++) { 14591 decodeBlock(component, decodeFn, mcu); 14592 mcu++; 14593 } 14594 } else { 14595 for (n = 0; n < resetInterval; n++) { 14596 for (i = 0; i < componentsLength; i++) { 14597 component = components[i]; 14598 h = component.h; 14599 v = component.v; 14600 for (j = 0; j < v; j++) { 14601 for (k = 0; k < h; k++) { 14602 decodeMcu(component, decodeFn, mcu, j, k); 14603 } 14604 } 14605 } 14606 mcu++; 14607 } 14608 } 14609 bitsCount = 0; 14610 marker = data[offset] << 8 | data[offset + 1]; 14611 while (data[offset] === 0x00 && offset < data.length - 1) { 14612 offset++; 14613 marker = data[offset] << 8 | data[offset + 1]; 14614 } 14615 if (marker <= 0xFF00) { 14616 error('JPEG error: marker was not found'); 14617 } 14618 if (marker >= 0xFFD0 && marker <= 0xFFD7) { 14619 offset += 2; 14620 } else { 14621 break; 14622 } 14623 } 14624 return offset - startOffset; 14625 } 14626 function quantizeAndInverse(component, blockBufferOffset, p) { 14627 var qt = component.quantizationTable, blockData = component.blockData; 14628 var v0, v1, v2, v3, v4, v5, v6, v7; 14629 var p0, p1, p2, p3, p4, p5, p6, p7; 14630 var t; 14631 if (!qt) { 14632 error('JPEG error: missing required Quantization Table.'); 14633 } 14634 for (var row = 0; row < 64; row += 8) { 14635 p0 = blockData[blockBufferOffset + row]; 14636 p1 = blockData[blockBufferOffset + row + 1]; 14637 p2 = blockData[blockBufferOffset + row + 2]; 14638 p3 = blockData[blockBufferOffset + row + 3]; 14639 p4 = blockData[blockBufferOffset + row + 4]; 14640 p5 = blockData[blockBufferOffset + row + 5]; 14641 p6 = blockData[blockBufferOffset + row + 6]; 14642 p7 = blockData[blockBufferOffset + row + 7]; 14643 p0 *= qt[row]; 14644 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 14645 t = dctSqrt2 * p0 + 512 >> 10; 14646 p[row] = t; 14647 p[row + 1] = t; 14648 p[row + 2] = t; 14649 p[row + 3] = t; 14650 p[row + 4] = t; 14651 p[row + 5] = t; 14652 p[row + 6] = t; 14653 p[row + 7] = t; 14654 continue; 14655 } 14656 p1 *= qt[row + 1]; 14657 p2 *= qt[row + 2]; 14658 p3 *= qt[row + 3]; 14659 p4 *= qt[row + 4]; 14660 p5 *= qt[row + 5]; 14661 p6 *= qt[row + 6]; 14662 p7 *= qt[row + 7]; 14663 v0 = dctSqrt2 * p0 + 128 >> 8; 14664 v1 = dctSqrt2 * p4 + 128 >> 8; 14665 v2 = p2; 14666 v3 = p6; 14667 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 14668 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 14669 v5 = p3 << 4; 14670 v6 = p5 << 4; 14671 v0 = v0 + v1 + 1 >> 1; 14672 v1 = v0 - v1; 14673 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 14674 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 14675 v3 = t; 14676 v4 = v4 + v6 + 1 >> 1; 14677 v6 = v4 - v6; 14678 v7 = v7 + v5 + 1 >> 1; 14679 v5 = v7 - v5; 14680 v0 = v0 + v3 + 1 >> 1;
vendor: 2,003 bytes, lines 14681-14742
14681 v3 = v0 - v3; 14682 v1 = v1 + v2 + 1 >> 1; 14683 v2 = v1 - v2; 14684 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 14685 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 14686 v7 = t; 14687 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 14688 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 14689 v6 = t; 14690 p[row] = v0 + v7; 14691 p[row + 7] = v0 - v7; 14692 p[row + 1] = v1 + v6; 14693 p[row + 6] = v1 - v6; 14694 p[row + 2] = v2 + v5; 14695 p[row + 5] = v2 - v5; 14696 p[row + 3] = v3 + v4; 14697 p[row + 4] = v3 - v4; 14698 } 14699 for (var col = 0; col < 8; ++col) { 14700 p0 = p[col]; 14701 p1 = p[col + 8]; 14702 p2 = p[col + 16]; 14703 p3 = p[col + 24]; 14704 p4 = p[col + 32]; 14705 p5 = p[col + 40]; 14706 p6 = p[col + 48]; 14707 p7 = p[col + 56]; 14708 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 14709 t = dctSqrt2 * p0 + 8192 >> 14; 14710 t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4; 14711 blockData[blockBufferOffset + col] = t; 14712 blockData[blockBufferOffset + col + 8] = t; 14713 blockData[blockBufferOffset + col + 16] = t; 14714 blockData[blockBufferOffset + col + 24] = t; 14715 blockData[blockBufferOffset + col + 32] = t; 14716 blockData[blockBufferOffset + col + 40] = t; 14717 blockData[blockBufferOffset + col + 48] = t; 14718 blockData[blockBufferOffset + col + 56] = t; 14719 continue; 14720 } 14721 v0 = dctSqrt2 * p0 + 2048 >> 12; 14722 v1 = dctSqrt2 * p4 + 2048 >> 12; 14723 v2 = p2; 14724 v3 = p6; 14725 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 14726 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 14727 v5 = p3; 14728 v6 = p5; 14729 v0 = (v0 + v1 + 1 >> 1) + 4112; 14730 v1 = v0 - v1; 14731 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 14732 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 14733 v3 = t; 14734 v4 = v4 + v6 + 1 >> 1; 14735 v6 = v4 - v6; 14736 v7 = v7 + v5 + 1 >> 1; 14737 v5 = v7 - v5; 14738 v0 = v0 + v3 + 1 >> 1; 14739 v3 = v0 - v3; 14740 v1 = v1 + v2 + 1 >> 1; 14741 v2 = v1 - v2; 14742 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
14742 12; 14743 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 14744 v7 = t; 14745 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 14746 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 14747 v6 = t; 14748 p0 = v0 + v7; 14749 p7 = v0 - v7; 14750 p1 = v1 + v6; 14751 p6 = v1 - v6; 14752 p2 = v2 + v5; 14753 p5 = v2 - v5; 14754 p3 = v3 + v4; 14755 p4 = v3 - v4; 14756 p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4; 14757 p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4; 14758 p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4; 14759 p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4; 14760 p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4; 14761 p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4; 14762 p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4; 14763 p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4; 14764 blockData[blockBufferOffset + col] = p0; 14765 blockData[blockBufferOffset + col + 8] = p1; 14766 blockData[blockBufferOffset + col + 16] = p2; 14767 blockData[blockBufferOffset + col + 24] = p3; 14768 blockData[blockBufferOffset + col + 32] = p4; 14769 blockData[blockBufferOffset + col + 40] = p5; 14770 blockData[blockBufferOffset + col + 48] = p6; 14771 blockData[blockBufferOffset + col + 56] = p7; 14772 } 14773 } 14774 function buildComponentData(frame, component) { 14775 var blocksPerLine = component.blocksPerLine; 14776 var blocksPerColumn = component.blocksPerColumn; 14777 var computationBuffer = new Int16Array(64); 14778 for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 14779 for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { 14780 var offset = getBlockBufferOffset(component, blockRow, blockCol); 14781 quantizeAndInverse(component, offset, computationBuffer); 14782 } 14783 } 14784 return component.blockData; 14785 } 14786 function clamp0to255(a) { 14787 return a <= 0 ? 0 : a >= 255 ? 255 : a; 14788 } 14789 JpegImage.prototype = { 14790 parse: function parse(data) { 14791 function readUint16() { 14792 var value = data[offset] << 8 | data[offset + 1]; 14793 offset += 2; 14794 return value; 14795 } 14796 function readDataBlock() { 14797 var length = readUint16(); 14798 var array = data.subarray(offset, offset + length - 2); 14799 offset += array.length; 14800 return array; 14801 } 14802 function prepareComponents(frame) { 14803 var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 14804 var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 14805 for (var i = 0; i < frame.components.length; i++) { 14806 component = frame.components[i]; 14807 var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 14808 var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 14809 var blocksPerLineForMcu = mcusPerLine * component.h; 14810 var blocksPerColumnForMcu = mcusPerColumn * component.v; 14811 var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 14812 component.blockData = new Int16Array(blocksBufferSize); 14813 component.blocksPerLine = blocksPerLine; 14814 component.blocksPerColumn = blocksPerColumn; 14815 } 14816 frame.mcusPerLine = mcusPerLine; 14817 frame.mcusPerColumn = mcusPerColumn; 14818 } 14819 var offset = 0; 14820 var jfif = null; 14821 var adobe = null; 14822 var frame, resetInterval; 14823 var quantizationTables = []; 14824 var huffmanTablesAC = [], huffmanTablesDC = []; 14825 var fileMarker = readUint16(); 14826 if (fileMarker !== 0xFFD8) { 14827 error('JPEG error: SOI not found'); 14828 } 14829 fileMarker = readUint16(); 14830 while (fileMarker !== 0xFFD9) { 14831 var i, j, l; 14832 switch (fileMarker) { 14833 case 0xFFE0: 14834 case 0xFFE1: 14835 case 0xFFE2: 14836 case 0xFFE3: 14837 case 0xFFE4: 14838 case 0xFFE5: 14839 case 0xFFE6: 14840 case 0xFFE7: 14841 case 0xFFE8: 14842 case 0xFFE9: 14843 case 0xFFEA: 14844 case 0xFFEB: 14845 case 0xFFEC: 14846 case 0xFFED: 14847 case 0xFFEE: 14848 case 0xFFEF: 14849 case 0xFFFE: 14850 var appData = readDataBlock(); 14851 if (fileMarker === 0xFFE0) { 14852 if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 14853 jfif = { 14854 version: { 14855 major: appData[5], 14856 minor: appData[6] 14857 }, 14858 densityUnits: appData[7], 14859 xDensity: appData[8] << 8 | appData[9], 14860 yDensity: appData[10] << 8 | appData[11], 14861 thumbWidth: appData[12],
14862 thumbHeight: appData[13], 14863 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 14864 }; 14865 } 14866 } 14867 if (fileMarker === 0xFFEE) { 14868 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) { 14869 adobe = { 14870 version: appData[5] << 8 | appData[6], 14871 flags0: appData[7] << 8 | appData[8], 14872 flags1: appData[9] << 8 | appData[10], 14873 transformCode: appData[11] 14874 }; 14875 } 14876 } 14877 break; 14878 case 0xFFDB: 14879 var quantizationTablesLength = readUint16(); 14880 var quantizationTablesEnd = quantizationTablesLength + offset - 2; 14881 var z; 14882 while (offset < quantizationTablesEnd) { 14883 var quantizationTableSpec = data[offset++]; 14884 var tableData = new Uint16Array(64); 14885 if (quantizationTableSpec >> 4 === 0) { 14886 for (j = 0; j < 64; j++) { 14887 z = dctZigZag[j]; 14888 tableData[z] = data[offset++]; 14889 } 14890 } else if (quantizationTableSpec >> 4 === 1) { 14891 for (j = 0; j < 64; j++) { 14892 z = dctZigZag[j]; 14893 tableData[z] = readUint16(); 14894 } 14895 } else { 14896 error('JPEG error: DQT - invalid table spec'); 14897 } 14898 quantizationTables[quantizationTableSpec & 15] = tableData; 14899 } 14900 break; 14901 case 0xFFC0: 14902 case 0xFFC1: 14903 case 0xFFC2: 14904 if (frame) { 14905 error('JPEG error: Only single frame JPEGs supported'); 14906 } 14907 readUint16(); 14908 frame = {}; 14909 frame.extended = fileMarker === 0xFFC1; 14910 frame.progressive = fileMarker === 0xFFC2; 14911 frame.precision = data[offset++]; 14912 frame.scanLines = readUint16(); 14913 frame.samplesPerLine = readUint16(); 14914 frame.components = []; 14915 frame.componentIds = {}; 14916 var componentsCount = data[offset++], componentId; 14917 var maxH = 0, maxV = 0; 14918 for (i = 0; i < componentsCount; i++) { 14919 componentId = data[offset]; 14920 var h = data[offset + 1] >> 4; 14921 var v = data[offset + 1] & 15; 14922 if (maxH < h) { 14923 maxH = h; 14924 } 14925 if (maxV < v) { 14926 maxV = v; 14927 } 14928 var qId = data[offset + 2]; 14929 l = frame.components.push({ 14930 h: h, 14931 v: v, 14932 quantizationId: qId, 14933 quantizationTable: null 14934 }); 14935 frame.componentIds[componentId] = l - 1; 14936 offset += 3; 14937 } 14938 frame.maxH = maxH; 14939 frame.maxV = maxV; 14940 prepareComponents(frame); 14941 break; 14942 case 0xFFC4: 14943 var huffmanLength = readUint16(); 14944 for (i = 2; i < huffmanLength;) { 14945 var huffmanTableSpec = data[offset++]; 14946 var codeLengths = new Uint8Array(16); 14947 var codeLengthSum = 0; 14948 for (j = 0; j < 16; j++, offset++) { 14949 codeLengthSum += codeLengths[j] = data[offset]; 14950 } 14951 var huffmanValues = new Uint8Array(codeLengthSum); 14952 for (j = 0; j < codeLengthSum; j++, offset++) { 14953 huffmanValues[j] = data[offset]; 14954 } 14955 i += 17 + codeLengthSum; 14956 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 14957 } 14958 break; 14959 case 0xFFDD: 14960 readUint16(); 14961 resetInterval = readUint16(); 14962 break; 14963 case 0xFFDA: 14964 readUint16(); 14965 var selectorsCount = data[offset++]; 14966 var components = [], component; 14967 for (i = 0; i < selectorsCount; i++) { 14968 var componentIndex = frame.componentIds[data[offset++]]; 14969 component = frame.components[componentIndex]; 14970 var tableSpec = data[offset++]; 14971 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 14972 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 14973 components.push(component); 14974 } 14975 var spectralStart = data[offset++]; 14976 var spectralEnd = data[offset++]; 14977 var successiveApproximation = data[offset++]; 14978 var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15); 14979 offset += processed; 14980 break; 14981 case 0xFFFF: 14982 if (data[offset] !== 0xFF) { 14983 offset--; 14984 } 14985 break; 14986 default: 14987 if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) { 14988 offset -= 3; 14989 break; 14990 } 14991 error('JPEG error: unknown marker ' + fileMarker.toString(16)); 14992 } 14993 fileMarker = readUint16(); 14994 } 14995 this.width = frame.samplesPerLine; 14996 this.height = frame.scanLines; 14997 this.jfif = jfif; 14998 this.adobe = adobe; 14999 this.components = []; 15000 for (i = 0; i < frame.components.length; i++) { 15001 component = frame.components[i]; 15002 var quantizationTable = quantizationTables[component.quantizationId]; 15003 if (quantizationTable) { 15004 component.quantizationTable = quantizationTable; 15005 } 15006 this.components.push({ 15007 output: buildComponentData(frame, component), 15008 scaleX: component.h / frame.maxH, 15009 scaleY: component.v / frame.maxV, 15010 blocksPerLine: component.blocksPerLine, 15011 blocksPerColumn: component.blocksPerColumn 15012 }); 15013 } 15014 this.numComponents = this.components.length; 15015 }, 15016 _getLinearizedBlockData: function getLinearizedBlockData(width, height) { 15017 var scaleX = this.width / width, scaleY = this.height / height; 15018 var component, componentScaleX, componentScaleY, blocksPerScanline; 15019 var x, y, i, j, k; 15020 var index; 15021 var offset = 0; 15022 var output; 15023 var numComponents = this.components.length;
15024 var dataLength = width * height * numComponents; 15025 var data = new Uint8Array(dataLength); 15026 var xScaleBlockOffset = new Uint32Array(width); 15027 var mask3LSB = 0xfffffff8; 15028 for (i = 0; i < numComponents; i++) { 15029 component = this.components[i]; 15030 componentScaleX = component.scaleX * scaleX; 15031 componentScaleY = component.scaleY * scaleY; 15032 offset = i; 15033 output = component.output; 15034 blocksPerScanline = component.blocksPerLine + 1 << 3; 15035 for (x = 0; x < width; x++) { 15036 j = 0 | x * componentScaleX; 15037 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 15038 } 15039 for (y = 0; y < height; y++) { 15040 j = 0 | y * componentScaleY; 15041 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 15042 for (x = 0; x < width; x++) { 15043 data[offset] = output[index + xScaleBlockOffset[x]]; 15044 offset += numComponents; 15045 } 15046 } 15047 } 15048 var transform = this.decodeTransform; 15049 if (transform) { 15050 for (i = 0; i < dataLength;) { 15051 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 15052 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 15053 } 15054 } 15055 } 15056 return data; 15057 }, 15058 _isColorConversionNeeded: function isColorConversionNeeded() { 15059 if (this.adobe && this.adobe.transformCode) { 15060 return true; 15061 } else if (this.numComponents === 3) { 15062 if (!this.adobe && this.colorTransform === 0) { 15063 return false; 15064 } 15065 return true; 15066 } 15067 if (!this.adobe && this.colorTransform === 1) { 15068 return true; 15069 } 15070 return false; 15071 }, 15072 _convertYccToRgb: function convertYccToRgb(data) { 15073 var Y, Cb, Cr; 15074 for (var i = 0, length = data.length; i < length; i += 3) { 15075 Y = data[i]; 15076 Cb = data[i + 1]; 15077 Cr = data[i + 2]; 15078 data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr); 15079 data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr); 15080 data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb); 15081 } 15082 return data; 15083 }, 15084 _convertYcckToRgb: function convertYcckToRgb(data) { 15085 var Y, Cb, Cr, k; 15086 var offset = 0; 15087 for (var i = 0, length = data.length; i < length; i += 4) { 15088 Y = data[i]; 15089 Cb = data[i + 1]; 15090 Cr = data[i + 2]; 15091 k = data[i + 3]; 15092 var r = -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); 15093 var g = 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); 15094 var b = -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); 15095 data[offset++] = clamp0to255(r); 15096 data[offset++] = clamp0to255(g); 15097 data[offset++] = clamp0to255(b); 15098 } 15099 return data; 15100 }, 15101 _convertYcckToCmyk: function convertYcckToCmyk(data) { 15102 var Y, Cb, Cr; 15103 for (var i = 0, length = data.length; i < length; i += 4) { 15104 Y = data[i]; 15105 Cb = data[i + 1]; 15106 Cr = data[i + 2]; 15107 data[i] = clamp0to255(434.456 - Y - 1.402 * Cr); 15108 data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr); 15109 data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb); 15110 } 15111 return data; 15112 }, 15113 _convertCmykToRgb: function convertCmykToRgb(data) { 15114 var c, m, y, k; 15115 var offset = 0; 15116 var min = -255 * 255 * 255; 15117 var scale = 1 / 255 / 255; 15118 for (var i = 0, length = data.length; i < length; i += 4) { 15119 c = data[i]; 15120 m = data[i + 1]; 15121 y = data[i + 2]; 15122 k = data[i + 3]; 15123 var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 72734.4411664936) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 1401.7366389350734) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 4465.541406466231) - k * (21.86122147463605 * k + 48317.86113160301);
15124 var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 20220.756542821975) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 48691.05921601825) + y * (4.444339102852739 * y + 9.8632861493405 * k - 6341.191035517494) - k * (20.737325471181034 * k + 47890.15695978492); 15125 var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k - 3616.812083916688) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 28620.90484698408) + y * (0.03296041114873217 * y + 115.60384449646641 * k - 49363.43385999684) - k * (22.33816807309886 * k + 45932.16563550634); 15126 data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0; 15127 data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0; 15128 data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0; 15129 } 15130 return data; 15131 }, 15132 getData: function getData(width, height, forceRGBoutput) { 15133 if (this.numComponents > 4) { 15134 error('JPEG error: Unsupported color mode'); 15135 } 15136 var data = this._getLinearizedBlockData(width, height); 15137 if (this.numComponents === 1 && forceRGBoutput) { 15138 var dataLength = data.length; 15139 var rgbData = new Uint8Array(dataLength * 3); 15140 var offset = 0; 15141 for (var i = 0; i < dataLength; i++) { 15142 var grayColor = data[i]; 15143 rgbData[offset++] = grayColor; 15144 rgbData[offset++] = grayColor; 15145 rgbData[offset++] = grayColor; 15146 } 15147 return rgbData; 15148 } else if (this.numComponents === 3 && this._isColorConversionNeeded()) { 15149 return this._convertYccToRgb(data); 15150 } else if (this.numComponents === 4) { 15151 if (this._isColorConversionNeeded()) { 15152 if (forceRGBoutput) { 15153 return this._convertYcckToRgb(data); 15154 } 15155 return this._convertYcckToCmyk(data); 15156 } else if (forceRGBoutput) { 15157 return this._convertCmykToRgb(data); 15158 } 15159 } 15160 return data; 15161 } 15162 }; 15163 return JpegImage; 15164 }(); 15165 exports.JpegImage = JpegImage; 15166 })); 15167 (function (root, factory) { 15168 factory(root.pdfjsCoreJpx = {}, root.pdfjsSharedUtil, root.pdfjsCoreArithmeticDecoder); 15169 }(this, function (exports, sharedUtil, coreArithmeticDecoder) { 15170 var info = sharedUtil.info; 15171 var warn = sharedUtil.warn; 15172 var error = sharedUtil.error; 15173 var log2 = sharedUtil.log2; 15174 var readUint16 = sharedUtil.readUint16; 15175 var readUint32 = sharedUtil.readUint32; 15176 var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder; 15177 var JpxImage = function JpxImageClosure() { 15178 var SubbandsGainLog2 = { 15179 'LL': 0, 15180 'LH': 1, 15181 'HL': 1, 15182 'HH': 2 15183 }; 15184 function JpxImage() { 15185 this.failOnCorruptedImage = false; 15186 } 15187 JpxImage.prototype = { 15188 parse: function JpxImage_parse(data) { 15189 var head = readUint16(data, 0); 15190 if (head === 0xFF4F) { 15191 this.parseCodestream(data, 0, data.length); 15192 return; 15193 } 15194 var position = 0, length = data.length; 15195 while (position < length) { 15196 var headerSize = 8; 15197 var lbox = readUint32(data, position); 15198 var tbox = readUint32(data, position + 4); 15199 position += headerSize; 15200 if (lbox === 1) { 15201 lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4); 15202 position += 8; 15203 headerSize += 8; 15204 } 15205 if (lbox === 0) { 15206 lbox = length - position + headerSize; 15207 } 15208 if (lbox < headerSize) { 15209 error('JPX Error: Invalid box field size'); 15210 } 15211 var dataLength = lbox - headerSize; 15212 var jumpDataLength = true; 15213 switch (tbox) { 15214 case 0x6A703268: 15215 jumpDataLength = false; 15216 break; 15217 case 0x636F6C72: 15218 var method = data[position]; 15219 if (method === 1) { 15220 var colorspace = readUint32(data, position + 3); 15221 switch (colorspace) { 15222 case 16: 15223 case 17: 15224 case 18: 15225 break; 15226 default: 15227 warn('Unknown colorspace ' + colorspace); 15228 break; 15229 } 15230 } else if (method === 2) { 15231 info('ICC profile not supported'); 15232 } 15233 break; 15234 case 0x6A703263: 15235 this.parseCodestream(data, position, position + dataLength); 15236 break; 15237 case 0x6A502020: 15238 if (0x0d0a870a !== readUint32(data, position)) { 15239 warn('Invalid JP2 signature'); 15240 } 15241 break; 15242 case 0x6A501A1A: 15243 case 0x66747970: 15244 case 0x72726571: 15245 case 0x72657320: 15246 case 0x69686472: 15247 break; 15248 default: 15249 var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF); 15250 warn('Unsupported header type ' + tbox + ' (' + headerType + ')'); 15251 break; 15252 } 15253 if (jumpDataLength) { 15254 position += dataLength; 15255 } 15256 } 15257 }, 15258 parseImageProperties: function JpxImage_parseImageProperties(stream) { 15259 var newByte = stream.getByte(); 15260 while (newByte >= 0) { 15261 var oldByte = newByte; 15262 newByte = stream.getByte(); 15263 var code = oldByte << 8 | newByte; 15264 if (code === 0xFF51) { 15265 stream.skip(4); 15266 var Xsiz = stream.getInt32() >>> 0; 15267 var Ysiz = stream.getInt32() >>> 0; 15268 var XOsiz = stream.getInt32() >>> 0; 15269 var YOsiz = stream.getInt32() >>> 0; 15270 stream.skip(16); 15271 var Csiz = stream.getUint16(); 15272 this.width = Xsiz - XOsiz; 15273 this.height = Ysiz - YOsiz; 15274 this.componentsCount = Csiz; 15275 this.bitsPerComponent = 8; 15276 return; 15277 } 15278 } 15279 error('JPX Error: No size marker found in JPX stream'); 15280 }, 15281 parseCodestream: function JpxImage_parseCodestream(data, start, end) { 15282 var context = {}; 15283 var doNotRecover = false;
15284 try { 15285 var position = start; 15286 while (position + 1 < end) { 15287 var code = readUint16(data, position); 15288 position += 2; 15289 var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile; 15290 switch (code) { 15291 case 0xFF4F: 15292 context.mainHeader = true; 15293 break; 15294 case 0xFFD9: 15295 break; 15296 case 0xFF51: 15297 length = readUint16(data, position); 15298 var siz = {}; 15299 siz.Xsiz = readUint32(data, position + 4); 15300 siz.Ysiz = readUint32(data, position + 8); 15301 siz.XOsiz = readUint32(data, position + 12); 15302 siz.YOsiz = readUint32(data, position + 16); 15303 siz.XTsiz = readUint32(data, position + 20); 15304 siz.YTsiz = readUint32(data, position + 24); 15305 siz.XTOsiz = readUint32(data, position + 28); 15306 siz.YTOsiz = readUint32(data, position + 32); 15307 var componentsCount = readUint16(data, position + 36); 15308 siz.Csiz = componentsCount; 15309 var components = []; 15310 j = position + 38; 15311 for (var i = 0; i < componentsCount; i++) { 15312 var component = { 15313 precision: (data[j] & 0x7F) + 1, 15314 isSigned: !!(data[j] & 0x80), 15315 XRsiz: data[j + 1], 15316 YRsiz: data[j + 1] 15317 }; 15318 calculateComponentDimensions(component, siz); 15319 components.push(component); 15320 } 15321 context.SIZ = siz; 15322 context.components = components; 15323 calculateTileGrids(context, components); 15324 context.QCC = []; 15325 context.COC = []; 15326 break; 15327 case 0xFF5C: 15328 length = readUint16(data, position); 15329 var qcd = {}; 15330 j = position + 2; 15331 sqcd = data[j++]; 15332 switch (sqcd & 0x1F) { 15333 case 0: 15334 spqcdSize = 8; 15335 scalarExpounded = true; 15336 break; 15337 case 1: 15338 spqcdSize = 16; 15339 scalarExpounded = false; 15340 break; 15341 case 2: 15342 spqcdSize = 16; 15343 scalarExpounded = true; 15344 break; 15345 default: 15346 throw new Error('Invalid SQcd value ' + sqcd); 15347 } 15348 qcd.noQuantization = spqcdSize === 8; 15349 qcd.scalarExpounded = scalarExpounded; 15350 qcd.guardBits = sqcd >> 5; 15351 spqcds = []; 15352 while (j < length + position) { 15353 var spqcd = {}; 15354 if (spqcdSize === 8) { 15355 spqcd.epsilon = data[j++] >> 3; 15356 spqcd.mu = 0; 15357 } else { 15358 spqcd.epsilon = data[j] >> 3; 15359 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 15360 j += 2; 15361 } 15362 spqcds.push(spqcd); 15363 } 15364 qcd.SPqcds = spqcds; 15365 if (context.mainHeader) { 15366 context.QCD = qcd; 15367 } else { 15368 context.currentTile.QCD = qcd; 15369 context.currentTile.QCC = []; 15370 } 15371 break; 15372 case 0xFF5D: 15373 length = readUint16(data, position); 15374 var qcc = {}; 15375 j = position + 2; 15376 var cqcc; 15377 if (context.SIZ.Csiz < 257) { 15378 cqcc = data[j++]; 15379 } else { 15380 cqcc = readUint16(data, j); 15381 j += 2; 15382 } 15383 sqcd = data[j++]; 15384 switch (sqcd & 0x1F) { 15385 case 0: 15386 spqcdSize = 8; 15387 scalarExpounded = true; 15388 break; 15389 case 1: 15390 spqcdSize = 16; 15391 scalarExpounded = false; 15392 break; 15393 case 2: 15394 spqcdSize = 16; 15395 scalarExpounded = true; 15396 break; 15397 default: 15398 throw new Error('Invalid SQcd value ' + sqcd); 15399 } 15400 qcc.noQuantization = spqcdSize === 8; 15401 qcc.scalarExpounded = scalarExpounded; 15402 qcc.guardBits = sqcd >> 5; 15403 spqcds = []; 15404 while (j < length + position) { 15405 spqcd = {}; 15406 if (spqcdSize === 8) { 15407 spqcd.epsilon = data[j++] >> 3; 15408 spqcd.mu = 0; 15409 } else { 15410 spqcd.epsilon = data[j] >> 3; 15411 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 15412 j += 2; 15413 } 15414 spqcds.push(spqcd); 15415 } 15416 qcc.SPqcds = spqcds; 15417 if (context.mainHeader) { 15418 context.QCC[cqcc] = qcc; 15419 } else { 15420 context.currentTile.QCC[cqcc] = qcc; 15421 } 15422 break; 15423 case 0xFF52: 15424 length = readUint16(data, position); 15425 var cod = {}; 15426 j = position + 2; 15427 var scod = data[j++]; 15428 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 15429 cod.sopMarkerUsed = !!(scod & 2); 15430 cod.ephMarkerUsed = !!(scod & 4); 15431 cod.progressionOrder = data[j++]; 15432 cod.layersCount = readUint16(data, j); 15433 j += 2; 15434 cod.multipleComponentTransform = data[j++]; 15435 cod.decompositionLevelsCount = data[j++]; 15436 cod.xcb = (data[j++] & 0xF) + 2; 15437 cod.ycb = (data[j++] & 0xF) + 2; 15438 var blockStyle = data[j++]; 15439 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 15440 cod.resetContextProbabilities = !!(blockStyle & 2); 15441 cod.terminationOnEachCodingPass = !!(blockStyle & 4);
15442 cod.verticalyStripe = !!(blockStyle & 8); 15443 cod.predictableTermination = !!(blockStyle & 16); 15444 cod.segmentationSymbolUsed = !!(blockStyle & 32); 15445 cod.reversibleTransformation = data[j++]; 15446 if (cod.entropyCoderWithCustomPrecincts) { 15447 var precinctsSizes = []; 15448 while (j < length + position) { 15449 var precinctsSize = data[j++]; 15450 precinctsSizes.push({ 15451 PPx: precinctsSize & 0xF, 15452 PPy: precinctsSize >> 4 15453 }); 15454 } 15455 cod.precinctsSizes = precinctsSizes; 15456 } 15457 var unsupported = []; 15458 if (cod.selectiveArithmeticCodingBypass) { 15459 unsupported.push('selectiveArithmeticCodingBypass'); 15460 } 15461 if (cod.resetContextProbabilities) { 15462 unsupported.push('resetContextProbabilities'); 15463 } 15464 if (cod.terminationOnEachCodingPass) { 15465 unsupported.push('terminationOnEachCodingPass'); 15466 } 15467 if (cod.verticalyStripe) { 15468 unsupported.push('verticalyStripe'); 15469 } 15470 if (cod.predictableTermination) { 15471 unsupported.push('predictableTermination'); 15472 } 15473 if (unsupported.length > 0) { 15474 doNotRecover = true; 15475 throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')'); 15476 } 15477 if (context.mainHeader) { 15478 context.COD = cod; 15479 } else { 15480 context.currentTile.COD = cod; 15481 context.currentTile.COC = []; 15482 } 15483 break; 15484 case 0xFF90: 15485 length = readUint16(data, position); 15486 tile = {}; 15487 tile.index = readUint16(data, position + 2); 15488 tile.length = readUint32(data, position + 4); 15489 tile.dataEnd = tile.length + position - 2; 15490 tile.partIndex = data[position + 8]; 15491 tile.partsCount = data[position + 9]; 15492 context.mainHeader = false;
15493 if (tile.partIndex === 0) { 15494 tile.COD = context.COD; 15495 tile.COC = context.COC.slice(0); 15496 tile.QCD = context.QCD; 15497 tile.QCC = context.QCC.slice(0); 15498 } 15499 context.currentTile = tile; 15500 break; 15501 case 0xFF93: 15502 tile = context.currentTile; 15503 if (tile.partIndex === 0) { 15504 initializeTile(context, tile.index); 15505 buildPackets(context); 15506 } 15507 length = tile.dataEnd - position; 15508 parseTilePackets(context, data, position, length); 15509 break; 15510 case 0xFF55: 15511 case 0xFF57: 15512 case 0xFF58: 15513 case 0xFF64: 15514 length = readUint16(data, position); 15515 break; 15516 case 0xFF53: 15517 throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented'); 15518 default: 15519 throw new Error('Unknown codestream code: ' + code.toString(16)); 15520 } 15521 position += length; 15522 } 15523 } catch (e) { 15524 if (doNotRecover || this.failOnCorruptedImage) { 15525 error('JPX Error: ' + e.message); 15526 } else { 15527 warn('JPX: Trying to recover from: ' + e.message); 15528 } 15529 } 15530 this.tiles = transformComponents(context); 15531 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 15532 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 15533 this.componentsCount = context.SIZ.Csiz; 15534 } 15535 }; 15536 function calculateComponentDimensions(component, siz) { 15537 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 15538 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 15539 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 15540 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 15541 component.width = component.x1 - component.x0; 15542 component.height = component.y1 - component.y0; 15543 } 15544 function calculateTileGrids(context, components) { 15545 var siz = context.SIZ; 15546 var tile, tiles = []; 15547 var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 15548 var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 15549 for (var q = 0; q < numYtiles; q++) { 15550 for (var p = 0; p < numXtiles; p++) { 15551 tile = {}; 15552 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 15553 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 15554 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 15555 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 15556 tile.width = tile.tx1 - tile.tx0; 15557 tile.height = tile.ty1 - tile.ty0; 15558 tile.components = []; 15559 tiles.push(tile); 15560 } 15561 } 15562 context.tiles = tiles; 15563 var componentsCount = siz.Csiz; 15564 for (var i = 0, ii = componentsCount; i < ii; i++) { 15565 var component = components[i]; 15566 for (var j = 0, jj = tiles.length; j < jj; j++) { 15567 var tileComponent = {}; 15568 tile = tiles[j]; 15569 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 15570 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 15571 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 15572 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 15573 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 15574 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 15575 tile.components[i] = tileComponent; 15576 } 15577 } 15578 } 15579 function getBlocksDimensions(context, component, r) { 15580 var codOrCoc = component.codingStyleParameters; 15581 var result = {}; 15582 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 15583 result.PPx = 15; 15584 result.PPy = 15; 15585 } else { 15586 result.PPx = codOrCoc.precinctsSizes[r].PPx; 15587 result.PPy = codOrCoc.precinctsSizes[r].PPy; 15588 } 15589 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 15590 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 15591 return result; 15592 } 15593 function buildPrecincts(context, resolution, dimensions) { 15594 var precinctWidth = 1 << dimensions.PPx; 15595 var precinctHeight = 1 << dimensions.PPy; 15596 var isZeroRes = resolution.resLevel === 0; 15597 var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 15598 var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 15599 var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 15600 var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 15601 var numprecincts = numprecinctswide * numprecinctshigh; 15602 resolution.precinctParameters = { 15603 precinctWidth: precinctWidth, 15604 precinctHeight: precinctHeight, 15605 numprecinctswide: numprecinctswide, 15606 numprecinctshigh: numprecinctshigh, 15607 numprecincts: numprecincts, 15608 precinctWidthInSubband: precinctWidthInSubband, 15609 precinctHeightInSubband: precinctHeightInSubband 15610 }; 15611 } 15612 function buildCodeblocks(context, subband, dimensions) { 15613 var xcb_ = dimensions.xcb_; 15614 var ycb_ = dimensions.ycb_; 15615 var codeblockWidth = 1 << xcb_; 15616 var codeblockHeight = 1 << ycb_; 15617 var cbx0 = subband.tbx0 >> xcb_; 15618 var cby0 = subband.tby0 >> ycb_; 15619 var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 15620 var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 15621 var precinctParameters = subband.resolution.precinctParameters; 15622 var codeblocks = []; 15623 var precincts = []; 15624 var i, j, codeblock, precinctNumber; 15625 for (j = cby0; j < cby1; j++) { 15626 for (i = cbx0; i < cbx1; i++) { 15627 codeblock = { 15628 cbx: i, 15629 cby: j, 15630 tbx0: codeblockWidth * i, 15631 tby0: codeblockHeight * j, 15632 tbx1: codeblockWidth * (i + 1), 15633 tby1: codeblockHeight * (j + 1) 15634 }; 15635 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 15636 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 15637 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 15638 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 15639 var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 15640 var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 15641 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 15642 codeblock.precinctNumber = precinctNumber; 15643 codeblock.subbandType = subband.type; 15644 codeblock.Lblock = 3; 15645 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 15646 continue; 15647 } 15648 codeblocks.push(codeblock); 15649 var precinct = precincts[precinctNumber]; 15650 if (precinct !== undefined) { 15651 if (i < precinct.cbxMin) { 15652 precinct.cbxMin = i; 15653 } else if (i > precinct.cbxMax) { 15654 precinct.cbxMax = i; 15655 } 15656 if (j < precinct.cbyMin) { 15657 precinct.cbxMin = j; 15658 } else if (j >
15658 precinct.cbyMax) { 15659 precinct.cbyMax = j; 15660 } 15661 } else { 15662 precincts[precinctNumber] = precinct = { 15663 cbxMin: i, 15664 cbyMin: j, 15665 cbxMax: i, 15666 cbyMax: j 15667 }; 15668 } 15669 codeblock.precinct = precinct; 15670 } 15671 } 15672 subband.codeblockParameters = { 15673 codeblockWidth: xcb_, 15674 codeblockHeight: ycb_, 15675 numcodeblockwide: cbx1 - cbx0 + 1, 15676 numcodeblockhigh: cby1 - cby0 + 1 15677 }; 15678 subband.codeblocks = codeblocks; 15679 subband.precincts = precincts; 15680 } 15681 function createPacket(resolution, precinctNumber, layerNumber) { 15682 var precinctCodeblocks = []; 15683 var subbands = resolution.subbands; 15684 for (var i = 0, ii = subbands.length; i < ii; i++) { 15685 var subband = subbands[i]; 15686 var codeblocks = subband.codeblocks; 15687 for (var j = 0, jj = codeblocks.length; j < jj; j++) { 15688 var codeblock = codeblocks[j]; 15689 if (codeblock.precinctNumber !== precinctNumber) { 15690 continue; 15691 } 15692 precinctCodeblocks.push(codeblock); 15693 } 15694 } 15695 return { 15696 layerNumber: layerNumber, 15697 codeblocks: precinctCodeblocks 15698 }; 15699 } 15700 function LayerResolutionComponentPositionIterator(context) { 15701 var siz = context.SIZ; 15702 var tileIndex = context.currentTile.index; 15703 var tile = context.tiles[tileIndex]; 15704 var layersCount = tile.codingStyleDefaultParameters.layersCount; 15705 var componentsCount = siz.Csiz; 15706 var maxDecompositionLevelsCount = 0; 15707 for (var q = 0; q < componentsCount; q++) { 15708 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 15709 } 15710 var l = 0, r = 0, i = 0, k = 0; 15711 this.nextPacket = function JpxImage_nextPacket() { 15712 for (; l < layersCount; l++) { 15713 for (; r <= maxDecompositionLevelsCount; r++) { 15714 for (; i < componentsCount; i++) { 15715 var component = tile.components[i]; 15716 if (r > component.codingStyleParameters.decompositionLevelsCount) { 15717 continue; 15718 } 15719 var resolution = component.resolutions[r]; 15720 var numprecincts = resolution.precinctParameters.numprecincts; 15721 for (; k < numprecincts;) { 15722 var packet = createPacket(resolution, k, l); 15723 k++; 15724 return packet; 15725 } 15726 k = 0; 15727 } 15728 i = 0; 15729 } 15730 r = 0; 15731 } 15732 error('JPX Error: Out of packets'); 15733 }; 15734 } 15735 function ResolutionLayerComponentPositionIterator(context) { 15736 var siz = context.SIZ; 15737 var tileIndex = context.currentTile.index; 15738 var tile = context.tiles[tileIndex]; 15739 var layersCount = tile.codingStyleDefaultParameters.layersCount; 15740 var componentsCount = siz.Csiz; 15741 var maxDecompositionLevelsCount = 0; 15742 for (var q = 0; q < componentsCount; q++) { 15743 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 15744 } 15745 var r = 0, l = 0, i = 0, k = 0; 15746 this.nextPacket = function JpxImage_nextPacket() { 15747 for (; r <= maxDecompositionLevelsCount; r++) { 15748 for (; l < layersCount; l++) { 15749 for (; i < componentsCount; i++) { 15750 var component = tile.components[i]; 15751 if (r > component.codingStyleParameters.decompositionLevelsCount) { 15752 continue; 15753 } 15754 var resolution = component.resolutions[r]; 15755 var numprecincts = resolution.precinctParameters.numprecincts; 15756 for (; k < numprecincts;) { 15757 var packet = createPacket(resolution, k, l); 15758 k++; 15759 return packet; 15760 } 15761 k = 0; 15762 } 15763 i = 0; 15764 } 15765 l = 0; 15766 } 15767 error('JPX Error: Out of packets'); 15768 }; 15769 } 15770 function ResolutionPositionComponentLayerIterator(context) { 15771 var siz = context.SIZ; 15772 var tileIndex = context.currentTile.index; 15773 var tile = context.tiles[tileIndex]; 15774 var layersCount = tile.codingStyleDefaultParameters.layersCount; 15775 var componentsCount = siz.Csiz; 15776 var l, r, c, p; 15777 var maxDecompositionLevelsCount = 0; 15778 for (c = 0; c < componentsCount; c++) { 15779 var component = tile.components[c]; 15780 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 15781 } 15782 var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 15783 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 15784 var maxNumPrecincts = 0; 15785 for (c = 0; c < componentsCount; ++c) { 15786 var resolutions = tile.components[c].resolutions; 15787 if (r < resolutions.length) { 15788 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 15789 } 15790 } 15791 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 15792 } 15793 l = 0; 15794 r = 0; 15795 c = 0; 15796 p = 0; 15797 this.nextPacket = function JpxImage_nextPacket() { 15798 for (; r <= maxDecompositionLevelsCount; r++) { 15799 for (; p < maxNumPrecinctsInLevel[r]; p++) { 15800 for (; c < componentsCount; c++) { 15801 var component = tile.components[c]; 15802 if (r > component.codingStyleParameters.decompositionLevelsCount) { 15803 continue; 15804 } 15805 var resolution = component.resolutions[r]; 15806 var numprecincts = resolution.precinctParameters.numprecincts; 15807 if (p >= numprecincts) { 15808 continue; 15809 } 15810 for (; l < layersCount;) { 15811 var packet = createPacket(resolution, p, l); 15812 l++; 15813 return packet; 15814 } 15815 l = 0; 15816 } 15817 c = 0; 15818 } 15819 p = 0; 15820 } 15821 error('JPX Error: Out of packets'); 15822 }; 15823 } 15824 function PositionComponentResolutionLayerIterator(context) { 15825 var siz = context.SIZ; 15826 var tileIndex = context.currentTile.index; 15827 var tile = context.tiles[tileIndex]; 15828 var layersCount = tile.codingStyleDefaultParameters.layersCount; 15829 var componentsCount = siz.Csiz; 15830 var precinctsSizes = getPrecinctSizesInImageScale(tile); 15831 var precinctsIterationSizes = precinctsSizes; 15832 var l = 0, r = 0, c = 0, px = 0, py = 0; 15833 this.nextPacket = function JpxImage_nextPacket() { 15834 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 15835 for (; px < precinctsIterationSizes.maxNumWide; px++) { 15836 for (; c < componentsCount; c++) { 15837 var component = tile.components[c]; 15838 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 15839 for (; r <= decompositionLevelsCount; r++) { 15840 var resolution = component.resolutions[r]; 15841 var sizeInImageScale = precinctsSizes.components[c].resolutions[r]; 15842 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 15843 if (k === null) { 15844 continue; 15845 } 15846 for (; l < layersCount;) { 15847 var packet = createPacket(resolution, k, l); 15848 l++; 15849 return packet; 15850 } 15851 l = 0; 15852 } 15853 r = 0; 15854 } 15855 c = 0; 15856 } 15857 px = 0; 15858 } 15859 error('JPX Error: Out of packets'); 15860 }; 15861 } 15862 function ComponentPositionResolutionLayerIterator(context) { 15863 var siz = context.SIZ; 15864 var tileIndex = context.currentTile.index; 15865 var tile = context.tiles[tileIndex]; 15866 var layersCount = tile.codingStyleDefaultParameters.layersCount; 15867 var componentsCount = siz.Csiz; 15868 var precinctsSizes = getPrecinctSizesInImageScale(tile); 15869 var l = 0, r = 0, c = 0, px = 0, py = 0; 15870 this.nextPacket = function JpxImage_nextPacket() { 15871 for (; c < componentsCount; ++c) { 15872 var component = tile.components[c]; 15873 var precinctsIterationSizes = precinctsSizes.components[c]; 15874 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 15875 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 15876 for (; px < precinctsIterationSizes.maxNumWide; px++) { 15877 for (; r <= decompositionLevelsCount; r++) { 15878 var resolution = component.resolutions[r]; 15879 var sizeInImageScale = precinctsIterationSizes.resolutions[r]; 15880 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 15881 if (k === null) { 15882 continue; 15883 } 15884 for (; l < layersCount;) { 15885 var packet = createPacket(resolution, k, l); 15886 l++; 15887 return packet; 15888 } 15889 l = 0; 15890 } 15891 r = 0; 15892 } 15893 px = 0; 15894 } 15895 py = 0; 15896 } 15897 error('JPX Error: Out of packets'); 15898 }; 15899 } 15900 function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 15901 var posX = pxIndex * precinctIterationSizes.minWidth; 15902 var posY = pyIndex * precinctIterationSizes.minHeight; 15903 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 15904 return null; 15905 } 15906 var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 15907 return posX / sizeInImageScale.height + startPrecinctRowIndex; 15908 } 15909 function getPrecinctSizesInImageScale(tile) { 15910 var componentsCount = tile.components.length; 15911 var minWidth = Number.MAX_VALUE; 15912 var minHeight = Number.MAX_VALUE; 15913 var maxNumWide = 0; 15914 var maxNumHigh = 0; 15915 var sizePerComponent = new Array(componentsCount); 15916 for (var c = 0; c < componentsCount; c++) { 15917 var component = tile.components[c]; 15918 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 15919 var sizePerResolution = new Array(decompositionLevelsCount + 1); 15920 var minWidthCurrentComponent = Number.MAX_VALUE; 15921 var minHeightCurrentComponent = Number.MAX_VALUE; 15922 var maxNumWideCurrentComponent = 0; 15923 var maxNumHighCurrentComponent = 0; 15924 var scale = 1; 15925 for (var r = decompositionLevelsCount; r >= 0; --r) { 15926 var resolution = component.resolutions[r]; 15927 var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 15928 var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 15929 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 15930 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 15931 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 15932 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 15933 sizePerResolution[r] = { 15934 width: widthCurrentResolution,
15935 height: heightCurrentResolution 15936 }; 15937 scale <<= 1; 15938 } 15939 minWidth = Math.min(minWidth, minWidthCurrentComponent); 15940 minHeight = Math.min(minHeight, minHeightCurrentComponent); 15941 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 15942 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 15943 sizePerComponent[c] = { 15944 resolutions: sizePerResolution, 15945 minWidth: minWidthCurrentComponent, 15946 minHeight: minHeightCurrentComponent, 15947 maxNumWide: maxNumWideCurrentComponent, 15948 maxNumHigh: maxNumHighCurrentComponent 15949 }; 15950 } 15951 return { 15952 components: sizePerComponent, 15953 minWidth: minWidth, 15954 minHeight: minHeight, 15955 maxNumWide: maxNumWide, 15956 maxNumHigh: maxNumHigh 15957 }; 15958 } 15959 function buildPackets(context) { 15960 var siz = context.SIZ; 15961 var tileIndex = context.currentTile.index; 15962 var tile = context.tiles[tileIndex]; 15963 var componentsCount = siz.Csiz; 15964 for (var c = 0; c < componentsCount; c++) { 15965 var component = tile.components[c]; 15966 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 15967 var resolutions = []; 15968 var subbands = []; 15969 for (var r = 0; r <= decompositionLevelsCount; r++) { 15970 var blocksDimensions = getBlocksDimensions(context, component, r); 15971 var resolution = {}; 15972 var scale = 1 << decompositionLevelsCount - r; 15973 resolution.trx0 = Math.ceil(component.tcx0 / scale); 15974 resolution.try0 = Math.ceil(component.tcy0 / scale); 15975 resolution.trx1 = Math.ceil(component.tcx1 / scale); 15976 resolution.try1 = Math.ceil(component.tcy1 / scale); 15977 resolution.resLevel = r; 15978 buildPrecincts(context, resolution, blocksDimensions); 15979 resolutions.push(resolution); 15980 var subband; 15981 if (r === 0) { 15982 subband = {}; 15983 subband.type = 'LL'; 15984 subband.tbx0 = Math.ceil(component.tcx0 / scale); 15985 subband.tby0 = Math.ceil(component.tcy0 / scale); 15986 subband.tbx1 = Math.ceil(component.tcx1 / scale); 15987 subband.tby1 = Math.ceil(component.tcy1 / scale); 15988 subband.resolution = resolution; 15989 buildCodeblocks(context, subband, blocksDimensions); 15990 subbands.push(subband); 15991 resolution.subbands = [subband]; 15992 } else { 15993 var bscale = 1 << decompositionLevelsCount - r + 1; 15994 var resolutionSubbands = []; 15995 subband = {}; 15996 subband.type = 'HL'; 15997 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 15998 subband.tby0 = Math.ceil(component.tcy0 / bscale); 15999 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 16000 subband.tby1 = Math.ceil(component.tcy1 / bscale); 16001 subband.resolution = resolution; 16002 buildCodeblocks(context, subband, blocksDimensions); 16003 subbands.push(subband); 16004 resolutionSubbands.push(subband); 16005 subband = {}; 16006 subband.type = 'LH'; 16007 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 16008 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 16009 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 16010 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 16011 subband.resolution = resolution; 16012 buildCodeblocks(context, subband, blocksDimensions); 16013 subbands.push(subband); 16014 resolutionSubbands.push(subband); 16015 subband = {}; 16016 subband.type = 'HH'; 16017 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 16018 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 16019 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 16020 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 16021 subband.resolution = resolution; 16022 buildCodeblocks(context, subband, blocksDimensions); 16023 subbands.push(subband); 16024 resolutionSubbands.push(subband); 16025 resolution.subbands = resolutionSubbands; 16026 } 16027 } 16028 component.resolutions = resolutions; 16029 component.subbands = subbands; 16030 } 16031 var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 16032 switch (progressionOrder) {
16033 case 0: 16034 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 16035 break; 16036 case 1: 16037 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 16038 break; 16039 case 2: 16040 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 16041 break; 16042 case 3: 16043 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 16044 break; 16045 case 4: 16046 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 16047 break; 16048 default: 16049 error('JPX Error: Unsupported progression order ' + progressionOrder); 16050 } 16051 } 16052 function parseTilePackets(context, data, offset, dataLength) { 16053 var position = 0; 16054 var buffer, bufferSize = 0, skipNextBit = false; 16055 function readBits(count) { 16056 while (bufferSize < count) { 16057 var b = data[offset + position]; 16058 position++; 16059 if (skipNextBit) { 16060 buffer = buffer << 7 | b; 16061 bufferSize += 7; 16062 skipNextBit = false; 16063 } else { 16064 buffer = buffer << 8 | b; 16065 bufferSize += 8; 16066 } 16067 if (b === 0xFF) { 16068 skipNextBit = true; 16069 } 16070 } 16071 bufferSize -= count; 16072 return buffer >>> bufferSize & (1 << count) - 1; 16073 } 16074 function skipMarkerIfEqual(value) { 16075 if (data[offset + position - 1] === 0xFF && data[offset + position] === value) { 16076 skipBytes(1); 16077 return true; 16078 } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) { 16079 skipBytes(2); 16080 return true; 16081 } 16082 return false; 16083 } 16084 function skipBytes(count) { 16085 position += count; 16086 } 16087 function alignToByte() { 16088 bufferSize = 0; 16089 if (skipNextBit) { 16090 position++; 16091 skipNextBit = false; 16092 } 16093 } 16094 function readCodingpasses() { 16095 if (readBits(1) === 0) { 16096 return 1; 16097 } 16098 if (readBits(1) === 0) { 16099 return 2; 16100 } 16101 var value = readBits(2); 16102 if (value < 3) { 16103 return value + 3; 16104 } 16105 value = readBits(5); 16106 if (value < 31) { 16107 return value + 6; 16108 } 16109 value = readBits(7); 16110 return value + 37; 16111 } 16112 var tileIndex = context.currentTile.index; 16113 var tile = context.tiles[tileIndex]; 16114 var sopMarkerUsed = context.COD.sopMarkerUsed; 16115 var ephMarkerUsed = context.COD.ephMarkerUsed; 16116 var packetsIterator = tile.packetsIterator; 16117 while (position < dataLength) { 16118 alignToByte(); 16119 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 16120 skipBytes(4); 16121 } 16122 var packet = packetsIterator.nextPacket(); 16123 if (!readBits(1)) { 16124 continue; 16125 } 16126 var layerNumber = packet.layerNumber; 16127 var queue = [], codeblock; 16128 for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) { 16129 codeblock = packet.codeblocks[i]; 16130 var precinct = codeblock.precinct; 16131 var codeblockColumn = codeblock.cbx - precinct.cbxMin; 16132 var codeblockRow = codeblock.cby - precinct.cbyMin; 16133 var codeblockIncluded = false; 16134 var firstTimeInclusion = false; 16135 var valueReady; 16136 if (codeblock['included'] !== undefined) { 16137 codeblockIncluded = !!readBits(1); 16138 } else { 16139 precinct = codeblock.precinct; 16140 var inclusionTree, zeroBitPlanesTree; 16141 if (precinct['inclusionTree'] !== undefined) { 16142 inclusionTree = precinct.inclusionTree; 16143 } else { 16144 var width = precinct.cbxMax - precinct.cbxMin + 1; 16145 var height = precinct.cbyMax - precinct.cbyMin + 1; 16146 inclusionTree = new InclusionTree(width, height, layerNumber); 16147 zeroBitPlanesTree = new TagTree(width, height); 16148 precinct.inclusionTree = inclusionTree; 16149 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 16150 } 16151 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 16152 while (true) { 16153 if (readBits(1)) { 16154 valueReady = !inclusionTree.nextLevel(); 16155 if (valueReady) { 16156 codeblock.included = true; 16157 codeblockIncluded = firstTimeInclusion = true; 16158 break; 16159 } 16160 } else { 16161 inclusionTree.incrementValue(layerNumber); 16162 break; 16163 } 16164 } 16165 } 16166 } 16167 if (!codeblockIncluded) { 16168 continue; 16169 } 16170 if (firstTimeInclusion) { 16171 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 16172 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 16173 while (true) { 16174 if (readBits(1)) { 16175 valueReady = !zeroBitPlanesTree.nextLevel(); 16176 if (valueReady) { 16177 break; 16178 } 16179 } else { 16180 zeroBitPlanesTree.incrementValue(); 16181 } 16182 } 16183 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 16184 } 16185 var codingpasses = readCodingpasses(); 16186 while (readBits(1)) { 16187 codeblock.Lblock++; 16188 } 16189 var codingpassesLog2 = log2(codingpasses); 16190 var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 16191 var codedDataLength = readBits(bits); 16192 queue.push({ 16193 codeblock: codeblock, 16194 codingpasses: codingpasses, 16195 dataLength: codedDataLength 16196 }); 16197 } 16198 alignToByte(); 16199 if (ephMarkerUsed) { 16200 skipMarkerIfEqual(0x92); 16201 } 16202 while (queue.length > 0) { 16203 var packetItem = queue.shift(); 16204 codeblock = packetItem.codeblock; 16205 if (codeblock['data'] === undefined) { 16206 codeblock.data = []; 16207 } 16208 codeblock.data.push({ 16209 data: data, 16210 start: offset + position, 16211 end: offset + position + packetItem.dataLength, 16212 codingpasses: packetItem.codingpasses 16213 }); 16214 position += packetItem.dataLength; 16215 } 16216 } 16217 return position; 16218 } 16219 function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) { 16220 var x0 = subband.tbx0; 16221 var y0 = subband.tby0; 16222 var width = subband.tbx1 - subband.tbx0; 16223 var codeblocks = subband.codeblocks; 16224 var right = subband.type.charAt(0) === 'H' ? 1 : 0; 16225 var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0; 16226 for (var i = 0, ii = codeblocks.length; i < ii; ++i) { 16227 var codeblock = codeblocks[i]; 16228 var blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 16229 var blockHeight = codeblock.tby1_ - codeblock.tby0_; 16230 if (blockWidth === 0 || blockHeight === 0) { 16231 continue; 16232 } 16233 if (codeblock['data'] === undefined) { 16234 continue; 16235 } 16236 var bitModel, currentCodingpassType; 16237 bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb); 16238 currentCodingpassType = 2; 16239 var data = codeblock.data, totalLength = 0, codingpasses = 0; 16240 var j, jj, dataItem; 16241 for (j = 0, jj = data.length; j < jj; j++) { 16242 dataItem = data[j]; 16243 totalLength += dataItem.end - dataItem.start; 16244 codingpasses += dataItem.codingpasses; 16245 } 16246 var encodedData = new Uint8Array(totalLength); 16247 var position = 0; 16248 for (j = 0, jj = data.length; j < jj; j++) { 16249 dataItem = data[j]; 16250 var chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 16251 encodedData.set(chunk, position); 16252 position += chunk.length; 16253 } 16254 var decoder = new ArithmeticDecoder(encodedData, 0, totalLength); 16255 bitModel.setDecoder(decoder); 16256 for (j = 0; j < codingpasses; j++) { 16257 switch (currentCodingpassType) { 16258 case 0: 16259 bitModel.runSignificancePropagationPass(); 16260 break; 16261 case 1: 16262 bitModel.runMagnitudeRefinementPass(); 16263 break; 16264 case 2: 16265 bitModel.runCleanupPass(); 16266 if (segmentationSymbolUsed) { 16267 bitModel.checkSegmentationSymbol(); 16268 } 16269 break; 16270 } 16271 currentCodingpassType = (currentCodingpassType + 1) % 3; 16272 } 16273 var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 16274 var sign = bitModel.coefficentsSign; 16275 var magnitude = bitModel.coefficentsMagnitude; 16276 var bitsDecoded = bitModel.bitsDecoded; 16277 var magnitudeCorrection = reversible ? 0 : 0.5; 16278 var k, n, nb; 16279 position = 0; 16280 var interleave = subband.type !== 'LL'; 16281 for (j = 0; j < blockHeight; j++) { 16282 var row = offset / width | 0; 16283 var levelOffset = 2 * row * (levelWidth - width) + right + bottom; 16284 for (k = 0; k < blockWidth; k++) { 16285 n = magnitude[position]; 16286 if (n !== 0) { 16287 n = (n + magnitudeCorrection) * delta; 16288 if (sign[position] !== 0) { 16289 n = -n; 16290 } 16291 nb = bitsDecoded[position]; 16292 var pos = interleave ? levelOffset + (offset << 1) : offset; 16293 if (reversible && nb >= mb) { 16294 coefficients[pos] = n; 16295 } else { 16296 coefficients[pos] = n * (1 << mb - nb); 16297 } 16298 } 16299 offset++; 16300 position++; 16301 } 16302 offset += width - blockWidth; 16303 } 16304 } 16305 } 16306 function transformTile(context, tile, c) { 16307 var component = tile.components[c]; 16308 var codingStyleParameters = component.codingStyleParameters; 16309 var quantizationParameters = component.quantizationParameters; 16310 var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 16311 var spqcds = quantizationParameters.SPqcds; 16312 var scalarExpounded = quantizationParameters.scalarExpounded; 16313 var guardBits = quantizationParameters.guardBits;
16314 var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 16315 var precision = context.components[c].precision; 16316 var reversible = codingStyleParameters.reversibleTransformation; 16317 var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 16318 var subbandCoefficients = []; 16319 var b = 0; 16320 for (var i = 0; i <= decompositionLevelsCount; i++) { 16321 var resolution = component.resolutions[i]; 16322 var width = resolution.trx1 - resolution.trx0; 16323 var height = resolution.try1 - resolution.try0; 16324 var coefficients = new Float32Array(width * height); 16325 for (var j = 0, jj = resolution.subbands.length; j < jj; j++) { 16326 var mu, epsilon; 16327 if (!scalarExpounded) { 16328 mu = spqcds[0].mu; 16329 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 16330 } else { 16331 mu = spqcds[b].mu; 16332 epsilon = spqcds[b].epsilon; 16333 b++; 16334 } 16335 var subband = resolution.subbands[j]; 16336 var gainLog2 = SubbandsGainLog2[subband.type]; 16337 var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048); 16338 var mb = guardBits + epsilon - 1; 16339 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed); 16340 } 16341 subbandCoefficients.push({ 16342 width: width, 16343 height: height, 16344 items: coefficients 16345 }); 16346 } 16347 var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0); 16348 return { 16349 left: component.tcx0, 16350 top: component.tcy0, 16351 width: result.width, 16352 height: result.height, 16353 items: result.items 16354 }; 16355 } 16356 function transformComponents(context) { 16357 var siz = context.SIZ; 16358 var components = context.components; 16359 var componentsCount = siz.Csiz; 16360 var resultImages = []; 16361 for (var i = 0, ii = context.tiles.length; i < ii; i++) { 16362 var tile = context.tiles[i]; 16363 var transformedTiles = []; 16364 var c; 16365 for (c = 0; c < componentsCount; c++) { 16366 transformedTiles[c] = transformTile(context, tile, c); 16367 } 16368 var tile0 = transformedTiles[0]; 16369 var out = new Uint8Array(tile0.items.length * componentsCount); 16370 var result = { 16371 left: tile0.left, 16372 top: tile0.top, 16373 width: tile0.width, 16374 height: tile0.height, 16375 items: out 16376 }; 16377 var shift, offset, max, min, maxK; 16378 var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val; 16379 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 16380 var fourComponents = componentsCount === 4; 16381 var y0items = transformedTiles[0].items; 16382 var y1items = transformedTiles[1].items; 16383 var y2items = transformedTiles[2].items; 16384 var y3items = fourComponents ? transformedTiles[3].items : null; 16385 shift = components[0].precision - 8; 16386 offset = (128 << shift) + 0.5; 16387 max = 255 * (1 << shift); 16388 maxK = max * 0.5; 16389 min = -maxK; 16390 var component0 = tile.components[0]; 16391 var alpha01 = componentsCount - 3; 16392 jj = y0items.length; 16393 if (!component0.codingStyleParameters.reversibleTransformation) { 16394 for (j = 0; j < jj; j++, pos += alpha01) { 16395 y0 = y0items[j] + offset; 16396 y1 = y1items[j]; 16397 y2 = y2items[j]; 16398 r = y0 + 1.402 * y2; 16399 g = y0 - 0.34413 * y1 - 0.71414 * y2; 16400 b = y0 + 1.772 * y1; 16401 out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift; 16402 out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift; 16403 out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift; 16404 } 16405 } else { 16406 for (j = 0; j < jj; j++, pos += alpha01) { 16407 y0 = y0items[j] + offset; 16408 y1 = y1items[j]; 16409 y2 = y2items[j]; 16410 g = y0 - (y2 + y1 >> 2); 16411 r = g + y2; 16412 b = g + y1; 16413 out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift; 16414 out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift; 16415 out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift; 16416 } 16417 } 16418 if (fourComponents) { 16419 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 16420 k = y3items[j]; 16421 out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift; 16422 } 16423 } 16424 } else { 16425 for (c = 0; c < componentsCount; c++) { 16426 var items = transformedTiles[c].items; 16427 shift = components[c].precision - 8; 16428 offset = (128 << shift) + 0.5; 16429 max = 127.5 * (1 << shift); 16430 min = -max; 16431 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 16432 val = items[j]; 16433 out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift; 16434 pos += componentsCount; 16435 } 16436 } 16437 } 16438 resultImages.push(result); 16439 } 16440 return resultImages; 16441 } 16442 function initializeTile(context, tileIndex) { 16443 var siz = context.SIZ; 16444 var componentsCount = siz.Csiz; 16445 var tile = context.tiles[tileIndex]; 16446 for (var c = 0; c < componentsCount; c++) { 16447 var component = tile.components[c]; 16448 var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 16449 component.quantizationParameters = qcdOrQcc; 16450 var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 16451 component.codingStyleParameters = codOrCoc; 16452 } 16453 tile.codingStyleDefaultParameters = context.currentTile.COD; 16454 } 16455 var TagTree = function TagTreeClosure() { 16456 function TagTree(width, height) { 16457 var levelsLength = log2(Math.max(width, height)) + 1; 16458 this.levels = []; 16459 for (var i = 0; i < levelsLength; i++) { 16460 var level = { 16461 width: width, 16462 height: height, 16463 items: [] 16464 }; 16465 this.levels.push(level); 16466 width = Math.ceil(width / 2);
16467 height = Math.ceil(height / 2); 16468 } 16469 } 16470 TagTree.prototype = { 16471 reset: function TagTree_reset(i, j) { 16472 var currentLevel = 0, value = 0, level; 16473 while (currentLevel < this.levels.length) { 16474 level = this.levels[currentLevel]; 16475 var index = i + j * level.width; 16476 if (level.items[index] !== undefined) { 16477 value = level.items[index]; 16478 break; 16479 } 16480 level.index = index; 16481 i >>= 1; 16482 j >>= 1; 16483 currentLevel++; 16484 } 16485 currentLevel--; 16486 level = this.levels[currentLevel]; 16487 level.items[level.index] = value; 16488 this.currentLevel = currentLevel; 16489 delete this.value; 16490 }, 16491 incrementValue: function TagTree_incrementValue() { 16492 var level = this.levels[this.currentLevel]; 16493 level.items[level.index]++; 16494 }, 16495 nextLevel: function TagTree_nextLevel() { 16496 var currentLevel = this.currentLevel; 16497 var level = this.levels[currentLevel]; 16498 var value = level.items[level.index]; 16499 currentLevel--; 16500 if (currentLevel < 0) { 16501 this.value = value; 16502 return false; 16503 } 16504 this.currentLevel = currentLevel; 16505 level = this.levels[currentLevel]; 16506 level.items[level.index] = value; 16507 return true; 16508 } 16509 }; 16510 return TagTree; 16511 }(); 16512 var InclusionTree = function InclusionTreeClosure() { 16513 function InclusionTree(width, height, defaultValue) { 16514 var levelsLength = log2(Math.max(width, height)) + 1; 16515 this.levels = []; 16516 for (var i = 0; i < levelsLength; i++) { 16517 var items = new Uint8Array(width * height); 16518 for (var j = 0, jj = items.length; j < jj; j++) { 16519 items[j] = defaultValue; 16520 } 16521 var level = { 16522 width: width, 16523 height: height, 16524 items: items 16525 }; 16526 this.levels.push(level); 16527 width = Math.ceil(width / 2); 16528 height = Math.ceil(height / 2); 16529 } 16530 } 16531 InclusionTree.prototype = { 16532 reset: function InclusionTree_reset(i, j, stopValue) { 16533 var currentLevel = 0; 16534 while (currentLevel < this.levels.length) { 16535 var level = this.levels[currentLevel]; 16536 var index = i + j * level.width; 16537 level.index = index; 16538 var value = level.items[index]; 16539 if (value === 0xFF) { 16540 break; 16541 } 16542 if (value > stopValue) { 16543 this.currentLevel = currentLevel; 16544 this.propagateValues(); 16545 return false; 16546 } 16547 i >>= 1; 16548 j >>= 1; 16549 currentLevel++; 16550 } 16551 this.currentLevel = currentLevel - 1; 16552 return true; 16553 }, 16554 incrementValue: function InclusionTree_incrementValue(stopValue) { 16555 var level = this.levels[this.currentLevel]; 16556 level.items[level.index] = stopValue + 1; 16557 this.propagateValues(); 16558 }, 16559 propagateValues: function InclusionTree_propagateValues() { 16560 var levelIndex = this.currentLevel; 16561 var level = this.levels[levelIndex]; 16562 var currentValue = level.items[level.index]; 16563 while (--levelIndex >= 0) { 16564 level = this.levels[levelIndex]; 16565 level.items[level.index] = currentValue; 16566 } 16567 }, 16568 nextLevel: function InclusionTree_nextLevel() { 16569 var currentLevel = this.currentLevel; 16570 var level = this.levels[currentLevel]; 16571 var value = level.items[level.index]; 16572 level.items[level.index] = 0xFF; 16573 currentLevel--; 16574 if (currentLevel < 0) { 16575 return false; 16576 } 16577 this.currentLevel = currentLevel; 16578 level = this.levels[currentLevel]; 16579 level.items[level.index] = value; 16580 return true; 16581 } 16582 }; 16583 return InclusionTree; 16584 }(); 16585 var BitModel = function BitModelClosure() { 16586 var UNIFORM_CONTEXT = 17; 16587 var RUNLENGTH_CONTEXT = 18; 16588 var LLAndLHContextsLabel = new Uint8Array([ 16589 0, 16590 5, 16591 8, 16592 0, 16593 3, 16594 7, 16595 8, 16596 0, 16597 4, 16598 7, 16599 8, 16600 0, 16601 0, 16602 0, 16603 0, 16604 0, 16605 1, 16606 6, 16607 8, 16608 0, 16609 3, 16610 7, 16611 8, 16612 0, 16613 4, 16614 7, 16615 8, 16616 0, 16617 0, 16618 0, 16619 0, 16620 0, 16621 2, 16622 6, 16623 8, 16624 0, 16625 3, 16626 7, 16627 8, 16628 0, 16629 4, 16630 7, 16631 8, 16632 0, 16633 0, 16634 0, 16635 0, 16636 0, 16637 2, 16638 6, 16639 8, 16640 0, 16641 3, 16642 7, 16643 8, 16644 0, 16645 4, 16646 7, 16647 8, 16648 0, 16649 0, 16650 0, 16651 0, 16652 0, 16653 2, 16654 6, 16655 8, 16656 0, 16657 3, 16658 7, 16659 8, 16660 0, 16661 4, 16662 7, 16663 8 16664 ]); 16665 var HLContextLabel = new Uint8Array([ 16666 0, 16667 3, 16668 4, 16669 0, 16670 5, 16671 7, 16672 7, 16673 0, 16674 8, 16675 8, 16676 8, 16677 0, 16678 0, 16679 0, 16680 0, 16681 0, 16682 1, 16683 3, 16684 4, 16685 0, 16686 6, 16687 7, 16688 7, 16689 0, 16690 8, 16691 8, 16692 8, 16693 0, 16694 0, 16695 0, 16696 0, 16697 0, 16698 2, 16699 3, 16700 4, 16701 0, 16702 6, 16703 7, 16704 7, 16705 0, 16706 8, 16707 8, 16708 8, 16709 0, 16710 0, 16711 0, 16712 0, 16713 0, 16714 2, 16715 3, 16716 4, 16717 0, 16718 6, 16719 7, 16720 7, 16721 0, 16722 8, 16723 8, 16724 8, 16725 0, 16726 0, 16727 0, 16728 0, 16729 0, 16730 2, 16731 3, 16732 4, 16733 0, 16734 6, 16735 7, 16736 7, 16737 0, 16738 8, 16739 8, 16740 8 16741 ]); 16742 var HHContextLabel = new Uint8Array([ 16743 0, 16744 1, 16745 2, 16746 0, 16747 1, 16748 2, 16749 2, 16750 0, 16751 2, 16752 2, 16753 2, 16754 0, 16755 0, 16756 0, 16757 0, 16758 0, 16759 3, 16760 4, 16761 5, 16762 0, 16763 4, 16764 5, 16765 5, 16766 0, 16767 5, 16768 5, 16769 5, 16770 0, 16771 0, 16772 0, 16773 0, 16774 0, 16775 6, 16776 7, 16777 7, 16778 0, 16779 7, 16780 7, 16781 7, 16782 0, 16783 7, 16784 7, 16785 7, 16786 0, 16787 0, 16788 0, 16789 0, 16790 0, 16791 8, 16792 8, 16793 8, 16794 0, 16795 8, 16796 8, 16797 8, 16798 0, 16799 8, 16800 8, 16801 8, 16802 0, 16803 0, 16804 0, 16805 0, 16806 0, 16807 8, 16808 8, 16809 8, 16810 0, 16811 8, 16812 8, 16813 8, 16814 0, 16815 8, 16816 8, 16817 8 16818 ]); 16819 function BitModel(width, height, subband, zeroBitPlanes, mb) { 16820 this.width = width; 16821 this.height = height; 16822 this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel; 16823 var coefficientCount = width * height; 16824 this.neighborsSignificance = new Uint8Array(coefficientCount); 16825 this.coefficentsSign = new Uint8Array(coefficientCount); 16826 this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount); 16827 this.processingFlags = new Uint8Array(coefficientCount); 16828 var bitsDecoded = new Uint8Array(coefficientCount); 16829 if (zeroBitPlanes !== 0) { 16830 for (var i = 0; i < coefficientCount; i++) { 16831 bitsDecoded[i] = zeroBitPlanes; 16832 } 16833 } 16834 this.bitsDecoded = bitsDecoded; 16835 this.reset(); 16836 } 16837 BitModel.prototype = { 16838 setDecoder: function BitModel_setDecoder(decoder) { 16839 this.decoder = decoder; 16840 }, 16841 reset: function BitModel_reset() { 16842 this.contexts = new Int8Array(19); 16843 this.contexts[0] = 4 << 1 | 0; 16844 this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0; 16845 this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0; 16846 }, 16847 setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) { 16848 var neighborsSignificance = this.neighborsSignificance; 16849 var width = this.width, height = this.height; 16850 var left = column > 0; 16851 var right = column + 1 < width; 16852 var i; 16853 if (row > 0) { 16854 i = index - width; 16855 if (left) { 16856 neighborsSignificance[i - 1] += 0x10; 16857 } 16858 if (right) { 16859 neighborsSignificance[i + 1] += 0x10; 16860 }
16861 neighborsSignificance[i] += 0x04; 16862 } 16863 if (row + 1 < height) { 16864 i = index + width; 16865 if (left) { 16866 neighborsSignificance[i - 1] += 0x10; 16867 } 16868 if (right) { 16869 neighborsSignificance[i + 1] += 0x10; 16870 } 16871 neighborsSignificance[i] += 0x04; 16872 } 16873 if (left) { 16874 neighborsSignificance[index - 1] += 0x01; 16875 } 16876 if (right) { 16877 neighborsSignificance[index + 1] += 0x01; 16878 } 16879 neighborsSignificance[index] |= 0x80; 16880 }, 16881 runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() { 16882 var decoder = this.decoder; 16883 var width = this.width, height = this.height; 16884 var coefficentsMagnitude = this.coefficentsMagnitude; 16885 var coefficentsSign = this.coefficentsSign; 16886 var neighborsSignificance = this.neighborsSignificance; 16887 var processingFlags = this.processingFlags; 16888 var contexts = this.contexts; 16889 var labels = this.contextLabelTable; 16890 var bitsDecoded = this.bitsDecoded; 16891 var processedInverseMask = ~1; 16892 var processedMask = 1; 16893 var firstMagnitudeBitMask = 2; 16894 for (var i0 = 0; i0 < height; i0 += 4) { 16895 for (var j = 0; j < width; j++) { 16896 var index = i0 * width + j; 16897 for (var i1 = 0; i1 < 4; i1++, index += width) { 16898 var i = i0 + i1; 16899 if (i >= height) { 16900 break; 16901 } 16902 processingFlags[index] &= processedInverseMask; 16903 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 16904 continue; 16905 } 16906 var contextLabel = labels[neighborsSignificance[index]]; 16907 var decision = decoder.readBit(contexts, contextLabel); 16908 if (decision) { 16909 var sign = this.decodeSignBit(i, j, index); 16910 coefficentsSign[index] = sign; 16911 coefficentsMagnitude[index] = 1; 16912 this.setNeighborsSignificance(i, j, index); 16913 processingFlags[index] |= firstMagnitudeBitMask; 16914 } 16915 bitsDecoded[index]++; 16916 processingFlags[index] |= processedMask; 16917 } 16918 } 16919 } 16920 }, 16921 decodeSignBit: function BitModel_decodeSignBit(row, column, index) { 16922 var width = this.width, height = this.height; 16923 var coefficentsMagnitude = this.coefficentsMagnitude; 16924 var coefficentsSign = this.coefficentsSign; 16925 var contribution, sign0, sign1, significance1; 16926 var contextLabel, decoded; 16927 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 16928 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 16929 sign1 = coefficentsSign[index + 1]; 16930 if (significance1) { 16931 sign0 = coefficentsSign[index - 1]; 16932 contribution = 1 - sign1 - sign0; 16933 } else { 16934 contribution = 1 - sign1 - sign1; 16935 } 16936 } else if (significance1) { 16937 sign0 = coefficentsSign[index - 1]; 16938 contribution = 1 - sign0 - sign0; 16939 } else { 16940 contribution = 0; 16941 } 16942 var horizontalContribution = 3 * contribution; 16943 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 16944 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 16945 sign1 = coefficentsSign[index + width]; 16946 if (significance1) { 16947 sign0 = coefficentsSign[index - width]; 16948 contribution = 1 - sign1 - sign0 + horizontalContribution; 16949 } else { 16950 contribution = 1 - sign1 - sign1 + horizontalContribution; 16951 } 16952 } else if (significance1) { 16953 sign0 = coefficentsSign[index - width]; 16954 contribution = 1 - sign0 - sign0 + horizontalContribution; 16955 } else { 16956 contribution = horizontalContribution; 16957 } 16958 if (contribution >= 0) { 16959 contextLabel = 9 + contribution; 16960 decoded = this.decoder.readBit(this.contexts, contextLabel); 16961 } else { 16962 contextLabel = 9 - contribution; 16963 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 16964 } 16965 return decoded; 16966 }, 16967 runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() { 16968 var decoder = this.decoder; 16969 var width = this.width, height = this.height; 16970 var coefficentsMagnitude = this.coefficentsMagnitude; 16971 var neighborsSignificance = this.neighborsSignificance; 16972 var contexts = this.contexts; 16973 var bitsDecoded = this.bitsDecoded; 16974 var processingFlags = this.processingFlags; 16975 var processedMask = 1; 16976 var firstMagnitudeBitMask = 2; 16977 var length = width * height; 16978 var width4 = width * 4; 16979 for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) { 16980 indexNext = Math.min(length, index0 + width4); 16981 for (var j = 0; j < width; j++) { 16982 for (var index = index0 + j; index < indexNext; index += width) { 16983 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 16984 continue; 16985 } 16986 var contextLabel = 16; 16987 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 16988 processingFlags[index] ^= firstMagnitudeBitMask; 16989 var significance = neighborsSignificance[index] & 127; 16990 contextLabel = significance === 0 ? 15 : 14; 16991 } 16992 var bit = decoder.readBit(contexts, contextLabel); 16993 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 16994 bitsDecoded[index]++; 16995 processingFlags[index] |= processedMask; 16996 } 16997 } 16998 } 16999 }, 17000 runCleanupPass: function BitModel_runCleanupPass() { 17001 var decoder = this.decoder; 17002 var width = this.width, height = this.height; 17003 var neighborsSignificance = this.neighborsSignificance; 17004 var coefficentsMagnitude = this.coefficentsMagnitude; 17005 var coefficentsSign = this.coefficentsSign; 17006 var contexts = this.contexts; 17007 var labels = this.contextLabelTable; 17008 var bitsDecoded = this.bitsDecoded; 17009 var processingFlags = this.processingFlags; 17010 var processedMask = 1; 17011 var firstMagnitudeBitMask = 2; 17012 var oneRowDown = width; 17013 var twoRowsDown = width * 2; 17014 var threeRowsDown = width * 3; 17015 var iNext; 17016 for (var i0 = 0; i0 < height; i0 = iNext) { 17017 iNext = Math.min(i0 + 4, height); 17018 var indexBase = i0 * width; 17019 var checkAllEmpty = i0 + 3 < height; 17020 for (var j = 0; j < width; j++) { 17021 var index0 = indexBase + j; 17022 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; 17023 var i1 = 0, index = index0; 17024 var i = i0, sign; 17025 if (allEmpty) { 17026 var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT); 17027 if (!hasSignificantCoefficent) { 17028 bitsDecoded[index0]++; 17029 bitsDecoded[index0 + oneRowDown]++; 17030 bitsDecoded[index0 + twoRowsDown]++; 17031 bitsDecoded[index0 + threeRowsDown]++; 17032 continue; 17033 } 17034 i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 17035 if (i1 !== 0) { 17036 i = i0 + i1; 17037 index += i1 * width; 17038 } 17039 sign = this.decodeSignBit(i, j, index); 17040 coefficentsSign[index] = sign; 17041 coefficentsMagnitude[index] = 1; 17042 this.setNeighborsSignificance(i, j, index);
17043 processingFlags[index] |= firstMagnitudeBitMask; 17044 index = index0; 17045 for (var i2 = i0; i2 <= i; i2++, index += width) { 17046 bitsDecoded[index]++; 17047 } 17048 i1++; 17049 } 17050 for (i = i0 + i1; i < iNext; i++, index += width) { 17051 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 17052 continue; 17053 } 17054 var contextLabel = labels[neighborsSignificance[index]]; 17055 var decision = decoder.readBit(contexts, contextLabel); 17056 if (decision === 1) { 17057 sign = this.decodeSignBit(i, j, index); 17058 coefficentsSign[index] = sign; 17059 coefficentsMagnitude[index] = 1; 17060 this.setNeighborsSignificance(i, j, index); 17061 processingFlags[index] |= firstMagnitudeBitMask; 17062 } 17063 bitsDecoded[index]++; 17064 } 17065 } 17066 } 17067 }, 17068 checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() { 17069 var decoder = this.decoder; 17070 var contexts = this.contexts; 17071 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); 17072 if (symbol !== 0xA) { 17073 error('JPX Error: Invalid segmentation symbol'); 17074 } 17075 } 17076 }; 17077 return BitModel; 17078 }(); 17079 var Transform = function TransformClosure() { 17080 function Transform() { 17081 } 17082 Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) { 17083 var ll = subbands[0]; 17084 for (var i = 1, ii = subbands.length; i < ii; i++) { 17085 ll = this.iterate(ll, subbands[i], u0, v0); 17086 } 17087 return ll; 17088 }; 17089 Transform.prototype.extend = function extend(buffer, offset, size) { 17090 var i1 = offset - 1, j1 = offset + 1; 17091 var i2 = offset + size - 2, j2 = offset + size; 17092 buffer[i1--] = buffer[j1++]; 17093 buffer[j2++] = buffer[i2--]; 17094 buffer[i1--] = buffer[j1++]; 17095 buffer[j2++] = buffer[i2--]; 17096 buffer[i1--] = buffer[j1++]; 17097 buffer[j2++] = buffer[i2--]; 17098 buffer[i1] = buffer[j1]; 17099 buffer[j2] = buffer[i2]; 17100 }; 17101 Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) { 17102 var llWidth = ll.width, llHeight = ll.height, llItems = ll.items; 17103 var width = hl_lh_hh.width; 17104 var height = hl_lh_hh.height; 17105 var items = hl_lh_hh.items; 17106 var i, j, k, l, u, v; 17107 for (k = 0, i = 0; i < llHeight; i++) { 17108 l = i * 2 * width; 17109 for (j = 0; j < llWidth; j++, k++, l += 2) { 17110 items[l] = llItems[k]; 17111 } 17112 } 17113 llItems = ll.items = null; 17114 var bufferPadding = 4; 17115 var rowBuffer = new Float32Array(width + 2 * bufferPadding); 17116 if (width === 1) { 17117 if ((u0 & 1) !== 0) { 17118 for (v = 0, k = 0; v < height; v++, k += width) { 17119 items[k] *= 0.5; 17120 } 17121 } 17122 } else { 17123 for (v = 0, k = 0; v < height; v++, k += width) { 17124 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 17125 this.extend(rowBuffer, bufferPadding, width); 17126 this.filter(rowBuffer, bufferPadding, width); 17127 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 17128 } 17129 } 17130 var numBuffers = 16; 17131 var colBuffers = []; 17132 for (i = 0; i < numBuffers; i++) { 17133 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 17134 } 17135 var b, currentBuffer = 0; 17136 ll = bufferPadding + height; 17137 if (height === 1) { 17138 if ((v0 & 1) !== 0) { 17139 for (u = 0; u < width; u++) { 17140 items[u] *= 0.5; 17141 } 17142 } 17143 } else { 17144 for (u = 0; u < width; u++) { 17145 if (currentBuffer === 0) { 17146 numBuffers = Math.min(width - u, numBuffers); 17147 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 17148 for (b = 0; b < numBuffers; b++) { 17149 colBuffers[b][l] = items[k + b]; 17150 } 17151 } 17152 currentBuffer = numBuffers; 17153 } 17154 currentBuffer--; 17155 var buffer = colBuffers[currentBuffer]; 17156 this.extend(buffer, bufferPadding, height); 17157 this.filter(buffer, bufferPadding, height); 17158 if (currentBuffer === 0) { 17159 k = u - numBuffers + 1; 17160 for (l = bufferPadding; l < ll; k += width, l++) { 17161 for (b = 0; b < numBuffers; b++) { 17162 items[k + b] = colBuffers[b][l]; 17163 } 17164 } 17165 } 17166 } 17167 } 17168 return { 17169 width: width, 17170 height: height, 17171 items: items 17172 }; 17173 }; 17174 return Transform; 17175 }(); 17176 var IrreversibleTransform = function IrreversibleTransformClosure() { 17177 function IrreversibleTransform() { 17178 Transform.call(this); 17179 } 17180 IrreversibleTransform.prototype = Object.create(Transform.prototype); 17181 IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) { 17182 var len = length >> 1; 17183 offset = offset | 0; 17184 var j, n, current, next; 17185 var alpha = -1.586134342059924; 17186 var beta = -0.052980118572961; 17187 var gamma = 0.882911075530934; 17188 var delta = 0.443506852043971; 17189 var K = 1.230174104914001; 17190 var K_ = 1 / K; 17191 j = offset - 3; 17192 for (n = len + 4; n--; j += 2) { 17193 x[j] *= K_; 17194 } 17195 j = offset - 2; 17196 current = delta * x[j - 1]; 17197 for (n = len + 3; n--; j += 2) { 17198 next = delta * x[j + 1]; 17199 x[j] = K * x[j] - current - next; 17200 if (n--) { 17201 j += 2; 17202 current = delta * x[j + 1]; 17203 x[j] = K * x[j] - current - next; 17204 } else { 17205 break; 17206 } 17207 } 17208 j = offset - 1; 17209 current = gamma * x[j - 1]; 17210 for (n = len + 2; n--; j += 2) { 17211 next = gamma * x[j + 1]; 17212 x[j] -= current + next; 17213 if (n--) { 17214 j += 2; 17215 current = gamma * x[j + 1]; 17216 x[j] -= current + next; 17217 } else { 17218 break; 17219 } 17220 } 17221 j = offset; 17222 current = beta * x[j - 1]; 17223 for (n = len + 1; n--; j += 2) { 17224 next = beta * x[j + 1]; 17225 x[j] -= current + next; 17226 if (n--) { 17227 j += 2; 17228 current = beta * x[j + 1]; 17229 x[j] -= current + next; 17230 } else { 17231 break; 17232 } 17233 } 17234 if (len !== 0) { 17235 j = offset + 1; 17236 current = alpha * x[j - 1]; 17237 for (n = len; n--; j += 2) { 17238 next = alpha * x[j + 1]; 17239 x[j] -= current + next; 17240 if (n--) { 17241 j += 2; 17242 current = alpha * x[j + 1]; 17243 x[j] -= current + next; 17244 } else { 17245 break; 17246 } 17247 } 17248 } 17249 }; 17250 return IrreversibleTransform; 17251 }();
17252 var ReversibleTransform = function ReversibleTransformClosure() { 17253 function ReversibleTransform() { 17254 Transform.call(this); 17255 } 17256 ReversibleTransform.prototype = Object.create(Transform.prototype); 17257 ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) { 17258 var len = length >> 1; 17259 offset = offset | 0; 17260 var j, n; 17261 for (j = offset, n = len + 1; n--; j += 2) { 17262 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 17263 } 17264 for (j = offset + 1, n = len; n--; j += 2) { 17265 x[j] += x[j - 1] + x[j + 1] >> 1; 17266 } 17267 }; 17268 return ReversibleTransform; 17269 }(); 17270 return JpxImage; 17271 }(); 17272 exports.JpxImage = JpxImage; 17273 })); 17274 (function (root, factory) { 17275 factory(root.pdfjsCoreMetrics = {}, root.pdfjsSharedUtil); 17276 }(this, function (exports, sharedUtil) { 17277 var getLookupTableFactory = sharedUtil.getLookupTableFactory; 17278 var getMetrics = getLookupTableFactory(function (t) { 17279 t['Courier'] = 600; 17280 t['Courier-Bold'] = 600; 17281 t['Courier-BoldOblique'] = 600; 17282 t['Courier-Oblique'] = 600; 17283 t['Helvetica'] = getLookupTableFactory(function (t) { 17284 t['space'] = 278; 17285 t['exclam'] = 278; 17286 t['quotedbl'] = 355; 17287 t['numbersign'] = 556; 17288 t['dollar'] = 556; 17289 t['percent'] = 889; 17290 t['ampersand'] = 667; 17291 t['quoteright'] = 222; 17292 t['parenleft'] = 333; 17293 t['parenright'] = 333; 17294 t['asterisk'] = 389; 17295 t['plus'] = 584; 17296 t['comma'] = 278; 17297 t['hyphen'] = 333; 17298 t['period'] = 278; 17299 t['slash'] = 278; 17300 t['zero'] = 556; 17301 t['one'] = 556; 17302 t['two'] = 556; 17303 t['three'] = 556; 17304 t['four'] = 556; 17305 t['five'] = 556; 17306 t['six'] = 556; 17307 t['seven'] = 556; 17308 t['eight'] = 556; 17309 t['nine'] = 556; 17310 t['colon'] = 278; 17311 t['semicolon'] = 278; 17312 t['less'] = 584; 17313 t['equal'] = 584; 17314 t['greater'] = 584; 17315 t['question'] = 556; 17316 t['at'] = 1015; 17317 t['A'] = 667; 17318 t['B'] = 667; 17319 t['C'] = 722; 17320 t['D'] = 722; 17321 t['E'] = 667; 17322 t['F'] = 611; 17323 t['G'] = 778; 17324 t['H'] = 722; 17325 t['I'] = 278; 17326 t['J'] = 500; 17327 t['K'] = 667; 17328 t['L'] = 556; 17329 t['M'] = 833; 17330 t['N'] = 722; 17331 t['O'] = 778; 17332 t['P'] = 667; 17333 t['Q'] = 778; 17334 t['R'] = 722; 17335 t['S'] = 667; 17336 t['T'] = 611; 17337 t['U'] = 722; 17338 t['V'] = 667; 17339 t['W'] = 944; 17340 t['X'] = 667; 17341 t['Y'] = 667; 17342 t['Z'] = 611; 17343 t['bracketleft'] = 278; 17344 t['backslash'] = 278; 17345 t['bracketright'] = 278; 17346 t['asciicircum'] = 469; 17347 t['underscore'] = 556; 17348 t['quoteleft'] = 222; 17349 t['a'] = 556; 17350 t['b'] = 556; 17351 t['c'] = 500; 17352 t['d'] = 556; 17353 t['e'] = 556; 17354 t['f'] = 278; 17355 t['g'] = 556; 17356 t['h'] = 556; 17357 t['i'] = 222; 17358 t['j'] = 222; 17359 t['k'] = 500; 17360 t['l'] = 222; 17361 t['m'] = 833; 17362 t['n'] = 556; 17363 t['o'] = 556; 17364 t['p'] = 556; 17365 t['q'] = 556; 17366 t['r'] = 333; 17367 t['s'] = 500; 17368 t['t'] = 278; 17369 t['u'] = 556; 17370 t['v'] = 500; 17371 t['w'] = 722; 17372 t['x'] = 500; 17373 t['y'] = 500; 17374 t['z'] = 500; 17375 t['braceleft'] = 334; 17376 t['bar'] = 260; 17377 t['braceright'] = 334; 17378 t['asciitilde'] = 584; 17379 t['exclamdown'] = 333; 17380 t['cent'] = 556; 17381 t['sterling'] = 556; 17382 t['fraction'] = 167; 17383 t['yen'] = 556; 17384 t['florin'] = 556; 17385 t['section'] = 556; 17386 t['currency'] = 556; 17387 t['quotesingle'] = 191; 17388 t['quotedblleft'] = 333; 17389 t['guillemotleft'] = 556; 17390 t['guilsinglleft'] = 333; 17391 t['guilsinglright'] = 333; 17392 t['fi'] = 500; 17393 t['fl'] = 500; 17394 t['endash'] = 556; 17395 t['dagger'] = 556; 17396 t['daggerdbl'] = 556; 17397 t['periodcentered'] = 278; 17398 t['paragraph'] = 537; 17399 t['bullet'] = 350; 17400 t['quotesinglbase'] = 222; 17401 t['quotedblbase'] = 333; 17402 t['quotedblright'] = 333; 17403 t['guillemotright'] = 556; 17404 t['ellipsis'] = 1000; 17405 t['perthousand'] = 1000; 17406 t['questiondown'] = 611; 17407 t['grave'] = 333; 17408 t['acute'] = 333; 17409 t['circumflex'] = 333; 17410 t['tilde'] = 333; 17411 t['macron'] = 333; 17412 t['breve'] = 333; 17413 t['dotaccent'] = 333; 17414 t['dieresis'] = 333; 17415 t['ring'] = 333; 17416 t['cedilla'] = 333; 17417 t['hungarumlaut'] = 333; 17418 t['ogonek'] = 333; 17419 t['caron'] = 333; 17420 t['emdash'] = 1000; 17421 t['AE'] = 1000; 17422 t['ordfeminine'] = 370; 17423 t['Lslash'] = 556; 17424 t['Oslash'] = 778; 17425 t['OE'] = 1000; 17426 t['ordmasculine'] = 365; 17427 t['ae'] = 889; 17428 t['dotlessi'] = 278; 17429 t['lslash'] = 222;
17430 t['oslash'] = 611; 17431 t['oe'] = 944; 17432 t['germandbls'] = 611; 17433 t['Idieresis'] = 278; 17434 t['eacute'] = 556; 17435 t['abreve'] = 556; 17436 t['uhungarumlaut'] = 556; 17437 t['ecaron'] = 556; 17438 t['Ydieresis'] = 667; 17439 t['divide'] = 584; 17440 t['Yacute'] = 667; 17441 t['Acircumflex'] = 667; 17442 t['aacute'] = 556; 17443 t['Ucircumflex'] = 722; 17444 t['yacute'] = 500; 17445 t['scommaaccent'] = 500; 17446 t['ecircumflex'] = 556; 17447 t['Uring'] = 722; 17448 t['Udieresis'] = 722; 17449 t['aogonek'] = 556; 17450 t['Uacute'] = 722; 17451 t['uogonek'] = 556; 17452 t['Edieresis'] = 667; 17453 t['Dcroat'] = 722; 17454 t['commaaccent'] = 250; 17455 t['copyright'] = 737; 17456 t['Emacron'] = 667; 17457 t['ccaron'] = 500; 17458 t['aring'] = 556; 17459 t['Ncommaaccent'] = 722; 17460 t['lacute'] = 222; 17461 t['agrave'] = 556; 17462 t['Tcommaaccent'] = 611; 17463 t['Cacute'] = 722; 17464 t['atilde'] = 556; 17465 t['Edotaccent'] = 667; 17466 t['scaron'] = 500; 17467 t['scedilla'] = 500; 17468 t['iacute'] = 278; 17469 t['lozenge'] = 471; 17470 t['Rcaron'] = 722; 17471 t['Gcommaaccent'] = 778; 17472 t['ucircumflex'] = 556; 17473 t['acircumflex'] = 556; 17474 t['Amacron'] = 667; 17475 t['rcaron'] = 333; 17476 t['ccedilla'] = 500; 17477 t['Zdotaccent'] = 611; 17478 t['Thorn'] = 667; 17479 t['Omacron'] = 778; 17480 t['Racute'] = 722; 17481 t['Sacute'] = 667; 17482 t['dcaron'] = 643; 17483 t['Umacron'] = 722; 17484 t['uring'] = 556; 17485 t['threesuperior'] = 333; 17486 t['Ograve'] = 778; 17487 t['Agrave'] = 667; 17488 t['Abreve'] = 667; 17489 t['multiply'] = 584; 17490 t['uacute'] = 556; 17491 t['Tcaron'] = 611; 17492 t['partialdiff'] = 476; 17493 t['ydieresis'] = 500; 17494 t['Nacute'] = 722; 17495 t['icircumflex'] = 278; 17496 t['Ecircumflex'] = 667; 17497 t['adieresis'] = 556; 17498 t['edieresis'] = 556; 17499 t['cacute'] = 500; 17500 t['nacute'] = 556; 17501 t['umacron'] = 556; 17502 t['Ncaron'] = 722; 17503 t['Iacute'] = 278; 17504 t['plusminus'] = 584; 17505 t['brokenbar'] = 260; 17506 t['registered'] = 737; 17507 t['Gbreve'] = 778; 17508 t['Idotaccent'] = 278; 17509 t['summation'] = 600; 17510 t['Egrave'] = 667; 17511 t['racute'] = 333; 17512 t['omacron'] = 556; 17513 t['Zacute'] = 611; 17514 t['Zcaron'] = 611; 17515 t['greaterequal'] = 549; 17516 t['Eth'] = 722; 17517 t['Ccedilla'] = 722; 17518 t['lcommaaccent'] = 222; 17519 t['tcaron'] = 317; 17520 t['eogonek'] = 556; 17521 t['Uogonek'] = 722; 17522 t['Aacute'] = 667; 17523 t['Adieresis'] = 667; 17524 t['egrave'] = 556; 17525 t['zacute'] = 500; 17526 t['iogonek'] = 222; 17527 t['Oacute'] = 778; 17528 t['oacute'] = 556; 17529 t['amacron'] = 556; 17530 t['sacute'] = 500; 17531 t['idieresis'] = 278; 17532 t['Ocircumflex'] = 778; 17533 t['Ugrave'] = 722; 17534 t['Delta'] = 612; 17535 t['thorn'] = 556; 17536 t['twosuperior'] = 333; 17537 t['Odieresis'] = 778; 17538 t['mu'] = 556; 17539 t['igrave'] = 278; 17540 t['ohungarumlaut'] = 556; 17541 t['Eogonek'] = 667; 17542 t['dcroat'] = 556; 17543 t['threequarters'] = 834; 17544 t['Scedilla'] = 667; 17545 t['lcaron'] = 299; 17546 t['Kcommaaccent'] = 667; 17547 t['Lacute'] = 556; 17548 t['trademark'] = 1000; 17549 t['edotaccent'] = 556; 17550 t['Igrave'] = 278; 17551 t['Imacron'] = 278; 17552 t['Lcaron'] = 556; 17553 t['onehalf'] = 834; 17554 t['lessequal'] = 549; 17555 t['ocircumflex'] = 556; 17556 t['ntilde'] = 556; 17557 t['Uhungarumlaut'] = 722; 17558 t['Eacute'] = 667; 17559 t['emacron'] = 556; 17560 t['gbreve'] = 556; 17561 t['onequarter'] = 834; 17562 t['Scaron'] = 667; 17563 t['Scommaaccent'] = 667; 17564 t['Ohungarumlaut'] = 778; 17565 t['degree'] = 400; 17566 t['ograve'] = 556; 17567 t['Ccaron'] = 722; 17568 t['ugrave'] = 556; 17569 t['radical'] = 453; 17570 t['Dcaron'] = 722; 17571 t['rcommaaccent'] = 333; 17572 t['Ntilde'] = 722; 17573 t['otilde'] = 556; 17574 t['Rcommaaccent'] = 722; 17575 t['Lcommaaccent'] = 556; 17576 t['Atilde'] = 667; 17577 t['Aogonek'] = 667; 17578 t['Aring'] = 667; 17579 t['Otilde'] = 778; 17580 t['zdotaccent'] = 500; 17581 t['Ecaron'] = 667; 17582 t['Iogonek'] = 278; 17583 t['kcommaaccent'] = 500; 17584 t['minus'] = 584; 17585 t['Icircumflex'] = 278; 17586 t['ncaron'] = 556; 17587 t['tcommaaccent'] = 278; 17588 t['logicalnot'] = 584; 17589 t['odieresis'] = 556; 17590 t['udieresis'] = 556; 17591 t['notequal'] = 549; 17592 t['gcommaaccent'] = 556; 17593 t['eth'] = 556; 17594 t['zcaron'] = 500; 17595 t['ncommaaccent'] = 556; 17596 t['onesuperior'] = 333; 17597 t['imacron'] = 278; 17598 t['Euro'] = 556; 17599 }); 17600 t['Helvetica-Bold'] = getLookupTableFactory(function (t) { 17601 t['space'] = 278; 17602 t['exclam'] = 333; 17603 t['quotedbl'] = 474; 17604 t['numbersign'] = 556; 17605 t['dollar'] = 556; 17606 t['percent'] = 889; 17607 t['ampersand'] = 722; 17608 t['quoteright'] = 278; 17609 t['parenleft'] = 333; 17610 t['parenright'] = 333; 17611 t['asterisk'] = 389; 17612 t['plus'] = 584; 17613 t['comma'] = 278; 17614 t['hyphen'] = 333; 17615 t['period'] = 278; 17616 t['slash'] = 278; 17617 t['zero'] = 556; 17618 t['one'] = 556; 17619 t['two'] = 556; 17620 t['three'] = 556; 17621 t['four'] = 556; 17622 t['five'] = 556; 17623 t['six'] = 556; 17624 t['seven'] = 556; 17625 t['eight'] = 556; 17626 t['nine'] = 556; 17627 t['colon'] = 333; 17628 t['semicolon'] = 333; 17629 t['less'] = 584; 17630 t['equal'] = 584; 17631 t['greater'] = 584; 17632 t['question'] = 611; 17633 t['at'] = 975; 17634 t['A'] = 722; 17635 t['B'] = 722; 17636 t['C'] = 722; 17637 t['D'] = 722; 17638 t['E'] = 667; 17639 t['F'] = 611; 17640 t['G'] = 778; 17641 t['H'] = 722; 17642 t['I'] = 278; 17643 t['J'] = 556; 17644 t['K'] = 722; 17645 t['L'] = 611; 17646 t['M'] = 833; 17647 t['N'] = 722; 17648 t['O'] = 778; 17649 t['P'] = 667; 17650 t['Q'] = 778; 17651 t['R'] = 722; 17652 t['S'] = 667; 17653 t['T'] = 611; 17654 t['U'] = 722; 17655 t['V'] = 667; 17656 t['W'] = 944; 17657 t['X'] = 667; 17658 t['Y'] = 667; 17659 t['Z'] = 611; 17660 t['bracketleft'] = 333; 17661 t['backslash'] = 278; 17662 t['bracketright'] = 333; 17663 t['asciicircum'] = 584; 17664 t['underscore'] = 556; 17665 t['quoteleft'] = 278; 17666 t['a'] = 556; 17667 t['b'] = 611; 17668 t['c'] = 556; 17669 t['d'] = 611; 17670 t['e'] = 556; 17671 t['f'] = 333; 17672 t['g'] = 611; 17673 t['h'] = 611; 17674 t['i'] = 278; 17675 t['j'] = 278; 17676 t['k'] = 556; 17677 t['l'] = 278; 17678 t['m'] = 889; 17679 t['n'] = 611; 17680 t['o'] = 611; 17681 t['p'] = 611; 17682 t['q'] = 611; 17683 t['r'] = 389; 17684 t['s'] = 556; 17685 t['t'] = 333; 17686 t['u'] = 611; 17687 t['v'] = 556; 17688 t['w'] = 778; 17689 t['x'] = 556; 17690 t['y'] = 556; 17691 t['z'] = 500; 17692 t['braceleft'] = 389; 17693 t['bar'] = 280; 17694 t['braceright'] = 389; 17695 t['asciitilde'] = 584; 17696 t['exclamdown'] = 333; 17697 t['cent'] = 556; 17698 t['sterling'] = 556; 17699 t['fraction'] = 167; 17700 t['yen'] = 556; 17701 t['florin'] = 556; 17702 t['section'] = 556; 17703 t['currency'] = 556; 17704 t['quotesingle'] = 238; 17705 t['quotedblleft'] = 500; 17706 t['guillemotleft'] = 556; 17707 t['guilsinglleft'] = 333; 17708 t['guilsinglright'] = 333; 17709 t['fi'] = 611; 17710 t['fl'] = 611; 17711 t['endash'] = 556; 17712 t['dagger'] = 556; 17713 t['daggerdbl'] = 556;
17714 t['periodcentered'] = 278; 17715 t['paragraph'] = 556; 17716 t['bullet'] = 350; 17717 t['quotesinglbase'] = 278; 17718 t['quotedblbase'] = 500; 17719 t['quotedblright'] = 500; 17720 t['guillemotright'] = 556; 17721 t['ellipsis'] = 1000; 17722 t['perthousand'] = 1000; 17723 t['questiondown'] = 611; 17724 t['grave'] = 333; 17725 t['acute'] = 333; 17726 t['circumflex'] = 333; 17727 t['tilde'] = 333; 17728 t['macron'] = 333; 17729 t['breve'] = 333; 17730 t['dotaccent'] = 333; 17731 t['dieresis'] = 333; 17732 t['ring'] = 333; 17733 t['cedilla'] = 333; 17734 t['hungarumlaut'] = 333; 17735 t['ogonek'] = 333; 17736 t['caron'] = 333; 17737 t['emdash'] = 1000; 17738 t['AE'] = 1000; 17739 t['ordfeminine'] = 370; 17740 t['Lslash'] = 611; 17741 t['Oslash'] = 778; 17742 t['OE'] = 1000; 17743 t['ordmasculine'] = 365; 17744 t['ae'] = 889; 17745 t['dotlessi'] = 278; 17746 t['lslash'] = 278; 17747 t['oslash'] = 611; 17748 t['oe'] = 944; 17749 t['germandbls'] = 611; 17750 t['Idieresis'] = 278; 17751 t['eacute'] = 556; 17752 t['abreve'] = 556; 17753 t['uhungarumlaut'] = 611; 17754 t['ecaron'] = 556; 17755 t['Ydieresis'] = 667; 17756 t['divide'] = 584; 17757 t['Yacute'] = 667; 17758 t['Acircumflex'] = 722; 17759 t['aacute'] = 556; 17760 t['Ucircumflex'] = 722; 17761 t['yacute'] = 556; 17762 t['scommaaccent'] = 556; 17763 t['ecircumflex'] = 556; 17764 t['Uring'] = 722; 17765 t['Udieresis'] = 722; 17766 t['aogonek'] = 556; 17767 t['Uacute'] = 722; 17768 t['uogonek'] = 611; 17769 t['Edieresis'] = 667; 17770 t['Dcroat'] = 722; 17771 t['commaaccent'] = 250; 17772 t['copyright'] = 737; 17773 t['Emacron'] = 667; 17774 t['ccaron'] = 556; 17775 t['aring'] = 556; 17776 t['Ncommaaccent'] = 722; 17777 t['lacute'] = 278; 17778 t['agrave'] = 556; 17779 t['Tcommaaccent'] = 611; 17780 t['Cacute'] = 722; 17781 t['atilde'] = 556; 17782 t['Edotaccent'] = 667; 17783 t['scaron'] = 556; 17784 t['scedilla'] = 556; 17785 t['iacute'] = 278; 17786 t['lozenge'] = 494; 17787 t['Rcaron'] = 722; 17788 t['Gcommaaccent'] = 778; 17789 t['ucircumflex'] = 611; 17790 t['acircumflex'] = 556; 17791 t['Amacron'] = 722; 17792 t['rcaron'] = 389; 17793 t['ccedilla'] = 556; 17794 t['Zdotaccent'] = 611; 17795 t['Thorn'] = 667; 17796 t['Omacron'] = 778; 17797 t['Racute'] = 722; 17798 t['Sacute'] = 667; 17799 t['dcaron'] = 743; 17800 t['Umacron'] = 722; 17801 t['uring'] = 611; 17802 t['threesuperior'] = 333; 17803 t['Ograve'] = 778; 17804 t['Agrave'] = 722; 17805 t['Abreve'] = 722; 17806 t['multiply'] = 584; 17807 t['uacute'] = 611; 17808 t['Tcaron'] = 611; 17809 t['partialdiff'] = 494; 17810 t['ydieresis'] = 556; 17811 t['Nacute'] = 722; 17812 t['icircumflex'] = 278; 17813 t['Ecircumflex'] = 667; 17814 t['adieresis'] = 556; 17815 t['edieresis'] = 556; 17816 t['cacute'] = 556; 17817 t['nacute'] = 611; 17818 t['umacron'] = 611; 17819 t['Ncaron'] = 722; 17820 t['Iacute'] = 278; 17821 t['plusminus'] = 584; 17822 t['brokenbar'] = 280; 17823 t['registered'] = 737; 17824 t['Gbreve'] = 778; 17825 t['Idotaccent'] = 278; 17826 t['summation'] = 600; 17827 t['Egrave'] = 667; 17828 t['racute'] = 389; 17829 t['omacron'] = 611; 17830 t['Zacute'] = 611; 17831 t['Zcaron'] = 611; 17832 t['greaterequal'] = 549; 17833 t['Eth'] = 722; 17834 t['Ccedilla'] = 722; 17835 t['lcommaaccent'] = 278; 17836 t['tcaron'] = 389; 17837 t['eogonek'] = 556; 17838 t['Uogonek'] = 722; 17839 t['Aacute'] = 722; 17840 t['Adieresis'] = 722; 17841 t['egrave'] = 556; 17842 t['zacute'] = 500; 17843 t['iogonek'] = 278; 17844 t['Oacute'] = 778; 17845 t['oacute'] = 611; 17846 t['amacron'] = 556; 17847 t['sacute'] = 556; 17848 t['idieresis'] = 278; 17849 t['Ocircumflex'] = 778; 17850 t['Ugrave'] = 722; 17851 t['Delta'] = 612; 17852 t['thorn'] = 611; 17853 t['twosuperior'] = 333; 17854 t['Odieresis'] = 778; 17855 t['mu'] = 611; 17856 t['igrave'] = 278; 17857 t['ohungarumlaut'] = 611; 17858 t['Eogonek'] = 667; 17859 t['dcroat'] = 611; 17860 t['threequarters'] = 834; 17861 t['Scedilla'] = 667; 17862 t['lcaron'] = 400; 17863 t['Kcommaaccent'] = 722; 17864 t['Lacute'] = 611; 17865 t['trademark'] = 1000; 17866 t['edotaccent'] = 556; 17867 t['Igrave'] = 278; 17868 t['Imacron'] = 278; 17869 t['Lcaron'] = 611; 17870 t['onehalf'] = 834; 17871 t['lessequal'] = 549; 17872 t['ocircumflex'] = 611; 17873 t['ntilde'] = 611; 17874 t['Uhungarumlaut'] = 722; 17875 t['Eacute'] = 667; 17876 t['emacron'] = 556; 17877 t['gbreve'] = 611; 17878 t['onequarter'] = 834; 17879 t['Scaron'] = 667; 17880 t['Scommaaccent'] = 667; 17881 t['Ohungarumlaut'] = 778; 17882 t['degree'] = 400; 17883 t['ograve'] = 611; 17884 t['Ccaron'] = 722; 17885 t['ugrave'] = 611; 17886 t['radical'] = 549; 17887 t['Dcaron'] = 722; 17888 t['rcommaaccent'] = 389; 17889 t['Ntilde'] = 722; 17890 t['otilde'] = 611; 17891 t['Rcommaaccent'] = 722; 17892 t['Lcommaaccent'] = 611; 17893 t['Atilde'] = 722; 17894 t['Aogonek'] = 722; 17895 t['Aring'] = 722; 17896 t['Otilde'] = 778; 17897 t['zdotaccent'] = 500; 17898 t['Ecaron'] = 667; 17899 t['Iogonek'] = 278; 17900 t['kcommaaccent'] = 556; 17901 t['minus'] = 584; 17902 t['Icircumflex'] = 278; 17903 t['ncaron'] = 611; 17904 t['tcommaaccent'] = 333; 17905 t['logicalnot'] = 584; 17906 t['odieresis'] = 611; 17907 t['udieresis'] = 611; 17908 t['notequal'] = 549; 17909 t['gcommaaccent'] = 611; 17910 t['eth'] = 611; 17911 t['zcaron'] = 500; 17912 t['ncommaaccent'] = 611; 17913 t['onesuperior'] = 333; 17914 t['imacron'] = 278; 17915 t['Euro'] = 556; 17916 }); 17917 t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) { 17918 t['space'] = 278; 17919 t['exclam'] = 333; 17920 t['quotedbl'] = 474; 17921 t['numbersign'] = 556; 17922 t['dollar'] = 556; 17923 t['percent'] = 889; 17924 t['ampersand'] = 722; 17925 t['quoteright'] = 278; 17926 t['parenleft'] = 333; 17927 t['parenright'] = 333; 17928 t['asterisk'] = 389; 17929 t['plus'] = 584; 17930 t['comma'] = 278; 17931 t['hyphen'] = 333; 17932 t['period'] = 278; 17933 t['slash'] = 278; 17934 t['zero'] = 556; 17935 t['one'] = 556; 17936 t['two'] = 556; 17937 t['three'] = 556; 17938 t['four'] = 556; 17939 t['five'] = 556; 17940 t['six'] = 556; 17941 t['seven'] = 556; 17942 t['eight'] = 556; 17943 t['nine'] = 556; 17944 t['colon'] = 333; 17945 t['semicolon'] = 333; 17946 t['less'] = 584; 17947 t['equal'] = 584; 17948 t['greater'] = 584; 17949 t['question'] = 611; 17950 t['at'] = 975; 17951 t['A'] = 722; 17952 t['B'] = 722; 17953 t['C'] = 722; 17954 t['D'] = 722; 17955 t['E'] = 667; 17956 t['F'] = 611; 17957 t['G'] = 778; 17958 t['H'] = 722; 17959 t['I'] = 278; 17960 t['J'] = 556; 17961 t['K'] = 722; 17962 t['L'] = 611; 17963 t['M'] = 833; 17964 t['N'] = 722; 17965 t['O'] = 778; 17966 t['P'] = 667; 17967 t['Q'] = 778; 17968 t['R'] = 722; 17969 t['S'] = 667; 17970 t['T'] = 611; 17971 t['U'] = 722; 17972 t['V'] = 667; 17973 t['W'] = 944; 17974 t['X'] = 667; 17975 t['Y'] = 667; 17976 t['Z'] = 611; 17977 t['bracketleft'] = 333; 17978 t['backslash'] = 278; 17979 t['bracketright'] = 333; 17980 t['asciicircum'] = 584; 17981 t['underscore'] = 556; 17982 t['quoteleft'] = 278; 17983 t['a'] = 556; 17984 t['b'] = 611; 17985 t['c'] = 556; 17986 t['d'] = 611; 17987 t['e'] = 556; 17988 t['f'] = 333; 17989 t['g'] = 611; 17990 t['h'] = 611; 17991 t['i'] = 278; 17992 t['j'] = 278; 17993 t['k'] = 556; 17994 t['l'] = 278; 17995 t['m'] = 889; 17996 t['n'] = 611; 17997 t['o'] = 611; 17998 t['p'] = 611; 17999 t['q'] = 611; 18000 t['r'] = 389; 18001 t['s'] = 556; 18002 t['t'] = 333; 18003 t['u'] = 611; 18004 t['v'] = 556; 18005 t['w'] = 778; 18006 t['x'] = 556; 18007 t['y'] = 556; 18008 t['z'] = 500; 18009 t['braceleft'] = 389; 18010 t['bar'] = 280; 18011 t['braceright'] = 389; 18012 t['asciitilde'] = 584; 18013 t['exclamdown'] = 333; 18014 t['cent'] = 556; 18015 t['sterling'] = 556; 18016 t['fraction'] = 167; 18017 t['yen'] = 556; 18018 t['florin'] = 556; 18019 t['section'] = 556; 18020 t['currency'] = 556; 18021 t['quotesingle'] = 238; 18022 t['quotedblleft'] = 500; 18023 t['guillemotleft'] = 556; 18024 t['guilsinglleft'] = 333; 18025 t['guilsinglright'] = 333; 18026 t['fi'] = 611; 18027 t['fl'] = 611; 18028 t['endash'] = 556; 18029 t['dagger'] = 556; 18030 t['daggerdbl'] = 556;
18031 t['periodcentered'] = 278; 18032 t['paragraph'] = 556; 18033 t['bullet'] = 350; 18034 t['quotesinglbase'] = 278; 18035 t['quotedblbase'] = 500; 18036 t['quotedblright'] = 500; 18037 t['guillemotright'] = 556; 18038 t['ellipsis'] = 1000; 18039 t['perthousand'] = 1000; 18040 t['questiondown'] = 611; 18041 t['grave'] = 333; 18042 t['acute'] = 333; 18043 t['circumflex'] = 333; 18044 t['tilde'] = 333; 18045 t['macron'] = 333; 18046 t['breve'] = 333; 18047 t['dotaccent'] = 333; 18048 t['dieresis'] = 333; 18049 t['ring'] = 333; 18050 t['cedilla'] = 333; 18051 t['hungarumlaut'] = 333; 18052 t['ogonek'] = 333; 18053 t['caron'] = 333; 18054 t['emdash'] = 1000; 18055 t['AE'] = 1000; 18056 t['ordfeminine'] = 370; 18057 t['Lslash'] = 611; 18058 t['Oslash'] = 778; 18059 t['OE'] = 1000; 18060 t['ordmasculine'] = 365; 18061 t['ae'] = 889; 18062 t['dotlessi'] = 278; 18063 t['lslash'] = 278; 18064 t['oslash'] = 611; 18065 t['oe'] = 944; 18066 t['germandbls'] = 611; 18067 t['Idieresis'] = 278; 18068 t['eacute'] = 556; 18069 t['abreve'] = 556; 18070 t['uhungarumlaut'] = 611; 18071 t['ecaron'] = 556; 18072 t['Ydieresis'] = 667; 18073 t['divide'] = 584; 18074 t['Yacute'] = 667; 18075 t['Acircumflex'] = 722; 18076 t['aacute'] = 556; 18077 t['Ucircumflex'] = 722; 18078 t['yacute'] = 556; 18079 t['scommaaccent'] = 556; 18080 t['ecircumflex'] = 556; 18081 t['Uring'] = 722; 18082 t['Udieresis'] = 722; 18083 t['aogonek'] = 556; 18084 t['Uacute'] = 722; 18085 t['uogonek'] = 611; 18086 t['Edieresis'] = 667; 18087 t['Dcroat'] = 722; 18088 t['commaaccent'] = 250; 18089 t['copyright'] = 737; 18090 t['Emacron'] = 667; 18091 t['ccaron'] = 556; 18092 t['aring'] = 556; 18093 t['Ncommaaccent'] = 722; 18094 t['lacute'] = 278; 18095 t['agrave'] = 556; 18096 t['Tcommaaccent'] = 611; 18097 t['Cacute'] = 722; 18098 t['atilde'] = 556; 18099 t['Edotaccent'] = 667; 18100 t['scaron'] = 556; 18101 t['scedilla'] = 556; 18102 t['iacute'] = 278; 18103 t['lozenge'] = 494; 18104 t['Rcaron'] = 722; 18105 t['Gcommaaccent'] = 778; 18106 t['ucircumflex'] = 611; 18107 t['acircumflex'] = 556; 18108 t['Amacron'] = 722; 18109 t['rcaron'] = 389; 18110 t['ccedilla'] = 556; 18111 t['Zdotaccent'] = 611; 18112 t['Thorn'] = 667; 18113 t['Omacron'] = 778; 18114 t['Racute'] = 722; 18115 t['Sacute'] = 667; 18116 t['dcaron'] = 743; 18117 t['Umacron'] = 722; 18118 t['uring'] = 611; 18119 t['threesuperior'] = 333; 18120 t['Ograve'] = 778; 18121 t['Agrave'] = 722; 18122 t['Abreve'] = 722; 18123 t['multiply'] = 584; 18124 t['uacute'] = 611; 18125 t['Tcaron'] = 611; 18126 t['partialdiff'] = 494; 18127 t['ydieresis'] = 556; 18128 t['Nacute'] = 722; 18129 t['icircumflex'] = 278; 18130 t['Ecircumflex'] = 667; 18131 t['adieresis'] = 556; 18132 t['edieresis'] = 556; 18133 t['cacute'] = 556; 18134 t['nacute'] = 611; 18135 t['umacron'] = 611; 18136 t['Ncaron'] = 722; 18137 t['Iacute'] = 278; 18138 t['plusminus'] = 584; 18139 t['brokenbar'] = 280; 18140 t['registered'] = 737; 18141 t['Gbreve'] = 778; 18142 t['Idotaccent'] = 278; 18143 t['summation'] = 600; 18144 t['Egrave'] = 667; 18145 t['racute'] = 389; 18146 t['omacron'] = 611; 18147 t['Zacute'] = 611; 18148 t['Zcaron'] = 611; 18149 t['greaterequal'] = 549; 18150 t['Eth'] = 722; 18151 t['Ccedilla'] = 722; 18152 t['lcommaaccent'] = 278; 18153 t['tcaron'] = 389; 18154 t['eogonek'] = 556; 18155 t['Uogonek'] = 722; 18156 t['Aacute'] = 722; 18157 t['Adieresis'] = 722; 18158 t['egrave'] = 556; 18159 t['zacute'] = 500; 18160 t['iogonek'] = 278; 18161 t['Oacute'] = 778; 18162 t['oacute'] = 611; 18163 t['amacron'] = 556; 18164 t['sacute'] = 556; 18165 t['idieresis'] = 278; 18166 t['Ocircumflex'] = 778; 18167 t['Ugrave'] = 722; 18168 t['Delta'] = 612; 18169 t['thorn'] = 611; 18170 t['twosuperior'] = 333; 18171 t['Odieresis'] = 778; 18172 t['mu'] = 611; 18173 t['igrave'] = 278; 18174 t['ohungarumlaut'] = 611; 18175 t['Eogonek'] = 667; 18176 t['dcroat'] = 611; 18177 t['threequarters'] = 834; 18178 t['Scedilla'] = 667; 18179 t['lcaron'] = 400; 18180 t['Kcommaaccent'] = 722; 18181 t['Lacute'] = 611; 18182 t['trademark'] = 1000; 18183 t['edotaccent'] = 556; 18184 t['Igrave'] = 278; 18185 t['Imacron'] = 278; 18186 t['Lcaron'] = 611; 18187 t['onehalf'] = 834; 18188 t['lessequal'] = 549; 18189 t['ocircumflex'] = 611; 18190 t['ntilde'] = 611; 18191 t['Uhungarumlaut'] = 722; 18192 t['Eacute'] = 667; 18193 t['emacron'] = 556; 18194 t['gbreve'] = 611; 18195 t['onequarter'] = 834; 18196 t['Scaron'] = 667; 18197 t['Scommaaccent'] = 667; 18198 t['Ohungarumlaut'] = 778; 18199 t['degree'] = 400; 18200 t['ograve'] = 611; 18201 t['Ccaron'] = 722; 18202 t['ugrave'] = 611; 18203 t['radical'] = 549; 18204 t['Dcaron'] = 722; 18205 t['rcommaaccent'] = 389; 18206 t['Ntilde'] = 722; 18207 t['otilde'] = 611; 18208 t['Rcommaaccent'] = 722; 18209 t['Lcommaaccent'] = 611; 18210 t['Atilde'] = 722; 18211 t['Aogonek'] = 722; 18212 t['Aring'] = 722; 18213 t['Otilde'] = 778; 18214 t['zdotaccent'] = 500; 18215 t['Ecaron'] = 667; 18216 t['Iogonek'] = 278; 18217 t['kcommaaccent'] = 556; 18218 t['minus'] = 584; 18219 t['Icircumflex'] = 278; 18220 t['ncaron'] = 611; 18221 t['tcommaaccent'] = 333; 18222 t['logicalnot'] = 584; 18223 t['odieresis'] = 611; 18224 t['udieresis'] = 611; 18225 t['notequal'] = 549; 18226 t['gcommaaccent'] = 611; 18227 t['eth'] = 611; 18228 t['zcaron'] = 500; 18229 t['ncommaaccent'] = 611; 18230 t['onesuperior'] = 333; 18231 t['imacron'] = 278; 18232 t['Euro'] = 556; 18233 }); 18234 t['Helvetica-Oblique'] = getLookupTableFactory(function (t) { 18235 t['space'] = 278; 18236 t['exclam'] = 278; 18237 t['quotedbl'] = 355; 18238 t['numbersign'] = 556; 18239 t['dollar'] = 556; 18240 t['percent'] = 889; 18241 t['ampersand'] = 667; 18242 t['quoteright'] = 222; 18243 t['parenleft'] = 333; 18244 t['parenright'] = 333; 18245 t['asterisk'] = 389; 18246 t['plus'] = 584; 18247 t['comma'] = 278; 18248 t['hyphen'] = 333; 18249 t['period'] = 278; 18250 t['slash'] = 278; 18251 t['zero'] = 556; 18252 t['one'] = 556; 18253 t['two'] = 556; 18254 t['three'] = 556; 18255 t['four'] = 556; 18256 t['five'] = 556; 18257 t['six'] = 556; 18258 t['seven'] = 556; 18259 t['eight'] = 556; 18260 t['nine'] = 556; 18261 t['colon'] = 278; 18262 t['semicolon'] = 278; 18263 t['less'] = 584; 18264 t['equal'] = 584; 18265 t['greater'] = 584; 18266 t['question'] = 556; 18267 t['at'] = 1015; 18268 t['A'] = 667; 18269 t['B'] = 667; 18270 t['C'] = 722; 18271 t['D'] = 722; 18272 t['E'] = 667; 18273 t['F'] = 611; 18274 t['G'] = 778; 18275 t['H'] = 722; 18276 t['I'] = 278; 18277 t['J'] = 500; 18278 t['K'] = 667; 18279 t['L'] = 556; 18280 t['M'] = 833; 18281 t['N'] = 722; 18282 t['O'] = 778; 18283 t['P'] = 667; 18284 t['Q'] = 778; 18285 t['R'] = 722; 18286 t['S'] = 667; 18287 t['T'] = 611; 18288 t['U'] = 722; 18289 t['V'] = 667; 18290 t['W'] = 944; 18291 t['X'] = 667; 18292 t['Y'] = 667; 18293 t['Z'] = 611; 18294 t['bracketleft'] = 278; 18295 t['backslash'] = 278; 18296 t['bracketright'] = 278; 18297 t['asciicircum'] = 469; 18298 t['underscore'] = 556; 18299 t['quoteleft'] = 222; 18300 t['a'] = 556; 18301 t['b'] = 556; 18302 t['c'] = 500; 18303 t['d'] = 556; 18304 t['e'] = 556; 18305 t['f'] = 278; 18306 t['g'] = 556; 18307 t['h'] = 556; 18308 t['i'] = 222; 18309 t['j'] = 222; 18310 t['k'] = 500; 18311 t['l'] = 222; 18312 t['m'] = 833; 18313 t['n'] = 556; 18314 t['o'] = 556; 18315 t['p'] = 556; 18316 t['q'] = 556; 18317 t['r'] = 333; 18318 t['s'] = 500; 18319 t['t'] = 278; 18320 t['u'] = 556; 18321 t['v'] = 500; 18322 t['w'] = 722; 18323 t['x'] = 500; 18324 t['y'] = 500; 18325 t['z'] = 500; 18326 t['braceleft'] = 334; 18327 t['bar'] = 260; 18328 t['braceright'] = 334; 18329 t['asciitilde'] = 584; 18330 t['exclamdown'] = 333; 18331 t['cent'] = 556; 18332 t['sterling'] = 556; 18333 t['fraction'] = 167; 18334 t['yen'] = 556; 18335 t['florin'] = 556; 18336 t['section'] = 556; 18337 t['currency'] = 556; 18338 t['quotesingle'] = 191; 18339 t['quotedblleft'] = 333; 18340 t['guillemotleft'] = 556; 18341 t['guilsinglleft'] = 333; 18342 t['guilsinglright'] = 333; 18343 t['fi'] = 500; 18344 t['fl'] = 500; 18345 t['endash'] = 556; 18346 t['dagger'] = 556; 18347 t['daggerdbl'] = 556;
18348 t['periodcentered'] = 278; 18349 t['paragraph'] = 537; 18350 t['bullet'] = 350; 18351 t['quotesinglbase'] = 222; 18352 t['quotedblbase'] = 333; 18353 t['quotedblright'] = 333; 18354 t['guillemotright'] = 556; 18355 t['ellipsis'] = 1000; 18356 t['perthousand'] = 1000; 18357 t['questiondown'] = 611; 18358 t['grave'] = 333; 18359 t['acute'] = 333; 18360 t['circumflex'] = 333; 18361 t['tilde'] = 333; 18362 t['macron'] = 333; 18363 t['breve'] = 333; 18364 t['dotaccent'] = 333; 18365 t['dieresis'] = 333; 18366 t['ring'] = 333; 18367 t['cedilla'] = 333; 18368 t['hungarumlaut'] = 333; 18369 t['ogonek'] = 333; 18370 t['caron'] = 333; 18371 t['emdash'] = 1000; 18372 t['AE'] = 1000; 18373 t['ordfeminine'] = 370; 18374 t['Lslash'] = 556; 18375 t['Oslash'] = 778; 18376 t['OE'] = 1000; 18377 t['ordmasculine'] = 365; 18378 t['ae'] = 889; 18379 t['dotlessi'] = 278; 18380 t['lslash'] = 222; 18381 t['oslash'] = 611; 18382 t['oe'] = 944; 18383 t['germandbls'] = 611; 18384 t['Idieresis'] = 278; 18385 t['eacute'] = 556; 18386 t['abreve'] = 556; 18387 t['uhungarumlaut'] = 556; 18388 t['ecaron'] = 556; 18389 t['Ydieresis'] = 667; 18390 t['divide'] = 584; 18391 t['Yacute'] = 667; 18392 t['Acircumflex'] = 667; 18393 t['aacute'] = 556; 18394 t['Ucircumflex'] = 722; 18395 t['yacute'] = 500; 18396 t['scommaaccent'] = 500; 18397 t['ecircumflex'] = 556; 18398 t['Uring'] = 722; 18399 t['Udieresis'] = 722; 18400 t['aogonek'] = 556; 18401 t['Uacute'] = 722; 18402 t['uogonek'] = 556; 18403 t['Edieresis'] = 667; 18404 t['Dcroat'] = 722; 18405 t['commaaccent'] = 250; 18406 t['copyright'] = 737; 18407 t['Emacron'] = 667; 18408 t['ccaron'] = 500; 18409 t['aring'] = 556; 18410 t['Ncommaaccent'] = 722; 18411 t['lacute'] = 222; 18412 t['agrave'] = 556; 18413 t['Tcommaaccent'] = 611; 18414 t['Cacute'] = 722; 18415 t['atilde'] = 556; 18416 t['Edotaccent'] = 667; 18417 t['scaron'] = 500; 18418 t['scedilla'] = 500; 18419 t['iacute'] = 278; 18420 t['lozenge'] = 471; 18421 t['Rcaron'] = 722; 18422 t['Gcommaaccent'] = 778; 18423 t['ucircumflex'] = 556; 18424 t['acircumflex'] = 556; 18425 t['Amacron'] = 667; 18426 t['rcaron'] = 333; 18427 t['ccedilla'] = 500; 18428 t['Zdotaccent'] = 611; 18429 t['Thorn'] = 667; 18430 t['Omacron'] = 778; 18431 t['Racute'] = 722; 18432 t['Sacute'] = 667; 18433 t['dcaron'] = 643; 18434 t['Umacron'] = 722; 18435 t['uring'] = 556; 18436 t['threesuperior'] = 333; 18437 t['Ograve'] = 778; 18438 t['Agrave'] = 667; 18439 t['Abreve'] = 667; 18440 t['multiply'] = 584; 18441 t['uacute'] = 556; 18442 t['Tcaron'] = 611; 18443 t['partialdiff'] = 476; 18444 t['ydieresis'] = 500; 18445 t['Nacute'] = 722; 18446 t['icircumflex'] = 278; 18447 t['Ecircumflex'] = 667; 18448 t['adieresis'] = 556; 18449 t['edieresis'] = 556; 18450 t['cacute'] = 500; 18451 t['nacute'] = 556; 18452 t['umacron'] = 556; 18453 t['Ncaron'] = 722; 18454 t['Iacute'] = 278; 18455 t['plusminus'] = 584; 18456 t['brokenbar'] = 260; 18457 t['registered'] = 737; 18458 t['Gbreve'] = 778; 18459 t['Idotaccent'] = 278; 18460 t['summation'] = 600; 18461 t['Egrave'] = 667; 18462 t['racute'] = 333; 18463 t['omacron'] = 556; 18464 t['Zacute'] = 611; 18465 t['Zcaron'] = 611; 18466 t['greaterequal'] = 549; 18467 t['Eth'] = 722; 18468 t['Ccedilla'] = 722; 18469 t['lcommaaccent'] = 222; 18470 t['tcaron'] = 317; 18471 t['eogonek'] = 556; 18472 t['Uogonek'] = 722; 18473 t['Aacute'] = 667; 18474 t['Adieresis'] = 667; 18475 t['egrave'] = 556; 18476 t['zacute'] = 500; 18477 t['iogonek'] = 222; 18478 t['Oacute'] = 778; 18479 t['oacute'] = 556; 18480 t['amacron'] = 556; 18481 t['sacute'] = 500; 18482 t['idieresis'] = 278; 18483 t['Ocircumflex'] = 778; 18484 t['Ugrave'] = 722; 18485 t['Delta'] = 612; 18486 t['thorn'] = 556; 18487 t['twosuperior'] = 333; 18488 t['Odieresis'] = 778; 18489 t['mu'] = 556; 18490 t['igrave'] = 278; 18491 t['ohungarumlaut'] = 556; 18492 t['Eogonek'] = 667; 18493 t['dcroat'] = 556; 18494 t['threequarters'] = 834; 18495 t['Scedilla'] = 667; 18496 t['lcaron'] = 299; 18497 t['Kcommaaccent'] = 667; 18498 t['Lacute'] = 556; 18499 t['trademark'] = 1000; 18500 t['edotaccent'] = 556; 18501 t['Igrave'] = 278; 18502 t['Imacron'] = 278; 18503 t['Lcaron'] = 556; 18504 t['onehalf'] = 834; 18505 t['lessequal'] = 549; 18506 t['ocircumflex'] = 556; 18507 t['ntilde'] = 556; 18508 t['Uhungarumlaut'] = 722; 18509 t['Eacute'] = 667; 18510 t['emacron'] = 556; 18511 t['gbreve'] = 556; 18512 t['onequarter'] = 834; 18513 t['Scaron'] = 667; 18514 t['Scommaaccent'] = 667; 18515 t['Ohungarumlaut'] = 778; 18516 t['degree'] = 400; 18517 t['ograve'] = 556; 18518 t['Ccaron'] = 722; 18519 t['ugrave'] = 556; 18520 t['radical'] = 453; 18521 t['Dcaron'] = 722; 18522 t['rcommaaccent'] = 333; 18523 t['Ntilde'] = 722; 18524 t['otilde'] = 556; 18525 t['Rcommaaccent'] = 722; 18526 t['Lcommaaccent'] = 556; 18527 t['Atilde'] = 667; 18528 t['Aogonek'] = 667; 18529 t['Aring'] = 667; 18530 t['Otilde'] = 778; 18531 t['zdotaccent'] = 500; 18532 t['Ecaron'] = 667; 18533 t['Iogonek'] = 278; 18534 t['kcommaaccent'] = 500; 18535 t['minus'] = 584; 18536 t['Icircumflex'] = 278; 18537 t['ncaron'] = 556; 18538 t['tcommaaccent'] = 278; 18539 t['logicalnot'] = 584; 18540 t['odieresis'] = 556; 18541 t['udieresis'] = 556; 18542 t['notequal'] = 549; 18543 t['gcommaaccent'] = 556; 18544 t['eth'] = 556; 18545 t['zcaron'] = 500; 18546 t['ncommaaccent'] = 556; 18547 t['onesuperior'] = 333; 18548 t['imacron'] = 278; 18549 t['Euro'] = 556; 18550 }); 18551 t['Symbol'] = getLookupTableFactory(function (t) { 18552 t['space'] = 250; 18553 t['exclam'] = 333; 18554 t['universal'] = 713; 18555 t['numbersign'] = 500; 18556 t['existential'] = 549; 18557 t['percent'] = 833; 18558 t['ampersand'] = 778; 18559 t['suchthat'] = 439; 18560 t['parenleft'] = 333; 18561 t['parenright'] = 333; 18562 t['asteriskmath'] = 500; 18563 t['plus'] = 549; 18564 t['comma'] = 250; 18565 t['minus'] = 549; 18566 t['period'] = 250; 18567 t['slash'] = 278; 18568 t['zero'] = 500; 18569 t['one'] = 500; 18570 t['two'] = 500; 18571 t['three'] = 500; 18572 t['four'] = 500; 18573 t['five'] = 500; 18574 t['six'] = 500; 18575 t['seven'] = 500; 18576 t['eight'] = 500; 18577 t['nine'] = 500; 18578 t['colon'] = 278; 18579 t['semicolon'] = 278; 18580 t['less'] = 549; 18581 t['equal'] = 549; 18582 t['greater'] = 549; 18583 t['question'] = 444; 18584 t['congruent'] = 549; 18585 t['Alpha'] = 722; 18586 t['Beta'] = 667; 18587 t['Chi'] = 722; 18588 t['Delta'] = 612; 18589 t['Epsilon'] = 611; 18590 t['Phi'] = 763; 18591 t['Gamma'] = 603; 18592 t['Eta'] = 722; 18593 t['Iota'] = 333; 18594 t['theta1'] = 631; 18595 t['Kappa'] = 722; 18596 t['Lambda'] = 686; 18597 t['Mu'] = 889; 18598 t['Nu'] = 722; 18599 t['Omicron'] = 722; 18600 t['Pi'] = 768; 18601 t['Theta'] = 741; 18602 t['Rho'] = 556;
18603 t['Sigma'] = 592; 18604 t['Tau'] = 611; 18605 t['Upsilon'] = 690; 18606 t['sigma1'] = 439; 18607 t['Omega'] = 768; 18608 t['Xi'] = 645; 18609 t['Psi'] = 795; 18610 t['Zeta'] = 611; 18611 t['bracketleft'] = 333; 18612 t['therefore'] = 863; 18613 t['bracketright'] = 333; 18614 t['perpendicular'] = 658; 18615 t['underscore'] = 500; 18616 t['radicalex'] = 500; 18617 t['alpha'] = 631; 18618 t['beta'] = 549; 18619 t['chi'] = 549; 18620 t['delta'] = 494; 18621 t['epsilon'] = 439; 18622 t['phi'] = 521; 18623 t['gamma'] = 411; 18624 t['eta'] = 603; 18625 t['iota'] = 329; 18626 t['phi1'] = 603; 18627 t['kappa'] = 549; 18628 t['lambda'] = 549; 18629 t['mu'] = 576; 18630 t['nu'] = 521; 18631 t['omicron'] = 549; 18632 t['pi'] = 549; 18633 t['theta'] = 521; 18634 t['rho'] = 549; 18635 t['sigma'] = 603; 18636 t['tau'] = 439; 18637 t['upsilon'] = 576; 18638 t['omega1'] = 713; 18639 t['omega'] = 686; 18640 t['xi'] = 493; 18641 t['psi'] = 686; 18642 t['zeta'] = 494; 18643 t['braceleft'] = 480; 18644 t['bar'] = 200; 18645 t['braceright'] = 480; 18646 t['similar'] = 549; 18647 t['Euro'] = 750; 18648 t['Upsilon1'] = 620; 18649 t['minute'] = 247; 18650 t['lessequal'] = 549; 18651 t['fraction'] = 167; 18652 t['infinity'] = 713; 18653 t['florin'] = 500; 18654 t['club'] = 753; 18655 t['diamond'] = 753; 18656 t['heart'] = 753; 18657 t['spade'] = 753; 18658 t['arrowboth'] = 1042; 18659 t['arrowleft'] = 987; 18660 t['arrowup'] = 603; 18661 t['arrowright'] = 987; 18662 t['arrowdown'] = 603; 18663 t['degree'] = 400; 18664 t['plusminus'] = 549; 18665 t['second'] = 411; 18666 t['greaterequal'] = 549; 18667 t['multiply'] = 549; 18668 t['proportional'] = 713; 18669 t['partialdiff'] = 494; 18670 t['bullet'] = 460; 18671 t['divide'] = 549; 18672 t['notequal'] = 549; 18673 t['equivalence'] = 549; 18674 t['approxequal'] = 549; 18675 t['ellipsis'] = 1000; 18676 t['arrowvertex'] = 603; 18677 t['arrowhorizex'] = 1000; 18678 t['carriagereturn'] = 658; 18679 t['aleph'] = 823; 18680 t['Ifraktur'] = 686; 18681 t['Rfraktur'] = 795; 18682 t['weierstrass'] = 987; 18683 t['circlemultiply'] = 768; 18684 t['circleplus'] = 768; 18685 t['emptyset'] = 823; 18686 t['intersection'] = 768; 18687 t['union'] = 768; 18688 t['propersuperset'] = 713; 18689 t['reflexsuperset'] = 713; 18690 t['notsubset'] = 713; 18691 t['propersubset'] = 713; 18692 t['reflexsubset'] = 713; 18693 t['element'] = 713; 18694 t['notelement'] = 713; 18695 t['angle'] = 768; 18696 t['gradient'] = 713; 18697 t['registerserif'] = 790; 18698 t['copyrightserif'] = 790; 18699 t['trademarkserif'] = 890; 18700 t['product'] = 823; 18701 t['radical'] = 549; 18702 t['dotmath'] = 250; 18703 t['logicalnot'] = 713; 18704 t['logicaland'] = 603; 18705 t['logicalor'] = 603; 18706 t['arrowdblboth'] = 1042; 18707 t['arrowdblleft'] = 987; 18708 t['arrowdblup'] = 603; 18709 t['arrowdblright'] = 987; 18710 t['arrowdbldown'] = 603; 18711 t['lozenge'] = 494; 18712 t['angleleft'] = 329; 18713 t['registersans'] = 790; 18714 t['copyrightsans'] = 790; 18715 t['trademarksans'] = 786; 18716 t['summation'] = 713; 18717 t['parenlefttp'] = 384; 18718 t['parenleftex'] = 384; 18719 t['parenleftbt'] = 384; 18720 t['bracketlefttp'] = 384; 18721 t['bracketleftex'] = 384; 18722 t['bracketleftbt'] = 384; 18723 t['bracelefttp'] = 494; 18724 t['braceleftmid'] = 494; 18725 t['braceleftbt'] = 494; 18726 t['braceex'] = 494; 18727 t['angleright'] = 329; 18728 t['integral'] = 274; 18729 t['integraltp'] = 686; 18730 t['integralex'] = 686; 18731 t['integralbt'] = 686; 18732 t['parenrighttp'] = 384; 18733 t['parenrightex'] = 384; 18734 t['parenrightbt'] = 384; 18735 t['bracketrighttp'] = 384; 18736 t['bracketrightex'] = 384; 18737 t['bracketrightbt'] = 384; 18738 t['bracerighttp'] = 494; 18739 t['bracerightmid'] = 494; 18740 t['bracerightbt'] = 494; 18741 t['apple'] = 790; 18742 }); 18743 t['Times-Roman'] = getLookupTableFactory(function (t) { 18744 t['space'] = 250; 18745 t['exclam'] = 333; 18746 t['quotedbl'] = 408; 18747 t['numbersign'] = 500; 18748 t['dollar'] = 500; 18749 t['percent'] = 833; 18750 t['ampersand'] = 778; 18751 t['quoteright'] = 333; 18752 t['parenleft'] = 333; 18753 t['parenright'] = 333; 18754 t['asterisk'] = 500; 18755 t['plus'] = 564; 18756 t['comma'] = 250; 18757 t['hyphen'] = 333; 18758 t['period'] = 250; 18759 t['slash'] = 278; 18760 t['zero'] = 500; 18761 t['one'] = 500; 18762 t['two'] = 500; 18763 t['three'] = 500; 18764 t['four'] = 500; 18765 t['five'] = 500; 18766 t['six'] = 500; 18767 t['seven'] = 500; 18768 t['eight'] = 500; 18769 t['nine'] = 500; 18770 t['colon'] = 278; 18771 t['semicolon'] = 278; 18772 t['less'] = 564; 18773 t['equal'] = 564; 18774 t['greater'] = 564; 18775 t['question'] = 444; 18776 t['at'] = 921; 18777 t['A'] = 722; 18778 t['B'] = 667; 18779 t['C'] = 667; 18780 t['D'] = 722; 18781 t['E'] = 611; 18782 t['F'] = 556; 18783 t['G'] = 722; 18784 t['H'] = 722; 18785 t['I'] = 333; 18786 t['J'] = 389; 18787 t['K'] = 722; 18788 t['L'] = 611; 18789 t['M'] = 889; 18790 t['N'] = 722; 18791 t['O'] = 722; 18792 t['P'] = 556; 18793 t['Q'] = 722; 18794 t['R'] = 667; 18795 t['S'] = 556; 18796 t['T'] = 611; 18797 t['U'] = 722; 18798 t['V'] = 722; 18799 t['W'] = 944; 18800 t['X'] = 722; 18801 t['Y'] = 722; 18802 t['Z'] = 611; 18803 t['bracketleft'] = 333; 18804 t['backslash'] = 278; 18805 t['bracketright'] = 333; 18806 t['asciicircum'] = 469; 18807 t['underscore'] = 500; 18808 t['quoteleft'] = 333; 18809 t['a'] = 444; 18810 t['b'] = 500; 18811 t['c'] = 444; 18812 t['d'] = 500; 18813 t['e'] = 444; 18814 t['f'] = 333; 18815 t['g'] = 500; 18816 t['h'] = 500; 18817 t['i'] = 278; 18818 t['j'] = 278; 18819 t['k'] = 500; 18820 t['l'] = 278; 18821 t['m'] = 778; 18822 t['n'] = 500; 18823 t['o'] = 500; 18824 t['p'] = 500; 18825 t['q'] = 500; 18826 t['r'] = 333; 18827 t['s'] = 389; 18828 t['t'] = 278; 18829 t['u'] = 500; 18830 t['v'] = 500; 18831 t['w'] = 722; 18832 t['x'] = 500; 18833 t['y'] = 500; 18834 t['z'] = 444; 18835 t['braceleft'] = 480; 18836 t['bar'] = 200; 18837 t['braceright'] = 480; 18838 t['asciitilde'] = 541; 18839 t['exclamdown'] = 333; 18840 t['cent'] = 500; 18841 t['sterling'] = 500; 18842 t['fraction'] = 167; 18843 t['yen'] = 500; 18844 t['florin'] = 500; 18845 t['section'] = 500; 18846 t['currency'] = 500; 18847 t['quotesingle'] = 180; 18848 t['quotedblleft'] = 444; 18849 t['guillemotleft'] = 500; 18850 t['guilsinglleft'] = 333; 18851 t['guilsinglright'] = 333; 18852 t['fi'] = 556; 18853 t['fl'] = 556; 18854 t['endash'] = 500; 18855 t['dagger'] = 500; 18856 t['daggerdbl'] = 500;
18857 t['periodcentered'] = 250; 18858 t['paragraph'] = 453; 18859 t['bullet'] = 350; 18860 t['quotesinglbase'] = 333; 18861 t['quotedblbase'] = 444; 18862 t['quotedblright'] = 444; 18863 t['guillemotright'] = 500; 18864 t['ellipsis'] = 1000; 18865 t['perthousand'] = 1000; 18866 t['questiondown'] = 444; 18867 t['grave'] = 333; 18868 t['acute'] = 333; 18869 t['circumflex'] = 333; 18870 t['tilde'] = 333; 18871 t['macron'] = 333; 18872 t['breve'] = 333; 18873 t['dotaccent'] = 333; 18874 t['dieresis'] = 333; 18875 t['ring'] = 333; 18876 t['cedilla'] = 333; 18877 t['hungarumlaut'] = 333; 18878 t['ogonek'] = 333; 18879 t['caron'] = 333; 18880 t['emdash'] = 1000; 18881 t['AE'] = 889; 18882 t['ordfeminine'] = 276; 18883 t['Lslash'] = 611; 18884 t['Oslash'] = 722; 18885 t['OE'] = 889; 18886 t['ordmasculine'] = 310; 18887 t['ae'] = 667; 18888 t['dotlessi'] = 278; 18889 t['lslash'] = 278; 18890 t['oslash'] = 500; 18891 t['oe'] = 722; 18892 t['germandbls'] = 500; 18893 t['Idieresis'] = 333; 18894 t['eacute'] = 444; 18895 t['abreve'] = 444; 18896 t['uhungarumlaut'] = 500; 18897 t['ecaron'] = 444; 18898 t['Ydieresis'] = 722; 18899 t['divide'] = 564; 18900 t['Yacute'] = 722; 18901 t['Acircumflex'] = 722; 18902 t['aacute'] = 444; 18903 t['Ucircumflex'] = 722; 18904 t['yacute'] = 500; 18905 t['scommaaccent'] = 389; 18906 t['ecircumflex'] = 444; 18907 t['Uring'] = 722; 18908 t['Udieresis'] = 722; 18909 t['aogonek'] = 444; 18910 t['Uacute'] = 722; 18911 t['uogonek'] = 500; 18912 t['Edieresis'] = 611; 18913 t['Dcroat'] = 722; 18914 t['commaaccent'] = 250; 18915 t['copyright'] = 760; 18916 t['Emacron'] = 611; 18917 t['ccaron'] = 444; 18918 t['aring'] = 444; 18919 t['Ncommaaccent'] = 722; 18920 t['lacute'] = 278; 18921 t['agrave'] = 444; 18922 t['Tcommaaccent'] = 611; 18923 t['Cacute'] = 667; 18924 t['atilde'] = 444; 18925 t['Edotaccent'] = 611; 18926 t['scaron'] = 389; 18927 t['scedilla'] = 389; 18928 t['iacute'] = 278; 18929 t['lozenge'] = 471; 18930 t['Rcaron'] = 667; 18931 t['Gcommaaccent'] = 722; 18932 t['ucircumflex'] = 500; 18933 t['acircumflex'] = 444; 18934 t['Amacron'] = 722; 18935 t['rcaron'] = 333; 18936 t['ccedilla'] = 444; 18937 t['Zdotaccent'] = 611; 18938 t['Thorn'] = 556; 18939 t['Omacron'] = 722; 18940 t['Racute'] = 667; 18941 t['Sacute'] = 556; 18942 t['dcaron'] = 588; 18943 t['Umacron'] = 722; 18944 t['uring'] = 500; 18945 t['threesuperior'] = 300; 18946 t['Ograve'] = 722; 18947 t['Agrave'] = 722; 18948 t['Abreve'] = 722; 18949 t['multiply'] = 564; 18950 t['uacute'] = 500; 18951 t['Tcaron'] = 611; 18952 t['partialdiff'] = 476; 18953 t['ydieresis'] = 500; 18954 t['Nacute'] = 722; 18955 t['icircumflex'] = 278; 18956 t['Ecircumflex'] = 611; 18957 t['adieresis'] = 444; 18958 t['edieresis'] = 444; 18959 t['cacute'] = 444; 18960 t['nacute'] = 500; 18961 t['umacron'] = 500; 18962 t['Ncaron'] = 722; 18963 t['Iacute'] = 333; 18964 t['plusminus'] = 564; 18965 t['brokenbar'] = 200; 18966 t['registered'] = 760; 18967 t['Gbreve'] = 722; 18968 t['Idotaccent'] = 333; 18969 t['summation'] = 600; 18970 t['Egrave'] = 611; 18971 t['racute'] = 333; 18972 t['omacron'] = 500; 18973 t['Zacute'] = 611; 18974 t['Zcaron'] = 611; 18975 t['greaterequal'] = 549; 18976 t['Eth'] = 722; 18977 t['Ccedilla'] = 667; 18978 t['lcommaaccent'] = 278; 18979 t['tcaron'] = 326; 18980 t['eogonek'] = 444; 18981 t['Uogonek'] = 722; 18982 t['Aacute'] = 722; 18983 t['Adieresis'] = 722; 18984 t['egrave'] = 444; 18985 t['zacute'] = 444; 18986 t['iogonek'] = 278; 18987 t['Oacute'] = 722; 18988 t['oacute'] = 500; 18989 t['amacron'] = 444; 18990 t['sacute'] = 389; 18991 t['idieresis'] = 278; 18992 t['Ocircumflex'] = 722; 18993 t['Ugrave'] = 722; 18994 t['Delta'] = 612; 18995 t['thorn'] = 500; 18996 t['twosuperior'] = 300; 18997 t['Odieresis'] = 722; 18998 t['mu'] = 500; 18999 t['igrave'] = 278; 19000 t['ohungarumlaut'] = 500; 19001 t['Eogonek'] = 611; 19002 t['dcroat'] = 500; 19003 t['threequarters'] = 750; 19004 t['Scedilla'] = 556; 19005 t['lcaron'] = 344; 19006 t['Kcommaaccent'] = 722; 19007 t['Lacute'] = 611; 19008 t['trademark'] = 980; 19009 t['edotaccent'] = 444; 19010 t['Igrave'] = 333; 19011 t['Imacron'] = 333; 19012 t['Lcaron'] = 611; 19013 t['onehalf'] = 750; 19014 t['lessequal'] = 549; 19015 t['ocircumflex'] = 500; 19016 t['ntilde'] = 500; 19017 t['Uhungarumlaut'] = 722; 19018 t['Eacute'] = 611; 19019 t['emacron'] = 444; 19020 t['gbreve'] = 500; 19021 t['onequarter'] = 750; 19022 t['Scaron'] = 556; 19023 t['Scommaaccent'] = 556; 19024 t['Ohungarumlaut'] = 722; 19025 t['degree'] = 400; 19026 t['ograve'] = 500; 19027 t['Ccaron'] = 667; 19028 t['ugrave'] = 500; 19029 t['radical'] = 453; 19030 t['Dcaron'] = 722; 19031 t['rcommaaccent'] = 333; 19032 t['Ntilde'] = 722; 19033 t['otilde'] = 500; 19034 t['Rcommaaccent'] = 667; 19035 t['Lcommaaccent'] = 611; 19036 t['Atilde'] = 722; 19037 t['Aogonek'] = 722; 19038 t['Aring'] = 722; 19039 t['Otilde'] = 722; 19040 t['zdotaccent'] = 444; 19041 t['Ecaron'] = 611; 19042 t['Iogonek'] = 333; 19043 t['kcommaaccent'] = 500; 19044 t['minus'] = 564; 19045 t['Icircumflex'] = 333; 19046 t['ncaron'] = 500; 19047 t['tcommaaccent'] = 278; 19048 t['logicalnot'] = 564; 19049 t['odieresis'] = 500; 19050 t['udieresis'] = 500; 19051 t['notequal'] = 549; 19052 t['gcommaaccent'] = 500; 19053 t['eth'] = 500; 19054 t['zcaron'] = 444; 19055 t['ncommaaccent'] = 500; 19056 t['onesuperior'] = 300; 19057 t['imacron'] = 278; 19058 t['Euro'] = 500; 19059 }); 19060 t['Times-Bold'] = getLookupTableFactory(function (t) { 19061 t['space'] = 250; 19062 t['exclam'] = 333; 19063 t['quotedbl'] = 555; 19064 t['numbersign'] = 500; 19065 t['dollar'] = 500; 19066 t['percent'] = 1000; 19067 t['ampersand'] = 833; 19068 t['quoteright'] = 333; 19069 t['parenleft'] = 333; 19070 t['parenright'] = 333; 19071 t['asterisk'] = 500; 19072 t['plus'] = 570; 19073 t['comma'] = 250; 19074 t['hyphen'] = 333; 19075 t['period'] = 250; 19076 t['slash'] = 278; 19077 t['zero'] = 500; 19078 t['one'] = 500; 19079 t['two'] = 500; 19080 t['three'] = 500; 19081 t['four'] = 500; 19082 t['five'] = 500; 19083 t['six'] = 500; 19084 t['seven'] = 500; 19085 t['eight'] = 500; 19086 t['nine'] = 500; 19087 t['colon'] = 333; 19088 t['semicolon'] = 333; 19089 t['less'] = 570; 19090 t['equal'] = 570; 19091 t['greater'] = 570; 19092 t['question'] = 500; 19093 t['at'] = 930; 19094 t['A'] = 722; 19095 t['B'] = 667; 19096 t['C'] = 722; 19097 t['D'] = 722; 19098 t['E'] = 667; 19099 t['F'] = 611; 19100 t['G'] = 778; 19101 t['H'] = 778; 19102 t['I'] = 389; 19103 t['J'] = 500; 19104 t['K'] = 778; 19105 t['L'] = 667; 19106 t['M'] = 944; 19107 t['N'] = 722; 19108 t['O'] = 778; 19109 t['P'] = 611; 19110 t['Q'] = 778; 19111 t['R'] = 722; 19112 t['S'] = 556; 19113 t['T'] = 667; 19114 t['U'] = 722; 19115 t['V'] = 722; 19116 t['W'] = 1000; 19117 t['X'] = 722; 19118 t['Y'] = 722; 19119 t['Z'] = 667; 19120 t['bracketleft'] = 333; 19121 t['backslash'] = 278; 19122 t['bracketright'] = 333; 19123 t['asciicircum'] = 581; 19124 t['underscore'] = 500; 19125 t['quoteleft'] = 333; 19126 t['a'] = 500; 19127 t['b'] = 556; 19128 t['c'] = 444; 19129 t['d'] = 556; 19130 t['e'] = 444; 19131 t['f'] = 333; 19132 t['g'] = 500; 19133 t['h'] = 556; 19134 t['i'] = 278; 19135 t['j'] = 333; 19136 t['k'] = 556; 19137 t['l'] = 278; 19138 t['m'] = 833; 19139 t['n'] = 556; 19140 t['o'] = 500; 19141 t['p'] = 556; 19142 t['q'] = 556; 19143 t['r'] = 444; 19144 t['s'] = 389; 19145 t['t'] = 333; 19146 t['u'] = 556; 19147 t['v'] = 500; 19148 t['w'] = 722; 19149 t['x'] = 500; 19150 t['y'] = 500; 19151 t['z'] = 444; 19152 t['braceleft'] = 394; 19153 t['bar'] = 220; 19154 t['braceright'] = 394; 19155 t['asciitilde'] = 520; 19156 t['exclamdown'] = 333; 19157 t['cent'] = 500; 19158 t['sterling'] = 500; 19159 t['fraction'] = 167; 19160 t['yen'] = 500; 19161 t['florin'] = 500; 19162 t['section'] = 500; 19163 t['currency'] = 500; 19164 t['quotesingle'] = 278; 19165 t['quotedblleft'] = 500; 19166 t['guillemotleft'] = 500; 19167 t['guilsinglleft'] = 333; 19168 t['guilsinglright'] = 333; 19169 t['fi'] = 556; 19170 t['fl'] = 556; 19171 t['endash'] = 500; 19172 t['dagger'] = 500; 19173 t['daggerdbl'] = 500;
19174 t['periodcentered'] = 250; 19175 t['paragraph'] = 540; 19176 t['bullet'] = 350; 19177 t['quotesinglbase'] = 333; 19178 t['quotedblbase'] = 500; 19179 t['quotedblright'] = 500; 19180 t['guillemotright'] = 500; 19181 t['ellipsis'] = 1000; 19182 t['perthousand'] = 1000; 19183 t['questiondown'] = 500; 19184 t['grave'] = 333; 19185 t['acute'] = 333; 19186 t['circumflex'] = 333; 19187 t['tilde'] = 333; 19188 t['macron'] = 333; 19189 t['breve'] = 333; 19190 t['dotaccent'] = 333; 19191 t['dieresis'] = 333; 19192 t['ring'] = 333; 19193 t['cedilla'] = 333; 19194 t['hungarumlaut'] = 333; 19195 t['ogonek'] = 333; 19196 t['caron'] = 333; 19197 t['emdash'] = 1000; 19198 t['AE'] = 1000; 19199 t['ordfeminine'] = 300; 19200 t['Lslash'] = 667; 19201 t['Oslash'] = 778; 19202 t['OE'] = 1000; 19203 t['ordmasculine'] = 330; 19204 t['ae'] = 722; 19205 t['dotlessi'] = 278; 19206 t['lslash'] = 278; 19207 t['oslash'] = 500; 19208 t['oe'] = 722; 19209 t['germandbls'] = 556; 19210 t['Idieresis'] = 389; 19211 t['eacute'] = 444; 19212 t['abreve'] = 500; 19213 t['uhungarumlaut'] = 556; 19214 t['ecaron'] = 444; 19215 t['Ydieresis'] = 722; 19216 t['divide'] = 570; 19217 t['Yacute'] = 722; 19218 t['Acircumflex'] = 722; 19219 t['aacute'] = 500; 19220 t['Ucircumflex'] = 722; 19221 t['yacute'] = 500; 19222 t['scommaaccent'] = 389; 19223 t['ecircumflex'] = 444; 19224 t['Uring'] = 722; 19225 t['Udieresis'] = 722; 19226 t['aogonek'] = 500; 19227 t['Uacute'] = 722; 19228 t['uogonek'] = 556; 19229 t['Edieresis'] = 667; 19230 t['Dcroat'] = 722; 19231 t['commaaccent'] = 250; 19232 t['copyright'] = 747; 19233 t['Emacron'] = 667; 19234 t['ccaron'] = 444; 19235 t['aring'] = 500; 19236 t['Ncommaaccent'] = 722; 19237 t['lacute'] = 278; 19238 t['agrave'] = 500; 19239 t['Tcommaaccent'] = 667; 19240 t['Cacute'] = 722; 19241 t['atilde'] = 500; 19242 t['Edotaccent'] = 667; 19243 t['scaron'] = 389; 19244 t['scedilla'] = 389; 19245 t['iacute'] = 278; 19246 t['lozenge'] = 494; 19247 t['Rcaron'] = 722; 19248 t['Gcommaaccent'] = 778; 19249 t['ucircumflex'] = 556; 19250 t['acircumflex'] = 500; 19251 t['Amacron'] = 722; 19252 t['rcaron'] = 444; 19253 t['ccedilla'] = 444; 19254 t['Zdotaccent'] = 667; 19255 t['Thorn'] = 611; 19256 t['Omacron'] = 778; 19257 t['Racute'] = 722; 19258 t['Sacute'] = 556; 19259 t['dcaron'] = 672; 19260 t['Umacron'] = 722; 19261 t['uring'] = 556; 19262 t['threesuperior'] = 300; 19263 t['Ograve'] = 778; 19264 t['Agrave'] = 722; 19265 t['Abreve'] = 722; 19266 t['multiply'] = 570; 19267 t['uacute'] = 556; 19268 t['Tcaron'] = 667; 19269 t['partialdiff'] = 494; 19270 t['ydieresis'] = 500; 19271 t['Nacute'] = 722; 19272 t['icircumflex'] = 278; 19273 t['Ecircumflex'] = 667; 19274 t['adieresis'] = 500; 19275 t['edieresis'] = 444; 19276 t['cacute'] = 444; 19277 t['nacute'] = 556; 19278 t['umacron'] = 556; 19279 t['Ncaron'] = 722; 19280 t['Iacute'] = 389; 19281 t['plusminus'] = 570; 19282 t['brokenbar'] = 220; 19283 t['registered'] = 747; 19284 t['Gbreve'] = 778; 19285 t['Idotaccent'] = 389; 19286 t['summation'] = 600; 19287 t['Egrave'] = 667; 19288 t['racute'] = 444; 19289 t['omacron'] = 500; 19290 t['Zacute'] = 667; 19291 t['Zcaron'] = 667; 19292 t['greaterequal'] = 549; 19293 t['Eth'] = 722; 19294 t['Ccedilla'] = 722; 19295 t['lcommaaccent'] = 278; 19296 t['tcaron'] = 416; 19297 t['eogonek'] = 444; 19298 t['Uogonek'] = 722; 19299 t['Aacute'] = 722; 19300 t['Adieresis'] = 722; 19301 t['egrave'] = 444; 19302 t['zacute'] = 444; 19303 t['iogonek'] = 278; 19304 t['Oacute'] = 778; 19305 t['oacute'] = 500; 19306 t['amacron'] = 500; 19307 t['sacute'] = 389; 19308 t['idieresis'] = 278; 19309 t['Ocircumflex'] = 778; 19310 t['Ugrave'] = 722; 19311 t['Delta'] = 612; 19312 t['thorn'] = 556; 19313 t['twosuperior'] = 300; 19314 t['Odieresis'] = 778; 19315 t['mu'] = 556; 19316 t['igrave'] = 278; 19317 t['ohungarumlaut'] = 500; 19318 t['Eogonek'] = 667; 19319 t['dcroat'] = 556; 19320 t['threequarters'] = 750; 19321 t['Scedilla'] = 556; 19322 t['lcaron'] = 394; 19323 t['Kcommaaccent'] = 778; 19324 t['Lacute'] = 667; 19325 t['trademark'] = 1000; 19326 t['edotaccent'] = 444; 19327 t['Igrave'] = 389; 19328 t['Imacron'] = 389; 19329 t['Lcaron'] = 667; 19330 t['onehalf'] = 750; 19331 t['lessequal'] = 549; 19332 t['ocircumflex'] = 500; 19333 t['ntilde'] = 556; 19334 t['Uhungarumlaut'] = 722; 19335 t['Eacute'] = 667; 19336 t['emacron'] = 444; 19337 t['gbreve'] = 500; 19338 t['onequarter'] = 750; 19339 t['Scaron'] = 556; 19340 t['Scommaaccent'] = 556; 19341 t['Ohungarumlaut'] = 778; 19342 t['degree'] = 400; 19343 t['ograve'] = 500; 19344 t['Ccaron'] = 722; 19345 t['ugrave'] = 556; 19346 t['radical'] = 549; 19347 t['Dcaron'] = 722; 19348 t['rcommaaccent'] = 444; 19349 t['Ntilde'] = 722; 19350 t['otilde'] = 500; 19351 t['Rcommaaccent'] = 722; 19352 t['Lcommaaccent'] = 667; 19353 t['Atilde'] = 722; 19354 t['Aogonek'] = 722; 19355 t['Aring'] = 722; 19356 t['Otilde'] = 778; 19357 t['zdotaccent'] = 444; 19358 t['Ecaron'] = 667; 19359 t['Iogonek'] = 389; 19360 t['kcommaaccent'] = 556; 19361 t['minus'] = 570; 19362 t['Icircumflex'] = 389; 19363 t['ncaron'] = 556; 19364 t['tcommaaccent'] = 333; 19365 t['logicalnot'] = 570; 19366 t['odieresis'] = 500; 19367 t['udieresis'] = 556; 19368 t['notequal'] = 549; 19369 t['gcommaaccent'] = 500; 19370 t['eth'] = 500; 19371 t['zcaron'] = 444; 19372 t['ncommaaccent'] = 556; 19373 t['onesuperior'] = 300; 19374 t['imacron'] = 278; 19375 t['Euro'] = 500; 19376 }); 19377 t['Times-BoldItalic'] = getLookupTableFactory(function (t) { 19378 t['space'] = 250; 19379 t['exclam'] = 389; 19380 t['quotedbl'] = 555; 19381 t['numbersign'] = 500; 19382 t['dollar'] = 500; 19383 t['percent'] = 833; 19384 t['ampersand'] = 778; 19385 t['quoteright'] = 333; 19386 t['parenleft'] = 333; 19387 t['parenright'] = 333; 19388 t['asterisk'] = 500; 19389 t['plus'] = 570; 19390 t['comma'] = 250; 19391 t['hyphen'] = 333; 19392 t['period'] = 250; 19393 t['slash'] = 278; 19394 t['zero'] = 500; 19395 t['one'] = 500; 19396 t['two'] = 500; 19397 t['three'] = 500; 19398 t['four'] = 500; 19399 t['five'] = 500; 19400 t['six'] = 500; 19401 t['seven'] = 500; 19402 t['eight'] = 500; 19403 t['nine'] = 500; 19404 t['colon'] = 333; 19405 t['semicolon'] = 333; 19406 t['less'] = 570; 19407 t['equal'] = 570; 19408 t['greater'] = 570; 19409 t['question'] = 500; 19410 t['at'] = 832; 19411 t['A'] = 667; 19412 t['B'] = 667; 19413 t['C'] = 667; 19414 t['D'] = 722; 19415 t['E'] = 667; 19416 t['F'] = 667; 19417 t['G'] = 722; 19418 t['H'] = 778; 19419 t['I'] = 389; 19420 t['J'] = 500; 19421 t['K'] = 667; 19422 t['L'] = 611; 19423 t['M'] = 889; 19424 t['N'] = 722; 19425 t['O'] = 722; 19426 t['P'] = 611; 19427 t['Q'] = 722; 19428 t['R'] = 667; 19429 t['S'] = 556; 19430 t['T'] = 611; 19431 t['U'] = 722; 19432 t['V'] = 667; 19433 t['W'] = 889; 19434 t['X'] = 667; 19435 t['Y'] = 611; 19436 t['Z'] = 611; 19437 t['bracketleft'] = 333; 19438 t['backslash'] = 278; 19439 t['bracketright'] = 333; 19440 t['asciicircum'] = 570; 19441 t['underscore'] = 500; 19442 t['quoteleft'] = 333; 19443 t['a'] = 500; 19444 t['b'] = 500; 19445 t['c'] = 444; 19446 t['d'] = 500; 19447 t['e'] = 444; 19448 t['f'] = 333; 19449 t['g'] = 500; 19450 t['h'] = 556; 19451 t['i'] = 278; 19452 t['j'] = 278; 19453 t['k'] = 500; 19454 t['l'] = 278; 19455 t['m'] = 778; 19456 t['n'] = 556; 19457 t['o'] = 500; 19458 t['p'] = 500; 19459 t['q'] = 500; 19460 t['r'] = 389; 19461 t['s'] = 389; 19462 t['t'] = 278; 19463 t['u'] = 556; 19464 t['v'] = 444; 19465 t['w'] = 667; 19466 t['x'] = 500; 19467 t['y'] = 444; 19468 t['z'] = 389; 19469 t['braceleft'] = 348; 19470 t['bar'] = 220; 19471 t['braceright'] = 348; 19472 t['asciitilde'] = 570; 19473 t['exclamdown'] = 389; 19474 t['cent'] = 500; 19475 t['sterling'] = 500; 19476 t['fraction'] = 167; 19477 t['yen'] = 500; 19478 t['florin'] = 500; 19479 t['section'] = 500; 19480 t['currency'] = 500; 19481 t['quotesingle'] = 278; 19482 t['quotedblleft'] = 500; 19483 t['guillemotleft'] = 500; 19484 t['guilsinglleft'] = 333; 19485 t['guilsinglright'] = 333; 19486 t['fi'] = 556; 19487 t['fl'] = 556; 19488 t['endash'] = 500; 19489 t['dagger'] = 500; 19490 t['daggerdbl'] = 500;
19491 t['periodcentered'] = 250; 19492 t['paragraph'] = 500; 19493 t['bullet'] = 350; 19494 t['quotesinglbase'] = 333; 19495 t['quotedblbase'] = 500; 19496 t['quotedblright'] = 500; 19497 t['guillemotright'] = 500; 19498 t['ellipsis'] = 1000; 19499 t['perthousand'] = 1000; 19500 t['questiondown'] = 500; 19501 t['grave'] = 333; 19502 t['acute'] = 333; 19503 t['circumflex'] = 333; 19504 t['tilde'] = 333; 19505 t['macron'] = 333; 19506 t['breve'] = 333; 19507 t['dotaccent'] = 333; 19508 t['dieresis'] = 333; 19509 t['ring'] = 333; 19510 t['cedilla'] = 333; 19511 t['hungarumlaut'] = 333; 19512 t['ogonek'] = 333; 19513 t['caron'] = 333; 19514 t['emdash'] = 1000; 19515 t['AE'] = 944; 19516 t['ordfeminine'] = 266; 19517 t['Lslash'] = 611; 19518 t['Oslash'] = 722; 19519 t['OE'] = 944; 19520 t['ordmasculine'] = 300; 19521 t['ae'] = 722; 19522 t['dotlessi'] = 278; 19523 t['lslash'] = 278; 19524 t['oslash'] = 500; 19525 t['oe'] = 722; 19526 t['germandbls'] = 500; 19527 t['Idieresis'] = 389; 19528 t['eacute'] = 444; 19529 t['abreve'] = 500; 19530 t['uhungarumlaut'] = 556; 19531 t['ecaron'] = 444; 19532 t['Ydieresis'] = 611; 19533 t['divide'] = 570; 19534 t['Yacute'] = 611; 19535 t['Acircumflex'] = 667; 19536 t['aacute'] = 500; 19537 t['Ucircumflex'] = 722; 19538 t['yacute'] = 444; 19539 t['scommaaccent'] = 389; 19540 t['ecircumflex'] = 444; 19541 t['Uring'] = 722; 19542 t['Udieresis'] = 722; 19543 t['aogonek'] = 500; 19544 t['Uacute'] = 722; 19545 t['uogonek'] = 556; 19546 t['Edieresis'] = 667; 19547 t['Dcroat'] = 722; 19548 t['commaaccent'] = 250; 19549 t['copyright'] = 747; 19550 t['Emacron'] = 667; 19551 t['ccaron'] = 444; 19552 t['aring'] = 500; 19553 t['Ncommaaccent'] = 722; 19554 t['lacute'] = 278; 19555 t['agrave'] = 500; 19556 t['Tcommaaccent'] = 611; 19557 t['Cacute'] = 667; 19558 t['atilde'] = 500; 19559 t['Edotaccent'] = 667; 19560 t['scaron'] = 389; 19561 t['scedilla'] = 389; 19562 t['iacute'] = 278; 19563 t['lozenge'] = 494; 19564 t['Rcaron'] = 667; 19565 t['Gcommaaccent'] = 722; 19566 t['ucircumflex'] = 556; 19567 t['acircumflex'] = 500; 19568 t['Amacron'] = 667; 19569 t['rcaron'] = 389; 19570 t['ccedilla'] = 444; 19571 t['Zdotaccent'] = 611; 19572 t['Thorn'] = 611; 19573 t['Omacron'] = 722; 19574 t['Racute'] = 667; 19575 t['Sacute'] = 556; 19576 t['dcaron'] = 608; 19577 t['Umacron'] = 722; 19578 t['uring'] = 556; 19579 t['threesuperior'] = 300; 19580 t['Ograve'] = 722; 19581 t['Agrave'] = 667; 19582 t['Abreve'] = 667; 19583 t['multiply'] = 570; 19584 t['uacute'] = 556; 19585 t['Tcaron'] = 611; 19586 t['partialdiff'] = 494; 19587 t['ydieresis'] = 444; 19588 t['Nacute'] = 722; 19589 t['icircumflex'] = 278; 19590 t['Ecircumflex'] = 667; 19591 t['adieresis'] = 500; 19592 t['edieresis'] = 444; 19593 t['cacute'] = 444; 19594 t['nacute'] = 556; 19595 t['umacron'] = 556; 19596 t['Ncaron'] = 722; 19597 t['Iacute'] = 389; 19598 t['plusminus'] = 570; 19599 t['brokenbar'] = 220; 19600 t['registered'] = 747; 19601 t['Gbreve'] = 722; 19602 t['Idotaccent'] = 389; 19603 t['summation'] = 600; 19604 t['Egrave'] = 667; 19605 t['racute'] = 389; 19606 t['omacron'] = 500; 19607 t['Zacute'] = 611; 19608 t['Zcaron'] = 611; 19609 t['greaterequal'] = 549; 19610 t['Eth'] = 722; 19611 t['Ccedilla'] = 667; 19612 t['lcommaaccent'] = 278; 19613 t['tcaron'] = 366; 19614 t['eogonek'] = 444; 19615 t['Uogonek'] = 722; 19616 t['Aacute'] = 667; 19617 t['Adieresis'] = 667; 19618 t['egrave'] = 444; 19619 t['zacute'] = 389; 19620 t['iogonek'] = 278; 19621 t['Oacute'] = 722; 19622 t['oacute'] = 500; 19623 t['amacron'] = 500; 19624 t['sacute'] = 389; 19625 t['idieresis'] = 278; 19626 t['Ocircumflex'] = 722; 19627 t['Ugrave'] = 722; 19628 t['Delta'] = 612; 19629 t['thorn'] = 500; 19630 t['twosuperior'] = 300; 19631 t['Odieresis'] = 722; 19632 t['mu'] = 576; 19633 t['igrave'] = 278; 19634 t['ohungarumlaut'] = 500; 19635 t['Eogonek'] = 667; 19636 t['dcroat'] = 500; 19637 t['threequarters'] = 750; 19638 t['Scedilla'] = 556; 19639 t['lcaron'] = 382; 19640 t['Kcommaaccent'] = 667; 19641 t['Lacute'] = 611; 19642 t['trademark'] = 1000; 19643 t['edotaccent'] = 444; 19644 t['Igrave'] = 389; 19645 t['Imacron'] = 389; 19646 t['Lcaron'] = 611; 19647 t['onehalf'] = 750; 19648 t['lessequal'] = 549; 19649 t['ocircumflex'] = 500; 19650 t['ntilde'] = 556; 19651 t['Uhungarumlaut'] = 722; 19652 t['Eacute'] = 667; 19653 t['emacron'] = 444; 19654 t['gbreve'] = 500; 19655 t['onequarter'] = 750; 19656 t['Scaron'] = 556; 19657 t['Scommaaccent'] = 556; 19658 t['Ohungarumlaut'] = 722; 19659 t['degree'] = 400; 19660 t['ograve'] = 500; 19661 t['Ccaron'] = 667; 19662 t['ugrave'] = 556; 19663 t['radical'] = 549; 19664 t['Dcaron'] = 722; 19665 t['rcommaaccent'] = 389; 19666 t['Ntilde'] = 722; 19667 t['otilde'] = 500; 19668 t['Rcommaaccent'] = 667; 19669 t['Lcommaaccent'] = 611; 19670 t['Atilde'] = 667; 19671 t['Aogonek'] = 667; 19672 t['Aring'] = 667; 19673 t['Otilde'] = 722; 19674 t['zdotaccent'] = 389; 19675 t['Ecaron'] = 667; 19676 t['Iogonek'] = 389; 19677 t['kcommaaccent'] = 500; 19678 t['minus'] = 606; 19679 t['Icircumflex'] = 389; 19680 t['ncaron'] = 556; 19681 t['tcommaaccent'] = 278; 19682 t['logicalnot'] = 606; 19683 t['odieresis'] = 500; 19684 t['udieresis'] = 556; 19685 t['notequal'] = 549; 19686 t['gcommaaccent'] = 500; 19687 t['eth'] = 500; 19688 t['zcaron'] = 389; 19689 t['ncommaaccent'] = 556; 19690 t['onesuperior'] = 300; 19691 t['imacron'] = 278; 19692 t['Euro'] = 500; 19693 }); 19694 t['Times-Italic'] = getLookupTableFactory(function (t) { 19695 t['space'] = 250; 19696 t['exclam'] = 333; 19697 t['quotedbl'] = 420; 19698 t['numbersign'] = 500; 19699 t['dollar'] = 500; 19700 t['percent'] = 833; 19701 t['ampersand'] = 778; 19702 t['quoteright'] = 333; 19703 t['parenleft'] = 333; 19704 t['parenright'] = 333; 19705 t['asterisk'] = 500; 19706 t['plus'] = 675; 19707 t['comma'] = 250; 19708 t['hyphen'] = 333; 19709 t['period'] = 250; 19710 t['slash'] = 278; 19711 t['zero'] = 500; 19712 t['one'] = 500; 19713 t['two'] = 500; 19714 t['three'] = 500; 19715 t['four'] = 500; 19716 t['five'] = 500; 19717 t['six'] = 500; 19718 t['seven'] = 500; 19719 t['eight'] = 500; 19720 t['nine'] = 500; 19721 t['colon'] = 333; 19722 t['semicolon'] = 333; 19723 t['less'] = 675; 19724 t['equal'] = 675; 19725 t['greater'] = 675; 19726 t['question'] = 500; 19727 t['at'] = 920; 19728 t['A'] = 611; 19729 t['B'] = 611; 19730 t['C'] = 667; 19731 t['D'] = 722; 19732 t['E'] = 611; 19733 t['F'] = 611; 19734 t['G'] = 722; 19735 t['H'] = 722; 19736 t['I'] = 333; 19737 t['J'] = 444; 19738 t['K'] = 667; 19739 t['L'] = 556; 19740 t['M'] = 833; 19741 t['N'] = 667; 19742 t['O'] = 722; 19743 t['P'] = 611; 19744 t['Q'] = 722; 19745 t['R'] = 611; 19746 t['S'] = 500; 19747 t['T'] = 556; 19748 t['U'] = 722; 19749 t['V'] = 611; 19750 t['W'] = 833; 19751 t['X'] = 611; 19752 t['Y'] = 556; 19753 t['Z'] = 556; 19754 t['bracketleft'] = 389; 19755 t['backslash'] = 278; 19756 t['bracketright'] = 389; 19757 t['asciicircum'] = 422; 19758 t['underscore'] = 500; 19759 t['quoteleft'] = 333; 19760 t['a'] = 500; 19761 t['b'] = 500; 19762 t['c'] = 444; 19763 t['d'] = 500; 19764 t['e'] = 444; 19765 t['f'] = 278; 19766 t['g'] = 500; 19767 t['h'] = 500; 19768 t['i'] = 278; 19769 t['j'] = 278; 19770 t['k'] = 444; 19771 t['l'] = 278; 19772 t['m'] = 722; 19773 t['n'] = 500; 19774 t['o'] = 500; 19775 t['p'] = 500; 19776 t['q'] = 500; 19777 t['r'] = 389; 19778 t['s'] = 389; 19779 t['t'] = 278; 19780 t['u'] = 500; 19781 t['v'] = 444; 19782 t['w'] = 667; 19783 t['x'] = 444; 19784 t['y'] = 444; 19785 t['z'] = 389; 19786 t['braceleft'] = 400; 19787 t['bar'] = 275; 19788 t['braceright'] = 400; 19789 t['asciitilde'] = 541; 19790 t['exclamdown'] = 389; 19791 t['cent'] = 500; 19792 t['sterling'] = 500; 19793 t['fraction'] = 167; 19794 t['yen'] = 500; 19795 t['florin'] = 500; 19796 t['section'] = 500; 19797 t['currency'] = 500; 19798 t['quotesingle'] = 214; 19799 t['quotedblleft'] = 556; 19800 t['guillemotleft'] = 500; 19801 t['guilsinglleft'] = 333; 19802 t['guilsinglright'] = 333; 19803 t['fi'] = 500; 19804 t['fl'] = 500; 19805 t['endash'] = 500; 19806 t['dagger'] = 500; 19807 t['daggerdbl'] = 500;
19808 t['periodcentered'] = 250; 19809 t['paragraph'] = 523; 19810 t['bullet'] = 350; 19811 t['quotesinglbase'] = 333; 19812 t['quotedblbase'] = 556; 19813 t['quotedblright'] = 556; 19814 t['guillemotright'] = 500; 19815 t['ellipsis'] = 889; 19816 t['perthousand'] = 1000; 19817 t['questiondown'] = 500; 19818 t['grave'] = 333; 19819 t['acute'] = 333; 19820 t['circumflex'] = 333; 19821 t['tilde'] = 333; 19822 t['macron'] = 333; 19823 t['breve'] = 333; 19824 t['dotaccent'] = 333; 19825 t['dieresis'] = 333; 19826 t['ring'] = 333; 19827 t['cedilla'] = 333; 19828 t['hungarumlaut'] = 333; 19829 t['ogonek'] = 333; 19830 t['caron'] = 333; 19831 t['emdash'] = 889; 19832 t['AE'] = 889; 19833 t['ordfeminine'] = 276; 19834 t['Lslash'] = 556; 19835 t['Oslash'] = 722; 19836 t['OE'] = 944; 19837 t['ordmasculine'] = 310; 19838 t['ae'] = 667; 19839 t['dotlessi'] = 278; 19840 t['lslash'] = 278; 19841 t['oslash'] = 500; 19842 t['oe'] = 667; 19843 t['germandbls'] = 500; 19844 t['Idieresis'] = 333; 19845 t['eacute'] = 444; 19846 t['abreve'] = 500; 19847 t['uhungarumlaut'] = 500; 19848 t['ecaron'] = 444; 19849 t['Ydieresis'] = 556; 19850 t['divide'] = 675; 19851 t['Yacute'] = 556; 19852 t['Acircumflex'] = 611; 19853 t['aacute'] = 500; 19854 t['Ucircumflex'] = 722; 19855 t['yacute'] = 444; 19856 t['scommaaccent'] = 389; 19857 t['ecircumflex'] = 444; 19858 t['Uring'] = 722; 19859 t['Udieresis'] = 722; 19860 t['aogonek'] = 500; 19861 t['Uacute'] = 722; 19862 t['uogonek'] = 500; 19863 t['Edieresis'] = 611; 19864 t['Dcroat'] = 722; 19865 t['commaaccent'] = 250; 19866 t['copyright'] = 760; 19867 t['Emacron'] = 611; 19868 t['ccaron'] = 444; 19869 t['aring'] = 500; 19870 t['Ncommaaccent'] = 667; 19871 t['lacute'] = 278; 19872 t['agrave'] = 500; 19873 t['Tcommaaccent'] = 556; 19874 t['Cacute'] = 667; 19875 t['atilde'] = 500; 19876 t['Edotaccent'] = 611; 19877 t['scaron'] = 389; 19878 t['scedilla'] = 389; 19879 t['iacute'] = 278; 19880 t['lozenge'] = 471; 19881 t['Rcaron'] = 611; 19882 t['Gcommaaccent'] = 722; 19883 t['ucircumflex'] = 500; 19884 t['acircumflex'] = 500; 19885 t['Amacron'] = 611; 19886 t['rcaron'] = 389; 19887 t['ccedilla'] = 444; 19888 t['Zdotaccent'] = 556; 19889 t['Thorn'] = 611; 19890 t['Omacron'] = 722; 19891 t['Racute'] = 611; 19892 t['Sacute'] = 500; 19893 t['dcaron'] = 544; 19894 t['Umacron'] = 722; 19895 t['uring'] = 500; 19896 t['threesuperior'] = 300; 19897 t['Ograve'] = 722; 19898 t['Agrave'] = 611; 19899 t['Abreve'] = 611; 19900 t['multiply'] = 675; 19901 t['uacute'] = 500; 19902 t['Tcaron'] = 556; 19903 t['partialdiff'] = 476; 19904 t['ydieresis'] = 444; 19905 t['Nacute'] = 667; 19906 t['icircumflex'] = 278; 19907 t['Ecircumflex'] = 611; 19908 t['adieresis'] = 500; 19909 t['edieresis'] = 444; 19910 t['cacute'] = 444; 19911 t['nacute'] = 500; 19912 t['umacron'] = 500; 19913 t['Ncaron'] = 667; 19914 t['Iacute'] = 333; 19915 t['plusminus'] = 675; 19916 t['brokenbar'] = 275; 19917 t['registered'] = 760; 19918 t['Gbreve'] = 722; 19919 t['Idotaccent'] = 333; 19920 t['summation'] = 600; 19921 t['Egrave'] = 611; 19922 t['racute'] = 389; 19923 t['omacron'] = 500; 19924 t['Zacute'] = 556; 19925 t['Zcaron'] = 556; 19926 t['greaterequal'] = 549; 19927 t['Eth'] = 722; 19928 t['Ccedilla'] = 667; 19929 t['lcommaaccent'] = 278; 19930 t['tcaron'] = 300; 19931 t['eogonek'] = 444; 19932 t['Uogonek'] = 722; 19933 t['Aacute'] = 611; 19934 t['Adieresis'] = 611; 19935 t['egrave'] = 444; 19936 t['zacute'] = 389; 19937 t['iogonek'] = 278; 19938 t['Oacute'] = 722; 19939 t['oacute'] = 500; 19940 t['amacron'] = 500; 19941 t['sacute'] = 389; 19942 t['idieresis'] = 278; 19943 t['Ocircumflex'] = 722; 19944 t['Ugrave'] = 722; 19945 t['Delta'] = 612; 19946 t['thorn'] = 500; 19947 t['twosuperior'] = 300; 19948 t['Odieresis'] = 722; 19949 t['mu'] = 500; 19950 t['igrave'] = 278; 19951 t['ohungarumlaut'] = 500; 19952 t['Eogonek'] = 611; 19953 t['dcroat'] = 500; 19954 t['threequarters'] = 750; 19955 t['Scedilla'] = 500; 19956 t['lcaron'] = 300; 19957 t['Kcommaaccent'] = 667; 19958 t['Lacute'] = 556; 19959 t['trademark'] = 980; 19960 t['edotaccent'] = 444; 19961 t['Igrave'] = 333; 19962 t['Imacron'] = 333; 19963 t['Lcaron'] = 611; 19964 t['onehalf'] = 750; 19965 t['lessequal'] = 549; 19966 t['ocircumflex'] = 500; 19967 t['ntilde'] = 500; 19968 t['Uhungarumlaut'] = 722; 19969 t['Eacute'] = 611; 19970 t['emacron'] = 444; 19971 t['gbreve'] = 500; 19972 t['onequarter'] = 750; 19973 t['Scaron'] = 500; 19974 t['Scommaaccent'] = 500; 19975 t['Ohungarumlaut'] = 722; 19976 t['degree'] = 400; 19977 t['ograve'] = 500; 19978 t['Ccaron'] = 667; 19979 t['ugrave'] = 500; 19980 t['radical'] = 453; 19981 t['Dcaron'] = 722; 19982 t['rcommaaccent'] = 389; 19983 t['Ntilde'] = 667; 19984 t['otilde'] = 500; 19985 t['Rcommaaccent'] = 611; 19986 t['Lcommaaccent'] = 556; 19987 t['Atilde'] = 611; 19988 t['Aogonek'] = 611; 19989 t['Aring'] = 611; 19990 t['Otilde'] = 722; 19991 t['zdotaccent'] = 389; 19992 t['Ecaron'] = 611; 19993 t['Iogonek'] = 333; 19994 t['kcommaaccent'] = 444; 19995 t['minus'] = 675; 19996 t['Icircumflex'] = 333; 19997 t['ncaron'] = 500; 19998 t['tcommaaccent'] = 278; 19999 t['logicalnot'] = 675; 20000 t['odieresis'] = 500; 20001 t['udieresis'] = 500; 20002 t['notequal'] = 549; 20003 t['gcommaaccent'] = 500; 20004 t['eth'] = 500; 20005 t['zcaron'] = 389; 20006 t['ncommaaccent'] = 500; 20007 t['onesuperior'] = 300; 20008 t['imacron'] = 278; 20009 t['Euro'] = 500; 20010 }); 20011 t['ZapfDingbats'] = getLookupTableFactory(function (t) { 20012 t['space'] = 278; 20013 t['a1'] = 974; 20014 t['a2'] = 961; 20015 t['a202'] = 974; 20016 t['a3'] = 980; 20017 t['a4'] = 719; 20018 t['a5'] = 789; 20019 t['a119'] = 790; 20020 t['a118'] = 791; 20021 t['a117'] = 690; 20022 t['a11'] = 960; 20023 t['a12'] = 939; 20024 t['a13'] = 549; 20025 t['a14'] = 855; 20026 t['a15'] = 911; 20027 t['a16'] = 933; 20028 t['a105'] = 911; 20029 t['a17'] = 945; 20030 t['a18'] = 974; 20031 t['a19'] = 755; 20032 t['a20'] = 846; 20033 t['a21'] = 762; 20034 t['a22'] = 761; 20035 t['a23'] = 571; 20036 t['a24'] = 677; 20037 t['a25'] = 763; 20038 t['a26'] = 760; 20039 t['a27'] = 759; 20040 t['a28'] = 754; 20041 t['a6'] = 494; 20042 t['a7'] = 552; 20043 t['a8'] = 537; 20044 t['a9'] = 577; 20045 t['a10'] = 692; 20046 t['a29'] = 786; 20047 t['a30'] = 788; 20048 t['a31'] = 788; 20049 t['a32'] = 790; 20050 t['a33'] = 793; 20051 t['a34'] = 794; 20052 t['a35'] = 816; 20053 t['a36'] = 823; 20054 t['a37'] = 789; 20055 t['a38'] = 841; 20056 t['a39'] = 823; 20057 t['a40'] = 833; 20058 t['a41'] = 816; 20059 t['a42'] = 831; 20060 t['a43'] = 923; 20061 t['a44'] = 744; 20062 t['a45'] = 723; 20063 t['a46'] = 749; 20064 t['a47'] = 790; 20065 t['a48'] = 792; 20066 t['a49'] = 695; 20067 t['a50'] = 776; 20068 t['a51'] = 768; 20069 t['a52'] = 792; 20070 t['a53'] = 759; 20071 t['a54'] = 707; 20072 t['a55'] = 708; 20073 t['a56'] = 682; 20074 t['a57'] = 701; 20075 t['a58'] = 826; 20076 t['a59'] = 815; 20077 t['a60'] = 789; 20078 t['a61'] = 789; 20079 t['a62'] = 707; 20080 t['a63'] = 687; 20081 t['a64'] = 696; 20082 t['a65'] = 689; 20083 t['a66'] = 786; 20084 t['a67'] = 787; 20085 t['a68'] = 713; 20086 t['a69'] = 791; 20087 t['a70'] = 785; 20088 t['a71'] = 791; 20089 t['a72'] = 873; 20090 t['a73'] = 761; 20091 t['a74'] = 762; 20092 t['a203'] = 762; 20093 t['a75'] = 759; 20094 t['a204'] = 759; 20095 t['a76'] = 892; 20096 t['a77'] = 892; 20097 t['a78'] = 788; 20098 t['a79'] = 784; 20099 t['a81'] = 438; 20100 t['a82'] = 138; 20101 t['a83'] = 277; 20102 t['a84'] = 415; 20103 t['a97'] = 392; 20104 t['a98'] = 392; 20105 t['a99'] = 668; 20106 t['a100'] = 668; 20107 t['a89'] = 390; 20108 t['a90'] = 390; 20109 t['a93'] = 317; 20110 t['a94'] = 317; 20111 t['a91'] = 276; 20112 t['a92'] = 276; 20113 t['a205'] = 509;
20114 t['a85'] = 509; 20115 t['a206'] = 410; 20116 t['a86'] = 410; 20117 t['a87'] = 234; 20118 t['a88'] = 234; 20119 t['a95'] = 334; 20120 t['a96'] = 334; 20121 t['a101'] = 732; 20122 t['a102'] = 544; 20123 t['a103'] = 544; 20124 t['a104'] = 910; 20125 t['a106'] = 667; 20126 t['a107'] = 760; 20127 t['a108'] = 760; 20128 t['a112'] = 776; 20129 t['a111'] = 595; 20130 t['a110'] = 694; 20131 t['a109'] = 626; 20132 t['a120'] = 788; 20133 t['a121'] = 788; 20134 t['a122'] = 788; 20135 t['a123'] = 788; 20136 t['a124'] = 788; 20137 t['a125'] = 788; 20138 t['a126'] = 788; 20139 t['a127'] = 788; 20140 t['a128'] = 788; 20141 t['a129'] = 788; 20142 t['a130'] = 788; 20143 t['a131'] = 788; 20144 t['a132'] = 788; 20145 t['a133'] = 788; 20146 t['a134'] = 788; 20147 t['a135'] = 788; 20148 t['a136'] = 788; 20149 t['a137'] = 788; 20150 t['a138'] = 788; 20151 t['a139'] = 788; 20152 t['a140'] = 788; 20153 t['a141'] = 788; 20154 t['a142'] = 788; 20155 t['a143'] = 788; 20156 t['a144'] = 788; 20157 t['a145'] = 788; 20158 t['a146'] = 788; 20159 t['a147'] = 788; 20160 t['a148'] = 788; 20161 t['a149'] = 788; 20162 t['a150'] = 788; 20163 t['a151'] = 788; 20164 t['a152'] = 788; 20165 t['a153'] = 788; 20166 t['a154'] = 788; 20167 t['a155'] = 788; 20168 t['a156'] = 788; 20169 t['a157'] = 788; 20170 t['a158'] = 788; 20171 t['a159'] = 788; 20172 t['a160'] = 894; 20173 t['a161'] = 838; 20174 t['a163'] = 1016; 20175 t['a164'] = 458; 20176 t['a196'] = 748; 20177 t['a165'] = 924; 20178 t['a192'] = 748; 20179 t['a166'] = 918; 20180 t['a167'] = 927; 20181 t['a168'] = 928; 20182 t['a169'] = 928; 20183 t['a170'] = 834; 20184 t['a171'] = 873; 20185 t['a172'] = 828; 20186 t['a173'] = 924; 20187 t['a162'] = 924; 20188 t['a174'] = 917; 20189 t['a175'] = 930; 20190 t['a176'] = 931; 20191 t['a177'] = 463; 20192 t['a178'] = 883; 20193 t['a179'] = 836; 20194 t['a193'] = 836; 20195 t['a180'] = 867; 20196 t['a199'] = 867; 20197 t['a181'] = 696; 20198 t['a200'] = 696; 20199 t['a182'] = 874; 20200 t['a201'] = 874; 20201 t['a183'] = 760; 20202 t['a184'] = 946; 20203 t['a197'] = 771; 20204 t['a185'] = 865; 20205 t['a194'] = 771; 20206 t['a198'] = 888; 20207 t['a186'] = 967; 20208 t['a195'] = 888; 20209 t['a187'] = 831; 20210 t['a188'] = 873; 20211 t['a189'] = 927; 20212 t['a190'] = 970; 20213 t['a191'] = 918; 20214 }); 20215 }); 20216 exports.getMetrics = getMetrics; 20217 })); 20218 (function (root, factory) { 20219 factory(root.pdfjsCoreMurmurHash3 = {}, root.pdfjsSharedUtil); 20220 }(this, function (exports, sharedUtil) { 20221 var Uint32ArrayView = sharedUtil.Uint32ArrayView; 20222 var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { 20223 var MASK_HIGH = 0xffff0000; 20224 var MASK_LOW = 0xffff; 20225 function MurmurHash3_64(seed) { 20226 var SEED = 0xc3d2e1f0; 20227 this.h1 = seed ? seed & 0xffffffff : SEED; 20228 this.h2 = seed ? seed & 0xffffffff : SEED; 20229 } 20230 var alwaysUseUint32ArrayView = false; 20231 try { 20232 new Uint32Array(new Uint8Array(5).buffer, 0, 1); 20233 } catch (e) { 20234 alwaysUseUint32ArrayView = true; 20235 } 20236 MurmurHash3_64.prototype = { 20237 update: function MurmurHash3_64_update(input) { 20238 var useUint32ArrayView = alwaysUseUint32ArrayView; 20239 var i; 20240 if (typeof input === 'string') { 20241 var data = new Uint8Array(input.length * 2); 20242 var length = 0; 20243 for (i = 0; i < input.length; i++) { 20244 var code = input.charCodeAt(i); 20245 if (code <= 0xff) { 20246 data[length++] = code; 20247 } else { 20248 data[length++] = code >>> 8; 20249 data[length++] = code & 0xff; 20250 } 20251 } 20252 } else if (input instanceof Uint8Array) { 20253 data = input; 20254 length = data.length; 20255 } else if (typeof input === 'object' && 'length' in input) { 20256 data = input; 20257 length = data.length; 20258 useUint32ArrayView = true; 20259 } else { 20260 throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.'); 20261 } 20262 var blockCounts = length >> 2; 20263 var tailLength = length - blockCounts * 4; 20264 var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts); 20265 var k1 = 0; 20266 var k2 = 0; 20267 var h1 = this.h1; 20268 var h2 = this.h2; 20269 var C1 = 0xcc9e2d51; 20270 var C2 = 0x1b873593; 20271 var C1_LOW = C1 & MASK_LOW; 20272 var C2_LOW = C2 & MASK_LOW; 20273 for (i = 0; i < blockCounts; i++) { 20274 if (i & 1) {
20275 k1 = dataUint32[i]; 20276 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 20277 k1 = k1 << 15 | k1 >>> 17; 20278 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 20279 h1 ^= k1; 20280 h1 = h1 << 13 | h1 >>> 19; 20281 h1 = h1 * 5 + 0xe6546b64; 20282 } else { 20283 k2 = dataUint32[i]; 20284 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 20285 k2 = k2 << 15 | k2 >>> 17; 20286 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 20287 h2 ^= k2; 20288 h2 = h2 << 13 | h2 >>> 19; 20289 h2 = h2 * 5 + 0xe6546b64; 20290 } 20291 } 20292 k1 = 0; 20293 switch (tailLength) { 20294 case 3: 20295 k1 ^= data[blockCounts * 4 + 2] << 16; 20296 case 2: 20297 k1 ^= data[blockCounts * 4 + 1] << 8; 20298 case 1: 20299 k1 ^= data[blockCounts * 4]; 20300 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 20301 k1 = k1 << 15 | k1 >>> 17; 20302 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 20303 if (blockCounts & 1) { 20304 h1 ^= k1; 20305 } else { 20306 h2 ^= k1; 20307 } 20308 } 20309 this.h1 = h1; 20310 this.h2 = h2; 20311 return this; 20312 }, 20313 hexdigest: function MurmurHash3_64_hexdigest() { 20314 var h1 = this.h1; 20315 var h2 = this.h2; 20316 h1 ^= h2 >>> 1; 20317 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 20318 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 20319 h1 ^= h2 >>> 1; 20320 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 20321 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 20322 h1 ^= h2 >>> 1; 20323 for (var i = 0, arr = [ 20324 h1, 20325 h2 20326 ], str = ''; i < arr.length; i++) { 20327 var hex = (arr[i] >>> 0).toString(16); 20328 while (hex.length < 8) { 20329 hex = '0' + hex; 20330 } 20331 str += hex; 20332 } 20333 return str; 20334 } 20335 }; 20336 return MurmurHash3_64; 20337 }(); 20338 exports.MurmurHash3_64 = MurmurHash3_64; 20339 })); 20340 (function (root, factory) { 20341 factory(root.pdfjsCorePrimitives = {}, root.pdfjsSharedUtil); 20342 }(this, function (exports, sharedUtil) { 20343 var isArray = sharedUtil.isArray; 20344 var EOF = {}; 20345 var Name = function NameClosure() { 20346 function Name(name) { 20347 this.name = name; 20348 } 20349 Name.prototype = {}; 20350 var nameCache = Object.create(null); 20351 Name.get = function Name_get(name) { 20352 var nameValue = nameCache[name]; 20353 return nameValue ? nameValue : nameCache[name] = new Name(name); 20354 }; 20355 return Name; 20356 }(); 20357 var Cmd = function CmdClosure() { 20358 function Cmd(cmd) { 20359 this.cmd = cmd; 20360 } 20361 Cmd.prototype = {}; 20362 var cmdCache = Object.create(null); 20363 Cmd.get = function Cmd_get(cmd) { 20364 var cmdValue = cmdCache[cmd]; 20365 return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); 20366 }; 20367 return Cmd; 20368 }(); 20369 var Dict = function DictClosure() { 20370 var nonSerializable = function nonSerializableClosure() { 20371 return nonSerializable; 20372 }; 20373 function Dict(xref) { 20374 this.map = Object.create(null); 20375 this.xref = xref; 20376 this.objId = null; 20377 this.suppressEncryption = false; 20378 this.__nonSerializable__ = nonSerializable; 20379 } 20380 Dict.prototype = { 20381 assignXref: function Dict_assignXref(newXref) { 20382 this.xref = newXref; 20383 }, 20384 get: function Dict_get(key1, key2, key3) { 20385 var value; 20386 var xref = this.xref, suppressEncryption = this.suppressEncryption; 20387 if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') { 20388 return xref ? xref.fetchIfRef(value, suppressEncryption) : value; 20389 } 20390 if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') { 20391 return xref ? xref.fetchIfRef(value, suppressEncryption) : value; 20392 } 20393 value = this.map[key3] || null; 20394 return xref ? xref.fetchIfRef(value, suppressEncryption) : value; 20395 }, 20396 getAsync: function Dict_getAsync(key1, key2, key3) { 20397 var value; 20398 var xref = this.xref, suppressEncryption = this.suppressEncryption;
20399 if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') { 20400 if (xref) { 20401 return xref.fetchIfRefAsync(value, suppressEncryption); 20402 } 20403 return Promise.resolve(value); 20404 } 20405 if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') { 20406 if (xref) { 20407 return xref.fetchIfRefAsync(value, suppressEncryption); 20408 } 20409 return Promise.resolve(value); 20410 } 20411 value = this.map[key3] || null; 20412 if (xref) { 20413 return xref.fetchIfRefAsync(value, suppressEncryption); 20414 } 20415 return Promise.resolve(value); 20416 }, 20417 getArray: function Dict_getArray(key1, key2, key3) { 20418 var value = this.get(key1, key2, key3); 20419 var xref = this.xref, suppressEncryption = this.suppressEncryption; 20420 if (!isArray(value) || !xref) { 20421 return value; 20422 } 20423 value = value.slice(); 20424 for (var i = 0, ii = value.length; i < ii; i++) { 20425 if (!isRef(value[i])) { 20426 continue; 20427 } 20428 value[i] = xref.fetch(value[i], suppressEncryption); 20429 } 20430 return value; 20431 }, 20432 getRaw: function Dict_getRaw(key) { 20433 return this.map[key]; 20434 }, 20435 getKeys: function Dict_getKeys() { 20436 return Object.keys(this.map); 20437 }, 20438 set: function Dict_set(key, value) { 20439 this.map[key] = value; 20440 }, 20441 has: function Dict_has(key) { 20442 return key in this.map; 20443 }, 20444 forEach: function Dict_forEach(callback) { 20445 for (var key in this.map) { 20446 callback(key, this.get(key)); 20447 } 20448 } 20449 }; 20450 Dict.empty = new Dict(null); 20451 Dict.merge = function Dict_merge(xref, dictArray) { 20452 var mergedDict = new Dict(xref); 20453 for (var i = 0, ii = dictArray.length; i < ii; i++) { 20454 var dict = dictArray[i]; 20455 if (!isDict(dict)) { 20456 continue; 20457 } 20458 for (var keyName in dict.map) { 20459 if (mergedDict.map[keyName]) { 20460 continue; 20461 } 20462 mergedDict.map[keyName] = dict.map[keyName]; 20463 } 20464 } 20465 return mergedDict; 20466 }; 20467 return Dict; 20468 }(); 20469 var Ref = function RefClosure() { 20470 function Ref(num, gen) { 20471 this.num = num; 20472 this.gen = gen; 20473 } 20474 Ref.prototype = { 20475 toString: function Ref_toString() { 20476 var str = this.num + 'R'; 20477 if (this.gen !== 0) { 20478 str += this.gen; 20479 } 20480 return str; 20481 } 20482 }; 20483 return Ref; 20484 }(); 20485 var RefSet = function RefSetClosure() { 20486 function RefSet() { 20487 this.dict = Object.create(null); 20488 } 20489 RefSet.prototype = { 20490 has: function RefSet_has(ref) { 20491 return ref.toString() in this.dict; 20492 }, 20493 put: function RefSet_put(ref) { 20494 this.dict[ref.toString()] = true; 20495 }, 20496 remove: function RefSet_remove(ref) { 20497 delete this.dict[ref.toString()]; 20498 } 20499 }; 20500 return RefSet; 20501 }(); 20502 var RefSetCache = function RefSetCacheClosure() { 20503 function RefSetCache() { 20504 this.dict = Object.create(null); 20505 } 20506 RefSetCache.prototype = { 20507 get: function RefSetCache_get(ref) { 20508 return this.dict[ref.toString()]; 20509 }, 20510 has: function RefSetCache_has(ref) { 20511 return ref.toString() in this.dict; 20512 }, 20513 put: function RefSetCache_put(ref, obj) { 20514 this.dict[ref.toString()] = obj; 20515 }, 20516 putAlias: function RefSetCache_putAlias(ref, aliasRef) { 20517 this.dict[ref.toString()] = this.get(aliasRef); 20518 }, 20519 forEach: function RefSetCache_forEach(fn, thisArg) { 20520 for (var i in this.dict) { 20521 fn.call(thisArg, this.dict[i]); 20522 } 20523 }, 20524 clear: function RefSetCache_clear() { 20525 this.dict = Object.create(null); 20526 } 20527 }; 20528 return RefSetCache; 20529 }(); 20530 function isEOF(v) { 20531 return v === EOF; 20532 } 20533 function isName(v, name) { 20534 return v instanceof Name && (name === undefined || v.name === name); 20535 } 20536 function isCmd(v, cmd) { 20537 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 20538 } 20539 function isDict(v, type) { 20540 return v instanceof Dict && (type === undefined || isName(v.get('Type'), type)); 20541 } 20542 function isRef(v) { 20543 return v instanceof Ref; 20544 } 20545 function isRefsEqual(v1, v2) { 20546 return v1.num === v2.num && v1.gen === v2.gen; 20547 } 20548 function isStream(v) { 20549 return typeof v === 'object' && v !== null && v.getBytes !== undefined; 20550 } 20551 exports.EOF = EOF; 20552 exports.Cmd = Cmd; 20553 exports.Dict = Dict; 20554 exports.Name = Name; 20555 exports.Ref = Ref; 20556 exports.RefSet = RefSet; 20557 exports.RefSetCache = RefSetCache; 20558 exports.isEOF = isEOF; 20559 exports.isCmd = isCmd; 20560 exports.isDict = isDict; 20561 exports.isName = isName; 20562 exports.isRef = isRef; 20563 exports.isRefsEqual = isRefsEqual; 20564 exports.isStream = isStream; 20565 })); 20566 (function (root, factory) { 20567 factory(root.pdfjsCoreStandardFonts = {}, root.pdfjsSharedUtil); 20568 }(this, function (exports, sharedUtil) { 20569 var getLookupTableFactory = sharedUtil.getLookupTableFactory; 20570 var getStdFontMap = getLookupTableFactory(function (t) { 20571 t['ArialNarrow'] = 'Helvetica'; 20572 t['ArialNarrow-Bold'] = 'Helvetica-Bold'; 20573 t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique'; 20574 t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
20575 t['ArialBlack'] = 'Helvetica'; 20576 t['ArialBlack-Bold'] = 'Helvetica-Bold'; 20577 t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique'; 20578 t['ArialBlack-Italic'] = 'Helvetica-Oblique'; 20579 t['Arial-Black'] = 'Helvetica'; 20580 t['Arial-Black-Bold'] = 'Helvetica-Bold'; 20581 t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique'; 20582 t['Arial-Black-Italic'] = 'Helvetica-Oblique'; 20583 t['Arial'] = 'Helvetica'; 20584 t['Arial-Bold'] = 'Helvetica-Bold'; 20585 t['Arial-BoldItalic'] = 'Helvetica-BoldOblique'; 20586 t['Arial-Italic'] = 'Helvetica-Oblique'; 20587 t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique'; 20588 t['Arial-BoldMT'] = 'Helvetica-Bold'; 20589 t['Arial-ItalicMT'] = 'Helvetica-Oblique'; 20590 t['ArialMT'] = 'Helvetica'; 20591 t['Courier-Bold'] = 'Courier-Bold'; 20592 t['Courier-BoldItalic'] = 'Courier-BoldOblique'; 20593 t['Courier-Italic'] = 'Courier-Oblique'; 20594 t['CourierNew'] = 'Courier'; 20595 t['CourierNew-Bold'] = 'Courier-Bold'; 20596 t['CourierNew-BoldItalic'] = 'Courier-BoldOblique'; 20597 t['CourierNew-Italic'] = 'Courier-Oblique'; 20598 t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique'; 20599 t['CourierNewPS-BoldMT'] = 'Courier-Bold'; 20600 t['CourierNewPS-ItalicMT'] = 'Courier-Oblique'; 20601 t['CourierNewPSMT'] = 'Courier'; 20602 t['Helvetica'] = 'Helvetica'; 20603 t['Helvetica-Bold'] = 'Helvetica-Bold'; 20604 t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique'; 20605 t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique'; 20606 t['Helvetica-Italic'] = 'Helvetica-Oblique'; 20607 t['Helvetica-Oblique'] = 'Helvetica-Oblique'; 20608 t['Symbol-Bold'] = 'Symbol'; 20609 t['Symbol-BoldItalic'] = 'Symbol'; 20610 t['Symbol-Italic'] = 'Symbol'; 20611 t['TimesNewRoman'] = 'Times-Roman'; 20612 t['TimesNewRoman-Bold'] = 'Times-Bold'; 20613 t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic'; 20614 t['TimesNewRoman-Italic'] = 'Times-Italic'; 20615 t['TimesNewRomanPS'] = 'Times-Roman'; 20616 t['TimesNewRomanPS-Bold'] = 'Times-Bold'; 20617 t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic'; 20618 t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic'; 20619 t['TimesNewRomanPS-BoldMT'] = 'Times-Bold'; 20620 t['TimesNewRomanPS-Italic'] = 'Times-Italic'; 20621 t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic'; 20622 t['TimesNewRomanPSMT'] = 'Times-Roman'; 20623 t['TimesNewRomanPSMT-Bold'] = 'Times-Bold'; 20624 t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic'; 20625 t['TimesNewRomanPSMT-Italic'] = 'Times-Italic'; 20626 }); 20627 var getNonStdFontMap = getLookupTableFactory(function (t) { 20628 t['CenturyGothic'] = 'Helvetica'; 20629 t['CenturyGothic-Bold'] = 'Helvetica-Bold'; 20630 t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique'; 20631 t['CenturyGothic-Italic'] = 'Helvetica-Oblique'; 20632 t['ComicSansMS'] = 'Comic Sans MS'; 20633 t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold'; 20634 t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic'; 20635 t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic'; 20636 t['LucidaConsole'] = 'Courier'; 20637 t['LucidaConsole-Bold'] = 'Courier-Bold'; 20638 t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique'; 20639 t['LucidaConsole-Italic'] = 'Courier-Oblique'; 20640 t['MS-Gothic'] = 'MS Gothic'; 20641 t['MS-Gothic-Bold'] = 'MS Gothic-Bold'; 20642 t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic'; 20643 t['MS-Gothic-Italic'] = 'MS Gothic-Italic'; 20644 t['MS-Mincho'] = 'MS Mincho'; 20645 t['MS-Mincho-Bold'] = 'MS Mincho-Bold'; 20646 t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic'; 20647 t['MS-Mincho-Italic'] = 'MS Mincho-Italic'; 20648 t['MS-PGothic'] = 'MS PGothic'; 20649 t['MS-PGothic-Bold'] = 'MS PGothic-Bold'; 20650 t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic'; 20651 t['MS-PGothic-Italic'] = 'MS PGothic-Italic'; 20652 t['MS-PMincho'] = 'MS PMincho'; 20653 t['MS-PMincho-Bold'] = 'MS PMincho-Bold'; 20654 t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic'; 20655 t['MS-PMincho-Italic'] = 'MS PMincho-Italic'; 20656 t['NuptialScript'] = 'Times-Italic'; 20657 t['Wingdings'] = 'ZapfDingbats'; 20658 }); 20659 var getSerifFonts = getLookupTableFactory(function (t) { 20660 t['Adobe Jenson'] = true; 20661 t['Adobe Text'] = true; 20662 t['Albertus'] = true; 20663 t['Aldus'] = true; 20664 t['Alexandria'] = true; 20665 t['Algerian'] = true; 20666 t['American Typewriter'] = true; 20667 t['Antiqua'] = true; 20668 t['Apex'] = true; 20669 t['Arno'] = true; 20670 t['Aster'] = true; 20671 t['Aurora'] = true; 20672 t['Baskerville'] = true; 20673 t['Bell'] = true; 20674 t['Bembo'] = true; 20675 t['Bembo Schoolbook'] = true; 20676 t['Benguiat'] = true; 20677 t['Berkeley Old Style'] = true; 20678 t['Bernhard Modern'] = true; 20679 t['Berthold City'] = true; 20680 t['Bodoni'] = true; 20681 t['Bauer Bodoni'] = true; 20682 t['Book Antiqua'] = true; 20683 t['Bookman'] = true; 20684 t['Bordeaux Roman'] = true; 20685 t['Californian FB'] = true; 20686 t['Calisto'] = true; 20687 t['Calvert'] = true; 20688 t['Capitals'] = true; 20689 t['Cambria'] = true; 20690 t['Cartier'] = true; 20691 t['Caslon'] = true; 20692 t['Catull'] = true; 20693 t['Centaur'] = true; 20694 t['Century Old Style'] = true; 20695 t['Century Schoolbook'] = true; 20696 t['Chaparral'] = true; 20697 t['Charis SIL'] = true; 20698 t['Cheltenham'] = true; 20699 t['Cholla Slab'] = true; 20700 t['Clarendon'] = true; 20701 t['Clearface'] = true;
20702 t['Cochin'] = true; 20703 t['Colonna'] = true; 20704 t['Computer Modern'] = true; 20705 t['Concrete Roman'] = true; 20706 t['Constantia'] = true; 20707 t['Cooper Black'] = true; 20708 t['Corona'] = true; 20709 t['Ecotype'] = true; 20710 t['Egyptienne'] = true; 20711 t['Elephant'] = true; 20712 t['Excelsior'] = true; 20713 t['Fairfield'] = true; 20714 t['FF Scala'] = true; 20715 t['Folkard'] = true; 20716 t['Footlight'] = true; 20717 t['FreeSerif'] = true; 20718 t['Friz Quadrata'] = true; 20719 t['Garamond'] = true; 20720 t['Gentium'] = true; 20721 t['Georgia'] = true; 20722 t['Gloucester'] = true; 20723 t['Goudy Old Style'] = true; 20724 t['Goudy Schoolbook'] = true; 20725 t['Goudy Pro Font'] = true; 20726 t['Granjon'] = true; 20727 t['Guardian Egyptian'] = true; 20728 t['Heather'] = true; 20729 t['Hercules'] = true; 20730 t['High Tower Text'] = true; 20731 t['Hiroshige'] = true; 20732 t['Hoefler Text'] = true; 20733 t['Humana Serif'] = true; 20734 t['Imprint'] = true; 20735 t['Ionic No. 5'] = true; 20736 t['Janson'] = true; 20737 t['Joanna'] = true; 20738 t['Korinna'] = true; 20739 t['Lexicon'] = true; 20740 t['Liberation Serif'] = true; 20741 t['Linux Libertine'] = true; 20742 t['Literaturnaya'] = true; 20743 t['Lucida'] = true; 20744 t['Lucida Bright'] = true; 20745 t['Melior'] = true; 20746 t['Memphis'] = true; 20747 t['Miller'] = true; 20748 t['Minion'] = true; 20749 t['Modern'] = true; 20750 t['Mona Lisa'] = true; 20751 t['Mrs Eaves'] = true; 20752 t['MS Serif'] = true; 20753 t['Museo Slab'] = true; 20754 t['New York'] = true; 20755 t['Nimbus Roman'] = true; 20756 t['NPS Rawlinson Roadway'] = true; 20757 t['NuptialScript'] = true; 20758 t['Palatino'] = true; 20759 t['Perpetua'] = true; 20760 t['Plantin'] = true; 20761 t['Plantin Schoolbook'] = true; 20762 t['Playbill'] = true; 20763 t['Poor Richard'] = true; 20764 t['Rawlinson Roadway'] = true; 20765 t['Renault'] = true; 20766 t['Requiem'] = true; 20767 t['Rockwell'] = true; 20768 t['Roman'] = true; 20769 t['Rotis Serif'] = true; 20770 t['Sabon'] = true; 20771 t['Scala'] = true; 20772 t['Seagull'] = true; 20773 t['Sistina'] = true; 20774 t['Souvenir'] = true; 20775 t['STIX'] = true; 20776 t['Stone Informal'] = true; 20777 t['Stone Serif'] = true; 20778 t['Sylfaen'] = true; 20779 t['Times'] = true; 20780 t['Trajan'] = true; 20781 t['Trinité'] = true; 20782 t['Trump Mediaeval'] = true; 20783 t['Utopia'] = true; 20784 t['Vale Type'] = true; 20785 t['Bitstream Vera'] = true; 20786 t['Vera Serif'] = true; 20787 t['Versailles'] = true;
20788 t['Wanted'] = true; 20789 t['Weiss'] = true; 20790 t['Wide Latin'] = true; 20791 t['Windsor'] = true; 20792 t['XITS'] = true; 20793 }); 20794 var getSymbolsFonts = getLookupTableFactory(function (t) { 20795 t['Dingbats'] = true; 20796 t['Symbol'] = true; 20797 t['ZapfDingbats'] = true; 20798 }); 20799 var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) { 20800 t[2] = 10; 20801 t[3] = 32; 20802 t[4] = 33; 20803 t[5] = 34; 20804 t[6] = 35; 20805 t[7] = 36; 20806 t[8] = 37; 20807 t[9] = 38; 20808 t[10] = 39; 20809 t[11] = 40; 20810 t[12] = 41; 20811 t[13] = 42; 20812 t[14] = 43; 20813 t[15] = 44; 20814 t[16] = 45; 20815 t[17] = 46; 20816 t[18] = 47; 20817 t[19] = 48; 20818 t[20] = 49; 20819 t[21] = 50; 20820 t[22] = 51; 20821 t[23] = 52; 20822 t[24] = 53; 20823 t[25] = 54; 20824 t[26] = 55; 20825 t[27] = 56; 20826 t[28] = 57; 20827 t[29] = 58; 20828 t[30] = 894; 20829 t[31] = 60; 20830 t[32] = 61; 20831 t[33] = 62; 20832 t[34] = 63; 20833 t[35] = 64; 20834 t[36] = 65; 20835 t[37] = 66; 20836 t[38] = 67; 20837 t[39] = 68; 20838 t[40] = 69; 20839 t[41] = 70; 20840 t[42] = 71; 20841 t[43] = 72; 20842 t[44] = 73; 20843 t[45] = 74; 20844 t[46] = 75; 20845 t[47] = 76; 20846 t[48] = 77; 20847 t[49] = 78; 20848 t[50] = 79; 20849 t[51] = 80; 20850 t[52] = 81; 20851 t[53] = 82; 20852 t[54] = 83; 20853 t[55] = 84; 20854 t[56] = 85; 20855 t[57] = 86; 20856 t[58] = 87; 20857 t[59] = 88; 20858 t[60] = 89; 20859 t[61] = 90; 20860 t[62] = 91; 20861 t[63] = 92; 20862 t[64] = 93; 20863 t[65] = 94; 20864 t[66] = 95; 20865 t[67] = 96; 20866 t[68] = 97; 20867 t[69] = 98; 20868 t[70] = 99; 20869 t[71] = 100; 20870 t[72] = 101; 20871 t[73] = 102; 20872 t[74] = 103; 20873 t[75] = 104; 20874 t[76] = 105; 20875 t[77] = 106; 20876 t[78] = 107; 20877 t[79] = 108; 20878 t[80] = 109; 20879 t[81] = 110; 20880 t[82] = 111; 20881 t[83] = 112; 20882 t[84] = 113; 20883 t[85] = 114; 20884 t[86] = 115; 20885 t[87] = 116; 20886 t[88] = 117; 20887 t[89] = 118; 20888 t[90] = 119; 20889 t[91] = 120; 20890 t[92] = 121; 20891 t[93] = 122; 20892 t[94] = 123; 20893 t[95] = 124; 20894 t[96] = 125; 20895 t[97] = 126; 20896 t[98] = 196; 20897 t[99] = 197; 20898 t[100] = 199; 20899 t[101] = 201; 20900 t[102] = 209; 20901 t[103] = 214; 20902 t[104] = 220; 20903 t[105] = 225; 20904 t[106] = 224; 20905 t[107] = 226; 20906 t[108] = 228; 20907 t[109] = 227; 20908 t[110] = 229; 20909 t[111] = 231; 20910 t[112] = 233; 20911 t[113] = 232; 20912 t[114] = 234; 20913 t[115] = 235; 20914 t[116] = 237; 20915 t[117] = 236; 20916 t[118] = 238; 20917 t[119] = 239; 20918 t[120] = 241; 20919 t[121] = 243; 20920 t[122] = 242; 20921 t[123] = 244; 20922 t[124] = 246; 20923 t[125] = 245; 20924 t[126] = 250; 20925 t[127] = 249; 20926 t[128] = 251; 20927 t[129] = 252; 20928 t[130] = 8224; 20929 t[131] = 176; 20930 t[132] = 162; 20931 t[133] = 163; 20932 t[134] = 167; 20933 t[135] = 8226; 20934 t[136] = 182; 20935 t[137] = 223; 20936 t[138] = 174; 20937 t[139] = 169; 20938 t[140] = 8482; 20939 t[141] = 180; 20940 t[142] = 168; 20941 t[143] = 8800; 20942 t[144] = 198; 20943 t[145] = 216; 20944 t[146] = 8734; 20945 t[147] = 177; 20946 t[148] = 8804; 20947 t[149] = 8805; 20948 t[150] = 165; 20949 t[151] = 181; 20950 t[152] = 8706; 20951 t[153] = 8721; 20952 t[154] = 8719; 20953 t[156] = 8747; 20954 t[157] = 170; 20955 t[158] = 186; 20956 t[159] = 8486; 20957 t[160] = 230; 20958 t[161] = 248; 20959 t[162] = 191; 20960 t[163] = 161; 20961 t[164] = 172; 20962 t[165] = 8730; 20963 t[166] = 402; 20964 t[167] = 8776; 20965 t[168] = 8710; 20966 t[169] = 171; 20967 t[170] = 187; 20968 t[171] = 8230; 20969 t[210] = 218; 20970 t[223] = 711; 20971 t[224] = 321; 20972 t[225] = 322; 20973 t[227] = 353; 20974 t[229] = 382; 20975 t[234] = 253; 20976 t[252] = 263; 20977 t[253] = 268; 20978 t[254] = 269; 20979 t[258] = 258; 20980 t[260] = 260; 20981 t[261] = 261; 20982 t[265] = 280; 20983 t[266] = 281; 20984 t[268] = 283; 20985 t[269] = 313; 20986 t[275] = 323; 20987 t[276] = 324; 20988 t[278] = 328; 20989 t[284] = 345; 20990 t[285] = 346; 20991 t[286] = 347; 20992 t[292] = 367; 20993 t[295] = 377; 20994 t[296] = 378; 20995 t[298] = 380; 20996 t[305] = 963; 20997 t[306] = 964; 20998 t[307] = 966; 20999 t[308] = 8215; 21000 t[309] = 8252; 21001 t[310] = 8319; 21002 t[311] = 8359; 21003 t[312] = 8592; 21004 t[313] = 8593; 21005 t[337] = 9552; 21006 t[493] = 1039; 21007 t[494] = 1040; 21008 t[705] = 1524; 21009 t[706] = 8362; 21010 t[710] = 64288; 21011 t[711] = 64298; 21012 t[759] = 1617; 21013 t[761] = 1776; 21014 t[763] = 1778; 21015 t[775] = 1652; 21016 t[777] = 1764; 21017 t[778] = 1780; 21018 t[779] = 1781; 21019 t[780] = 1782; 21020 t[782] = 771; 21021 t[783] = 64726; 21022 t[786] = 8363; 21023 t[788] = 8532; 21024 t[790] = 768; 21025 t[791] = 769; 21026 t[792] = 768; 21027 t[795] = 803; 21028 t[797] = 64336; 21029 t[798] = 64337; 21030 t[799] = 64342; 21031 t[800] = 64343; 21032 t[801] = 64344; 21033 t[802] = 64345; 21034 t[803] = 64362; 21035 t[804] = 64363; 21036 t[805] = 64364; 21037 t[2424] = 7821; 21038 t[2425] = 7822; 21039 t[2426] = 7823; 21040 t[2427] = 7824; 21041 t[2428] = 7825; 21042 t[2429] = 7826; 21043 t[2430] = 7827; 21044 t[2433] = 7682; 21045 t[2678] = 8045; 21046 t[2679] = 8046; 21047 t[2830] = 1552; 21048 t[2838] = 686; 21049 t[2840] = 751; 21050 t[2842] = 753; 21051 t[2843] = 754; 21052 t[2844] = 755; 21053 t[2846] = 757; 21054 t[2856] = 767; 21055 t[2857] = 848; 21056 t[2858] = 849; 21057 t[2862] = 853; 21058 t[2863] = 854; 21059 t[2864] = 855; 21060 t[2865] = 861; 21061 t[2866] = 862; 21062 t[2906] = 7460; 21063 t[2908] = 7462; 21064 t[2909] = 7463; 21065 t[2910] = 7464; 21066 t[2912] = 7466; 21067 t[2913] = 7467; 21068 t[2914] = 7468; 21069 t[2916] = 7470; 21070 t[2917] = 7471; 21071 t[2918] = 7472; 21072 t[2920] = 7474; 21073 t[2921] = 7475; 21074 t[2922] = 7476; 21075 t[2924] = 7478; 21076 t[2925] = 7479; 21077 t[2926] = 7480; 21078 t[2928] = 7482;
21079 t[2929] = 7483; 21080 t[2930] = 7484; 21081 t[2932] = 7486; 21082 t[2933] = 7487; 21083 t[2934] = 7488; 21084 t[2936] = 7490; 21085 t[2937] = 7491; 21086 t[2938] = 7492; 21087 t[2940] = 7494; 21088 t[2941] = 7495; 21089 t[2942] = 7496; 21090 t[2944] = 7498; 21091 t[2946] = 7500; 21092 t[2948] = 7502; 21093 t[2950] = 7504; 21094 t[2951] = 7505; 21095 t[2952] = 7506; 21096 t[2954] = 7508; 21097 t[2955] = 7509; 21098 t[2956] = 7510; 21099 t[2958] = 7512; 21100 t[2959] = 7513; 21101 t[2960] = 7514; 21102 t[2962] = 7516; 21103 t[2963] = 7517; 21104 t[2964] = 7518; 21105 t[2966] = 7520; 21106 t[2967] = 7521; 21107 t[2968] = 7522; 21108 t[2970] = 7524; 21109 t[2971] = 7525; 21110 t[2972] = 7526; 21111 t[2974] = 7528; 21112 t[2975] = 7529; 21113 t[2976] = 7530; 21114 t[2978] = 1537; 21115 t[2979] = 1538; 21116 t[2980] = 1539; 21117 t[2982] = 1549; 21118 t[2983] = 1551; 21119 t[2984] = 1552; 21120 t[2986] = 1554; 21121 t[2987] = 1555; 21122 t[2988] = 1556; 21123 t[2990] = 1623; 21124 t[2991] = 1624; 21125 t[2995] = 1775; 21126 t[2999] = 1791; 21127 t[3002] = 64290; 21128 t[3003] = 64291; 21129 t[3004] = 64292; 21130 t[3006] = 64294; 21131 t[3007] = 64295; 21132 t[3008] = 64296; 21133 t[3011] = 1900; 21134 t[3014] = 8223; 21135 t[3015] = 8244; 21136 t[3017] = 7532; 21137 t[3018] = 7533; 21138 t[3019] = 7534; 21139 t[3075] = 7590; 21140 t[3076] = 7591; 21141 t[3079] = 7594; 21142 t[3080] = 7595; 21143 t[3083] = 7598; 21144 t[3084] = 7599; 21145 t[3087] = 7602; 21146 t[3088] = 7603; 21147 t[3091] = 7606; 21148 t[3092] = 7607; 21149 t[3095] = 7610; 21150 t[3096] = 7611; 21151 t[3099] = 7614; 21152 t[3100] = 7615; 21153 t[3103] = 7618; 21154 t[3104] = 7619; 21155 t[3107] = 8337; 21156 t[3108] = 8338; 21157 t[3116] = 1884; 21158 t[3119] = 1885; 21159 t[3120] = 1885; 21160 t[3123] = 1886; 21161 t[3124] = 1886; 21162 t[3127] = 1887; 21163 t[3128] = 1887; 21164 t[3131] = 1888; 21165 t[3132] = 1888; 21166 t[3135] = 1889; 21167 t[3136] = 1889; 21168 t[3139] = 1890; 21169 t[3140] = 1890; 21170 t[3143] = 1891; 21171 t[3144] = 1891; 21172 t[3147] = 1892; 21173 t[3148] = 1892; 21174 t[3153] = 580; 21175 t[3154] = 581; 21176 t[3157] = 584; 21177 t[3158] = 585; 21178 t[3161] = 588; 21179 t[3162] = 589; 21180 t[3165] = 891; 21181 t[3166] = 892; 21182 t[3169] = 1274; 21183 t[3170] = 1275; 21184 t[3173] = 1278; 21185 t[3174] = 1279; 21186 t[3181] = 7622; 21187 t[3182] = 7623; 21188 t[3282] = 11799; 21189 t[3316] = 578; 21190 t[3379] = 42785; 21191 t[3393] = 1159; 21192 t[3416] = 8377; 21193 }); 21194 var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) { 21195 t[227] = 322; 21196 t[264] = 261; 21197 t[291] = 346; 21198 }); 21199 exports.getStdFontMap = getStdFontMap; 21200 exports.getNonStdFontMap = getNonStdFontMap; 21201 exports.getSerifFonts = getSerifFonts; 21202 exports.getSymbolsFonts = getSymbolsFonts; 21203 exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 21204 exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 21205 })); 21206 (function (root, factory) { 21207 factory(root.pdfjsCoreUnicode = {}, root.pdfjsSharedUtil); 21208 }(this, function (exports, sharedUtil) { 21209 var getLookupTableFactory = sharedUtil.getLookupTableFactory;
21210 var getSpecialPUASymbols = getLookupTableFactory(function (t) { 21211 t[63721] = 0x00A9; 21212 t[63193] = 0x00A9; 21213 t[63720] = 0x00AE; 21214 t[63194] = 0x00AE; 21215 t[63722] = 0x2122; 21216 t[63195] = 0x2122; 21217 t[63729] = 0x23A7; 21218 t[63730] = 0x23A8; 21219 t[63731] = 0x23A9; 21220 t[63740] = 0x23AB; 21221 t[63741] = 0x23AC; 21222 t[63742] = 0x23AD; 21223 t[63726] = 0x23A1; 21224 t[63727] = 0x23A2; 21225 t[63728] = 0x23A3; 21226 t[63737] = 0x23A4; 21227 t[63738] = 0x23A5; 21228 t[63739] = 0x23A6; 21229 t[63723] = 0x239B; 21230 t[63724] = 0x239C; 21231 t[63725] = 0x239D; 21232 t[63734] = 0x239E; 21233 t[63735] = 0x239F; 21234 t[63736] = 0x23A0; 21235 }); 21236 function mapSpecialUnicodeValues(code) { 21237 if (code >= 0xFFF0 && code <= 0xFFFF) { 21238 return 0; 21239 } else if (code >= 0xF600 && code <= 0xF8FF) { 21240 return getSpecialPUASymbols()[code] || code; 21241 } 21242 return code; 21243 } 21244 function getUnicodeForGlyph(name, glyphsUnicodeMap) { 21245 var unicode = glyphsUnicodeMap[name]; 21246 if (unicode !== undefined) { 21247 return unicode; 21248 } 21249 if (!name) { 21250 return -1; 21251 } 21252 if (name[0] === 'u') { 21253 var nameLen = name.length, hexStr; 21254 if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') { 21255 hexStr = name.substr(3); 21256 } else if (nameLen >= 5 && nameLen <= 7) { 21257 hexStr = name.substr(1); 21258 } else { 21259 return -1; 21260 } 21261 if (hexStr === hexStr.toUpperCase()) { 21262 unicode = parseInt(hexStr, 16); 21263 if (unicode >= 0) { 21264 return unicode; 21265 } 21266 } 21267 } 21268 return -1; 21269 } 21270 var UnicodeRanges = [ 21271 { 21272 'begin': 0x0000, 21273 'end': 0x007F 21274 }, 21275 { 21276 'begin': 0x0080, 21277 'end': 0x00FF 21278 }, 21279 { 21280 'begin': 0x0100, 21281 'end': 0x017F 21282 }, 21283 { 21284 'begin': 0x0180, 21285 'end': 0x024F 21286 }, 21287 { 21288 'begin': 0x0250, 21289 'end': 0x02AF 21290 }, 21291 { 21292 'begin': 0x02B0, 21293 'end': 0x02FF 21294 }, 21295 { 21296 'begin': 0x0300, 21297 'end': 0x036F 21298 }, 21299 { 21300 'begin': 0x0370, 21301 'end': 0x03FF 21302 }, 21303 { 21304 'begin': 0x2C80, 21305 'end': 0x2CFF 21306 }, 21307 { 21308 'begin': 0x0400, 21309 'end': 0x04FF 21310 }, 21311 { 21312 'begin': 0x0530, 21313 'end': 0x058F 21314 }, 21315 { 21316 'begin': 0x0590, 21317 'end': 0x05FF 21318 }, 21319 { 21320 'begin': 0xA500, 21321 'end': 0xA63F 21322 }, 21323 { 21324 'begin': 0x0600, 21325 'end': 0x06FF 21326 }, 21327 { 21328 'begin': 0x07C0, 21329 'end': 0x07FF 21330 }, 21331 { 21332 'begin': 0x0900, 21333 'end': 0x097F 21334 }, 21335 { 21336 'begin': 0x0980, 21337 'end': 0x09FF 21338 }, 21339 { 21340 'begin': 0x0A00, 21341 'end': 0x0A7F 21342 }, 21343 { 21344 'begin': 0x0A80, 21345 'end': 0x0AFF 21346 }, 21347 { 21348 'begin': 0x0B00, 21349 'end': 0x0B7F 21350 }, 21351 { 21352 'begin': 0x0B80, 21353 'end': 0x0BFF 21354 }, 21355 { 21356 'begin': 0x0C00, 21357 'end': 0x0C7F 21358 }, 21359 { 21360 'begin': 0x0C80, 21361 'end': 0x0CFF 21362 }, 21363 { 21364 'begin': 0x0D00, 21365 'end': 0x0D7F 21366 }, 21367 { 21368 'begin': 0x0E00, 21369 'end': 0x0E7F 21370 }, 21371 { 21372 'begin': 0x0E80, 21373 'end': 0x0EFF 21374 }, 21375 { 21376 'begin': 0x10A0, 21377 'end': 0x10FF 21378 }, 21379 { 21380 'begin': 0x1B00, 21381 'end': 0x1B7F 21382 }, 21383 { 21384 'begin': 0x1100, 21385 'end': 0x11FF 21386 }, 21387 { 21388 'begin': 0x1E00, 21389 'end': 0x1EFF 21390 }, 21391 { 21392 'begin': 0x1F00, 21393 'end': 0x1FFF 21394 }, 21395 { 21396 'begin': 0x2000, 21397 'end': 0x206F 21398 }, 21399 { 21400 'begin': 0x2070, 21401 'end': 0x209F 21402 }, 21403 { 21404 'begin': 0x20A0, 21405 'end': 0x20CF 21406 }, 21407 { 21408 'begin': 0x20D0, 21409 'end': 0x20FF 21410 }, 21411 { 21412 'begin': 0x2100, 21413 'end': 0x214F 21414 }, 21415 { 21416 'begin': 0x2150, 21417 'end': 0x218F 21418 }, 21419 { 21420 'begin': 0x2190, 21421 'end': 0x21FF 21422 }, 21423 { 21424 'begin': 0x2200, 21425 'end': 0x22FF 21426 }, 21427 { 21428 'begin': 0x2300, 21429 'end': 0x23FF 21430 }, 21431 { 21432 'begin': 0x2400, 21433 'end': 0x243F 21434 }, 21435 { 21436 'begin': 0x2440, 21437 'end': 0x245F 21438 }, 21439 { 21440 'begin': 0x2460, 21441 'end': 0x24FF 21442 }, 21443 { 21444 'begin': 0x2500, 21445 'end': 0x257F 21446 }, 21447 { 21448 'begin': 0x2580, 21449 'end': 0x259F 21450 }, 21451 { 21452 'begin': 0x25A0, 21453 'end': 0x25FF 21454 }, 21455 { 21456 'begin': 0x2600, 21457 'end': 0x26FF 21458 }, 21459 { 21460 'begin': 0x2700, 21461 'end': 0x27BF 21462 }, 21463 { 21464 'begin': 0x3000, 21465 'end': 0x303F 21466 }, 21467 { 21468 'begin': 0x3040, 21469 'end': 0x309F 21470 }, 21471 { 21472 'begin': 0x30A0, 21473 'end': 0x30FF 21474 }, 21475 { 21476 'begin': 0x3100, 21477 'end': 0x312F 21478 }, 21479 { 21480 'begin': 0x3130, 21481 'end': 0x318F 21482 }, 21483 { 21484 'begin': 0xA840, 21485 'end': 0xA87F 21486 }, 21487 { 21488 'begin': 0x3200, 21489 'end': 0x32FF 21490 }, 21491 { 21492 'begin': 0x3300, 21493 'end': 0x33FF 21494 }, 21495 { 21496 'begin': 0xAC00, 21497 'end': 0xD7AF 21498 }, 21499 { 21500 'begin': 0xD800, 21501 'end': 0xDFFF 21502 }, 21503 { 21504 'begin': 0x10900, 21505 'end': 0x1091F 21506 }, 21507 { 21508 'begin': 0x4E00, 21509 'end': 0x9FFF 21510 }, 21511 { 21512 'begin': 0xE000, 21513 'end': 0xF8FF 21514 }, 21515 { 21516 'begin': 0x31C0, 21517 'end': 0x31EF 21518 }, 21519 { 21520 'begin': 0xFB00, 21521 'end': 0xFB4F 21522 }, 21523 { 21524 'begin': 0xFB50, 21525 'end': 0xFDFF 21526 }, 21527 { 21528 'begin': 0xFE20, 21529 'end': 0xFE2F 21530 }, 21531 { 21532 'begin': 0xFE10, 21533 'end': 0xFE1F 21534 }, 21535 { 21536 'begin': 0xFE50, 21537 'end': 0xFE6F 21538 }, 21539 { 21540 'begin': 0xFE70, 21541 'end': 0xFEFF 21542 }, 21543 { 21544 'begin': 0xFF00, 21545 'end': 0xFFEF 21546 }, 21547 { 21548 'begin': 0xFFF0, 21549 'end': 0xFFFF 21550 }, 21551 { 21552 'begin': 0x0F00, 21553 'end': 0x0FFF 21554 }, 21555 { 21556 'begin': 0x0700, 21557 'end': 0x074F 21558 }, 21559 { 21560 'begin': 0x0780, 21561 'end': 0x07BF 21562 }, 21563 { 21564 'begin': 0x0D80, 21565 'end': 0x0DFF 21566 }, 21567 { 21568 'begin': 0x1000, 21569 'end': 0x109F 21570 }, 21571 { 21572 'begin': 0x1200, 21573 'end': 0x137F 21574 }, 21575 { 21576 'begin': 0x13A0, 21577 'end': 0x13FF 21578 }, 21579 { 21580 'begin': 0x1400, 21581 'end': 0x167F 21582 }, 21583 { 21584 'begin': 0x1680, 21585 'end': 0x169F 21586 }, 21587 { 21588 'begin': 0x16A0, 21589 'end': 0x16FF 21590 }, 21591 { 21592 'begin': 0x1780, 21593 'end': 0x17FF 21594 }, 21595 { 21596 'begin': 0x1800, 21597 'end': 0x18AF 21598 }, 21599 { 21600 'begin': 0x2800, 21601 'end': 0x28FF 21602 }, 21603 { 21604 'begin': 0xA000, 21605 'end': 0xA48F 21606 }, 21607 { 21608 'begin': 0x1700, 21609 'end': 0x171F 21610 }, 21611 { 21612 'begin': 0x10300, 21613 'end': 0x1032F 21614 }, 21615 { 21616 'begin': 0x10330, 21617 'end': 0x1034F 21618 }, 21619 { 21620 'begin': 0x10400, 21621 'end': 0x1044F 21622 }, 21623 { 21624 'begin': 0x1D000, 21625 'end': 0x1D0FF 21626 }, 21627 { 21628 'begin': 0x1D400, 21629 'end': 0x1D7FF 21630 }, 21631 { 21632 'begin': 0xFF000, 21633 'end': 0xFFFFD 21634 }, 21635 { 21636 'begin': 0xFE00,
21637 'end': 0xFE0F 21638 }, 21639 { 21640 'begin': 0xE0000, 21641 'end': 0xE007F 21642 }, 21643 { 21644 'begin': 0x1900, 21645 'end': 0x194F 21646 }, 21647 { 21648 'begin': 0x1950, 21649 'end': 0x197F 21650 }, 21651 { 21652 'begin': 0x1980, 21653 'end': 0x19DF 21654 }, 21655 { 21656 'begin': 0x1A00, 21657 'end': 0x1A1F 21658 }, 21659 { 21660 'begin': 0x2C00, 21661 'end': 0x2C5F 21662 }, 21663 { 21664 'begin': 0x2D30, 21665 'end': 0x2D7F 21666 }, 21667 { 21668 'begin': 0x4DC0, 21669 'end': 0x4DFF 21670 }, 21671 { 21672 'begin': 0xA800, 21673 'end': 0xA82F 21674 }, 21675 { 21676 'begin': 0x10000, 21677 'end': 0x1007F 21678 }, 21679 { 21680 'begin': 0x10140, 21681 'end': 0x1018F 21682 }, 21683 { 21684 'begin': 0x10380, 21685 'end': 0x1039F 21686 }, 21687 { 21688 'begin': 0x103A0, 21689 'end': 0x103DF 21690 }, 21691 { 21692 'begin': 0x10450, 21693 'end': 0x1047F 21694 }, 21695 { 21696 'begin': 0x10480, 21697 'end': 0x104AF 21698 }, 21699 { 21700 'begin': 0x10800, 21701 'end': 0x1083F 21702 }, 21703 { 21704 'begin': 0x10A00, 21705 'end': 0x10A5F 21706 }, 21707 { 21708 'begin': 0x1D300, 21709 'end': 0x1D35F 21710 }, 21711 { 21712 'begin': 0x12000, 21713 'end': 0x123FF 21714 }, 21715 { 21716 'begin': 0x1D360, 21717 'end': 0x1D37F 21718 }, 21719 { 21720 'begin': 0x1B80, 21721 'end': 0x1BBF 21722 }, 21723 { 21724 'begin': 0x1C00, 21725 'end': 0x1C4F 21726 }, 21727 { 21728 'begin': 0x1C50, 21729 'end': 0x1C7F 21730 }, 21731 { 21732 'begin': 0xA880, 21733 'end': 0xA8DF 21734 }, 21735 { 21736 'begin': 0xA900, 21737 'end': 0xA92F 21738 }, 21739 { 21740 'begin': 0xA930, 21741 'end': 0xA95F 21742 }, 21743 { 21744 'begin': 0xAA00, 21745 'end': 0xAA5F 21746 }, 21747 { 21748 'begin': 0x10190, 21749 'end': 0x101CF 21750 }, 21751 { 21752 'begin': 0x101D0, 21753 'end': 0x101FF 21754 }, 21755 { 21756 'begin': 0x102A0, 21757 'end': 0x102DF 21758 }, 21759 { 21760 'begin': 0x1F030, 21761 'end': 0x1F09F 21762 } 21763 ]; 21764 function getUnicodeRangeFor(value) { 21765 for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) { 21766 var range = UnicodeRanges[i]; 21767 if (value >= range.begin && value < range.end) { 21768 return i; 21769 } 21770 } 21771 return -1; 21772 } 21773 function isRTLRangeFor(value) { 21774 var range = UnicodeRanges[13]; 21775 if (value >= range.begin && value < range.end) { 21776 return true; 21777 } 21778 range = UnicodeRanges[11]; 21779 if (value >= range.begin && value < range.end) { 21780 return true; 21781 } 21782 return false; 21783 } 21784 var getNormalizedUnicodes = getLookupTableFactory(function (t) { 21785 t['\u00A8'] = '\u0020\u0308'; 21786 t['\u00AF'] = '\u0020\u0304'; 21787 t['\u00B4'] = '\u0020\u0301'; 21788 t['\u00B5'] = '\u03BC'; 21789 t['\u00B8'] = '\u0020\u0327'; 21790 t['\u0132'] = '\u0049\u004A'; 21791 t['\u0133'] = '\u0069\u006A'; 21792 t['\u013F'] = '\u004C\u00B7'; 21793 t['\u0140'] = '\u006C\u00B7'; 21794 t['\u0149'] = '\u02BC\u006E'; 21795 t['\u017F'] = '\u0073'; 21796 t['\u01C4'] = '\u0044\u017D'; 21797 t['\u01C5'] = '\u0044\u017E'; 21798 t['\u01C6'] = '\u0064\u017E'; 21799 t['\u01C7'] = '\u004C\u004A'; 21800 t['\u01C8'] = '\u004C\u006A'; 21801 t['\u01C9'] = '\u006C\u006A'; 21802 t['\u01CA'] = '\u004E\u004A'; 21803 t['\u01CB'] = '\u004E\u006A'; 21804 t['\u01CC'] = '\u006E\u006A'; 21805 t['\u01F1'] = '\u0044\u005A'; 21806 t['\u01F2'] = '\u0044\u007A'; 21807 t['\u01F3'] = '\u0064\u007A'; 21808 t['\u02D8'] = '\u0020\u0306'; 21809 t['\u02D9'] = '\u0020\u0307'; 21810 t['\u02DA'] = '\u0020\u030A'; 21811 t['\u02DB'] = '\u0020\u0328'; 21812 t['\u02DC'] = '\u0020\u0303'; 21813 t['\u02DD'] = '\u0020\u030B'; 21814 t['\u037A'] = '\u0020\u0345'; 21815 t['\u0384'] = '\u0020\u0301'; 21816 t['\u03D0'] = '\u03B2'; 21817 t['\u03D1'] = '\u03B8'; 21818 t['\u03D2'] = '\u03A5'; 21819 t['\u03D5'] = '\u03C6'; 21820 t['\u03D6'] = '\u03C0'; 21821 t['\u03F0'] = '\u03BA'; 21822 t['\u03F1'] = '\u03C1'; 21823 t['\u03F2'] = '\u03C2'; 21824 t['\u03F4'] = '\u0398'; 21825 t['\u03F5'] = '\u03B5'; 21826 t['\u03F9'] = '\u03A3'; 21827 t['\u0587'] = '\u0565\u0582'; 21828 t['\u0675'] = '\u0627\u0674'; 21829 t['\u0676'] = '\u0648\u0674'; 21830 t['\u0677'] = '\u06C7\u0674'; 21831 t['\u0678'] = '\u064A\u0674'; 21832 t['\u0E33'] = '\u0E4D\u0E32'; 21833 t['\u0EB3'] = '\u0ECD\u0EB2'; 21834 t['\u0EDC'] = '\u0EAB\u0E99'; 21835 t['\u0EDD'] = '\u0EAB\u0EA1'; 21836 t['\u0F77'] = '\u0FB2\u0F81'; 21837 t['\u0F79'] = '\u0FB3\u0F81'; 21838 t['\u1E9A'] = '\u0061\u02BE'; 21839 t['\u1FBD'] = '\u0020\u0313'; 21840 t['\u1FBF'] = '\u0020\u0313'; 21841 t['\u1FC0'] = '\u0020\u0342'; 21842 t['\u1FFE'] = '\u0020\u0314'; 21843 t['\u2002'] = '\u0020'; 21844 t['\u2003'] = '\u0020'; 21845 t['\u2004'] = '\u0020'; 21846 t['\u2005'] = '\u0020'; 21847 t['\u2006'] = '\u0020'; 21848 t['\u2008'] = '\u0020'; 21849 t['\u2009'] = '\u0020'; 21850 t['\u200A'] = '\u0020'; 21851 t['\u2017'] = '\u0020\u0333'; 21852 t['\u2024'] = '\u002E'; 21853 t['\u2025'] = '\u002E\u002E'; 21854 t['\u2026'] = '\u002E\u002E\u002E'; 21855 t['\u2033'] = '\u2032\u2032'; 21856 t['\u2034'] = '\u2032\u2032\u2032'; 21857 t['\u2036'] = '\u2035\u2035'; 21858 t['\u2037'] = '\u2035\u2035\u2035'; 21859 t['\u203C'] = '\u0021\u0021'; 21860 t['\u203E'] = '\u0020\u0305'; 21861 t['\u2047'] = '\u003F\u003F'; 21862 t['\u2048'] = '\u003F\u0021'; 21863 t['\u2049'] = '\u0021\u003F'; 21864 t['\u2057'] = '\u2032\u2032\u2032\u2032'; 21865 t['\u205F'] = '\u0020'; 21866 t['\u20A8'] = '\u0052\u0073';
21867 t['\u2100'] = '\u0061\u002F\u0063'; 21868 t['\u2101'] = '\u0061\u002F\u0073'; 21869 t['\u2103'] = '\u00B0\u0043'; 21870 t['\u2105'] = '\u0063\u002F\u006F'; 21871 t['\u2106'] = '\u0063\u002F\u0075'; 21872 t['\u2107'] = '\u0190'; 21873 t['\u2109'] = '\u00B0\u0046'; 21874 t['\u2116'] = '\u004E\u006F'; 21875 t['\u2121'] = '\u0054\u0045\u004C'; 21876 t['\u2135'] = '\u05D0'; 21877 t['\u2136'] = '\u05D1'; 21878 t['\u2137'] = '\u05D2'; 21879 t['\u2138'] = '\u05D3'; 21880 t['\u213B'] = '\u0046\u0041\u0058'; 21881 t['\u2160'] = '\u0049'; 21882 t['\u2161'] = '\u0049\u0049'; 21883 t['\u2162'] = '\u0049\u0049\u0049'; 21884 t['\u2163'] = '\u0049\u0056'; 21885 t['\u2164'] = '\u0056'; 21886 t['\u2165'] = '\u0056\u0049'; 21887 t['\u2166'] = '\u0056\u0049\u0049'; 21888 t['\u2167'] = '\u0056\u0049\u0049\u0049'; 21889 t['\u2168'] = '\u0049\u0058'; 21890 t['\u2169'] = '\u0058'; 21891 t['\u216A'] = '\u0058\u0049'; 21892 t['\u216B'] = '\u0058\u0049\u0049'; 21893 t['\u216C'] = '\u004C'; 21894 t['\u216D'] = '\u0043'; 21895 t['\u216E'] = '\u0044'; 21896 t['\u216F'] = '\u004D'; 21897 t['\u2170'] = '\u0069'; 21898 t['\u2171'] = '\u0069\u0069'; 21899 t['\u2172'] = '\u0069\u0069\u0069'; 21900 t['\u2173'] = '\u0069\u0076'; 21901 t['\u2174'] = '\u0076'; 21902 t['\u2175'] = '\u0076\u0069'; 21903 t['\u2176'] = '\u0076\u0069\u0069'; 21904 t['\u2177'] = '\u0076\u0069\u0069\u0069'; 21905 t['\u2178'] = '\u0069\u0078'; 21906 t['\u2179'] = '\u0078'; 21907 t['\u217A'] = '\u0078\u0069'; 21908 t['\u217B'] = '\u0078\u0069\u0069'; 21909 t['\u217C'] = '\u006C'; 21910 t['\u217D'] = '\u0063'; 21911 t['\u217E'] = '\u0064'; 21912 t['\u217F'] = '\u006D'; 21913 t['\u222C'] = '\u222B\u222B'; 21914 t['\u222D'] = '\u222B\u222B\u222B'; 21915 t['\u222F'] = '\u222E\u222E'; 21916 t['\u2230'] = '\u222E\u222E\u222E'; 21917 t['\u2474'] = '\u0028\u0031\u0029'; 21918 t['\u2475'] = '\u0028\u0032\u0029'; 21919 t['\u2476'] = '\u0028\u0033\u0029'; 21920 t['\u2477'] = '\u0028\u0034\u0029'; 21921 t['\u2478'] = '\u0028\u0035\u0029'; 21922 t['\u2479'] = '\u0028\u0036\u0029'; 21923 t['\u247A'] = '\u0028\u0037\u0029'; 21924 t['\u247B'] = '\u0028\u0038\u0029'; 21925 t['\u247C'] = '\u0028\u0039\u0029'; 21926 t['\u247D'] = '\u0028\u0031\u0030\u0029'; 21927 t['\u247E'] = '\u0028\u0031\u0031\u0029'; 21928 t['\u247F'] = '\u0028\u0031\u0032\u0029'; 21929 t['\u2480'] = '\u0028\u0031\u0033\u0029'; 21930 t['\u2481'] = '\u0028\u0031\u0034\u0029'; 21931 t['\u2482'] = '\u0028\u0031\u0035\u0029'; 21932 t['\u2483'] = '\u0028\u0031\u0036\u0029'; 21933 t['\u2484'] = '\u0028\u0031\u0037\u0029'; 21934 t['\u2485'] = '\u0028\u0031\u0038\u0029'; 21935 t['\u2486'] = '\u0028\u0031\u0039\u0029'; 21936 t['\u2487'] = '\u0028\u0032\u0030\u0029'; 21937 t['\u2488'] = '\u0031\u002E'; 21938 t['\u2489'] = '\u0032\u002E'; 21939 t['\u248A'] = '\u0033\u002E'; 21940 t['\u248B'] = '\u0034\u002E'; 21941 t['\u248C'] = '\u0035\u002E'; 21942 t['\u248D'] = '\u0036\u002E'; 21943 t['\u248E'] = '\u0037\u002E'; 21944 t['\u248F'] = '\u0038\u002E'; 21945 t['\u2490'] = '\u0039\u002E'; 21946 t['\u2491'] = '\u0031\u0030\u002E'; 21947 t['\u2492'] = '\u0031\u0031\u002E'; 21948 t['\u2493'] = '\u0031\u0032\u002E'; 21949 t['\u2494'] = '\u0031\u0033\u002E'; 21950 t['\u2495'] = '\u0031\u0034\u002E'; 21951 t['\u2496'] = '\u0031\u0035\u002E'; 21952 t['\u2497'] = '\u0031\u0036\u002E'; 21953 t['\u2498'] = '\u0031\u0037\u002E'; 21954 t['\u2499'] = '\u0031\u0038\u002E'; 21955 t['\u249A'] = '\u0031\u0039\u002E'; 21956 t['\u249B'] = '\u0032\u0030\u002E'; 21957 t['\u249C'] = '\u0028\u0061\u0029'; 21958 t['\u249D'] = '\u0028\u0062\u0029'; 21959 t['\u249E'] = '\u0028\u0063\u0029'; 21960 t['\u249F'] = '\u0028\u0064\u0029'; 21961 t['\u24A0'] = '\u0028\u0065\u0029'; 21962 t['\u24A1'] = '\u0028\u0066\u0029'; 21963 t['\u24A2'] = '\u0028\u0067\u0029'; 21964 t['\u24A3'] = '\u0028\u0068\u0029'; 21965 t['\u24A4'] = '\u0028\u0069\u0029'; 21966 t['\u24A5'] = '\u0028\u006A\u0029'; 21967 t['\u24A6'] = '\u0028\u006B\u0029'; 21968 t['\u24A7'] = '\u0028\u006C\u0029'; 21969 t['\u24A8'] = '\u0028\u006D\u0029'; 21970 t['\u24A9'] = '\u0028\u006E\u0029'; 21971 t['\u24AA'] = '\u0028\u006F\u0029'; 21972 t['\u24AB'] = '\u0028\u0070\u0029'; 21973 t['\u24AC'] = '\u0028\u0071\u0029'; 21974 t['\u24AD'] = '\u0028\u0072\u0029'; 21975 t['\u24AE'] = '\u0028\u0073\u0029'; 21976 t['\u24AF'] = '\u0028\u0074\u0029'; 21977 t['\u24B0'] = '\u0028\u0075\u0029'; 21978 t['\u24B1'] = '\u0028\u0076\u0029'; 21979 t['\u24B2'] = '\u0028\u0077\u0029'; 21980 t['\u24B3'] = '\u0028\u0078\u0029'; 21981 t['\u24B4'] = '\u0028\u0079\u0029'; 21982 t['\u24B5'] = '\u0028\u007A\u0029'; 21983 t['\u2A0C'] = '\u222B\u222B\u222B\u222B'; 21984 t['\u2A74'] = '\u003A\u003A\u003D'; 21985 t['\u2A75'] = '\u003D\u003D'; 21986 t['\u2A76'] = '\u003D\u003D\u003D'; 21987 t['\u2E9F'] = '\u6BCD'; 21988 t['\u2EF3'] = '\u9F9F'; 21989 t['\u2F00'] = '\u4E00'; 21990 t['\u2F01'] = '\u4E28'; 21991 t['\u2F02'] = '\u4E36'; 21992 t['\u2F03'] = '\u4E3F'; 21993 t['\u2F04'] = '\u4E59'; 21994 t['\u2F05'] = '\u4E85'; 21995 t['\u2F06'] = '\u4E8C'; 21996 t['\u2F07'] = '\u4EA0'; 21997 t['\u2F08'] = '\u4EBA'; 21998 t['\u2F09'] = '\u513F'; 21999 t['\u2F0A'] = '\u5165'; 22000 t['\u2F0B'] = '\u516B';
22001 t['\u2F0C'] = '\u5182'; 22002 t['\u2F0D'] = '\u5196'; 22003 t['\u2F0E'] = '\u51AB'; 22004 t['\u2F0F'] = '\u51E0'; 22005 t['\u2F10'] = '\u51F5'; 22006 t['\u2F11'] = '\u5200'; 22007 t['\u2F12'] = '\u529B'; 22008 t['\u2F13'] = '\u52F9'; 22009 t['\u2F14'] = '\u5315'; 22010 t['\u2F15'] = '\u531A'; 22011 t['\u2F16'] = '\u5338'; 22012 t['\u2F17'] = '\u5341'; 22013 t['\u2F18'] = '\u535C'; 22014 t['\u2F19'] = '\u5369'; 22015 t['\u2F1A'] = '\u5382'; 22016 t['\u2F1B'] = '\u53B6'; 22017 t['\u2F1C'] = '\u53C8'; 22018 t['\u2F1D'] = '\u53E3'; 22019 t['\u2F1E'] = '\u56D7'; 22020 t['\u2F1F'] = '\u571F'; 22021 t['\u2F20'] = '\u58EB'; 22022 t['\u2F21'] = '\u5902'; 22023 t['\u2F22'] = '\u590A'; 22024 t['\u2F23'] = '\u5915'; 22025 t['\u2F24'] = '\u5927'; 22026 t['\u2F25'] = '\u5973'; 22027 t['\u2F26'] = '\u5B50'; 22028 t['\u2F27'] = '\u5B80'; 22029 t['\u2F28'] = '\u5BF8'; 22030 t['\u2F29'] = '\u5C0F'; 22031 t['\u2F2A'] = '\u5C22'; 22032 t['\u2F2B'] = '\u5C38'; 22033 t['\u2F2C'] = '\u5C6E'; 22034 t['\u2F2D'] = '\u5C71'; 22035 t['\u2F2E'] = '\u5DDB'; 22036 t['\u2F2F'] = '\u5DE5'; 22037 t['\u2F30'] = '\u5DF1'; 22038 t['\u2F31'] = '\u5DFE'; 22039 t['\u2F32'] = '\u5E72'; 22040 t['\u2F33'] = '\u5E7A'; 22041 t['\u2F34'] = '\u5E7F'; 22042 t['\u2F35'] = '\u5EF4'; 22043 t['\u2F36'] = '\u5EFE'; 22044 t['\u2F37'] = '\u5F0B'; 22045 t['\u2F38'] = '\u5F13'; 22046 t['\u2F39'] = '\u5F50'; 22047 t['\u2F3A'] = '\u5F61'; 22048 t['\u2F3B'] = '\u5F73'; 22049 t['\u2F3C'] = '\u5FC3'; 22050 t['\u2F3D'] = '\u6208'; 22051 t['\u2F3E'] = '\u6236'; 22052 t['\u2F3F'] = '\u624B'; 22053 t['\u2F40'] = '\u652F'; 22054 t['\u2F41'] = '\u6534'; 22055 t['\u2F42'] = '\u6587'; 22056 t['\u2F43'] = '\u6597'; 22057 t['\u2F44'] = '\u65A4'; 22058 t['\u2F45'] = '\u65B9'; 22059 t['\u2F46'] = '\u65E0'; 22060 t['\u2F47'] = '\u65E5'; 22061 t['\u2F48'] = '\u66F0'; 22062 t['\u2F49'] = '\u6708'; 22063 t['\u2F4A'] = '\u6728'; 22064 t['\u2F4B'] = '\u6B20'; 22065 t['\u2F4C'] = '\u6B62'; 22066 t['\u2F4D'] = '\u6B79'; 22067 t['\u2F4E'] = '\u6BB3'; 22068 t['\u2F4F'] = '\u6BCB'; 22069 t['\u2F50'] = '\u6BD4'; 22070 t['\u2F51'] = '\u6BDB'; 22071 t['\u2F52'] = '\u6C0F'; 22072 t['\u2F53'] = '\u6C14'; 22073 t['\u2F54'] = '\u6C34'; 22074 t['\u2F55'] = '\u706B'; 22075 t['\u2F56'] = '\u722A'; 22076 t['\u2F57'] = '\u7236'; 22077 t['\u2F58'] = '\u723B'; 22078 t['\u2F59'] = '\u723F'; 22079 t['\u2F5A'] = '\u7247'; 22080 t['\u2F5B'] = '\u7259'; 22081 t['\u2F5C'] = '\u725B'; 22082 t['\u2F5D'] = '\u72AC'; 22083 t['\u2F5E'] = '\u7384'; 22084 t['\u2F5F'] = '\u7389'; 22085 t['\u2F60'] = '\u74DC'; 22086 t['\u2F61'] = '\u74E6'; 22087 t['\u2F62'] = '\u7518'; 22088 t['\u2F63'] = '\u751F'; 22089 t['\u2F64'] = '\u7528'; 22090 t['\u2F65'] = '\u7530'; 22091 t['\u2F66'] = '\u758B'; 22092 t['\u2F67'] = '\u7592'; 22093 t['\u2F68'] = '\u7676'; 22094 t['\u2F69'] = '\u767D'; 22095 t['\u2F6A'] = '\u76AE'; 22096 t['\u2F6B'] = '\u76BF'; 22097 t['\u2F6C'] = '\u76EE'; 22098 t['\u2F6D'] = '\u77DB'; 22099 t['\u2F6E'] = '\u77E2'; 22100 t['\u2F6F'] = '\u77F3'; 22101 t['\u2F70'] = '\u793A'; 22102 t['\u2F71'] = '\u79B8'; 22103 t['\u2F72'] = '\u79BE'; 22104 t['\u2F73'] = '\u7A74'; 22105 t['\u2F74'] = '\u7ACB'; 22106 t['\u2F75'] = '\u7AF9'; 22107 t['\u2F76'] = '\u7C73'; 22108 t['\u2F77'] = '\u7CF8'; 22109 t['\u2F78'] = '\u7F36'; 22110 t['\u2F79'] = '\u7F51'; 22111 t['\u2F7A'] = '\u7F8A'; 22112 t['\u2F7B'] = '\u7FBD'; 22113 t['\u2F7C'] = '\u8001'; 22114 t['\u2F7D'] = '\u800C'; 22115 t['\u2F7E'] = '\u8012'; 22116 t['\u2F7F'] = '\u8033'; 22117 t['\u2F80'] = '\u807F'; 22118 t['\u2F81'] = '\u8089'; 22119 t['\u2F82'] = '\u81E3'; 22120 t['\u2F83'] = '\u81EA'; 22121 t['\u2F84'] = '\u81F3'; 22122 t['\u2F85'] = '\u81FC'; 22123 t['\u2F86'] = '\u820C'; 22124 t['\u2F87'] = '\u821B'; 22125 t['\u2F88'] = '\u821F'; 22126 t['\u2F89'] = '\u826E'; 22127 t['\u2F8A'] = '\u8272'; 22128 t['\u2F8B'] = '\u8278'; 22129 t['\u2F8C'] = '\u864D'; 22130 t['\u2F8D'] = '\u866B'; 22131 t['\u2F8E'] = '\u8840'; 22132 t['\u2F8F'] = '\u884C'; 22133 t['\u2F90'] = '\u8863'; 22134 t['\u2F91'] = '\u897E'; 22135 t['\u2F92'] = '\u898B'; 22136 t['\u2F93'] = '\u89D2'; 22137 t['\u2F94'] = '\u8A00'; 22138 t['\u2F95'] = '\u8C37'; 22139 t['\u2F96'] = '\u8C46'; 22140 t['\u2F97'] = '\u8C55'; 22141 t['\u2F98'] = '\u8C78'; 22142 t['\u2F99'] = '\u8C9D'; 22143 t['\u2F9A'] = '\u8D64'; 22144 t['\u2F9B'] = '\u8D70'; 22145 t['\u2F9C'] = '\u8DB3'; 22146 t['\u2F9D'] = '\u8EAB'; 22147 t['\u2F9E'] = '\u8ECA'; 22148 t['\u2F9F'] = '\u8F9B'; 22149 t['\u2FA0'] = '\u8FB0'; 22150 t['\u2FA1'] = '\u8FB5'; 22151 t['\u2FA2'] = '\u9091'; 22152 t['\u2FA3'] = '\u9149'; 22153 t['\u2FA4'] = '\u91C6'; 22154 t['\u2FA5'] = '\u91CC'; 22155 t['\u2FA6'] = '\u91D1'; 22156 t['\u2FA7'] = '\u9577'; 22157 t['\u2FA8'] = '\u9580'; 22158 t['\u2FA9'] = '\u961C'; 22159 t['\u2FAA'] = '\u96B6'; 22160 t['\u2FAB'] = '\u96B9'; 22161 t['\u2FAC'] = '\u96E8'; 22162 t['\u2FAD'] = '\u9751'; 22163 t['\u2FAE'] = '\u975E'; 22164 t['\u2FAF'] = '\u9762'; 22165 t['\u2FB0'] = '\u9769'; 22166 t['\u2FB1'] = '\u97CB'; 22167 t['\u2FB2'] = '\u97ED'; 22168 t['\u2FB3'] = '\u97F3'; 22169 t['\u2FB4'] = '\u9801'; 22170 t['\u2FB5'] = '\u98A8'; 22171 t['\u2FB6'] = '\u98DB'; 22172 t['\u2FB7'] = '\u98DF'; 22173 t['\u2FB8'] = '\u9996'; 22174 t['\u2FB9'] = '\u9999'; 22175 t['\u2FBA'] = '\u99AC'; 22176 t['\u2FBB'] = '\u9AA8'; 22177 t['\u2FBC'] = '\u9AD8'; 22178 t['\u2FBD'] = '\u9ADF'; 22179 t['\u2FBE'] = '\u9B25'; 22180 t['\u2FBF'] = '\u9B2F'; 22181 t['\u2FC0'] = '\u9B32'; 22182 t['\u2FC1'] = '\u9B3C';
22183 t['\u2FC2'] = '\u9B5A'; 22184 t['\u2FC3'] = '\u9CE5'; 22185 t['\u2FC4'] = '\u9E75'; 22186 t['\u2FC5'] = '\u9E7F'; 22187 t['\u2FC6'] = '\u9EA5'; 22188 t['\u2FC7'] = '\u9EBB'; 22189 t['\u2FC8'] = '\u9EC3'; 22190 t['\u2FC9'] = '\u9ECD'; 22191 t['\u2FCA'] = '\u9ED1'; 22192 t['\u2FCB'] = '\u9EF9'; 22193 t['\u2FCC'] = '\u9EFD'; 22194 t['\u2FCD'] = '\u9F0E'; 22195 t['\u2FCE'] = '\u9F13'; 22196 t['\u2FCF'] = '\u9F20'; 22197 t['\u2FD0'] = '\u9F3B'; 22198 t['\u2FD1'] = '\u9F4A'; 22199 t['\u2FD2'] = '\u9F52'; 22200 t['\u2FD3'] = '\u9F8D'; 22201 t['\u2FD4'] = '\u9F9C'; 22202 t['\u2FD5'] = '\u9FA0'; 22203 t['\u3036'] = '\u3012'; 22204 t['\u3038'] = '\u5341'; 22205 t['\u3039'] = '\u5344'; 22206 t['\u303A'] = '\u5345'; 22207 t['\u309B'] = '\u0020\u3099'; 22208 t['\u309C'] = '\u0020\u309A'; 22209 t['\u3131'] = '\u1100'; 22210 t['\u3132'] = '\u1101'; 22211 t['\u3133'] = '\u11AA'; 22212 t['\u3134'] = '\u1102'; 22213 t['\u3135'] = '\u11AC'; 22214 t['\u3136'] = '\u11AD'; 22215 t['\u3137'] = '\u1103'; 22216 t['\u3138'] = '\u1104'; 22217 t['\u3139'] = '\u1105'; 22218 t['\u313A'] = '\u11B0'; 22219 t['\u313B'] = '\u11B1'; 22220 t['\u313C'] = '\u11B2'; 22221 t['\u313D'] = '\u11B3'; 22222 t['\u313E'] = '\u11B4'; 22223 t['\u313F'] = '\u11B5'; 22224 t['\u3140'] = '\u111A'; 22225 t['\u3141'] = '\u1106'; 22226 t['\u3142'] = '\u1107'; 22227 t['\u3143'] = '\u1108'; 22228 t['\u3144'] = '\u1121'; 22229 t['\u3145'] = '\u1109'; 22230 t['\u3146'] = '\u110A'; 22231 t['\u3147'] = '\u110B'; 22232 t['\u3148'] = '\u110C'; 22233 t['\u3149'] = '\u110D'; 22234 t['\u314A'] = '\u110E'; 22235 t['\u314B'] = '\u110F'; 22236 t['\u314C'] = '\u1110'; 22237 t['\u314D'] = '\u1111'; 22238 t['\u314E'] = '\u1112'; 22239 t['\u314F'] = '\u1161'; 22240 t['\u3150'] = '\u1162'; 22241 t['\u3151'] = '\u1163'; 22242 t['\u3152'] = '\u1164'; 22243 t['\u3153'] = '\u1165'; 22244 t['\u3154'] = '\u1166'; 22245 t['\u3155'] = '\u1167'; 22246 t['\u3156'] = '\u1168'; 22247 t['\u3157'] = '\u1169'; 22248 t['\u3158'] = '\u116A'; 22249 t['\u3159'] = '\u116B'; 22250 t['\u315A'] = '\u116C'; 22251 t['\u315B'] = '\u116D'; 22252 t['\u315C'] = '\u116E'; 22253 t['\u315D'] = '\u116F'; 22254 t['\u315E'] = '\u1170'; 22255 t['\u315F'] = '\u1171'; 22256 t['\u3160'] = '\u1172'; 22257 t['\u3161'] = '\u1173'; 22258 t['\u3162'] = '\u1174'; 22259 t['\u3163'] = '\u1175'; 22260 t['\u3164'] = '\u1160'; 22261 t['\u3165'] = '\u1114'; 22262 t['\u3166'] = '\u1115'; 22263 t['\u3167'] = '\u11C7'; 22264 t['\u3168'] = '\u11C8'; 22265 t['\u3169'] = '\u11CC'; 22266 t['\u316A'] = '\u11CE'; 22267 t['\u316B'] = '\u11D3'; 22268 t['\u316C'] = '\u11D7'; 22269 t['\u316D'] = '\u11D9'; 22270 t['\u316E'] = '\u111C'; 22271 t['\u316F'] = '\u11DD'; 22272 t['\u3170'] = '\u11DF'; 22273 t['\u3171'] = '\u111D'; 22274 t['\u3172'] = '\u111E'; 22275 t['\u3173'] = '\u1120'; 22276 t['\u3174'] = '\u1122'; 22277 t['\u3175'] = '\u1123'; 22278 t['\u3176'] = '\u1127'; 22279 t['\u3177'] = '\u1129'; 22280 t['\u3178'] = '\u112B'; 22281 t['\u3179'] = '\u112C'; 22282 t['\u317A'] = '\u112D'; 22283 t['\u317B'] = '\u112E'; 22284 t['\u317C'] = '\u112F'; 22285 t['\u317D'] = '\u1132'; 22286 t['\u317E'] = '\u1136'; 22287 t['\u317F'] = '\u1140'; 22288 t['\u3180'] = '\u1147'; 22289 t['\u3181'] = '\u114C'; 22290 t['\u3182'] = '\u11F1'; 22291 t['\u3183'] = '\u11F2'; 22292 t['\u3184'] = '\u1157'; 22293 t['\u3185'] = '\u1158'; 22294 t['\u3186'] = '\u1159'; 22295 t['\u3187'] = '\u1184'; 22296 t['\u3188'] = '\u1185'; 22297 t['\u3189'] = '\u1188'; 22298 t['\u318A'] = '\u1191'; 22299 t['\u318B'] = '\u1192'; 22300 t['\u318C'] = '\u1194'; 22301 t['\u318D'] = '\u119E'; 22302 t['\u318E'] = '\u11A1'; 22303 t['\u3200'] = '\u0028\u1100\u0029'; 22304 t['\u3201'] = '\u0028\u1102\u0029'; 22305 t['\u3202'] = '\u0028\u1103\u0029'; 22306 t['\u3203'] = '\u0028\u1105\u0029'; 22307 t['\u3204'] = '\u0028\u1106\u0029'; 22308 t['\u3205'] = '\u0028\u1107\u0029'; 22309 t['\u3206'] = '\u0028\u1109\u0029'; 22310 t['\u3207'] = '\u0028\u110B\u0029'; 22311 t['\u3208'] = '\u0028\u110C\u0029'; 22312 t['\u3209'] = '\u0028\u110E\u0029'; 22313 t['\u320A'] = '\u0028\u110F\u0029'; 22314 t['\u320B'] = '\u0028\u1110\u0029'; 22315 t['\u320C'] = '\u0028\u1111\u0029'; 22316 t['\u320D'] = '\u0028\u1112\u0029'; 22317 t['\u320E'] = '\u0028\u1100\u1161\u0029'; 22318 t['\u320F'] = '\u0028\u1102\u1161\u0029'; 22319 t['\u3210'] = '\u0028\u1103\u1161\u0029'; 22320 t['\u3211'] = '\u0028\u1105\u1161\u0029'; 22321 t['\u3212'] = '\u0028\u1106\u1161\u0029'; 22322 t['\u3213'] = '\u0028\u1107\u1161\u0029'; 22323 t['\u3214'] = '\u0028\u1109\u1161\u0029'; 22324 t['\u3215'] = '\u0028\u110B\u1161\u0029'; 22325 t['\u3216'] = '\u0028\u110C\u1161\u0029'; 22326 t['\u3217'] = '\u0028\u110E\u1161\u0029'; 22327 t['\u3218'] = '\u0028\u110F\u1161\u0029'; 22328 t['\u3219'] = '\u0028\u1110\u1161\u0029'; 22329 t['\u321A'] = '\u0028\u1111\u1161\u0029'; 22330 t['\u321B'] = '\u0028\u1112\u1161\u0029'; 22331 t['\u321C'] = '\u0028\u110C\u116E\u0029'; 22332 t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029'; 22333 t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029'; 22334 t['\u3220'] = '\u0028\u4E00\u0029'; 22335 t['\u3221'] = '\u0028\u4E8C\u0029'; 22336 t['\u3222'] = '\u0028\u4E09\u0029'; 22337 t['\u3223'] = '\u0028\u56DB\u0029'; 22338 t['\u3224'] = '\u0028\u4E94\u0029'; 22339 t['\u3225'] = '\u0028\u516D\u0029'; 22340 t['\u3226'] = '\u0028\u4E03\u0029'; 22341 t['\u3227'] = '\u0028\u516B\u0029'; 22342 t['\u3228'] = '\u0028\u4E5D\u0029'; 22343 t['\u3229'] = '\u0028\u5341\u0029'; 22344 t['\u322A'] = '\u0028\u6708\u0029'; 22345 t['\u322B'] = '\u0028\u706B\u0029'; 22346 t['\u322C'] = '\u0028\u6C34\u0029'; 22347 t['\u322D'] = '\u0028\u6728\u0029'; 22348 t['\u322E'] = '\u0028\u91D1\u0029';
22349 t['\u322F'] = '\u0028\u571F\u0029'; 22350 t['\u3230'] = '\u0028\u65E5\u0029'; 22351 t['\u3231'] = '\u0028\u682A\u0029'; 22352 t['\u3232'] = '\u0028\u6709\u0029'; 22353 t['\u3233'] = '\u0028\u793E\u0029'; 22354 t['\u3234'] = '\u0028\u540D\u0029'; 22355 t['\u3235'] = '\u0028\u7279\u0029'; 22356 t['\u3236'] = '\u0028\u8CA1\u0029'; 22357 t['\u3237'] = '\u0028\u795D\u0029'; 22358 t['\u3238'] = '\u0028\u52B4\u0029'; 22359 t['\u3239'] = '\u0028\u4EE3\u0029'; 22360 t['\u323A'] = '\u0028\u547C\u0029'; 22361 t['\u323B'] = '\u0028\u5B66\u0029'; 22362 t['\u323C'] = '\u0028\u76E3\u0029'; 22363 t['\u323D'] = '\u0028\u4F01\u0029'; 22364 t['\u323E'] = '\u0028\u8CC7\u0029'; 22365 t['\u323F'] = '\u0028\u5354\u0029'; 22366 t['\u3240'] = '\u0028\u796D\u0029'; 22367 t['\u3241'] = '\u0028\u4F11\u0029'; 22368 t['\u3242'] = '\u0028\u81EA\u0029'; 22369 t['\u3243'] = '\u0028\u81F3\u0029'; 22370 t['\u32C0'] = '\u0031\u6708'; 22371 t['\u32C1'] = '\u0032\u6708'; 22372 t['\u32C2'] = '\u0033\u6708'; 22373 t['\u32C3'] = '\u0034\u6708'; 22374 t['\u32C4'] = '\u0035\u6708'; 22375 t['\u32C5'] = '\u0036\u6708'; 22376 t['\u32C6'] = '\u0037\u6708'; 22377 t['\u32C7'] = '\u0038\u6708'; 22378 t['\u32C8'] = '\u0039\u6708'; 22379 t['\u32C9'] = '\u0031\u0030\u6708'; 22380 t['\u32CA'] = '\u0031\u0031\u6708'; 22381 t['\u32CB'] = '\u0031\u0032\u6708'; 22382 t['\u3358'] = '\u0030\u70B9'; 22383 t['\u3359'] = '\u0031\u70B9'; 22384 t['\u335A'] = '\u0032\u70B9'; 22385 t['\u335B'] = '\u0033\u70B9'; 22386 t['\u335C'] = '\u0034\u70B9'; 22387 t['\u335D'] = '\u0035\u70B9'; 22388 t['\u335E'] = '\u0036\u70B9'; 22389 t['\u335F'] = '\u0037\u70B9'; 22390 t['\u3360'] = '\u0038\u70B9'; 22391 t['\u3361'] = '\u0039\u70B9'; 22392 t['\u3362'] = '\u0031\u0030\u70B9'; 22393 t['\u3363'] = '\u0031\u0031\u70B9'; 22394 t['\u3364'] = '\u0031\u0032\u70B9'; 22395 t['\u3365'] = '\u0031\u0033\u70B9'; 22396 t['\u3366'] = '\u0031\u0034\u70B9'; 22397 t['\u3367'] = '\u0031\u0035\u70B9'; 22398 t['\u3368'] = '\u0031\u0036\u70B9'; 22399 t['\u3369'] = '\u0031\u0037\u70B9'; 22400 t['\u336A'] = '\u0031\u0038\u70B9'; 22401 t['\u336B'] = '\u0031\u0039\u70B9'; 22402 t['\u336C'] = '\u0032\u0030\u70B9'; 22403 t['\u336D'] = '\u0032\u0031\u70B9'; 22404 t['\u336E'] = '\u0032\u0032\u70B9'; 22405 t['\u336F'] = '\u0032\u0033\u70B9'; 22406 t['\u3370'] = '\u0032\u0034\u70B9'; 22407 t['\u33E0'] = '\u0031\u65E5'; 22408 t['\u33E1'] = '\u0032\u65E5'; 22409 t['\u33E2'] = '\u0033\u65E5'; 22410 t['\u33E3'] = '\u0034\u65E5'; 22411 t['\u33E4'] = '\u0035\u65E5'; 22412 t['\u33E5'] = '\u0036\u65E5'; 22413 t['\u33E6'] = '\u0037\u65E5'; 22414 t['\u33E7'] = '\u0038\u65E5'; 22415 t['\u33E8'] = '\u0039\u65E5'; 22416 t['\u33E9'] = '\u0031\u0030\u65E5'; 22417 t['\u33EA'] = '\u0031\u0031\u65E5'; 22418 t['\u33EB'] = '\u0031\u0032\u65E5'; 22419 t['\u33EC'] = '\u0031\u0033\u65E5'; 22420 t['\u33ED'] = '\u0031\u0034\u65E5'; 22421 t['\u33EE'] = '\u0031\u0035\u65E5'; 22422 t['\u33EF'] = '\u0031\u0036\u65E5'; 22423 t['\u33F0'] = '\u0031\u0037\u65E5'; 22424 t['\u33F1'] = '\u0031\u0038\u65E5'; 22425 t['\u33F2'] = '\u0031\u0039\u65E5'; 22426 t['\u33F3'] = '\u0032\u0030\u65E5'; 22427 t['\u33F4'] = '\u0032\u0031\u65E5'; 22428 t['\u33F5'] = '\u0032\u0032\u65E5'; 22429 t['\u33F6'] = '\u0032\u0033\u65E5'; 22430 t['\u33F7'] = '\u0032\u0034\u65E5'; 22431 t['\u33F8'] = '\u0032\u0035\u65E5'; 22432 t['\u33F9'] = '\u0032\u0036\u65E5'; 22433 t['\u33FA'] = '\u0032\u0037\u65E5'; 22434 t['\u33FB'] = '\u0032\u0038\u65E5'; 22435 t['\u33FC'] = '\u0032\u0039\u65E5'; 22436 t['\u33FD'] = '\u0033\u0030\u65E5'; 22437 t['\u33FE'] = '\u0033\u0031\u65E5'; 22438 t['\uFB00'] = '\u0066\u0066'; 22439 t['\uFB01'] = '\u0066\u0069'; 22440 t['\uFB02'] = '\u0066\u006C'; 22441 t['\uFB03'] = '\u0066\u0066\u0069'; 22442 t['\uFB04'] = '\u0066\u0066\u006C'; 22443 t['\uFB05'] = '\u017F\u0074'; 22444 t['\uFB06'] = '\u0073\u0074'; 22445 t['\uFB13'] = '\u0574\u0576'; 22446 t['\uFB14'] = '\u0574\u0565'; 22447 t['\uFB15'] = '\u0574\u056B'; 22448 t['\uFB16'] = '\u057E\u0576'; 22449 t['\uFB17'] = '\u0574\u056D'; 22450 t['\uFB4F'] = '\u05D0\u05DC'; 22451 t['\uFB50'] = '\u0671'; 22452 t['\uFB51'] = '\u0671'; 22453 t['\uFB52'] = '\u067B'; 22454 t['\uFB53'] = '\u067B'; 22455 t['\uFB54'] = '\u067B'; 22456 t['\uFB55'] = '\u067B'; 22457 t['\uFB56'] = '\u067E'; 22458 t['\uFB57'] = '\u067E'; 22459 t['\uFB58'] = '\u067E'; 22460 t['\uFB59'] = '\u067E'; 22461 t['\uFB5A'] = '\u0680'; 22462 t['\uFB5B'] = '\u0680'; 22463 t['\uFB5C'] = '\u0680'; 22464 t['\uFB5D'] = '\u0680'; 22465 t['\uFB5E'] = '\u067A'; 22466 t['\uFB5F'] = '\u067A'; 22467 t['\uFB60'] = '\u067A';
22468 t['\uFB61'] = '\u067A'; 22469 t['\uFB62'] = '\u067F'; 22470 t['\uFB63'] = '\u067F'; 22471 t['\uFB64'] = '\u067F'; 22472 t['\uFB65'] = '\u067F'; 22473 t['\uFB66'] = '\u0679'; 22474 t['\uFB67'] = '\u0679'; 22475 t['\uFB68'] = '\u0679'; 22476 t['\uFB69'] = '\u0679'; 22477 t['\uFB6A'] = '\u06A4'; 22478 t['\uFB6B'] = '\u06A4'; 22479 t['\uFB6C'] = '\u06A4'; 22480 t['\uFB6D'] = '\u06A4'; 22481 t['\uFB6E'] = '\u06A6'; 22482 t['\uFB6F'] = '\u06A6'; 22483 t['\uFB70'] = '\u06A6'; 22484 t['\uFB71'] = '\u06A6'; 22485 t['\uFB72'] = '\u0684'; 22486 t['\uFB73'] = '\u0684'; 22487 t['\uFB74'] = '\u0684'; 22488 t['\uFB75'] = '\u0684'; 22489 t['\uFB76'] = '\u0683'; 22490 t['\uFB77'] = '\u0683'; 22491 t['\uFB78'] = '\u0683'; 22492 t['\uFB79'] = '\u0683'; 22493 t['\uFB7A'] = '\u0686'; 22494 t['\uFB7B'] = '\u0686'; 22495 t['\uFB7C'] = '\u0686'; 22496 t['\uFB7D'] = '\u0686'; 22497 t['\uFB7E'] = '\u0687'; 22498 t['\uFB7F'] = '\u0687'; 22499 t['\uFB80'] = '\u0687'; 22500 t['\uFB81'] = '\u0687'; 22501 t['\uFB82'] = '\u068D'; 22502 t['\uFB83'] = '\u068D'; 22503 t['\uFB84'] = '\u068C'; 22504 t['\uFB85'] = '\u068C'; 22505 t['\uFB86'] = '\u068E'; 22506 t['\uFB87'] = '\u068E'; 22507 t['\uFB88'] = '\u0688'; 22508 t['\uFB89'] = '\u0688'; 22509 t['\uFB8A'] = '\u0698'; 22510 t['\uFB8B'] = '\u0698'; 22511 t['\uFB8C'] = '\u0691'; 22512 t['\uFB8D'] = '\u0691'; 22513 t['\uFB8E'] = '\u06A9'; 22514 t['\uFB8F'] = '\u06A9'; 22515 t['\uFB90'] = '\u06A9'; 22516 t['\uFB91'] = '\u06A9'; 22517 t['\uFB92'] = '\u06AF'; 22518 t['\uFB93'] = '\u06AF'; 22519 t['\uFB94'] = '\u06AF'; 22520 t['\uFB95'] = '\u06AF'; 22521 t['\uFB96'] = '\u06B3'; 22522 t['\uFB97'] = '\u06B3'; 22523 t['\uFB98'] = '\u06B3'; 22524 t['\uFB99'] = '\u06B3'; 22525 t['\uFB9A'] = '\u06B1'; 22526 t['\uFB9B'] = '\u06B1'; 22527 t['\uFB9C'] = '\u06B1'; 22528 t['\uFB9D'] = '\u06B1'; 22529 t['\uFB9E'] = '\u06BA'; 22530 t['\uFB9F'] = '\u06BA'; 22531 t['\uFBA0'] = '\u06BB'; 22532 t['\uFBA1'] = '\u06BB'; 22533 t['\uFBA2'] = '\u06BB'; 22534 t['\uFBA3'] = '\u06BB'; 22535 t['\uFBA4'] = '\u06C0'; 22536 t['\uFBA5'] = '\u06C0'; 22537 t['\uFBA6'] = '\u06C1'; 22538 t['\uFBA7'] = '\u06C1'; 22539 t['\uFBA8'] = '\u06C1'; 22540 t['\uFBA9'] = '\u06C1'; 22541 t['\uFBAA'] = '\u06BE'; 22542 t['\uFBAB'] = '\u06BE'; 22543 t['\uFBAC'] = '\u06BE'; 22544 t['\uFBAD'] = '\u06BE'; 22545 t['\uFBAE'] = '\u06D2'; 22546 t['\uFBAF'] = '\u06D2'; 22547 t['\uFBB0'] = '\u06D3'; 22548 t['\uFBB1'] = '\u06D3'; 22549 t['\uFBD3'] = '\u06AD'; 22550 t['\uFBD4'] = '\u06AD'; 22551 t['\uFBD5'] = '\u06AD'; 22552 t['\uFBD6'] = '\u06AD'; 22553 t['\uFBD7'] = '\u06C7'; 22554 t['\uFBD8'] = '\u06C7'; 22555 t['\uFBD9'] = '\u06C6'; 22556 t['\uFBDA'] = '\u06C6'; 22557 t['\uFBDB'] = '\u06C8'; 22558 t['\uFBDC'] = '\u06C8'; 22559 t['\uFBDD'] = '\u0677'; 22560 t['\uFBDE'] = '\u06CB'; 22561 t['\uFBDF'] = '\u06CB'; 22562 t['\uFBE0'] = '\u06C5'; 22563 t['\uFBE1'] = '\u06C5'; 22564 t['\uFBE2'] = '\u06C9'; 22565 t['\uFBE3'] = '\u06C9'; 22566 t['\uFBE4'] = '\u06D0'; 22567 t['\uFBE5'] = '\u06D0'; 22568 t['\uFBE6'] = '\u06D0'; 22569 t['\uFBE7'] = '\u06D0'; 22570 t['\uFBE8'] = '\u0649'; 22571 t['\uFBE9'] = '\u0649'; 22572 t['\uFBEA'] = '\u0626\u0627'; 22573 t['\uFBEB'] = '\u0626\u0627'; 22574 t['\uFBEC'] = '\u0626\u06D5'; 22575 t['\uFBED'] = '\u0626\u06D5'; 22576 t['\uFBEE'] = '\u0626\u0648'; 22577 t['\uFBEF'] = '\u0626\u0648'; 22578 t['\uFBF0'] = '\u0626\u06C7'; 22579 t['\uFBF1'] = '\u0626\u06C7'; 22580 t['\uFBF2'] = '\u0626\u06C6'; 22581 t['\uFBF3'] = '\u0626\u06C6'; 22582 t['\uFBF4'] = '\u0626\u06C8'; 22583 t['\uFBF5'] = '\u0626\u06C8'; 22584 t['\uFBF6'] = '\u0626\u06D0'; 22585 t['\uFBF7'] = '\u0626\u06D0'; 22586 t['\uFBF8'] = '\u0626\u06D0'; 22587 t['\uFBF9'] = '\u0626\u0649'; 22588 t['\uFBFA'] = '\u0626\u0649'; 22589 t['\uFBFB'] = '\u0626\u0649'; 22590 t['\uFBFC'] = '\u06CC'; 22591 t['\uFBFD'] = '\u06CC'; 22592 t['\uFBFE'] = '\u06CC'; 22593 t['\uFBFF'] = '\u06CC'; 22594 t['\uFC00'] = '\u0626\u062C'; 22595 t['\uFC01'] = '\u0626\u062D'; 22596 t['\uFC02'] = '\u0626\u0645'; 22597 t['\uFC03'] = '\u0626\u0649'; 22598 t['\uFC04'] = '\u0626\u064A'; 22599 t['\uFC05'] = '\u0628\u062C'; 22600 t['\uFC06'] = '\u0628\u062D'; 22601 t['\uFC07'] = '\u0628\u062E'; 22602 t['\uFC08'] = '\u0628\u0645'; 22603 t['\uFC09'] = '\u0628\u0649'; 22604 t['\uFC0A'] = '\u0628\u064A'; 22605 t['\uFC0B'] = '\u062A\u062C'; 22606 t['\uFC0C'] = '\u062A\u062D'; 22607 t['\uFC0D'] = '\u062A\u062E'; 22608 t['\uFC0E'] = '\u062A\u0645'; 22609 t['\uFC0F'] = '\u062A\u0649'; 22610 t['\uFC10'] = '\u062A\u064A'; 22611 t['\uFC11'] = '\u062B\u062C'; 22612 t['\uFC12'] = '\u062B\u0645'; 22613 t['\uFC13'] = '\u062B\u0649'; 22614 t['\uFC14'] = '\u062B\u064A'; 22615 t['\uFC15'] = '\u062C\u062D'; 22616 t['\uFC16'] = '\u062C\u0645'; 22617 t['\uFC17'] = '\u062D\u062C'; 22618 t['\uFC18'] = '\u062D\u0645'; 22619 t['\uFC19'] = '\u062E\u062C'; 22620 t['\uFC1A'] = '\u062E\u062D'; 22621 t['\uFC1B'] = '\u062E\u0645';
22622 t['\uFC1C'] = '\u0633\u062C'; 22623 t['\uFC1D'] = '\u0633\u062D'; 22624 t['\uFC1E'] = '\u0633\u062E'; 22625 t['\uFC1F'] = '\u0633\u0645'; 22626 t['\uFC20'] = '\u0635\u062D'; 22627 t['\uFC21'] = '\u0635\u0645'; 22628 t['\uFC22'] = '\u0636\u062C'; 22629 t['\uFC23'] = '\u0636\u062D'; 22630 t['\uFC24'] = '\u0636\u062E'; 22631 t['\uFC25'] = '\u0636\u0645'; 22632 t['\uFC26'] = '\u0637\u062D'; 22633 t['\uFC27'] = '\u0637\u0645'; 22634 t['\uFC28'] = '\u0638\u0645'; 22635 t['\uFC29'] = '\u0639\u062C'; 22636 t['\uFC2A'] = '\u0639\u0645'; 22637 t['\uFC2B'] = '\u063A\u062C'; 22638 t['\uFC2C'] = '\u063A\u0645'; 22639 t['\uFC2D'] = '\u0641\u062C'; 22640 t['\uFC2E'] = '\u0641\u062D'; 22641 t['\uFC2F'] = '\u0641\u062E'; 22642 t['\uFC30'] = '\u0641\u0645'; 22643 t['\uFC31'] = '\u0641\u0649'; 22644 t['\uFC32'] = '\u0641\u064A'; 22645 t['\uFC33'] = '\u0642\u062D'; 22646 t['\uFC34'] = '\u0642\u0645'; 22647 t['\uFC35'] = '\u0642\u0649'; 22648 t['\uFC36'] = '\u0642\u064A'; 22649 t['\uFC37'] = '\u0643\u0627'; 22650 t['\uFC38'] = '\u0643\u062C'; 22651 t['\uFC39'] = '\u0643\u062D'; 22652 t['\uFC3A'] = '\u0643\u062E'; 22653 t['\uFC3B'] = '\u0643\u0644'; 22654 t['\uFC3C'] = '\u0643\u0645'; 22655 t['\uFC3D'] = '\u0643\u0649'; 22656 t['\uFC3E'] = '\u0643\u064A'; 22657 t['\uFC3F'] = '\u0644\u062C'; 22658 t['\uFC40'] = '\u0644\u062D'; 22659 t['\uFC41'] = '\u0644\u062E'; 22660 t['\uFC42'] = '\u0644\u0645'; 22661 t['\uFC43'] = '\u0644\u0649'; 22662 t['\uFC44'] = '\u0644\u064A'; 22663 t['\uFC45'] = '\u0645\u062C'; 22664 t['\uFC46'] = '\u0645\u062D'; 22665 t['\uFC47'] = '\u0645\u062E'; 22666 t['\uFC48'] = '\u0645\u0645'; 22667 t['\uFC49'] = '\u0645\u0649'; 22668 t['\uFC4A'] = '\u0645\u064A'; 22669 t['\uFC4B'] = '\u0646\u062C'; 22670 t['\uFC4C'] = '\u0646\u062D'; 22671 t['\uFC4D'] = '\u0646\u062E'; 22672 t['\uFC4E'] = '\u0646\u0645'; 22673 t['\uFC4F'] = '\u0646\u0649'; 22674 t['\uFC50'] = '\u0646\u064A'; 22675 t['\uFC51'] = '\u0647\u062C'; 22676 t['\uFC52'] = '\u0647\u0645'; 22677 t['\uFC53'] = '\u0647\u0649'; 22678 t['\uFC54'] = '\u0647\u064A'; 22679 t['\uFC55'] = '\u064A\u062C'; 22680 t['\uFC56'] = '\u064A\u062D'; 22681 t['\uFC57'] = '\u064A\u062E'; 22682 t['\uFC58'] = '\u064A\u0645'; 22683 t['\uFC59'] = '\u064A\u0649'; 22684 t['\uFC5A'] = '\u064A\u064A'; 22685 t['\uFC5B'] = '\u0630\u0670'; 22686 t['\uFC5C'] = '\u0631\u0670'; 22687 t['\uFC5D'] = '\u0649\u0670'; 22688 t['\uFC5E'] = '\u0020\u064C\u0651'; 22689 t['\uFC5F'] = '\u0020\u064D\u0651'; 22690 t['\uFC60'] = '\u0020\u064E\u0651'; 22691 t['\uFC61'] = '\u0020\u064F\u0651'; 22692 t['\uFC62'] = '\u0020\u0650\u0651'; 22693 t['\uFC63'] = '\u0020\u0651\u0670'; 22694 t['\uFC64'] = '\u0626\u0631'; 22695 t['\uFC65'] = '\u0626\u0632'; 22696 t['\uFC66'] = '\u0626\u0645'; 22697 t['\uFC67'] = '\u0626\u0646'; 22698 t['\uFC68'] = '\u0626\u0649'; 22699 t['\uFC69'] = '\u0626\u064A'; 22700 t['\uFC6A'] = '\u0628\u0631'; 22701 t['\uFC6B'] = '\u0628\u0632'; 22702 t['\uFC6C'] = '\u0628\u0645'; 22703 t['\uFC6D'] = '\u0628\u0646'; 22704 t['\uFC6E'] = '\u0628\u0649'; 22705 t['\uFC6F'] = '\u0628\u064A'; 22706 t['\uFC70'] = '\u062A\u0631'; 22707 t['\uFC71'] = '\u062A\u0632'; 22708 t['\uFC72'] = '\u062A\u0645'; 22709 t['\uFC73'] = '\u062A\u0646'; 22710 t['\uFC74'] = '\u062A\u0649'; 22711 t['\uFC75'] = '\u062A\u064A'; 22712 t['\uFC76'] = '\u062B\u0631'; 22713 t['\uFC77'] = '\u062B\u0632'; 22714 t['\uFC78'] = '\u062B\u0645'; 22715 t['\uFC79'] = '\u062B\u0646'; 22716 t['\uFC7A'] = '\u062B\u0649'; 22717 t['\uFC7B'] = '\u062B\u064A'; 22718 t['\uFC7C'] = '\u0641\u0649'; 22719 t['\uFC7D'] = '\u0641\u064A'; 22720 t['\uFC7E'] = '\u0642\u0649'; 22721 t['\uFC7F'] = '\u0642\u064A'; 22722 t['\uFC80'] = '\u0643\u0627'; 22723 t['\uFC81'] = '\u0643\u0644'; 22724 t['\uFC82'] = '\u0643\u0645'; 22725 t['\uFC83'] = '\u0643\u0649'; 22726 t['\uFC84'] = '\u0643\u064A'; 22727 t['\uFC85'] = '\u0644\u0645'; 22728 t['\uFC86'] = '\u0644\u0649'; 22729 t['\uFC87'] = '\u0644\u064A'; 22730 t['\uFC88'] = '\u0645\u0627'; 22731 t['\uFC89'] = '\u0645\u0645'; 22732 t['\uFC8A'] = '\u0646\u0631'; 22733 t['\uFC8B'] = '\u0646\u0632'; 22734 t['\uFC8C'] = '\u0646\u0645'; 22735 t['\uFC8D'] = '\u0646\u0646'; 22736 t['\uFC8E'] = '\u0646\u0649'; 22737 t['\uFC8F'] = '\u0646\u064A'; 22738 t['\uFC90'] = '\u0649\u0670'; 22739 t['\uFC91'] = '\u064A\u0631'; 22740 t['\uFC92'] = '\u064A\u0632'; 22741 t['\uFC93'] = '\u064A\u0645'; 22742 t['\uFC94'] = '\u064A\u0646'; 22743 t['\uFC95'] = '\u064A\u0649'; 22744 t['\uFC96'] = '\u064A\u064A'; 22745 t['\uFC97'] = '\u0626\u062C'; 22746 t['\uFC98'] = '\u0626\u062D'; 22747 t['\uFC99'] = '\u0626\u062E'; 22748 t['\uFC9A'] = '\u0626\u0645'; 22749 t['\uFC9B'] = '\u0626\u0647'; 22750 t['\uFC9C'] = '\u0628\u062C'; 22751 t['\uFC9D'] = '\u0628\u062D'; 22752 t['\uFC9E'] = '\u0628\u062E'; 22753 t['\uFC9F'] = '\u0628\u0645'; 22754 t['\uFCA0'] = '\u0628\u0647'; 22755 t['\uFCA1'] = '\u062A\u062C'; 22756 t['\uFCA2'] = '\u062A\u062D'; 22757 t['\uFCA3'] = '\u062A\u062E'; 22758 t['\uFCA4'] = '\u062A\u0645'; 22759 t['\uFCA5'] = '\u062A\u0647'; 22760 t['\uFCA6'] = '\u062B\u0645'; 22761 t['\uFCA7'] = '\u062C\u062D'; 22762 t['\uFCA8'] = '\u062C\u0645'; 22763 t['\uFCA9'] = '\u062D\u062C'; 22764 t['\uFCAA'] = '\u062D\u0645'; 22765 t['\uFCAB'] = '\u062E\u062C'; 22766 t['\uFCAC'] = '\u062E\u0645';
22767 t['\uFCAD'] = '\u0633\u062C'; 22768 t['\uFCAE'] = '\u0633\u062D'; 22769 t['\uFCAF'] = '\u0633\u062E'; 22770 t['\uFCB0'] = '\u0633\u0645'; 22771 t['\uFCB1'] = '\u0635\u062D'; 22772 t['\uFCB2'] = '\u0635\u062E'; 22773 t['\uFCB3'] = '\u0635\u0645'; 22774 t['\uFCB4'] = '\u0636\u062C'; 22775 t['\uFCB5'] = '\u0636\u062D'; 22776 t['\uFCB6'] = '\u0636\u062E'; 22777 t['\uFCB7'] = '\u0636\u0645'; 22778 t['\uFCB8'] = '\u0637\u062D'; 22779 t['\uFCB9'] = '\u0638\u0645'; 22780 t['\uFCBA'] = '\u0639\u062C'; 22781 t['\uFCBB'] = '\u0639\u0645'; 22782 t['\uFCBC'] = '\u063A\u062C'; 22783 t['\uFCBD'] = '\u063A\u0645'; 22784 t['\uFCBE'] = '\u0641\u062C'; 22785 t['\uFCBF'] = '\u0641\u062D'; 22786 t['\uFCC0'] = '\u0641\u062E'; 22787 t['\uFCC1'] = '\u0641\u0645'; 22788 t['\uFCC2'] = '\u0642\u062D'; 22789 t['\uFCC3'] = '\u0642\u0645'; 22790 t['\uFCC4'] = '\u0643\u062C'; 22791 t['\uFCC5'] = '\u0643\u062D'; 22792 t['\uFCC6'] = '\u0643\u062E'; 22793 t['\uFCC7'] = '\u0643\u0644'; 22794 t['\uFCC8'] = '\u0643\u0645'; 22795 t['\uFCC9'] = '\u0644\u062C'; 22796 t['\uFCCA'] = '\u0644\u062D'; 22797 t['\uFCCB'] = '\u0644\u062E'; 22798 t['\uFCCC'] = '\u0644\u0645'; 22799 t['\uFCCD'] = '\u0644\u0647'; 22800 t['\uFCCE'] = '\u0645\u062C'; 22801 t['\uFCCF'] = '\u0645\u062D'; 22802 t['\uFCD0'] = '\u0645\u062E'; 22803 t['\uFCD1'] = '\u0645\u0645'; 22804 t['\uFCD2'] = '\u0646\u062C'; 22805 t['\uFCD3'] = '\u0646\u062D'; 22806 t['\uFCD4'] = '\u0646\u062E'; 22807 t['\uFCD5'] = '\u0646\u0645'; 22808 t['\uFCD6'] = '\u0646\u0647'; 22809 t['\uFCD7'] = '\u0647\u062C'; 22810 t['\uFCD8'] = '\u0647\u0645'; 22811 t['\uFCD9'] = '\u0647\u0670'; 22812 t['\uFCDA'] = '\u064A\u062C'; 22813 t['\uFCDB'] = '\u064A\u062D'; 22814 t['\uFCDC'] = '\u064A\u062E'; 22815 t['\uFCDD'] = '\u064A\u0645'; 22816 t['\uFCDE'] = '\u064A\u0647'; 22817 t['\uFCDF'] = '\u0626\u0645'; 22818 t['\uFCE0'] = '\u0626\u0647'; 22819 t['\uFCE1'] = '\u0628\u0645'; 22820 t['\uFCE2'] = '\u0628\u0647'; 22821 t['\uFCE3'] = '\u062A\u0645'; 22822 t['\uFCE4'] = '\u062A\u0647'; 22823 t['\uFCE5'] = '\u062B\u0645'; 22824 t['\uFCE6'] = '\u062B\u0647'; 22825 t['\uFCE7'] = '\u0633\u0645'; 22826 t['\uFCE8'] = '\u0633\u0647'; 22827 t['\uFCE9'] = '\u0634\u0645'; 22828 t['\uFCEA'] = '\u0634\u0647'; 22829 t['\uFCEB'] = '\u0643\u0644'; 22830 t['\uFCEC'] = '\u0643\u0645'; 22831 t['\uFCED'] = '\u0644\u0645'; 22832 t['\uFCEE'] = '\u0646\u0645'; 22833 t['\uFCEF'] = '\u0646\u0647'; 22834 t['\uFCF0'] = '\u064A\u0645'; 22835 t['\uFCF1'] = '\u064A\u0647'; 22836 t['\uFCF2'] = '\u0640\u064E\u0651'; 22837 t['\uFCF3'] = '\u0640\u064F\u0651'; 22838 t['\uFCF4'] = '\u0640\u0650\u0651'; 22839 t['\uFCF5'] = '\u0637\u0649'; 22840 t['\uFCF6'] = '\u0637\u064A'; 22841 t['\uFCF7'] = '\u0639\u0649'; 22842 t['\uFCF8'] = '\u0639\u064A'; 22843 t['\uFCF9'] = '\u063A\u0649'; 22844 t['\uFCFA'] = '\u063A\u064A'; 22845 t['\uFCFB'] = '\u0633\u0649'; 22846 t['\uFCFC'] = '\u0633\u064A'; 22847 t['\uFCFD'] = '\u0634\u0649'; 22848 t['\uFCFE'] = '\u0634\u064A'; 22849 t['\uFCFF'] = '\u062D\u0649'; 22850 t['\uFD00'] = '\u062D\u064A'; 22851 t['\uFD01'] = '\u062C\u0649'; 22852 t['\uFD02'] = '\u062C\u064A'; 22853 t['\uFD03'] = '\u062E\u0649'; 22854 t['\uFD04'] = '\u062E\u064A'; 22855 t['\uFD05'] = '\u0635\u0649'; 22856 t['\uFD06'] = '\u0635\u064A'; 22857 t['\uFD07'] = '\u0636\u0649'; 22858 t['\uFD08'] = '\u0636\u064A'; 22859 t['\uFD09'] = '\u0634\u062C'; 22860 t['\uFD0A'] = '\u0634\u062D'; 22861 t['\uFD0B'] = '\u0634\u062E'; 22862 t['\uFD0C'] = '\u0634\u0645'; 22863 t['\uFD0D'] = '\u0634\u0631'; 22864 t['\uFD0E'] = '\u0633\u0631'; 22865 t['\uFD0F'] = '\u0635\u0631'; 22866 t['\uFD10'] = '\u0636\u0631'; 22867 t['\uFD11'] = '\u0637\u0649'; 22868 t['\uFD12'] = '\u0637\u064A'; 22869 t['\uFD13'] = '\u0639\u0649'; 22870 t['\uFD14'] = '\u0639\u064A'; 22871 t['\uFD15'] = '\u063A\u0649'; 22872 t['\uFD16'] = '\u063A\u064A'; 22873 t['\uFD17'] = '\u0633\u0649'; 22874 t['\uFD18'] = '\u0633\u064A'; 22875 t['\uFD19'] = '\u0634\u0649'; 22876 t['\uFD1A'] = '\u0634\u064A'; 22877 t['\uFD1B'] = '\u062D\u0649'; 22878 t['\uFD1C'] = '\u062D\u064A'; 22879 t['\uFD1D'] = '\u062C\u0649'; 22880 t['\uFD1E'] = '\u062C\u064A'; 22881 t['\uFD1F'] = '\u062E\u0649'; 22882 t['\uFD20'] = '\u062E\u064A'; 22883 t['\uFD21'] = '\u0635\u0649'; 22884 t['\uFD22'] = '\u0635\u064A'; 22885 t['\uFD23'] = '\u0636\u0649'; 22886 t['\uFD24'] = '\u0636\u064A'; 22887 t['\uFD25'] = '\u0634\u062C'; 22888 t['\uFD26'] = '\u0634\u062D'; 22889 t['\uFD27'] = '\u0634\u062E'; 22890 t['\uFD28'] = '\u0634\u0645'; 22891 t['\uFD29'] = '\u0634\u0631'; 22892 t['\uFD2A'] = '\u0633\u0631'; 22893 t['\uFD2B'] = '\u0635\u0631'; 22894 t['\uFD2C'] = '\u0636\u0631'; 22895 t['\uFD2D'] = '\u0634\u062C'; 22896 t['\uFD2E'] = '\u0634\u062D'; 22897 t['\uFD2F'] = '\u0634\u062E'; 22898 t['\uFD30'] = '\u0634\u0645'; 22899 t['\uFD31'] = '\u0633\u0647'; 22900 t['\uFD32'] = '\u0634\u0647'; 22901 t['\uFD33'] = '\u0637\u0645';
22902 t['\uFD34'] = '\u0633\u062C'; 22903 t['\uFD35'] = '\u0633\u062D'; 22904 t['\uFD36'] = '\u0633\u062E'; 22905 t['\uFD37'] = '\u0634\u062C'; 22906 t['\uFD38'] = '\u0634\u062D'; 22907 t['\uFD39'] = '\u0634\u062E'; 22908 t['\uFD3A'] = '\u0637\u0645'; 22909 t['\uFD3B'] = '\u0638\u0645'; 22910 t['\uFD3C'] = '\u0627\u064B'; 22911 t['\uFD3D'] = '\u0627\u064B'; 22912 t['\uFD50'] = '\u062A\u062C\u0645'; 22913 t['\uFD51'] = '\u062A\u062D\u062C'; 22914 t['\uFD52'] = '\u062A\u062D\u062C'; 22915 t['\uFD53'] = '\u062A\u062D\u0645'; 22916 t['\uFD54'] = '\u062A\u062E\u0645'; 22917 t['\uFD55'] = '\u062A\u0645\u062C'; 22918 t['\uFD56'] = '\u062A\u0645\u062D'; 22919 t['\uFD57'] = '\u062A\u0645\u062E'; 22920 t['\uFD58'] = '\u062C\u0645\u062D'; 22921 t['\uFD59'] = '\u062C\u0645\u062D'; 22922 t['\uFD5A'] = '\u062D\u0645\u064A'; 22923 t['\uFD5B'] = '\u062D\u0645\u0649'; 22924 t['\uFD5C'] = '\u0633\u062D\u062C'; 22925 t['\uFD5D'] = '\u0633\u062C\u062D'; 22926 t['\uFD5E'] = '\u0633\u062C\u0649'; 22927 t['\uFD5F'] = '\u0633\u0645\u062D'; 22928 t['\uFD60'] = '\u0633\u0645\u062D'; 22929 t['\uFD61'] = '\u0633\u0645\u062C'; 22930 t['\uFD62'] = '\u0633\u0645\u0645'; 22931 t['\uFD63'] = '\u0633\u0645\u0645'; 22932 t['\uFD64'] = '\u0635\u062D\u062D'; 22933 t['\uFD65'] = '\u0635\u062D\u062D'; 22934 t['\uFD66'] = '\u0635\u0645\u0645'; 22935 t['\uFD67'] = '\u0634\u062D\u0645'; 22936 t['\uFD68'] = '\u0634\u062D\u0645'; 22937 t['\uFD69'] = '\u0634\u062C\u064A'; 22938 t['\uFD6A'] = '\u0634\u0645\u062E'; 22939 t['\uFD6B'] = '\u0634\u0645\u062E'; 22940 t['\uFD6C'] = '\u0634\u0645\u0645'; 22941 t['\uFD6D'] = '\u0634\u0645\u0645'; 22942 t['\uFD6E'] = '\u0636\u062D\u0649'; 22943 t['\uFD6F'] = '\u0636\u062E\u0645'; 22944 t['\uFD70'] = '\u0636\u062E\u0645'; 22945 t['\uFD71'] = '\u0637\u0645\u062D'; 22946 t['\uFD72'] = '\u0637\u0645\u062D'; 22947 t['\uFD73'] = '\u0637\u0645\u0645'; 22948 t['\uFD74'] = '\u0637\u0645\u064A'; 22949 t['\uFD75'] = '\u0639\u062C\u0645'; 22950 t['\uFD76'] = '\u0639\u0645\u0645'; 22951 t['\uFD77'] = '\u0639\u0645\u0645'; 22952 t['\uFD78'] = '\u0639\u0645\u0649'; 22953 t['\uFD79'] = '\u063A\u0645\u0645'; 22954 t['\uFD7A'] = '\u063A\u0645\u064A'; 22955 t['\uFD7B'] = '\u063A\u0645\u0649'; 22956 t['\uFD7C'] = '\u0641\u062E\u0645'; 22957 t['\uFD7D'] = '\u0641\u062E\u0645'; 22958 t['\uFD7E'] = '\u0642\u0645\u062D'; 22959 t['\uFD7F'] = '\u0642\u0645\u0645'; 22960 t['\uFD80'] = '\u0644\u062D\u0645'; 22961 t['\uFD81'] = '\u0644\u062D\u064A'; 22962 t['\uFD82'] = '\u0644\u062D\u0649'; 22963 t['\uFD83'] = '\u0644\u062C\u062C'; 22964 t['\uFD84'] = '\u0644\u062C\u062C'; 22965 t['\uFD85'] = '\u0644\u062E\u0645'; 22966 t['\uFD86'] = '\u0644\u062E\u0645'; 22967 t['\uFD87'] = '\u0644\u0645\u062D'; 22968 t['\uFD88'] = '\u0644\u0645\u062D'; 22969 t['\uFD89'] = '\u0645\u062D\u062C'; 22970 t['\uFD8A'] = '\u0645\u062D\u0645'; 22971 t['\uFD8B'] = '\u0645\u062D\u064A'; 22972 t['\uFD8C'] = '\u0645\u062C\u062D'; 22973 t['\uFD8D'] = '\u0645\u062C\u0645'; 22974 t['\uFD8E'] = '\u0645\u062E\u062C'; 22975 t['\uFD8F'] = '\u0645\u062E\u0645'; 22976 t['\uFD92'] = '\u0645\u062C\u062E'; 22977 t['\uFD93'] = '\u0647\u0645\u062C'; 22978 t['\uFD94'] = '\u0647\u0645\u0645'; 22979 t['\uFD95'] = '\u0646\u062D\u0645'; 22980 t['\uFD96'] = '\u0646\u062D\u0649'; 22981 t['\uFD97'] = '\u0646\u062C\u0645'; 22982 t['\uFD98'] = '\u0646\u062C\u0645'; 22983 t['\uFD99'] = '\u0646\u062C\u0649'; 22984 t['\uFD9A'] = '\u0646\u0645\u064A'; 22985 t['\uFD9B'] = '\u0646\u0645\u0649'; 22986 t['\uFD9C'] = '\u064A\u0645\u0645'; 22987 t['\uFD9D'] = '\u064A\u0645\u0645'; 22988 t['\uFD9E'] = '\u0628\u062E\u064A'; 22989 t['\uFD9F'] = '\u062A\u062C\u064A'; 22990 t['\uFDA0'] = '\u062A\u062C\u0649'; 22991 t['\uFDA1'] = '\u062A\u062E\u064A'; 22992 t['\uFDA2'] = '\u062A\u062E\u0649'; 22993 t['\uFDA3'] = '\u062A\u0645\u064A'; 22994 t['\uFDA4'] = '\u062A\u0645\u0649'; 22995 t['\uFDA5'] = '\u062C\u0645\u064A'; 22996 t['\uFDA6'] = '\u062C\u062D\u0649'; 22997 t['\uFDA7'] = '\u062C\u0645\u0649'; 22998 t['\uFDA8'] = '\u0633\u062E\u0649'; 22999 t['\uFDA9'] = '\u0635\u062D\u064A'; 23000 t['\uFDAA'] = '\u0634\u062D\u064A'; 23001 t['\uFDAB'] = '\u0636\u062D\u064A'; 23002 t['\uFDAC'] = '\u0644\u062C\u064A'; 23003 t['\uFDAD'] = '\u0644\u0645\u064A'; 23004 t['\uFDAE'] = '\u064A\u062D\u064A'; 23005 t['\uFDAF'] = '\u064A\u062C\u064A'; 23006 t['\uFDB0'] = '\u064A\u0645\u064A'; 23007 t['\uFDB1'] = '\u0645\u0645\u064A'; 23008 t['\uFDB2'] = '\u0642\u0645\u064A'; 23009 t['\uFDB3'] = '\u0646\u062D\u064A'; 23010 t['\uFDB4'] = '\u0642\u0645\u062D'; 23011 t['\uFDB5'] = '\u0644\u062D\u0645'; 23012 t['\uFDB6'] = '\u0639\u0645\u064A'; 23013 t['\uFDB7'] = '\u0643\u0645\u064A'; 23014 t['\uFDB8'] = '\u0646\u062C\u062D'; 23015 t['\uFDB9'] = '\u0645\u062E\u064A'; 23016 t['\uFDBA'] = '\u0644\u062C\u0645'; 23017 t['\uFDBB'] = '\u0643\u0645\u0645'; 23018 t['\uFDBC'] = '\u0644\u062C\u0645'; 23019 t['\uFDBD'] = '\u0646\u062C\u062D'; 23020 t['\uFDBE'] = '\u062C\u062D\u064A'; 23021 t['\uFDBF'] = '\u062D\u062C\u064A'; 23022 t['\uFDC0'] = '\u0645\u062C\u064A'; 23023 t['\uFDC1'] = '\u0641\u0645\u064A'; 23024 t['\uFDC2'] = '\u0628\u062D\u064A'; 23025 t['\uFDC3'] = '\u0643\u0645\u0645'; 23026 t['\uFDC4'] = '\u0639\u062C\u0645'; 23027 t['\uFDC5'] = '\u0635\u0645\u0645'; 23028 t['\uFDC6'] = '\u0633\u062E\u064A'; 23029 t['\uFDC7'] = '\u0646\u062C\u064A'; 23030 t['\uFE49'] = '\u203E'; 23031 t['\uFE4A'] = '\u203E';
23032 t['\uFE4B'] = '\u203E'; 23033 t['\uFE4C'] = '\u203E'; 23034 t['\uFE4D'] = '\u005F'; 23035 t['\uFE4E'] = '\u005F'; 23036 t['\uFE4F'] = '\u005F'; 23037 t['\uFE80'] = '\u0621'; 23038 t['\uFE81'] = '\u0622'; 23039 t['\uFE82'] = '\u0622'; 23040 t['\uFE83'] = '\u0623'; 23041 t['\uFE84'] = '\u0623'; 23042 t['\uFE85'] = '\u0624'; 23043 t['\uFE86'] = '\u0624'; 23044 t['\uFE87'] = '\u0625'; 23045 t['\uFE88'] = '\u0625'; 23046 t['\uFE89'] = '\u0626'; 23047 t['\uFE8A'] = '\u0626'; 23048 t['\uFE8B'] = '\u0626'; 23049 t['\uFE8C'] = '\u0626'; 23050 t['\uFE8D'] = '\u0627'; 23051 t['\uFE8E'] = '\u0627'; 23052 t['\uFE8F'] = '\u0628'; 23053 t['\uFE90'] = '\u0628'; 23054 t['\uFE91'] = '\u0628'; 23055 t['\uFE92'] = '\u0628'; 23056 t['\uFE93'] = '\u0629'; 23057 t['\uFE94'] = '\u0629'; 23058 t['\uFE95'] = '\u062A'; 23059 t['\uFE96'] = '\u062A'; 23060 t['\uFE97'] = '\u062A'; 23061 t['\uFE98'] = '\u062A'; 23062 t['\uFE99'] = '\u062B'; 23063 t['\uFE9A'] = '\u062B'; 23064 t['\uFE9B'] = '\u062B'; 23065 t['\uFE9C'] = '\u062B'; 23066 t['\uFE9D'] = '\u062C'; 23067 t['\uFE9E'] = '\u062C'; 23068 t['\uFE9F'] = '\u062C'; 23069 t['\uFEA0'] = '\u062C'; 23070 t['\uFEA1'] = '\u062D'; 23071 t['\uFEA2'] = '\u062D'; 23072 t['\uFEA3'] = '\u062D'; 23073 t['\uFEA4'] = '\u062D'; 23074 t['\uFEA5'] = '\u062E'; 23075 t['\uFEA6'] = '\u062E'; 23076 t['\uFEA7'] = '\u062E'; 23077 t['\uFEA8'] = '\u062E'; 23078 t['\uFEA9'] = '\u062F'; 23079 t['\uFEAA'] = '\u062F'; 23080 t['\uFEAB'] = '\u0630'; 23081 t['\uFEAC'] = '\u0630'; 23082 t['\uFEAD'] = '\u0631'; 23083 t['\uFEAE'] = '\u0631'; 23084 t['\uFEAF'] = '\u0632'; 23085 t['\uFEB0'] = '\u0632'; 23086 t['\uFEB1'] = '\u0633'; 23087 t['\uFEB2'] = '\u0633'; 23088 t['\uFEB3'] = '\u0633'; 23089 t['\uFEB4'] = '\u0633'; 23090 t['\uFEB5'] = '\u0634'; 23091 t['\uFEB6'] = '\u0634'; 23092 t['\uFEB7'] = '\u0634'; 23093 t['\uFEB8'] = '\u0634'; 23094 t['\uFEB9'] = '\u0635'; 23095 t['\uFEBA'] = '\u0635'; 23096 t['\uFEBB'] = '\u0635'; 23097 t['\uFEBC'] = '\u0635'; 23098 t['\uFEBD'] = '\u0636'; 23099 t['\uFEBE'] = '\u0636'; 23100 t['\uFEBF'] = '\u0636'; 23101 t['\uFEC0'] = '\u0636'; 23102 t['\uFEC1'] = '\u0637'; 23103 t['\uFEC2'] = '\u0637'; 23104 t['\uFEC3'] = '\u0637'; 23105 t['\uFEC4'] = '\u0637'; 23106 t['\uFEC5'] = '\u0638'; 23107 t['\uFEC6'] = '\u0638'; 23108 t['\uFEC7'] = '\u0638'; 23109 t['\uFEC8'] = '\u0638'; 23110 t['\uFEC9'] = '\u0639'; 23111 t['\uFECA'] = '\u0639'; 23112 t['\uFECB'] = '\u0639'; 23113 t['\uFECC'] = '\u0639'; 23114 t['\uFECD'] = '\u063A'; 23115 t['\uFECE'] = '\u063A'; 23116 t['\uFECF'] = '\u063A'; 23117 t['\uFED0'] = '\u063A'; 23118 t['\uFED1'] = '\u0641'; 23119 t['\uFED2'] = '\u0641'; 23120 t['\uFED3'] = '\u0641'; 23121 t['\uFED4'] = '\u0641'; 23122 t['\uFED5'] = '\u0642'; 23123 t['\uFED6'] = '\u0642'; 23124 t['\uFED7'] = '\u0642'; 23125 t['\uFED8'] = '\u0642'; 23126 t['\uFED9'] = '\u0643'; 23127 t['\uFEDA'] = '\u0643'; 23128 t['\uFEDB'] = '\u0643'; 23129 t['\uFEDC'] = '\u0643'; 23130 t['\uFEDD'] = '\u0644'; 23131 t['\uFEDE'] = '\u0644'; 23132 t['\uFEDF'] = '\u0644'; 23133 t['\uFEE0'] = '\u0644'; 23134 t['\uFEE1'] = '\u0645'; 23135 t['\uFEE2'] = '\u0645'; 23136 t['\uFEE3'] = '\u0645'; 23137 t['\uFEE4'] = '\u0645'; 23138 t['\uFEE5'] = '\u0646'; 23139 t['\uFEE6'] = '\u0646'; 23140 t['\uFEE7'] = '\u0646'; 23141 t['\uFEE8'] = '\u0646'; 23142 t['\uFEE9'] = '\u0647'; 23143 t['\uFEEA'] = '\u0647'; 23144 t['\uFEEB'] = '\u0647'; 23145 t['\uFEEC'] = '\u0647'; 23146 t['\uFEED'] = '\u0648'; 23147 t['\uFEEE'] = '\u0648'; 23148 t['\uFEEF'] = '\u0649'; 23149 t['\uFEF0'] = '\u0649'; 23150 t['\uFEF1'] = '\u064A'; 23151 t['\uFEF2'] = '\u064A'; 23152 t['\uFEF3'] = '\u064A'; 23153 t['\uFEF4'] = '\u064A'; 23154 t['\uFEF5'] = '\u0644\u0622'; 23155 t['\uFEF6'] = '\u0644\u0622'; 23156 t['\uFEF7'] = '\u0644\u0623'; 23157 t['\uFEF8'] = '\u0644\u0623'; 23158 t['\uFEF9'] = '\u0644\u0625'; 23159 t['\uFEFA'] = '\u0644\u0625'; 23160 t['\uFEFB'] = '\u0644\u0627'; 23161 t['\uFEFC'] = '\u0644\u0627'; 23162 }); 23163 function reverseIfRtl(chars) { 23164 var charsLength = chars.length; 23165 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { 23166 return chars; 23167 } 23168 var s = ''; 23169 for (var ii = charsLength - 1; ii >= 0; ii--) { 23170 s += chars[ii]; 23171 } 23172 return s; 23173 } 23174 exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues; 23175 exports.reverseIfRtl = reverseIfRtl; 23176 exports.getUnicodeRangeFor = getUnicodeRangeFor; 23177 exports.getNormalizedUnicodes = getNormalizedUnicodes; 23178 exports.getUnicodeForGlyph = getUnicodeForGlyph; 23179 })); 23180 (function (root, factory) { 23181 factory(root.pdfjsCorePsParser = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives); 23182 }(this, function (exports, sharedUtil, corePrimitives) { 23183 var error = sharedUtil.error; 23184 var isSpace = sharedUtil.isSpace; 23185 var EOF = corePrimitives.EOF; 23186 var PostScriptParser = function PostScriptParserClosure() { 23187 function PostScriptParser(lexer) { 23188 this.lexer = lexer;
23189 this.operators = []; 23190 this.token = null; 23191 this.prev = null; 23192 } 23193 PostScriptParser.prototype = { 23194 nextToken: function PostScriptParser_nextToken() { 23195 this.prev = this.token; 23196 this.token = this.lexer.getToken(); 23197 }, 23198 accept: function PostScriptParser_accept(type) { 23199 if (this.token.type === type) { 23200 this.nextToken(); 23201 return true; 23202 } 23203 return false; 23204 }, 23205 expect: function PostScriptParser_expect(type) { 23206 if (this.accept(type)) { 23207 return true; 23208 } 23209 error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.'); 23210 }, 23211 parse: function PostScriptParser_parse() { 23212 this.nextToken(); 23213 this.expect(PostScriptTokenTypes.LBRACE); 23214 this.parseBlock(); 23215 this.expect(PostScriptTokenTypes.RBRACE); 23216 return this.operators; 23217 }, 23218 parseBlock: function PostScriptParser_parseBlock() { 23219 while (true) { 23220 if (this.accept(PostScriptTokenTypes.NUMBER)) { 23221 this.operators.push(this.prev.value); 23222 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 23223 this.operators.push(this.prev.value); 23224 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 23225 this.parseCondition(); 23226 } else { 23227 return; 23228 } 23229 } 23230 }, 23231 parseCondition: function PostScriptParser_parseCondition() { 23232 var conditionLocation = this.operators.length; 23233 this.operators.push(null, null); 23234 this.parseBlock(); 23235 this.expect(PostScriptTokenTypes.RBRACE); 23236 if (this.accept(PostScriptTokenTypes.IF)) { 23237 this.operators[conditionLocation] = this.operators.length; 23238 this.operators[conditionLocation + 1] = 'jz'; 23239 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 23240 var jumpLocation = this.operators.length; 23241 this.operators.push(null, null); 23242 var endOfTrue = this.operators.length; 23243 this.parseBlock(); 23244 this.expect(PostScriptTokenTypes.RBRACE); 23245 this.expect(PostScriptTokenTypes.IFELSE); 23246 this.operators[jumpLocation] = this.operators.length; 23247 this.operators[jumpLocation + 1] = 'j'; 23248 this.operators[conditionLocation] = endOfTrue; 23249 this.operators[conditionLocation + 1] = 'jz'; 23250 } else { 23251 error('PS Function: error parsing conditional.'); 23252 } 23253 } 23254 }; 23255 return PostScriptParser; 23256 }(); 23257 var PostScriptTokenTypes = { 23258 LBRACE: 0, 23259 RBRACE: 1, 23260 NUMBER: 2, 23261 OPERATOR: 3, 23262 IF: 4, 23263 IFELSE: 5 23264 }; 23265 var PostScriptToken = function PostScriptTokenClosure() { 23266 function PostScriptToken(type, value) { 23267 this.type = type; 23268 this.value = value; 23269 } 23270 var opCache = Object.create(null); 23271 PostScriptToken.getOperator = function PostScriptToken_getOperator(op) { 23272 var opValue = opCache[op]; 23273 if (opValue) { 23274 return opValue; 23275 } 23276 return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 23277 }; 23278 PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{'); 23279 PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}'); 23280 PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF'); 23281 PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE'); 23282 return PostScriptToken; 23283 }(); 23284 var PostScriptLexer = function PostScriptLexerClosure() { 23285 function PostScriptLexer(stream) { 23286 this.stream = stream; 23287 this.nextChar(); 23288 this.strBuf = []; 23289 } 23290 PostScriptLexer.prototype = { 23291 nextChar: function PostScriptLexer_nextChar() { 23292 return this.currentChar = this.stream.getByte(); 23293 }, 23294 getToken: function PostScriptLexer_getToken() { 23295 var comment = false; 23296 var ch = this.currentChar; 23297 while (true) { 23298 if (ch < 0) { 23299 return EOF; 23300 } 23301 if (comment) { 23302 if (ch === 0x0A || ch === 0x0D) { 23303 comment = false; 23304 } 23305 } else if (ch === 0x25) { 23306 comment = true; 23307 } else if (!isSpace(ch)) { 23308 break; 23309 } 23310 ch = this.nextChar(); 23311 } 23312 switch (ch | 0) { 23313 case 0x30: 23314 case 0x31: 23315 case 0x32: 23316 case 0x33: 23317 case 0x34: 23318 case 0x35: 23319 case 0x36: 23320 case 0x37: 23321 case 0x38: 23322 case 0x39: 23323 case 0x2B: 23324 case 0x2D: 23325 case 0x2E: 23326 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 23327 case 0x7B: 23328 this.nextChar(); 23329 return PostScriptToken.LBRACE; 23330 case 0x7D: 23331 this.nextChar(); 23332 return PostScriptToken.RBRACE; 23333 } 23334 var strBuf = this.strBuf; 23335 strBuf.length = 0; 23336 strBuf[0] = String.fromCharCode(ch); 23337 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) { 23338 strBuf.push(String.fromCharCode(ch)); 23339 } 23340 var str = strBuf.join(''); 23341 switch (str.toLowerCase()) { 23342 case 'if': 23343 return PostScriptToken.IF; 23344 case 'ifelse': 23345 return PostScriptToken.IFELSE; 23346 default: 23347 return PostScriptToken.getOperator(str); 23348 } 23349 }, 23350 getNumber: function PostScriptLexer_getNumber() { 23351 var ch = this.currentChar; 23352 var strBuf = this.strBuf; 23353 strBuf.length = 0; 23354 strBuf[0] = String.fromCharCode(ch); 23355 while ((ch = this.nextChar()) >= 0) { 23356 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) { 23357 strBuf.push(String.fromCharCode(ch)); 23358 } else { 23359 break; 23360 } 23361 } 23362 var value = parseFloat(strBuf.join('')); 23363 if (isNaN(value)) { 23364 error('Invalid floating point number: ' + value); 23365 } 23366 return value; 23367 } 23368 }; 23369 return PostScriptLexer; 23370 }(); 23371 exports.PostScriptLexer = PostScriptLexer; 23372 exports.PostScriptParser = PostScriptParser; 23373 })); 23374 (function (root, factory) { 23375 factory(root.pdfjsCoreStream = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreJbig2, root.pdfjsCoreJpg, root.pdfjsCoreJpx); 23376 }(this, function (exports, sharedUtil, corePrimitives, coreJbig2, coreJpg, coreJpx) { 23377 var Util = sharedUtil.Util; 23378 var error = sharedUtil.error; 23379 var info = sharedUtil.info; 23380 var isInt = sharedUtil.isInt; 23381 var isArray = sharedUtil.isArray; 23382 var createObjectURL = sharedUtil.createObjectURL; 23383 var shadow = sharedUtil.shadow; 23384 var isSpace = sharedUtil.isSpace; 23385 var Dict = corePrimitives.Dict; 23386 var isDict = corePrimitives.isDict; 23387 var isStream = corePrimitives.isStream; 23388 var Jbig2Image = coreJbig2.Jbig2Image; 23389 var JpegImage = coreJpg.JpegImage; 23390 var JpxImage = coreJpx.JpxImage; 23391 var Stream = function StreamClosure() { 23392 function Stream(arrayBuffer, start, length, dict) { 23393 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 23394 this.start = start || 0; 23395 this.pos = this.start; 23396 this.end = start + length || this.bytes.length; 23397 this.dict = dict; 23398 } 23399 Stream.prototype = { 23400 get length() {
23401 return this.end - this.start; 23402 }, 23403 get isEmpty() { 23404 return this.length === 0; 23405 }, 23406 getByte: function Stream_getByte() { 23407 if (this.pos >= this.end) { 23408 return -1; 23409 } 23410 return this.bytes[this.pos++]; 23411 }, 23412 getUint16: function Stream_getUint16() { 23413 var b0 = this.getByte(); 23414 var b1 = this.getByte(); 23415 if (b0 === -1 || b1 === -1) { 23416 return -1; 23417 } 23418 return (b0 << 8) + b1; 23419 }, 23420 getInt32: function Stream_getInt32() { 23421 var b0 = this.getByte(); 23422 var b1 = this.getByte(); 23423 var b2 = this.getByte(); 23424 var b3 = this.getByte(); 23425 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 23426 }, 23427 getBytes: function Stream_getBytes(length) { 23428 var bytes = this.bytes; 23429 var pos = this.pos; 23430 var strEnd = this.end; 23431 if (!length) { 23432 return bytes.subarray(pos, strEnd); 23433 } 23434 var end = pos + length; 23435 if (end > strEnd) { 23436 end = strEnd; 23437 } 23438 this.pos = end; 23439 return bytes.subarray(pos, end); 23440 }, 23441 peekByte: function Stream_peekByte() { 23442 var peekedByte = this.getByte(); 23443 this.pos--; 23444 return peekedByte; 23445 }, 23446 peekBytes: function Stream_peekBytes(length) { 23447 var bytes = this.getBytes(length); 23448 this.pos -= bytes.length; 23449 return bytes; 23450 }, 23451 skip: function Stream_skip(n) { 23452 if (!n) { 23453 n = 1; 23454 } 23455 this.pos += n; 23456 }, 23457 reset: function Stream_reset() { 23458 this.pos = this.start; 23459 }, 23460 moveStart: function Stream_moveStart() { 23461 this.start = this.pos; 23462 }, 23463 makeSubStream: function Stream_makeSubStream(start, length, dict) { 23464 return new Stream(this.bytes.buffer, start, length, dict); 23465 } 23466 }; 23467 return Stream; 23468 }(); 23469 var StringStream = function StringStreamClosure() { 23470 function StringStream(str) { 23471 var length = str.length; 23472 var bytes = new Uint8Array(length); 23473 for (var n = 0; n < length; ++n) { 23474 bytes[n] = str.charCodeAt(n); 23475 } 23476 Stream.call(this, bytes); 23477 } 23478 StringStream.prototype = Stream.prototype; 23479 return StringStream; 23480 }(); 23481 var DecodeStream = function DecodeStreamClosure() { 23482 var emptyBuffer = new Uint8Array(0); 23483 function DecodeStream(maybeMinBufferLength) { 23484 this.pos = 0; 23485 this.bufferLength = 0; 23486 this.eof = false; 23487 this.buffer = emptyBuffer; 23488 this.minBufferLength = 512; 23489 if (maybeMinBufferLength) { 23490 while (this.minBufferLength < maybeMinBufferLength) { 23491 this.minBufferLength *= 2; 23492 } 23493 } 23494 } 23495 DecodeStream.prototype = { 23496 get isEmpty() { 23497 while (!this.eof && this.bufferLength === 0) { 23498 this.readBlock(); 23499 } 23500 return this.bufferLength === 0; 23501 }, 23502 ensureBuffer: function DecodeStream_ensureBuffer(requested) { 23503 var buffer = this.buffer; 23504 if (requested <= buffer.byteLength) { 23505 return buffer; 23506 } 23507 var size = this.minBufferLength; 23508 while (size < requested) { 23509 size *= 2; 23510 } 23511 var buffer2 = new Uint8Array(size); 23512 buffer2.set(buffer); 23513 return this.buffer = buffer2; 23514 }, 23515 getByte: function DecodeStream_getByte() { 23516 var pos = this.pos; 23517 while (this.bufferLength <= pos) { 23518 if (this.eof) { 23519 return -1; 23520 } 23521 this.readBlock(); 23522 } 23523 return this.buffer[this.pos++]; 23524 }, 23525 getUint16: function DecodeStream_getUint16() { 23526 var b0 = this.getByte(); 23527 var b1 = this.getByte(); 23528 if (b0 === -1 || b1 === -1) { 23529 return -1; 23530 } 23531 return (b0 << 8) + b1; 23532 }, 23533 getInt32: function DecodeStream_getInt32() { 23534 var b0 = this.getByte(); 23535 var b1 = this.getByte(); 23536 var b2 = this.getByte(); 23537 var b3 = this.getByte(); 23538 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 23539 }, 23540 getBytes: function DecodeStream_getBytes(length) { 23541 var end, pos = this.pos; 23542 if (length) { 23543 this.ensureBuffer(pos + length); 23544 end = pos + length; 23545 while (!this.eof && this.bufferLength < end) { 23546 this.readBlock(); 23547 } 23548 var bufEnd = this.bufferLength; 23549 if (end > bufEnd) { 23550 end = bufEnd; 23551 } 23552 } else { 23553 while (!this.eof) { 23554 this.readBlock(); 23555 } 23556 end = this.bufferLength; 23557 } 23558 this.pos = end; 23559 return this.buffer.subarray(pos, end); 23560 }, 23561 peekByte: function DecodeStream_peekByte() { 23562 var peekedByte = this.getByte(); 23563 this.pos--; 23564 return peekedByte; 23565 }, 23566 peekBytes: function DecodeStream_peekBytes(length) { 23567 var bytes = this.getBytes(length); 23568 this.pos -= bytes.length; 23569 return bytes; 23570 }, 23571 makeSubStream: function DecodeStream_makeSubStream(start, length, dict) { 23572 var end = start + length; 23573 while (this.bufferLength <= end && !this.eof) { 23574 this.readBlock(); 23575 } 23576 return new Stream(this.buffer, start, length, dict); 23577 }, 23578 skip: function DecodeStream_skip(n) { 23579 if (!n) { 23580 n = 1; 23581 } 23582 this.pos += n; 23583 }, 23584 reset: function DecodeStream_reset() { 23585 this.pos = 0; 23586 }, 23587 getBaseStreams: function DecodeStream_getBaseStreams() { 23588 if (this.str && this.str.getBaseStreams) { 23589 return this.str.getBaseStreams(); 23590 } 23591 return []; 23592 } 23593 }; 23594 return DecodeStream; 23595 }(); 23596 var StreamsSequenceStream = function StreamsSequenceStreamClosure() { 23597 function StreamsSequenceStream(streams) { 23598 this.streams = streams; 23599 DecodeStream.call(this, null); 23600 } 23601 StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype); 23602 StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() { 23603 var streams = this.streams; 23604 if (streams.length === 0) { 23605 this.eof = true; 23606 return; 23607 } 23608 var stream = streams.shift(); 23609 var chunk = stream.getBytes(); 23610 var bufferLength = this.bufferLength; 23611 var newLength = bufferLength + chunk.length; 23612 var buffer = this.ensureBuffer(newLength); 23613 buffer.set(chunk, bufferLength); 23614 this.bufferLength = newLength; 23615 }; 23616 StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() { 23617 var baseStreams = []; 23618 for (var i = 0, ii = this.streams.length; i < ii; i++) { 23619 var stream = this.streams[i]; 23620 if (stream.getBaseStreams) { 23621 Util.appendToArray(baseStreams, stream.getBaseStreams()); 23622 } 23623 } 23624 return baseStreams; 23625 }; 23626 return StreamsSequenceStream; 23627 }(); 23628 var FlateStream = function FlateStreamClosure() { 23629 var codeLenCodeMap = new Int32Array([ 23630 16, 23631 17, 23632 18, 23633 0, 23634 8, 23635 7, 23636 9, 23637 6, 23638 10, 23639 5, 23640 11, 23641 4, 23642 12, 23643 3, 23644 13, 23645 2, 23646 14, 23647 1, 23648 15 23649 ]); 23650 var lengthDecode = new Int32Array([ 23651 0x00003, 23652 0x00004, 23653 0x00005, 23654 0x00006, 23655 0x00007, 23656 0x00008, 23657 0x00009, 23658 0x0000a, 23659 0x1000b, 23660 0x1000d, 23661 0x1000f, 23662 0x10011, 23663 0x20013, 23664 0x20017, 23665 0x2001b, 23666 0x2001f, 23667 0x30023, 23668 0x3002b, 23669 0x30033, 23670 0x3003b, 23671 0x40043, 23672 0x40053, 23673 0x40063, 23674 0x40073, 23675 0x50083, 23676 0x500a3, 23677 0x500c3, 23678 0x500e3, 23679 0x00102, 23680 0x00102, 23681 0x00102 23682 ]); 23683 var distDecode = new Int32Array([ 23684 0x00001, 23685 0x00002, 23686 0x00003, 23687 0x00004, 23688 0x10005, 23689 0x10007, 23690 0x20009, 23691 0x2000d, 23692 0x30011, 23693 0x30019, 23694 0x40021, 23695 0x40031, 23696 0x50041, 23697 0x50061, 23698 0x60081, 23699 0x600c1, 23700 0x70101, 23701 0x70181, 23702 0x80201, 23703 0x80301, 23704 0x90401, 23705 0x90601, 23706 0xa0801, 23707 0xa0c01, 23708 0xb1001, 23709 0xb1801, 23710 0xc2001, 23711 0xc3001, 23712 0xd4001, 23713 0xd6001 23714 ]);
23715 var fixedLitCodeTab = [ 23716 new Int32Array([ 23717 0x70100, 23718 0x80050, 23719 0x80010, 23720 0x80118, 23721 0x70110, 23722 0x80070, 23723 0x80030, 23724 0x900c0, 23725 0x70108, 23726 0x80060, 23727 0x80020, 23728 0x900a0, 23729 0x80000, 23730 0x80080, 23731 0x80040, 23732 0x900e0, 23733 0x70104, 23734 0x80058, 23735 0x80018, 23736 0x90090, 23737 0x70114, 23738 0x80078, 23739 0x80038, 23740 0x900d0, 23741 0x7010c, 23742 0x80068, 23743 0x80028, 23744 0x900b0, 23745 0x80008, 23746 0x80088, 23747 0x80048, 23748 0x900f0, 23749 0x70102, 23750 0x80054, 23751 0x80014, 23752 0x8011c, 23753 0x70112, 23754 0x80074, 23755 0x80034, 23756 0x900c8, 23757 0x7010a, 23758 0x80064, 23759 0x80024, 23760 0x900a8, 23761 0x80004, 23762 0x80084, 23763 0x80044, 23764 0x900e8, 23765 0x70106, 23766 0x8005c, 23767 0x8001c, 23768 0x90098, 23769 0x70116, 23770 0x8007c, 23771 0x8003c, 23772 0x900d8, 23773 0x7010e, 23774 0x8006c, 23775 0x8002c, 23776 0x900b8, 23777 0x8000c, 23778 0x8008c, 23779 0x8004c, 23780 0x900f8, 23781 0x70101, 23782 0x80052, 23783 0x80012, 23784 0x8011a, 23785 0x70111, 23786 0x80072, 23787 0x80032, 23788 0x900c4, 23789 0x70109, 23790 0x80062, 23791 0x80022, 23792 0x900a4, 23793 0x80002, 23794 0x80082, 23795 0x80042, 23796 0x900e4, 23797 0x70105, 23798 0x8005a, 23799 0x8001a, 23800 0x90094, 23801 0x70115, 23802 0x8007a, 23803 0x8003a, 23804 0x900d4, 23805 0x7010d, 23806 0x8006a, 23807 0x8002a, 23808 0x900b4, 23809 0x8000a, 23810 0x8008a, 23811 0x8004a, 23812 0x900f4, 23813 0x70103, 23814 0x80056, 23815 0x80016, 23816 0x8011e, 23817 0x70113, 23818 0x80076, 23819 0x80036, 23820 0x900cc, 23821 0x7010b, 23822 0x80066, 23823 0x80026, 23824 0x900ac, 23825 0x80006, 23826 0x80086, 23827 0x80046, 23828 0x900ec, 23829 0x70107, 23830 0x8005e, 23831 0x8001e, 23832 0x9009c, 23833 0x70117, 23834 0x8007e, 23835 0x8003e, 23836 0x900dc, 23837 0x7010f, 23838 0x8006e, 23839 0x8002e, 23840 0x900bc, 23841 0x8000e, 23842 0x8008e, 23843 0x8004e, 23844 0x900fc, 23845 0x70100, 23846 0x80051, 23847 0x80011, 23848 0x80119, 23849 0x70110, 23850 0x80071, 23851 0x80031, 23852 0x900c2, 23853 0x70108, 23854 0x80061, 23855 0x80021, 23856 0x900a2, 23857 0x80001, 23858 0x80081, 23859 0x80041, 23860 0x900e2, 23861 0x70104, 23862 0x80059, 23863 0x80019, 23864 0x90092, 23865 0x70114, 23866 0x80079, 23867 0x80039, 23868 0x900d2, 23869 0x7010c, 23870 0x80069, 23871 0x80029, 23872 0x900b2, 23873 0x80009, 23874 0x80089, 23875 0x80049, 23876 0x900f2, 23877 0x70102, 23878 0x80055, 23879 0x80015, 23880 0x8011d, 23881 0x70112, 23882 0x80075, 23883 0x80035, 23884 0x900ca, 23885 0x7010a, 23886 0x80065, 23887 0x80025, 23888 0x900aa, 23889 0x80005, 23890 0x80085, 23891 0x80045, 23892 0x900ea, 23893 0x70106, 23894 0x8005d, 23895 0x8001d, 23896 0x9009a, 23897 0x70116, 23898 0x8007d, 23899 0x8003d, 23900 0x900da, 23901 0x7010e, 23902 0x8006d, 23903 0x8002d, 23904 0x900ba, 23905 0x8000d, 23906 0x8008d, 23907 0x8004d, 23908 0x900fa, 23909 0x70101, 23910 0x80053, 23911 0x80013, 23912 0x8011b, 23913 0x70111, 23914 0x80073, 23915 0x80033, 23916 0x900c6, 23917 0x70109, 23918 0x80063, 23919 0x80023, 23920 0x900a6, 23921 0x80003, 23922 0x80083, 23923 0x80043, 23924 0x900e6, 23925 0x70105, 23926 0x8005b, 23927 0x8001b, 23928 0x90096, 23929 0x70115, 23930 0x8007b, 23931 0x8003b, 23932 0x900d6, 23933 0x7010d, 23934 0x8006b, 23935 0x8002b, 23936 0x900b6, 23937 0x8000b, 23938 0x8008b, 23939 0x8004b, 23940 0x900f6, 23941 0x70103, 23942 0x80057, 23943 0x80017, 23944 0x8011f, 23945 0x70113, 23946 0x80077, 23947 0x80037, 23948 0x900ce, 23949 0x7010b, 23950 0x80067, 23951 0x80027, 23952 0x900ae, 23953 0x80007, 23954 0x80087, 23955 0x80047, 23956 0x900ee, 23957 0x70107, 23958 0x8005f, 23959 0x8001f, 23960 0x9009e, 23961 0x70117, 23962 0x8007f, 23963 0x8003f, 23964 0x900de, 23965 0x7010f, 23966 0x8006f, 23967 0x8002f, 23968 0x900be, 23969 0x8000f, 23970 0x8008f, 23971 0x8004f, 23972 0x900fe, 23973 0x70100, 23974 0x80050, 23975 0x80010, 23976 0x80118, 23977 0x70110, 23978 0x80070, 23979 0x80030, 23980 0x900c1, 23981 0x70108, 23982 0x80060, 23983 0x80020, 23984 0x900a1, 23985 0x80000, 23986 0x80080, 23987 0x80040, 23988 0x900e1, 23989 0x70104, 23990 0x80058, 23991 0x80018, 23992 0x90091, 23993 0x70114, 23994 0x80078, 23995 0x80038, 23996 0x900d1, 23997 0x7010c, 23998 0x80068, 23999 0x80028, 24000 0x900b1, 24001 0x80008, 24002 0x80088, 24003 0x80048, 24004 0x900f1, 24005 0x70102, 24006 0x80054, 24007 0x80014, 24008 0x8011c, 24009 0x70112, 24010 0x80074, 24011 0x80034, 24012 0x900c9, 24013 0x7010a, 24014 0x80064, 24015 0x80024, 24016 0x900a9, 24017 0x80004, 24018 0x80084, 24019 0x80044, 24020 0x900e9, 24021 0x70106, 24022 0x8005c, 24023 0x8001c, 24024 0x90099, 24025 0x70116, 24026 0x8007c, 24027 0x8003c, 24028 0x900d9, 24029 0x7010e, 24030 0x8006c, 24031 0x8002c, 24032 0x900b9, 24033 0x8000c, 24034 0x8008c, 24035 0x8004c, 24036 0x900f9, 24037 0x70101, 24038 0x80052, 24039 0x80012, 24040 0x8011a, 24041 0x70111, 24042 0x80072, 24043 0x80032, 24044 0x900c5, 24045 0x70109, 24046 0x80062, 24047 0x80022, 24048 0x900a5, 24049 0x80002, 24050 0x80082, 24051 0x80042, 24052 0x900e5, 24053 0x70105, 24054 0x8005a, 24055 0x8001a, 24056 0x90095, 24057 0x70115, 24058 0x8007a, 24059 0x8003a, 24060 0x900d5, 24061 0x7010d, 24062 0x8006a, 24063 0x8002a, 24064 0x900b5, 24065 0x8000a, 24066 0x8008a, 24067 0x8004a, 24068 0x900f5, 24069 0x70103, 24070 0x80056, 24071 0x80016, 24072 0x8011e, 24073 0x70113, 24074 0x80076, 24075 0x80036, 24076 0x900cd, 24077 0x7010b, 24078 0x80066, 24079 0x80026, 24080 0x900ad, 24081 0x80006, 24082 0x80086, 24083 0x80046, 24084 0x900ed, 24085 0x70107, 24086 0x8005e, 24087 0x8001e, 24088 0x9009d, 24089 0x70117, 24090 0x8007e, 24091 0x8003e, 24092 0x900dd, 24093 0x7010f, 24094 0x8006e, 24095 0x8002e, 24096 0x900bd, 24097 0x8000e, 24098 0x8008e, 24099 0x8004e, 24100 0x900fd, 24101 0x70100, 24102 0x80051, 24103 0x80011, 24104 0x80119, 24105 0x70110, 24106 0x80071, 24107 0x80031, 24108 0x900c3, 24109 0x70108, 24110 0x80061, 24111 0x80021, 24112 0x900a3, 24113 0x80001, 24114 0x80081, 24115 0x80041, 24116 0x900e3, 24117 0x70104, 24118 0x80059, 24119 0x80019, 24120 0x90093, 24121 0x70114, 24122 0x80079, 24123 0x80039, 24124 0x900d3, 24125 0x7010c, 24126 0x80069, 24127 0x80029, 24128 0x900b3, 24129 0x80009, 24130 0x80089, 24131 0x80049, 24132 0x900f3, 24133 0x70102, 24134 0x80055, 24135 0x80015, 24136 0x8011d, 24137 0x70112, 24138 0x80075, 24139 0x80035, 24140 0x900cb, 24141 0x7010a, 24142 0x80065, 24143 0x80025, 24144 0x900ab, 24145 0x80005, 24146 0x80085, 24147 0x80045, 24148 0x900eb, 24149 0x70106, 24150 0x8005d, 24151 0x8001d, 24152 0x9009b, 24153 0x70116, 24154 0x8007d, 24155 0x8003d, 24156 0x900db, 24157 0x7010e, 24158 0x8006d, 24159 0x8002d, 24160 0x900bb, 24161 0x8000d, 24162 0x8008d, 24163 0x8004d, 24164 0x900fb, 24165 0x70101, 24166 0x80053, 24167 0x80013, 24168 0x8011b, 24169 0x70111, 24170 0x80073, 24171 0x80033, 24172 0x900c7, 24173 0x70109, 24174 0x80063, 24175 0x80023, 24176 0x900a7, 24177 0x80003, 24178 0x80083, 24179 0x80043, 24180 0x900e7, 24181 0x70105, 24182 0x8005b, 24183 0x8001b, 24184 0x90097, 24185 0x70115, 24186 0x8007b, 24187 0x8003b, 24188 0x900d7, 24189 0x7010d, 24190 0x8006b, 24191 0x8002b, 24192 0x900b7, 24193 0x8000b, 24194 0x8008b, 24195 0x8004b, 24196 0x900f7, 24197 0x70103, 24198 0x80057, 24199 0x80017, 24200 0x8011f, 24201 0x70113, 24202 0x80077, 24203 0x80037, 24204 0x900cf, 24205 0x7010b, 24206 0x80067, 24207 0x80027, 24208 0x900af, 24209 0x80007, 24210 0x80087, 24211 0x80047, 24212 0x900ef, 24213 0x70107, 24214 0x8005f, 24215 0x8001f, 24216 0x9009f, 24217 0x70117, 24218 0x8007f, 24219 0x8003f, 24220 0x900df, 24221 0x7010f, 24222 0x8006f, 24223 0x8002f, 24224 0x900bf, 24225 0x8000f, 24226 0x8008f, 24227 0x8004f, 24228 0x900ff 24229 ]), 24230 9 24231 ]; 24232 var fixedDistCodeTab = [ 24233 new Int32Array([ 24234 0x50000, 24235 0x50010, 24236 0x50008, 24237 0x50018, 24238 0x50004, 24239 0x50014, 24240 0x5000c, 24241 0x5001c, 24242 0x50002, 24243 0x50012, 24244 0x5000a, 24245 0x5001a, 24246 0x50006, 24247 0x50016, 24248 0x5000e, 24249 0x00000, 24250 0x50001, 24251 0x50011, 24252 0x50009, 24253 0x50019, 24254 0x50005, 24255 0x50015, 24256 0x5000d, 24257 0x5001d, 24258 0x50003, 24259 0x50013, 24260 0x5000b, 24261 0x5001b, 24262 0x50007, 24263 0x50017, 24264 0x5000f, 24265 0x00000 24266 ]), 24267 5 24268 ]; 24269 function FlateStream(str, maybeLength) { 24270 this.str = str; 24271 this.dict = str.dict; 24272 var cmf = str.getByte(); 24273 var flg = str.getByte(); 24274 if (cmf === -1 || flg === -1) { 24275 error('Invalid header in flate stream: ' + cmf + ', ' + flg); 24276 } 24277 if ((cmf & 0x0f) !== 0x08) { 24278 error('Unknown compression method in flate stream: ' + cmf + ', ' + flg); 24279 } 24280 if (((cmf << 8) + flg) % 31 !== 0) { 24281 error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg); 24282 } 24283 if (flg & 0x20) { 24284 error('FDICT bit set in flate stream: ' + cmf + ', ' + flg); 24285 } 24286 this.codeSize = 0; 24287 this.codeBuf = 0; 24288 DecodeStream.call(this, maybeLength); 24289 } 24290 FlateStream.prototype = Object.create(DecodeStream.prototype); 24291 FlateStream.prototype.getBits = function FlateStream_getBits(bits) { 24292 var str = this.str;
24293 var codeSize = this.codeSize; 24294 var codeBuf = this.codeBuf; 24295 var b; 24296 while (codeSize < bits) { 24297 if ((b = str.getByte()) === -1) { 24298 error('Bad encoding in flate stream'); 24299 } 24300 codeBuf |= b << codeSize; 24301 codeSize += 8; 24302 } 24303 b = codeBuf & (1 << bits) - 1; 24304 this.codeBuf = codeBuf >> bits; 24305 this.codeSize = codeSize -= bits; 24306 return b; 24307 }; 24308 FlateStream.prototype.getCode = function FlateStream_getCode(table) { 24309 var str = this.str; 24310 var codes = table[0]; 24311 var maxLen = table[1]; 24312 var codeSize = this.codeSize; 24313 var codeBuf = this.codeBuf; 24314 var b; 24315 while (codeSize < maxLen) { 24316 if ((b = str.getByte()) === -1) { 24317 break; 24318 } 24319 codeBuf |= b << codeSize; 24320 codeSize += 8; 24321 } 24322 var code = codes[codeBuf & (1 << maxLen) - 1]; 24323 var codeLen = code >> 16; 24324 var codeVal = code & 0xffff; 24325 if (codeLen < 1 || codeSize < codeLen) { 24326 error('Bad encoding in flate stream'); 24327 } 24328 this.codeBuf = codeBuf >> codeLen; 24329 this.codeSize = codeSize - codeLen; 24330 return codeVal; 24331 }; 24332 FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) { 24333 var n = lengths.length; 24334 var maxLen = 0; 24335 var i; 24336 for (i = 0; i < n; ++i) { 24337 if (lengths[i] > maxLen) { 24338 maxLen = lengths[i]; 24339 } 24340 } 24341 var size = 1 << maxLen; 24342 var codes = new Int32Array(size); 24343 for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 24344 for (var val = 0; val < n; ++val) { 24345 if (lengths[val] === len) { 24346 var code2 = 0; 24347 var t = code; 24348 for (i = 0; i < len; ++i) { 24349 code2 = code2 << 1 | t & 1; 24350 t >>= 1; 24351 } 24352 for (i = code2; i < size; i += skip) { 24353 codes[i] = len << 16 | val; 24354 } 24355 ++code; 24356 } 24357 } 24358 } 24359 return [ 24360 codes, 24361 maxLen 24362 ]; 24363 }; 24364 FlateStream.prototype.readBlock = function FlateStream_readBlock() { 24365 var buffer, len; 24366 var str = this.str; 24367 var hdr = this.getBits(3); 24368 if (hdr & 1) { 24369 this.eof = true; 24370 } 24371 hdr >>= 1; 24372 if (hdr === 0) { 24373 var b; 24374 if ((b = str.getByte()) === -1) { 24375 error('Bad block header in flate stream'); 24376 } 24377 var blockLen = b; 24378 if ((b = str.getByte()) === -1) { 24379 error('Bad block header in flate stream'); 24380 } 24381 blockLen |= b << 8; 24382 if ((b = str.getByte()) === -1) { 24383 error('Bad block header in flate stream'); 24384 } 24385 var check = b; 24386 if ((b = str.getByte()) === -1) { 24387 error('Bad block header in flate stream'); 24388 } 24389 check |= b << 8; 24390 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 24391 error('Bad uncompressed block length in flate stream'); 24392 } 24393 this.codeBuf = 0; 24394 this.codeSize = 0; 24395 var bufferLength = this.bufferLength; 24396 buffer = this.ensureBuffer(bufferLength + blockLen); 24397 var end = bufferLength + blockLen; 24398 this.bufferLength = end; 24399 if (blockLen === 0) { 24400 if (str.peekByte() === -1) { 24401 this.eof = true; 24402 } 24403 } else { 24404 for (var n = bufferLength; n < end; ++n) { 24405 if ((b = str.getByte()) === -1) { 24406 this.eof = true; 24407 break; 24408 } 24409 buffer[n] = b; 24410 } 24411 } 24412 return; 24413 } 24414 var litCodeTable; 24415 var distCodeTable; 24416 if (hdr === 1) { 24417 litCodeTable = fixedLitCodeTab; 24418 distCodeTable = fixedDistCodeTab; 24419 } else if (hdr === 2) { 24420 var numLitCodes = this.getBits(5) + 257; 24421 var numDistCodes = this.getBits(5) + 1; 24422 var numCodeLenCodes = this.getBits(4) + 4; 24423 var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 24424 var i; 24425 for (i = 0; i < numCodeLenCodes; ++i) { 24426 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 24427 } 24428 var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 24429 len = 0; 24430 i = 0; 24431 var codes = numLitCodes + numDistCodes; 24432 var codeLengths = new Uint8Array(codes); 24433 var bitsLength, bitsOffset, what; 24434 while (i < codes) { 24435 var code = this.getCode(codeLenCodeTab); 24436 if (code === 16) { 24437 bitsLength = 2; 24438 bitsOffset = 3; 24439 what = len; 24440 } else if (code === 17) { 24441 bitsLength = 3; 24442 bitsOffset = 3; 24443 what = len = 0; 24444 } else if (code === 18) { 24445 bitsLength = 7; 24446 bitsOffset = 11; 24447 what = len = 0; 24448 } else { 24449 codeLengths[i++] = len = code; 24450 continue; 24451 } 24452 var repeatLength = this.getBits(bitsLength) + bitsOffset; 24453 while (repeatLength-- > 0) { 24454 codeLengths[i++] = what; 24455 } 24456 } 24457 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 24458 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 24459 } else { 24460 error('Unknown block type in flate stream'); 24461 } 24462 buffer = this.buffer; 24463 var limit = buffer ? buffer.length : 0; 24464 var pos = this.bufferLength; 24465 while (true) { 24466 var code1 = this.getCode(litCodeTable); 24467 if (code1 < 256) { 24468 if (pos + 1 >= limit) { 24469 buffer = this.ensureBuffer(pos + 1); 24470 limit = buffer.length; 24471 } 24472 buffer[pos++] = code1; 24473 continue; 24474 } 24475 if (code1 === 256) { 24476 this.bufferLength = pos; 24477 return; 24478 } 24479 code1 -= 257; 24480 code1 = lengthDecode[code1]; 24481 var code2 = code1 >> 16; 24482 if (code2 > 0) { 24483 code2 = this.getBits(code2); 24484 } 24485 len = (code1 & 0xffff) + code2;
24486 code1 = this.getCode(distCodeTable); 24487 code1 = distDecode[code1]; 24488 code2 = code1 >> 16; 24489 if (code2 > 0) { 24490 code2 = this.getBits(code2); 24491 } 24492 var dist = (code1 & 0xffff) + code2; 24493 if (pos + len >= limit) { 24494 buffer = this.ensureBuffer(pos + len); 24495 limit = buffer.length; 24496 } 24497 for (var k = 0; k < len; ++k, ++pos) { 24498 buffer[pos] = buffer[pos - dist]; 24499 } 24500 } 24501 }; 24502 return FlateStream; 24503 }(); 24504 var PredictorStream = function PredictorStreamClosure() { 24505 function PredictorStream(str, maybeLength, params) { 24506 if (!isDict(params)) { 24507 return str; 24508 } 24509 var predictor = this.predictor = params.get('Predictor') || 1; 24510 if (predictor <= 1) { 24511 return str; 24512 } 24513 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 24514 error('Unsupported predictor: ' + predictor); 24515 } 24516 if (predictor === 2) { 24517 this.readBlock = this.readBlockTiff; 24518 } else { 24519 this.readBlock = this.readBlockPng; 24520 } 24521 this.str = str; 24522 this.dict = str.dict; 24523 var colors = this.colors = params.get('Colors') || 1; 24524 var bits = this.bits = params.get('BitsPerComponent') || 8; 24525 var columns = this.columns = params.get('Columns') || 1; 24526 this.pixBytes = colors * bits + 7 >> 3; 24527 this.rowBytes = columns * colors * bits + 7 >> 3; 24528 DecodeStream.call(this, maybeLength); 24529 return this; 24530 } 24531 PredictorStream.prototype = Object.create(DecodeStream.prototype); 24532 PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() { 24533 var rowBytes = this.rowBytes; 24534 var bufferLength = this.bufferLength; 24535 var buffer = this.ensureBuffer(bufferLength + rowBytes); 24536 var bits = this.bits; 24537 var colors = this.colors; 24538 var rawBytes = this.str.getBytes(rowBytes); 24539 this.eof = !rawBytes.length; 24540 if (this.eof) { 24541 return; 24542 } 24543 var inbuf = 0, outbuf = 0; 24544 var inbits = 0, outbits = 0; 24545 var pos = bufferLength; 24546 var i; 24547 if (bits === 1 && colors === 1) { 24548 for (i = 0; i < rowBytes; ++i) { 24549 var c = rawBytes[i] ^ inbuf; 24550 c ^= c >> 1; 24551 c ^= c >> 2; 24552 c ^= c >> 4; 24553 inbuf = (c & 1) << 7; 24554 buffer[pos++] = c; 24555 } 24556 } else if (bits === 8) { 24557 for (i = 0; i < colors; ++i) { 24558 buffer[pos++] = rawBytes[i]; 24559 } 24560 for (; i < rowBytes; ++i) { 24561 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 24562 pos++; 24563 } 24564 } else { 24565 var compArray = new Uint8Array(colors + 1); 24566 var bitMask = (1 << bits) - 1; 24567 var j = 0, k = bufferLength; 24568 var columns = this.columns; 24569 for (i = 0; i < columns; ++i) { 24570 for (var kk = 0; kk < colors; ++kk) { 24571 if (inbits < bits) { 24572 inbuf = inbuf << 8 | rawBytes[j++] & 0xFF; 24573 inbits += 8; 24574 } 24575 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 24576 inbits -= bits; 24577 outbuf = outbuf << bits | compArray[kk]; 24578 outbits += bits; 24579 if (outbits >= 8) { 24580 buffer[k++] = outbuf >> outbits - 8 & 0xFF; 24581 outbits -= 8; 24582 } 24583 } 24584 } 24585 if (outbits > 0) { 24586 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 24587 } 24588 } 24589 this.bufferLength += rowBytes; 24590 }; 24591 PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() { 24592 var rowBytes = this.rowBytes; 24593 var pixBytes = this.pixBytes; 24594 var predictor = this.str.getByte(); 24595 var rawBytes = this.str.getBytes(rowBytes); 24596 this.eof = !rawBytes.length; 24597 if (this.eof) { 24598 return; 24599 } 24600 var bufferLength = this.bufferLength; 24601 var buffer = this.ensureBuffer(bufferLength + rowBytes); 24602 var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 24603 if (prevRow.length === 0) { 24604 prevRow = new Uint8Array(rowBytes); 24605 } 24606 var i, j = bufferLength, up, c; 24607 switch (predictor) { 24608 case 0: 24609 for (i = 0; i < rowBytes; ++i) { 24610 buffer[j++] = rawBytes[i]; 24611 } 24612 break; 24613 case 1: 24614 for (i = 0; i < pixBytes; ++i) { 24615 buffer[j++] = rawBytes[i]; 24616 } 24617 for (; i < rowBytes; ++i) { 24618 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF; 24619 j++; 24620 } 24621 break; 24622 case 2: 24623 for (i = 0; i < rowBytes; ++i) { 24624 buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF; 24625 } 24626 break; 24627 case 3: 24628 for (i = 0; i < pixBytes; ++i) { 24629 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 24630 } 24631 for (; i < rowBytes; ++i) { 24632 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF; 24633 j++; 24634 } 24635 break; 24636 case 4: 24637 for (i = 0; i < pixBytes; ++i) { 24638 up = prevRow[i]; 24639 c = rawBytes[i]; 24640 buffer[j++] = up + c; 24641 } 24642 for (; i < rowBytes; ++i) { 24643 up = prevRow[i]; 24644 var upLeft = prevRow[i - pixBytes]; 24645 var left = buffer[j - pixBytes]; 24646 var p = left + up - upLeft; 24647 var pa = p - left; 24648 if (pa < 0) { 24649 pa = -pa; 24650 } 24651 var pb = p - up; 24652 if (pb < 0) { 24653 pb = -pb; 24654 } 24655 var pc = p - upLeft; 24656 if (pc < 0) { 24657 pc = -pc; 24658 } 24659 c = rawBytes[i]; 24660 if (pa <= pb && pa <= pc) { 24661 buffer[j++] = left + c; 24662 } else if (pb <= pc) { 24663 buffer[j++] = up + c; 24664 } else { 24665 buffer[j++] = upLeft + c; 24666 } 24667 } 24668 break; 24669 default: 24670 error('Unsupported predictor: ' + predictor); 24671 } 24672 this.bufferLength += rowBytes; 24673 }; 24674 return PredictorStream; 24675 }(); 24676 var JpegStream = function JpegStreamClosure() { 24677 function JpegStream(stream, maybeLength, dict, params) { 24678 var ch; 24679 while ((ch = stream.getByte()) !== -1) { 24680 if (ch === 0xFF) { 24681 stream.skip(-1); 24682 break; 24683 } 24684 } 24685 this.stream = stream; 24686 this.maybeLength = maybeLength; 24687 this.dict = dict; 24688 this.params = params; 24689 DecodeStream.call(this, maybeLength); 24690 } 24691 JpegStream.prototype = Object.create(DecodeStream.prototype);
24692 Object.defineProperty(JpegStream.prototype, 'bytes', { 24693 get: function JpegStream_bytes() { 24694 return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); 24695 }, 24696 configurable: true 24697 }); 24698 JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) { 24699 if (this.bufferLength) { 24700 return; 24701 } 24702 var jpegImage = new JpegImage(); 24703 var decodeArr = this.dict.getArray('Decode', 'D'); 24704 if (this.forceRGB && isArray(decodeArr)) { 24705 var bitsPerComponent = this.dict.get('BitsPerComponent') || 8; 24706 var decodeArrLength = decodeArr.length; 24707 var transform = new Int32Array(decodeArrLength); 24708 var transformNeeded = false; 24709 var maxValue = (1 << bitsPerComponent) - 1; 24710 for (var i = 0; i < decodeArrLength; i += 2) { 24711 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 24712 transform[i + 1] = decodeArr[i] * maxValue | 0; 24713 if (transform[i] !== 256 || transform[i + 1] !== 0) { 24714 transformNeeded = true; 24715 } 24716 } 24717 if (transformNeeded) { 24718 jpegImage.decodeTransform = transform; 24719 } 24720 } 24721 if (isDict(this.params)) { 24722 var colorTransform = this.params.get('ColorTransform'); 24723 if (isInt(colorTransform)) { 24724 jpegImage.colorTransform = colorTransform; 24725 } 24726 } 24727 jpegImage.parse(this.bytes); 24728 var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB); 24729 this.buffer = data; 24730 this.bufferLength = data.length; 24731 this.eof = true; 24732 }; 24733 JpegStream.prototype.getBytes = function JpegStream_getBytes(length) { 24734 this.ensureBuffer(); 24735 return this.buffer; 24736 }; 24737 JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) { 24738 return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema); 24739 }; 24740 return JpegStream; 24741 }(); 24742 var JpxStream = function JpxStreamClosure() { 24743 function JpxStream(stream, maybeLength, dict, params) { 24744 this.stream = stream; 24745 this.maybeLength = maybeLength; 24746 this.dict = dict; 24747 this.params = params; 24748 DecodeStream.call(this, maybeLength); 24749 } 24750 JpxStream.prototype = Object.create(DecodeStream.prototype); 24751 Object.defineProperty(JpxStream.prototype, 'bytes', { 24752 get: function JpxStream_bytes() { 24753 return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); 24754 }, 24755 configurable: true 24756 }); 24757 JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) { 24758 if (this.bufferLength) { 24759 return; 24760 } 24761 var jpxImage = new JpxImage(); 24762 jpxImage.parse(this.bytes); 24763 var width = jpxImage.width; 24764 var height = jpxImage.height; 24765 var componentsCount = jpxImage.componentsCount; 24766 var tileCount = jpxImage.tiles.length; 24767 if (tileCount === 1) { 24768 this.buffer = jpxImage.tiles[0].items; 24769 } else { 24770 var data = new Uint8Array(width * height * componentsCount); 24771 for (var k = 0; k < tileCount; k++) { 24772 var tileComponents = jpxImage.tiles[k]; 24773 var tileWidth = tileComponents.width; 24774 var tileHeight = tileComponents.height; 24775 var tileLeft = tileComponents.left; 24776 var tileTop = tileComponents.top; 24777 var src = tileComponents.items; 24778 var srcPosition = 0; 24779 var dataPosition = (width * tileTop + tileLeft) * componentsCount; 24780 var imgRowSize = width * componentsCount; 24781 var tileRowSize = tileWidth * componentsCount; 24782 for (var j = 0; j < tileHeight; j++) { 24783 var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 24784 data.set(rowBytes, dataPosition); 24785 srcPosition += tileRowSize; 24786 dataPosition += imgRowSize; 24787 } 24788 } 24789 this.buffer = data; 24790 } 24791 this.bufferLength = this.buffer.length; 24792 this.eof = true; 24793 }; 24794 return JpxStream; 24795 }(); 24796 var Jbig2Stream = function Jbig2StreamClosure() { 24797 function Jbig2Stream(stream, maybeLength, dict, params) { 24798 this.stream = stream; 24799 this.maybeLength = maybeLength; 24800 this.dict = dict; 24801 this.params = params; 24802 DecodeStream.call(this, maybeLength); 24803 } 24804 Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
24805 Object.defineProperty(Jbig2Stream.prototype, 'bytes', { 24806 get: function Jbig2Stream_bytes() { 24807 return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); 24808 }, 24809 configurable: true 24810 }); 24811 Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) { 24812 if (this.bufferLength) { 24813 return; 24814 } 24815 var jbig2Image = new Jbig2Image(); 24816 var chunks = []; 24817 if (isDict(this.params)) { 24818 var globalsStream = this.params.get('JBIG2Globals'); 24819 if (isStream(globalsStream)) { 24820 var globals = globalsStream.getBytes(); 24821 chunks.push({ 24822 data: globals, 24823 start: 0, 24824 end: globals.length 24825 }); 24826 } 24827 } 24828 chunks.push({ 24829 data: this.bytes, 24830 start: 0, 24831 end: this.bytes.length 24832 }); 24833 var data = jbig2Image.parseChunks(chunks); 24834 var dataLength = data.length; 24835 for (var i = 0; i < dataLength; i++) { 24836 data[i] ^= 0xFF; 24837 } 24838 this.buffer = data; 24839 this.bufferLength = dataLength; 24840 this.eof = true; 24841 }; 24842 return Jbig2Stream; 24843 }(); 24844 var DecryptStream = function DecryptStreamClosure() { 24845 function DecryptStream(str, maybeLength, decrypt) { 24846 this.str = str; 24847 this.dict = str.dict; 24848 this.decrypt = decrypt; 24849 this.nextChunk = null; 24850 this.initialized = false; 24851 DecodeStream.call(this, maybeLength); 24852 } 24853 var chunkSize = 512; 24854 DecryptStream.prototype = Object.create(DecodeStream.prototype); 24855 DecryptStream.prototype.readBlock = function DecryptStream_readBlock() { 24856 var chunk; 24857 if (this.initialized) { 24858 chunk = this.nextChunk; 24859 } else { 24860 chunk = this.str.getBytes(chunkSize); 24861 this.initialized = true; 24862 } 24863 if (!chunk || chunk.length === 0) { 24864 this.eof = true; 24865 return; 24866 } 24867 this.nextChunk = this.str.getBytes(chunkSize); 24868 var hasMoreData = this.nextChunk && this.nextChunk.length > 0; 24869 var decrypt = this.decrypt; 24870 chunk = decrypt(chunk, !hasMoreData); 24871 var bufferLength = this.bufferLength; 24872 var i, n = chunk.length; 24873 var buffer = this.ensureBuffer(bufferLength + n); 24874 for (i = 0; i < n; i++) { 24875 buffer[bufferLength++] = chunk[i]; 24876 } 24877 this.bufferLength = bufferLength; 24878 }; 24879 return DecryptStream; 24880 }(); 24881 var Ascii85Stream = function Ascii85StreamClosure() { 24882 function Ascii85Stream(str, maybeLength) { 24883 this.str = str; 24884 this.dict = str.dict; 24885 this.input = new Uint8Array(5); 24886 if (maybeLength) { 24887 maybeLength = 0.8 * maybeLength; 24888 } 24889 DecodeStream.call(this, maybeLength); 24890 } 24891 Ascii85Stream.prototype = Object.create(DecodeStream.prototype); 24892 Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() { 24893 var TILDA_CHAR = 0x7E; 24894 var Z_LOWER_CHAR = 0x7A; 24895 var EOF = -1; 24896 var str = this.str; 24897 var c = str.getByte(); 24898 while (isSpace(c)) { 24899 c = str.getByte(); 24900 } 24901 if (c === EOF || c === TILDA_CHAR) { 24902 this.eof = true; 24903 return; 24904 } 24905 var bufferLength = this.bufferLength, buffer; 24906 var i; 24907 if (c === Z_LOWER_CHAR) { 24908 buffer = this.ensureBuffer(bufferLength + 4); 24909 for (i = 0; i < 4; ++i) { 24910 buffer[bufferLength + i] = 0; 24911 } 24912 this.bufferLength += 4; 24913 } else { 24914 var input = this.input; 24915 input[0] = c; 24916 for (i = 1; i < 5; ++i) { 24917 c = str.getByte(); 24918 while (isSpace(c)) { 24919 c = str.getByte(); 24920 } 24921 input[i] = c; 24922 if (c === EOF || c === TILDA_CHAR) { 24923 break; 24924 } 24925 } 24926 buffer = this.ensureBuffer(bufferLength + i - 1); 24927 this.bufferLength += i - 1; 24928 if (i < 5) { 24929 for (; i < 5; ++i) { 24930 input[i] = 0x21 + 84; 24931 } 24932 this.eof = true; 24933 } 24934 var t = 0; 24935 for (i = 0; i < 5; ++i) { 24936 t = t * 85 + (input[i] - 0x21); 24937 } 24938 for (i = 3; i >= 0; --i) { 24939 buffer[bufferLength + i] = t & 0xFF; 24940 t >>= 8; 24941 } 24942 } 24943 }; 24944 return Ascii85Stream; 24945 }(); 24946 var AsciiHexStream = function AsciiHexStreamClosure() { 24947 function AsciiHexStream(str, maybeLength) { 24948 this.str = str; 24949 this.dict = str.dict; 24950 this.firstDigit = -1; 24951 if (maybeLength) { 24952 maybeLength = 0.5 * maybeLength; 24953 } 24954 DecodeStream.call(this, maybeLength); 24955 } 24956 AsciiHexStream.prototype = Object.create(DecodeStream.prototype); 24957 AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() { 24958 var UPSTREAM_BLOCK_SIZE = 8000; 24959 var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 24960 if (!bytes.length) { 24961 this.eof = true; 24962 return; 24963 } 24964 var maxDecodeLength = bytes.length + 1 >> 1; 24965 var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 24966 var bufferLength = this.bufferLength; 24967 var firstDigit = this.firstDigit; 24968 for (var i = 0, ii = bytes.length; i < ii; i++) { 24969 var ch = bytes[i], digit; 24970 if (ch >= 0x30 && ch <= 0x39) { 24971 digit = ch & 0x0F; 24972 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 24973 digit = (ch & 0x0F) + 9; 24974 } else if (ch === 0x3E) { 24975 this.eof = true; 24976 break; 24977 } else { 24978 continue; 24979 } 24980 if (firstDigit < 0) { 24981 firstDigit = digit; 24982 } else { 24983 buffer[bufferLength++] = firstDigit << 4 | digit; 24984 firstDigit = -1; 24985 } 24986 } 24987 if (firstDigit >= 0 && this.eof) { 24988 buffer[bufferLength++] = firstDigit << 4; 24989 firstDigit = -1; 24990 } 24991 this.firstDigit = firstDigit; 24992 this.bufferLength = bufferLength; 24993 }; 24994 return AsciiHexStream; 24995 }(); 24996 var RunLengthStream = function RunLengthStreamClosure() { 24997 function RunLengthStream(str, maybeLength) { 24998 this.str = str; 24999 this.dict = str.dict; 25000 DecodeStream.call(this, maybeLength); 25001 } 25002 RunLengthStream.prototype = Object.create(DecodeStream.prototype); 25003 RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() { 25004 var repeatHeader = this.str.getBytes(2); 25005 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 25006 this.eof = true; 25007 return; 25008 } 25009 var buffer; 25010 var bufferLength = this.bufferLength; 25011 var n = repeatHeader[0]; 25012 if (n < 128) { 25013 buffer = this.ensureBuffer(bufferLength + n + 1); 25014 buffer[bufferLength++] = repeatHeader[1]; 25015 if (n > 0) { 25016 var source = this.str.getBytes(n); 25017 buffer.set(source, bufferLength); 25018 bufferLength += n; 25019 } 25020 } else { 25021 n = 257 - n; 25022 var b = repeatHeader[1]; 25023 buffer = this.ensureBuffer(bufferLength + n + 1); 25024 for (var i = 0; i < n; i++) { 25025 buffer[bufferLength++] = b; 25026 } 25027 } 25028 this.bufferLength = bufferLength; 25029 }; 25030 return RunLengthStream; 25031 }(); 25032 var CCITTFaxStream = function CCITTFaxStreamClosure() { 25033 var ccittEOL = -2; 25034 var ccittEOF = -1; 25035 var twoDimPass = 0; 25036 var twoDimHoriz = 1; 25037 var twoDimVert0 = 2; 25038 var twoDimVertR1 = 3; 25039 var twoDimVertL1 = 4; 25040 var twoDimVertR2 = 5; 25041 var twoDimVertL2 = 6; 25042 var twoDimVertR3 = 7; 25043 var twoDimVertL3 = 8; 25044 var twoDimTable = [ 25045 [ 25046 -1, 25047 -1 25048 ], 25049 [ 25050 -1, 25051 -1 25052 ], 25053 [ 25054 7, 25055 twoDimVertL3 25056 ], 25057 [ 25058 7, 25059 twoDimVertR3 25060 ], 25061 [ 25062 6, 25063 twoDimVertL2 25064 ], 25065 [ 25066 6, 25067 twoDimVertL2 25068 ], 25069 [ 25070 6, 25071 twoDimVertR2 25072 ], 25073 [ 25074 6, 25075 twoDimVertR2 25076 ], 25077 [ 25078 4, 25079 twoDimPass 25080 ], 25081 [ 25082 4, 25083 twoDimPass 25084 ], 25085 [ 25086 4, 25087 twoDimPass 25088 ], 25089 [ 25090 4, 25091 twoDimPass 25092 ], 25093 [ 25094 4, 25095 twoDimPass 25096 ], 25097 [ 25098 4, 25099 twoDimPass 25100 ], 25101 [ 25102 4, 25103 twoDimPass 25104 ], 25105 [ 25106 4, 25107 twoDimPass 25108 ], 25109 [ 25110 3, 25111 twoDimHoriz 25112 ], 25113 [ 25114 3, 25115 twoDimHoriz 25116 ], 25117 [ 25118 3, 25119 twoDimHoriz 25120 ], 25121 [ 25122 3, 25123 twoDimHoriz 25124 ], 25125 [ 25126 3, 25127 twoDimHoriz 25128 ], 25129 [ 25130 3, 25131 twoDimHoriz 25132 ], 25133 [ 25134 3, 25135 twoDimHoriz 25136 ], 25137 [ 25138 3, 25139 twoDimHoriz 25140 ], 25141 [ 25142 3, 25143 twoDimHoriz 25144 ], 25145 [ 25146 3, 25147 twoDimHoriz 25148 ], 25149 [ 25150 3, 25151 twoDimHoriz 25152 ], 25153 [ 25154 3, 25155 twoDimHoriz 25156 ], 25157 [ 25158 3, 25159 twoDimHoriz 25160 ], 25161 [ 25162 3, 25163 twoDimHoriz 25164 ], 25165 [ 25166 3, 25167 twoDimHoriz 25168 ], 25169 [ 25170 3, 25171 twoDimHoriz 25172 ], 25173 [ 25174 3, 25175 twoDimVertL1 25176 ], 25177 [ 25178 3, 25179 twoDimVertL1 25180 ], 25181 [ 25182 3, 25183 twoDimVertL1 25184 ], 25185 [ 25186 3, 25187 twoDimVertL1 25188 ], 25189 [ 25190 3, 25191 twoDimVertL1 25192 ], 25193 [ 25194 3, 25195 twoDimVertL1 25196 ], 25197 [ 25198 3, 25199 twoDimVertL1 25200 ], 25201 [ 25202 3, 25203 twoDimVertL1 25204 ], 25205 [ 25206 3, 25207 twoDimVertL1 25208 ], 25209 [ 25210 3, 25211 twoDimVertL1 25212 ], 25213 [ 25214 3, 25215 twoDimVertL1 25216 ], 25217 [ 25218 3, 25219 twoDimVertL1 25220 ], 25221 [ 25222 3, 25223 twoDimVertL1 25224 ], 25225 [ 25226 3, 25227 twoDimVertL1 25228 ], 25229 [ 25230 3, 25231 twoDimVertL1 25232 ], 25233 [ 25234 3, 25235 twoDimVertL1 25236 ], 25237 [ 25238 3, 25239 twoDimVertR1 25240 ], 25241 [ 25242 3, 25243 twoDimVertR1 25244 ], 25245 [ 25246 3, 25247 twoDimVertR1 25248 ], 25249 [ 25250 3, 25251 twoDimVertR1 25252 ], 25253 [ 25254 3, 25255 twoDimVertR1 25256 ], 25257 [ 25258 3, 25259 twoDimVertR1 25260 ], 25261 [ 25262 3, 25263 twoDimVertR1 25264 ], 25265 [ 25266 3, 25267 twoDimVertR1 25268 ], 25269 [ 25270 3, 25271 twoDimVertR1 25272 ], 25273 [ 25274 3, 25275 twoDimVertR1 25276 ], 25277 [ 25278 3, 25279 twoDimVertR1 25280 ], 25281 [ 25282 3, 25283 twoDimVertR1 25284 ], 25285 [ 25286 3, 25287 twoDimVertR1 25288 ], 25289 [ 25290 3, 25291 twoDimVertR1 25292 ], 25293 [ 25294 3, 25295 twoDimVertR1 25296 ], 25297 [ 25298 3, 25299 twoDimVertR1 25300 ], 25301 [ 25302 1, 25303 twoDimVert0 25304 ], 25305 [ 25306 1, 25307 twoDimVert0 25308 ], 25309 [ 25310 1, 25311 twoDimVert0 25312 ], 25313 [ 25314 1, 25315 twoDimVert0 25316 ], 25317 [ 25318 1, 25319 twoDimVert0 25320 ], 25321 [ 25322 1, 25323 twoDimVert0 25324 ], 25325 [ 25326 1, 25327 twoDimVert0 25328 ], 25329 [ 25330 1, 25331 twoDimVert0 25332 ], 25333 [ 25334 1, 25335 twoDimVert0 25336 ], 25337 [ 25338 1, 25339 twoDimVert0 25340 ], 25341 [ 25342 1, 25343 twoDimVert0 25344 ], 25345 [ 25346 1, 25347 twoDimVert0 25348 ], 25349 [ 25350 1, 25351 twoDimVert0 25352 ], 25353 [ 25354 1, 25355 twoDimVert0 25356 ], 25357 [ 25358 1, 25359 twoDimVert0 25360 ], 25361 [ 25362 1, 25363 twoDimVert0 25364 ], 25365 [ 25366 1, 25367 twoDimVert0 25368 ], 25369 [ 25370 1, 25371 twoDimVert0 25372 ], 25373 [ 25374 1, 25375 twoDimVert0 25376 ], 25377 [ 25378 1, 25379 twoDimVert0 25380 ], 25381 [ 25382 1, 25383 twoDimVert0 25384 ], 25385 [ 25386 1, 25387 twoDimVert0 25388 ], 25389 [ 25390 1, 25391 twoDimVert0 25392 ], 25393 [ 25394 1, 25395 twoDimVert0 25396 ], 25397 [ 25398 1, 25399 twoDimVert0 25400 ], 25401 [ 25402 1, 25403 twoDimVert0 25404 ], 25405 [ 25406 1, 25407 twoDimVert0 25408 ], 25409 [ 25410 1, 25411 twoDimVert0 25412 ], 25413 [ 25414 1, 25415 twoDimVert0 25416 ], 25417 [ 25418 1, 25419 twoDimVert0 25420 ], 25421 [ 25422 1, 25423 twoDimVert0 25424 ], 25425 [ 25426 1, 25427 twoDimVert0 25428 ], 25429 [ 25430 1, 25431 twoDimVert0 25432 ], 25433 [ 25434 1, 25435 twoDimVert0 25436 ], 25437 [ 25438 1, 25439 twoDimVert0 25440 ], 25441 [ 25442 1, 25443 twoDimVert0 25444 ], 25445 [ 25446 1, 25447 twoDimVert0 25448 ], 25449 [ 25450 1, 25451 twoDimVert0 25452 ], 25453 [ 25454 1, 25455 twoDimVert0 25456 ], 25457 [ 25458 1, 25459 twoDimVert0 25460 ], 25461 [ 25462 1, 25463 twoDimVert0 25464 ], 25465 [ 25466 1, 25467 twoDimVert0 25468 ], 25469 [ 25470 1, 25471 twoDimVert0 25472 ], 25473 [ 25474 1, 25475 twoDimVert0 25476 ], 25477 [ 25478 1, 25479 twoDimVert0 25480 ], 25481 [ 25482 1, 25483 twoDimVert0 25484 ], 25485 [ 25486 1, 25487 twoDimVert0 25488 ], 25489 [ 25490 1, 25491 twoDimVert0 25492 ], 25493 [ 25494 1, 25495 twoDimVert0 25496 ], 25497 [ 25498 1, 25499 twoDimVert0 25500 ], 25501 [ 25502 1, 25503 twoDimVert0 25504 ], 25505 [ 25506 1, 25507 twoDimVert0 25508 ], 25509 [ 25510 1, 25511 twoDimVert0 25512 ], 25513 [ 25514 1, 25515 twoDimVert0 25516 ], 25517 [ 25518 1, 25519 twoDimVert0 25520 ], 25521 [ 25522 1, 25523 twoDimVert0 25524 ], 25525 [ 25526 1, 25527 twoDimVert0 25528 ], 25529 [ 25530 1, 25531 twoDimVert0 25532 ], 25533 [ 25534 1, 25535 twoDimVert0 25536 ], 25537 [ 25538 1, 25539 twoDimVert0 25540 ], 25541 [ 25542 1, 25543 twoDimVert0 25544 ], 25545 [ 25546 1, 25547 twoDimVert0 25548 ], 25549 [ 25550 1, 25551 twoDimVert0 25552 ], 25553 [ 25554 1, 25555 twoDimVert0 25556 ] 25557 ]; 25558 var whiteTable1 = [ 25559 [ 25560 -1, 25561 -1 25562 ], 25563 [ 25564 12, 25565 ccittEOL 25566 ], 25567 [ 25568 -1, 25569 -1 25570 ], 25571 [ 25572 -1, 25573 -1 25574 ], 25575 [ 25576 -1, 25577 -1 25578 ], 25579 [ 25580 -1, 25581 -1 25582 ], 25583 [ 25584 -1, 25585 -1 25586 ], 25587 [ 25588 -1, 25589 -1 25590 ], 25591 [ 25592 -1, 25593 -1 25594 ], 25595 [ 25596 -1, 25597 -1 25598 ], 25599 [ 25600 -1, 25601 -1 25602 ], 25603 [ 25604 -1, 25605 -1 25606 ], 25607 [ 25608 -1, 25609 -1 25610 ], 25611 [ 25612 -1, 25613 -1 25614 ], 25615 [ 25616 -1, 25617 -1 25618 ], 25619 [ 25620 -1, 25621 -1 25622 ], 25623 [ 25624 11, 25625 1792 25626 ], 25627 [ 25628 11, 25629 1792 25630 ], 25631 [ 25632 12, 25633 1984 25634 ], 25635 [ 25636 12, 25637 2048 25638 ], 25639 [ 25640 12, 25641 2112 25642 ], 25643 [ 25644 12, 25645 2176 25646 ], 25647 [ 25648 12, 25649 2240 25650 ], 25651 [ 25652 12, 25653 2304 25654 ], 25655 [ 25656 11, 25657 1856 25658 ], 25659 [ 25660 11, 25661 1856 25662 ], 25663 [ 25664 11, 25665 1920 25666 ], 25667 [ 25668 11, 25669 1920 25670 ], 25671 [ 25672 12, 25673 2368 25674 ], 25675 [ 25676 12, 25677 2432 25678 ], 25679 [ 25680 12, 25681 2496 25682 ], 25683 [ 25684 12, 25685 2560 25686 ] 25687 ]; 25688 var whiteTable2 = [ 25689 [ 25690 -1, 25691 -1 25692 ], 25693 [ 25694 -1, 25695 -1 25696 ], 25697 [ 25698 -1, 25699 -1 25700 ], 25701 [ 25702 -1, 25703 -1 25704 ], 25705 [ 25706 8, 25707 29 25708 ], 25709 [ 25710 8, 25711 29 25712 ], 25713 [ 25714 8, 25715 30 25716 ], 25717 [ 25718 8, 25719 30 25720 ], 25721 [ 25722 8, 25723 45 25724 ], 25725 [ 25726 8, 25727 45 25728 ], 25729 [ 25730 8, 25731 46 25732 ], 25733 [ 25734 8, 25735 46 25736 ], 25737 [ 25738 7, 25739 22 25740 ], 25741 [ 25742 7, 25743 22 25744 ], 25745 [ 25746 7, 25747 22 25748 ], 25749 [ 25750 7, 25751 22 25752 ], 25753 [ 25754 7, 25755 23 25756 ], 25757 [ 25758 7, 25759 23 25760 ], 25761 [ 25762 7, 25763 23 25764 ], 25765 [ 25766 7, 25767 23 25768 ], 25769 [ 25770 8, 25771 47 25772 ], 25773 [ 25774 8, 25775 47 25776 ], 25777 [ 25778 8, 25779 48 25780 ], 25781 [ 25782 8, 25783 48 25784 ], 25785 [ 25786 6, 25787 13 25788 ], 25789 [ 25790 6, 25791 13 25792 ], 25793 [ 25794 6, 25795 13 25796 ], 25797 [ 25798 6, 25799 13 25800 ], 25801 [ 25802 6, 25803 13 25804 ], 25805 [ 25806 6, 25807 13 25808 ], 25809 [ 25810 6, 25811 13 25812 ], 25813 [ 25814 6, 25815 13 25816 ], 25817 [ 25818 7, 25819 20 25820 ], 25821 [ 25822 7, 25823 20 25824 ], 25825 [ 25826 7, 25827 20 25828 ], 25829 [ 25830 7, 25831 20 25832 ], 25833 [ 25834 8, 25835 33 25836 ], 25837 [ 25838 8, 25839 33 25840 ], 25841 [ 25842 8, 25843 34 25844 ], 25845 [ 25846 8, 25847 34 25848 ], 25849 [ 25850 8, 25851 35 25852 ], 25853 [ 25854 8, 25855 35 25856 ], 25857 [ 25858 8, 25859 36 25860 ], 25861 [ 25862 8, 25863 36 25864 ], 25865 [ 25866 8, 25867 37 25868 ], 25869 [ 25870 8, 25871 37 25872 ], 25873 [ 25874 8, 25875 38 25876 ], 25877 [ 25878 8, 25879 38 25880 ], 25881 [ 25882 7, 25883 19 25884 ], 25885 [ 25886 7, 25887 19 25888 ], 25889 [ 25890 7, 25891 19 25892 ], 25893 [ 25894 7, 25895 19 25896 ], 25897 [ 25898 8, 25899 31 25900 ], 25901 [ 25902 8, 25903 31 25904 ], 25905 [ 25906 8, 25907 32 25908 ], 25909 [ 25910 8, 25911 32 25912 ], 25913 [ 25914 6, 25915 1 25916 ], 25917 [ 25918 6, 25919 1 25920 ], 25921 [ 25922 6, 25923 1 25924 ], 25925 [ 25926 6, 25927 1 25928 ], 25929 [ 25930 6, 25931 1 25932 ], 25933 [ 25934 6, 25935 1 25936 ], 25937 [ 25938 6, 25939 1 25940 ], 25941 [ 25942 6, 25943 1 25944 ], 25945 [ 25946 6, 25947 12
25948 ], 25949 [ 25950 6, 25951 12 25952 ], 25953 [ 25954 6, 25955 12 25956 ], 25957 [ 25958 6, 25959 12 25960 ], 25961 [ 25962 6, 25963 12 25964 ], 25965 [ 25966 6, 25967 12 25968 ], 25969 [ 25970 6, 25971 12 25972 ], 25973 [ 25974 6, 25975 12 25976 ], 25977 [ 25978 8, 25979 53 25980 ], 25981 [ 25982 8, 25983 53 25984 ], 25985 [ 25986 8, 25987 54 25988 ], 25989 [ 25990 8, 25991 54 25992 ], 25993 [ 25994 7, 25995 26 25996 ], 25997 [ 25998 7, 25999 26 26000 ], 26001 [ 26002 7, 26003 26 26004 ], 26005 [ 26006 7, 26007 26 26008 ], 26009 [ 26010 8, 26011 39 26012 ], 26013 [ 26014 8, 26015 39 26016 ], 26017 [ 26018 8, 26019 40 26020 ], 26021 [ 26022 8, 26023 40 26024 ], 26025 [ 26026 8, 26027 41 26028 ], 26029 [ 26030 8, 26031 41 26032 ], 26033 [ 26034 8, 26035 42 26036 ], 26037 [ 26038 8, 26039 42 26040 ], 26041 [ 26042 8, 26043 43 26044 ], 26045 [ 26046 8, 26047 43 26048 ], 26049 [ 26050 8, 26051 44 26052 ], 26053 [ 26054 8, 26055 44 26056 ], 26057 [ 26058 7, 26059 21 26060 ], 26061 [ 26062 7, 26063 21 26064 ], 26065 [ 26066 7, 26067 21 26068 ], 26069 [ 26070 7, 26071 21 26072 ], 26073 [ 26074 7, 26075 28 26076 ], 26077 [ 26078 7, 26079 28 26080 ], 26081 [ 26082 7, 26083 28 26084 ], 26085 [ 26086 7, 26087 28 26088 ], 26089 [ 26090 8, 26091 61 26092 ], 26093 [ 26094 8, 26095 61 26096 ], 26097 [ 26098 8, 26099 62 26100 ], 26101 [ 26102 8, 26103 62 26104 ], 26105 [ 26106 8, 26107 63 26108 ], 26109 [ 26110 8, 26111 63 26112 ], 26113 [ 26114 8, 26115 0 26116 ], 26117 [ 26118 8, 26119 0 26120 ], 26121 [ 26122 8, 26123 320 26124 ], 26125 [ 26126 8, 26127 320 26128 ], 26129 [ 26130 8, 26131 384 26132 ], 26133 [ 26134 8, 26135 384 26136 ], 26137 [ 26138 5, 26139 10 26140 ], 26141 [ 26142 5, 26143 10 26144 ], 26145 [ 26146 5, 26147 10 26148 ], 26149 [ 26150 5, 26151 10 26152 ], 26153 [ 26154 5, 26155 10 26156 ], 26157 [ 26158 5, 26159 10 26160 ], 26161 [ 26162 5, 26163 10 26164 ], 26165 [ 26166 5, 26167 10 26168 ], 26169 [ 26170 5, 26171 10 26172 ], 26173 [ 26174 5, 26175 10 26176 ], 26177 [ 26178 5, 26179 10 26180 ], 26181 [ 26182 5, 26183 10 26184 ], 26185 [ 26186 5, 26187 10 26188 ], 26189 [ 26190 5, 26191 10 26192 ], 26193 [ 26194 5, 26195 10 26196 ], 26197 [ 26198 5, 26199 10 26200 ], 26201 [ 26202 5, 26203 11 26204 ], 26205 [ 26206 5, 26207 11 26208 ], 26209 [ 26210 5, 26211 11 26212 ], 26213 [ 26214 5, 26215 11 26216 ], 26217 [ 26218 5, 26219 11 26220 ], 26221 [ 26222 5, 26223 11 26224 ], 26225 [ 26226 5, 26227 11 26228 ], 26229 [ 26230 5, 26231 11 26232 ], 26233 [ 26234 5, 26235 11 26236 ], 26237 [ 26238 5, 26239 11 26240 ], 26241 [ 26242 5, 26243 11 26244 ], 26245 [ 26246 5, 26247 11 26248 ], 26249 [ 26250 5, 26251 11 26252 ], 26253 [ 26254 5, 26255 11 26256 ], 26257 [ 26258 5, 26259 11 26260 ], 26261 [ 26262 5, 26263 11 26264 ], 26265 [ 26266 7, 26267 27 26268 ], 26269 [ 26270 7, 26271 27 26272 ], 26273 [ 26274 7, 26275 27 26276 ], 26277 [ 26278 7, 26279 27 26280 ], 26281 [ 26282 8, 26283 59 26284 ], 26285 [ 26286 8, 26287 59 26288 ], 26289 [ 26290 8, 26291 60 26292 ], 26293 [ 26294 8, 26295 60 26296 ], 26297 [ 26298 9, 26299 1472 26300 ], 26301 [ 26302 9, 26303 1536 26304 ], 26305 [ 26306 9, 26307 1600 26308 ], 26309 [ 26310 9, 26311 1728 26312 ], 26313 [ 26314 7, 26315 18 26316 ], 26317 [ 26318 7, 26319 18 26320 ], 26321 [ 26322 7, 26323 18 26324 ], 26325 [ 26326 7, 26327 18 26328 ], 26329 [ 26330 7, 26331 24 26332 ], 26333 [ 26334 7, 26335 24 26336 ], 26337 [ 26338 7, 26339 24 26340 ], 26341 [ 26342 7, 26343 24 26344 ], 26345 [ 26346 8, 26347 49 26348 ], 26349 [ 26350 8, 26351 49 26352 ], 26353 [ 26354 8, 26355 50 26356 ], 26357 [ 26358 8, 26359 50 26360 ], 26361 [ 26362 8, 26363 51 26364 ], 26365 [ 26366 8, 26367 51 26368 ], 26369 [ 26370 8, 26371 52 26372 ], 26373 [ 26374 8, 26375 52 26376 ], 26377 [ 26378 7, 26379 25 26380 ], 26381 [ 26382 7, 26383 25 26384 ], 26385 [ 26386 7, 26387 25 26388 ], 26389 [ 26390 7, 26391 25 26392 ], 26393 [ 26394 8, 26395 55 26396 ], 26397 [ 26398 8, 26399 55 26400 ], 26401 [ 26402 8, 26403 56 26404 ], 26405 [ 26406 8, 26407 56 26408 ], 26409 [ 26410 8, 26411 57 26412 ], 26413 [ 26414 8, 26415 57 26416 ], 26417 [ 26418 8, 26419 58 26420 ], 26421 [ 26422 8, 26423 58 26424 ], 26425 [ 26426 6, 26427 192 26428 ], 26429 [ 26430 6, 26431 192 26432 ], 26433 [ 26434 6, 26435 192 26436 ], 26437 [ 26438 6, 26439 192 26440 ], 26441 [ 26442 6, 26443 192 26444 ], 26445 [ 26446 6, 26447 192 26448 ], 26449 [ 26450 6, 26451 192 26452 ], 26453 [ 26454 6, 26455 192 26456 ], 26457 [ 26458 6, 26459 1664 26460 ], 26461 [ 26462 6, 26463 1664 26464 ], 26465 [ 26466 6, 26467 1664 26468 ], 26469 [ 26470 6, 26471 1664 26472 ], 26473 [ 26474 6, 26475 1664 26476 ], 26477 [ 26478 6, 26479 1664 26480 ], 26481 [ 26482 6, 26483 1664 26484 ], 26485 [ 26486 6, 26487 1664 26488 ], 26489 [ 26490 8, 26491 448 26492 ], 26493 [ 26494 8, 26495 448 26496 ], 26497 [ 26498 8, 26499 512 26500 ], 26501 [ 26502 8, 26503 512 26504 ], 26505 [ 26506 9, 26507 704 26508 ], 26509 [ 26510 9, 26511 768 26512 ], 26513 [ 26514 8, 26515 640 26516 ], 26517 [ 26518 8, 26519 640 26520 ], 26521 [ 26522 8, 26523 576 26524 ], 26525 [ 26526 8, 26527 576 26528 ], 26529 [ 26530 9, 26531 832 26532 ], 26533 [ 26534 9, 26535 896 26536 ], 26537 [ 26538 9, 26539 960 26540 ], 26541 [ 26542 9, 26543 1024 26544 ], 26545 [ 26546 9, 26547 1088 26548 ], 26549 [ 26550 9, 26551 1152 26552 ], 26553 [ 26554 9, 26555 1216 26556 ], 26557 [ 26558 9, 26559 1280 26560 ], 26561 [ 26562 9, 26563 1344 26564 ], 26565 [ 26566 9, 26567 1408 26568 ], 26569 [ 26570 7, 26571 256 26572 ], 26573 [ 26574 7, 26575 256 26576 ], 26577 [ 26578 7, 26579 256 26580 ], 26581 [ 26582 7, 26583 256 26584 ], 26585 [ 26586 4, 26587 2 26588 ], 26589 [ 26590 4, 26591 2 26592 ], 26593 [ 26594 4, 26595 2 26596 ], 26597 [ 26598 4, 26599 2 26600 ], 26601 [ 26602 4, 26603 2 26604 ], 26605 [ 26606 4, 26607 2 26608 ], 26609 [ 26610 4, 26611 2 26612 ], 26613 [ 26614 4, 26615 2 26616 ], 26617 [ 26618 4, 26619 2 26620 ], 26621 [ 26622 4, 26623 2 26624 ], 26625 [ 26626 4, 26627 2 26628 ], 26629 [ 26630 4, 26631 2 26632 ], 26633 [ 26634 4, 26635 2 26636 ], 26637 [ 26638 4, 26639 2 26640 ], 26641 [ 26642 4, 26643 2 26644 ], 26645 [ 26646 4, 26647 2 26648 ], 26649 [ 26650 4, 26651 2 26652 ], 26653 [ 26654 4, 26655 2 26656 ], 26657 [ 26658 4, 26659 2 26660 ], 26661 [ 26662 4, 26663 2 26664 ], 26665 [ 26666 4, 26667 2 26668 ], 26669 [ 26670 4, 26671 2 26672 ], 26673 [ 26674 4, 26675 2 26676 ], 26677 [ 26678 4, 26679 2 26680 ], 26681 [ 26682 4, 26683 2 26684 ], 26685 [ 26686 4, 26687 2 26688 ], 26689 [ 26690 4, 26691 2 26692 ], 26693 [ 26694 4, 26695 2 26696 ], 26697 [ 26698 4, 26699 2 26700 ], 26701 [ 26702 4, 26703 2 26704 ], 26705 [ 26706 4, 26707 2 26708 ], 26709 [ 26710 4, 26711 2 26712 ], 26713 [ 26714 4, 26715 3 26716 ], 26717 [ 26718 4, 26719 3 26720 ], 26721 [ 26722 4, 26723 3 26724 ], 26725 [ 26726 4, 26727 3 26728 ], 26729 [ 26730 4, 26731 3 26732 ], 26733 [ 26734 4, 26735 3 26736 ], 26737 [ 26738 4, 26739 3 26740 ], 26741 [ 26742 4, 26743 3 26744 ], 26745 [ 26746 4, 26747 3 26748 ], 26749 [ 26750 4, 26751 3 26752 ], 26753 [ 26754 4, 26755 3 26756 ], 26757 [ 26758 4, 26759 3 26760 ], 26761 [ 26762 4, 26763 3 26764 ], 26765 [ 26766 4, 26767 3 26768 ], 26769 [ 26770 4, 26771 3 26772 ], 26773 [ 26774 4, 26775 3 26776 ], 26777 [ 26778 4, 26779 3 26780 ], 26781 [ 26782 4, 26783 3 26784 ], 26785 [ 26786 4, 26787 3 26788 ], 26789 [ 26790 4, 26791 3 26792 ], 26793 [ 26794 4, 26795 3 26796 ], 26797 [ 26798 4, 26799 3 26800 ], 26801 [ 26802 4, 26803 3 26804 ], 26805 [ 26806 4, 26807 3 26808 ], 26809 [ 26810 4, 26811 3 26812 ], 26813 [ 26814 4, 26815 3 26816 ], 26817 [ 26818 4, 26819 3 26820 ], 26821 [ 26822 4, 26823 3 26824 ], 26825 [ 26826 4, 26827 3 26828 ], 26829 [ 26830 4, 26831 3 26832 ], 26833 [ 26834 4, 26835 3 26836 ], 26837 [ 26838 4, 26839 3 26840 ], 26841 [ 26842 5, 26843 128 26844 ], 26845 [ 26846 5, 26847 128 26848 ], 26849 [ 26850 5, 26851 128 26852 ], 26853 [ 26854 5, 26855 128 26856 ], 26857 [ 26858 5, 26859 128 26860 ], 26861 [ 26862 5, 26863 128 26864 ], 26865 [ 26866 5, 26867 128 26868 ], 26869 [ 26870 5, 26871 128 26872 ], 26873 [ 26874 5, 26875 128 26876 ], 26877 [ 26878 5, 26879 128 26880 ], 26881 [ 26882 5, 26883 128 26884 ], 26885 [ 26886 5, 26887 128 26888 ], 26889 [ 26890 5, 26891 128 26892 ], 26893 [ 26894 5, 26895 128 26896 ], 26897 [ 26898 5, 26899 128 26900 ], 26901 [ 26902 5, 26903 128 26904 ], 26905 [ 26906 5, 26907 8 26908 ], 26909 [ 26910 5, 26911 8 26912 ], 26913 [ 26914 5, 26915 8 26916 ], 26917 [ 26918 5, 26919 8 26920 ], 26921 [ 26922 5, 26923 8 26924 ], 26925 [ 26926 5, 26927 8 26928 ], 26929 [ 26930 5, 26931 8 26932 ], 26933 [ 26934 5, 26935 8 26936 ], 26937 [ 26938 5, 26939 8 26940 ], 26941 [ 26942 5, 26943 8 26944 ], 26945 [ 26946 5, 26947 8 26948 ], 26949 [ 26950 5, 26951 8 26952 ], 26953 [ 26954 5, 26955 8 26956 ], 26957 [ 26958 5, 26959 8 26960 ], 26961 [ 26962 5, 26963 8 26964 ], 26965 [ 26966 5, 26967 8 26968 ], 26969 [ 26970 5, 26971 9 26972 ], 26973 [ 26974 5, 26975 9 26976 ], 26977 [ 26978 5, 26979 9 26980 ], 26981 [ 26982 5, 26983 9 26984 ], 26985 [ 26986 5, 26987 9 26988 ], 26989 [ 26990 5, 26991 9 26992 ], 26993 [ 26994 5, 26995 9 26996 ], 26997 [ 26998 5, 26999 9 27000 ], 27001 [ 27002 5, 27003 9 27004 ], 27005 [ 27006 5, 27007 9 27008 ], 27009 [ 27010 5, 27011 9 27012 ], 27013 [ 27014 5, 27015 9 27016 ], 27017 [ 27018 5, 27019 9 27020 ], 27021 [ 27022 5, 27023 9 27024 ], 27025 [ 27026 5, 27027 9 27028 ], 27029 [ 27030 5, 27031 9 27032 ], 27033 [ 27034 6, 27035 16 27036 ], 27037 [ 27038 6, 27039 16 27040 ], 27041 [ 27042 6, 27043 16 27044 ], 27045 [ 27046 6, 27047 16 27048 ], 27049 [ 27050 6, 27051 16 27052 ], 27053 [ 27054 6, 27055 16 27056 ], 27057 [ 27058 6, 27059 16 27060 ], 27061 [ 27062 6, 27063 16 27064 ], 27065 [ 27066 6, 27067 17 27068 ], 27069 [ 27070 6, 27071 17 27072 ], 27073 [ 27074 6, 27075 17 27076 ], 27077 [ 27078 6, 27079 17 27080 ], 27081 [ 27082 6, 27083 17 27084 ], 27085 [ 27086 6, 27087 17 27088 ], 27089 [ 27090 6, 27091 17 27092 ], 27093 [ 27094 6, 27095 17 27096 ], 27097 [ 27098 4, 27099 4 27100 ], 27101 [ 27102 4, 27103 4 27104 ], 27105 [ 27106 4, 27107 4 27108 ], 27109 [ 27110 4, 27111 4 27112 ], 27113 [ 27114 4, 27115 4 27116 ], 27117 [ 27118 4, 27119 4 27120 ], 27121 [ 27122 4, 27123 4 27124 ], 27125 [ 27126 4, 27127 4 27128 ], 27129 [ 27130 4, 27131 4 27132 ], 27133 [ 27134 4, 27135 4 27136 ], 27137 [ 27138 4, 27139 4 27140 ], 27141 [ 27142 4, 27143 4 27144 ], 27145 [ 27146 4, 27147 4 27148 ], 27149 [ 27150 4, 27151 4 27152 ], 27153 [ 27154 4, 27155 4 27156 ], 27157 [ 27158 4, 27159 4 27160 ], 27161 [ 27162 4, 27163 4 27164 ], 27165 [ 27166 4, 27167 4 27168 ], 27169 [ 27170 4, 27171 4 27172 ], 27173 [ 27174 4, 27175 4 27176 ], 27177 [ 27178 4, 27179 4 27180 ], 27181 [ 27182 4, 27183 4 27184 ], 27185 [ 27186 4, 27187 4 27188 ], 27189 [ 27190 4, 27191 4 27192 ], 27193 [ 27194 4, 27195 4 27196 ], 27197 [ 27198 4, 27199 4 27200 ], 27201 [ 27202 4, 27203 4 27204 ], 27205 [ 27206 4, 27207 4 27208 ], 27209 [ 27210 4, 27211 4 27212 ], 27213 [ 27214 4, 27215 4 27216 ], 27217 [ 27218 4, 27219 4 27220 ], 27221 [ 27222 4, 27223 4 27224 ], 27225 [ 27226 4, 27227 5 27228 ], 27229 [ 27230 4, 27231 5 27232 ], 27233 [ 27234 4, 27235 5 27236 ], 27237 [ 27238 4, 27239 5 27240 ], 27241 [ 27242 4, 27243 5 27244 ], 27245 [ 27246 4, 27247 5 27248 ], 27249 [ 27250 4, 27251 5 27252 ], 27253 [ 27254 4, 27255 5 27256 ], 27257 [ 27258 4, 27259 5 27260 ], 27261 [ 27262 4, 27263 5 27264 ], 27265 [ 27266 4, 27267 5 27268 ], 27269 [ 27270 4, 27271 5 27272 ], 27273 [ 27274 4, 27275 5 27276 ], 27277 [ 27278 4, 27279 5 27280 ], 27281 [ 27282 4, 27283 5 27284 ], 27285 [ 27286 4, 27287 5 27288 ], 27289 [ 27290 4, 27291 5 27292 ], 27293 [ 27294 4, 27295 5 27296 ], 27297 [ 27298 4, 27299 5 27300 ], 27301 [ 27302 4, 27303 5 27304 ], 27305 [ 27306 4, 27307 5 27308 ], 27309 [ 27310 4, 27311 5 27312 ], 27313 [ 27314 4, 27315 5 27316 ], 27317 [ 27318 4, 27319 5 27320 ], 27321 [ 27322 4, 27323 5 27324 ], 27325 [ 27326 4, 27327 5 27328 ], 27329 [ 27330 4, 27331 5 27332 ], 27333 [ 27334 4, 27335 5 27336 ], 27337 [ 27338 4, 27339 5 27340 ], 27341 [ 27342 4, 27343 5 27344 ], 27345 [ 27346 4, 27347 5 27348 ], 27349 [ 27350 4, 27351 5 27352 ], 27353 [ 27354 6, 27355 14 27356 ], 27357 [ 27358 6, 27359 14 27360 ], 27361 [ 27362 6, 27363 14 27364 ], 27365 [ 27366 6, 27367 14 27368 ], 27369 [ 27370 6, 27371 14 27372 ], 27373 [ 27374 6, 27375 14 27376 ], 27377 [ 27378 6, 27379 14 27380 ], 27381 [ 27382 6, 27383 14 27384 ], 27385 [ 27386 6, 27387 15 27388 ], 27389 [ 27390 6, 27391 15 27392 ], 27393 [ 27394 6, 27395 15 27396 ], 27397 [ 27398 6, 27399 15 27400 ], 27401 [ 27402 6, 27403 15 27404 ], 27405 [ 27406 6, 27407 15 27408 ], 27409 [ 27410 6, 27411 15 27412 ], 27413 [ 27414 6, 27415 15 27416 ], 27417 [ 27418 5, 27419 64 27420 ], 27421 [ 27422 5, 27423 64 27424 ], 27425 [ 27426 5, 27427 64 27428 ], 27429 [ 27430 5, 27431 64 27432 ], 27433 [ 27434 5, 27435 64 27436 ], 27437 [ 27438 5, 27439 64 27440 ], 27441 [ 27442 5, 27443 64 27444 ], 27445 [ 27446 5, 27447 64 27448 ], 27449 [ 27450 5, 27451 64 27452 ], 27453 [ 27454 5, 27455 64 27456 ], 27457 [ 27458 5, 27459 64 27460 ], 27461 [ 27462 5, 27463 64 27464 ], 27465 [ 27466 5, 27467 64 27468 ], 27469 [ 27470 5, 27471 64 27472 ], 27473 [ 27474 5, 27475 64 27476 ], 27477 [ 27478 5, 27479 64 27480 ], 27481 [ 27482 4, 27483 6 27484 ], 27485 [ 27486 4, 27487 6 27488 ], 27489 [ 27490 4, 27491 6 27492 ], 27493 [ 27494 4, 27495 6 27496 ], 27497 [ 27498 4, 27499 6 27500 ], 27501 [ 27502 4, 27503 6 27504 ], 27505 [ 27506 4, 27507 6 27508 ], 27509 [ 27510 4, 27511 6 27512 ], 27513 [ 27514 4, 27515 6 27516 ], 27517 [ 27518 4, 27519 6 27520 ], 27521 [ 27522 4, 27523 6 27524 ], 27525 [ 27526 4, 27527 6 27528 ], 27529 [ 27530 4, 27531 6 27532 ], 27533 [ 27534 4, 27535 6 27536 ], 27537 [ 27538 4, 27539 6 27540 ], 27541 [ 27542 4, 27543 6 27544 ], 27545 [ 27546 4, 27547 6 27548 ], 27549 [ 27550 4, 27551 6 27552 ], 27553 [ 27554 4, 27555 6 27556 ], 27557 [ 27558 4, 27559 6 27560 ], 27561 [ 27562 4, 27563 6 27564 ], 27565 [ 27566 4, 27567 6 27568 ], 27569 [ 27570 4, 27571 6 27572 ], 27573 [ 27574 4, 27575 6 27576 ], 27577 [ 27578 4, 27579 6 27580 ], 27581 [ 27582 4, 27583 6 27584 ], 27585 [ 27586 4, 27587 6 27588 ], 27589 [ 27590 4, 27591 6 27592 ], 27593 [ 27594 4, 27595 6 27596 ], 27597 [ 27598 4, 27599 6 27600 ], 27601 [ 27602 4, 27603 6 27604 ], 27605 [ 27606 4, 27607 6 27608 ], 27609 [ 27610 4, 27611 7 27612 ], 27613 [ 27614 4, 27615 7 27616 ], 27617 [ 27618 4, 27619 7 27620 ], 27621 [ 27622 4, 27623 7 27624 ], 27625 [ 27626 4, 27627 7 27628 ], 27629 [ 27630 4, 27631 7 27632 ], 27633 [ 27634 4, 27635 7 27636 ], 27637 [ 27638 4, 27639 7 27640 ], 27641 [ 27642 4, 27643 7 27644 ], 27645 [ 27646 4, 27647 7 27648 ], 27649 [ 27650 4, 27651 7 27652 ], 27653 [ 27654 4, 27655 7 27656 ], 27657 [ 27658 4, 27659 7 27660 ], 27661 [ 27662 4, 27663 7 27664 ], 27665 [ 27666 4, 27667 7 27668 ], 27669 [ 27670 4, 27671 7 27672 ], 27673 [ 27674 4, 27675 7 27676 ], 27677 [ 27678 4, 27679 7 27680 ], 27681 [ 27682 4, 27683 7 27684 ], 27685 [ 27686 4, 27687 7 27688 ], 27689 [ 27690 4, 27691 7 27692 ], 27693 [ 27694 4, 27695 7 27696 ], 27697 [ 27698 4, 27699 7 27700 ], 27701 [ 27702 4, 27703 7 27704 ], 27705 [ 27706 4, 27707 7 27708 ], 27709 [ 27710 4, 27711 7 27712 ], 27713 [ 27714 4, 27715 7 27716 ], 27717 [ 27718 4, 27719 7 27720 ], 27721 [ 27722 4, 27723 7 27724 ], 27725 [ 27726 4, 27727 7 27728 ], 27729 [ 27730 4, 27731 7 27732 ], 27733 [ 27734 4, 27735 7 27736 ] 27737 ]; 27738 var blackTable1 = [ 27739 [ 27740 -1, 27741 -1 27742 ], 27743 [ 27744 -1, 27745 -1 27746 ], 27747 [ 27748 12, 27749 ccittEOL 27750 ], 27751 [ 27752 12, 27753 ccittEOL 27754 ], 27755 [ 27756 -1, 27757 -1 27758 ], 27759 [ 27760 -1, 27761 -1 27762 ], 27763 [ 27764 -1, 27765 -1 27766 ], 27767 [ 27768 -1, 27769 -1 27770 ], 27771 [ 27772 -1, 27773 -1 27774 ], 27775 [ 27776 -1, 27777 -1 27778 ], 27779 [ 27780 -1, 27781 -1 27782 ], 27783 [ 27784 -1, 27785 -1 27786 ], 27787 [ 27788 -1, 27789 -1 27790 ], 27791 [ 27792 -1, 27793 -1 27794 ], 27795 [ 27796 -1, 27797 -1 27798 ], 27799 [ 27800 -1, 27801 -1 27802 ], 27803 [ 27804 -1, 27805 -1 27806 ], 27807 [ 27808 -1, 27809 -1 27810 ], 27811 [ 27812 -1, 27813 -1 27814 ], 27815 [ 27816 -1, 27817 -1 27818 ], 27819 [ 27820 -1, 27821 -1 27822 ], 27823 [ 27824 -1, 27825 -1 27826 ], 27827 [ 27828 -1, 27829 -1 27830 ], 27831 [ 27832 -1, 27833 -1 27834 ], 27835 [ 27836 -1, 27837 -1 27838 ], 27839 [ 27840 -1, 27841 -1 27842 ], 27843 [ 27844 -1, 27845 -1 27846 ], 27847 [ 27848 -1, 27849 -1 27850 ], 27851 [ 27852 -1, 27853 -1 27854 ], 27855 [ 27856 -1, 27857 -1 27858 ], 27859 [ 27860 -1, 27861 -1 27862 ], 27863 [ 27864 -1, 27865 -1 27866 ], 27867 [ 27868 11, 27869 1792 27870 ], 27871 [ 27872 11, 27873 1792 27874 ], 27875 [ 27876 11, 27877 1792 27878 ], 27879 [ 27880 11, 27881 1792 27882 ], 27883 [ 27884 12, 27885 1984 27886 ], 27887 [ 27888 12, 27889 1984 27890 ], 27891 [ 27892 12, 27893 2048 27894 ], 27895 [ 27896 12, 27897 2048 27898 ], 27899 [ 27900 12, 27901 2112 27902 ], 27903 [ 27904 12, 27905 2112 27906 ], 27907 [ 27908 12, 27909 2176 27910 ], 27911 [ 27912 12, 27913 2176 27914 ], 27915 [ 27916 12, 27917 2240 27918 ], 27919 [ 27920 12, 27921 2240 27922 ], 27923 [ 27924 12, 27925 2304 27926 ], 27927 [ 27928 12, 27929 2304 27930 ], 27931 [ 27932 11, 27933 1856 27934 ], 27935 [ 27936 11, 27937 185
279376 27938 ], 27939 [ 27940 11, 27941 1856 27942 ], 27943 [ 27944 11, 27945 1856 27946 ], 27947 [ 27948 11, 27949 1920 27950 ], 27951 [ 27952 11, 27953 1920 27954 ], 27955 [ 27956 11, 27957 1920 27958 ], 27959 [ 27960 11, 27961 1920 27962 ], 27963 [ 27964 12, 27965 2368 27966 ], 27967 [ 27968 12, 27969 2368 27970 ], 27971 [ 27972 12, 27973 2432 27974 ], 27975 [ 27976 12, 27977 2432 27978 ], 27979 [ 27980 12, 27981 2496 27982 ], 27983 [ 27984 12, 27985 2496 27986 ], 27987 [ 27988 12, 27989 2560 27990 ], 27991 [ 27992 12, 27993 2560 27994 ], 27995 [ 27996 10, 27997 18 27998 ], 27999 [ 28000 10, 28001 18 28002 ], 28003 [ 28004 10, 28005 18 28006 ], 28007 [ 28008 10, 28009 18 28010 ], 28011 [ 28012 10, 28013 18 28014 ], 28015 [ 28016 10, 28017 18 28018 ], 28019 [ 28020 10, 28021 18 28022 ], 28023 [ 28024 10, 28025 18 28026 ], 28027 [ 28028 12, 28029 52 28030 ], 28031 [ 28032 12, 28033 52 28034 ], 28035 [ 28036 13, 28037 640 28038 ], 28039 [ 28040 13, 28041 704 28042 ], 28043 [ 28044 13, 28045 768 28046 ], 28047 [ 28048 13, 28049 832 28050 ], 28051 [ 28052 12, 28053 55 28054 ], 28055 [ 28056 12, 28057 55 28058 ], 28059 [ 28060 12, 28061 56 28062 ], 28063 [ 28064 12, 28065 56 28066 ], 28067 [ 28068 13, 28069 1280 28070 ], 28071 [ 28072 13, 28073 1344 28074 ], 28075 [ 28076 13, 28077 1408 28078 ], 28079 [ 28080 13, 28081 1472 28082 ], 28083 [ 28084 12, 28085 59 28086 ], 28087 [ 28088 12, 28089 59 28090 ], 28091 [ 28092 12, 28093 60 28094 ], 28095 [ 28096 12, 28097 60 28098 ], 28099 [ 28100 13, 28101 1536 28102 ], 28103 [ 28104 13, 28105 1600 28106 ], 28107 [ 28108 11, 28109 24 28110 ], 28111 [ 28112 11, 28113 24 28114 ], 28115 [ 28116 11, 28117 24 28118 ], 28119 [ 28120 11, 28121 24 28122 ], 28123 [ 28124 11, 28125 25 28126 ], 28127 [ 28128 11, 28129 25 28130 ], 28131 [ 28132 11, 28133 25 28134 ], 28135 [ 28136 11, 28137 25 28138 ], 28139 [ 28140 13, 28141 1664 28142 ], 28143 [ 28144 13, 28145 1728 28146 ], 28147 [ 28148 12, 28149 320 28150 ], 28151 [ 28152 12, 28153 320 28154 ], 28155 [ 28156 12, 28157 384 28158 ], 28159 [ 28160 12, 28161 384 28162 ], 28163 [ 28164 12, 28165 448 28166 ], 28167 [ 28168 12, 28169 448 28170 ], 28171 [ 28172 13, 28173 512 28174 ], 28175 [ 28176 13, 28177 576 28178 ], 28179 [ 28180 12, 28181 53 28182 ], 28183 [ 28184 12, 28185 53 28186 ], 28187 [ 28188 12, 28189 54 28190 ], 28191 [ 28192 12, 28193 54 28194 ], 28195 [ 28196 13, 28197 896 28198 ], 28199 [ 28200 13, 28201 960 28202 ], 28203 [ 28204 13, 28205 1024 28206 ], 28207 [ 28208 13, 28209 1088 28210 ], 28211 [ 28212 13, 28213 1152 28214 ], 28215 [ 28216 13, 28217 1216 28218 ], 28219 [ 28220 10, 28221 64 28222 ], 28223 [ 28224 10, 28225 64 28226 ], 28227 [ 28228 10, 28229 64 28230 ], 28231 [ 28232 10, 28233 64 28234 ], 28235 [ 28236 10, 28237 64 28238 ], 28239 [ 28240 10, 28241 64 28242 ], 28243 [ 28244 10, 28245 64 28246 ], 28247 [ 28248 10, 28249 64 28250 ] 28251 ]; 28252 var blackTable2 = [ 28253 [ 28254 8, 28255 13 28256 ], 28257 [ 28258 8, 28259 13 28260 ], 28261 [ 28262 8, 28263 13 28264 ], 28265 [ 28266 8, 28267 13 28268 ], 28269 [ 28270 8, 28271 13 28272 ], 28273 [ 28274 8, 28275 13 28276 ], 28277 [ 28278 8, 28279 13 28280 ], 28281 [ 28282 8, 28283 13 28284 ], 28285 [ 28286 8, 28287 13 28288 ], 28289 [ 28290 8, 28291 13 28292 ], 28293 [ 28294 8, 28295 13 28296 ], 28297 [ 28298 8, 28299 13 28300 ], 28301 [ 28302 8, 28303 13 28304 ], 28305 [ 28306 8, 28307 13 28308 ], 28309 [ 28310 8, 28311 13 28312 ], 28313 [ 28314 8, 28315 13 28316 ], 28317 [ 28318 11, 28319 23 28320 ], 28321 [ 28322 11, 28323 23 28324 ], 28325 [ 28326 12, 28327 50 28328 ], 28329 [ 28330 12, 28331 51 28332 ], 28333 [ 28334 12, 28335 44 28336 ], 28337 [ 28338 12, 28339 45 28340 ], 28341 [ 28342 12, 28343 46 28344 ], 28345 [ 28346 12, 28347 47 28348 ], 28349 [ 28350 12, 28351 57 28352 ], 28353 [ 28354 12, 28355 58 28356 ], 28357 [ 28358 12, 28359 61 28360 ], 28361 [ 28362 12, 28363 256 28364 ], 28365 [ 28366 10, 28367 16 28368 ], 28369 [ 28370 10, 28371 16 28372 ], 28373 [ 28374 10, 28375 16 28376 ], 28377 [ 28378 10, 28379 16 28380 ], 28381 [ 28382 10, 28383 17 28384 ], 28385 [ 28386 10, 28387 17 28388 ], 28389 [ 28390 10, 28391 17 28392 ], 28393 [ 28394 10, 28395 17 28396 ], 28397 [ 28398 12, 28399 48 28400 ], 28401 [ 28402 12, 28403 49 28404 ], 28405 [ 28406 12, 28407 62 28408 ], 28409 [ 28410 12, 28411 63 28412 ], 28413 [ 28414 12, 28415 30 28416 ], 28417 [ 28418 12, 28419 31 28420 ], 28421 [ 28422 12, 28423 32 28424 ], 28425 [ 28426 12, 28427 33 28428 ], 28429 [ 28430 12, 28431 40 28432 ], 28433 [ 28434 12, 28435 41 28436 ], 28437 [ 28438 11, 28439 22 28440 ], 28441 [ 28442 11, 28443 22 28444 ], 28445 [ 28446 8, 28447 14 28448 ], 28449 [ 28450 8, 28451 14 28452 ], 28453 [ 28454 8, 28455 14 28456 ], 28457 [ 28458 8, 28459 14 28460 ], 28461 [ 28462 8, 28463 14 28464 ], 28465 [ 28466 8, 28467 14 28468 ], 28469 [ 28470 8, 28471 14 28472 ], 28473 [ 28474 8, 28475 14 28476 ], 28477 [ 28478 8, 28479 14 28480 ], 28481 [ 28482 8, 28483 14 28484 ], 28485 [ 28486 8, 28487 14 28488 ], 28489 [ 28490 8, 28491 14 28492 ], 28493 [ 28494 8, 28495 14 28496 ], 28497 [ 28498 8, 28499 14 28500 ], 28501 [ 28502 8, 28503 14 28504 ], 28505 [ 28506 8, 28507 14 28508 ], 28509 [ 28510 7, 28511 10 28512 ], 28513 [ 28514 7, 28515 10 28516 ], 28517 [ 28518 7, 28519 10 28520 ], 28521 [ 28522 7, 28523 10 28524 ], 28525 [ 28526 7, 28527 10 28528 ], 28529 [ 28530 7, 28531 10 28532 ], 28533 [ 28534 7, 28535 10 28536 ], 28537 [ 28538 7, 28539 10 28540 ], 28541 [ 28542 7, 28543 10 28544 ], 28545 [ 28546 7, 28547 10 28548 ], 28549 [ 28550 7, 28551 10 28552 ], 28553 [ 28554 7, 28555 10 28556 ], 28557 [ 28558 7, 28559 10 28560 ], 28561 [ 28562 7, 28563 10 28564 ], 28565 [ 28566 7, 28567 10 28568 ], 28569 [ 28570 7, 28571 10 28572 ], 28573 [ 28574 7, 28575 10 28576 ], 28577 [ 28578 7, 28579 10 28580 ], 28581 [ 28582 7, 28583 10 28584 ], 28585 [ 28586 7, 28587 10 28588 ], 28589 [ 28590 7, 28591 10 28592 ], 28593 [ 28594 7, 28595 10 28596 ], 28597 [ 28598 7, 28599 10 28600 ], 28601 [ 28602 7, 28603 10 28604 ], 28605 [ 28606 7, 28607 10 28608 ], 28609 [ 28610 7, 28611 10 28612 ], 28613 [ 28614 7, 28615 10 28616 ], 28617 [ 28618 7, 28619 10 28620 ], 28621 [ 28622 7, 28623 10 28624 ], 28625 [ 28626 7, 28627 10 28628 ], 28629 [ 28630 7, 28631 10 28632 ], 28633 [ 28634 7, 28635 10 28636 ], 28637 [ 28638 7, 28639 11 28640 ], 28641 [ 28642 7, 28643 11 28644 ], 28645 [ 28646 7, 28647 11 28648 ], 28649 [ 28650 7, 28651 11 28652 ], 28653 [ 28654 7, 28655 11 28656 ], 28657 [ 28658 7, 28659 11 28660 ], 28661 [ 28662 7, 28663 11 28664 ], 28665 [ 28666 7, 28667 11 28668 ], 28669 [ 28670 7, 28671 11 28672 ], 28673 [ 28674 7, 28675 11 28676 ], 28677 [ 28678 7, 28679 11 28680 ], 28681 [ 28682 7, 28683 11 28684 ], 28685 [ 28686 7, 28687 11 28688 ], 28689 [ 28690 7, 28691 11 28692 ], 28693 [ 28694 7, 28695 11 28696 ], 28697 [ 28698 7, 28699 11 28700 ], 28701 [ 28702 7, 28703 11 28704 ], 28705 [ 28706 7, 28707 11 28708 ], 28709 [ 28710 7, 28711 11 28712 ], 28713 [ 28714 7, 28715 11 28716 ], 28717 [ 28718 7, 28719 11 28720 ], 28721 [ 28722 7, 28723 11 28724 ], 28725 [ 28726 7, 28727 11 28728 ], 28729 [ 28730 7, 28731 11 28732 ], 28733 [ 28734 7, 28735 11 28736 ], 28737 [ 28738 7, 28739 11 28740 ], 28741 [ 28742 7, 28743 11 28744 ], 28745 [ 28746 7, 28747 11 28748 ], 28749 [ 28750 7, 28751 11 28752 ], 28753 [ 28754 7, 28755 11 28756 ], 28757 [ 28758 7, 28759 11 28760 ], 28761 [ 28762 7, 28763 11 28764 ], 28765 [ 28766 9, 28767 15 28768 ], 28769 [ 28770 9, 28771 15 28772 ], 28773 [ 28774 9, 28775 15 28776 ], 28777 [ 28778 9, 28779 15 28780 ], 28781 [ 28782 9, 28783 15 28784 ], 28785 [ 28786 9, 28787 15 28788 ], 28789 [ 28790 9, 28791 15 28792 ], 28793 [ 28794 9, 28795 15 28796 ], 28797 [ 28798 12, 28799 128 28800 ], 28801 [ 28802 12, 28803 192 28804 ], 28805 [ 28806 12, 28807 26 28808 ], 28809 [ 28810 12, 28811 27 28812 ], 28813 [ 28814 12, 28815 28 28816 ], 28817 [ 28818 12, 28819 29 28820 ], 28821 [ 28822 11, 28823 19 28824 ], 28825 [ 28826 11, 28827 19 28828 ], 28829 [ 28830 11, 28831 20 28832 ], 28833 [ 28834 11, 28835 20 28836 ], 28837 [ 28838 12, 28839 34 28840 ], 28841 [ 28842 12, 28843 35 28844 ], 28845 [ 28846 12, 28847 36 28848 ], 28849 [ 28850 12, 28851 37 28852 ], 28853 [ 28854 12, 28855 38 28856 ], 28857 [ 28858 12, 28859 39 28860 ], 28861 [ 28862 11, 28863 21 28864 ], 28865 [ 28866 11, 28867 21 28868 ], 28869 [ 28870 12, 28871 42 28872 ], 28873 [ 28874 12, 28875 43 28876 ], 28877 [ 28878 10, 28879 0 28880 ], 28881 [ 28882 10, 28883 0 28884 ], 28885 [ 28886 10, 28887 0 28888 ], 28889 [ 28890 10, 28891 0 28892 ], 28893 [ 28894 7, 28895 12
28896 ], 28897 [ 28898 7, 28899 12 28900 ], 28901 [ 28902 7, 28903 12 28904 ], 28905 [ 28906 7, 28907 12 28908 ], 28909 [ 28910 7, 28911 12 28912 ], 28913 [ 28914 7, 28915 12 28916 ], 28917 [ 28918 7, 28919 12 28920 ], 28921 [ 28922 7, 28923 12 28924 ], 28925 [ 28926 7, 28927 12 28928 ], 28929 [ 28930 7, 28931 12 28932 ], 28933 [ 28934 7, 28935 12 28936 ], 28937 [ 28938 7, 28939 12 28940 ], 28941 [ 28942 7, 28943 12 28944 ], 28945 [ 28946 7, 28947 12 28948 ], 28949 [ 28950 7, 28951 12 28952 ], 28953 [ 28954 7, 28955 12 28956 ], 28957 [ 28958 7, 28959 12 28960 ], 28961 [ 28962 7, 28963 12 28964 ], 28965 [ 28966 7, 28967 12 28968 ], 28969 [ 28970 7, 28971 12 28972 ], 28973 [ 28974 7, 28975 12 28976 ], 28977 [ 28978 7, 28979 12 28980 ], 28981 [ 28982 7, 28983 12 28984 ], 28985 [ 28986 7, 28987 12 28988 ], 28989 [ 28990 7, 28991 12 28992 ], 28993 [ 28994 7, 28995 12 28996 ], 28997 [ 28998 7, 28999 12 29000 ], 29001 [ 29002 7, 29003 12 29004 ], 29005 [ 29006 7, 29007 12 29008 ], 29009 [ 29010 7, 29011 12 29012 ], 29013 [ 29014 7, 29015 12 29016 ], 29017 [ 29018 7, 29019 12 29020 ] 29021 ]; 29022 var blackTable3 = [ 29023 [ 29024 -1, 29025 -1 29026 ], 29027 [ 29028 -1, 29029 -1 29030 ], 29031 [ 29032 -1, 29033 -1 29034 ], 29035 [ 29036 -1, 29037 -1 29038 ], 29039 [ 29040 6, 29041 9 29042 ], 29043 [ 29044 6, 29045 8 29046 ], 29047 [ 29048 5, 29049 7 29050 ], 29051 [ 29052 5, 29053 7 29054 ], 29055 [ 29056 4, 29057 6 29058 ], 29059 [ 29060 4, 29061 6 29062 ], 29063 [ 29064 4, 29065 6 29066 ], 29067 [ 29068 4, 29069 6 29070 ], 29071 [ 29072 4, 29073 5 29074 ], 29075 [ 29076 4, 29077 5 29078 ], 29079 [ 29080 4, 29081 5 29082 ], 29083 [ 29084 4, 29085 5 29086 ], 29087 [ 29088 3, 29089 1 29090 ], 29091 [ 29092 3, 29093 1 29094 ], 29095 [ 29096 3, 29097 1 29098 ], 29099 [ 29100 3, 29101 1 29102 ], 29103 [ 29104 3, 29105 1 29106 ], 29107 [ 29108 3, 29109 1 29110 ], 29111 [ 29112 3, 29113 1 29114 ], 29115 [ 29116 3, 29117 1 29118 ], 29119 [ 29120 3, 29121 4 29122 ], 29123 [ 29124 3, 29125 4 29126 ], 29127 [ 29128 3, 29129 4 29130 ], 29131 [ 29132 3, 29133 4 29134 ], 29135 [ 29136 3, 29137 4 29138 ], 29139 [ 29140 3, 29141 4 29142 ], 29143 [ 29144 3, 29145 4 29146 ], 29147 [ 29148 3, 29149 4 29150 ], 29151 [ 29152 2, 29153 3 29154 ], 29155 [ 29156 2, 29157 3 29158 ], 29159 [ 29160 2, 29161 3 29162 ], 29163 [ 29164 2, 29165 3 29166 ], 29167 [ 29168 2, 29169 3 29170 ], 29171 [ 29172 2, 29173 3 29174 ], 29175 [ 29176 2, 29177 3 29178 ], 29179 [ 29180 2, 29181 3 29182 ], 29183 [ 29184 2, 29185 3 29186 ], 29187 [ 29188 2, 29189 3 29190 ], 29191 [ 29192 2, 29193 3 29194 ], 29195 [ 29196 2, 29197 3 29198 ], 29199 [ 29200 2, 29201 3 29202 ], 29203 [ 29204 2, 29205 3 29206 ], 29207 [ 29208 2, 29209 3 29210 ], 29211 [ 29212 2, 29213 3 29214 ], 29215 [ 29216 2, 29217 2 29218 ], 29219 [ 29220 2, 29221 2 29222 ], 29223 [ 29224 2, 29225 2 29226 ], 29227 [ 29228 2, 29229 2 29230 ], 29231 [ 29232 2, 29233 2 29234 ], 29235 [ 29236 2, 29237 2 29238 ], 29239 [ 29240 2, 29241 2 29242 ], 29243 [ 29244 2, 29245 2 29246 ], 29247 [ 29248 2, 29249 2 29250 ], 29251 [ 29252 2, 29253 2 29254 ], 29255 [ 29256 2, 29257 2 29258 ], 29259 [ 29260 2, 29261 2 29262 ], 29263 [ 29264 2, 29265 2 29266 ], 29267 [ 29268 2, 29269 2 29270 ], 29271 [ 29272 2, 29273 2 29274 ], 29275 [ 29276 2, 29277 2 29278 ] 29279 ]; 29280 function CCITTFaxStream(str, maybeLength, params) { 29281 this.str = str; 29282 this.dict = str.dict; 29283 params = params || Dict.empty; 29284 this.encoding = params.get('K') || 0; 29285 this.eoline = params.get('EndOfLine') || false; 29286 this.byteAlign = params.get('EncodedByteAlign') || false; 29287 this.columns = params.get('Columns') || 1728; 29288 this.rows = params.get('Rows') || 0; 29289 var eoblock = params.get('EndOfBlock'); 29290 if (eoblock === null || eoblock === undefined) { 29291 eoblock = true; 29292 } 29293 this.eoblock = eoblock; 29294 this.black = params.get('BlackIs1') || false; 29295 this.codingLine = new Uint32Array(this.columns + 1); 29296 this.refLine = new Uint32Array(this.columns + 2); 29297 this.codingLine[0] = this.columns; 29298 this.codingPos = 0; 29299 this.row = 0; 29300 this.nextLine2D = this.encoding < 0; 29301 this.inputBits = 0; 29302 this.inputBuf = 0; 29303 this.outputBits = 0; 29304 var code1; 29305 while ((code1 = this.lookBits(12)) === 0) { 29306 this.eatBits(1); 29307 } 29308 if (code1 === 1) { 29309 this.eatBits(12); 29310 } 29311 if (this.encoding > 0) { 29312 this.nextLine2D = !this.lookBits(1); 29313 this.eatBits(1); 29314 } 29315 DecodeStream.call(this, maybeLength); 29316 } 29317 CCITTFaxStream.prototype = Object.create(DecodeStream.prototype); 29318 CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() { 29319 while (!this.eof) { 29320 var c = this.lookChar(); 29321 this.ensureBuffer(this.bufferLength + 1); 29322 this.buffer[this.bufferLength++] = c; 29323 } 29324 }; 29325 CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
vendor: 8,197 bytes, lines 29326-29604
29326 var codingLine = this.codingLine; 29327 var codingPos = this.codingPos; 29328 if (a1 > codingLine[codingPos]) { 29329 if (a1 > this.columns) { 29330 info('row is wrong length'); 29331 this.err = true; 29332 a1 = this.columns; 29333 } 29334 if (codingPos & 1 ^ blackPixels) { 29335 ++codingPos; 29336 } 29337 codingLine[codingPos] = a1; 29338 } 29339 this.codingPos = codingPos; 29340 }; 29341 CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) { 29342 var codingLine = this.codingLine; 29343 var codingPos = this.codingPos; 29344 if (a1 > codingLine[codingPos]) { 29345 if (a1 > this.columns) { 29346 info('row is wrong length'); 29347 this.err = true; 29348 a1 = this.columns; 29349 } 29350 if (codingPos & 1 ^ blackPixels) { 29351 ++codingPos; 29352 } 29353 codingLine[codingPos] = a1; 29354 } else if (a1 < codingLine[codingPos]) { 29355 if (a1 < 0) { 29356 info('invalid code'); 29357 this.err = true; 29358 a1 = 0; 29359 } 29360 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 29361 --codingPos; 29362 } 29363 codingLine[codingPos] = a1; 29364 } 29365 this.codingPos = codingPos; 29366 }; 29367 CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() { 29368 var refLine = this.refLine; 29369 var codingLine = this.codingLine; 29370 var columns = this.columns; 29371 var refPos, blackPixels, bits, i; 29372 if (this.outputBits === 0) { 29373 if (this.eof) { 29374 return null; 29375 } 29376 this.err = false; 29377 var code1, code2, code3; 29378 if (this.nextLine2D) { 29379 for (i = 0; codingLine[i] < columns; ++i) { 29380 refLine[i] = codingLine[i]; 29381 } 29382 refLine[i++] = columns; 29383 refLine[i] = columns; 29384 codingLine[0] = 0; 29385 this.codingPos = 0; 29386 refPos = 0; 29387 blackPixels = 0; 29388 while (codingLine[this.codingPos] < columns) { 29389 code1 = this.getTwoDimCode(); 29390 switch (code1) { 29391 case twoDimPass: 29392 this.addPixels(refLine[refPos + 1], blackPixels); 29393 if (refLine[refPos + 1] < columns) { 29394 refPos += 2; 29395 } 29396 break; 29397 case twoDimHoriz: 29398 code1 = code2 = 0; 29399 if (blackPixels) { 29400 do { 29401 code1 += code3 = this.getBlackCode(); 29402 } while (code3 >= 64); 29403 do { 29404 code2 += code3 = this.getWhiteCode(); 29405 } while (code3 >= 64); 29406 } else { 29407 do { 29408 code1 += code3 = this.getWhiteCode(); 29409 } while (code3 >= 64); 29410 do { 29411 code2 += code3 = this.getBlackCode(); 29412 } while (code3 >= 64); 29413 } 29414 this.addPixels(codingLine[this.codingPos] + code1, blackPixels); 29415 if (codingLine[this.codingPos] < columns) { 29416 this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 29417 } 29418 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29419 refPos += 2; 29420 } 29421 break; 29422 case twoDimVertR3: 29423 this.addPixels(refLine[refPos] + 3, blackPixels); 29424 blackPixels ^= 1; 29425 if (codingLine[this.codingPos] < columns) { 29426 ++refPos; 29427 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29428 refPos += 2; 29429 } 29430 } 29431 break; 29432 case twoDimVertR2: 29433 this.addPixels(refLine[refPos] + 2, blackPixels); 29434 blackPixels ^= 1; 29435 if (codingLine[this.codingPos] < columns) { 29436 ++refPos; 29437 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29438 refPos += 2; 29439 } 29440 } 29441 break; 29442 case twoDimVertR1: 29443 this.addPixels(refLine[refPos] + 1, blackPixels); 29444 blackPixels ^= 1; 29445 if (codingLine[this.codingPos] < columns) { 29446 ++refPos; 29447 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29448 refPos += 2; 29449 } 29450 } 29451 break; 29452 case twoDimVert0: 29453 this.addPixels(refLine[refPos], blackPixels); 29454 blackPixels ^= 1; 29455 if (codingLine[this.codingPos] < columns) { 29456 ++refPos; 29457 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29458 refPos += 2; 29459 } 29460 } 29461 break; 29462 case twoDimVertL3: 29463 this.addPixelsNeg(refLine[refPos] - 3, blackPixels); 29464 blackPixels ^= 1; 29465 if (codingLine[this.codingPos] < columns) { 29466 if (refPos > 0) { 29467 --refPos; 29468 } else { 29469 ++refPos; 29470 } 29471 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29472 refPos += 2; 29473 } 29474 } 29475 break; 29476 case twoDimVertL2: 29477 this.addPixelsNeg(refLine[refPos] - 2, blackPixels); 29478 blackPixels ^= 1; 29479 if (codingLine[this.codingPos] < columns) { 29480 if (refPos > 0) { 29481 --refPos; 29482 } else { 29483 ++refPos; 29484 } 29485 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29486 refPos += 2; 29487 } 29488 } 29489 break; 29490 case twoDimVertL1: 29491 this.addPixelsNeg(refLine[refPos] - 1, blackPixels); 29492 blackPixels ^= 1; 29493 if (codingLine[this.codingPos] < columns) { 29494 if (refPos > 0) { 29495 --refPos; 29496 } else { 29497 ++refPos; 29498 } 29499 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 29500 refPos += 2; 29501 } 29502 } 29503 break; 29504 case ccittEOF: 29505 this.addPixels(columns, 0); 29506 this.eof = true; 29507 break; 29508 default: 29509 info('bad 2d code'); 29510 this.addPixels(columns, 0); 29511 this.err = true; 29512 } 29513 } 29514 } else { 29515 codingLine[0] = 0; 29516 this.codingPos = 0; 29517 blackPixels = 0; 29518 while (codingLine[this.codingPos] < columns) { 29519 code1 = 0; 29520 if (blackPixels) { 29521 do { 29522 code1 += code3 = this.getBlackCode(); 29523 } while (code3 >= 64); 29524 } else { 29525 do { 29526 code1 += code3 = this.getWhiteCode(); 29527 } while (code3 >= 64); 29528 } 29529 this.addPixels(codingLine[this.codingPos] + code1, blackPixels); 29530 blackPixels ^= 1; 29531 } 29532 } 29533 var gotEOL = false; 29534 if (this.byteAlign) { 29535 this.inputBits &= ~7; 29536 } 29537 if (!this.eoblock && this.row === this.rows - 1) { 29538 this.eof = true; 29539 } else { 29540 code1 = this.lookBits(12); 29541 if (this.eoline) { 29542 while (code1 !== ccittEOF && code1 !== 1) { 29543 this.eatBits(1); 29544 code1 = this.lookBits(12); 29545 } 29546 } else { 29547 while (code1 === 0) { 29548 this.eatBits(1); 29549 code1 = this.lookBits(12); 29550 } 29551 } 29552 if (code1 === 1) { 29553 this.eatBits(12); 29554 gotEOL = true; 29555 } else if (code1 === ccittEOF) { 29556 this.eof = true; 29557 } 29558 } 29559 if (!this.eof && this.encoding > 0) { 29560 this.nextLine2D = !this.lookBits(1); 29561 this.eatBits(1); 29562 } 29563 if (this.eoblock && gotEOL && this.byteAlign) { 29564 code1 = this.lookBits(12); 29565 if (code1 === 1) { 29566 this.eatBits(12); 29567 if (this.encoding > 0) { 29568 this.lookBits(1); 29569 this.eatBits(1); 29570 } 29571 if (this.encoding >= 0) { 29572 for (i = 0; i < 4; ++i) { 29573 code1 = this.lookBits(12); 29574 if (code1 !== 1) { 29575 info('bad rtc code: ' + code1); 29576 } 29577 this.eatBits(12); 29578 if (this.encoding > 0) { 29579 this.lookBits(1); 29580 this.eatBits(1); 29581 } 29582 } 29583 } 29584 this.eof = true; 29585 } 29586 } else if (this.err && this.eoline) { 29587 while (true) { 29588 code1 = this.lookBits(13); 29589 if (code1 === ccittEOF) { 29590 this.eof = true; 29591 return null; 29592 } 29593 if (code1 >> 1 === 1) { 29594 break; 29595 } 29596 this.eatBits(1); 29597 } 29598 this.eatBits(12); 29599 if (this.encoding > 0) { 29600 this.eatBits(1); 29601 this.nextLine2D = !(code1 & 1); 29602 } 29603 } 29604 if (codingLine[0] > 0) {
29605 this.outputBits = codingLine[this.codingPos = 0]; 29606 } else { 29607 this.outputBits = codingLine[this.codingPos = 1]; 29608 } 29609 this.row++; 29610 } 29611 var c; 29612 if (this.outputBits >= 8) { 29613 c = this.codingPos & 1 ? 0 : 0xFF; 29614 this.outputBits -= 8; 29615 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 29616 this.codingPos++; 29617 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 29618 } 29619 } else { 29620 bits = 8; 29621 c = 0; 29622 do { 29623 if (this.outputBits > bits) { 29624 c <<= bits; 29625 if (!(this.codingPos & 1)) { 29626 c |= 0xFF >> 8 - bits; 29627 } 29628 this.outputBits -= bits; 29629 bits = 0; 29630 } else { 29631 c <<= this.outputBits; 29632 if (!(this.codingPos & 1)) { 29633 c |= 0xFF >> 8 - this.outputBits; 29634 } 29635 bits -= this.outputBits; 29636 this.outputBits = 0; 29637 if (codingLine[this.codingPos] < columns) { 29638 this.codingPos++; 29639 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 29640 } else if (bits > 0) { 29641 c <<= bits; 29642 bits = 0; 29643 } 29644 } 29645 } while (bits); 29646 } 29647 if (this.black) { 29648 c ^= 0xFF; 29649 } 29650 return c; 29651 }; 29652 CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) { 29653 var limitValue = limit || 0; 29654 for (var i = start; i <= end; ++i) { 29655 var code = this.lookBits(i); 29656 if (code === ccittEOF) { 29657 return [ 29658 true, 29659 1, 29660 false 29661 ]; 29662 } 29663 if (i < end) { 29664 code <<= end - i; 29665 } 29666 if (!limitValue || code >= limitValue) { 29667 var p = table[code - limitValue]; 29668 if (p[0] === i) { 29669 this.eatBits(i); 29670 return [ 29671 true, 29672 p[1], 29673 true 29674 ]; 29675 } 29676 } 29677 } 29678 return [ 29679 false, 29680 0, 29681 false 29682 ]; 29683 }; 29684 CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() { 29685 var code = 0; 29686 var p; 29687 if (this.eoblock) { 29688 code = this.lookBits(7); 29689 p = twoDimTable[code]; 29690 if (p && p[0] > 0) { 29691 this.eatBits(p[0]); 29692 return p[1]; 29693 } 29694 } else { 29695 var result = this.findTableCode(1, 7, twoDimTable); 29696 if (result[0] && result[2]) { 29697 return result[1]; 29698 } 29699 } 29700 info('Bad two dim code'); 29701 return ccittEOF; 29702 }; 29703 CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() { 29704 var code = 0; 29705 var p; 29706 if (this.eoblock) { 29707 code = this.lookBits(12); 29708 if (code === ccittEOF) { 29709 return 1; 29710 } 29711 if (code >> 5 === 0) { 29712 p = whiteTable1[code]; 29713 } else { 29714 p = whiteTable2[code >> 3]; 29715 } 29716 if (p[0] > 0) { 29717 this.eatBits(p[0]); 29718 return p[1]; 29719 } 29720 } else { 29721 var result = this.findTableCode(1, 9, whiteTable2); 29722 if (result[0]) { 29723 return result[1]; 29724 } 29725 result = this.findTableCode(11, 12, whiteTable1); 29726 if (result[0]) { 29727 return result[1]; 29728 } 29729 } 29730 info('bad white code'); 29731 this.eatBits(1); 29732 return 1; 29733 }; 29734 CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() { 29735 var code, p; 29736 if (this.eoblock) { 29737 code = this.lookBits(13); 29738 if (code === ccittEOF) { 29739 return 1; 29740 } 29741 if (code >> 7 === 0) { 29742 p = blackTable1[code]; 29743 } else if (code >> 9 === 0 && code >> 7 !== 0) { 29744 p = blackTable2[(code >> 1) - 64]; 29745 } else { 29746 p = blackTable3[code >> 7]; 29747 } 29748 if (p[0] > 0) { 29749 this.eatBits(p[0]); 29750 return p[1]; 29751 } 29752 } else { 29753 var result = this.findTableCode(2, 6, blackTable3); 29754 if (result[0]) { 29755 return result[1]; 29756 } 29757 result = this.findTableCode(7, 12, blackTable2, 64); 29758 if (result[0]) { 29759 return result[1]; 29760 } 29761 result = this.findTableCode(10, 13, blackTable1); 29762 if (result[0]) { 29763 return result[1]; 29764 } 29765 } 29766 info('bad black code'); 29767 this.eatBits(1); 29768 return 1; 29769 }; 29770 CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) { 29771 var c; 29772 while (this.inputBits < n) { 29773 if ((c = this.str.getByte()) === -1) { 29774 if (this.inputBits === 0) { 29775 return ccittEOF; 29776 } 29777 return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n; 29778 } 29779 this.inputBuf = this.inputBuf << 8 | c; 29780 this.inputBits += 8; 29781 } 29782 return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n; 29783 }; 29784 CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) { 29785 if ((this.inputBits -= n) < 0) { 29786 this.inputBits = 0; 29787 } 29788 }; 29789 return CCITTFaxStream; 29790 }(); 29791 var LZWStream = function LZWStreamClosure() { 29792 function LZWStream(str, maybeLength, earlyChange) { 29793 this.str = str; 29794 this.dict = str.dict; 29795 this.cachedData = 0; 29796 this.bitsCached = 0; 29797 var maxLzwDictionarySize = 4096; 29798 var lzwState = { 29799 earlyChange: earlyChange, 29800 codeLength: 9, 29801 nextCode: 258, 29802 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 29803 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 29804 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 29805 currentSequence: new Uint8Array(maxLzwDictionarySize), 29806 currentSequenceLength: 0 29807 }; 29808 for (var i = 0; i < 256; ++i) { 29809 lzwState.dictionaryValues[i] = i; 29810 lzwState.dictionaryLengths[i] = 1; 29811 } 29812 this.lzwState = lzwState; 29813 DecodeStream.call(this, maybeLength); 29814 } 29815 LZWStream.prototype = Object.create(DecodeStream.prototype); 29816 LZWStream.prototype.readBits = function LZWStream_readBits(n) { 29817 var bitsCached = this.bitsCached; 29818 var cachedData = this.cachedData; 29819 while (bitsCached < n) { 29820 var c = this.str.getByte(); 29821 if (c === -1) { 29822 this.eof = true; 29823 return null; 29824 } 29825 cachedData = cachedData << 8 | c; 29826 bitsCached += 8; 29827 } 29828 this.bitsCached = bitsCached -= n; 29829 this.cachedData = cachedData; 29830 this.lastCode = null; 29831 return cachedData >>>
29831 bitsCached & (1 << n) - 1; 29832 }; 29833 LZWStream.prototype.readBlock = function LZWStream_readBlock() { 29834 var blockSize = 512; 29835 var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize; 29836 var i, j, q; 29837 var lzwState = this.lzwState; 29838 if (!lzwState) { 29839 return; 29840 } 29841 var earlyChange = lzwState.earlyChange; 29842 var nextCode = lzwState.nextCode; 29843 var dictionaryValues = lzwState.dictionaryValues; 29844 var dictionaryLengths = lzwState.dictionaryLengths; 29845 var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 29846 var codeLength = lzwState.codeLength; 29847 var prevCode = lzwState.prevCode; 29848 var currentSequence = lzwState.currentSequence; 29849 var currentSequenceLength = lzwState.currentSequenceLength; 29850 var decodedLength = 0; 29851 var currentBufferLength = this.bufferLength; 29852 var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 29853 for (i = 0; i < blockSize; i++) { 29854 var code = this.readBits(codeLength); 29855 var hasPrev = currentSequenceLength > 0; 29856 if (code < 256) { 29857 currentSequence[0] = code; 29858 currentSequenceLength = 1; 29859 } else if (code >= 258) {
29860 if (code < nextCode) { 29861 currentSequenceLength = dictionaryLengths[code]; 29862 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 29863 currentSequence[j] = dictionaryValues[q]; 29864 q = dictionaryPrevCodes[q]; 29865 } 29866 } else { 29867 currentSequence[currentSequenceLength++] = currentSequence[0]; 29868 } 29869 } else if (code === 256) { 29870 codeLength = 9; 29871 nextCode = 258; 29872 currentSequenceLength = 0; 29873 continue; 29874 } else { 29875 this.eof = true; 29876 delete this.lzwState; 29877 break; 29878 } 29879 if (hasPrev) { 29880 dictionaryPrevCodes[nextCode] = prevCode; 29881 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 29882 dictionaryValues[nextCode] = currentSequence[0]; 29883 nextCode++; 29884 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 29885 } 29886 prevCode = code; 29887 decodedLength += currentSequenceLength; 29888 if (estimatedDecodedSize < decodedLength) { 29889 do { 29890 estimatedDecodedSize += decodedSizeDelta; 29891 } while (estimatedDecodedSize < decodedLength); 29892 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 29893 } 29894 for (j = 0; j < currentSequenceLength; j++) { 29895 buffer[currentBufferLength++] = currentSequence[j]; 29896 } 29897 } 29898 lzwState.nextCode = nextCode; 29899 lzwState.codeLength = codeLength; 29900 lzwState.prevCode = prevCode; 29901 lzwState.currentSequenceLength = currentSequenceLength; 29902 this.bufferLength = currentBufferLength; 29903 }; 29904 return LZWStream; 29905 }(); 29906 var NullStream = function NullStreamClosure() { 29907 function NullStream() { 29908 Stream.call(this, new Uint8Array(0)); 29909 } 29910 NullStream.prototype = Stream.prototype; 29911 return NullStream; 29912 }(); 29913 exports.Ascii85Stream = Ascii85Stream; 29914 exports.AsciiHexStream = AsciiHexStream; 29915 exports.CCITTFaxStream = CCITTFaxStream; 29916 exports.DecryptStream = DecryptStream; 29917 exports.DecodeStream = DecodeStream; 29918 exports.FlateStream = FlateStream; 29919 exports.Jbig2Stream = Jbig2Stream; 29920 exports.JpegStream = JpegStream; 29921 exports.JpxStream = JpxStream; 29922 exports.NullStream = NullStream; 29923 exports.PredictorStream = PredictorStream; 29924 exports.RunLengthStream = RunLengthStream; 29925 exports.Stream = Stream; 29926 exports.StreamsSequenceStream = StreamsSequenceStream; 29927 exports.StringStream = StringStream; 29928 exports.LZWStream = LZWStream; 29929 })); 29930 (function (root, factory) { 29931 factory(root.pdfjsCoreCrypto = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream); 29932 }(this, function (exports, sharedUtil, corePrimitives, coreStream) { 29933 var PasswordException = sharedUtil.PasswordException; 29934 var PasswordResponses = sharedUtil.PasswordResponses; 29935 var bytesToString = sharedUtil.bytesToString; 29936 var warn = sharedUtil.warn; 29937 var error = sharedUtil.error; 29938 var assert = sharedUtil.assert; 29939 var isInt = sharedUtil.isInt; 29940 var stringToBytes = sharedUtil.stringToBytes; 29941 var utf8StringToString = sharedUtil.utf8StringToString; 29942 var Name = corePrimitives.Name; 29943 var isName = corePrimitives.isName; 29944 var isDict = corePrimitives.isDict; 29945 var DecryptStream = coreStream.DecryptStream; 29946 var ARCFourCipher = function ARCFourCipherClosure() { 29947 function ARCFourCipher(key) { 29948 this.a = 0; 29949 this.b = 0; 29950 var s = new Uint8Array(256); 29951 var i, j = 0, tmp, keyLength = key.length; 29952 for (i = 0; i < 256; ++i) { 29953 s[i] = i; 29954 } 29955 for (i = 0; i < 256; ++i) { 29956 tmp = s[i]; 29957 j = j + tmp + key[i % keyLength] & 0xFF; 29958 s[i] = s[j]; 29959 s[j] = tmp; 29960 } 29961 this.s = s; 29962 } 29963 ARCFourCipher.prototype = { 29964 encryptBlock: function ARCFourCipher_encryptBlock(data) { 29965 var i, n = data.length, tmp, tmp2; 29966 var a = this.a, b = this.b, s = this.s; 29967 var output = new Uint8Array(n); 29968 for (i = 0; i < n; ++i) { 29969 a = a + 1 & 0xFF; 29970 tmp = s[a]; 29971 b = b + tmp & 0xFF; 29972 tmp2 = s[b]; 29973 s[a] = tmp2; 29974 s[b] = tmp; 29975 output[i] = data[i] ^ s[tmp + tmp2 & 0xFF]; 29976 } 29977 this.a = a; 29978 this.b = b; 29979 return output; 29980 } 29981 }; 29982 ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock; 29983 return ARCFourCipher; 29984 }(); 29985 var calculateMD5 = function calculateMD5Closure() { 29986 var r = new Uint8Array([ 29987 7, 29988 12, 29989 17, 29990 22, 29991 7, 29992 12, 29993 17, 29994 22, 29995 7, 29996 12, 29997 17, 29998 22, 29999 7, 30000 12, 30001 17, 30002 22, 30003 5, 30004 9, 30005 14, 30006 20, 30007 5, 30008 9, 30009 14, 30010 20, 30011 5, 30012 9, 30013 14, 30014 20, 30015 5, 30016 9, 30017 14, 30018 20, 30019 4, 30020 11, 30021 16, 30022 23, 30023 4, 30024 11, 30025 16, 30026 23, 30027 4, 30028 11, 30029 16, 30030 23, 30031 4, 30032 11, 30033 16, 30034 23, 30035 6, 30036 10, 30037 15, 30038 21, 30039 6, 30040 10, 30041 15, 30042 21, 30043 6, 30044 10, 30045 15, 30046 21, 30047 6, 30048 10, 30049 15, 30050 21 30051 ]); 30052 var k = new Int32Array([ 30053 -680876936, 30054 -389564586, 30055 606105819, 30056 -1044525330, 30057 -176418897, 30058 1200080426, 30059 -1473231341, 30060 -45705983, 30061 1770035416, 30062 -1958414417, 30063 -42063, 30064 -1990404162, 30065 1804603682, 30066 -40341101, 30067 -1502002290, 30068 1236535329, 30069 -165796510, 30070 -1069501632, 30071 643717713, 30072 -373897302, 30073 -701558691, 30074 38016083, 30075 -660478335, 30076 -405537848, 30077 568446438, 30078 -1019803690, 30079 -187363961, 30080 1163531501, 30081 -1444681467, 30082 -51403784, 30083 1735328473, 30084 -1926607734, 30085 -378558, 30086 -2022574463, 30087 1839030562, 30088 -35309556, 30089 -1530992060, 30090 1272893353, 30091 -155497632, 30092 -1094730640, 30093 681279174, 30094 -358537222, 30095 -722521979, 30096 76029189, 30097 -640364487, 30098 -421815835, 30099 530742520, 30100 -995338651, 30101 -198630844, 30102 1126891415, 30103 -1416354905, 30104 -57434055, 30105 1700485571, 30106 -1894986606, 30107 -1051523, 30108 -2054922799, 30109 1873313359, 30110 -30611744, 30111 -1560198380, 30112 1309151649, 30113 -145523070, 30114 -1120210379, 30115 718787259, 30116 -343485551 30117 ]); 30118 function hash(data, offset, length) { 30119 var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878; 30120 var paddedLength = length + 72 & ~63; 30121 var padded = new Uint8Array(paddedLength); 30122 var i, j, n; 30123 for (i = 0; i < length; ++i) { 30124 padded[i] = data[offset++]; 30125 } 30126 padded[i++] = 0x80; 30127 n = paddedLength - 8; 30128 while (i < n) { 30129 padded[i++] = 0; 30130 } 30131 padded[i++] = length << 3 & 0xFF; 30132 padded[i++] = length >> 5 & 0xFF; 30133 padded[i++] = length >> 13 & 0xFF; 30134 padded[i++] = length >> 21 & 0xFF; 30135 padded[i++] = length >>> 29 & 0xFF; 30136 padded[i++] = 0; 30137 padded[i++] = 0; 30138 padded[i++] = 0; 30139 var w = new Int32Array(16); 30140 for (i = 0; i < paddedLength;) { 30141 for (j = 0; j < 16; ++j, i += 4) { 30142 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 30143 } 30144 var a = h0, b = h1, c = h2, d = h3, f, g; 30145 for (j = 0; j < 64; ++j) { 30146 if (j < 16) { 30147 f = b & c | ~b & d; 30148 g = j; 30149 } else if (j < 32) { 30150 f = d & b | ~d & c; 30151 g = 5 * j + 1 & 15; 30152 } else if (j < 48) { 30153 f = b ^ c ^ d; 30154 g = 3 * j + 5 & 15; 30155 } else { 30156 f = c ^ (b | ~d); 30157 g = 7 * j & 15; 30158 } 30159 var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j]; 30160 d = c; 30161 c = b; 30162 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 30163 a = tmp; 30164 } 30165 h0 = h0 + a | 0; 30166 h1 = h1 + b | 0; 30167 h2 = h2 + c | 0; 30168 h3 = h3 + d | 0; 30169 } 30170 return new Uint8Array([ 30171 h0 & 0xFF, 30172 h0 >> 8 & 0xFF, 30173 h0 >> 16 & 0xFF, 30174 h0 >>> 24 & 0xFF, 30175 h1 & 0xFF, 30176 h1 >> 8 & 0xFF, 30177 h1 >> 16 & 0xFF, 30178 h1 >>> 24 & 0xFF, 30179 h2 & 0xFF, 30180 h2 >> 8 & 0xFF, 30181 h2 >> 16 & 0xFF, 30182 h2 >>> 24 & 0xFF, 30183 h3 & 0xFF, 30184 h3 >> 8 & 0xFF, 30185 h3 >> 16 & 0xFF, 30186 h3 >>> 24 & 0xFF 30187 ]); 30188 } 30189 return hash; 30190 }(); 30191 var Word64 = function Word64Closure() { 30192 function Word64(highInteger, lowInteger) { 30193 this.high = highInteger | 0; 30194 this.low = lowInteger | 0; 30195 } 30196 Word64.prototype = { 30197 and: function Word64_and(word) { 30198 this.high &= word.high; 30199 this.low &= word.low; 30200 }, 30201 xor: function Word64_xor(word) { 30202 this.high ^= word.high; 30203 this.low ^= word.low; 30204 }, 30205 or: function Word64_or(word) { 30206 this.high |= word.high; 30207 this.low |= word.low; 30208 }, 30209 shiftRight: function Word64_shiftRight(places) { 30210 if (places >= 32) { 30211 this.low = this.high >>> places - 32 | 0; 30212 this.high = 0; 30213 } else { 30214 this.low = this.low >>> places | this.high << 32 - places; 30215 this.high = this.high >>> places | 0; 30216 } 30217 }, 30218 shiftLeft: function Word64_shiftLeft(places) { 30219 if (places >= 32) { 30220 this.high = this.low << places - 32; 30221 this.low = 0; 30222 } else { 30223 this.high = this.high << places | this.low >>> 32 - places; 30224 this.low = this.low << places; 30225 } 30226 }, 30227 rotateRight: function Word64_rotateRight(places) { 30228 var low, high; 30229 if (places & 32) { 30230 high = this.low; 30231 low = this.high; 30232 } else { 30233 low = this.low; 30234 high = this.high; 30235 } 30236 places &= 31; 30237 this.low = low >>> places | high << 32 - places; 30238 this.high = high >>> places | low << 32 - places; 30239 }, 30240 not: function Word64_not() { 30241 this.high = ~this.high; 30242 this.low = ~this.low; 30243 }, 30244 add: function Word64_add(word) { 30245 var lowAdd = (this.low >>> 0) + (word.low >>> 0); 30246 var highAdd = (this.high >>> 0) + (word.high >>> 0); 30247 if (lowAdd > 0xFFFFFFFF) { 30248 highAdd += 1; 30249 } 30250 this.low = lowAdd | 0; 30251 this.high = highAdd | 0; 30252 }, 30253 copyTo: function Word64_copyTo(bytes, offset) { 30254 bytes[offset] = this.high >>> 24 & 0xFF; 30255 bytes[offset + 1] = this.high >> 16 & 0xFF; 30256 bytes[offset + 2] = this.high >> 8 & 0xFF; 30257 bytes[offset + 3] = this.high & 0xFF; 30258 bytes[offset + 4] = this.low >>> 24 & 0xFF; 30259 bytes[offset + 5] = this.low >> 16 & 0xFF; 30260 bytes[offset + 6] = this.low >> 8 & 0xFF; 30261 bytes[offset + 7] = this.low & 0xFF; 30262 }, 30263 assign: function Word64_assign(word) { 30264 this.high = word.high; 30265 this.low = word.low; 30266 } 30267 }; 30268 return Word64; 30269 }(); 30270 var calculateSHA256 = function calculateSHA256Closure() { 30271 function rotr(x, n) { 30272 return x >>> n | x << 32 - n; 30273 } 30274 function ch(x, y, z) { 30275 return x & y ^ ~x & z; 30276 } 30277 function maj(x, y, z) { 30278 return x & y ^ x & z ^ y & z; 30279 } 30280 function sigma(x) {
30281 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 30282 } 30283 function sigmaPrime(x) { 30284 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 30285 } 30286 function littleSigma(x) { 30287 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 30288 } 30289 function littleSigmaPrime(x) { 30290 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 30291 } 30292 var k = [ 30293 0x428a2f98, 30294 0x71374491, 30295 0xb5c0fbcf, 30296 0xe9b5dba5, 30297 0x3956c25b, 30298 0x59f111f1, 30299 0x923f82a4, 30300 0xab1c5ed5, 30301 0xd807aa98, 30302 0x12835b01, 30303 0x243185be, 30304 0x550c7dc3, 30305 0x72be5d74, 30306 0x80deb1fe, 30307 0x9bdc06a7, 30308 0xc19bf174, 30309 0xe49b69c1, 30310 0xefbe4786, 30311 0x0fc19dc6, 30312 0x240ca1cc, 30313 0x2de92c6f, 30314 0x4a7484aa, 30315 0x5cb0a9dc, 30316 0x76f988da, 30317 0x983e5152, 30318 0xa831c66d, 30319 0xb00327c8, 30320 0xbf597fc7, 30321 0xc6e00bf3, 30322 0xd5a79147, 30323 0x06ca6351, 30324 0x14292967, 30325 0x27b70a85, 30326 0x2e1b2138, 30327 0x4d2c6dfc, 30328 0x53380d13, 30329 0x650a7354, 30330 0x766a0abb, 30331 0x81c2c92e, 30332 0x92722c85, 30333 0xa2bfe8a1, 30334 0xa81a664b, 30335 0xc24b8b70, 30336 0xc76c51a3, 30337 0xd192e819, 30338 0xd6990624, 30339 0xf40e3585, 30340 0x106aa070, 30341 0x19a4c116, 30342 0x1e376c08, 30343 0x2748774c, 30344 0x34b0bcb5, 30345 0x391c0cb3, 30346 0x4ed8aa4a, 30347 0x5b9cca4f, 30348 0x682e6ff3, 30349 0x748f82ee, 30350 0x78a5636f, 30351 0x84c87814, 30352 0x8cc70208, 30353 0x90befffa, 30354 0xa4506ceb, 30355 0xbef9a3f7, 30356 0xc67178f2 30357 ]; 30358 function hash(data, offset, length) { 30359 var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19; 30360 var paddedLength = Math.ceil((length + 9) / 64) * 64; 30361 var padded = new Uint8Array(paddedLength); 30362 var i, j, n; 30363 for (i = 0; i < length; ++i) { 30364 padded[i] = data[offset++]; 30365 } 30366 padded[i++] = 0x80; 30367 n = paddedLength - 8; 30368 while (i < n) { 30369 padded[i++] = 0; 30370 } 30371 padded[i++] = 0; 30372 padded[i++] = 0; 30373 padded[i++] = 0; 30374 padded[i++] = length >>> 29 & 0xFF; 30375 padded[i++] = length >> 21 & 0xFF; 30376 padded[i++] = length >> 13 & 0xFF; 30377 padded[i++] = length >> 5 & 0xFF; 30378 padded[i++] = length << 3 & 0xFF; 30379 var w = new Uint32Array(64); 30380 for (i = 0; i < paddedLength;) { 30381 for (j = 0; j < 16; ++j) { 30382 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 30383 i += 4; 30384 } 30385 for (j = 16; j < 64; ++j) { 30386 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 30387 } 30388 var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2; 30389 for (j = 0; j < 64; ++j) { 30390 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 30391 t2 = sigma(a) + maj(a, b, c); 30392 h = g; 30393 g = f; 30394 f = e; 30395 e = d + t1 | 0; 30396 d = c; 30397 c = b; 30398 b = a; 30399 a = t1 + t2 | 0; 30400 } 30401 h0 = h0 + a | 0; 30402 h1 = h1 + b | 0; 30403 h2 = h2 + c | 0; 30404 h3 = h3 + d | 0; 30405 h4 = h4 + e | 0; 30406 h5 = h5 + f | 0; 30407 h6 = h6 + g | 0; 30408 h7 = h7 + h | 0; 30409 } 30410 return new Uint8Array([ 30411 h0 >> 24 & 0xFF, 30412 h0 >> 16 & 0xFF, 30413 h0 >> 8 & 0xFF, 30414 h0 & 0xFF, 30415 h1 >> 24 & 0xFF, 30416 h1 >> 16 & 0xFF, 30417 h1 >> 8 & 0xFF, 30418 h1 & 0xFF, 30419 h2 >> 24 & 0xFF, 30420 h2 >> 16 & 0xFF, 30421 h2 >> 8 & 0xFF, 30422 h2 & 0xFF, 30423 h3 >> 24 & 0xFF, 30424 h3 >> 16 & 0xFF, 30425 h3 >> 8 & 0xFF, 30426 h3 & 0xFF, 30427 h4 >> 24 & 0xFF, 30428 h4 >> 16 & 0xFF, 30429 h4 >> 8 & 0xFF, 30430 h4 & 0xFF, 30431 h5 >> 24 & 0xFF, 30432 h5 >> 16 & 0xFF, 30433 h5 >> 8 & 0xFF, 30434 h5 & 0xFF, 30435 h6 >> 24 & 0xFF, 30436 h6 >> 16 & 0xFF, 30437 h6 >> 8 & 0xFF, 30438 h6 & 0xFF, 30439 h7 >> 24 & 0xFF, 30440 h7 >> 16 & 0xFF, 30441 h7 >> 8 & 0xFF, 30442 h7 & 0xFF 30443 ]); 30444 } 30445 return hash; 30446 }(); 30447 var calculateSHA512 = function calculateSHA512Closure() { 30448 function ch(result, x, y, z, tmp) { 30449 result.assign(x); 30450 result.and(y); 30451 tmp.assign(x); 30452 tmp.not(); 30453 tmp.and(z); 30454 result.xor(tmp); 30455 } 30456 function maj(result, x, y, z, tmp) { 30457 result.assign(x); 30458 result.and(y); 30459 tmp.assign(x); 30460 tmp.and(z); 30461 result.xor(tmp); 30462 tmp.assign(y); 30463 tmp.and(z); 30464 result.xor(tmp); 30465 } 30466 function sigma(result, x, tmp) { 30467 result.assign(x); 30468 result.rotateRight(28); 30469 tmp.assign(x); 30470 tmp.rotateRight(34); 30471 result.xor(tmp); 30472 tmp.assign(x); 30473 tmp.rotateRight(39); 30474 result.xor(tmp); 30475 } 30476 function sigmaPrime(result, x, tmp) { 30477 result.assign(x); 30478 result.rotateRight(14); 30479 tmp.assign(x); 30480 tmp.rotateRight(18); 30481 result.xor(tmp); 30482 tmp.assign(x); 30483 tmp.rotateRight(41); 30484 result.xor(tmp); 30485 } 30486 function littleSigma(result, x, tmp) { 30487 result.assign(x); 30488 result.rotateRight(1); 30489 tmp.assign(x); 30490 tmp.rotateRight(8); 30491 result.xor(tmp); 30492 tmp.assign(x); 30493 tmp.shiftRight(7); 30494 result.xor(tmp); 30495 } 30496 function littleSigmaPrime(result, x, tmp) { 30497 result.assign(x); 30498 result.rotateRight(19); 30499 tmp.assign(x); 30500 tmp.rotateRight(61); 30501 result.xor(tmp); 30502 tmp.assign(x); 30503 tmp.shiftRight(6); 30504 result.xor(tmp); 30505 } 30506 var k = [ 30507 new Word64(0x428a2f98, 0xd728ae22), 30508 new Word64(0x71374491, 0x23ef65cd), 30509 new Word64(0xb5c0fbcf, 0xec4d3b2f), 30510 new Word64(0xe9b5dba5, 0x8189dbbc), 30511 new Word64(0x3956c25b, 0xf348b538),
vendor: 13,007 bytes, lines 30512-31235
30512 new Word64(0x59f111f1, 0xb605d019), 30513 new Word64(0x923f82a4, 0xaf194f9b), 30514 new Word64(0xab1c5ed5, 0xda6d8118), 30515 new Word64(0xd807aa98, 0xa3030242), 30516 new Word64(0x12835b01, 0x45706fbe), 30517 new Word64(0x243185be, 0x4ee4b28c), 30518 new Word64(0x550c7dc3, 0xd5ffb4e2), 30519 new Word64(0x72be5d74, 0xf27b896f), 30520 new Word64(0x80deb1fe, 0x3b1696b1), 30521 new Word64(0x9bdc06a7, 0x25c71235), 30522 new Word64(0xc19bf174, 0xcf692694), 30523 new Word64(0xe49b69c1, 0x9ef14ad2), 30524 new Word64(0xefbe4786, 0x384f25e3), 30525 new Word64(0x0fc19dc6, 0x8b8cd5b5), 30526 new Word64(0x240ca1cc, 0x77ac9c65), 30527 new Word64(0x2de92c6f, 0x592b0275), 30528 new Word64(0x4a7484aa, 0x6ea6e483), 30529 new Word64(0x5cb0a9dc, 0xbd41fbd4), 30530 new Word64(0x76f988da, 0x831153b5), 30531 new Word64(0x983e5152, 0xee66dfab), 30532 new Word64(0xa831c66d, 0x2db43210), 30533 new Word64(0xb00327c8, 0x98fb213f), 30534 new Word64(0xbf597fc7, 0xbeef0ee4), 30535 new Word64(0xc6e00bf3, 0x3da88fc2), 30536 new Word64(0xd5a79147, 0x930aa725), 30537 new Word64(0x06ca6351, 0xe003826f), 30538 new Word64(0x14292967, 0x0a0e6e70), 30539 new Word64(0x27b70a85, 0x46d22ffc), 30540 new Word64(0x2e1b2138, 0x5c26c926), 30541 new Word64(0x4d2c6dfc, 0x5ac42aed), 30542 new Word64(0x53380d13, 0x9d95b3df), 30543 new Word64(0x650a7354, 0x8baf63de), 30544 new Word64(0x766a0abb, 0x3c77b2a8), 30545 new Word64(0x81c2c92e, 0x47edaee6), 30546 new Word64(0x92722c85, 0x1482353b), 30547 new Word64(0xa2bfe8a1, 0x4cf10364), 30548 new Word64(0xa81a664b, 0xbc423001), 30549 new Word64(0xc24b8b70, 0xd0f89791), 30550 new Word64(0xc76c51a3, 0x0654be30), 30551 new Word64(0xd192e819, 0xd6ef5218), 30552 new Word64(0xd6990624, 0x5565a910), 30553 new Word64(0xf40e3585, 0x5771202a), 30554 new Word64(0x106aa070, 0x32bbd1b8), 30555 new Word64(0x19a4c116, 0xb8d2d0c8), 30556 new Word64(0x1e376c08, 0x5141ab53), 30557 new Word64(0x2748774c, 0xdf8eeb99), 30558 new Word64(0x34b0bcb5, 0xe19b48a8), 30559 new Word64(0x391c0cb3, 0xc5c95a63), 30560 new Word64(0x4ed8aa4a, 0xe3418acb), 30561 new Word64(0x5b9cca4f, 0x7763e373), 30562 new Word64(0x682e6ff3, 0xd6b2b8a3), 30563 new Word64(0x748f82ee, 0x5defb2fc), 30564 new Word64(0x78a5636f, 0x43172f60), 30565 new Word64(0x84c87814, 0xa1f0ab72), 30566 new Word64(0x8cc70208, 0x1a6439ec), 30567 new Word64(0x90befffa, 0x23631e28), 30568 new Word64(0xa4506ceb, 0xde82bde9), 30569 new Word64(0xbef9a3f7, 0xb2c67915), 30570 new Word64(0xc67178f2, 0xe372532b), 30571 new Word64(0xca273ece, 0xea26619c), 30572 new Word64(0xd186b8c7, 0x21c0c207), 30573 new Word64(0xeada7dd6, 0xcde0eb1e), 30574 new Word64(0xf57d4f7f, 0xee6ed178), 30575 new Word64(0x06f067aa, 0x72176fba), 30576 new Word64(0x0a637dc5, 0xa2c898a6), 30577 new Word64(0x113f9804, 0xbef90dae), 30578 new Word64(0x1b710b35, 0x131c471b), 30579 new Word64(0x28db77f5, 0x23047d84), 30580 new Word64(0x32caab7b, 0x40c72493), 30581 new Word64(0x3c9ebe0a, 0x15c9bebc), 30582 new Word64(0x431d67c4, 0x9c100d4c), 30583 new Word64(0x4cc5d4be, 0xcb3e42b6), 30584 new Word64(0x597f299c, 0xfc657e2a), 30585 new Word64(0x5fcb6fab, 0x3ad6faec), 30586 new Word64(0x6c44198c, 0x4a475817) 30587 ]; 30588 function hash(data, offset, length, mode384) { 30589 mode384 = !!mode384; 30590 var h0, h1, h2, h3, h4, h5, h6, h7; 30591 if (!mode384) { 30592 h0 = new Word64(0x6a09e667, 0xf3bcc908); 30593 h1 = new Word64(0xbb67ae85, 0x84caa73b); 30594 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 30595 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 30596 h4 = new Word64(0x510e527f, 0xade682d1); 30597 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 30598 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 30599 h7 = new Word64(0x5be0cd19, 0x137e2179); 30600 } else { 30601 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 30602 h1 = new Word64(0x629a292a, 0x367cd507); 30603 h2 = new Word64(0x9159015a, 0x3070dd17); 30604 h3 = new Word64(0x152fecd8, 0xf70e5939); 30605 h4 = new Word64(0x67332667, 0xffc00b31); 30606 h5 = new Word64(0x8eb44a87, 0x68581511); 30607 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 30608 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 30609 } 30610 var paddedLength = Math.ceil((length + 17) / 128) * 128; 30611 var padded = new Uint8Array(paddedLength); 30612 var i, j, n; 30613 for (i = 0; i < length; ++i) { 30614 padded[i] = data[offset++]; 30615 } 30616 padded[i++] = 0x80; 30617 n = paddedLength - 16; 30618 while (i < n) { 30619 padded[i++] = 0; 30620 } 30621 padded[i++] = 0; 30622 padded[i++] = 0; 30623 padded[i++] = 0; 30624 padded[i++] = 0; 30625 padded[i++] = 0; 30626 padded[i++] = 0; 30627 padded[i++] = 0; 30628 padded[i++] = 0; 30629 padded[i++] = 0; 30630 padded[i++] = 0; 30631 padded[i++] = 0; 30632 padded[i++] = length >>> 29 & 0xFF; 30633 padded[i++] = length >> 21 & 0xFF; 30634 padded[i++] = length >> 13 & 0xFF; 30635 padded[i++] = length >> 5 & 0xFF; 30636 padded[i++] = length << 3 & 0xFF; 30637 var w = new Array(80); 30638 for (i = 0; i < 80; i++) { 30639 w[i] = new Word64(0, 0); 30640 } 30641 var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0); 30642 var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0); 30643 var g = new Word64(0, 0), h = new Word64(0, 0); 30644 var t1 = new Word64(0, 0), t2 = new Word64(0, 0); 30645 var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3; 30646 for (i = 0; i < paddedLength;) { 30647 for (j = 0; j < 16; ++j) { 30648 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 30649 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 30650 i += 8; 30651 } 30652 for (j = 16; j < 80; ++j) { 30653 tmp3 = w[j]; 30654 littleSigmaPrime(tmp3, w[j - 2], tmp2); 30655 tmp3.add(w[j - 7]); 30656 littleSigma(tmp1, w[j - 15], tmp2); 30657 tmp3.add(tmp1); 30658 tmp3.add(w[j - 16]); 30659 } 30660 a.assign(h0); 30661 b.assign(h1); 30662 c.assign(h2); 30663 d.assign(h3); 30664 e.assign(h4); 30665 f.assign(h5); 30666 g.assign(h6); 30667 h.assign(h7); 30668 for (j = 0; j < 80; ++j) { 30669 t1.assign(h); 30670 sigmaPrime(tmp1, e, tmp2); 30671 t1.add(tmp1); 30672 ch(tmp1, e, f, g, tmp2); 30673 t1.add(tmp1); 30674 t1.add(k[j]); 30675 t1.add(w[j]); 30676 sigma(t2, a, tmp2); 30677 maj(tmp1, a, b, c, tmp2); 30678 t2.add(tmp1); 30679 tmp3 = h; 30680 h = g; 30681 g = f; 30682 f = e; 30683 d.add(t1); 30684 e = d; 30685 d = c; 30686 c = b; 30687 b = a; 30688 tmp3.assign(t1); 30689 tmp3.add(t2); 30690 a = tmp3; 30691 } 30692 h0.add(a); 30693 h1.add(b); 30694 h2.add(c); 30695 h3.add(d); 30696 h4.add(e); 30697 h5.add(f); 30698 h6.add(g); 30699 h7.add(h); 30700 } 30701 var result; 30702 if (!mode384) { 30703 result = new Uint8Array(64); 30704 h0.copyTo(result, 0); 30705 h1.copyTo(result, 8); 30706 h2.copyTo(result, 16); 30707 h3.copyTo(result, 24); 30708 h4.copyTo(result, 32); 30709 h5.copyTo(result, 40); 30710 h6.copyTo(result, 48); 30711 h7.copyTo(result, 56); 30712 } else { 30713 result = new Uint8Array(48); 30714 h0.copyTo(result, 0); 30715 h1.copyTo(result, 8); 30716 h2.copyTo(result, 16); 30717 h3.copyTo(result, 24); 30718 h4.copyTo(result, 32); 30719 h5.copyTo(result, 40); 30720 } 30721 return result; 30722 } 30723 return hash; 30724 }(); 30725 var calculateSHA384 = function calculateSHA384Closure() { 30726 function hash(data, offset, length) { 30727 return calculateSHA512(data, offset, length, true); 30728 } 30729 return hash; 30730 }(); 30731 var NullCipher = function NullCipherClosure() { 30732 function NullCipher() { 30733 } 30734 NullCipher.prototype = { 30735 decryptBlock: function NullCipher_decryptBlock(data) { 30736 return data; 30737 } 30738 }; 30739 return NullCipher; 30740 }(); 30741 var AES128Cipher = function AES128CipherClosure() { 30742 var rcon = new Uint8Array([ 30743 0x8d, 30744 0x01, 30745 0x02, 30746 0x04, 30747 0x08, 30748 0x10, 30749 0x20, 30750 0x40, 30751 0x80, 30752 0x1b, 30753 0x36, 30754 0x6c, 30755 0xd8, 30756 0xab, 30757 0x4d, 30758 0x9a, 30759 0x2f, 30760 0x5e, 30761 0xbc, 30762 0x63, 30763 0xc6, 30764 0x97, 30765 0x35, 30766 0x6a, 30767 0xd4, 30768 0xb3, 30769 0x7d, 30770 0xfa, 30771 0xef, 30772 0xc5, 30773 0x91, 30774 0x39, 30775 0x72, 30776 0xe4, 30777 0xd3, 30778 0xbd, 30779 0x61, 30780 0xc2, 30781 0x9f, 30782 0x25, 30783 0x4a, 30784 0x94, 30785 0x33, 30786 0x66, 30787 0xcc, 30788 0x83, 30789 0x1d, 30790 0x3a, 30791 0x74, 30792 0xe8, 30793 0xcb, 30794 0x8d, 30795 0x01, 30796 0x02, 30797 0x04, 30798 0x08, 30799 0x10, 30800 0x20, 30801 0x40, 30802 0x80, 30803 0x1b, 30804 0x36, 30805 0x6c, 30806 0xd8, 30807 0xab, 30808 0x4d, 30809 0x9a, 30810 0x2f, 30811 0x5e, 30812 0xbc, 30813 0x63, 30814 0xc6, 30815 0x97, 30816 0x35, 30817 0x6a, 30818 0xd4, 30819 0xb3, 30820 0x7d, 30821 0xfa, 30822 0xef, 30823 0xc5, 30824 0x91, 30825 0x39, 30826 0x72, 30827 0xe4, 30828 0xd3, 30829 0xbd, 30830 0x61, 30831 0xc2, 30832 0x9f, 30833 0x25, 30834 0x4a, 30835 0x94, 30836 0x33, 30837 0x66, 30838 0xcc, 30839 0x83, 30840 0x1d, 30841 0x3a, 30842 0x74, 30843 0xe8, 30844 0xcb, 30845 0x8d, 30846 0x01, 30847 0x02, 30848 0x04, 30849 0x08, 30850 0x10, 30851 0x20, 30852 0x40, 30853 0x80, 30854 0x1b, 30855 0x36, 30856 0x6c, 30857 0xd8, 30858 0xab, 30859 0x4d, 30860 0x9a, 30861 0x2f, 30862 0x5e, 30863 0xbc, 30864 0x63, 30865 0xc6, 30866 0x97, 30867 0x35, 30868 0x6a, 30869 0xd4, 30870 0xb3, 30871 0x7d, 30872 0xfa, 30873 0xef, 30874 0xc5, 30875 0x91, 30876 0x39, 30877 0x72, 30878 0xe4, 30879 0xd3, 30880 0xbd, 30881 0x61, 30882 0xc2, 30883 0x9f, 30884 0x25, 30885 0x4a, 30886 0x94, 30887 0x33, 30888 0x66, 30889 0xcc, 30890 0x83, 30891 0x1d, 30892 0x3a, 30893 0x74, 30894 0xe8, 30895 0xcb, 30896 0x8d, 30897 0x01, 30898 0x02, 30899 0x04, 30900 0x08, 30901 0x10, 30902 0x20, 30903 0x40, 30904 0x80, 30905 0x1b, 30906 0x36, 30907 0x6c, 30908 0xd8, 30909 0xab, 30910 0x4d, 30911 0x9a, 30912 0x2f, 30913 0x5e, 30914 0xbc, 30915 0x63, 30916 0xc6, 30917 0x97, 30918 0x35, 30919 0x6a, 30920 0xd4, 30921 0xb3, 30922 0x7d, 30923 0xfa, 30924 0xef, 30925 0xc5, 30926 0x91, 30927 0x39, 30928 0x72, 30929 0xe4, 30930 0xd3, 30931 0xbd, 30932 0x61, 30933 0xc2, 30934 0x9f, 30935 0x25, 30936 0x4a, 30937 0x94, 30938 0x33, 30939 0x66, 30940 0xcc, 30941 0x83, 30942 0x1d, 30943 0x3a, 30944 0x74, 30945 0xe8, 30946 0xcb, 30947 0x8d, 30948 0x01, 30949 0x02, 30950 0x04, 30951 0x08, 30952 0x10, 30953 0x20, 30954 0x40, 30955 0x80, 30956 0x1b, 30957 0x36, 30958 0x6c, 30959 0xd8, 30960 0xab, 30961 0x4d, 30962 0x9a, 30963 0x2f, 30964 0x5e, 30965 0xbc, 30966 0x63, 30967 0xc6, 30968 0x97, 30969 0x35, 30970 0x6a, 30971 0xd4, 30972 0xb3, 30973 0x7d, 30974 0xfa, 30975 0xef, 30976 0xc5, 30977 0x91, 30978 0x39, 30979 0x72, 30980 0xe4, 30981 0xd3, 30982 0xbd, 30983 0x61, 30984 0xc2, 30985 0x9f, 30986 0x25, 30987 0x4a, 30988 0x94, 30989 0x33, 30990 0x66, 30991 0xcc, 30992 0x83, 30993 0x1d, 30994 0x3a, 30995 0x74, 30996 0xe8, 30997 0xcb, 30998 0x8d 30999 ]); 31000 var s = new Uint8Array([ 31001 0x63, 31002 0x7c, 31003 0x77, 31004 0x7b, 31005 0xf2, 31006 0x6b, 31007 0x6f, 31008 0xc5, 31009 0x30, 31010 0x01, 31011 0x67, 31012 0x2b, 31013 0xfe, 31014 0xd7, 31015 0xab, 31016 0x76, 31017 0xca, 31018 0x82, 31019 0xc9, 31020 0x7d, 31021 0xfa, 31022 0x59, 31023 0x47, 31024 0xf0, 31025 0xad, 31026 0xd4, 31027 0xa2, 31028 0xaf, 31029 0x9c, 31030 0xa4, 31031 0x72, 31032 0xc0, 31033 0xb7, 31034 0xfd, 31035 0x93, 31036 0x26, 31037 0x36, 31038 0x3f, 31039 0xf7, 31040 0xcc, 31041 0x34, 31042 0xa5, 31043 0xe5, 31044 0xf1, 31045 0x71, 31046 0xd8, 31047 0x31, 31048 0x15, 31049 0x04, 31050 0xc7, 31051 0x23, 31052 0xc3, 31053 0x18, 31054 0x96, 31055 0x05, 31056 0x9a, 31057 0x07, 31058 0x12, 31059 0x80, 31060 0xe2, 31061 0xeb, 31062 0x27, 31063 0xb2, 31064 0x75, 31065 0x09, 31066 0x83, 31067 0x2c, 31068 0x1a, 31069 0x1b, 31070 0x6e, 31071 0x5a, 31072 0xa0, 31073 0x52, 31074 0x3b, 31075 0xd6, 31076 0xb3, 31077 0x29, 31078 0xe3, 31079 0x2f, 31080 0x84, 31081 0x53, 31082 0xd1, 31083 0x00, 31084 0xed, 31085 0x20, 31086 0xfc, 31087 0xb1, 31088 0x5b, 31089 0x6a, 31090 0xcb, 31091 0xbe, 31092 0x39, 31093 0x4a, 31094 0x4c, 31095 0x58, 31096 0xcf, 31097 0xd0, 31098 0xef, 31099 0xaa, 31100 0xfb, 31101 0x43, 31102 0x4d, 31103 0x33, 31104 0x85, 31105 0x45, 31106 0xf9, 31107 0x02, 31108 0x7f, 31109 0x50, 31110 0x3c, 31111 0x9f, 31112 0xa8, 31113 0x51, 31114 0xa3, 31115 0x40, 31116 0x8f, 31117 0x92, 31118 0x9d, 31119 0x38, 31120 0xf5, 31121 0xbc, 31122 0xb6, 31123 0xda, 31124 0x21, 31125 0x10, 31126 0xff, 31127 0xf3, 31128 0xd2, 31129 0xcd, 31130 0x0c, 31131 0x13, 31132 0xec, 31133 0x5f, 31134 0x97, 31135 0x44, 31136 0x17, 31137 0xc4, 31138 0xa7, 31139 0x7e, 31140 0x3d, 31141 0x64, 31142 0x5d, 31143 0x19, 31144 0x73, 31145 0x60, 31146 0x81, 31147 0x4f, 31148 0xdc, 31149 0x22, 31150 0x2a, 31151 0x90, 31152 0x88, 31153 0x46, 31154 0xee, 31155 0xb8, 31156 0x14, 31157 0xde, 31158 0x5e, 31159 0x0b, 31160 0xdb, 31161 0xe0, 31162 0x32, 31163 0x3a, 31164 0x0a, 31165 0x49, 31166 0x06, 31167 0x24, 31168 0x5c, 31169 0xc2, 31170 0xd3, 31171 0xac, 31172 0x62, 31173 0x91, 31174 0x95, 31175 0xe4, 31176 0x79, 31177 0xe7, 31178 0xc8, 31179 0x37, 31180 0x6d, 31181 0x8d, 31182 0xd5, 31183 0x4e, 31184 0xa9, 31185 0x6c, 31186 0x56, 31187 0xf4, 31188 0xea, 31189 0x65, 31190 0x7a, 31191 0xae, 31192 0x08, 31193 0xba, 31194 0x78, 31195 0x25, 31196 0x2e, 31197 0x1c, 31198 0xa6, 31199 0xb4, 31200 0xc6, 31201 0xe8, 31202 0xdd, 31203 0x74, 31204 0x1f, 31205 0x4b, 31206 0xbd, 31207 0x8b, 31208 0x8a, 31209 0x70, 31210 0x3e, 31211 0xb5, 31212 0x66, 31213 0x48, 31214 0x03, 31215 0xf6, 31216 0x0e, 31217 0x61, 31218 0x35, 31219 0x57, 31220 0xb9, 31221 0x86, 31222 0xc1, 31223 0x1d, 31224 0x9e, 31225 0xe1, 31226 0xf8, 31227 0x98, 31228 0x11, 31229 0x69, 31230 0xd9, 31231 0x8e, 31232 0x94, 31233 0x9b, 31234 0x1e, 31235 0x87,
31236 0xe9, 31237 0xce, 31238 0x55, 31239 0x28, 31240 0xdf, 31241 0x8c, 31242 0xa1, 31243 0x89, 31244 0x0d, 31245 0xbf, 31246 0xe6, 31247 0x42, 31248 0x68, 31249 0x41, 31250 0x99, 31251 0x2d, 31252 0x0f, 31253 0xb0, 31254 0x54, 31255 0xbb, 31256 0x16 31257 ]); 31258 var inv_s = new Uint8Array([ 31259 0x52, 31260 0x09, 31261 0x6a, 31262 0xd5, 31263 0x30, 31264 0x36, 31265 0xa5, 31266 0x38, 31267 0xbf, 31268 0x40, 31269 0xa3, 31270 0x9e, 31271 0x81, 31272 0xf3, 31273 0xd7, 31274 0xfb, 31275 0x7c, 31276 0xe3, 31277 0x39, 31278 0x82, 31279 0x9b, 31280 0x2f, 31281 0xff, 31282 0x87, 31283 0x34, 31284 0x8e, 31285 0x43, 31286 0x44, 31287 0xc4, 31288 0xde, 31289 0xe9, 31290 0xcb, 31291 0x54, 31292 0x7b, 31293 0x94, 31294 0x32, 31295 0xa6, 31296 0xc2, 31297 0x23, 31298 0x3d, 31299 0xee, 31300 0x4c, 31301 0x95, 31302 0x0b, 31303 0x42, 31304 0xfa, 31305 0xc3, 31306 0x4e, 31307 0x08, 31308 0x2e, 31309 0xa1, 31310 0x66, 31311 0x28, 31312 0xd9, 31313 0x24, 31314 0xb2, 31315 0x76, 31316 0x5b, 31317 0xa2, 31318 0x49, 31319 0x6d, 31320 0x8b, 31321 0xd1, 31322 0x25, 31323 0x72, 31324 0xf8, 31325 0xf6, 31326 0x64, 31327 0x86, 31328 0x68, 31329 0x98, 31330 0x16, 31331 0xd4, 31332 0xa4, 31333 0x5c, 31334 0xcc, 31335 0x5d, 31336 0x65, 31337 0xb6, 31338 0x92, 31339 0x6c, 31340 0x70, 31341 0x48, 31342 0x50, 31343 0xfd, 31344 0xed, 31345 0xb9, 31346 0xda, 31347 0x5e, 31348 0x15, 31349 0x46, 31350 0x57, 31351 0xa7, 31352 0x8d, 31353 0x9d, 31354 0x84, 31355 0x90, 31356 0xd8, 31357 0xab, 31358 0x00, 31359 0x8c, 31360 0xbc, 31361 0xd3, 31362 0x0a, 31363 0xf7, 31364 0xe4, 31365 0x58, 31366 0x05, 31367 0xb8, 31368 0xb3, 31369 0x45, 31370 0x06, 31371 0xd0, 31372 0x2c, 31373 0x1e, 31374 0x8f, 31375 0xca, 31376 0x3f, 31377 0x0f, 31378 0x02, 31379 0xc1, 31380 0xaf, 31381 0xbd, 31382 0x03, 31383 0x01, 31384 0x13, 31385 0x8a, 31386 0x6b, 31387 0x3a, 31388 0x91, 31389 0x11, 31390 0x41, 31391 0x4f, 31392 0x67, 31393 0xdc, 31394 0xea, 31395 0x97, 31396 0xf2, 31397 0xcf, 31398 0xce, 31399 0xf0, 31400 0xb4, 31401 0xe6, 31402 0x73, 31403 0x96, 31404 0xac, 31405 0x74, 31406 0x22, 31407 0xe7, 31408 0xad, 31409 0x35, 31410 0x85, 31411 0xe2, 31412 0xf9, 31413 0x37, 31414 0xe8, 31415 0x1c, 31416 0x75, 31417 0xdf, 31418 0x6e, 31419 0x47, 31420 0xf1, 31421 0x1a, 31422 0x71, 31423 0x1d, 31424 0x29, 31425 0xc5, 31426 0x89, 31427 0x6f, 31428 0xb7, 31429 0x62, 31430 0x0e, 31431 0xaa, 31432 0x18, 31433 0xbe, 31434 0x1b, 31435 0xfc, 31436 0x56, 31437 0x3e, 31438 0x4b, 31439 0xc6, 31440 0xd2, 31441 0x79, 31442 0x20, 31443 0x9a, 31444 0xdb, 31445 0xc0, 31446 0xfe, 31447 0x78, 31448 0xcd, 31449 0x5a, 31450 0xf4, 31451 0x1f, 31452 0xdd, 31453 0xa8, 31454 0x33, 31455 0x88, 31456 0x07, 31457 0xc7, 31458 0x31, 31459 0xb1, 31460 0x12, 31461 0x10, 31462 0x59, 31463 0x27, 31464 0x80, 31465 0xec, 31466 0x5f, 31467 0x60, 31468 0x51, 31469 0x7f, 31470 0xa9, 31471 0x19, 31472 0xb5, 31473 0x4a, 31474 0x0d, 31475 0x2d, 31476 0xe5, 31477 0x7a, 31478 0x9f, 31479 0x93, 31480 0xc9, 31481 0x9c, 31482 0xef, 31483 0xa0, 31484 0xe0, 31485 0x3b, 31486 0x4d, 31487 0xae, 31488 0x2a, 31489 0xf5, 31490 0xb0, 31491 0xc8, 31492 0xeb, 31493 0xbb, 31494 0x3c, 31495 0x83, 31496 0x53, 31497 0x99, 31498 0x61, 31499 0x17, 31500 0x2b, 31501 0x04, 31502 0x7e, 31503 0xba, 31504 0x77, 31505 0xd6, 31506 0x26, 31507 0xe1, 31508 0x69, 31509 0x14, 31510 0x63, 31511 0x55, 31512 0x21, 31513 0x0c, 31514 0x7d 31515 ]); 31516 var mixCol = new Uint8Array(256); 31517 for (var i = 0; i < 256; i++) { 31518 if (i < 128) { 31519 mixCol[i] = i << 1; 31520 } else { 31521 mixCol[i] = i << 1 ^ 0x1b; 31522 } 31523 } 31524 var mix = new Uint32Array([ 31525 0x00000000, 31526 0x0e090d0b, 31527 0x1c121a16, 31528 0x121b171d, 31529 0x3824342c, 31530 0x362d3927, 31531 0x24362e3a, 31532 0x2a3f2331, 31533 0x70486858, 31534 0x7e416553, 31535 0x6c5a724e, 31536 0x62537f45, 31537 0x486c5c74, 31538 0x4665517f, 31539 0x547e4662, 31540 0x5a774b69, 31541 0xe090d0b0, 31542 0xee99ddbb, 31543 0xfc82caa6, 31544 0xf28bc7ad, 31545 0xd8b4e49c, 31546 0xd6bde997, 31547 0xc4a6fe8a, 31548 0xcaaff381, 31549 0x90d8b8e8, 31550 0x9ed1b5e3, 31551 0x8ccaa2fe, 31552 0x82c3aff5, 31553 0xa8fc8cc4, 31554 0xa6f581cf, 31555 0xb4ee96d2, 31556 0xbae79bd9, 31557 0xdb3bbb7b, 31558 0xd532b670, 31559 0xc729a16d, 31560 0xc920ac66, 31561 0xe31f8f57, 31562 0xed16825c, 31563 0xff0d9541, 31564 0xf104984a, 31565 0xab73d323, 31566 0xa57ade28, 31567 0xb761c935, 31568 0xb968c43e, 31569 0x9357e70f, 31570 0x9d5eea04, 31571 0x8f45fd19, 31572 0x814cf012, 31573 0x3bab6bcb, 31574 0x35a266c0, 31575 0x27b971dd, 31576 0x29b07cd6, 31577 0x038f5fe7, 31578 0x0d8652ec, 31579 0x1f9d45f1, 31580 0x119448fa, 31581 0x4be30393, 31582 0x45ea0e98, 31583 0x57f11985, 31584 0x59f8148e, 31585 0x73c737bf, 31586 0x7dce3ab4, 31587 0x6fd52da9, 31588 0x61dc20a2, 31589 0xad766df6, 31590 0xa37f60fd, 31591 0xb16477e0, 31592 0xbf6d7aeb, 31593 0x955259da, 31594 0x9b5b54d1, 31595 0x894043cc, 31596 0x87494ec7, 31597 0xdd3e05ae, 31598 0xd33708a5, 31599 0xc12c1fb8, 31600 0xcf2512b3, 31601 0xe51a3182, 31602 0xeb133c89, 31603 0xf9082b94, 31604 0xf701269f, 31605 0x4de6bd46, 31606 0x43efb04d,
31607 0x51f4a750, 31608 0x5ffdaa5b, 31609 0x75c2896a, 31610 0x7bcb8461, 31611 0x69d0937c, 31612 0x67d99e77, 31613 0x3daed51e, 31614 0x33a7d815, 31615 0x21bccf08, 31616 0x2fb5c203, 31617 0x058ae132, 31618 0x0b83ec39, 31619 0x1998fb24, 31620 0x1791f62f, 31621 0x764dd68d, 31622 0x7844db86, 31623 0x6a5fcc9b, 31624 0x6456c190, 31625 0x4e69e2a1, 31626 0x4060efaa, 31627 0x527bf8b7, 31628 0x5c72f5bc, 31629 0x0605bed5, 31630 0x080cb3de, 31631 0x1a17a4c3, 31632 0x141ea9c8, 31633 0x3e218af9, 31634 0x302887f2, 31635 0x223390ef, 31636 0x2c3a9de4, 31637 0x96dd063d, 31638 0x98d40b36, 31639 0x8acf1c2b, 31640 0x84c61120, 31641 0xaef93211, 31642 0xa0f03f1a, 31643 0xb2eb2807, 31644 0xbce2250c, 31645 0xe6956e65, 31646 0xe89c636e, 31647 0xfa877473, 31648 0xf48e7978, 31649 0xdeb15a49, 31650 0xd0b85742, 31651 0xc2a3405f, 31652 0xccaa4d54, 31653 0x41ecdaf7, 31654 0x4fe5d7fc, 31655 0x5dfec0e1, 31656 0x53f7cdea, 31657 0x79c8eedb, 31658 0x77c1e3d0, 31659 0x65daf4cd, 31660 0x6bd3f9c6, 31661 0x31a4b2af, 31662 0x3fadbfa4, 31663 0x2db6a8b9, 31664 0x23bfa5b2, 31665 0x09808683, 31666 0x07898b88, 31667 0x15929c95, 31668 0x1b9b919e, 31669 0xa17c0a47, 31670 0xaf75074c, 31671 0xbd6e1051, 31672 0xb3671d5a, 31673 0x99583e6b, 31674 0x97513360, 31675 0x854a247d, 31676 0x8b432976, 31677 0xd134621f, 31678 0xdf3d6f14, 31679 0xcd267809, 31680 0xc32f7502, 31681 0xe9105633, 31682 0xe7195b38, 31683 0xf5024c25, 31684 0xfb0b412e, 31685 0x9ad7618c, 31686 0x94de6c87, 31687 0x86c57b9a, 31688 0x88cc7691, 31689 0xa2f355a0, 31690 0xacfa58ab, 31691 0xbee14fb6, 31692 0xb0e842bd, 31693 0xea9f09d4, 31694 0xe49604df, 31695 0xf68d13c2, 31696 0xf8841ec9, 31697 0xd2bb3df8, 31698 0xdcb230f3, 31699 0xcea927ee, 31700 0xc0a02ae5, 31701 0x7a47b13c, 31702 0x744ebc37, 31703 0x6655ab2a, 31704 0x685ca621, 31705 0x42638510, 31706 0x4c6a881b, 31707 0x5e719f06, 31708 0x5078920d, 31709 0x0a0fd964, 31710 0x0406d46f, 31711 0x161dc372, 31712 0x1814ce79, 31713 0x322bed48, 31714 0x3c22e043, 31715 0x2e39f75e, 31716 0x2030fa55, 31717 0xec9ab701, 31718 0xe293ba0a, 31719 0xf088ad17, 31720 0xfe81a01c, 31721 0xd4be832d, 31722 0xdab78e26, 31723 0xc8ac993b, 31724 0xc6a59430, 31725 0x9cd2df59, 31726 0x92dbd252, 31727 0x80c0c54f, 31728 0x8ec9c844, 31729 0xa4f6eb75, 31730 0xaaffe67e, 31731 0xb8e4f163, 31732 0xb6edfc68, 31733 0x0c0a67b1, 31734 0x02036aba, 31735 0x10187da7, 31736 0x1e1170ac, 31737 0x342e539d, 31738 0x3a275e96, 31739 0x283c498b, 31740 0x26354480, 31741 0x7c420fe9, 31742 0x724b02e2, 31743 0x605015ff, 31744 0x6e5918f4, 31745 0x44663bc5, 31746 0x4a6f36ce, 31747 0x587421d3, 31748 0x567d2cd8, 31749 0x37a10c7a, 31750 0x39a80171, 31751 0x2bb3166c, 31752 0x25ba1b67, 31753 0x0f853856, 31754 0x018c355d, 31755 0x13972240, 31756 0x1d9e2f4b, 31757 0x47e96422, 31758 0x49e06929, 31759 0x5bfb7e34, 31760 0x55f2733f, 31761 0x7fcd500e, 31762 0x71c45d05, 31763 0x63df4a18, 31764 0x6dd64713, 31765 0xd731dcca, 31766 0xd938d1c1, 31767 0xcb23c6dc, 31768 0xc52acbd7, 31769 0xef15e8e6, 31770 0xe11ce5ed, 31771 0xf307f2f0, 31772 0xfd0efffb, 31773 0xa779b492, 31774 0xa970b999, 31775 0xbb6bae84, 31776 0xb562a38f, 31777 0x9f5d80be, 31778 0x91548db5, 31779 0x834f9aa8, 31780 0x8d4697a3 31781 ]); 31782 function expandKey128(cipherKey) { 31783 var b = 176, result = new Uint8Array(b); 31784 result.set(cipherKey); 31785 for (var j = 16, i = 1; j < b; ++i) { 31786 var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4]; 31787 t1 = s[t1]; 31788 t2 = s[t2]; 31789 t3 = s[t3]; 31790 t4 = s[t4]; 31791 t1 = t1 ^ rcon[i]; 31792 for (var n = 0; n < 4; ++n) { 31793 result[j] = t1 ^= result[j - 16]; 31794 j++; 31795 result[j] = t2 ^= result[j - 16]; 31796 j++; 31797 result[j] = t3 ^= result[j - 16]; 31798 j++; 31799 result[j] = t4 ^= result[j - 16]; 31800 j++; 31801 } 31802 } 31803 return result; 31804 } 31805 function decrypt128(input, key) { 31806 var state = new Uint8Array(16); 31807 state.set(input); 31808 var i, j, k; 31809 var t, u, v; 31810 for (j = 0, k = 160; j < 16; ++j, ++k) { 31811 state[j] ^= key[k]; 31812 } 31813 for (i = 9; i >= 1; --i) { 31814 t = state[13]; 31815 state[13] = state[9]; 31816 state[9] = state[5]; 31817 state[5] = state[1]; 31818 state[1] = t; 31819 t = state[14]; 31820 u = state[10]; 31821 state[14] = state[6]; 31822 state[10] = state[2]; 31823 state[6] = t; 31824 state[2] = u; 31825 t = state[15]; 31826 u = state[11]; 31827 v = state[7]; 31828 state[15] = state[3]; 31829 state[11] = t; 31830 state[7] = u; 31831 state[3] = v; 31832 for (j = 0; j < 16; ++j) { 31833 state[j] = inv_s[state[j]]; 31834 } 31835 for (j = 0, k = i * 16; j < 16; ++j, ++k) { 31836 state[j] ^= key[k]; 31837 } 31838 for (j = 0; j < 16; j += 4) { 31839 var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]]; 31840 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 31841 state[j] = t >>> 24 & 0xFF; 31842 state[j + 1] = t >> 16 & 0xFF; 31843 state[j + 2] = t >> 8 & 0xFF; 31844 state[j + 3] = t & 0xFF; 31845 } 31846 } 31847 t = state[13]; 31848 state[13] = state[9]; 31849 state[9] = state[5]; 31850 state[5] = state[1]; 31851 state[1] = t; 31852 t = state[14]; 31853 u = state[10]; 31854 state[14] = state[6]; 31855 state[10] = state[2]; 31856 state[6] = t; 31857 state[2] = u; 31858 t = state[15]; 31859 u = state[11]; 31860 v = state[7]; 31861 state[15] = state[3]; 31862 state[11] = t; 31863 state[7] = u; 31864 state[3] = v; 31865 for (j = 0; j < 16; ++j) { 31866 state[j] = inv_s[state[j]]; 31867 state[j] ^= key[j]; 31868 } 31869 return state; 31870 } 31871 function encrypt128(input, key) { 31872 var t, u, v, k; 31873 var state = new Uint8Array(16); 31874 state.set(input); 31875 for (j = 0; j < 16; ++j) { 31876 state[j] ^= key[j]; 31877 } 31878 for (i = 1; i < 10; i++) { 31879 for (j = 0; j < 16; ++j) { 31880 state[j] = s[state[j]]; 31881 } 31882 v = state[1]; 31883 state[1] = state[5]; 31884 state[5] = state[9]; 31885 state[9] = state[13]; 31886 state[13] = v; 31887 v = state[2]; 31888 u = state[6]; 31889 state[2] = state[10]; 31890 state[6] = state[14]; 31891 state[10] = v; 31892 state[14] = u; 31893 v = state[3]; 31894 u = state[7]; 31895 t = state[11]; 31896 state[3] = state[15]; 31897 state[7] = v; 31898 state[11] = u; 31899 state[15] = t; 31900 for (var j = 0; j < 16; j += 4) { 31901 var s0 = state[j + 0], s1 = state[j + 1]; 31902 var s2 = state[j + 2], s3 = state[j + 3]; 31903 t = s0 ^ s1 ^ s2 ^ s3; 31904 state[j + 0] ^= t ^ mixCol[s0 ^ s1]; 31905 state[j + 1] ^= t ^ mixCol[s1 ^ s2]; 31906 state[j + 2] ^= t ^ mixCol[s2 ^ s3]; 31907 state[j + 3] ^= t ^ mixCol[s3 ^ s0]; 31908 } 31909 for (j = 0, k = i * 16; j < 16; ++j, ++k) { 31910 state[j] ^= key[k]; 31911 } 31912 } 31913 for (j = 0; j < 16; ++j) { 31914 state[j] = s[state[j]]; 31915 } 31916 v = state[1]; 31917 state[1] = state[5]; 31918 state[5] = state[9]; 31919 state[9] = state[13]; 31920 state[13] = v; 31921 v = state[2]; 31922 u = state[6]; 31923 state[2] = state[10]; 31924 state[6] = state[14]; 31925 state[10] = v; 31926 state[14] = u; 31927 v = state[3]; 31928 u = state[7]; 31929 t = state[11]; 31930 state[3] = state[15]; 31931 state[7] = v; 31932 state[11] = u; 31933 state[15] = t; 31934 for (j = 0, k = 160; j < 16; ++j, ++k) { 31935 state[j] ^= key[k]; 31936 } 31937 return state; 31938 } 31939 function AES128Cipher(key) { 31940 this.key = expandKey128(key); 31941 this.buffer = new Uint8Array(16); 31942 this.bufferPosition = 0; 31943 } 31944 function decryptBlock2(data, finalize) { 31945 var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv; 31946 for (i = 0; i < sourceLength; ++i) { 31947 buffer[bufferLength] = data[i]; 31948 ++bufferLength; 31949 if (bufferLength < 16) { 31950 continue; 31951 } 31952 var plain = decrypt128(buffer, this.key); 31953 for (j = 0; j < 16; ++j) { 31954 plain[j] ^= iv[j]; 31955 } 31956 iv = buffer; 31957 result.push(plain); 31958 buffer = new Uint8Array(16); 31959 bufferLength = 0; 31960 } 31961 this.buffer = buffer; 31962 this.bufferLength = bufferLength; 31963 this.iv = iv; 31964 if (result.length === 0) { 31965 return new Uint8Array([]); 31966 } 31967 var outputLength = 16 * result.length; 31968 if (finalize) { 31969 var lastBlock = result[result.length - 1]; 31970 var psLen = lastBlock[15]; 31971 if (psLen <= 16) { 31972 for (i = 15, ii = 16 - psLen; i >= ii; --i) { 31973 if (lastBlock[i] !== psLen) { 31974 psLen = 0; 31975 break; 31976 } 31977 } 31978 outputLength -= psLen; 31979 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 31980 } 31981 } 31982 var output = new Uint8Array(outputLength); 31983 for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 31984 output.set(result[i], j); 31985 } 31986 return output; 31987 } 31988 AES128Cipher.prototype = { 31989 decryptBlock: function AES128Cipher_decryptBlock(data, finalize) { 31990 var i, sourceLength = data.length; 31991 var buffer = this.buffer, bufferLength = this.bufferPosition; 31992 for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 31993 buffer[bufferLength] = data[i]; 31994 } 31995 if (bufferLength < 16) { 31996 this.bufferLength = bufferLength; 31997 return new Uint8Array([]); 31998 } 31999 this.iv = buffer; 32000 this.buffer = new Uint8Array(16); 32001 this.bufferLength = 0; 32002 this.decryptBlock = decryptBlock2; 32003 return this.decryptBlock(data.subarray(16), finalize); 32004 },
32005 encrypt: function AES128Cipher_encrypt(data, iv) { 32006 var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = []; 32007 if (!iv) { 32008 iv = new Uint8Array(16); 32009 } 32010 for (i = 0; i < sourceLength; ++i) { 32011 buffer[bufferLength] = data[i]; 32012 ++bufferLength; 32013 if (bufferLength < 16) { 32014 continue; 32015 } 32016 for (j = 0; j < 16; ++j) { 32017 buffer[j] ^= iv[j]; 32018 } 32019 var cipher = encrypt128(buffer, this.key); 32020 iv = cipher; 32021 result.push(cipher); 32022 buffer = new Uint8Array(16); 32023 bufferLength = 0; 32024 } 32025 this.buffer = buffer; 32026 this.bufferLength = bufferLength; 32027 this.iv = iv; 32028 if (result.length === 0) { 32029 return new Uint8Array([]); 32030 } 32031 var outputLength = 16 * result.length; 32032 var output = new Uint8Array(outputLength); 32033 for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 32034 output.set(result[i], j); 32035 } 32036 return output; 32037 } 32038 }; 32039 return AES128Cipher; 32040 }(); 32041 var AES256Cipher = function AES256CipherClosure() { 32042 var s = new Uint8Array([ 32043 0x63, 32044 0x7c, 32045 0x77, 32046 0x7b, 32047 0xf2, 32048 0x6b, 32049 0x6f, 32050 0xc5, 32051 0x30, 32052 0x01, 32053 0x67, 32054 0x2b, 32055 0xfe, 32056 0xd7, 32057 0xab, 32058 0x76, 32059 0xca, 32060 0x82, 32061 0xc9, 32062 0x7d, 32063 0xfa, 32064 0x59, 32065 0x47, 32066 0xf0, 32067 0xad, 32068 0xd4, 32069 0xa2, 32070 0xaf, 32071 0x9c, 32072 0xa4, 32073 0x72, 32074 0xc0, 32075 0xb7, 32076 0xfd, 32077 0x93, 32078 0x26, 32079 0x36, 32080 0x3f, 32081 0xf7, 32082 0xcc, 32083 0x34, 32084 0xa5, 32085 0xe5, 32086 0xf1, 32087 0x71, 32088 0xd8, 32089 0x31, 32090 0x15, 32091 0x04, 32092 0xc7, 32093 0x23, 32094 0xc3, 32095 0x18, 32096 0x96, 32097 0x05, 32098 0x9a, 32099 0x07, 32100 0x12, 32101 0x80, 32102 0xe2, 32103 0xeb, 32104 0x27, 32105 0xb2, 32106 0x75, 32107 0x09, 32108 0x83, 32109 0x2c, 32110 0x1a, 32111 0x1b, 32112 0x6e, 32113 0x5a, 32114 0xa0, 32115 0x52, 32116 0x3b, 32117 0xd6, 32118 0xb3, 32119 0x29, 32120 0xe3, 32121 0x2f, 32122 0x84, 32123 0x53, 32124 0xd1, 32125 0x00, 32126 0xed, 32127 0x20, 32128 0xfc, 32129 0xb1, 32130 0x5b, 32131 0x6a, 32132 0xcb, 32133 0xbe, 32134 0x39, 32135 0x4a, 32136 0x4c, 32137 0x58, 32138 0xcf, 32139 0xd0, 32140 0xef, 32141 0xaa, 32142 0xfb, 32143 0x43, 32144 0x4d, 32145 0x33, 32146 0x85, 32147 0x45, 32148 0xf9, 32149 0x02, 32150 0x7f, 32151 0x50, 32152 0x3c, 32153 0x9f, 32154 0xa8, 32155 0x51, 32156 0xa3, 32157 0x40, 32158 0x8f, 32159 0x92, 32160 0x9d, 32161 0x38, 32162 0xf5, 32163 0xbc, 32164 0xb6, 32165 0xda, 32166 0x21, 32167 0x10, 32168 0xff, 32169 0xf3, 32170 0xd2, 32171 0xcd, 32172 0x0c, 32173 0x13, 32174 0xec, 32175 0x5f, 32176 0x97, 32177 0x44, 32178 0x17, 32179 0xc4, 32180 0xa7, 32181 0x7e, 32182 0x3d, 32183 0x64, 32184 0x5d, 32185 0x19, 32186 0x73, 32187 0x60, 32188 0x81, 32189 0x4f, 32190 0xdc, 32191 0x22, 32192 0x2a, 32193 0x90, 32194 0x88, 32195 0x46, 32196 0xee, 32197 0xb8, 32198 0x14, 32199 0xde, 32200 0x5e, 32201 0x0b, 32202 0xdb, 32203 0xe0, 32204 0x32, 32205 0x3a, 32206 0x0a, 32207 0x49, 32208 0x06, 32209 0x24, 32210 0x5c, 32211 0xc2, 32212 0xd3, 32213 0xac, 32214 0x62, 32215 0x91, 32216 0x95, 32217 0xe4, 32218 0x79, 32219 0xe7, 32220 0xc8, 32221 0x37, 32222 0x6d, 32223 0x8d, 32224 0xd5, 32225 0x4e, 32226 0xa9, 32227 0x6c, 32228 0x56, 32229 0xf4, 32230 0xea, 32231 0x65, 32232 0x7a, 32233 0xae, 32234 0x08, 32235 0xba, 32236 0x78, 32237 0x25, 32238 0x2e, 32239 0x1c, 32240 0xa6, 32241 0xb4, 32242 0xc6, 32243 0xe8, 32244 0xdd, 32245 0x74, 32246 0x1f, 32247 0x4b, 32248 0xbd, 32249 0x8b, 32250 0x8a, 32251 0x70, 32252 0x3e, 32253 0xb5, 32254 0x66, 32255 0x48, 32256 0x03, 32257 0xf6, 32258 0x0e, 32259 0x61, 32260 0x35, 32261 0x57, 32262 0xb9, 32263 0x86, 32264 0xc1, 32265 0x1d, 32266 0x9e, 32267 0xe1, 32268 0xf8, 32269 0x98, 32270 0x11, 32271 0x69, 32272 0xd9, 32273 0x8e, 32274 0x94, 32275 0x9b, 32276 0x1e, 32277 0x87, 32278 0xe9, 32279 0xce, 32280 0x55, 32281 0x28, 32282 0xdf, 32283 0x8c, 32284 0xa1, 32285 0x89, 32286 0x0d, 32287 0xbf, 32288 0xe6, 32289 0x42, 32290 0x68, 32291 0x41, 32292 0x99, 32293 0x2d, 32294 0x0f, 32295 0xb0, 32296 0x54, 32297 0xbb, 32298 0x16 32299 ]); 32300 var inv_s = new Uint8Array([ 32301 0x52, 32302 0x09, 32303 0x6a, 32304 0xd5, 32305 0x30, 32306 0x36, 32307 0xa5, 32308 0x38, 32309 0xbf, 32310 0x40, 32311 0xa3, 32312 0x9e, 32313 0x81, 32314 0xf3, 32315 0xd7, 32316 0xfb, 32317 0x7c, 32318 0xe3, 32319 0x39, 32320 0x82, 32321 0x9b, 32322 0x2f, 32323 0xff, 32324 0x87,
32325 0x34, 32326 0x8e, 32327 0x43, 32328 0x44, 32329 0xc4, 32330 0xde, 32331 0xe9, 32332 0xcb, 32333 0x54, 32334 0x7b, 32335 0x94, 32336 0x32, 32337 0xa6, 32338 0xc2, 32339 0x23, 32340 0x3d, 32341 0xee, 32342 0x4c, 32343 0x95, 32344 0x0b, 32345 0x42, 32346 0xfa, 32347 0xc3, 32348 0x4e, 32349 0x08, 32350 0x2e, 32351 0xa1, 32352 0x66, 32353 0x28, 32354 0xd9, 32355 0x24, 32356 0xb2, 32357 0x76, 32358 0x5b, 32359 0xa2, 32360 0x49, 32361 0x6d, 32362 0x8b, 32363 0xd1, 32364 0x25, 32365 0x72, 32366 0xf8, 32367 0xf6, 32368 0x64, 32369 0x86, 32370 0x68, 32371 0x98, 32372 0x16, 32373 0xd4, 32374 0xa4, 32375 0x5c, 32376 0xcc, 32377 0x5d, 32378 0x65, 32379 0xb6, 32380 0x92, 32381 0x6c, 32382 0x70, 32383 0x48, 32384 0x50, 32385 0xfd, 32386 0xed, 32387 0xb9, 32388 0xda, 32389 0x5e, 32390 0x15, 32391 0x46, 32392 0x57, 32393 0xa7, 32394 0x8d, 32395 0x9d, 32396 0x84, 32397 0x90, 32398 0xd8, 32399 0xab, 32400 0x00, 32401 0x8c, 32402 0xbc, 32403 0xd3, 32404 0x0a, 32405 0xf7, 32406 0xe4, 32407 0x58, 32408 0x05, 32409 0xb8, 32410 0xb3, 32411 0x45, 32412 0x06, 32413 0xd0, 32414 0x2c, 32415 0x1e, 32416 0x8f, 32417 0xca, 32418 0x3f, 32419 0x0f, 32420 0x02, 32421 0xc1, 32422 0xaf, 32423 0xbd, 32424 0x03, 32425 0x01, 32426 0x13, 32427 0x8a, 32428 0x6b, 32429 0x3a, 32430 0x91, 32431 0x11, 32432 0x41, 32433 0x4f, 32434 0x67, 32435 0xdc, 32436 0xea, 32437 0x97, 32438 0xf2, 32439 0xcf, 32440 0xce, 32441 0xf0, 32442 0xb4, 32443 0xe6, 32444 0x73, 32445 0x96, 32446 0xac, 32447 0x74, 32448 0x22, 32449 0xe7, 32450 0xad, 32451 0x35, 32452 0x85, 32453 0xe2, 32454 0xf9, 32455 0x37, 32456 0xe8, 32457 0x1c, 32458 0x75, 32459 0xdf, 32460 0x6e, 32461 0x47, 32462 0xf1, 32463 0x1a, 32464 0x71, 32465 0x1d, 32466 0x29, 32467 0xc5, 32468 0x89, 32469 0x6f, 32470 0xb7, 32471 0x62, 32472 0x0e, 32473 0xaa, 32474 0x18, 32475 0xbe, 32476 0x1b, 32477 0xfc, 32478 0x56, 32479 0x3e, 32480 0x4b, 32481 0xc6, 32482 0xd2, 32483 0x79, 32484 0x20, 32485 0x9a, 32486 0xdb, 32487 0xc0, 32488 0xfe, 32489 0x78, 32490 0xcd, 32491 0x5a, 32492 0xf4, 32493 0x1f, 32494 0xdd, 32495 0xa8, 32496 0x33, 32497 0x88, 32498 0x07, 32499 0xc7, 32500 0x31, 32501 0xb1, 32502 0x12, 32503 0x10, 32504 0x59, 32505 0x27, 32506 0x80, 32507 0xec, 32508 0x5f, 32509 0x60, 32510 0x51, 32511 0x7f, 32512 0xa9, 32513 0x19, 32514 0xb5, 32515 0x4a, 32516 0x0d, 32517 0x2d, 32518 0xe5, 32519 0x7a, 32520 0x9f, 32521 0x93, 32522 0xc9, 32523 0x9c, 32524 0xef, 32525 0xa0, 32526 0xe0, 32527 0x3b, 32528 0x4d, 32529 0xae, 32530 0x2a, 32531 0xf5, 32532 0xb0, 32533 0xc8, 32534 0xeb, 32535 0xbb, 32536 0x3c, 32537 0x83, 32538 0x53, 32539 0x99, 32540 0x61, 32541 0x17, 32542 0x2b, 32543 0x04, 32544 0x7e, 32545 0xba, 32546 0x77, 32547 0xd6, 32548 0x26, 32549 0xe1, 32550 0x69, 32551 0x14, 32552 0x63, 32553 0x55, 32554 0x21, 32555 0x0c, 32556 0x7d 32557 ]); 32558 var mixCol = new Uint8Array(256); 32559 for (var i = 0; i < 256; i++) { 32560 if (i < 128) { 32561 mixCol[i] = i << 1; 32562 } else { 32563 mixCol[i] = i << 1 ^ 0x1b; 32564 } 32565 } 32566 var mix = new Uint32Array([ 32567 0x00000000, 32568 0x0e090d0b, 32569 0x1c121a16, 32570 0x121b171d, 32571 0x3824342c, 32572 0x362d3927, 32573 0x24362e3a, 32574 0x2a3f2331, 32575 0x70486858, 32576 0x7e416553, 32577 0x6c5a724e, 32578 0x62537f45, 32579 0x486c5c74, 32580 0x4665517f, 32581 0x547e4662, 32582 0x5a774b69, 32583 0xe090d0b0, 32584 0xee99ddbb, 32585 0xfc82caa6, 32586 0xf28bc7ad, 32587 0xd8b4e49c, 32588 0xd6bde997, 32589 0xc4a6fe8a, 32590 0xcaaff381, 32591 0x90d8b8e8, 32592 0x9ed1b5e3, 32593 0x8ccaa2fe, 32594 0x82c3aff5, 32595 0xa8fc8cc4, 32596 0xa6f581cf, 32597 0xb4ee96d2, 32598 0xbae79bd9, 32599 0xdb3bbb7b, 32600 0xd532b670, 32601 0xc729a16d, 32602 0xc920ac66, 32603 0xe31f8f57, 32604 0xed16825c, 32605 0xff0d9541, 32606 0xf104984a, 32607 0xab73d323, 32608 0xa57ade28, 32609 0xb761c935, 32610 0xb968c43e, 32611 0x9357e70f, 32612 0x9d5eea04, 32613 0x8f45fd19, 32614 0x814cf012, 32615 0x3bab6bcb, 32616 0x35a266c0, 32617 0x27b971dd, 32618 0x29b07cd6, 32619 0x038f5fe7, 32620 0x0d8652ec, 32621 0x1f9d45f1, 32622 0x119448fa, 32623 0x4be30393, 32624 0x45ea0e98, 32625 0x57f11985, 32626 0x59f8148e, 32627 0x73c737bf, 32628 0x7dce3ab4, 32629 0x6fd52da9, 32630 0x61dc20a2, 32631 0xad766df6, 32632 0xa37f60fd, 32633 0xb16477e0, 32634 0xbf6d7aeb, 32635 0x955259da, 32636 0x9b5b54d1, 32637 0x894043cc, 32638 0x87494ec7, 32639 0xdd3e05ae, 32640 0xd33708a5, 32641 0xc12c1fb8, 32642 0xcf2512b3, 32643 0xe51a3182, 32644 0xeb133c89, 32645 0xf9082b94, 32646 0xf701269f, 32647 0x4de6bd46, 32648 0x43efb04d,
32649 0x51f4a750, 32650 0x5ffdaa5b, 32651 0x75c2896a, 32652 0x7bcb8461, 32653 0x69d0937c, 32654 0x67d99e77, 32655 0x3daed51e, 32656 0x33a7d815, 32657 0x21bccf08, 32658 0x2fb5c203, 32659 0x058ae132, 32660 0x0b83ec39, 32661 0x1998fb24, 32662 0x1791f62f, 32663 0x764dd68d, 32664 0x7844db86, 32665 0x6a5fcc9b, 32666 0x6456c190, 32667 0x4e69e2a1, 32668 0x4060efaa, 32669 0x527bf8b7, 32670 0x5c72f5bc, 32671 0x0605bed5, 32672 0x080cb3de, 32673 0x1a17a4c3, 32674 0x141ea9c8, 32675 0x3e218af9, 32676 0x302887f2, 32677 0x223390ef, 32678 0x2c3a9de4, 32679 0x96dd063d, 32680 0x98d40b36, 32681 0x8acf1c2b, 32682 0x84c61120, 32683 0xaef93211, 32684 0xa0f03f1a, 32685 0xb2eb2807, 32686 0xbce2250c, 32687 0xe6956e65, 32688 0xe89c636e, 32689 0xfa877473, 32690 0xf48e7978, 32691 0xdeb15a49, 32692 0xd0b85742, 32693 0xc2a3405f, 32694 0xccaa4d54, 32695 0x41ecdaf7, 32696 0x4fe5d7fc, 32697 0x5dfec0e1, 32698 0x53f7cdea, 32699 0x79c8eedb, 32700 0x77c1e3d0, 32701 0x65daf4cd, 32702 0x6bd3f9c6, 32703 0x31a4b2af, 32704 0x3fadbfa4, 32705 0x2db6a8b9, 32706 0x23bfa5b2, 32707 0x09808683, 32708 0x07898b88, 32709 0x15929c95, 32710 0x1b9b919e, 32711 0xa17c0a47, 32712 0xaf75074c, 32713 0xbd6e1051, 32714 0xb3671d5a, 32715 0x99583e6b, 32716 0x97513360, 32717 0x854a247d, 32718 0x8b432976, 32719 0xd134621f, 32720 0xdf3d6f14, 32721 0xcd267809, 32722 0xc32f7502, 32723 0xe9105633, 32724 0xe7195b38, 32725 0xf5024c25, 32726 0xfb0b412e, 32727 0x9ad7618c, 32728 0x94de6c87, 32729 0x86c57b9a, 32730 0x88cc7691, 32731 0xa2f355a0, 32732 0xacfa58ab, 32733 0xbee14fb6, 32734 0xb0e842bd, 32735 0xea9f09d4, 32736 0xe49604df, 32737 0xf68d13c2, 32738 0xf8841ec9, 32739 0xd2bb3df8, 32740 0xdcb230f3, 32741 0xcea927ee, 32742 0xc0a02ae5, 32743 0x7a47b13c, 32744 0x744ebc37, 32745 0x6655ab2a, 32746 0x685ca621, 32747 0x42638510, 32748 0x4c6a881b, 32749 0x5e719f06, 32750 0x5078920d, 32751 0x0a0fd964, 32752 0x0406d46f, 32753 0x161dc372, 32754 0x1814ce79, 32755 0x322bed48, 32756 0x3c22e043, 32757 0x2e39f75e, 32758 0x2030fa55, 32759 0xec9ab701, 32760 0xe293ba0a, 32761 0xf088ad17, 32762 0xfe81a01c, 32763 0xd4be832d, 32764 0xdab78e26, 32765 0xc8ac993b, 32766 0xc6a59430, 32767 0x9cd2df59, 32768 0x92dbd252, 32769 0x80c0c54f, 32770 0x8ec9c844, 32771 0xa4f6eb75, 32772 0xaaffe67e, 32773 0xb8e4f163, 32774 0xb6edfc68, 32775 0x0c0a67b1, 32776 0x02036aba, 32777 0x10187da7, 32778 0x1e1170ac, 32779 0x342e539d, 32780 0x3a275e96, 32781 0x283c498b, 32782 0x26354480, 32783 0x7c420fe9, 32784 0x724b02e2, 32785 0x605015ff, 32786 0x6e5918f4, 32787 0x44663bc5, 32788 0x4a6f36ce, 32789 0x587421d3, 32790 0x567d2cd8, 32791 0x37a10c7a, 32792 0x39a80171, 32793 0x2bb3166c, 32794 0x25ba1b67, 32795 0x0f853856, 32796 0x018c355d, 32797 0x13972240, 32798 0x1d9e2f4b, 32799 0x47e96422, 32800 0x49e06929, 32801 0x5bfb7e34, 32802 0x55f2733f, 32803 0x7fcd500e, 32804 0x71c45d05, 32805 0x63df4a18, 32806 0x6dd64713, 32807 0xd731dcca, 32808 0xd938d1c1, 32809 0xcb23c6dc, 32810 0xc52acbd7, 32811 0xef15e8e6, 32812 0xe11ce5ed, 32813 0xf307f2f0, 32814 0xfd0efffb, 32815 0xa779b492, 32816 0xa970b999, 32817 0xbb6bae84, 32818 0xb562a38f, 32819 0x9f5d80be, 32820 0x91548db5, 32821 0x834f9aa8, 32822 0x8d4697a3 32823 ]); 32824 function expandKey256(cipherKey) { 32825 var b = 240, result = new Uint8Array(b); 32826 var r = 1; 32827 result.set(cipherKey); 32828 for (var j = 32, i = 1; j < b; ++i) { 32829 if (j % 32 === 16) { 32830 t1 = s[t1]; 32831 t2 = s[t2]; 32832 t3 = s[t3]; 32833 t4 = s[t4]; 32834 } else if (j % 32 === 0) { 32835 var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4]; 32836 t1 = s[t1]; 32837 t2 = s[t2]; 32838 t3 = s[t3]; 32839 t4 = s[t4]; 32840 t1 = t1 ^ r; 32841 if ((r <<= 1) >= 256) { 32842 r = (r ^ 0x1b) & 0xFF; 32843 } 32844 } 32845 for (var n = 0; n < 4; ++n) { 32846 result[j] = t1 ^= result[j - 32]; 32847 j++; 32848 result[j] = t2 ^= result[j - 32]; 32849 j++; 32850 result[j] = t3 ^= result[j - 32]; 32851 j++; 32852 result[j] = t4 ^= result[j - 32]; 32853 j++; 32854 } 32855 } 32856 return result; 32857 } 32858 function decrypt256(input, key) { 32859 var state = new Uint8Array(16); 32860 state.set(input); 32861 var i, j, k; 32862 var t, u, v; 32863 for (j = 0, k = 224; j < 16; ++j, ++k) { 32864 state[j] ^= key[k]; 32865 } 32866 for (i = 13; i >= 1; --i) { 32867 t = state[13]; 32868 state[13] = state[9]; 32869 state[9] = state[5]; 32870 state[5] = state[1]; 32871 state[1] = t; 32872 t = state[14]; 32873 u = state[10]; 32874 state[14] = state[6]; 32875 state[10] = state[2]; 32876 state[6] = t; 32877 state[2] = u; 32878 t = state[15]; 32879 u = state[11]; 32880 v = state[7]; 32881 state[15] = state[3]; 32882 state[11] = t; 32883 state[7] = u; 32884 state[3] = v; 32885 for (j = 0; j < 16; ++j) { 32886 state[j] = inv_s[state[j]]; 32887 } 32888 for (j = 0, k = i * 16; j < 16; ++j, ++k) { 32889 state[j] ^= key[k]; 32890 } 32891 for (j = 0; j < 16; j += 4) { 32892 var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]]; 32893 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 32894 state[j] = t >>> 24 & 0xFF; 32895 state[j + 1] = t >> 16 & 0xFF; 32896 state[j + 2] = t >> 8 & 0xFF; 32897 state[j + 3] = t & 0xFF; 32898 } 32899 } 32900 t = state[13]; 32901 state[13] = state[9]; 32902 state[9] = state[5]; 32903 state[5] = state[1]; 32904 state[1] = t; 32905 t = state[14]; 32906 u = state[10]; 32907 state[14] = state[6]; 32908 state[10] = state[2]; 32909 state[6] = t; 32910 state[2] = u; 32911 t = state[15]; 32912 u = state[11]; 32913 v = state[7]; 32914 state[15] = state[3]; 32915 state[11] = t; 32916 state[7] = u; 32917 state[3] = v; 32918 for (j = 0; j < 16; ++j) { 32919 state[j] = inv_s[state[j]]; 32920 state[j] ^= key[j]; 32921 } 32922 return state; 32923 } 32924 function encrypt256(input, key) { 32925 var t, u, v, k; 32926 var state = new Uint8Array(16); 32927 state.set(input); 32928 for (j = 0; j < 16; ++j) { 32929 state[j] ^= key[j]; 32930 } 32931 for (i = 1; i < 14; i++) { 32932 for (j = 0; j < 16; ++j) { 32933 state[j] = s[state[j]]; 32934 } 32935 v = state[1]; 32936 state[1] = state[5]; 32937 state[5] = state[9]; 32938 state[9] = state[13]; 32939 state[13] = v; 32940 v = state[2]; 32941 u = state[6]; 32942 state[2] = state[10]; 32943 state[6] = state[14]; 32944 state[10] = v; 32945 state[14] = u; 32946 v = state[3]; 32947 u = state[7]; 32948 t = state[11]; 32949 state[3] = state[15]; 32950 state[7] = v; 32951 state[11] = u; 32952 state[15] = t; 32953 for (var j = 0; j < 16; j += 4) { 32954 var s0 = state[j + 0], s1 = state[j + 1]; 32955 var s2 = state[j + 2], s3 = state[j + 3]; 32956 t = s0 ^ s1 ^ s2 ^ s3; 32957 state[j + 0] ^= t ^ mixCol[s0 ^ s1]; 32958 state[j + 1] ^= t ^ mixCol[s1 ^ s2]; 32959 state[j + 2] ^= t ^ mixCol[s2 ^ s3]; 32960 state[j + 3] ^= t ^ mixCol[s3 ^ s0]; 32961 } 32962 for (j = 0, k = i * 16; j < 16; ++j, ++k) { 32963 state[j] ^= key[k]; 32964 } 32965 } 32966 for (j = 0; j < 16; ++j) { 32967 state[j] = s[state[j]]; 32968 } 32969 v = state[1]; 32970 state[1] = state[5]; 32971 state[5] = state[9]; 32972 state[9] = state[13]; 32973 state[13] = v; 32974 v = state[2]; 32975 u = state[6]; 32976 state[2] = state[10]; 32977 state[6] = state[14]; 32978 state[10] = v; 32979 state[14] = u; 32980 v = state[3]; 32981 u = state[7]; 32982 t = state[11]; 32983 state[3] = state[15]; 32984 state[7] = v; 32985 state[11] = u; 32986 state[15] = t; 32987 for (j = 0, k = 224; j < 16; ++j, ++k) { 32988 state[j] ^= key[k]; 32989 } 32990 return state; 32991 } 32992 function AES256Cipher(key) { 32993 this.key = expandKey256(key); 32994 this.buffer = new Uint8Array(16); 32995 this.bufferPosition = 0; 32996 } 32997 function decryptBlock2(data, finalize) { 32998 var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv; 32999 for (i = 0; i < sourceLength; ++i) { 33000 buffer[bufferLength] = data[i]; 33001 ++bufferLength; 33002 if (bufferLength < 16) { 33003 continue; 33004 } 33005 var plain = decrypt256(buffer, this.key); 33006 for (j = 0; j < 16; ++j) { 33007 plain[j] ^= iv[j]; 33008 } 33009 iv = buffer; 33010 result.push(plain); 33011 buffer = new Uint8Array(16); 33012 bufferLength = 0; 33013 } 33014 this.buffer = buffer; 33015 this.bufferLength = bufferLength; 33016 this.iv = iv; 33017 if (result.length === 0) { 33018 return new Uint8Array([]); 33019 } 33020 var outputLength = 16 * result.length; 33021 if (finalize) { 33022 var lastBlock = result[result.length - 1]; 33023 var psLen = lastBlock[15]; 33024 if (psLen <= 16) { 33025 for (i = 15, ii = 16 - psLen; i >= ii; --i) { 33026 if (lastBlock[i] !== psLen) { 33027 psLen = 0; 33028 break; 33029 } 33030 } 33031 outputLength -= psLen; 33032 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 33033 } 33034 } 33035 var output = new Uint8Array(outputLength); 33036 for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 33037 output.set(result[i], j); 33038 } 33039 return output; 33040 } 33041 AES256Cipher.prototype = { 33042 decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) { 33043 var i, sourceLength = data.length; 33044 var buffer = this.buffer, bufferLength = this.bufferPosition; 33045 if (iv) { 33046 this.iv = iv; 33047 } else { 33048 for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 33049 buffer[bufferLength] = data[i]; 33050 } 33051 if (bufferLength < 16) { 33052 this.bufferLength = bufferLength; 33053 return new Uint8Array([]); 33054 } 33055 this.iv = buffer; 33056 data = data.subarray(16); 33057 } 33058 this.buffer = new Uint8Array(16); 33059 this.bufferLength = 0; 33060 this.decryptBlock = decryptBlock2; 33061 return this.decryptBlock(data, finalize); 33062 },
33063 encrypt: function AES256Cipher_encrypt(data, iv) { 33064 var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = []; 33065 if (!iv) { 33066 iv = new Uint8Array(16); 33067 } 33068 for (i = 0; i < sourceLength; ++i) { 33069 buffer[bufferLength] = data[i]; 33070 ++bufferLength; 33071 if (bufferLength < 16) { 33072 continue; 33073 } 33074 for (j = 0; j < 16; ++j) { 33075 buffer[j] ^= iv[j]; 33076 } 33077 var cipher = encrypt256(buffer, this.key); 33078 this.iv = cipher; 33079 result.push(cipher); 33080 buffer = new Uint8Array(16); 33081 bufferLength = 0; 33082 } 33083 this.buffer = buffer; 33084 this.bufferLength = bufferLength; 33085 this.iv = iv; 33086 if (result.length === 0) { 33087 return new Uint8Array([]); 33088 } 33089 var outputLength = 16 * result.length; 33090 var output = new Uint8Array(outputLength); 33091 for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 33092 output.set(result[i], j); 33093 } 33094 return output; 33095 } 33096 }; 33097 return AES256Cipher; 33098 }(); 33099 var PDF17 = function PDF17Closure() { 33100 function compareByteArrays(array1, array2) { 33101 if (array1.length !== array2.length) { 33102 return false; 33103 } 33104 for (var i = 0; i < array1.length; i++) { 33105 if (array1[i] !== array2[i]) { 33106 return false; 33107 } 33108 } 33109 return true; 33110 } 33111 function PDF17() { 33112 } 33113 PDF17.prototype = { 33114 checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 33115 var hashData = new Uint8Array(password.length + 56); 33116 hashData.set(password, 0); 33117 hashData.set(ownerValidationSalt, password.length); 33118 hashData.set(userBytes, password.length + ownerValidationSalt.length); 33119 var result = calculateSHA256(hashData, 0, hashData.length); 33120 return compareByteArrays(result, ownerPassword); 33121 }, 33122 checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) { 33123 var hashData = new Uint8Array(password.length + 8); 33124 hashData.set(password, 0); 33125 hashData.set(userValidationSalt, password.length); 33126 var result = calculateSHA256(hashData, 0, hashData.length); 33127 return compareByteArrays(result, userPassword); 33128 }, 33129 getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 33130 var hashData = new Uint8Array(password.length + 56); 33131 hashData.set(password, 0); 33132 hashData.set(ownerKeySalt, password.length); 33133 hashData.set(userBytes, password.length + ownerKeySalt.length); 33134 var key = calculateSHA256(hashData, 0, hashData.length); 33135 var cipher = new AES256Cipher(key); 33136 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 33137 }, 33138 getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) { 33139 var hashData = new Uint8Array(password.length + 8); 33140 hashData.set(password, 0); 33141 hashData.set(userKeySalt, password.length); 33142 var key = calculateSHA256(hashData, 0, hashData.length); 33143 var cipher = new AES256Cipher(key); 33144 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 33145 } 33146 }; 33147 return PDF17; 33148 }(); 33149 var PDF20 = function PDF20Closure() { 33150 function concatArrays(array1, array2) { 33151 var t = new Uint8Array(array1.length + array2.length); 33152 t.set(array1, 0); 33153 t.set(array2, array1.length); 33154 return t; 33155 } 33156 function calculatePDF20Hash(password, input, userBytes) { 33157 var k = calculateSHA256(input, 0, input.length).subarray(0, 32); 33158 var e = [0]; 33159 var i = 0; 33160 while (i < 64 || e[e.length - 1] > i - 32) { 33161 var arrayLength = password.length + k.length + userBytes.length; 33162 var k1 = new Uint8Array(arrayLength * 64); 33163 var array = concatArrays(password, k); 33164 array = concatArrays(array, userBytes); 33165 for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) { 33166 k1.set(array, pos); 33167 } 33168 var cipher = new AES128Cipher(k.subarray(0, 16)); 33169 e = cipher.encrypt(k1, k.subarray(16, 32)); 33170 var remainder = 0; 33171 for (var z = 0; z < 16; z++) { 33172 remainder *= 256 % 3; 33173 remainder %= 3; 33174 remainder += (e[z] >>> 0) % 3; 33175 remainder %= 3; 33176 } 33177 if (remainder === 0) { 33178 k = calculateSHA256(e, 0, e.length); 33179 } else if (remainder === 1) { 33180 k = calculateSHA384(e, 0, e.length); 33181 } else if (remainder === 2) { 33182 k = calculateSHA512(e, 0, e.length); 33183 } 33184 i++; 33185 } 33186 return k.subarray(0, 32); 33187 } 33188 function PDF20() { 33189 } 33190 function compareByteArrays(array1, array2) { 33191 if (array1.length !== array2.length) { 33192 return false;
33193 } 33194 for (var i = 0; i < array1.length; i++) { 33195 if (array1[i] !== array2[i]) { 33196 return false; 33197 } 33198 } 33199 return true; 33200 } 33201 PDF20.prototype = { 33202 hash: function PDF20_hash(password, concatBytes, userBytes) { 33203 return calculatePDF20Hash(password, concatBytes, userBytes); 33204 }, 33205 checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 33206 var hashData = new Uint8Array(password.length + 56); 33207 hashData.set(password, 0); 33208 hashData.set(ownerValidationSalt, password.length); 33209 hashData.set(userBytes, password.length + ownerValidationSalt.length); 33210 var result = calculatePDF20Hash(password, hashData, userBytes); 33211 return compareByteArrays(result, ownerPassword); 33212 }, 33213 checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) { 33214 var hashData = new Uint8Array(password.length + 8); 33215 hashData.set(password, 0); 33216 hashData.set(userValidationSalt, password.length); 33217 var result = calculatePDF20Hash(password, hashData, []); 33218 return compareByteArrays(result, userPassword); 33219 }, 33220 getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 33221 var hashData = new Uint8Array(password.length + 56); 33222 hashData.set(password, 0); 33223 hashData.set(ownerKeySalt, password.length); 33224 hashData.set(userBytes, password.length + ownerKeySalt.length); 33225 var key = calculatePDF20Hash(password, hashData, userBytes); 33226 var cipher = new AES256Cipher(key); 33227 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 33228 }, 33229 getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) { 33230 var hashData = new Uint8Array(password.length + 8); 33231 hashData.set(password, 0); 33232 hashData.set(userKeySalt, password.length); 33233 var key = calculatePDF20Hash(password, hashData, []); 33234 var cipher = new AES256Cipher(key); 33235 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 33236 } 33237 }; 33238 return PDF20; 33239 }(); 33240 var CipherTransform = function CipherTransformClosure() { 33241 function CipherTransform(stringCipherConstructor, streamCipherConstructor) { 33242 this.StringCipherConstructor = stringCipherConstructor; 33243 this.StreamCipherConstructor = streamCipherConstructor; 33244 } 33245 CipherTransform.prototype = { 33246 createStream: function CipherTransform_createStream(stream, length) { 33247 var cipher = new this.StreamCipherConstructor(); 33248 return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 33249 return cipher.decryptBlock(data, finalize); 33250 }); 33251 }, 33252 decryptString: function CipherTransform_decryptString(s) { 33253 var cipher = new this.StringCipherConstructor(); 33254 var data = stringToBytes(s); 33255 data = cipher.decryptBlock(data, true); 33256 return bytesToString(data); 33257 } 33258 }; 33259 return CipherTransform; 33260 }(); 33261 var CipherTransformFactory = function CipherTransformFactoryClosure() { 33262 var defaultPasswordBytes = new Uint8Array([ 33263 0x28, 33264 0xBF, 33265 0x4E, 33266 0x5E, 33267 0x4E, 33268 0x75, 33269 0x8A, 33270 0x41, 33271 0x64, 33272 0x00, 33273 0x4E, 33274 0x56, 33275 0xFF, 33276 0xFA, 33277 0x01, 33278 0x08, 33279 0x2E, 33280 0x2E, 33281 0x00, 33282 0xB6, 33283 0xD0, 33284 0x68, 33285 0x3E, 33286 0x80, 33287 0x2F, 33288 0x0C, 33289 0xA9, 33290 0xFE, 33291 0x64, 33292 0x53, 33293 0x69, 33294 0x7A 33295 ]); 33296 function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 33297 if (password) { 33298 var passwordLength = Math.min(127, password.length); 33299 password = password.subarray(0, passwordLength); 33300 } else { 33301 password = []; 33302 } 33303 var pdfAlgorithm; 33304 if (revision === 6) { 33305 pdfAlgorithm = new PDF20(); 33306 } else { 33307 pdfAlgorithm = new PDF17(); 33308 } 33309 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 33310 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 33311 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
33312 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 33313 } 33314 return null; 33315 } 33316 function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 33317 var hashDataSize = 40 + ownerPassword.length + fileId.length; 33318 var hashData = new Uint8Array(hashDataSize), i = 0, j, n; 33319 if (password) { 33320 n = Math.min(32, password.length); 33321 for (; i < n; ++i) { 33322 hashData[i] = password[i]; 33323 } 33324 } 33325 j = 0; 33326 while (i < 32) { 33327 hashData[i++] = defaultPasswordBytes[j++]; 33328 } 33329 for (j = 0, n = ownerPassword.length; j < n; ++j) { 33330 hashData[i++] = ownerPassword[j]; 33331 } 33332 hashData[i++] = flags & 0xFF; 33333 hashData[i++] = flags >> 8 & 0xFF; 33334 hashData[i++] = flags >> 16 & 0xFF; 33335 hashData[i++] = flags >>> 24 & 0xFF; 33336 for (j = 0, n = fileId.length; j < n; ++j) { 33337 hashData[i++] = fileId[j]; 33338 } 33339 if (revision >= 4 && !encryptMetadata) { 33340 hashData[i++] = 0xFF; 33341 hashData[i++] = 0xFF; 33342 hashData[i++] = 0xFF; 33343 hashData[i++] = 0xFF; 33344 } 33345 var hash = calculateMD5(hashData, 0, i); 33346 var keyLengthInBytes = keyLength >> 3; 33347 if (revision >= 3) { 33348 for (j = 0; j < 50; ++j) { 33349 hash = calculateMD5(hash, 0, keyLengthInBytes); 33350 } 33351 } 33352 var encryptionKey = hash.subarray(0, keyLengthInBytes); 33353 var cipher, checkData; 33354 if (revision >= 3) { 33355 for (i = 0; i < 32; ++i) { 33356 hashData[i] = defaultPasswordBytes[i]; 33357 } 33358 for (j = 0, n = fileId.length; j < n; ++j) { 33359 hashData[i++] = fileId[j]; 33360 } 33361 cipher = new ARCFourCipher(encryptionKey); 33362 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 33363 n = encryptionKey.length; 33364 var derivedKey = new Uint8Array(n), k; 33365 for (j = 1; j <= 19; ++j) { 33366 for (k = 0; k < n; ++k) { 33367 derivedKey[k] = encryptionKey[k] ^ j; 33368 } 33369 cipher = new ARCFourCipher(derivedKey); 33370 checkData = cipher.encryptBlock(checkData); 33371 } 33372 for (j = 0, n = checkData.length; j < n; ++j) { 33373 if (userPassword[j] !== checkData[j]) { 33374 return null; 33375 } 33376 } 33377 } else { 33378 cipher = new ARCFourCipher(encryptionKey); 33379 checkData = cipher.encryptBlock(defaultPasswordBytes); 33380 for (j = 0, n = checkData.length; j < n; ++j) { 33381 if (userPassword[j] !== checkData[j]) { 33382 return null; 33383 } 33384 } 33385 } 33386 return encryptionKey; 33387 } 33388 function decodeUserPassword(password, ownerPassword, revision, keyLength) { 33389 var hashData = new Uint8Array(32), i = 0, j, n; 33390 n = Math.min(32, password.length); 33391 for (; i < n; ++i) { 33392 hashData[i] = password[i]; 33393 } 33394 j = 0; 33395 while (i < 32) { 33396 hashData[i++] = defaultPasswordBytes[j++]; 33397 } 33398 var hash = calculateMD5(hashData, 0, i); 33399 var keyLengthInBytes = keyLength >> 3; 33400 if (revision >= 3) { 33401 for (j = 0; j < 50; ++j) { 33402 hash = calculateMD5(hash, 0, hash.length); 33403 } 33404 } 33405 var cipher, userPassword; 33406 if (revision >= 3) { 33407 userPassword = ownerPassword; 33408 var derivedKey = new Uint8Array(keyLengthInBytes), k; 33409 for (j = 19; j >= 0; j--) { 33410 for (k = 0; k < keyLengthInBytes; ++k) { 33411 derivedKey[k] = hash[k] ^ j; 33412 } 33413 cipher = new ARCFourCipher(derivedKey); 33414 userPassword = cipher.encryptBlock(userPassword); 33415 } 33416 } else { 33417 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 33418 userPassword = cipher.encryptBlock(ownerPassword); 33419 } 33420 return userPassword; 33421 } 33422 var identityName = Name.get('Identity'); 33423 function CipherTransformFactory(dict, fileId, password) { 33424 var filter = dict.get('Filter'); 33425 if (!isName(filter, 'Standard')) { 33426 error('unknown encryption method'); 33427 } 33428 this.dict = dict; 33429 var algorithm = dict.get('V'); 33430 if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 33431 error('unsupported encryption algorithm'); 33432 } 33433 this.algorithm = algorithm; 33434 var keyLength = dict.get('Length'); 33435 if (!keyLength) { 33436 if (algorithm <= 3) { 33437 keyLength = 40; 33438 } else { 33439 var cfDict = dict.get('CF'); 33440 var streamCryptoName = dict.get('StmF'); 33441 if (isDict(cfDict) && isName(streamCryptoName)) { 33442 cfDict.suppressEncryption = true; 33443 var handlerDict = cfDict.get(streamCryptoName.name); 33444 keyLength = handlerDict && handlerDict.get('Length') || 128; 33445 if (keyLength < 40) { 33446 keyLength <<= 3; 33447 } 33448 } 33449 } 33450 } 33451 if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 33452 error('invalid key length'); 33453 } 33454 var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32); 33455 var userPassword = stringToBytes(dict.get('U')).subarray(0, 32); 33456 var flags = dict.get('P'); 33457 var revision = dict.get('R'); 33458 var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false; 33459 this.encryptMetadata = encryptMetadata; 33460 var fileIdBytes = stringToBytes(fileId); 33461 var passwordBytes; 33462 if (password) { 33463 if (revision === 6) { 33464 try { 33465 password = utf8StringToString(password); 33466 } catch (ex) { 33467 warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.'); 33468 } 33469 } 33470 passwordBytes = stringToBytes(password); 33471 } 33472 var encryptionKey; 33473 if (algorithm !== 5) { 33474 encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 33475 } else { 33476 var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
33477 var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48); 33478 var uBytes = stringToBytes(dict.get('U')).subarray(0, 48); 33479 var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40); 33480 var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48); 33481 var ownerEncryption = stringToBytes(dict.get('OE')); 33482 var userEncryption = stringToBytes(dict.get('UE')); 33483 var perms = stringToBytes(dict.get('Perms')); 33484 encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 33485 } 33486 if (!encryptionKey && !password) { 33487 throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD); 33488 } else if (!encryptionKey && password) { 33489 var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 33490 encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 33491 } 33492 if (!encryptionKey) { 33493 throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD); 33494 } 33495 this.encryptionKey = encryptionKey; 33496 if (algorithm >= 4) { 33497 var cf = dict.get('CF'); 33498 if (isDict(cf)) {
33499 cf.suppressEncryption = true; 33500 } 33501 this.cf = cf; 33502 this.stmf = dict.get('StmF') || identityName; 33503 this.strf = dict.get('StrF') || identityName; 33504 this.eff = dict.get('EFF') || this.stmf; 33505 } 33506 } 33507 function buildObjectKey(num, gen, encryptionKey, isAes) { 33508 var key = new Uint8Array(encryptionKey.length + 9), i, n; 33509 for (i = 0, n = encryptionKey.length; i < n; ++i) { 33510 key[i] = encryptionKey[i]; 33511 } 33512 key[i++] = num & 0xFF; 33513 key[i++] = num >> 8 & 0xFF; 33514 key[i++] = num >> 16 & 0xFF; 33515 key[i++] = gen & 0xFF; 33516 key[i++] = gen >> 8 & 0xFF; 33517 if (isAes) { 33518 key[i++] = 0x73; 33519 key[i++] = 0x41; 33520 key[i++] = 0x6C; 33521 key[i++] = 0x54; 33522 } 33523 var hash = calculateMD5(key, 0, i); 33524 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 33525 } 33526 function buildCipherConstructor(cf, name, num, gen, key) { 33527 assert(isName(name), 'Invalid crypt filter name.'); 33528 var cryptFilter = cf.get(name.name); 33529 var cfm; 33530 if (cryptFilter
33530!== null && cryptFilter !== undefined) { 33531 cfm = cryptFilter.get('CFM'); 33532 } 33533 if (!cfm || cfm.name === 'None') { 33534 return function cipherTransformFactoryBuildCipherConstructorNone() { 33535 return new NullCipher(); 33536 }; 33537 } 33538 if (cfm.name === 'V2') { 33539 return function cipherTransformFactoryBuildCipherConstructorV2() { 33540 return new ARCFourCipher(buildObjectKey(num, gen, key, false)); 33541 }; 33542 } 33543 if (cfm.name === 'AESV2') { 33544 return function cipherTransformFactoryBuildCipherConstructorAESV2() { 33545 return new AES128Cipher(buildObjectKey(num, gen, key, true)); 33546 }; 33547 } 33548 if (cfm.name === 'AESV3') { 33549 return function cipherTransformFactoryBuildCipherConstructorAESV3() { 33550 return new AES256Cipher(key); 33551 }; 33552 } 33553 error('Unknown crypto method'); 33554 } 33555 CipherTransformFactory.prototype = { 33556 createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) { 33557 if (this.algorithm === 4 || this.algorithm === 5) { 33558 return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey)); 33559 } 33560 var key = buildObjectKey(num, gen, this.encryptionKey, false); 33561 var cipherConstructor = function buildCipherCipherConstructor() { 33562 return new ARCFourCipher(key); 33563 }; 33564 return new CipherTransform(cipherConstructor, cipherConstructor); 33565 } 33566 }; 33567 return CipherTransformFactory; 33568 }(); 33569 exports.AES128Cipher = AES128Cipher; 33570 exports.AES256Cipher = AES256Cipher; 33571 exports.ARCFourCipher = ARCFourCipher; 33572 exports.CipherTransformFactory = CipherTransformFactory; 33573 exports.PDF17 = PDF17; 33574 exports.PDF20 = PDF20; 33575 exports.calculateMD5 = calculateMD5; 33576 exports.calculateSHA256 = calculateSHA256; 33577 exports.calculateSHA384 = calculateSHA384; 33578 exports.calculateSHA512 = calculateSHA512; 33579 })); 33580 (function (root, factory) { 33581 factory(root.pdfjsCoreFontRenderer = {}, root.pdfjsSharedUtil, root.pdfjsCoreStream, root.pdfjsCoreGlyphList, root.pdfjsCoreEncodings, root.pdfjsCoreCFFParser); 33582 }(this, function (exports, sharedUtil, coreStream, coreGlyphList, coreEncodings, coreCFFParser) { 33583 var Util = sharedUtil.Util; 33584 var bytesToString = sharedUtil.bytesToString; 33585 var error = sharedUtil.error; 33586 var Stream = coreStream.Stream; 33587 var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode; 33588 var StandardEncoding = coreEncodings.StandardEncoding; 33589 var CFFParser = coreCFFParser.CFFParser; 33590 var FontRendererFactory = function FontRendererFactoryClosure() { 33591 function getLong(data, offset) { 33592 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 33593 } 33594 function getUshort(data, offset) { 33595 return data[offset] << 8 | data[offset + 1]; 33596 } 33597 function parseCmap(data, start, end) { 33598 var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16); 33599 var format = getUshort(data, start + offset); 33600 var ranges, p, i; 33601 if (format === 4) { 33602 getUshort(data, start + offset + 2); 33603 var segCount = getUshort(data, start + offset + 6) >> 1; 33604 p = start + offset + 14; 33605 ranges = []; 33606 for (i = 0; i < segCount; i++, p += 2) { 33607 ranges[i] = { end: getUshort(data, p) }; 33608 } 33609 p += 2; 33610 for (i = 0; i < segCount; i++, p += 2) { 33611 ranges[i].start = getUshort(data, p); 33612 } 33613 for (i = 0; i < segCount; i++, p += 2) { 33614 ranges[i].idDelta = getUshort(data, p); 33615 } 33616 for (i = 0; i < segCount; i++, p += 2) { 33617 var idOffset = getUshort(data, p); 33618 if (idOffset === 0) { 33619 continue; 33620 } 33621 ranges[i].ids = []; 33622 for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 33623 ranges[i].ids[j] = getUshort(data, p + idOffset); 33624 idOffset += 2; 33625 } 33626 } 33627 return ranges; 33628 } else if (format === 12) { 33629 getLong(data, start + offset + 4); 33630 var groups = getLong(data, start + offset + 12); 33631 p = start + offset + 16; 33632 ranges = []; 33633 for (i = 0; i < groups; i++) { 33634 ranges.push({ 33635 start: getLong(data, p), 33636 end: getLong(data, p + 4), 33637 idDelta: getLong(data, p + 8) - getLong(data, p) 33638 }); 33639 p += 12; 33640 } 33641 return ranges; 33642 } 33643 error('not supported cmap: ' + format); 33644 } 33645 function parseCff(data, start, end, seacAnalysisEnabled) { 33646 var properties = {};
33647 var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled); 33648 var cff = parser.parse(); 33649 return { 33650 glyphs: cff.charStrings.objects, 33651 subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, 33652 gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects 33653 }; 33654 } 33655 function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 33656 var itemSize, itemDecode; 33657 if (isGlyphLocationsLong) { 33658 itemSize = 4; 33659 itemDecode = function fontItemDecodeLong(data, offset) { 33660 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 33661 }; 33662 } else { 33663 itemSize = 2; 33664 itemDecode = function fontItemDecode(data, offset) { 33665 return data[offset] << 9 | data[offset + 1] << 1; 33666 }; 33667 } 33668 var glyphs = []; 33669 var startOffset = itemDecode(loca, 0); 33670 for (var j = itemSize; j < loca.length; j += itemSize) { 33671 var endOffset = itemDecode(loca, j); 33672 glyphs.push(glyf.subarray(startOffset, endOffset)); 33673 startOffset = endOffset; 33674 } 33675 return glyphs; 33676 } 33677 function lookupCmap(ranges, unicode) { 33678 var code = unicode.charCodeAt(0), gid = 0; 33679 var l = 0, r = ranges.length - 1; 33680 while (l < r) { 33681 var c = l + r + 1 >> 1; 33682 if (code < ranges[c].start) { 33683 r = c - 1; 33684 } else { 33685 l = c; 33686 } 33687 } 33688 if (ranges[l].start <= code && code <= ranges[l].end) { 33689 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF; 33690 } 33691 return { 33692 charCode: code, 33693 glyphId: gid 33694 }; 33695 } 33696 function compileGlyf(code, cmds, font) { 33697 function moveTo(x, y) { 33698 cmds.push({ 33699 cmd: 'moveTo', 33700 args: [ 33701 x, 33702 y 33703 ] 33704 }); 33705 } 33706 function lineTo(x, y) { 33707 cmds.push({ 33708 cmd: 'lineTo', 33709 args: [ 33710 x, 33711 y 33712 ] 33713 }); 33714 } 33715 function quadraticCurveTo(xa, ya, x, y) { 33716 cmds.push({ 33717 cmd: 'quadraticCurveTo', 33718 args: [ 33719 xa, 33720 ya, 33721 x, 33722 y 33723 ] 33724 }); 33725 } 33726 var i = 0; 33727 var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16; 33728 var flags; 33729 var x = 0, y = 0; 33730 i += 10; 33731 if (numberOfContours < 0) { 33732 do { 33733 flags = code[i] << 8 | code[i + 1]; 33734 var glyphIndex = code[i + 2] << 8 | code[i + 3]; 33735 i += 4; 33736 var arg1, arg2; 33737 if (flags & 0x01) { 33738 arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16; 33739 arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16; 33740 i += 4; 33741 } else { 33742 arg1 = code[i++]; 33743 arg2 = code[i++]; 33744 } 33745 if (flags & 0x02) { 33746 x = arg1; 33747 y = arg2; 33748 } else { 33749 x = 0; 33750 y = 0; 33751 } 33752 var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0; 33753 if (flags & 0x08) { 33754 scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 33755 i += 2; 33756 } else if (flags & 0x40) { 33757 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 33758 scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 33759 i += 4; 33760 } else if (flags & 0x80) { 33761 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 33762 scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 33763 scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824; 33764 scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824; 33765 i += 8; 33766 } 33767 var subglyph = font.glyphs[glyphIndex]; 33768 if (subglyph) { 33769 cmds.push({ cmd: 'save' }); 33770 cmds.push({ 33771 cmd: 'transform', 33772 args: [ 33773 scaleX, 33774 scale01, 33775 scale10, 33776 scaleY, 33777 x, 33778 y 33779 ] 33780 }); 33781 compileGlyf(subglyph, cmds, font); 33782 cmds.push({ cmd: 'restore' }); 33783 } 33784 } while (flags & 0x20); 33785 } else { 33786 var endPtsOfContours = []; 33787 var j, jj; 33788 for (j = 0; j < numberOfContours; j++) { 33789 endPtsOfContours.push(code[i] << 8 | code[i + 1]); 33790 i += 2; 33791 } 33792 var instructionLength = code[i] << 8 | code[i + 1]; 33793 i += 2 + instructionLength; 33794 var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1; 33795 var points = []; 33796 while (points.length < numberOfPoints) { 33797 flags = code[i++]; 33798 var repeat = 1; 33799 if (flags & 0x08) { 33800 repeat += code[i++]; 33801 } 33802 while (repeat-- > 0) { 33803 points.push({ flags: flags }); 33804 } 33805 } 33806 for (j = 0; j < numberOfPoints; j++) { 33807 switch (points[j].flags & 0x12) { 33808 case 0x00: 33809 x += (code[i] << 24 | code[i + 1] << 16) >> 16; 33810 i += 2; 33811 break; 33812 case 0x02: 33813 x -= code[i++]; 33814 break; 33815 case 0x12: 33816 x += code[i++]; 33817 break; 33818 } 33819 points[j].x = x; 33820 } 33821 for (j = 0; j < numberOfPoints; j++) { 33822 switch (points[j].flags & 0x24) { 33823 case 0x00: 33824 y += (code[i] << 24 | code[i + 1] << 16) >> 16; 33825 i += 2; 33826 break; 33827 case 0x04: 33828 y -= code[i++]; 33829 break; 33830 case 0x24: 33831 y += code[i++]; 33832 break; 33833 } 33834 points[j].y = y; 33835 } 33836 var startPoint = 0; 33837 for (i = 0; i < numberOfContours; i++) { 33838 var endPoint = endPtsOfContours[i]; 33839 var contour = points.slice(startPoint, endPoint + 1); 33840 if (contour[0].flags & 1) { 33841 contour.push(contour[0]); 33842 } else if (contour[contour.length - 1].flags & 1) { 33843 contour.unshift(contour[contour.length - 1]); 33844 } else { 33845 var p = { 33846 flags: 1, 33847 x: (contour[0].x + contour[contour.length - 1].x) / 2, 33848 y: (contour[0].y + contour[contour.length - 1].y) / 2 33849 }; 33850 contour.unshift(p); 33851 contour.push(p); 33852 } 33853 moveTo(contour[0].x, contour[0].y); 33854 for (j = 1, jj = contour.length; j < jj; j++) { 33855 if (contour[j].flags & 1) { 33856 lineTo(contour[j].x, contour[j].y); 33857 } else if (contour[j + 1].flags & 1) { 33858 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 33859 j++; 33860 } else { 33861 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 33862 } 33863 } 33864 startPoint = endPoint + 1; 33865 } 33866 } 33867 } 33868 function compileCharString(code, cmds, font) { 33869 var stack = []; 33870 var x = 0, y = 0; 33871 var stems = 0; 33872 function moveTo(x, y) { 33873 cmds.push({ 33874 cmd: 'moveTo', 33875 args: [ 33876 x, 33877 y 33878 ] 33879 }); 33880 } 33881 function lineTo(x, y) { 33882 cmds.push({ 33883 cmd: 'lineTo', 33884 args: [ 33885 x, 33886 y 33887 ] 33888 }); 33889 } 33890 function bezierCurveTo(x1, y1, x2, y2, x, y) { 33891 cmds.push({ 33892 cmd: 'bezierCurveTo', 33893 args: [ 33894 x1, 33895 y1, 33896 x2, 33897 y2, 33898 x, 33899 y 33900 ] 33901 }); 33902 } 33903 function parse(code) { 33904 var i = 0; 33905 while (i < code.length) { 33906 var stackClean = false;
vendor: 8,461 bytes, lines 33907-34209
33907 var v = code[i++]; 33908 var xa, xb, ya, yb, y1, y2, y3, n, subrCode; 33909 switch (v) { 33910 case 1: 33911 stems += stack.length >> 1; 33912 stackClean = true; 33913 break; 33914 case 3: 33915 stems += stack.length >> 1; 33916 stackClean = true; 33917 break; 33918 case 4: 33919 y += stack.pop(); 33920 moveTo(x, y); 33921 stackClean = true; 33922 break; 33923 case 5: 33924 while (stack.length > 0) { 33925 x += stack.shift(); 33926 y += stack.shift(); 33927 lineTo(x, y); 33928 } 33929 break; 33930 case 6: 33931 while (stack.length > 0) { 33932 x += stack.shift(); 33933 lineTo(x, y); 33934 if (stack.length === 0) { 33935 break; 33936 } 33937 y += stack.shift(); 33938 lineTo(x, y); 33939 } 33940 break; 33941 case 7: 33942 while (stack.length > 0) { 33943 y += stack.shift(); 33944 lineTo(x, y); 33945 if (stack.length === 0) { 33946 break; 33947 } 33948 x += stack.shift(); 33949 lineTo(x, y); 33950 } 33951 break; 33952 case 8: 33953 while (stack.length > 0) { 33954 xa = x + stack.shift(); 33955 ya = y + stack.shift(); 33956 xb = xa + stack.shift(); 33957 yb = ya + stack.shift(); 33958 x = xb + stack.shift(); 33959 y = yb + stack.shift(); 33960 bezierCurveTo(xa, ya, xb, yb, x, y); 33961 } 33962 break; 33963 case 10: 33964 n = stack.pop() + font.subrsBias; 33965 subrCode = font.subrs[n]; 33966 if (subrCode) { 33967 parse(subrCode); 33968 } 33969 break; 33970 case 11: 33971 return; 33972 case 12: 33973 v = code[i++]; 33974 switch (v) { 33975 case 34: 33976 xa = x + stack.shift(); 33977 xb = xa + stack.shift(); 33978 y1 = y + stack.shift(); 33979 x = xb + stack.shift(); 33980 bezierCurveTo(xa, y, xb, y1, x, y1); 33981 xa = x + stack.shift(); 33982 xb = xa + stack.shift(); 33983 x = xb + stack.shift(); 33984 bezierCurveTo(xa, y1, xb, y, x, y); 33985 break; 33986 case 35: 33987 xa = x + stack.shift(); 33988 ya = y + stack.shift(); 33989 xb = xa + stack.shift(); 33990 yb = ya + stack.shift(); 33991 x = xb + stack.shift(); 33992 y = yb + stack.shift(); 33993 bezierCurveTo(xa, ya, xb, yb, x, y); 33994 xa = x + stack.shift(); 33995 ya = y + stack.shift(); 33996 xb = xa + stack.shift(); 33997 yb = ya + stack.shift(); 33998 x = xb + stack.shift(); 33999 y = yb + stack.shift(); 34000 bezierCurveTo(xa, ya, xb, yb, x, y); 34001 stack.pop(); 34002 break; 34003 case 36: 34004 xa = x + stack.shift(); 34005 y1 = y + stack.shift(); 34006 xb = xa + stack.shift(); 34007 y2 = y1 + stack.shift(); 34008 x = xb + stack.shift(); 34009 bezierCurveTo(xa, y1, xb, y2, x, y2); 34010 xa = x + stack.shift(); 34011 xb = xa + stack.shift(); 34012 y3 = y2 + stack.shift(); 34013 x = xb + stack.shift(); 34014 bezierCurveTo(xa, y2, xb, y3, x, y); 34015 break; 34016 case 37: 34017 var x0 = x, y0 = y; 34018 xa = x + stack.shift(); 34019 ya = y + stack.shift(); 34020 xb = xa + stack.shift(); 34021 yb = ya + stack.shift(); 34022 x = xb + stack.shift(); 34023 y = yb + stack.shift(); 34024 bezierCurveTo(xa, ya, xb, yb, x, y); 34025 xa = x + stack.shift(); 34026 ya = y + stack.shift(); 34027 xb = xa + stack.shift(); 34028 yb = ya + stack.shift(); 34029 x = xb; 34030 y = yb; 34031 if (Math.abs(x - x0) > Math.abs(y - y0)) { 34032 x += stack.shift(); 34033 } else { 34034 y += stack.shift(); 34035 } 34036 bezierCurveTo(xa, ya, xb, yb, x, y); 34037 break; 34038 default: 34039 error('unknown operator: 12 ' + v); 34040 } 34041 break; 34042 case 14: 34043 if (stack.length >= 4) { 34044 var achar = stack.pop(); 34045 var bchar = stack.pop(); 34046 y = stack.pop(); 34047 x = stack.pop(); 34048 cmds.push({ cmd: 'save' }); 34049 cmds.push({ 34050 cmd: 'translate', 34051 args: [ 34052 x, 34053 y 34054 ] 34055 }); 34056 var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]])); 34057 compileCharString(font.glyphs[cmap.glyphId], cmds, font); 34058 cmds.push({ cmd: 'restore' }); 34059 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]])); 34060 compileCharString(font.glyphs[cmap.glyphId], cmds, font); 34061 } 34062 return; 34063 case 18: 34064 stems += stack.length >> 1; 34065 stackClean = true; 34066 break; 34067 case 19: 34068 stems += stack.length >> 1; 34069 i += stems + 7 >> 3; 34070 stackClean = true; 34071 break; 34072 case 20: 34073 stems += stack.length >> 1; 34074 i += stems + 7 >> 3; 34075 stackClean = true; 34076 break; 34077 case 21: 34078 y += stack.pop(); 34079 x += stack.pop(); 34080 moveTo(x, y); 34081 stackClean = true; 34082 break; 34083 case 22: 34084 x += stack.pop(); 34085 moveTo(x, y); 34086 stackClean = true; 34087 break; 34088 case 23: 34089 stems += stack.length >> 1; 34090 stackClean = true; 34091 break; 34092 case 24: 34093 while (stack.length > 2) { 34094 xa = x + stack.shift(); 34095 ya = y + stack.shift(); 34096 xb = xa + stack.shift(); 34097 yb = ya + stack.shift(); 34098 x = xb + stack.shift(); 34099 y = yb + stack.shift(); 34100 bezierCurveTo(xa, ya, xb, yb, x, y); 34101 } 34102 x += stack.shift(); 34103 y += stack.shift(); 34104 lineTo(x, y); 34105 break; 34106 case 25: 34107 while (stack.length > 6) { 34108 x += stack.shift(); 34109 y += stack.shift(); 34110 lineTo(x, y); 34111 } 34112 xa = x + stack.shift(); 34113 ya = y + stack.shift(); 34114 xb = xa + stack.shift(); 34115 yb = ya + stack.shift(); 34116 x = xb + stack.shift(); 34117 y = yb + stack.shift(); 34118 bezierCurveTo(xa, ya, xb, yb, x, y); 34119 break; 34120 case 26: 34121 if (stack.length % 2) { 34122 x += stack.shift(); 34123 } 34124 while (stack.length > 0) { 34125 xa = x; 34126 ya = y + stack.shift(); 34127 xb = xa + stack.shift(); 34128 yb = ya + stack.shift(); 34129 x = xb; 34130 y = yb + stack.shift(); 34131 bezierCurveTo(xa, ya, xb, yb, x, y); 34132 } 34133 break; 34134 case 27: 34135 if (stack.length % 2) { 34136 y += stack.shift(); 34137 } 34138 while (stack.length > 0) { 34139 xa = x + stack.shift(); 34140 ya = y; 34141 xb = xa + stack.shift(); 34142 yb = ya + stack.shift(); 34143 x = xb + stack.shift(); 34144 y = yb; 34145 bezierCurveTo(xa, ya, xb, yb, x, y); 34146 } 34147 break; 34148 case 28: 34149 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 34150 i += 2; 34151 break; 34152 case 29: 34153 n = stack.pop() + font.gsubrsBias; 34154 subrCode = font.gsubrs[n]; 34155 if (subrCode) { 34156 parse(subrCode); 34157 } 34158 break; 34159 case 30: 34160 while (stack.length > 0) { 34161 xa = x; 34162 ya = y + stack.shift(); 34163 xb = xa + stack.shift(); 34164 yb = ya + stack.shift(); 34165 x = xb + stack.shift(); 34166 y = yb + (stack.length === 1 ? stack.shift() : 0); 34167 bezierCurveTo(xa, ya, xb, yb, x, y); 34168 if (stack.length === 0) { 34169 break; 34170 } 34171 xa = x + stack.shift(); 34172 ya = y; 34173 xb = xa + stack.shift(); 34174 yb = ya + stack.shift(); 34175 y = yb + stack.shift(); 34176 x = xb + (stack.length === 1 ? stack.shift() : 0); 34177 bezierCurveTo(xa, ya, xb, yb, x, y); 34178 } 34179 break; 34180 case 31: 34181 while (stack.length > 0) { 34182 xa = x + stack.shift(); 34183 ya = y; 34184 xb = xa + stack.shift(); 34185 yb = ya + stack.shift(); 34186 y = yb + stack.shift(); 34187 x = xb + (stack.length === 1 ? stack.shift() : 0); 34188 bezierCurveTo(xa, ya, xb, yb, x, y); 34189 if (stack.length === 0) { 34190 break; 34191 } 34192 xa = x; 34193 ya = y + stack.shift(); 34194 xb = xa + stack.shift(); 34195 yb = ya + stack.shift(); 34196 x = xb + stack.shift(); 34197 y = yb + (stack.length === 1 ? stack.shift() : 0); 34198 bezierCurveTo(xa, ya, xb, yb, x, y); 34199 } 34200 break; 34201 default: 34202 if (v < 32) { 34203 error('unknown operator: ' + v); 34204 } 34205 if (v < 247) { 34206 stack.push(v - 139); 34207 } else if (v < 251) { 34208 stack.push((v - 247) * 256 + code[i++] + 108); 34209 } else if (v < 255) {
34210 stack.push(-(v - 251) * 256 - code[i++] - 108); 34211 } else { 34212 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 34213 i += 4; 34214 } 34215 break; 34216 } 34217 if (stackClean) { 34218 stack.length = 0; 34219 } 34220 } 34221 } 34222 parse(code); 34223 } 34224 var noop = ''; 34225 function CompiledFont(fontMatrix) { 34226 this.compiledGlyphs = Object.create(null); 34227 this.compiledCharCodeToGlyphId = Object.create(null); 34228 this.fontMatrix = fontMatrix; 34229 } 34230 CompiledFont.prototype = { 34231 getPathJs: function (unicode) { 34232 var cmap = lookupCmap(this.cmap, unicode); 34233 var fn = this.compiledGlyphs[cmap.glyphId]; 34234 if (!fn) { 34235 fn = this.compileGlyph(this.glyphs[cmap.glyphId]); 34236 this.compiledGlyphs[cmap.glyphId] = fn; 34237 } 34238 if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) { 34239 this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId; 34240 } 34241 return fn; 34242 }, 34243 compileGlyph: function (code) { 34244 if (!code || code.length === 0 || code[0] === 14) { 34245 return noop; 34246 } 34247 var cmds = []; 34248 cmds.push({ cmd: 'save' }); 34249 cmds.push({ 34250 cmd: 'transform', 34251 args: this.fontMatrix.slice() 34252 }); 34253 cmds.push({ 34254 cmd: 'scale', 34255 args: [ 34256 'size', 34257 '-size' 34258 ] 34259 }); 34260 this.compileGlyphImpl(code, cmds); 34261 cmds.push({ cmd: 'restore' }); 34262 return cmds; 34263 }, 34264 compileGlyphImpl: function () { 34265 error('Children classes should implement this.'); 34266 }, 34267 hasBuiltPath: function (unicode) { 34268 var cmap = lookupCmap(this.cmap, unicode); 34269 return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCo
34269de] !== undefined; 34270 } 34271 }; 34272 function TrueTypeCompiled(glyphs, cmap, fontMatrix) { 34273 fontMatrix = fontMatrix || [ 34274 0.000488, 34275 0, 34276 0, 34277 0.000488, 34278 0, 34279 0 34280 ]; 34281 CompiledFont.call(this, fontMatrix); 34282 this.glyphs = glyphs; 34283 this.cmap = cmap; 34284 } 34285 Util.inherit(TrueTypeCompiled, CompiledFont, { 34286 compileGlyphImpl: function (code, cmds) { 34287 compileGlyf(code, cmds, this); 34288 } 34289 }); 34290 function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) { 34291 fontMatrix = fontMatrix || [ 34292 0.001, 34293 0, 34294 0, 34295 0.001, 34296 0, 34297 0 34298 ]; 34299 CompiledFont.call(this, fontMatrix); 34300 this.glyphs = cffInfo.glyphs; 34301 this.gsubrs = cffInfo.gsubrs || []; 34302 this.subrs = cffInfo.subrs || []; 34303 this.cmap = cmap; 34304 this.glyphNameMap = glyphNameMap || getGlyphsUnicode(); 34305 this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768; 34306 this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768; 34307 } 34308 Util.inherit(Type2Compiled, CompiledFont, { 34309 compileGlyphImpl: function (code, cmds) { 34310 compileCharString(code, cmds, this); 34311 } 34312 }); 34313 return { 34314 create: function FontRendererFactory_create(font, seacAnalysisEnabled) { 34315 var data = new Uint8Array(font.data); 34316 var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 34317 var numTables = getUshort(data, 4); 34318 for (var i = 0, p = 12; i < numTables; i++, p += 16) { 34319 var tag = bytesToString(data.subarray(p, p + 4)); 34320 var offset = getLong(data, p + 8); 34321 var length = getLong(data, p + 12); 34322 switch (tag) { 34323 case 'cmap': 34324 cmap = parseCmap(data, offset, offset + length); 34325 break; 34326 case 'glyf': 34327 glyf = data.subarray(offset, offset + length); 34328 break; 34329 case 'loca': 34330 loca = data.subarray(offset, offset + length); 34331 break; 34332 case 'head': 34333 unitsPerEm = getUshort(data, offset + 18); 34334 indexToLocFormat = getUshort(data, offset + 50); 34335 break; 34336 case 'CFF ': 34337 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 34338 break; 34339 } 34340 } 34341 if (glyf) { 34342 var fontMatrix = !unitsPerEm ? font.fontMatrix : [ 34343 1 / unitsPerEm, 34344 0, 34345 0, 34346 1 / unitsPerEm, 34347 0, 34348 0 34349 ]; 34350 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 34351 } 34352 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 34353 } 34354 }; 34355 }(); 34356 exports.FontRendererFactory = FontRendererFactory; 34357 })); 34358 (function (root, factory) { 34359 factory(root.pdfjsCoreFunction = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCorePsParser); 34360 }(this, function (exports, sharedUtil, corePrimitives, corePsParser) { 34361 var error = sharedUtil.error; 34362 var info = sharedUtil.info; 34363 var isArray = sharedUtil.isArray; 34364 var isBool = sharedUtil.isBool; 34365 var isDict = corePrimitives.isDict; 34366 var isStream = corePrimitives.isStream; 34367 var PostScriptLexer = corePsParser.PostScriptLexer; 34368 var PostScriptParser = corePsParser.PostScriptParser; 34369 var PDFFunction = function PDFFunctionClosure() { 34370 var CONSTRUCT_SAMPLED = 0; 34371 var CONSTRUCT_INTERPOLATED = 2; 34372 var CONSTRUCT_STICHED = 3; 34373 var CONSTRUCT_POSTSCRIPT = 4; 34374 return { 34375 getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) { 34376 var i, ii; 34377 var length = 1; 34378 for (i = 0, ii = size.length; i < ii; i++) { 34379 length *= size[i]; 34380 } 34381 length *= outputSize; 34382 var array = new Array(length); 34383 var codeSize = 0; 34384 var codeBuf = 0; 34385 var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1); 34386 var strBytes = str.getBytes((length * bps + 7) / 8); 34387 var strIdx = 0; 34388 for (i = 0; i < length; i++) { 34389 while (codeSize < bps) { 34390 codeBuf <<= 8; 34391 codeBuf |= strBytes[strIdx++]; 34392 codeSize += 8; 34393 } 34394 codeSize -= bps; 34395 array[i] = (codeBuf >> codeSize) * sampleMul; 34396 codeBuf &= (1 << codeSize) - 1; 34397 } 34398 return array; 34399 },
34400 getIR: function PDFFunction_getIR(xref, fn) { 34401 var dict = fn.dict; 34402 if (!dict) { 34403 dict = fn; 34404 } 34405 var types = [ 34406 this.constructSampled, 34407 null, 34408 this.constructInterpolated, 34409 this.constructStiched, 34410 this.constructPostScript 34411 ]; 34412 var typeNum = dict.get('FunctionType'); 34413 var typeFn = types[typeNum]; 34414 if (!typeFn) { 34415 error('Unknown type of function'); 34416 } 34417 return typeFn.call(this, fn, dict, xref); 34418 }, 34419 fromIR: function PDFFunction_fromIR(IR) { 34420 var type = IR[0]; 34421 switch (type) { 34422 case CONSTRUCT_SAMPLED: 34423 return this.constructSampledFromIR(IR); 34424 case CONSTRUCT_INTERPOLATED: 34425 return this.constructInterpolatedFromIR(IR); 34426 case CONSTRUCT_STICHED: 34427 return this.constructStichedFromIR(IR); 34428 default: 34429 return this.constructPostScriptFromIR(IR); 34430 } 34431 }, 34432 parse: function PDFFunction_parse(xref, fn) { 34433 var IR = this.getIR(xref, fn); 34434 return this.fromIR(IR); 34435 }, 34436 parseArray: function PDFFunction_parseArray(xref, fnObj) { 34437 if (!isArray(fnObj)) { 34438 return this.parse(xref, fnObj); 34439 } 34440 var fnArray = []; 34441 for (var j = 0, jj = fnObj.length; j < jj; j++) { 34442 var obj = xref.fetchIfRef(fnObj[j]); 34443 fnArray.push(PDFFunction.parse(xref, obj)); 34444 } 34445 return function (src, srcOffset, dest, destOffset) { 34446 for (var i = 0, ii = fnArray.length; i < ii; i++) { 34447 fnArray[i](src, srcOffset, dest, destOffset + i); 34448 } 34449 }; 34450 }, 34451 constructSampled: function PDFFunction_constructSampled(str, dict) { 34452 function toMultiArray(arr) { 34453 var inputLength = arr.length; 34454 var out = []; 34455 var index = 0; 34456 for (var i = 0; i < inputLength; i += 2) { 34457 out[index] = [ 34458 arr[i], 34459 arr[i + 1] 34460 ]; 34461 ++index; 34462 } 34463 return out; 34464 } 34465 var domain = dict.getArray('Domain'); 34466 var range = dict.getArray('Range'); 34467 if (!domain || !range) { 34468 error('No domain or range'); 34469 } 34470 var inputSize = domain.length / 2; 34471 var outputSize = range.length / 2; 34472 domain = toMultiArray(domain); 34473 range = toMultiArray(range); 34474 var size = dict.get('Size'); 34475 var bps = dict.get('BitsPerSample'); 34476 var order = dict.get('Order') || 1; 34477 if (order !== 1) { 34478 info('No support for cubic spline interpolation: ' + order); 34479 } 34480 var encode = dict.getArray('Encode'); 34481 if (!encode) { 34482 encode = []; 34483 for (var i = 0; i < inputSize; ++i) { 34484 encode.push(0); 34485 encode.push(size[i] - 1); 34486 } 34487 } 34488 encode = toMultiArray(encode); 34489 var decode = dict.getArray('Decode'); 34490 if (!decode) { 34491 decode = range; 34492 } else { 34493 decode = toMultiArray(decode); 34494 } 34495 var samples = this.getSampleArray(size, outputSize, bps, str); 34496 return [ 34497 CONSTRUCT_SAMPLED, 34498 inputSize, 34499 domain, 34500 encode, 34501 decode, 34502 samples, 34503 size, 34504 outputSize, 34505 Math.pow(2, bps) - 1, 34506 range 34507 ]; 34508 }, 34509 constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) { 34510 function interpolate(x, xmin, xmax, ymin, ymax) { 34511 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 34512 } 34513 return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) { 34514 var m = IR[1]; 34515 var domain = IR[2]; 34516 var encode = IR[3]; 34517 var decode = IR[4]; 34518 var samples = IR[5]; 34519 var size = IR[6]; 34520 var n = IR[7]; 34521 var range = IR[9]; 34522 var cubeVertices = 1 << m; 34523 var cubeN = new Float64Array(cubeVertices); 34524 var cubeVertex = new Uint32Array(cubeVertices); 34525 var i, j; 34526 for (j = 0; j < cubeVertices; j++) { 34527 cubeN[j] = 1; 34528 } 34529 var k = n, pos = 1; 34530 for (i = 0; i < m; ++i) { 34531 var domain_2i = domain[i][0]; 34532 var domain_2i_1 = domain[i][1]; 34533 var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 34534 var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 34535 var size_i = size[i]; 34536 e = Math.min(Math.max(e, 0), size_i - 1); 34537 var e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 34538 var n0 = e0 + 1 - e; 34539 var n1 = e - e0; 34540 var offset0 = e0 * k; 34541 var offset1 = offset0 + k; 34542 for (j = 0; j < cubeVertices; j++) { 34543 if (j & pos) { 34544 cubeN[j] *= n1; 34545 cubeVertex[j] += offset1; 34546 } else { 34547 cubeN[j] *= n0; 34548 cubeVertex[j] += offset0; 34549 } 34550 } 34551 k *= size_i; 34552 pos <<= 1; 34553 } 34554 for (j = 0; j < n; ++j) { 34555 var rj = 0; 34556 for (i = 0; i < cubeVertices; i++) { 34557 rj += samples[cubeVertex[i] + j] * cubeN[i]; 34558 } 34559 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 34560 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 34561 } 34562 }; 34563 }, 34564 constructInterpolated: function PDFFunction_constructInterpolated(str, dict) { 34565 var c0 = dict.getArray('C0') || [0]; 34566 var c1 = dict.getArray('C1') || [1]; 34567 var n = dict.get('N'); 34568 if (!isArray(c0) || !isArray(c1)) { 34569 error('Illegal dictionary for interpolated function'); 34570 } 34571 var length = c0.length; 34572 var diff = []; 34573 for (var i = 0; i < length; ++i) { 34574 diff.push(c1[i] - c0[i]); 34575 } 34576 return [ 34577 CONSTRUCT_INTERPOLATED, 34578 c0, 34579 diff, 34580 n 34581 ]; 34582 }, 34583 constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) { 34584 var c0 = IR[1]; 34585 var diff = IR[2]; 34586 var n = IR[3]; 34587 var length = diff.length; 34588 return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOff
34588set) { 34589 var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n); 34590 for (var j = 0; j < length; ++j) { 34591 dest[destOffset + j] = c0[j] + x * diff[j]; 34592 } 34593 }; 34594 }, 34595 constructStiched: function PDFFunction_constructStiched(fn, dict, xref) { 34596 var domain = dict.getArray('Domain'); 34597 if (!domain) { 34598 error('No domain'); 34599 } 34600 var inputSize = domain.length / 2; 34601 if (inputSize !== 1) { 34602 error('Bad domain for stiched function'); 34603 } 34604 var fnRefs = dict.get('Functions'); 34605 var fns = []; 34606 for (var i = 0, ii = fnRefs.length; i < ii; ++i) { 34607 fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i]))); 34608 } 34609 var bounds = dict.getArray('Bounds'); 34610 var encode = dict.getArray('Encode'); 34611 return [ 34612 CONSTRUCT_STICHED, 34613 domain, 34614 bounds, 34615 encode, 34616 fns 34617 ]; 34618 }, 34619 constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) { 34620 var domain = IR[1]; 34621 var bounds = IR[2]; 34622 var encode = IR[3]; 34623 var fnsIR = IR[4]; 34624 var fns = []; 34625 var tmpBuf = new Float32Array(1); 34626 for (var i = 0, ii = fnsIR.length; i < ii; i++) { 34627 fns.push(PDFFunction.fromIR(fnsIR[i])); 34628 } 34629 return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) { 34630 var clip = function constructStichedFromIRClip(v, min, max) { 34631 if (v > max) { 34632 v = max; 34633 } else if (v < min) { 34634 v = min; 34635 } 34636 return v; 34637 }; 34638 var v = clip(src[srcOffset], domain[0], domain[1]); 34639 for (var i = 0, ii = bounds.length; i < ii; ++i) { 34640 if (v < bounds[i]) { 34641 break; 34642 } 34643 } 34644 var dmin = domain[0]; 34645 if (i > 0) { 34646 dmin = bounds[i - 1]; 34647 } 34648 var dmax = domain[1]; 34649 if (i < bounds.length) { 34650 dmax = bounds[i]; 34651 } 34652 var rmin = encode[2 * i]; 34653 var rmax = encode[2 * i + 1]; 34654 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 34655 fns[i](tmpBuf, 0, dest, destOffset); 34656 }; 34657 }, 34658 constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) { 34659 var domain = dict.getArray('Domain'); 34660 var range = dict.getArray('Range'); 34661 if (!domain) { 34662 error('No domain.'); 34663 } 34664 if (!range) { 34665 error('No range.'); 34666 } 34667 var lexer = new PostScriptLexer(fn); 34668 var parser = new PostScriptParser(lexer); 34669 var code = parser.parse(); 34670 return [ 34671 CONSTRUCT_POSTSCRIPT, 34672 domain, 34673 range, 34674 code 34675 ]; 34676 }, 34677 constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) { 34678 var domain = IR[1]; 34679 var range = IR[2]; 34680 var code = IR[3]; 34681 var compiled = new PostScriptCompiler().compile(code, domain, range); 34682 if (compiled) { 34683 return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled); 34684 } 34685 info('Unable to compile PS function'); 34686 var numOutputs = range.length >> 1; 34687 var numInputs = domain.length >> 1; 34688 var evaluator = new PostScriptEvaluator(code); 34689 var cache = Object.create(null); 34690 var MAX_CACHE_SIZE = 2048 * 4; 34691 var cache_available = MAX_CACHE_SIZE; 34692 var tmpBuf = new Float32Array(numInputs); 34693 return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) { 34694 var i, value; 34695 var key = ''; 34696 var input = tmpBuf; 34697 for (i = 0; i < numInputs; i++) { 34698 value = src[srcOffset + i]; 34699 input[i] = value; 34700 key += value + '_'; 34701 } 34702 var cachedValue = cache[key]; 34703 if (cachedValue !== undefined) { 34704 dest.set(cachedValue, destOffset); 34705 return; 34706 } 34707 var output = new Float32Array(numOutputs); 34708 var stack = evaluator.execute(input); 34709 var stackIndex = stack.length - numOutputs; 34710 for (i = 0; i < numOutputs; i++) { 34711 value = stack[stackIndex + i]; 34712 var bound = range[i * 2]; 34713 if (value < bound) { 34714 value = bound; 34715 } else { 34716 bound = range[i * 2 + 1]; 34717 if (value > bound) { 34718 value = bound; 34719 } 34720 } 34721 output[i] = value; 34722 } 34723 if (cache_available > 0) { 34724 cache_available--; 34725 cache[key] = output; 34726 }
34727 dest.set(output, destOffset); 34728 }; 34729 } 34730 }; 34731 }(); 34732 function isPDFFunction(v) { 34733 var fnDict; 34734 if (typeof v !== 'object') { 34735 return false; 34736 } else if (isDict(v)) { 34737 fnDict = v; 34738 } else if (isStream(v)) { 34739 fnDict = v.dict; 34740 } else { 34741 return false; 34742 } 34743 return fnDict.has('FunctionType'); 34744 } 34745 var PostScriptStack = function PostScriptStackClosure() { 34746 var MAX_STACK_SIZE = 100; 34747 function PostScriptStack(initialStack) { 34748 this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); 34749 } 34750 PostScriptStack.prototype = { 34751 push: function PostScriptStack_push(value) { 34752 if (this.stack.length >= MAX_STACK_SIZE) { 34753 error('PostScript function stack overflow.'); 34754 } 34755 this.stack.push(value); 34756 }, 34757 pop: function PostScriptStack_pop() { 34758 if (this.stack.length <= 0) { 34759 error('PostScript function stack underflow.'); 34760 } 34761 return this.stack.pop(); 34762 }, 34763 copy: function PostScriptStack_copy(n) { 34764 if (this.stack.length + n >= MAX_STACK_SIZE) { 34765 error('PostScript function stack overflow.'); 34766 } 34767 var stack = this.stack; 34768 for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 34769 stack.push(stack[i]); 34770 } 34771 }, 34772 index: function PostScriptStack_index(n) { 34773 this.push(this.stack[this.stack.length - n - 1]); 34774 }, 34775 roll: function PostScriptStack_roll(n, p) { 34776 var stack = this.stack; 34777 var l = stack.length - n; 34778 var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t; 34779 for (i = l, j = r; i < j; i++, j--) { 34780 t = stack[i]; 34781 stack[i] = stack[j]; 34782 stack[j] = t; 34783 } 34784 for (i = l, j = c - 1; i < j; i++, j--) { 34785 t = stack[i]; 34786 stack[i] = stack[j]; 34787 stack[j] = t; 34788 } 34789 for (i = c, j = r; i < j; i++, j--) { 34790 t = stack[i]; 34791 stack[i] = stack[j]; 34792 stack[j] = t; 34793 } 34794 } 34795 }; 34796 return PostScriptStack; 34797 }(); 34798 var PostScriptEvaluator = function PostScriptEvaluatorClosure() { 34799 function PostScriptEvaluator(operators) { 34800 this.operators = operators; 34801 } 34802 PostScriptEvaluator.prototype = { 34803 execute: function PostScriptEvaluator_execute(initialStack) { 34804 var stack = new PostScriptStack(initialStack); 34805 var counter = 0; 34806 var operators = this.operators; 34807 var length = operators.length; 34808 var operator, a, b; 34809 while (counter < length) { 34810 operator = operators[counter++]; 34811 if (typeof operator === 'number') { 34812 stack.push(operator); 34813 continue; 34814 } 34815 switch (operator) { 34816 case 'jz': 34817 b = stack.pop(); 34818 a = stack.pop(); 34819 if (!a) { 34820 counter = b; 34821 } 34822 break; 34823 case 'j': 34824 a = stack.pop(); 34825 counter = a; 34826 break; 34827 case 'abs': 34828 a = stack.pop(); 34829 stack.push(Math.abs(a)); 34830 break; 34831 case 'add': 34832 b = stack.pop(); 34833 a = stack.pop(); 34834 stack.push(a + b); 34835 break; 34836 case 'and': 34837 b = stack.pop(); 34838 a = stack.pop(); 34839 if (isBool(a) && isBool(b)) { 34840 stack.push(a && b); 34841 } else { 34842 stack.push(a & b); 34843 } 34844 break; 34845 case 'atan': 34846 a = stack.pop(); 34847 stack.push(Math.atan(a)); 34848 break; 34849 case 'bitshift': 34850 b = stack.pop(); 34851 a = stack.pop(); 34852 if (a > 0) { 34853 stack.push(a << b); 34854 } else { 34855 stack.push(a >> b); 34856 } 34857 break; 34858 case 'ceiling': 34859 a = stack.pop(); 34860 stack.push(Math.ceil(a)); 34861 break; 34862 case 'copy': 34863 a = stack.pop(); 34864 stack.copy(a); 34865 break; 34866 case 'cos': 34867 a = stack.pop(); 34868 stack.push(Math.cos(a)); 34869 break; 34870 case 'cvi': 34871 a = stack.pop() | 0; 34872 stack.push(a); 34873 break; 34874 case 'cvr': 34875 break; 34876 case 'div': 34877 b = stack.pop(); 34878 a = stack.pop(); 34879 stack.push(a / b); 34880 break; 34881 case 'dup': 34882 stack.copy(1); 34883 break; 34884 case 'eq': 34885 b = stack.pop(); 34886 a = stack.pop(); 34887 stack.push(a === b); 34888 break; 34889 case 'exch': 34890 stack.roll(2, 1); 34891 break; 34892 case 'exp': 34893 b = stack.pop(); 34894 a = stack.pop(); 34895 stack.push(Math.pow(a, b)); 34896 break; 34897 case 'false': 34898 stack.push(false); 34899 break; 34900 case 'floor': 34901 a = stack.pop(); 34902 stack.push(Math.floor(a)); 34903 break; 34904 case 'ge': 34905 b = stack.pop(); 34906 a = stack.pop(); 34907 stack.push(a >= b); 34908 break; 34909 case 'gt': 34910 b = stack.pop(); 34911 a = stack.pop(); 34912 stack.push(a > b); 34913 break; 34914 case 'idiv': 34915 b = stack.pop(); 34916 a = stack.pop(); 34917 stack.push(a / b | 0); 34918 break; 34919 case 'index': 34920 a = stack.pop(); 34921 stack.index(a); 34922 break; 34923 case 'le': 34924 b = stack.pop(); 34925 a = stack.pop(); 34926 stack.push(a <= b); 34927 break; 34928 case 'ln': 34929 a = stack.pop(); 34930 stack.push(Math.log(a)); 34931 break; 34932 case 'log': 34933 a = stack.pop(); 34934 stack.push(Math.log(a) / Math.LN10); 34935 break; 34936 case 'lt': 34937 b = stack.pop(); 34938 a = stack.pop(); 34939 stack.push(a < b); 34940 break; 34941 case 'mod': 34942 b = stack.pop(); 34943 a = stack.pop(); 34944 stack.push(a % b); 34945 break; 34946 case 'mul': 34947 b = stack.pop(); 34948 a = stack.pop(); 34949 stack.push(a * b); 34950 break;
34951 case 'ne': 34952 b = stack.pop(); 34953 a = stack.pop(); 34954 stack.push(a !== b); 34955 break; 34956 case 'neg': 34957 a = stack.pop(); 34958 stack.push(-a); 34959 break; 34960 case 'not': 34961 a = stack.pop(); 34962 if (isBool(a)) { 34963 stack.push(!a); 34964 } else { 34965 stack.push(~a); 34966 } 34967 break; 34968 case 'or': 34969 b = stack.pop(); 34970 a = stack.pop(); 34971 if (isBool(a) && isBool(b)) { 34972 stack.push(a || b); 34973 } else { 34974 stack.push(a | b); 34975 } 34976 break; 34977 case 'pop': 34978 stack.pop(); 34979 break; 34980 case 'roll': 34981 b = stack.pop(); 34982 a = stack.pop(); 34983 stack.roll(a, b); 34984 break; 34985 case 'round': 34986 a = stack.pop(); 34987 stack.push(Math.round(a)); 34988 break; 34989 case 'sin': 34990 a = stack.pop(); 34991 stack.push(Math.sin(a)); 34992 break; 34993 case 'sqrt': 34994 a = stack.pop(); 34995 stack.push(Math.sqrt(a)); 34996 break; 34997 case 'sub': 34998 b = stack.pop(); 34999 a = stack.pop(); 35000 stack.push(a - b); 35001 break; 35002 case 'true': 35003 stack.push(true); 35004 break; 35005 case 'truncate': 35006 a = stack.pop(); 35007 a = a < 0 ? Math.ceil(a) : Math.floor(a); 35008 stack.push(a); 35009 break; 35010 case 'xor': 35011 b = stack.pop(); 35012 a = stack.pop(); 35013 if (isBool(a) && isBool(b)) { 35014 stack.push(a !== b); 35015 } else { 35016 stack.push(a ^ b); 35017 } 35018 break; 35019 default: 35020 error('Unknown operator ' + operator); 35021 break; 35022 } 35023 } 35024 return stack.stack; 35025 } 35026 }; 35027 return PostScriptEvaluator; 35028 }(); 35029 var PostScriptCompiler = function PostScriptCompilerClosure() { 35030 function AstNode(type) { 35031 this.type = type; 35032 } 35033 AstNode.prototype.visit = function (visitor) { 35034 throw new Error('abstract method'); 35035 }; 35036 function AstArgument(index, min, max) { 35037 AstNode.call(this, 'args'); 35038 this.index = index; 35039 this.min = min; 35040 this.max = max; 35041 } 35042 AstArgument.prototype = Object.create(AstNode.prototype); 35043 AstArgument.prototype.visit = function (visitor) { 35044 visitor.visitArgument(this); 35045 }; 35046 function AstLiteral(number) { 35047 AstNode.call(this, 'literal'); 35048 this.number = number; 35049 this.min = number; 35050 this.max = number; 35051 } 35052 AstLiteral.prototype = Object.create(AstNode.prototype); 35053 AstLiteral.prototype.visit = function (visitor) { 35054 visitor.visitLiteral(this); 35055 }; 35056 function AstBinaryOperation(op, arg1, arg2, min, max) { 35057 AstNode.call(this, 'binary'); 35058 this.op = op; 35059 this.arg1 = arg1; 35060 this.arg2 = arg2; 35061 this.min = min; 35062 this.max = max; 35063 } 35064 AstBinaryOperation.prototype = Object.create(AstNode.prototype); 35065 AstBinaryOperation.prototype.visit = function (visitor) { 35066 visitor.visitBinaryOperation(this); 35067 }; 35068 function AstMin(arg, max) { 35069 AstNode.call(this, 'max'); 35070 this.arg = arg; 35071 this.min = arg.min; 35072 this.max = max; 35073 } 35074 AstMin.prototype = Object.create(AstNode.prototype); 35075 AstMin.prototype.visit = function (visitor) { 35076 visitor.visitMin(this); 35077 }; 35078 function AstVariable(index, min, max) { 35079 AstNode.call(this, 'var'); 35080 this.index = index; 35081 this.min = min; 35082 this.max = max; 35083 } 35084 AstVariable.prototype = Object.create(AstNode.prototype); 35085 AstVariable.prototype.visit = function (visitor) { 35086 visitor.visitVariable(this); 35087 }; 35088 function AstVariableDefinition(variable, arg) { 35089 AstNode.call(this, 'definition'); 35090 this.variable = variable; 35091 this.arg = arg; 35092 } 35093 AstVariableDefinition.prototype = Object.create(AstNode.prototype); 35094 AstVariableDefinition.prototype.visit = function (visitor) { 35095 visitor.visitVariableDefinition(this); 35096 }; 35097 function ExpressionBuilderVisitor() { 35098 this.parts = []; 35099 } 35100 ExpressionBuilderVisitor.prototype = { 35101 visitArgument: function (arg) { 35102 this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))'); 35103 }, 35104 visitVariable: function (variable) {
35105 this.parts.push('v', variable.index); 35106 }, 35107 visitLiteral: function (literal) { 35108 this.parts.push(literal.number); 35109 }, 35110 visitBinaryOperation: function (operation) { 35111 this.parts.push('('); 35112 operation.arg1.visit(this); 35113 this.parts.push(' ', operation.op, ' '); 35114 operation.arg2.visit(this); 35115 this.parts.push(')'); 35116 }, 35117 visitVariableDefinition: function (definition) { 35118 this.parts.push('var '); 35119 definition.variable.visit(this); 35120 this.parts.push(' = '); 35121 definition.arg.visit(this); 35122 this.parts.push(';'); 35123 }, 35124 visitMin: function (max) { 35125 this.parts.push('Math.min('); 35126 max.arg.visit(this); 35127 this.parts.push(', ', max.max, ')'); 35128 }, 35129 toString: function () { 35130 return this.parts.join(''); 35131 } 35132 }; 35133 function buildAddOperation(num1, num2) { 35134 if (num2.type === 'literal' && num2.number === 0) { 35135 return num1; 35136 } 35137 if (num1.type === 'literal' && num1.number === 0) { 35138 return num2; 35139 } 35140 if (num2.type === 'literal' && num1.type === 'literal') { 35141 return new AstLiteral(num1.number + num2.number); 35142 } 35143 return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max); 35144 } 35145 function buildMulOperation(num1, num2) { 35146 if (num2.type === 'literal') { 35147 if (num2.number === 0) { 35148 return new AstLiteral(0); 35149 } else if (num2.number === 1) { 35150 return num1; 35151 } else if (num1.type === 'literal') { 35152 return new AstLiteral(num1.number * num2.number); 35153 } 35154 } 35155 if (num1.type === 'literal') { 35156 if (num1.number === 0) { 35157 return new AstLiteral(0); 35158 } else if (num1.number === 1) { 35159 return num2; 35160 } 35161 } 35162 var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 35163 var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 35164 return new AstBinaryOperation('*', num1, num2, min, max); 35165 } 35166 function buildSubOperation(num1, num2) { 35167 if (num2.type === 'literal') { 35168 if (num2.number === 0) { 35169 return num1; 35170 } else if (num1.type === 'literal') { 35171 return new AstLiteral(num1.number - num2.number); 35172 } 35173 } 35174 if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) { 35175 return num2.arg2; 35176 } 35177 return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min); 35178 } 35179 function buildMinOperation(num1, max) { 35180 if (num1.min >= max) { 35181 return new AstLiteral(max); 35182 } else if (num1.max <= max) { 35183 return num1; 35184 } 35185 return new AstMin(num1, max); 35186 } 35187 function PostScriptCompiler() { 35188 } 35189 PostScriptCompiler.prototype = { 35190 compile: function PostScriptCompiler_compile(code, domain, range) { 35191 var stack = []; 35192 var i, ii; 35193 var instructions = []; 35194 var inputSize = domain.length >> 1, outputSize = range.length >> 1; 35195 var lastRegister = 0; 35196 var n, j; 35197 var num1, num2, ast1, ast2, tmpVar, item; 35198 for (i = 0; i < inputSize; i++) { 35199 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 35200 } 35201 for (i = 0, ii = code.length; i < ii; i++) { 35202 item = code[i]; 35203 if (typeof item === 'number') { 35204 stack.push(new AstLiteral(item)); 35205 continue; 35206 } 35207 switch (item) { 35208 case 'add': 35209 if (stack.length < 2) { 35210 return null; 35211 } 35212 num2 = stack.pop(); 35213 num1 = stack.pop(); 35214 stack.push(buildAddOperation(num1, num2)); 35215 break; 35216 case 'cvr': 35217 if (stack.length < 1) { 35218 return null; 35219 } 35220 break; 35221 case 'mul': 35222 if (stack.length < 2) { 35223 return null; 35224 } 35225 num2 = stack.pop(); 35226 num1 = stack.pop(); 35227 stack.push(buildMulOperation(num1, num2)); 35228 break; 35229 case 'sub': 35230 if (stack.length < 2) { 35231 return null; 35232 } 35233 num2 = stack.pop(); 35234 num1 = stack.pop(); 35235 stack.push(buildSubOperation(num1, num2)); 35236 break; 35237 case 'exch': 35238 if (stack.length < 2) { 35239 return null; 35240 } 35241 ast1 = stack.pop(); 35242 ast2 = stack.pop(); 35243 stack.push(ast1, ast2); 35244 break; 35245 case 'pop': 35246 if (stack.length < 1) { 35247 return null; 35248 } 35249 stack.pop(); 35250 break; 35251 case 'index': 35252 if (stack.length < 1) { 35253 return null; 35254 } 35255 num1 = stack.pop(); 35256 if (num1.type !== 'literal') { 35257 return null; 35258 } 35259 n = num1.number; 35260 if (n < 0 || (n | 0) !== n || stack.length < n) { 35261 return null; 35262 } 35263 ast1 = stack[stack.length - n - 1]; 35264 if (ast1.type === 'literal' || ast1.type === 'var') { 35265 stack.push(ast1); 35266 break; 35267 } 35268 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 35269 stack[stack.length - n - 1] = tmpVar; 35270 stack.push(tmpVar); 35271 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 35272 break; 35273 case 'dup': 35274 if (stack.length < 1) { 35275 return null; 35276 } 35277 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]) { 35278 num1 = stack.pop(); 35279 stack.push(buildMinOperation(num1, code[i + 1])); 35280 i += 6; 35281 break; 35282 } 35283 ast1 = stack[stack.length - 1]; 35284 if (ast1.type === 'literal' || ast1.type === 'var') { 35285 stack.push(ast1); 35286 break; 35287 } 35288 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 35289 stack[stack.length - 1] = tmpVar; 35290 stack.push(tmpVar); 35291 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 35292 break; 35293 case 'roll': 35294 if (stack.length < 2) { 35295 return null; 35296 } 35297 num2 = stack.pop(); 35298 num1 = stack.pop(); 35299 if (num2.type !== 'literal' || num1.type !== 'literal') { 35300 return null; 35301 } 35302 j = num2.number; 35303 n = num1.number; 35304 if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) { 35305 return null; 35306 } 35307 j = (j % n + n) % n; 35308 if (j === 0) { 35309 break; 35310 } 35311 Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j)); 35312 break; 35313 default: 35314 return null; 35315 } 35316 } 35317 if (stack.length !== outputSize) { 35318 return null; 35319 } 35320 var result = []; 35321 instructions.forEach(function (instruction) { 35322 var statementBuilder = new ExpressionBuilderVisitor(); 35323 instruction.visit(statementBuilder); 35324 result.push(statementBuilder.toString()); 35325 }); 35326 stack.forEach(function (expr, i) { 35327 var statementBuilder = new ExpressionBuilderVisitor(); 35328 expr.visit(statementBuilder); 35329 var min = range[i * 2], max = range[i * 2 + 1]; 35330 var out = [statementBuilder.toString()]; 35331 if (min > expr.min) { 35332 out.unshift('Math.max(', min, ', '); 35333 out.push(')'); 35334 } 35335 if (max < expr.max) { 35336 out.unshift('Math.min(', max, ', '); 35337 out.push(')'); 35338 } 35339 out.unshift('dest[destOffset + ', i, '] = '); 35340 out.push(';'); 35341 result.push(out.join('')); 35342 }); 35343 return result.join('\n'); 35344 } 35345 }; 35346 return PostScriptCompiler; 35347 }(); 35348 exports.isPDFFunction = isPDFFunction; 35349 exports.PDFFunction = PDFFunction; 35350 exports.PostScriptEvaluator = PostScriptEvaluator; 35351 exports.PostScriptCompiler = PostScriptCompiler; 35352 })); 35353 (function (root, factory) { 35354 factory(root.pdfjsCoreParser = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream); 35355 }(this, function (exports, sharedUtil, corePrimitives, coreStream) { 35356 var MissingDataException = sharedUtil.MissingDataException; 35357 var StreamType = sharedUtil.StreamType; 35358 var assert = sharedUtil.assert; 35359 var error = sharedUtil.error; 35360 var info = sharedUtil.info; 35361 var isArray = sharedUtil.isArray; 35362 var isInt = sharedUtil.isInt; 35363 var isNum = sharedUtil.isNum; 35364 var isString = sharedUtil.isString; 35365 var warn = sharedUtil.warn; 35366 var EOF = corePrimitives.EOF; 35367 var Cmd = corePrimitives.Cmd; 35368 var Dict = corePrimitives.Dict; 35369 var Name = corePrimitives.Name; 35370 var Ref = corePrimitives.Ref; 35371 var isEOF = corePrimitives.isEOF; 35372 var isCmd = corePrimitives.isCmd; 35373 var isDict = corePrimitives.isDict; 35374 var isName = corePrimitives.isName; 35375 var Ascii85Stream = coreStream.Ascii85Stream; 35376 var AsciiHexStream = coreStream.AsciiHexStream; 35377 var CCITTFaxStream = coreStream.CCITTFaxStream; 35378 var FlateStream = coreStream.FlateStream; 35379 var Jbig2Stream = coreStream.Jbig2Stream; 35380 var JpegStream = coreStream.JpegStream; 35381 var JpxStream = coreStream.JpxStream; 35382 var LZWStream = coreStream.LZWStream; 35383 var NullStream = coreStream.NullStream; 35384 var PredictorStream = coreStream.PredictorStream; 35385 var RunLengthStream = coreStream.RunLengthStream; 35386 var MAX_LENGTH_TO_CACHE = 1000; 35387 var Parser = function ParserClosure() { 35388 function Parser(lexer, allowStreams, xref, recoveryMode) { 35389 this.lexer = lexer;
35390 this.allowStreams = allowStreams; 35391 this.xref = xref; 35392 this.recoveryMode = recoveryMode || false; 35393 this.imageCache = Object.create(null); 35394 this.refill(); 35395 } 35396 Parser.prototype = { 35397 refill: function Parser_refill() { 35398 this.buf1 = this.lexer.getObj(); 35399 this.buf2 = this.lexer.getObj(); 35400 }, 35401 shift: function Parser_shift() { 35402 if (isCmd(this.buf2, 'ID')) { 35403 this.buf1 = this.buf2; 35404 this.buf2 = null; 35405 } else { 35406 this.buf1 = this.buf2; 35407 this.buf2 = this.lexer.getObj(); 35408 } 35409 }, 35410 tryShift: function Parser_tryShift() { 35411 try { 35412 this.shift(); 35413 return true; 35414 } catch (e) { 35415 if (e instanceof MissingDataException) { 35416 throw e; 35417 } 35418 return false; 35419 } 35420 }, 35421 getObj: function Parser_getObj(cipherTransform) { 35422 var buf1 = this.buf1; 35423 this.shift(); 35424 if (buf1 instanceof Cmd) { 35425 switch (buf1.cmd) { 35426 case 'BI': 35427 return this.makeInlineImage(cipherTransform); 35428 case '[': 35429 var array = []; 35430 while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) { 35431 array.push(this.getObj(cipherTransform)); 35432 } 35433 if (isEOF(this.buf1)) { 35434 if (!this.recoveryMode) { 35435 error('End of file inside array'); 35436 } 35437 return array; 35438 } 35439 this.shift(); 35440 return array; 35441 case '<<': 35442 var dict = new Dict(this.xref); 35443 while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) { 35444 if (!isName(this.buf1)) { 35445 info('Malformed dictionary: key must be a name object'); 35446 this.shift(); 35447 continue; 35448 } 35449 var key = this.buf1.name; 35450 this.shift(); 35451 if (isEOF(this.buf1)) { 35452 break; 35453 } 35454 dict.set(key, this.getObj(cipherTransform)); 35455 } 35456 if (isEOF(this.buf1)) { 35457 if (!this.recoveryMode) { 35458 error('End of file inside dictionary'); 35459 } 35460 return dict; 35461 } 35462 if (isCmd(this.buf2, 'stream')) { 35463 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 35464 } 35465 this.shift(); 35466 return dict; 35467 default: 35468 return buf1; 35469 } 35470 } 35471 if (isInt(buf1)) { 35472 var num = buf1; 35473 if (isInt(this.buf1) && isCmd(this.buf2, 'R')) { 35474 var ref = new Ref(num, this.buf1); 35475 this.shift(); 35476 this.shift(); 35477 return ref; 35478 } 35479 return num; 35480 } 35481 if (isString(buf1)) { 35482 var str = buf1; 35483 if (cipherTransform) { 35484 str = cipherTransform.decryptString(str); 35485 } 35486 return str; 35487 } 35488 return buf1; 35489 }, 35490 findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) { 35491 var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD; 35492 var startPos = stream.pos, state = 0, ch, i, n, followingBytes; 35493 while ((ch = stream.getByte()) !== -1) { 35494 if (state === 0) { 35495 state = ch === E ? 1 : 0; 35496 } else if (state === 1) { 35497 state = ch === I ? 2 : 0; 35498 } else { 35499 assert(state === 2); 35500 if (ch === SPACE || ch === LF || ch === CR) { 35501 n = 5; 35502 followingBytes = stream.peekBytes(n); 35503 for (i = 0; i < n; i++) { 35504 ch = followingBytes[i]; 35505 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) { 35506 state = 0; 35507 break; 35508 } 35509 } 35510 if (state === 2) { 35511 break; 35512 } 35513 } else 35514 { 35515 state = 0; 35516 } 35517 } 35518 } 35519 return stream.pos - 4 - startPos; 35520 }, 35521 findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) { 35522 var startPos = stream.pos, foundEOI = false, b, markerLength, length; 35523 while ((b = stream.getByte()) !== -1) { 35524 if (b !== 0xFF) { 35525 continue; 35526 } 35527 switch (stream.getByte()) { 35528 case 0x00: 35529 break; 35530 case 0xFF: 35531 stream.skip(-1); 35532 break; 35533 case 0xD9: 35534 foundEOI = true; 35535 break; 35536 case 0xC0: 35537 case 0xC1: 35538 case 0xC2: 35539 case 0xC3: 35540 case 0xC5: 35541 case 0xC6: 35542 case 0xC7: 35543 case 0xC9: 35544 case 0xCA: 35545 case 0xCB: 35546 case 0xCD: 35547 case 0xCE: 35548 case 0xCF: 35549 case 0xC4: 35550 case 0xCC: 35551 case 0xDA: 35552 case 0xDB: 35553 case 0xDC: 35554 case 0xDD: 35555 case 0xDE: 35556 case 0xDF: 35557 case 0xE0: 35558 case 0xE1: 35559 case 0xE2: 35560 case 0xE3: 35561 case 0xE4: 35562 case 0xE5: 35563 case 0xE6: 35564 case 0xE7: 35565 case 0xE8: 35566 case 0xE9: 35567 case 0xEA: 35568 case 0xEB: 35569 case 0xEC: 35570 case 0xED: 35571 case 0xEE: 35572 case 0xEF: 35573 case 0xFE: 35574 markerLength = stream.getUint16(); 35575 if (markerLength > 2) { 35576 stream.skip(markerLength - 2); 35577 } else 35578 { 35579 stream.skip(-2); 35580 } 35581 break; 35582 } 35583 if (foundEOI) { 35584 break; 35585 } 35586 } 35587 length = stream.pos - startPos; 35588 if (b === -1) { 35589 warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.'); 35590 stream.skip(-length); 35591 return this.findDefaultInlineStreamEnd(stream); 35592 } 35593 this.inlineStreamSkipEI(stream); 35594 return length; 35595 }, 35596 findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) { 35597 var TILDE = 0x7E, GT = 0x3E; 35598 var startPos = stream.pos, ch, length; 35599 while ((ch = stream.getByte()) !== -1) { 35600 if (ch === TILDE && stream.peekByte() === GT) { 35601 stream.skip(); 35602 break; 35603 } 35604 } 35605 length = stream.pos - startPos; 35606 if (ch === -1) { 35607 warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); 35608 stream.skip(-length); 35609 return this.findDefaultInlineStreamEnd(stream); 35610 } 35611 this.inlineStreamSkipEI(stream); 35612 return length; 35613 }, 35614 findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) { 35615 var GT = 0x3E; 35616 var startPos = stream.pos, ch, length; 35617 while ((ch = stream.getByte()) !== -1) { 35618 if (ch === GT) { 35619 break; 35620 } 35621 } 35622 length = stream.pos - startPos; 35623 if (ch === -1) { 35624 warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); 35625 stream.skip(-length); 35626 return this.findDefaultInlineStreamEnd(stream); 35627 } 35628 this.inlineStreamSkipEI(stream); 35629 return length; 35630 },
35631 inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) { 35632 var E = 0x45, I = 0x49; 35633 var state = 0, ch; 35634 while ((ch = stream.getByte()) !== -1) { 35635 if (state === 0) { 35636 state = ch === E ? 1 : 0; 35637 } else if (state === 1) { 35638 state = ch === I ? 2 : 0; 35639 } else if (state === 2) { 35640 break; 35641 } 35642 } 35643 }, 35644 makeInlineImage: function Parser_makeInlineImage(cipherTransform) { 35645 var lexer = this.lexer; 35646 var stream = lexer.stream; 35647 var dict = new Dict(this.xref); 35648 while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) { 35649 if (!isName(this.buf1)) { 35650 error('Dictionary key must be a name object'); 35651 } 35652 var key = this.buf1.name; 35653 this.shift(); 35654 if (isEOF(this.buf1)) { 35655 break; 35656 } 35657 dict.set(key, this.getObj(cipherTransform)); 35658 } 35659 var filter = dict.get('Filter', 'F'), filterName; 35660 if (isName(filter)) { 35661 filterName = filter.name; 35662 } else if (isArray(filter)) { 35663 var filterZero = this.xref.fetchIfRef(filter[0]); 35664 if (isName(filterZero)) { 35665 filterName = filterZero.name; 35666 } 35667 } 35668 var startPos = stream.pos, length, i, ii; 35669 if (filterName === 'DCTDecode' || filterName === 'DCT') { 35670 length = this.findDCTDecodeInlineStreamEnd(stream); 35671 } else if (filterName === 'ASCII85Decide' || filterName === 'A85') { 35672 length = this.findASCII85DecodeInlineStreamEnd(stream); 35673 } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') { 35674 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 35675 } else { 35676 length = this.findDefaultInlineStreamEnd(stream); 35677 } 35678 var imageStream = stream.makeSubStream(startPos, length, dict); 35679 var adler32; 35680 if (length < MAX_LENGTH_TO_CACHE) { 35681 var imageBytes = imageStream.getBytes(); 35682 imageStream.reset(); 35683 var a = 1; 35684 var b = 0; 35685 for (i = 0, ii = imageBytes.length; i < ii; ++i) { 35686 a += imageBytes[i] & 0xff; 35687 b += a; 35688 } 35689 adler32 = b % 65521 << 16 | a % 65521; 35690 if (this.imageCache.adler32 === adler32) { 35691 this.buf2 = Cmd.get('EI'); 35692 this.shift(); 35693 this.imageCache[adler32].reset(); 35694 return this.imageCache[adler32]; 35695 } 35696 } 35697 if (cipherTransform) { 35698 imageStream = cipherTransform.createStream(imageStream, length); 35699 } 35700 imageStream = this.filter(imageStream, dict, length); 35701 imageStream.dict = dict; 35702 if (adler32 !== undefined) { 35703 imageStream.cacheKey = 'inline_' + length + '_' + adler32; 35704 this.imageCache[adler32] = imageStream; 35705 } 35706 this.buf2 = Cmd.get('EI'); 35707 this.shift(); 35708 return imageStream; 35709 }, 35710 makeStream: function Parser_makeStream(dict, cipherTransform) { 35711 var lexer = this.lexer; 35712 var stream = lexer.stream; 35713 lexer.skipToNextLine(); 35714 var pos = stream.pos - 1; 35715 var length = dict.get('Length'); 35716 if (!isInt(length)) { 35717 info('Bad ' + length + ' attribute in stream'); 35718 length = 0; 35719 } 35720 stream.pos = pos + length; 35721 lexer.nextChar(); 35722 if (this.tryShift() && isCmd(this.buf2, 'endstream')) { 35723 this.shift(); 35724 } else 35725 { 35726 stream.pos = pos; 35727 var SCAN_BLOCK_SIZE = 2048; 35728 var ENDSTREAM_SIGNATURE_LENGTH = 9; 35729 var ENDSTREAM_SIGNATURE = [ 35730 0x65, 35731 0x6E, 35732 0x64, 35733 0x73, 35734 0x74, 35735 0x72, 35736 0x65, 35737 0x61, 35738 0x6D 35739 ]; 35740 var skipped = 0, found = false, i, j; 35741 while (stream.pos < stream.end) { 35742 var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE); 35743 var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH; 35744 if (scanLength <= 0) { 35745 break; 35746 } 35747 found = false; 35748 i = 0; 35749 while (i < scanLength) { 35750 j = 0; 35751 while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) { 35752 j++; 35753 } 35754 if (j >= ENDSTREAM_SIGNATURE_LENGTH) { 35755 found = true; 35756 break; 35757 } 35758 i++; 35759 } 35760 if (found) { 35761 skipped += i; 35762 stream.pos += i; 35763 break; 35764 } 35765 skipped += scanLength; 35766 stream.pos += scanLength; 35767 } 35768 if (!found) { 35769 error('Missing endstream'); 35770 } 35771 length = skipped; 35772 lexer.nextChar(); 35773 this.shift(); 35774 this.shift(); 35775 } 35776 this.shift(); 35777 stream = stream.makeSubStream(pos, length, dict); 35778 if (cipherTransform) { 35779 stream = cipherTransform.createStream(stream, length); 35780 } 35781 stream = this.filter(stream, dict, length); 35782 stream.dict = dict; 35783 return stream; 35784 }, 35785 filter: function Parser_filter(stream, dict, length) { 35786 var filter = dict.get('Filter', 'F'); 35787 var params = dict.get('DecodeParms', 'DP'); 35788 if (isName(filter)) { 35789 if (isArray(params)) { 35790 params = this.xref.fetchIfRef(params[0]); 35791 } 35792 return this.makeFilter(stream, filter.name, length, params); 35793 } 35794 var maybeLength = length; 35795 if (isArray(filter)) { 35796 var filterArray = filter; 35797 var paramsArray = params; 35798 for (var i = 0, ii = filterArray.length; i < ii; ++i) { 35799 filter = this.xref.fetchIfRef(filterArray[i]); 35800 if (!isName(filter)) { 35801 error('Bad filter name: ' + filter); 35802 } 35803 params = null; 35804 if (isArray(paramsArray) && i in paramsArray) { 35805 params = this.xref.fetchIfRef(paramsArray[i]); 35806 } 35807 stream = this.makeFilter(stream, filter.name, maybeLength, params); 35808 maybeLength = null; 35809 } 35810 } 35811 return stream; 35812 }, 35813 makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) { 35814 if (maybeLength === 0) {
35815 warn('Empty "' + name + '" stream.'); 35816 return new NullStream(stream); 35817 } 35818 try { 35819 var xrefStreamStats = this.xref.stats.streamTypes; 35820 if (name === 'FlateDecode' || name === 'Fl') { 35821 xrefStreamStats[StreamType.FLATE] = true; 35822 if (params) { 35823 return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params); 35824 } 35825 return new FlateStream(stream, maybeLength); 35826 } 35827 if (name === 'LZWDecode' || name === 'LZW') { 35828 xrefStreamStats[StreamType.LZW] = true; 35829 var earlyChange = 1; 35830 if (params) { 35831 if (params.has('EarlyChange')) { 35832 earlyChange = params.get('EarlyChange'); 35833 } 35834 return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 35835 } 35836 return new LZWStream(stream, maybeLength, earlyChange); 35837 } 35838 if (name === 'DCTDecode' || name === 'DCT') { 35839 xrefStreamStats[StreamType.DCT] = true; 35840 return new JpegStream(stream, maybeLength, stream.dict, params); 35841 } 35842 if (name === 'JPXDecode' || name === 'JPX') { 35843 xrefStreamStats[StreamType.JPX] = true; 35844 return new JpxStream(stream, maybeLength, stream.dict, params); 35845 } 35846 if (name === 'ASCII85Decode' || name === 'A85') { 35847 xrefStreamStats[StreamType.A85] = true; 35848 return new Ascii85Stream(stream, maybeLength); 35849 } 35850 if (name === 'ASCIIHexDecode' || name === 'AHx') { 35851 xrefStreamStats[StreamType.AHX] = true; 35852 return new AsciiHexStream(stream, maybeLength); 35853 } 35854 if (name === 'CCITTFaxDecode' || name === 'CCF') { 35855 xrefStreamStats[StreamType.CCF] = true; 35856 return new CCITTFaxStream(stream, maybeLength, params); 35857 } 35858 if (name === 'RunLengthDecode' || name === 'RL') { 35859 xrefStreamStats[StreamType.RL] = true; 35860 return new RunLengthStream(stream, maybeLength); 35861 } 35862 if (name === 'JBIG2Decode') { 35863 xrefStreamStats[StreamType.JBIG] = true; 35864 return new Jbig2Stream(stream, maybeLength, stream.dict, params); 35865 } 35866 warn('filter "' + name + '" not supported yet'); 35867 return stream; 35868 } catch (ex) { 35869 if (ex instanceof MissingDataException) { 35870 throw ex; 35871 } 35872 warn('Invalid stream: \"' + ex + '\"'); 35873 return new NullStream(stream); 35874 } 35875 } 35876 }; 35877 return Parser; 35878 }(); 35879 var Lexer = function LexerClosure() { 35880 function Lexer(stream, knownCommands) { 35881 this.stream = stream; 35882 this.nextChar(); 35883 this.strBuf = []; 35884 this.knownCommands = knownCommands; 35885 } 35886 var specialChars = [ 35887 1, 35888 0, 35889 0, 35890 0, 35891 0, 35892 0, 35893 0, 35894 0, 35895 0, 35896 1, 35897 1, 35898 0, 35899 1, 35900 1, 35901 0, 35902 0, 35903 0, 35904 0, 35905 0, 35906 0, 35907 0, 35908 0, 35909 0, 35910 0, 35911 0, 35912 0, 35913 0, 35914 0, 35915 0, 35916 0, 35917 0, 35918 0, 35919 1, 35920 0, 35921 0, 35922 0, 35923 0, 35924 2, 35925 0, 35926 0, 35927 2, 35928 2, 35929 0, 35930 0, 35931 0, 35932 0, 35933 0, 35934 2, 35935 0, 35936 0, 35937 0, 35938 0, 35939 0, 35940 0, 35941 0, 35942 0, 35943 0, 35944 0, 35945 0, 35946 0, 35947 2, 35948 0, 35949 2, 35950 0, 35951 0, 35952 0, 35953 0, 35954 0, 35955 0, 35956 0, 35957 0, 35958 0, 35959 0, 35960 0, 35961 0, 35962 0, 35963 0, 35964 0, 35965 0, 35966 0, 35967 0, 35968 0, 35969 0, 35970 0, 35971 0, 35972 0, 35973 0, 35974 0, 35975 0, 35976 0, 35977 0, 35978 2, 35979 0, 35980 2, 35981 0, 35982 0, 35983 0, 35984 0, 35985 0, 35986 0, 35987 0, 35988 0, 35989 0, 35990 0, 35991 0, 35992 0, 35993 0, 35994 0, 35995 0, 35996 0, 35997 0, 35998 0, 35999 0, 36000 0, 36001 0, 36002 0, 36003 0, 36004 0, 36005 0, 36006 0, 36007 0, 36008 0, 36009 0, 36010 2, 36011 0, 36012 2, 36013 0, 36014 0, 36015 0, 36016 0, 36017 0, 36018 0, 36019 0, 36020 0, 36021 0, 36022 0, 36023 0, 36024 0, 36025 0, 36026 0, 36027 0, 36028 0, 36029 0, 36030 0, 36031 0, 36032 0, 36033 0, 36034 0, 36035 0, 36036 0, 36037 0, 36038 0, 36039 0, 36040 0, 36041 0, 36042 0, 36043 0, 36044 0, 36045 0, 36046 0, 36047 0, 36048 0, 36049 0, 36050 0, 36051 0, 36052 0, 36053 0, 36054 0, 36055 0, 36056 0, 36057 0, 36058 0, 36059 0, 36060 0, 36061 0, 36062 0, 36063 0, 36064 0, 36065 0, 36066 0, 36067 0, 36068 0, 36069 0, 36070 0, 36071 0, 36072 0, 36073 0, 36074 0, 36075 0, 36076 0, 36077 0, 36078 0, 36079 0, 36080 0, 36081 0, 36082 0, 36083 0, 36084 0, 36085 0, 36086 0, 36087 0, 36088 0, 36089 0, 36090 0, 36091 0, 36092 0, 36093 0, 36094 0, 36095 0, 36096 0, 36097 0, 36098 0, 36099 0, 36100 0, 36101 0, 36102 0, 36103 0, 36104 0, 36105 0, 36106 0, 36107 0, 36108 0, 36109 0, 36110 0, 36111 0, 36112 0, 36113 0, 36114 0, 36115 0, 36116 0, 36117 0, 36118 0, 36119 0, 36120 0, 36121 0, 36122 0, 36123 0, 36124 0, 36125 0, 36126 0, 36127 0, 36128 0, 36129 0, 36130 0, 36131 0, 36132 0, 36133 0, 36134 0, 36135 0, 36136 0, 36137 0, 36138 0, 36139 0, 36140 0, 36141 0, 36142 0 36143 ]; 36144 function toHexDigit(ch) { 36145 if (ch >= 0x30 && ch <= 0x39) { 36146 return ch & 0x0F; 36147 } 36148 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 36149 return (ch & 0x0F) + 9; 36150 } 36151 return -1; 36152 } 36153 Lexer.prototype = { 36154 nextChar: function Lexer_nextChar() { 36155 return this.currentChar = this.stream.getByte(); 36156 }, 36157 peekChar: function Lexer_peekChar() { 36158 return this.stream.peekByte(); 36159 }, 36160 getNumber: function Lexer_getNumber() { 36161 var ch = this.currentChar; 36162 var eNotation = false;
36163 var divideBy = 0; 36164 var sign = 1; 36165 if (ch === 0x2D) { 36166 sign = -1; 36167 ch = this.nextChar(); 36168 if (ch === 0x2D) { 36169 ch = this.nextChar(); 36170 } 36171 } else if (ch === 0x2B) { 36172 ch = this.nextChar(); 36173 } 36174 if (ch === 0x2E) { 36175 divideBy = 10; 36176 ch = this.nextChar(); 36177 } 36178 if (ch < 0x30 || ch > 0x39) { 36179 error('Invalid number: ' + String.fromCharCode(ch)); 36180 return 0; 36181 } 36182 var baseValue = ch - 0x30; 36183 var powerValue = 0; 36184 var powerValueSign = 1; 36185 while ((ch = this.nextChar()) >= 0) { 36186 if (0x30 <= ch && ch <= 0x39) { 36187 var currentDigit = ch - 0x30; 36188 if (eNotation) { 36189 powerValue = powerValue * 10 + currentDigit; 36190 } else { 36191 if (divideBy !== 0) { 36192 divideBy *= 10; 36193 } 36194 baseValue = baseValue * 10 + currentDigit; 36195 } 36196 } else if (ch === 0x2E) { 36197 if (divideBy === 0) { 36198 divideBy = 1; 36199 } else { 36200 break; 36201 } 36202 } else if (ch === 0x2D) { 36203 warn('Badly formatted number'); 36204 } else if (ch === 0x45 || ch === 0x65) { 36205 ch = this.peekChar(); 36206 if (ch === 0x2B || ch === 0x2D) { 36207 powerValueSign = ch === 0x2D ? -1 : 1; 36208 this.nextChar(); 36209 } else if (ch < 0x30 || ch > 0x39) { 36210 break; 36211 } 36212 eNotation = true; 36213 } else { 36214 break; 36215 } 36216 } 36217 if (divideBy !== 0) { 36218 baseValue /= divideBy; 36219 } 36220 if (eNotation) { 36221 baseValue *= Math.pow(10, powerValueSign * powerValue); 36222 } 36223 return sign * baseValue; 36224 }, 36225 getString: function Lexer_getString() { 36226 var numParen = 1; 36227 var done = false; 36228 var strBuf = this.strBuf; 36229 strBuf.length = 0; 36230 var ch = this.nextChar(); 36231 while (true) { 36232 var charBuffered = false; 36233 switch (ch | 0) { 36234 case -1: 36235 warn('Unterminated string'); 36236 done = true; 36237 break; 36238 case 0x28: 36239 ++numParen; 36240 strBuf.push('('); 36241 break; 36242 case 0x29: 36243 if (--numParen === 0) { 36244 this.nextChar(); 36245 done = true; 36246 } else { 36247 strBuf.push(')'); 36248 } 36249 break; 36250 case 0x5C: 36251 ch = this.nextChar(); 36252 switch (ch) { 36253 case -1: 36254 warn('Unterminated string'); 36255 done = true; 36256 break; 36257 case 0x6E: 36258 strBuf.push('\n'); 36259 break; 36260 case 0x72: 36261 strBuf.push('\r'); 36262 break; 36263 case 0x74: 36264 strBuf.push('\t'); 36265 break; 36266 case 0x62: 36267 strBuf.push('\b'); 36268 break; 36269 case 0x66: 36270 strBuf.push('\f'); 36271 break; 36272 case 0x5C: 36273 case 0x28: 36274 case 0x29: 36275 strBuf.push(String.fromCharCode(ch)); 36276 break; 36277 case 0x30: 36278 case 0x31: 36279 case 0x32: 36280 case 0x33: 36281 case 0x34: 36282 case 0x35: 36283 case 0x36: 36284 case 0x37: 36285 var x = ch & 0x0F; 36286 ch = this.nextChar(); 36287 charBuffered = true; 36288 if (ch >= 0x30 && ch <= 0x37) { 36289 x = (x << 3) + (ch & 0x0F); 36290 ch = this.nextChar(); 36291 if (ch >= 0x30 && ch <= 0x37) { 36292 charBuffered = false; 36293 x = (x << 3) + (ch & 0x0F); 36294 } 36295 } 36296 strBuf.push(String.fromCharCode(x)); 36297 break; 36298 case 0x0D: 36299 if (this.peekChar() === 0x0A) { 36300 this.nextChar(); 36301 } 36302 break; 36303 case 0x0A: 36304 break; 36305 default: 36306 strBuf.push(String.fromCharCode(ch)); 36307 break; 36308 } 36309 break; 36310 default: 36311 strBuf.push(String.fromCharCode(ch)); 36312 break; 36313 } 36314 if (done) { 36315 break; 36316 } 36317 if (!charBuffered) { 36318 ch = this.nextChar(); 36319 } 36320 } 36321 return strBuf.join(''); 36322 }, 36323 getName: function Lexer_getName() { 36324 var ch, previousCh; 36325 var strBuf = this.strBuf; 36326 strBuf.length = 0; 36327 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 36328 if (ch === 0x23) { 36329 ch = this.nextChar(); 36330 if (specialChars[ch]) { 36331 warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.'); 36332 strBuf.push('#'); 36333 break; 36334 } 36335 var x = toHexDigit(ch); 36336 if (x !== -1) { 36337 previousCh = ch; 36338 ch = this.nextChar(); 36339 var x2 = toHexDigit(ch); 36340 if (x2 === -1) { 36341 warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.'); 36342 strBuf.push('#', String.fromCharCode(previousCh)); 36343 if (specialChars[ch]) { 36344 break; 36345 } 36346 strBuf.push(String.fromCharCode(ch)); 36347 continue; 36348 } 36349 strBuf.push(String.fromCharCode(x << 4 | x2)); 36350 } else { 36351 strBuf.push('#', String.fromCharCode(ch)); 36352 } 36353 } else { 36354 strBuf.push(String.fromCharCode(ch)); 36355 } 36356 } 36357 if (strBuf.length > 127) { 36358 warn('name token is longer than allowed by the spec: ' + strBuf.length); 36359 } 36360 return Name.get(strBuf.join('')); 36361 }, 36362 getHexString: function Lexer_getHexString() { 36363 var strBuf = this.strBuf; 36364 strBuf.length = 0; 36365 var ch = this.currentChar; 36366 var isFirstHex = true; 36367 var firstDigit; 36368 var secondDigit; 36369 while (true) { 36370 if (ch < 0) { 36371 warn('Unterminated hex string'); 36372 break; 36373 } else if (ch === 0x3E) { 36374 this.nextChar(); 36375 break; 36376 } else if (specialChars[ch] === 1) { 36377 ch = this.nextChar(); 36378 continue; 36379 } else { 36380 if (isFirstHex) { 36381 firstDigit = toHexDigit(ch); 36382 if (firstDigit === -1) { 36383 warn('Ignoring invalid character "' + ch + '" in hex string'); 36384 ch = this.nextChar(); 36385 continue; 36386 } 36387 } else { 36388 secondDigit = toHexDigit(ch); 36389 if (secondDigit === -1) { 36390 warn('Ignoring invalid character "' + ch + '" in hex string'); 36391 ch = this.nextChar(); 36392 continue; 36393 } 36394 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 36395 } 36396 isFirstHex = !isFirstHex; 36397 ch = this.nextChar(); 36398 } 36399 } 36400 return strBuf.join(''); 36401 }, 36402 getObj: function Lexer_getObj() { 36403 var comment = false;
36404 var ch = this.currentChar; 36405 while (true) { 36406 if (ch < 0) { 36407 return EOF; 36408 } 36409 if (comment) { 36410 if (ch === 0x0A || ch === 0x0D) { 36411 comment = false; 36412 } 36413 } else if (ch === 0x25) { 36414 comment = true; 36415 } else if (specialChars[ch] !== 1) { 36416 break; 36417 } 36418 ch = this.nextChar(); 36419 } 36420 switch (ch | 0) { 36421 case 0x30: 36422 case 0x31: 36423 case 0x32: 36424 case 0x33: 36425 case 0x34: 36426 case 0x35: 36427 case 0x36: 36428 case 0x37: 36429 case 0x38: 36430 case 0x39: 36431 case 0x2B: 36432 case 0x2D: 36433 case 0x2E: 36434 return this.getNumber(); 36435 case 0x28: 36436 return this.getString(); 36437 case 0x2F: 36438 return this.getName(); 36439 case 0x5B: 36440 this.nextChar(); 36441 return Cmd.get('['); 36442 case 0x5D: 36443 this.nextChar(); 36444 return Cmd.get(']'); 36445 case 0x3C: 36446 ch = this.nextChar(); 36447 if (ch === 0x3C) { 36448 this.nextChar(); 36449 return Cmd.get('<<'); 36450 } 36451 return this.getHexString(); 36452 case 0x3E: 36453 ch = this.nextChar(); 36454 if (ch === 0x3E) { 36455 this.nextChar(); 36456 return Cmd.get('>>'); 36457 } 36458 return Cmd.get('>'); 36459 case 0x7B: 36460 this.nextChar(); 36461 return Cmd.get('{'); 36462 case 0x7D: 36463 this.nextChar(); 36464 return Cmd.get('}'); 36465 case 0x29: 36466 error('Illegal character: ' + ch); 36467 break; 36468 } 36469 var str = String.fromCharCode(ch); 36470 var knownCommands = this.knownCommands; 36471 var knownCommandFound = knownCommands && knownCommands[str] !== undefined; 36472 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 36473 var possibleCommand = str + String.fromCharCode(ch); 36474 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 36475 break; 36476 } 36477 if (str.length === 128) { 36478 error('Command token too long: ' + str.length); 36479 } 36480 str = possibleCommand; 36481 knownCommandFound = knownCommands && knownCommands[str] !== undefined; 36482 } 36483 if (str === 'true') { 36484 return true; 36485 } 36486 if (str === 'false') { 36487 return false; 36488 } 36489 if (str === 'null') { 36490 return null; 36491 } 36492 return Cmd.get(str); 36493 }, 36494 skipToNextLine: function Lexer_skipToNextLine() { 36495 var ch = this.currentChar; 36496 while (ch >= 0) { 36497 if (ch === 0x0D) { 36498 ch = this.nextChar(); 36499 if (ch === 0x0A) { 36500 this.nextChar(); 36501 } 36502 break; 36503 } else if (ch === 0x0A) { 36504 this.nextChar(); 36505 break; 36506 } 36507 ch = this.nextChar(); 36508 } 36509 } 36510 }; 36511 return Lexer; 36512 }(); 36513 var Linearization = { 36514 create: function LinearizationCreate(stream) { 36515 function getInt(name, allowZeroValue) { 36516 var obj = linDict.get(name); 36517 if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 36518 return obj; 36519 } 36520 throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invali
36520d.'); 36521 } 36522 function getHints() { 36523 var hints = linDict.get('H'), hintsLength, item; 36524 if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 36525 for (var index = 0; index < hintsLength; index++) { 36526 if (!(isInt(item = hints[index]) && item > 0)) { 36527 throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.'); 36528 } 36529 } 36530 return hints; 36531 } 36532 throw new Error('Hint array in the linearization dictionary is invalid.'); 36533 } 36534 var parser = new Parser(new Lexer(stream), false, null); 36535 var obj1 = parser.getObj(); 36536 var obj2 = parser.getObj(); 36537 var obj3 = parser.getObj(); 36538 var linDict = parser.getObj(); 36539 var obj, length; 36540 if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) { 36541 return null; 36542 } else if ((length = getInt('L')) !== stream.length) { 36543 throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.'); 36544 } 36545 return { 36546 length: length, 36547 hints: getHints(), 36548 objectNumberFirst: getInt('O'), 36549 endFirst: getInt('E'), 36550 numPages: getInt('N'), 36551 mainXRefEntriesOffset: getInt('T'), 36552 pageFirst: linDict.has('P') ? getInt('P', true) : 0 36553 }; 36554 } 36555 }; 36556 exports.Lexer = Lexer; 36557 exports.Linearization = Linearization; 36558 exports.Parser = Parser; 36559 })); 36560 (function (root, factory) { 36561 factory(root.pdfjsCoreType1Parser = {}, root.pdfjsSharedUtil, root.pdfjsCoreStream, root.pdfjsCoreEncodings); 36562 }(this, function (exports, sharedUtil, coreStream, coreEncodings) { 36563 var warn = sharedUtil.warn; 36564 var isSpace = sharedUtil.isSpace; 36565 var Stream = coreStream.Stream; 36566 var getEncoding = coreEncodings.getEncoding; 36567 var HINTING_ENABLED = false; 36568 var Type1CharString = function Type1CharStringClosure() { 36569 var COMMAND_MAP = { 36570 'hstem': [1], 36571 'vstem': [3], 36572 'vmoveto': [4], 36573 'rlineto': [5], 36574 'hlineto': [6], 36575 'vlineto': [7], 36576 'rrcurveto': [8], 36577 'callsubr': [10], 36578 'flex': [ 36579 12, 36580 35 36581 ], 36582 'drop': [ 36583 12, 36584 18 36585 ], 36586 'endchar': [14], 36587 'rmoveto': [21], 36588 'hmoveto': [22], 36589 'vhcurveto': [30], 36590 'hvcurveto': [31] 36591 }; 36592 function Type1CharString() { 36593 this.width = 0; 36594 this.lsb = 0; 36595 this.flexing = false; 36596 this.output = []; 36597 this.stack = []; 36598 } 36599 Type1CharString.prototype = { 36600 convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) { 36601 var count = encoded.length; 36602 var error = false; 36603 var wx, sbx, subrNumber; 36604 for (var i = 0; i < count; i++) { 36605 var value = encoded[i]; 36606 if (value < 32) { 36607 if (value === 12) { 36608 value = (value << 8) + encoded[++i]; 36609 } 36610 switch (value) { 36611 case 1: 36612 if (!HINTING_ENABLED) { 36613 this.stack = []; 36614 break; 36615 } 36616 error = this.executeCommand(2, COMMAND_MAP.hstem); 36617 break; 36618 case 3: 36619 if (!HINTING_ENABLED) { 36620 this.stack = []; 36621 break; 36622 } 36623 error = this.executeCommand(2, COMMAND_MAP.vstem); 36624 break; 36625 case 4: 36626 if (this.flexing) { 36627 if (this.stack.length < 1) { 36628 error = true; 36629 break; 36630 } 36631 var dy = this.stack.pop(); 36632 this.stack.push(0, dy); 36633 break; 36634 } 36635 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 36636 break; 36637 case 5: 36638 error = this.executeCommand(2, COMMAND_MAP.rlineto); 36639 break; 36640 case 6: 36641 error = this.executeCommand(1, COMMAND_MAP.hlineto); 36642 break; 36643 case 7: 36644 error = this.executeCommand(1, COMMAND_MAP.vlineto); 36645 break; 36646 case 8: 36647 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 36648 break; 36649 case 9: 36650 this.stack = []; 36651 break; 36652 case 10: 36653 if (this.stack.length < 1) { 36654 error = true; 36655 break; 36656 } 36657 subrNumber = this.stack.pop(); 36658 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 36659 break; 36660 case 11: 36661 return error; 36662 case 13: 36663 if (this.stack.length < 2) { 36664 error = true; 36665 break; 36666 } 36667 wx = this.stack.pop(); 36668 sbx = this.stack.pop(); 36669 this.lsb = sbx; 36670 this.width = wx; 36671 this.stack.push(wx, sbx); 36672 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 36673 break; 36674 case 14: 36675 this.output.push(COMMAND_MAP.endchar[0]); 36676 break; 36677 case 21: 36678 if (this.flexing) { 36679 break; 36680 } 36681 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 36682 break; 36683 case 22: 36684 if (this.flexing) { 36685 this.stack.push(0); 36686 break; 36687 } 36688 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 36689 break; 36690 case 30: 36691 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 36692 break; 36693 case 31: 36694 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 36695 break; 36696 case (12 << 8) + 0: 36697 this.stack = []; 36698 break; 36699 case (12 << 8) + 1: 36700 if (!HINTING_ENABLED) { 36701 this.stack = []; 36702 break; 36703 } 36704 error = this.executeCommand(2, COMMAND_MAP.vstem); 36705 break; 36706 case (12 << 8) + 2: 36707 if (!HINTING_ENABLED) { 36708 this.stack = []; 36709 break; 36710 } 36711 error = this.executeCommand(2, COMMAND_MAP.hstem); 36712 break; 36713 case (12 << 8) + 6: 36714 if (seacAnalysisEnabled) { 36715 this.seac = this.stack.splice(-4, 4); 36716 error = this.executeCommand(0, COMMAND_MAP.endchar); 36717 } else { 36718 error = this.executeCommand(4, COMMAND_MAP.endchar); 36719 } 36720 break; 36721 case (12 << 8) + 7: 36722 if (this.stack.length < 4) { 36723 error = true; 36724 break; 36725 } 36726 this.stack.pop(); 36727 wx = this.stack.pop(); 36728 var sby = this.stack.pop(); 36729 sbx = this.stack.pop(); 36730 this.lsb = sbx; 36731 this.width = wx; 36732 this.stack.push(wx, sbx, sby); 36733 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 36734 break; 36735 case (12 << 8) + 12: 36736 if (this.stack.length < 2) { 36737 error = true; 36738 break; 36739 } 36740 var num2 = this.stack.pop(); 36741 var num1 = this.stack.pop(); 36742 this.stack.push(num1 / num2); 36743 break; 36744 case (12 << 8) + 16: 36745 if (this.stack.length < 2) { 36746 error = true; 36747 break; 36748 } 36749 subrNumber = this.stack.pop(); 36750 var numArgs = this.stack.pop(); 36751 if (subrNumber === 0 && numArgs === 3) { 36752 var flexArgs = this.stack.splice(this.stack.length - 17, 17); 36753 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]); 36754 error = this.executeCommand(13, COMMAND_MAP.flex, true); 36755 this.flexing = false;
36756 this.stack.push(flexArgs[15], flexArgs[16]); 36757 } else if (subrNumber === 1 && numArgs === 0) { 36758 this.flexing = true; 36759 } 36760 break; 36761 case (12 << 8) + 17: 36762 break; 36763 case (12 << 8) + 33: 36764 this.stack = []; 36765 break; 36766 default: 36767 warn('Unknown type 1 charstring command of "' + value + '"'); 36768 break; 36769 } 36770 if (error) { 36771 break; 36772 } 36773 continue; 36774 } else if (value <= 246) { 36775 value = value - 139; 36776 } else if (value <= 250) { 36777 value = (value - 247) * 256 + encoded[++i] + 108; 36778 } else if (value <= 254) { 36779 value = -((value - 251) * 256) - encoded[++i] - 108; 36780 } else { 36781 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 36782 } 36783 this.stack.push(value); 36784 } 36785 return error; 36786 }, 36787 executeCommand: function (howManyArgs, command, keepStack) { 36788 var stackLength = this.stack.length; 36789 if (howManyArgs > stackLength) { 36790 return true; 36791 } 36792 var start = stackLength - howManyArgs; 36793 for (var i = start; i < stackLength; i++) { 36794 var value = this.stack[i]; 36795 if (value === (value | 0)) { 36796 this.output.push(28, value >> 8 & 0xff, value & 0xff); 36797 } else { 36798 value = 65536 * value | 0; 36799 this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF); 36800 } 36801 } 36802 this.output.push.apply(this.output, command); 36803 if (keepStack) { 36804 this.stack.splice(start, howManyArgs); 36805 } else { 36806 this.stack.length = 0; 36807 } 36808 return false; 36809 } 36810 }; 36811 return Type1CharString; 36812 }(); 36813 var Type1Parser = function Type1ParserClosure() { 36814 var EEXEC_ENCRYPT_KEY = 55665; 36815 var CHAR_STRS_ENCRYPT_KEY = 4330; 36816 function isHexDigit(code) { 36817 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 36818 } 36819 function decrypt(data, key, discardNumber) { 36820 if (discardNumber >= data.length) { 36821 return new Uint8Array(0); 36822 } 36823 var r = key | 0, c1 = 52845, c2 = 22719, i, j; 36824 for (i = 0; i < discardNumber; i++) { 36825 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 36826 } 36827 var count = data.length - discardNumber; 36828 var decrypted = new Uint8Array(count); 36829 for (i = discardNumber, j = 0; j < count; i++, j++) { 36830 var value = data[i]; 36831 decrypted[j] = value ^ r >> 8; 36832 r = (value + r) * c1 + c2 & (1 << 16) - 1; 36833 } 36834 return decrypted; 36835 } 36836 function decryptAscii(data, key, discardNumber) { 36837 var r = key | 0, c1 = 52845, c2 = 22719; 36838 var count = data.length, maybeLength = count >>> 1; 36839 var decrypted = new Uint8Array(maybeLength); 36840 var i, j; 36841 for (i = 0, j = 0; i < count; i++) { 36842 var digit1 = data[i]; 36843 if (!isHexDigit(digit1)) { 36844 continue; 36845 } 36846 i++; 36847 var digit2; 36848 while (i < count && !isHexDigit(digit2 = data[i])) { 36849 i++; 36850 } 36851 if (i < count) { 36852 var value = parseInt(String.fromCharCode(digit1, digit2), 16); 36853 decrypted[j++] = value ^ r >> 8; 36854 r = (value + r) * c1 + c2 & (1 << 16) - 1; 36855 } 36856 } 36857 return Array.prototype.slice.call(decrypted, discardNumber, j); 36858 } 36859 function isSpecial(c) { 36860 return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29; 36861 } 36862 function Type1Parser(stream, encrypted, seacAnalysisEnabled) { 36863 if (encrypted) { 36864 var data = stream.getBytes(); 36865 var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3])); 36866 stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 36867 } 36868 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 36869 this.stream = stream; 36870 this.nextChar(); 36871 } 36872 Type1Parser.prototype = { 36873 readNumberArray: function Type1Parser_readNumberArray() { 36874 this.getToken(); 36875 var array = []; 36876 while (true) { 36877 var token = this.getToken(); 36878 if (token === null || token === ']' || token === '}') { 36879 break; 36880 } 36881 array.push(parseFloat(token || 0)); 36882 } 36883 return array; 36884 }, 36885 readNumber: function Type1Parser_readNumber() { 36886 var token = this.getToken(); 36887 return parseFloat(token || 0); 36888 }, 36889 readInt: function Type1Parser_readInt() { 36890 var token = this.getToken(); 36891 return parseInt(token || 0, 10) | 0; 36892 }, 36893 readBoolean: function Type1Parser_readBoolean() { 36894 var token = this.getToken(); 36895 return token === 'true' ? 1 : 0; 36896 }, 36897 nextChar: function Type1_nextChar() { 36898 return this.currentChar = this.stream.getByte(); 36899 }, 36900 getToken: function Type1Parser_getToken() { 36901 var comment = false;
36902 var ch = this.currentChar; 36903 while (true) { 36904 if (ch === -1) { 36905 return null; 36906 } 36907 if (comment) { 36908 if (ch === 0x0A || ch === 0x0D) { 36909 comment = false; 36910 } 36911 } else if (ch === 0x25) { 36912 comment = true; 36913 } else if (!isSpace(ch)) { 36914 break; 36915 } 36916 ch = this.nextChar(); 36917 } 36918 if (isSpecial(ch)) { 36919 this.nextChar(); 36920 return String.fromCharCode(ch); 36921 } 36922 var token = ''; 36923 do { 36924 token += String.fromCharCode(ch); 36925 ch = this.nextChar(); 36926 } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch)); 36927 return token; 36928 }, 36929 extractFontProgram: function Type1Parser_extractFontProgram() { 36930 var stream = this.stream; 36931 var subrs = [], charstrings = []; 36932 var privateData = Object.create(null); 36933 privateData['lenIV'] = 4; 36934 var program = { 36935 subrs: [], 36936 charstrings: [], 36937 properties: { 'privateData': privateData } 36938 }; 36939 var token, length, data, lenIV, encoded; 36940 while ((token = this.getToken()) !== null) { 36941 if (token !== '/') { 36942 continue; 36943 } 36944 token = this.getToken(); 36945 switch (token) { 36946 case 'CharStrings': 36947 this.getToken(); 36948 this.getToken(); 36949 this.getToken(); 36950 this.getToken(); 36951 while (true) { 36952 token = this.getToken(); 36953 if (token === null || token === 'end') { 36954 break; 36955 } 36956 if (token !== '/') { 36957 continue; 36958 } 36959 var glyph = this.getToken(); 36960 length = this.readInt(); 36961 this.getToken(); 36962 data = stream.makeSubStream(stream.pos, length); 36963 lenIV = program.properties.privateData['lenIV']; 36964 encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV); 36965 stream.skip(length); 36966 this.nextChar(); 36967 token = this.getToken(); 36968 if (token === 'noaccess') { 36969 this.getToken(); 36970 } 36971 charstrings.push({ 36972 glyph: glyph, 36973 encoded: encoded 36974 }); 36975 } 36976 break; 36977 case 'Subrs': 36978 this.readInt(); 36979 this.getToken(); 36980 while ((token = this.getToken()) === 'dup') { 36981 var index = this.readInt(); 36982 length = this.readInt(); 36983 this.getToken(); 36984 data = stream.makeSubStream(stream.pos, length); 36985 lenIV = program.properties.privateData['lenIV']; 36986 encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV); 36987 stream.skip(length); 36988 this.nextChar(); 36989 token = this.getToken(); 36990 if (token === 'noaccess') { 36991 this.getToken(); 36992 } 36993 subrs[index] = encoded; 36994 } 36995 break; 36996 case 'BlueValues': 36997 case 'OtherBlues': 36998 case 'FamilyBlues': 36999 case 'FamilyOtherBlues': 37000 var blueArray = this.readNumberArray(); 37001 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 37002 program.properties.privateData[token] = blueArray; 37003 } 37004 break; 37005 case 'StemSnapH': 37006 case 'StemSnapV': 37007 program.properties.privateData[token] = this.readNumberArray(); 37008 break; 37009 case 'StdHW': 37010 case 'StdVW': 37011 program.properties.privateData[token] = this.readNumberArray()[0]; 37012 break; 37013 case 'BlueShift': 37014 case 'lenIV': 37015 case 'BlueFuzz': 37016 case 'BlueScale': 37017 case 'LanguageGroup': 37018 case 'ExpansionFactor': 37019 program.properties.privateData[token] = this.readNumber(); 37020 break; 37021 case 'ForceBold': 37022 program.properties.privateData[token] = this.readBoolean(); 37023 break; 37024 } 37025 } 37026 for (var i = 0; i < charstrings.length; i++) { 37027 glyph = charstrings[i].glyph; 37028 encoded = charstrings[i].encoded; 37029 var charString = new Type1CharString(); 37030 var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 37031 var output = charString.output; 37032 if (error) { 37033 output = [14]; 37034 } 37035 program.charstrings.push({ 37036 glyphName: glyph, 37037 charstring: output, 37038 width: charString.width, 37039 lsb: charString.lsb, 37040 seac: charString.seac 37041 }); 37042 } 37043 return program; 37044 }, 37045 extractFontHeader: function Type1Parser_extractFontHeader(properties) { 37046 var token; 37047 while ((token = this.getToken()) !== null) { 37048 if (token !== '/') { 37049 continue; 37050 } 37051 token = this.getToken(); 37052 switch (token) { 37053 case 'FontMatrix': 37054 var matrix = this.readNumberArray(); 37055 properties.fontMatrix = matrix; 37056 break; 37057 case 'Encoding': 37058 var encodingArg = this.getToken(); 37059 var encoding; 37060 if (!/^\d+$/.test(encodingArg)) { 37061 encoding = getEncoding(encodingArg); 37062 } else { 37063 encoding = []; 37064 var size = parseInt(encodingArg, 10) | 0; 37065 this.getToken(); 37066 for (var j = 0; j < size; j++) { 37067 token = this.getToken(); 37068 while (token !== 'dup' && token !== 'def') { 37069 token = this.getToken(); 37070 if (token === null) { 37071 return; 37072 } 37073 } 37074 if (token === 'def') { 37075 break; 37076 } 37077 var index = this.readInt(); 37078 this.getToken(); 37079 var glyph = this.getToken(); 37080 encoding[index] = glyph; 37081 this.getToken(); 37082 } 37083 } 37084 properties.builtInEncoding = encoding; 37085 break; 37086 case 'FontBBox': 37087 var fontBBox = this.readNumberArray(); 37088 properties.ascent = fontBBox[3]; 37089 properties.descent = fontBBox[1]; 37090 properties.ascentScaled = true; 37091 break; 37092 } 37093 } 37094 } 37095 }; 37096 return Type1Parser; 37097 }(); 37098 exports.Type1Parser = Type1Parser; 37099 })); 37100 (function (root, factory) { 37101 factory(root.pdfjsCoreCMap = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser); 37102 }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser) { 37103 var Util = sharedUtil.Util; 37104 var assert = sharedUtil.assert; 37105 var warn = sharedUtil.warn; 37106 var error = sharedUtil.error; 37107 var isInt = sharedUtil.isInt; 37108 var isString = sharedUtil.isString; 37109 var MissingDataException = sharedUtil.MissingDataException; 37110 var isEOF = corePrimitives.isEOF; 37111 var isName = corePrimitives.isName; 37112 var isCmd = corePrimitives.isCmd; 37113 var isStream = corePrimitives.isStream; 37114 var StringStream = coreStream.StringStream; 37115 var Lexer = coreParser.Lexer; 37116 var BUILT_IN_CMAPS = [ 37117 'Adobe-GB1-UCS2', 37118 'Adobe-CNS1-UCS2', 37119 'Adobe-Japan1-UCS2', 37120 'Adobe-Korea1-UCS2', 37121 '78-EUC-H', 37122 '78-EUC-V', 37123 '78-H', 37124 '78-RKSJ-H', 37125 '78-RKSJ-V', 37126 '78-V', 37127 '78ms-RKSJ-H', 37128 '78ms-RKSJ-V', 37129 '83pv-RKSJ-H', 37130 '90ms-RKSJ-H', 37131 '90ms-RKSJ-V', 37132 '90msp-RKSJ-H', 37133 '90msp-RKSJ-V', 37134 '90pv-RKSJ-H', 37135 '90pv-RKSJ-V', 37136 'Add-H', 37137 'Add-RKSJ-H', 37138 'Add-RKSJ-V', 37139 'Add-V', 37140 'Adobe-CNS1-0', 37141 'Adobe-CNS1-1', 37142 'Adobe-CNS1-2', 37143 'Adobe-CNS1-3', 37144 'Adobe-CNS1-4', 37145 'Adobe-CNS1-5', 37146 'Adobe-CNS1-6', 37147 'Adobe-GB1-0', 37148 'Adobe-GB1-1', 37149 'Adobe-GB1-2', 37150 'Adobe-GB1-3', 37151 'Adobe-GB1-4', 37152 'Adobe-GB1-5', 37153 'Adobe-Japan1-0', 37154 'Adobe-Japan1-1', 37155 'Adobe-Japan1-2', 37156 'Adobe-Japan1-3', 37157 'Adobe-Japan1-4', 37158 'Adobe-Japan1-5', 37159 'Adobe-Japan1-6', 37160 'Adobe-Korea1-0', 37161 'Adobe-Korea1-1', 37162 'Adobe-Korea1-2', 37163 'B5-H', 37164 'B5-V', 37165 'B5pc-H', 37166 'B5pc-V', 37167 'CNS-EUC-H', 37168 'CNS-EUC-V', 37169 'CNS1-H', 37170 'CNS1-V', 37171 'CNS2-H', 37172 'CNS2-V', 37173 'ETHK-B5-H', 37174 'ETHK-B5-V', 37175 'ETen-B5-H', 37176 'ETen-B5-V', 37177 'ETenms-B5-H', 37178 'ETenms-B5-V', 37179 'EUC-H', 37180 'EUC-V', 37181 'Ext-H', 37182 'Ext-RKSJ-H', 37183 'Ext-RKSJ-V', 37184 'Ext-V', 37185 'GB-EUC-H', 37186 'GB-EUC-V', 37187 'GB-H', 37188 'GB-V', 37189 'GBK-EUC-H', 37190 'GBK-EUC-V', 37191 'GBK2K-H', 37192 'GBK2K-V', 37193 'GBKp-EUC-H', 37194 'GBKp-EUC-V', 37195 'GBT-EUC-H', 37196 'GBT-EUC-V', 37197 'GBT-H', 37198 'GBT-V', 37199 'GBTpc-EUC-H', 37200 'GBTpc-EUC-V', 37201 'GBpc-EUC-H', 37202 'GBpc-EUC-V', 37203 'H', 37204 'HKdla-B5-H', 37205 'HKdla-B5-V', 37206 'HKdlb-B5-H', 37207 'HKdlb-B5-V', 37208 'HKgccs-B5-H', 37209 'HKgccs-B5-V', 37210 'HKm314-B5-H', 37211 'HKm314-B5-V', 37212 'HKm471-B5-H', 37213 'HKm471-B5-V', 37214 'HKscs-B5-H', 37215 'HKscs-B5-V', 37216 'Hankaku', 37217 'Hiragana',
37218 'KSC-EUC-H', 37219 'KSC-EUC-V', 37220 'KSC-H', 37221 'KSC-Johab-H', 37222 'KSC-Johab-V', 37223 'KSC-V', 37224 'KSCms-UHC-H', 37225 'KSCms-UHC-HW-H', 37226 'KSCms-UHC-HW-V', 37227 'KSCms-UHC-V', 37228 'KSCpc-EUC-H', 37229 'KSCpc-EUC-V', 37230 'Katakana', 37231 'NWP-H', 37232 'NWP-V', 37233 'RKSJ-H', 37234 'RKSJ-V', 37235 'Roman', 37236 'UniCNS-UCS2-H', 37237 'UniCNS-UCS2-V', 37238 'UniCNS-UTF16-H', 37239 'UniCNS-UTF16-V', 37240 'UniCNS-UTF32-H', 37241 'UniCNS-UTF32-V', 37242 'UniCNS-UTF8-H', 37243 'UniCNS-UTF8-V', 37244 'UniGB-UCS2-H', 37245 'UniGB-UCS2-V', 37246 'UniGB-UTF16-H', 37247 'UniGB-UTF16-V', 37248 'UniGB-UTF32-H', 37249 'UniGB-UTF32-V', 37250 'UniGB-UTF8-H', 37251 'UniGB-UTF8-V', 37252 'UniJIS-UCS2-H', 37253 'UniJIS-UCS2-HW-H', 37254 'UniJIS-UCS2-HW-V', 37255 'UniJIS-UCS2-V', 37256 'UniJIS-UTF16-H', 37257 'UniJIS-UTF16-V', 37258 'UniJIS-UTF32-H', 37259 'UniJIS-UTF32-V', 37260 'UniJIS-UTF8-H', 37261 'UniJIS-UTF8-V', 37262 'UniJIS2004-UTF16-H', 37263 'UniJIS2004-UTF16-V', 37264 'UniJIS2004-UTF32-H', 37265 'UniJIS2004-UTF32-V', 37266 'UniJIS2004-UTF8-H', 37267 'UniJIS2004-UTF8-V', 37268 'UniJISPro-UCS2-HW-V', 37269 'UniJISPro-UCS2-V', 37270 'UniJISPro-UTF8-V', 37271 'UniJISX0213-UTF32-H', 37272 'UniJISX0213-UTF32-V', 37273 'UniJISX02132004-UTF32-H', 37274 'UniJISX02132004-UTF32-V', 37275 'UniKS-UCS2-H', 37276 'UniKS-UCS2-V', 37277 'UniKS-UTF16-H', 37278 'UniKS-UTF16-V', 37279 'UniKS-UTF32-H', 37280 'UniKS-UTF32-V', 37281 'UniKS-UTF8-H', 37282 'UniKS-UTF8-V', 37283 'V', 37284 'WP-Symbol' 37285 ]; 37286 var CMap = function CMapClosure() { 37287 function CMap(builtInCMap) { 37288 this.codespaceRanges = [ 37289 [], 37290 [], 37291 [], 37292 [] 37293 ]; 37294 this.numCodespaceRanges = 0; 37295 this._map = []; 37296 this.name = ''; 37297 this.vertical = false;
37298 this.useCMap = null; 37299 this.builtInCMap = builtInCMap; 37300 } 37301 CMap.prototype = { 37302 addCodespaceRange: function (n, low, high) { 37303 this.codespaceRanges[n - 1].push(low, high); 37304 this.numCodespaceRanges++; 37305 }, 37306 mapCidRange: function (low, high, dstLow) { 37307 while (low <= high) { 37308 this._map[low++] = dstLow++; 37309 } 37310 }, 37311 mapBfRange: function (low, high, dstLow) { 37312 var lastByte = dstLow.length - 1; 37313 while (low <= high) { 37314 this._map[low++] = dstLow; 37315 dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1); 37316 } 37317 }, 37318 mapBfRangeToArray: function (low, high, array) { 37319 var i = 0, ii = array.length; 37320 while (low <= high && i < ii) { 37321 this._map[low] = array[i++]; 37322 ++low; 37323 } 37324 }, 37325 mapOne: function (src, dst) { 37326 this._map[src] = dst; 37327 }, 37328 lookup: function (code) { 37329 return this._map[code]; 37330 }, 37331 contains: function (code) { 37332 return this._map[code] !== undefined; 37333 }, 37334 forEach: function (callback) { 37335 var map = this._map; 37336 var length = map.length; 37337 var i; 37338 if (length <= 0x10000) { 37339 for (i = 0; i < length; i++) { 37340 if (map[i] !== undefined) { 37341 callback(i, map[i]); 37342 } 37343 } 37344 } else { 37345 for (i in this._map) { 37346 callback(i, map[i]); 37347 } 37348 } 37349 },
37350 charCodeOf: function (value) { 37351 return this._map.indexOf(value); 37352 }, 37353 getMap: function () { 37354 return this._map; 37355 }, 37356 readCharCode: function (str, offset, out) { 37357 var c = 0; 37358 var codespaceRanges = this.codespaceRanges; 37359 var codespaceRangesLen = this.codespaceRanges.length; 37360 for (var n = 0; n < codespaceRangesLen; n++) { 37361 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 37362 var codespaceRange = codespaceRanges[n]; 37363 for (var k = 0, kk = codespaceRange.length; k < kk;) { 37364 var low = codespaceRange[k++]; 37365 var high = codespaceRange[k++]; 37366 if (c >= low && c <= high) { 37367 out.charcode = c; 37368 out.length = n + 1; 37369 return; 37370 } 37371 } 37372 } 37373 out.charcode = 0; 37374 out.length = 1; 37375 }, 37376 get length() { 37377 return this._map.length; 37378 }, 37379 get isIdentityCMap() { 37380 if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) { 37381 return false; 37382 } 37383 if (this._map.length !== 0x10000) { 37384 return false; 37385 } 37386 for (var i = 0; i < 0x10000; i++) { 37387 if (this._map[i] !== i) { 37388 return false; 37389 } 37390 } 37391 return true; 37392 } 37393 }; 37394 return CMap; 37395 }(); 37396 var IdentityCMap = function IdentityCMapClosure() { 37397 function IdentityCMap(vertical, n) { 37398 CMap.call(this); 37399 this.vertical = vertical; 37400 this.addCodespaceRange(n, 0, 0xffff); 37401 } 37402 Util.inherit(IdentityCMap, CMap, {}); 37403 IdentityCMap.prototype = { 37404 addCodespaceRange: CMap.prototype.addCodespaceRange, 37405 mapCidRange: function (low, high, dstLow) { 37406 error('should not call mapCidRange'); 37407 }, 37408 mapBfRange: function (low, high, dstLow) { 37409 error('should not call mapBfRange'); 37410 }, 37411 mapBfRangeToArray: function (low, high, array) { 37412 error('should not call mapBfRangeToArray'); 37413 }, 37414 mapOne: function (src, dst) { 37415 error('should not call mapCidOne'); 37416 }, 37417 lookup: function (code) { 37418 return isInt(code) && code <= 0xffff ? code : undefined; 37419 }, 37420 contains: function (code) { 37421 return isInt(code) && code <= 0xffff; 37422 }, 37423 forEach: function (callback) { 37424 for (var i = 0; i <= 0xffff; i++) { 37425 callback(i, i); 37426 } 37427 },
37428 charCodeOf: function (value) { 37429 return isInt(value) && value <= 0xffff ? value : -1; 37430 }, 37431 getMap: function () { 37432 var map = new Array(0x10000); 37433 for (var i = 0; i <= 0xffff; i++) { 37434 map[i] = i; 37435 } 37436 return map; 37437 }, 37438 readCharCode: CMap.prototype.readCharCode, 37439 get length() { 37440 return 0x10000; 37441 }, 37442 get isIdentityCMap() { 37443 error('should not access .isIdentityCMap'); 37444 } 37445 }; 37446 return IdentityCMap; 37447 }(); 37448 var BinaryCMapReader = function BinaryCMapReaderClosure() { 37449 function fetchBinaryData(url) { 37450 return new Promise(function (resolve, reject) { 37451 var request = new XMLHttpRequest(); 37452 request.open('GET', url, true); 37453 request.responseType = 'arraybuffer'; 37454 request.onreadystatechange = function () { 37455 if (request.readyState === XMLHttpRequest.DONE) { 37456 if (!request.response || request.status !== 200 && request.status !== 0) { 37457 reject(new Error('Unable to get binary cMap at: ' + url)); 37458 } else { 37459 resolve(new Uint8Array(request.response)); 37460 } 37461 } 37462 }; 37463 request.send(null); 37464 }); 37465 } 37466 function hexToInt(a, size) { 37467 var n = 0; 37468 for (var i = 0; i <= size; i++) { 37469 n = n << 8 | a[i]; 37470 } 37471 return n >>> 0; 37472 } 37473 function hexToStr(a, size) { 37474 if (size === 1) { 37475 return String.fromCharCode(a[0], a[1]); 37476 } 37477 if (size === 3) { 37478 return String.fromCharCode(a[0], a[1], a[2], a[3]); 37479 } 37480 return String.fromCharCode.apply(null, a.subarray(0, size + 1)); 37481 } 37482 function addHex(a, b, size) { 37483 var c = 0; 37484 for (var i = size; i >= 0; i--) { 37485 c += a[i] + b[i]; 37486 a[i] = c & 255; 37487 c >>= 8; 37488 } 37489 } 37490 function incHex(a, size) { 37491 var c = 1; 37492 for (var i = size; i >= 0 && c > 0; i--) { 37493 c += a[i]; 37494 a[i] = c & 255; 37495 c >>= 8; 37496 } 37497 } 37498 var MAX_NUM_SIZE = 16; 37499 var MAX_ENCODED_NUM_SIZE = 19; 37500 function BinaryCMapStream(data) { 37501 this.buffer = data; 37502 this.pos = 0; 37503 this.end = data.length; 37504 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 37505 } 37506 BinaryCMapStream.prototype = { 37507 readByte: function () { 37508 if (this.pos >= this.end) { 37509 return -1; 37510 } 37511 return this.buffer[this.pos++]; 37512 }, 37513 readNumber: function () { 37514 var n = 0; 37515 var last; 37516 do { 37517 var b = this.readByte(); 37518 if (b < 0) { 37519 error('unexpected EOF in bcmap'); 37520 } 37521 last = !(b & 0x80); 37522 n = n << 7 | b & 0x7F; 37523 } while (!last); 37524 return n; 37525 }, 37526 readSigned: function () { 37527 var n = this.readNumber(); 37528 return n & 1 ? ~(n >>> 1) : n >>> 1; 37529 }, 37530 readHex: function (num, size) { 37531 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 37532 this.pos += size + 1; 37533 }, 37534 readHexNumber: function (num, size) { 37535 var last; 37536 var stack = this.tmpBuf, sp = 0; 37537 do { 37538 var b = this.readByte(); 37539 if (b < 0) { 37540 error('unexpected EOF in bcmap'); 37541 } 37542 last = !(b & 0x80); 37543 stack[sp++] = b & 0x7F; 37544 } while (!last); 37545 var i = size, buffer = 0, bufferSize = 0; 37546 while (i >= 0) { 37547 while (bufferSize < 8 && stack.length > 0) { 37548 buffer = stack[--sp] << bufferSize | buffer; 37549 bufferSize += 7; 37550 } 37551 num[i] = buffer & 255; 37552 i--; 37553 buffer >>= 8; 37554 bufferSize -= 8; 37555 } 37556 }, 37557 readHexSigned: function (num, size) { 37558 this.readHexNumber(num, size); 37559 var sign = num[size] & 1 ? 255 : 0; 37560 var c = 0; 37561 for (var i = 0; i <= size; i++) { 37562 c = (c & 1) << 8 | num[i]; 37563 num[i] = c >> 1 ^ sign; 37564 } 37565 }, 37566 readString: function () { 37567 var len = this.readNumber(); 37568 var s = ''; 37569 for (var i = 0; i < len; i++) { 37570 s += String.fromCharCode(this.readNumber()); 37571 } 37572 return s; 37573 } 37574 }; 37575 function processBinaryCMap(url, cMap, extend) { 37576 return fetchBinaryData(url).then(function (data) { 37577 var stream = new BinaryCMapStream(data); 37578 var header = stream.readByte(); 37579 cMap.vertical = !!(header & 1); 37580 var useCMap = null; 37581 var start = new Uint8Array(MAX_NUM_SIZE); 37582 var end = new Uint8Array(MAX_NUM_SIZE); 37583 var char = new Uint8Array(MAX_NUM_SIZE);
37584 var charCode = new Uint8Array(MAX_NUM_SIZE); 37585 var tmp = new Uint8Array(MAX_NUM_SIZE); 37586 var code; 37587 var b; 37588 while ((b = stream.readByte()) >= 0) { 37589 var type = b >> 5; 37590 if (type === 7) { 37591 switch (b & 0x1F) { 37592 case 0: 37593 stream.readString(); 37594 break; 37595 case 1: 37596 useCMap = stream.readString(); 37597 break; 37598 } 37599 continue; 37600 } 37601 var sequence = !!(b & 0x10); 37602 var dataSize = b & 15; 37603 assert(dataSize + 1 <= MAX_NUM_SIZE); 37604 var ucs2DataSize = 1; 37605 var subitemsCount = stream.readNumber(); 37606 var i; 37607 switch (type) { 37608 case 0: 37609 stream.readHex(start, dataSize); 37610 stream.readHexNumber(end, dataSize); 37611 addHex(end, start, dataSize); 37612 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 37613 for (i = 1; i < subitemsCount; i++) { 37614 incHex(end, dataSize); 37615 stream.readHexNumber(start, dataSize); 37616 addHex(start, end, dataSize); 37617 stream.readHexNumber(end, dataSize); 37618 addHex(end, start, dataSize); 37619 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 37620 } 37621 break; 37622 case 1: 37623 stream.readHex(start, dataSize); 37624 stream.readHexNumber(end, dataSize); 37625 addHex(end, start, dataSize); 37626 code = stream.readNumber(); 37627 for (i = 1; i < subitemsCount; i++) { 37628 incHex(end, dataSize); 37629 stream.readHexNumber(start, dataSize); 37630 addHex(start, end, dataSize); 37631 stream.readHexNumber(end, dataSize); 37632 addHex(end, start, dataSize); 37633 code = stream.readNumber(); 37634 } 37635 break; 37636 case 2: 37637 stream.readHex(char, dataSize); 37638 code = stream.readNumber(); 37639 cMap.mapOne(hexToInt(char, dataSize), code); 37640 for (i = 1; i < subitemsCount; i++) { 37641 incHex(char, dataSize); 37642 if (!sequence) { 37643 stream.readHexNumber(tmp, dataSize); 37644 addHex(char, tmp, dataSize); 37645 } 37646 code = stream.readSigned() + (code + 1); 37647 cMap.mapOne(hexToInt(char, dataSize), code); 37648 } 37649 break; 37650 case 3: 37651 stream.readHex(start, dataSize); 37652 stream.readHexNumber(end, dataSize); 37653 addHex(end, start, dataSize); 37654 code = stream.readNumber(); 37655 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 37656 for (i = 1; i < subitemsCount; i++) { 37657 incHex(end, dataSize); 37658 if (!sequence) { 37659 stream.readHexNumber(start, dataSize); 37660 addHex(start, end, dataSize); 37661 } else { 37662 start.set(end); 37663 } 37664 stream.readHexNumber(end, dataSize); 37665 addHex(end, start, dataSize); 37666 code = stream.readNumber(); 37667 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 37668 } 37669 break; 37670 case 4: 37671 stream.readHex(char, ucs2DataSize); 37672 stream.readHex(charCode, dataSize); 37673 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 37674 for (i = 1; i < subitemsCount; i++) { 37675 incHex(char, ucs2DataSize); 37676 if (!sequence) { 37677 stream.readHexNumber(tmp, ucs2DataSize); 37678 addHex(char, tmp, ucs2DataSize); 37679 } 37680 incHex(charCode, dataSize); 37681 stream.readHexSigned(tmp, dataSize); 37682 addHex(charCode, tmp, dataSize); 37683 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 37684 } 37685 break; 37686 case 5: 37687 stream.readHex(start, ucs2DataSize); 37688 stream.readHexNumber(end, ucs2DataSize); 37689 addHex(end, start, ucs2DataSize); 37690 stream.readHex(charCode, dataSize); 37691 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 37692 for (i = 1; i < subitemsCount; i++) { 37693 incHex(end, ucs2DataSize); 37694 if (!sequence) { 37695 stream.readHexNumber(start, ucs2DataSize); 37696 addHex(start, end, ucs2DataSize); 37697 } else { 37698 start.set(end); 37699 } 37700 stream.readHexNumber(end, ucs2DataSize); 37701 addHex(end, start, ucs2DataSize); 37702 stream.readHex(charCode, dataSize); 37703 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 37704 } 37705 break; 37706 default: 37707 error('Unknown type: ' + type); 37708 break; 37709 } 37710 } 37711 if (useCMap) { 37712 return extend(useCMap); 37713 } 37714 return cMap; 37715 }); 37716 } 37717 function BinaryCMapReader() { 37718 } 37719 BinaryCMapReader.prototype = { read: processBinaryCMap }; 37720 return BinaryCMapReader; 37721 }(); 37722 var CMapFactory = function CMapFactoryClosure() { 37723 function strToInt(str) { 37724 var a = 0; 37725 for (var i = 0; i < str.length; i++) { 37726 a = a << 8 | str.charCodeAt(i); 37727 } 37728 return a >>> 0; 37729 } 37730 function expectString(obj) { 37731 if (!isString(obj)) { 37732 error('Malformed CMap: expected string.'); 37733 } 37734 } 37735 function expectInt(obj) { 37736 if (!isInt(obj)) { 37737 error('Malformed CMap: expected int.'); 37738 } 37739 } 37740 function parseBfChar(cMap, lexer) { 37741 while (true) { 37742 var obj = lexer.getObj(); 37743 if (isEOF(obj)) { 37744 break; 37745 } 37746 if (isCmd(obj, 'endbfchar')) { 37747 return; 37748 } 37749 expectString(obj); 37750 var src = strToInt(obj); 37751 obj = lexer.getObj(); 37752 expectString(obj); 37753 var dst = obj; 37754 cMap.mapOne(src, dst); 37755 } 37756 } 37757 function parseBfRange(cMap, lexer) { 37758 while (true) { 37759 var obj = lexer.getObj(); 37760 if (isEOF(obj)) { 37761 break; 37762 } 37763 if (isCmd(obj, 'endbfrange')) { 37764 return; 37765 } 37766 expectString(obj); 37767 var low = strToInt(obj); 37768 obj = lexer.getObj(); 37769 expectString(obj); 37770 var high = strToInt(obj); 37771 obj = lexer.getObj(); 37772 if (isInt(obj) || isString(obj)) { 37773 var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj; 37774 cMap.mapBfRange(low, high, dstLow); 37775 } else if (isCmd(obj, '[')) { 37776 obj = lexer.getObj(); 37777 var array = []; 37778 while (!isCmd(obj, ']') && !isEOF(obj)) { 37779 array.push(obj); 37780 obj = lexer.getObj(); 37781 } 37782 cMap.mapBfRangeToArray(low, high, array); 37783 } else { 37784 break; 37785 } 37786 } 37787 error('Invalid bf range.'); 37788 } 37789 function parseCidChar(cMap, lexer) { 37790 while (true) { 37791 var obj = lexer.getObj(); 37792 if (isEOF(obj)) { 37793 break; 37794 } 37795 if (isCmd(obj, 'endcidchar')) { 37796 return; 37797 } 37798 expectString(obj); 37799 var src = strToInt(obj); 37800 obj = lexer.getObj(); 37801 expectInt(obj); 37802 var dst = obj; 37803 cMap.mapOne(src, dst); 37804 } 37805 } 37806 function parseCidRange(cMap, lexer) { 37807 while (true) { 37808 var obj = lexer.getObj(); 37809 if (isEOF(obj)) { 37810 break; 37811 } 37812 if (isCmd(obj, 'endcidrange')) { 37813 return; 37814 } 37815 expectString(obj); 37816 var low = strToInt(obj); 37817 obj = lexer.getObj(); 37818 expectString(obj); 37819 var high = strToInt(obj); 37820 obj = lexer.getObj(); 37821 expectInt(obj); 37822 var dstLow = obj; 37823 cMap.mapCidRange(low, high, dstLow); 37824 } 37825 } 37826 function parseCodespaceRange(cMap, lexer) { 37827 while (true) { 37828 var obj = lexer.getObj(); 37829 if (isEOF(obj)) { 37830 break; 37831 } 37832 if (isCmd(obj, 'endcodespacerange')) { 37833 return; 37834 } 37835 if (!isString(obj)) { 37836 break; 37837 } 37838 var low = strToInt(obj); 37839 obj = lexer.getObj(); 37840 if (!isString(obj)) { 37841 break; 37842 } 37843 var high = strToInt(obj); 37844 cMap.addCodespaceRange(obj.length, low, high); 37845 } 37846 error('Invalid codespace range.'); 37847 } 37848 function parseWMode(cMap, lexer) { 37849 var obj = lexer.getObj(); 37850 if (isInt(obj)) { 37851 cMap.vertical = !!obj; 37852 } 37853 } 37854 function parseCMapName(cMap, lexer) { 37855 var obj = lexer.getObj(); 37856 if (isName(obj) && isString(obj.name)) { 37857 cMap.name = obj.name; 37858 } 37859 } 37860 function parseCMap(cMap, lexer, builtInCMapParams, useCMap) { 37861 var previous; 37862 var embededUseCMap; 37863 objLoop: 37864 while (true) { 37865 try { 37866 var obj = lexer.getObj(); 37867 if (isEOF(obj)) { 37868 break; 37869 } else if (isName(obj)) { 37870 if (obj.name === 'WMode') { 37871 parseWMode(cMap, lexer); 37872 } else if (obj.name === 'CMapName') {
37873 parseCMapName(cMap, lexer); 37874 } 37875 previous = obj; 37876 } else if (isCmd(obj)) { 37877 switch (obj.cmd) { 37878 case 'endcmap': 37879 break objLoop; 37880 case 'usecmap': 37881 if (isName(previous)) { 37882 embededUseCMap = previous.name; 37883 } 37884 break; 37885 case 'begincodespacerange': 37886 parseCodespaceRange(cMap, lexer); 37887 break; 37888 case 'beginbfchar': 37889 parseBfChar(cMap, lexer); 37890 break; 37891 case 'begincidchar': 37892 parseCidChar(cMap, lexer); 37893 break; 37894 case 'beginbfrange': 37895 parseBfRange(cMap, lexer); 37896 break; 37897 case 'begincidrange': 37898 parseCidRange(cMap, lexer); 37899 break; 37900 } 37901 } 37902 } catch (ex) { 37903 if (ex instanceof MissingDataException) { 37904 throw ex; 37905 } 37906 warn('Invalid cMap data: ' + ex); 37907 continue; 37908 } 37909 } 37910 if (!useCMap && embededUseCMap) { 37911 useCMap = embededUseCMap; 37912 } 37913 if (useCMap) { 37914 return extendCMap(cMap, builtInCMapParams, useCMap); 37915 } 37916 return Promise.resolve(cMap); 37917 } 37918 function extendCMap(cMap, builtInCMapParams, useCMap) { 37919 return createBuiltInCMap(useCMap, builtInCMapParams).then(function (newCMap) { 37920 cMap.useCMap = newCMap; 37921 if (cMap.numCodespaceRanges === 0) { 37922 var useCodespaceRanges = cMap.useCMap.codespaceRanges; 37923 for (var i = 0; i < useCodespaceRanges.length; i++) { 37924 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 37925 } 37926 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 37927 } 37928 cMap.useCMap.forEach(function (key, value) { 37929 if (!cMap.contains(key)) { 37930 cMap.mapOne(key, cMap.useCMap.lookup(key)); 37931 } 37932 }); 37933 return cMap; 37934 }); 37935 } 37936 function parseBinaryCMap(name, builtInCMapParams) { 37937 var url = builtInCMapParams.url + name + '.bcmap'; 37938 var cMap = new CMap(true); 37939 return new BinaryCMapReader().read(url, cMap, function (useCMap) { 37940 return extendCMap(cMap, builtInCMapParams, useCMap); 37941 }); 37942 } 37943 function createBuiltInCMap(name, builtInCMapParams) { 37944 if (name === 'Identity-H') { 37945 return Promise.resolve(new IdentityCMap(false, 2)); 37946 } else if (name === 'Identity-V') { 37947 return Promise.resolve(new IdentityCMap(true, 2)); 37948 } 37949 if (BUILT_IN_CMAPS.indexOf(name) === -1) { 37950 return Promise.reject(new Error('Unknown cMap name: ' + name)); 37951 } 37952 assert(builtInCMapParams, 'built-in cMap parameters are not provided'); 37953 if (builtInCMapParams.packed) { 37954 return parseBinaryCMap(name, builtInCMapParams); 37955 } 37956 return new Promise(function (resolve, reject) { 37957 var url = builtInCMapParams.url + name; 37958 var request = new XMLHttpRequest(); 37959 request.onreadystatechange = function () { 37960 if (request.readyState === XMLHttpRequest.DONE) { 37961 if (request.status === 200 || request.status === 0) { 37962 var cMap = new CMap(true); 37963 var lexer = new Lexer(new StringStream(request.responseText)); 37964 parseCMap(cMap, lexer, builtInCMapParams, null).then(function (parsedCMap) { 37965 resolve(parsedCMap); 37966 }); 37967 } else { 37968 reject(new Error('Unable to get cMap at: ' + url)); 37969 } 37970 } 37971 }; 37972 request.open('GET', url, true); 37973 request.send(null); 37974 }); 37975 } 37976 return { 37977 create: function (encoding, builtInCMapParams, useCMap) { 37978 if (isName(encoding)) { 37979 return createBuiltInCMap(encoding.name, builtInCMapParams); 37980 } else if (isStream(encoding)) { 37981 var cMap = new CMap(); 37982 var lexer = new Lexer(encoding); 37983 return parseCMap(cMap, lexer, builtInCMapParams, useCMap).then(function (parsedCMap) { 37984 if (parsedCMap.isIdentityCMap) { 37985 return createBuiltInCMap(parsedCMap.name, builtInCMapParams); 37986 } 37987 return parsedCMap; 37988 }); 37989 } 37990 return Promise.reject(new Error('Encoding required.')); 37991 } 37992 }; 37993 }(); 37994 exports.CMap = CMap; 37995 exports.CMapFactory = CMapFactory; 37996 exports.IdentityCMap = IdentityCMap; 37997 })); 37998 (function (root, factory) { 37999 factory(root.pdfjsCoreColorSpace = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreFunction); 38000 }(this, function (exports, sharedUtil, corePrimitives, coreFunction) { 38001 var error = sharedUtil.error; 38002 var info = sharedUtil.info; 38003 var isArray = sharedUtil.isArray; 38004 var isString = sharedUtil.isString; 38005 var shadow = sharedUtil.shadow; 38006 var warn = sharedUtil.warn; 38007 var isDict = corePrimitives.isDict; 38008 var isName = corePrimitives.isName; 38009 var isStream = corePrimitives.isStream; 38010 var PDFFunction = coreFunction.PDFFunction; 38011 var ColorSpace = function ColorSpaceClosure() { 38012 function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) { 38013 var COMPONENTS = 3; 38014 alpha01 = alpha01 !== 1 ? 0 : alpha01; 38015 var xRatio = w1 / w2; 38016 var yRatio = h1 / h2; 38017 var i, j, py, newIndex = 0, oldIndex; 38018 var xScaled = new Uint16Array(w2); 38019 var w1Scanline = w1 * COMPONENTS; 38020 for (i = 0; i < w2; i++) { 38021 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 38022 } 38023 for (i = 0; i < h2; i++) { 38024 py = Math.floor(i * yRatio) * w1Scanline; 38025 for (j = 0; j < w2; j++) { 38026 oldIndex = py + xScaled[j]; 38027 dest[newIndex++] = src[oldIndex++]; 38028 dest[newIndex++] = src[oldIndex++]; 38029 dest[newIndex++] = src[oldIndex++]; 38030 newIndex += alpha01; 38031 } 38032 } 38033 } 38034 function ColorSpace() { 38035 error('should not call ColorSpace constructor'); 38036 } 38037 ColorSpace.prototype = { 38038 getRgb: function ColorSpace_getRgb(src, srcOffset) { 38039 var rgb = new Uint8Array(3); 38040 this.getRgbItem(src, srcOffset, rgb, 0); 38041 return rgb; 38042 }, 38043 getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOff
38043set) { 38044 error('Should not call ColorSpace.getRgbItem'); 38045 }, 38046 getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38047 error('Should not call ColorSpace.getRgbBuffer'); 38048 }, 38049 getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) { 38050 error('Should not call ColorSpace.getOutputLength'); 38051 }, 38052 isPassthrough: function ColorSpace_isPassthrough(bits) { 38053 return false; 38054 }, 38055 fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 38056 var count = originalWidth * originalHeight; 38057 var rgbBuf = null; 38058 var numComponentColors = 1 << bpc; 38059 var needsResizing = originalHeight !== height || originalWidth !== width; 38060 var i, ii; 38061 if (this.isPassthrough(bpc)) { 38062 rgbBuf = comps; 38063 } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') { 38064 var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 38065 var key; 38066 for (i = 0; i < numComponentColors; i++) { 38067 allColors[i] = i; 38068 } 38069 var colorMap = new Uint8Array(numComponentColors * 3); 38070 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 38071 var destPos, rgbPos; 38072 if (!needsResizing) { 38073 destPos = 0; 38074 for (i = 0; i < count; ++i) { 38075 key = comps[i] * 3; 38076 dest[destPos++] = colorMap[key]; 38077 dest[destPos++] = colorMap[key + 1]; 38078 dest[destPos++] = colorMap[key + 2]; 38079 destPos += alpha01; 38080 } 38081 } else { 38082 rgbBuf = new Uint8Array(count * 3); 38083 rgbPos = 0; 38084 for (i = 0; i < count; ++i) { 38085 key = comps[i] * 3; 38086 rgbBuf[rgbPos++] = colorMap[key]; 38087 rgbBuf[rgbPos++] = colorMap[key + 1]; 38088 rgbBuf[rgbPos++] = colorMap[key + 2]; 38089 } 38090 } 38091 } else { 38092 if (!needsResizing) { 38093 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 38094 } else { 38095 rgbBuf = new Uint8Array(count * 3); 38096 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 38097 } 38098 } 38099 if (rgbBuf) { 38100 if (needsResizing) { 38101 resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest); 38102 } else { 38103 rgbPos = 0; 38104 destPos = 0; 38105 for (i = 0, ii = width * actualHeight; i < ii; i++) { 38106 dest[destPos++] = rgbBuf[rgbPos++]; 38107 dest[destPos++] = rgbBuf[rgbPos++]; 38108 dest[destPos++] = rgbBuf[rgbPos++]; 38109 destPos += alpha01; 38110 } 38111 } 38112 } 38113 }, 38114 usesZeroToOneRange: true 38115 }; 38116 ColorSpace.parse = function ColorSpace_parse(cs, xref, res) { 38117 var IR = ColorSpace.parseToIR(cs, xref, res); 38118 if (IR instanceof AlternateCS) { 38119 return IR; 38120 } 38121 return ColorSpace.fromIR(IR); 38122 }; 38123 ColorSpace.fromIR = function ColorSpace_fromIR(IR) { 38124 var name = isArray(IR) ? IR[0] : IR; 38125 var whitePoint, blackPoint, gamma; 38126 switch (name) { 38127 case 'DeviceGrayCS': 38128 return this.singletons.gray; 38129 case 'DeviceRgbCS': 38130 return this.singletons.rgb; 38131 case 'DeviceCmykCS': 38132 return this.singletons.cmyk; 38133 case 'CalGrayCS': 38134 whitePoint = IR[1]; 38135 blackPoint = IR[2]; 38136 gamma = IR[3]; 38137 return new CalGrayCS(whitePoint, blackPoint, gamma); 38138 case 'CalRGBCS': 38139 whitePoint = IR[1]; 38140 blackPoint = IR[2]; 38141 gamma = IR[3]; 38142 var matrix = IR[4]; 38143 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 38144 case 'PatternCS': 38145 var basePatternCS = IR[1]; 38146 if (basePatternCS) { 38147 basePatternCS = ColorSpace.fromIR(basePatternCS); 38148 } 38149 return new PatternCS(basePatternCS); 38150 case 'IndexedCS': 38151 var baseIndexedCS = IR[1]; 38152 var hiVal = IR[2]; 38153 var lookup = IR[3]; 38154 return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup); 38155 case 'AlternateCS': 38156 var numComps = IR[1]; 38157 var alt = IR[2]; 38158 var tintFnIR = IR[3]; 38159 return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR)); 38160 case 'LabCS': 38161 whitePoint = IR[1]; 38162 blackPoint = IR[2]; 38163 var range = IR[3];
38164 return new LabCS(whitePoint, blackPoint, range); 38165 default: 38166 error('Unknown name ' + name); 38167 } 38168 return null; 38169 }; 38170 ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) { 38171 if (isName(cs)) { 38172 var colorSpaces = res.get('ColorSpace'); 38173 if (isDict(colorSpaces)) { 38174 var refcs = colorSpaces.get(cs.name); 38175 if (refcs) { 38176 cs = refcs; 38177 } 38178 } 38179 } 38180 cs = xref.fetchIfRef(cs); 38181 if (isName(cs)) { 38182 switch (cs.name) { 38183 case 'DeviceGray': 38184 case 'G': 38185 return 'DeviceGrayCS'; 38186 case 'DeviceRGB': 38187 case 'RGB': 38188 return 'DeviceRgbCS'; 38189 case 'DeviceCMYK': 38190 case 'CMYK': 38191 return 'DeviceCmykCS'; 38192 case 'Pattern': 38193 return [ 38194 'PatternCS', 38195 null 38196 ]; 38197 default: 38198 error('unrecognized colorspace ' + cs.name); 38199 } 38200 } else if (isArray(cs)) { 38201 var mode = xref.fetchIfRef(cs[0]).name; 38202 var numComps, params, alt, whitePoint, blackPoint, gamma; 38203 switch (mode) { 38204 case 'DeviceGray': 38205 case 'G': 38206 return 'DeviceGrayCS'; 38207 case 'DeviceRGB': 38208 case 'RGB': 38209 return 'DeviceRgbCS'; 38210 case 'DeviceCMYK': 38211 case 'CMYK': 38212 return 'DeviceCmykCS'; 38213 case 'CalGray': 38214 params = xref.fetchIfRef(cs[1]); 38215 whitePoint = params.getArray('WhitePoint'); 38216 blackPoint = params.getArray('BlackPoint'); 38217 gamma = params.get('Gamma'); 38218 return [ 38219 'CalGrayCS', 38220 whitePoint, 38221 blackPoint, 38222 gamma 38223 ]; 38224 case 'CalRGB': 38225 params = xref.fetchIfRef(cs[1]); 38226 whitePoint = params.getArray('WhitePoint'); 38227 blackPoint = params.getArray('BlackPoint'); 38228 gamma = params.getArray('Gamma'); 38229 var matrix = params.getArray('Matrix'); 38230 return [ 38231 'CalRGBCS', 38232 whitePoint, 38233 blackPoint, 38234 gamma, 38235 matrix 38236 ]; 38237 case 'ICCBased': 38238 var stream = xref.fetchIfRef(cs[1]); 38239 var dict = stream.dict; 38240 numComps = dict.get('N'); 38241 alt = dict.get('Alternate'); 38242 if (alt) { 38243 var altIR = ColorSpace.parseToIR(alt, xref, res); 38244 var altCS = ColorSpace.fromIR(altIR); 38245 if (altCS.numComps === numComps) { 38246 return altIR; 38247 } 38248 warn('ICCBased color space: Ignoring incorrect /Alternate entry.'); 38249 } 38250 if (numComps === 1) { 38251 return 'DeviceGrayCS'; 38252 } else if (numComps === 3) { 38253 return 'DeviceRgbCS'; 38254 } else if (numComps === 4) { 38255 return 'DeviceCmykCS'; 38256 } 38257 break; 38258 case 'Pattern': 38259 var basePatternCS = cs[1] || null; 38260 if (basePatternCS) { 38261 basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res); 38262 } 38263 return [ 38264 'PatternCS', 38265 basePatternCS 38266 ]; 38267 case 'Indexed': 38268 case 'I': 38269 var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res); 38270 var hiVal = xref.fetchIfRef(cs[2]) + 1; 38271 var lookup = xref.fetchIfRef(cs[3]); 38272 if (isStream(lookup)) { 38273 lookup = lookup.getBytes(); 38274 } 38275 return [ 38276 'IndexedCS', 38277 baseIndexedCS, 38278 hiVal, 38279 lookup 38280 ]; 38281 case 'Separation': 38282 case 'DeviceN': 38283 var name = xref.fetchIfRef(cs[1]); 38284 numComps = isArray(name) ? name.length : 1; 38285 alt = ColorSpace.parseToIR(cs[2], xref, res); 38286 var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); 38287 return [ 38288 'AlternateCS', 38289 numComps, 38290 alt, 38291 tintFnIR 38292 ]; 38293 case 'Lab': 38294 params = xref.fetchIfRef(cs[1]); 38295 whitePoint = params.getArray('WhitePoint'); 38296 blackPoint = params.getArray('BlackPoint'); 38297 var range = params.getArray('Range'); 38298 return [ 38299 'LabCS', 38300 whitePoint, 38301 blackPoint, 38302 range 38303 ]; 38304 default: 38305 error('unimplemented color space object "' + mode + '"'); 38306 } 38307 } else { 38308 error('unrecognized color space object: "' + cs + '"'); 38309 } 38310 return null; 38311 }; 38312 ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) { 38313 if (!isArray(decode)) { 38314 return true; 38315 } 38316 if (n * 2 !== decode.length) { 38317 warn('The decode map is not the correct length'); 38318 return true; 38319 } 38320 for (var i = 0, ii = decode.length; i < ii; i += 2) { 38321 if (decode[i] !== 0 || decode[i + 1] !== 1) { 38322 return false;
38323 } 38324 } 38325 return true; 38326 }; 38327 ColorSpace.singletons = { 38328 get gray() { 38329 return shadow(this, 'gray', new DeviceGrayCS()); 38330 }, 38331 get rgb() { 38332 return shadow(this, 'rgb', new DeviceRgbCS()); 38333 }, 38334 get cmyk() { 38335 return shadow(this, 'cmyk', new DeviceCmykCS()); 38336 } 38337 }; 38338 return ColorSpace; 38339 }(); 38340 var AlternateCS = function AlternateCSClosure() { 38341 function AlternateCS(numComps, base, tintFn) { 38342 this.name = 'Alternate'; 38343 this.numComps = numComps; 38344 this.defaultColor = new Float32Array(numComps); 38345 for (var i = 0; i < numComps; ++i) { 38346 this.defaultColor[i] = 1; 38347 } 38348 this.base = base; 38349 this.tintFn = tintFn; 38350 this.tmpBuf = new Float32Array(base.numComps); 38351 } 38352 AlternateCS.prototype = { 38353 getRgb: ColorSpace.prototype.getRgb, 38354 getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) { 38355 var tmpBuf = this.tmpBuf; 38356 this.tintFn(src, srcOffset, tmpBuf, 0); 38357 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 38358 }, 38359 getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38360 var tintFn = this.tintFn; 38361 var base = this.base; 38362 var scale = 1 / ((1 << bits) - 1); 38363 var baseNumComps = base.numComps; 38364 var usesZeroToOneRange = base.usesZeroToOneRange; 38365 var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 38366 var pos = isPassthrough ? destOffset : 0; 38367 var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count); 38368 var numComps = this.numComps; 38369 var scaled = new Float32Array(numComps); 38370 var tinted = new Float32Array(baseNumComps); 38371 var i, j; 38372 for (i = 0; i < count; i++) { 38373 for (j = 0; j < numComps; j++) { 38374 scaled[j] = src[srcOffset++] * scale; 38375 } 38376 tintFn(scaled, 0, tinted, 0); 38377 if (usesZeroToOneRange) { 38378 for (j = 0; j < baseNumComps; j++) { 38379 baseBuf[pos++] = tinted[j] * 255; 38380 } 38381 } else { 38382 base.getRgbItem(tinted, 0, baseBuf, pos); 38383 pos += baseNumComps; 38384 } 38385 } 38386 if (!isPassthrough) { 38387 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 38388 } 38389 }, 38390 getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) { 38391 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 38392 }, 38393 isPassthrough: ColorSpace.prototype.isPassthrough, 38394 fillRgb: ColorSpace.prototype.fillRgb, 38395 isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) { 38396 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38397 }, 38398 usesZeroToOneRange: true 38399 }; 38400 return AlternateCS; 38401 }(); 38402 var PatternCS = function PatternCSClosure() { 38403 function PatternCS(baseCS) { 38404 this.name = 'Pattern'; 38405 this.base = baseCS; 38406 } 38407 PatternCS.prototype = {}; 38408 return PatternCS; 38409 }(); 38410 var IndexedCS = function IndexedCSClosure() { 38411 function IndexedCS(base, highVal, lookup) { 38412 this.name = 'Indexed'; 38413 this.numComps = 1; 38414 this.defaultColor = new Uint8Array(this.numComps); 38415 this.base = base; 38416 this.highVal = highVal; 38417 var baseNumComps = base.numComps; 38418 var length = baseNumComps * highVal; 38419 if (isStream(lookup)) { 38420 this.lookup = new Uint8Array(length); 38421 var bytes = lookup.getBytes(length); 38422 this.lookup.set(bytes); 38423 } else if (isString(lookup)) { 38424 this.lookup = new Uint8Array(length); 38425 for (var i = 0; i < length; ++i) { 38426 this.lookup[i] = lookup.charCodeAt(i); 38427 } 38428 } else if (lookup instanceof Uint8Array || lookup instanceof Array) { 38429 this.lookup = lookup; 38430 } else { 38431 error('Unrecognized lookup table: ' + lookup); 38432 } 38433 } 38434 IndexedCS.prototype = { 38435 getRgb: ColorSpace.prototype.getRgb, 38436 getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) { 38437 var numComps = this.base.numComps; 38438 var start = src[srcOffset] * numComps;
38439 this.base.getRgbItem(this.lookup, start, dest, destOffset); 38440 }, 38441 getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38442 var base = this.base; 38443 var numComps = base.numComps; 38444 var outputDelta = base.getOutputLength(numComps, alpha01); 38445 var lookup = this.lookup; 38446 for (var i = 0; i < count; ++i) { 38447 var lookupPos = src[srcOffset++] * numComps; 38448 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 38449 destOffset += outputDelta; 38450 } 38451 }, 38452 getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) { 38453 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 38454 }, 38455 isPassthrough: ColorSpace.prototype.isPassthrough, 38456 fillRgb: ColorSpace.prototype.fillRgb, 38457 isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) { 38458 return true; 38459 }, 38460 usesZeroToOneRange: true 38461 }; 38462 return IndexedCS; 38463 }(); 38464 var DeviceGrayCS = function DeviceGrayCSClosure() { 38465 function DeviceGrayCS() { 38466 this.name = 'DeviceGray'; 38467 this.numComps = 1; 38468 this.defaultColor = new Float32Array(this.numComps); 38469 } 38470 DeviceGrayCS.prototype = { 38471 getRgb: ColorSpace.prototype.getRgb, 38472 getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) { 38473 var c = src[srcOffset] * 255 | 0; 38474 c = c < 0 ? 0 : c > 255 ? 255 : c; 38475 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 38476 }, 38477 getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38478 var scale = 255 / ((1 << bits) - 1); 38479 var j = srcOffset, q = destOffset; 38480 for (var i = 0; i < count; ++i) { 38481 var c = scale * src[j++] | 0; 38482 dest[q++] = c; 38483 dest[q++] = c; 38484 dest[q++] = c; 38485 q += alpha01; 38486 } 38487 }, 38488 getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) { 38489 return inputLength * (3 + alpha01); 38490 }, 38491 isPassthrough: ColorSpace.prototype.isPassthrough, 38492 fillRgb: ColorSpace.prototype.fillRgb, 38493 isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) { 38494 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38495 }, 38496 usesZeroToOneRange: true 38497 }; 38498 return DeviceGrayCS; 38499 }(); 38500 var DeviceRgbCS = function DeviceRgbCSClosure() { 38501 function DeviceRgbCS() { 38502 this.name = 'DeviceRGB'; 38503 this.numComps = 3; 38504 this.defaultColor = new Float32Array(this.numComps); 38505 } 38506 DeviceRgbCS.prototype = { 38507 getRgb: ColorSpace.prototype.getRgb, 38508 getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) { 38509 var r = src[srcOffset] * 255 | 0; 38510 var g = src[srcOffset + 1] * 255 | 0; 38511 var b = src[srcOffset + 2] * 255 | 0; 38512 dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r; 38513 dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g; 38514 dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b; 38515 }, 38516 getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38517 if (bits === 8 && alpha01 === 0) { 38518 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 38519 return; 38520 } 38521 var scale = 255 / ((1 << bits) - 1); 38522 var j = srcOffset, q = destOffset; 38523 for (var i = 0; i < count; ++i) { 38524 dest[q++] = scale * src[j++] | 0; 38525 dest[q++] = scale * src[j++] | 0; 38526 dest[q++] = scale * src[j++] | 0; 38527 q += alpha01; 38528 } 38529 }, 38530 getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) { 38531 return inputLength * (3 + alpha01) / 3 | 0; 38532 }, 38533 isPassthrough: function DeviceRgbCS_isPassthrough(bits) { 38534 return bits === 8; 38535 }, 38536 fillRgb: ColorSpace.prototype.fillRgb, 38537 isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) { 38538 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38539 }, 38540 usesZeroToOneRange: true 38541 }; 38542 return DeviceRgbCS; 38543 }(); 38544 var DeviceCmykCS = function DeviceCmykCSClosure() { 38545 function convertToRgb(src, srcOffset, srcScale, dest, destOff
38545set) { 38546 var c = src[srcOffset + 0] * srcScale; 38547 var m = src[srcOffset + 1] * srcScale; 38548 var y = src[srcOffset + 2] * srcScale; 38549 var k = src[srcOffset + 3] * srcScale; 38550 var r = 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) + 255 | 0; 38551 var g = 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) + 255 | 0; 38552 var b = 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) + 255 | 0; 38553 dest[destOffset] = r >
38553 255 ? 255 : r < 0 ? 0 : r; 38554 dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g; 38555 dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b; 38556 } 38557 function DeviceCmykCS() { 38558 this.name = 'DeviceCMYK'; 38559 this.numComps = 4; 38560 this.defaultColor = new Float32Array(this.numComps); 38561 this.defaultColor[3] = 1; 38562 } 38563 DeviceCmykCS.prototype = { 38564 getRgb: ColorSpace.prototype.getRgb, 38565 getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) { 38566 convertToRgb(src, srcOffset, 1, dest, destOffset); 38567 }, 38568 getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38569 var scale = 1 / ((1 << bits) - 1); 38570 for (var i = 0; i < count; i++) { 38571 convertToRgb(src, srcOffset, scale, dest, destOffset); 38572 srcOffset += 4; 38573 destOffset += 3 + alpha01; 38574 } 38575 }, 38576 getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) { 38577 return inputLength / 4 * (3 + alpha01) | 0; 38578 }, 38579 isPassthrough: ColorSpace.prototype.isPassthrough, 38580 fillRgb: ColorSpace.prototype.fillRgb, 38581 isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) { 38582 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38583 }, 38584 usesZeroToOneRange: true 38585 }; 38586 return DeviceCmykCS; 38587 }(); 38588 var CalGrayCS = function CalGrayCSClosure() { 38589 function CalGrayCS(whitePoint, blackPoint, gamma) { 38590 this.name = 'CalGray'; 38591 this.numComps = 1; 38592 this.defaultColor = new Float32Array(this.numComps); 38593 if (!whitePoint) { 38594 error('WhitePoint missing - required for color space CalGray'); 38595 } 38596 blackPoint = blackPoint || [ 38597 0, 38598 0, 38599 0 38600 ]; 38601 gamma = gamma || 1; 38602 this.XW = whitePoint[0]; 38603 this.YW = whitePoint[1]; 38604 this.ZW = whitePoint[2]; 38605 this.XB = blackPoint[0]; 38606 this.YB = blackPoint[1]; 38607 this.ZB = blackPoint[2]; 38608 this.G = gamma; 38609 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 38610 error('Invalid WhitePoint components for ' + this.name + ', no fallback available'); 38611 } 38612 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 38613 info('Invalid BlackPoint for ' + this.name + ', falling back to default'); 38614 this.XB = this.YB = this.ZB = 0; 38615 } 38616 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 38617 warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.'); 38618 } 38619 if (this.G < 1) { 38620 info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default'); 38621 this.G = 1; 38622 } 38623 } 38624 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 38625 var A = src[srcOffset] * scale; 38626 var AG = Math.pow(A, cs.G); 38627 var L = cs.YW * AG; 38628 var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0; 38629 dest[destOffset] = val; 38630 dest[destOffset + 1] = val; 38631 dest[destOffset + 2] = val; 38632 } 38633 CalGrayCS.prototype = { 38634 getRgb: ColorSpace.prototype.getRgb, 38635 getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) { 38636 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 38637 }, 38638 getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38639 var scale = 1 / ((1 << bits) - 1); 38640 for (var i = 0; i < count; ++i) { 38641 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 38642 srcOffset += 1; 38643 destOffset += 3 + alpha01; 38644 } 38645 }, 38646 getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) { 38647 return inputLength * (3 + alpha01); 38648 }, 38649 isPassthrough: ColorSpace.prototype.isPassthrough, 38650 fillRgb: ColorSpace.prototype.fillRgb, 38651 isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) { 38652 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38653 }, 38654 usesZeroToOneRange: true 38655 }; 38656 return CalGrayCS; 38657 }(); 38658 var CalRGBCS = function CalRGBCSClosure() { 38659 var BRADFORD_SCALE_MATRIX = new Float32Array([ 38660 0.8951, 38661 0.2664, 38662 -0.1614, 38663 -0.7502, 38664 1.7135, 38665 0.0367, 38666 0.0389, 38667 -0.0685, 38668 1.0296 38669 ]); 38670 var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([ 38671 0.9869929, 38672 -0.1470543, 38673 0.1599627, 38674 0.4323053, 38675 0.5183603, 38676 0.0492912, 38677 -0.0085287, 38678 0.0400428, 38679 0.9684867 38680 ]); 38681 var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([ 38682 3.2404542, 38683 -1.5371385, 38684 -0.4985314, 38685 -0.9692660, 38686 1.8760108, 38687 0.0415560, 38688 0.0556434, 38689 -0.2040259, 38690 1.0572252 38691 ]); 38692 var FLAT_WHITEPOINT_MATRIX = new Float32Array([ 38693 1, 38694 1, 38695 1 38696 ]); 38697 var tempNormalizeMatrix = new Float32Array(3); 38698 var tempConvertMatrix1 = new Float32Array(3); 38699 var tempConvertMatrix2 = new Float32Array(3); 38700 var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0; 38701 function CalRGBCS(whitePoint, blackPoint, gamma, matrix) { 38702 this.name = 'CalRGB'; 38703 this.numComps = 3; 38704 this.defaultColor = new Float32Array(this.numComps); 38705 if (!whitePoint) { 38706 error('WhitePoint missing - required for color space CalRGB'); 38707 } 38708 blackPoint = blackPoint || new Float32Array(3); 38709 gamma = gamma || new Float32Array([ 38710 1, 38711 1, 38712 1 38713 ]); 38714 matrix = matrix || new Float32Array([ 38715 1, 38716 0, 38717 0, 38718 0, 38719 1, 38720 0, 38721 0, 38722 0, 38723 1 38724 ]); 38725 var XW = whitePoint[0]; 38726 var YW = whitePoint[1]; 38727 var ZW = whitePoint[2]; 38728 this.whitePoint = whitePoint; 38729 var XB = blackPoint[0]; 38730 var YB = blackPoint[1]; 38731 var ZB = blackPoint[2]; 38732 this.blackPoint = blackPoint; 38733 this.GR = gamma[0]; 38734 this.GG = gamma[1]; 38735 this.GB = gamma[2]; 38736 this.MXA = matrix[0]; 38737 this.MYA = matrix[1]; 38738 this.MZA = matrix[2]; 38739 this.MXB = matrix[3]; 38740 this.MYB = matrix[4]; 38741 this.MZB = matrix[5]; 38742 this.MXC = matrix[6]; 38743 this.MYC = matrix[7]; 38744 this.MZC = matrix[8]; 38745 if (XW < 0 || ZW < 0 || YW !== 1) { 38746 error('Invalid WhitePoint components for ' + this.name + ', no fallback available'); 38747 } 38748 if (XB < 0 || YB < 0 || ZB < 0) { 38749 info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default'); 38750 this.blackPoint = new Float32Array(3); 38751 } 38752 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 38753 info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default'); 38754 this.GR = this.GG = this.GB = 1; 38755 } 38756 if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) { 38757 info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default'); 38758 this.MXA = this.MYB = this.MZC = 1; 38759 this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0; 38760 } 38761 } 38762 function matrixProduct(a, b, result) { 38763 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 38764 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 38765 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 38766 } 38767 function convertToFlat(sourceWhitePoint, LMS, result) { 38768 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 38769 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 38770 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 38771 } 38772 function convertToD65(sourceWhitePoint, LMS, result) { 38773 var D65X = 0.95047; 38774 var D65Y = 1; 38775 var D65Z = 1.08883; 38776 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 38777 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 38778 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 38779 } 38780 function sRGBTransferFunction(color) { 38781 if (color <= 0.0031308) { 38782 return adjustToRange(0, 1, 12.92 * color); 38783 } 38784 return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055); 38785 } 38786 function adjustToRange(min, max, value) { 38787 return Math.max(min, Math.min(max, value)); 38788 } 38789 function decodeL(L) { 38790 if (L < 0) { 38791 return -decodeL(-L); 38792 } 38793 if (L > 8.0) { 38794 return Math.pow((L + 16) / 116, 3); 38795 } 38796 return L * DECODE_L_CONSTANT;
38797 } 38798 function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 38799 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 38800 result[0] = XYZ_Flat[0]; 38801 result[1] = XYZ_Flat[1]; 38802 result[2] = XYZ_Flat[2]; 38803 return; 38804 } 38805 var zeroDecodeL = decodeL(0); 38806 var X_DST = zeroDecodeL; 38807 var X_SRC = decodeL(sourceBlackPoint[0]); 38808 var Y_DST = zeroDecodeL; 38809 var Y_SRC = decodeL(sourceBlackPoint[1]); 38810 var Z_DST = zeroDecodeL; 38811 var Z_SRC = decodeL(sourceBlackPoint[2]); 38812 var X_Scale = (1 - X_DST) / (1 - X_SRC); 38813 var X_Offset = 1 - X_Scale; 38814 var Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 38815 var Y_Offset = 1 - Y_Scale; 38816 var Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 38817 var Z_Offset = 1 - Z_Scale; 38818 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 38819 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 38820 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 38821 } 38822 function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 38823 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 38824 result[0] = XYZ_In[0]; 38825 result[1] = XYZ_In[1]; 38826 result[2] = XYZ_In[2]; 38827 return; 38828 } 38829 var LMS = result; 38830 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 38831 var LMS_Flat = tempNormalizeMatrix; 38832 convertToFlat(sourceWhitePoint, LMS, LMS_Flat); 38833 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 38834 } 38835 function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 38836 var LMS = result; 38837 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 38838 var LMS_D65 = tempNormalizeMatrix; 38839 convertToD65(sourceWhitePoint, LMS, LMS_D65); 38840 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 38841 } 38842 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 38843 var A = adjustToRange(0, 1, src[srcOffset] * scale); 38844 var B = adjustToRange(0, 1, src[srcOffset + 1] * scale); 38845 var C = adjustToRange(0, 1, src[srcOffset + 2] * scale); 38846 var AGR = Math.pow(A, cs.GR); 38847 var BGG = Math.pow(B, cs.GG); 38848 var CGB = Math.pow(C, cs.GB); 38849 var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; 38850 var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; 38851 var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; 38852 var XYZ = tempConvertMatrix1; 38853 XYZ[0] = X; 38854 XYZ[1] = Y; 38855 XYZ[2] = Z; 38856 var XYZ_Flat = tempConvertMatrix2; 38857 normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); 38858 var XYZ_Black = tempConvertMatrix1; 38859 compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); 38860 var XYZ_D65 = tempConvertMatrix2; 38861 normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 38862 var SRGB = tempConvertMatrix1; 38863 matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 38864 var sR = sRGBTransferFunction(SRGB[0]); 38865 var sG = sRGBTransferFunction(SRGB[1]); 38866 var sB = sRGBTransferFunction(SRGB[2]); 38867 dest[destOffset] = Math.round(sR * 255); 38868 dest[destOffset + 1] = Math.round(sG * 255); 38869 dest[destOffset + 2] = Math.round(sB * 255); 38870 } 38871 CalRGBCS.prototype = { 38872 getRgb: function CalRGBCS_getRgb(src, srcOffset) { 38873 var rgb = new Uint8Array(3); 38874 this.getRgbItem(src, srcOffset, rgb, 0); 38875 return rgb; 38876 }, 38877 getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) { 38878 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 38879 }, 38880 getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38881 var scale = 1 / ((1 << bits) - 1); 38882 for (var i = 0; i < count; ++i) { 38883 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 38884 srcOffset += 3; 38885 destOffset += 3 + alpha01; 38886 } 38887 }, 38888 getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) { 38889 return inputLength * (3 + alpha01) / 3 | 0; 38890 }, 38891 isPassthrough: ColorSpace.prototype.isPassthrough, 38892 fillRgb: ColorSpace.prototype.fillRgb, 38893 isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) { 38894 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 38895 }, 38896 usesZeroToOneRange: true 38897 }; 38898 return CalRGBCS; 38899 }(); 38900 var LabCS = function LabCSClosure() { 38901 function LabCS(whitePoint, blackPoint, range) { 38902 this.name = 'Lab'; 38903 this.numComps = 3; 38904 this.defaultColor = new Float32Array(this.numComps); 38905 if (!whitePoint) { 38906 error('WhitePoint missing - required for color space Lab'); 38907 } 38908 blackPoint = blackPoint || [ 38909 0, 38910 0, 38911 0 38912 ]; 38913 range = range || [ 38914 -100, 38915 100, 38916 -100, 38917 100 38918 ]; 38919 this.XW = whitePoint[0]; 38920 this.YW = whitePoint[1]; 38921 this.ZW = whitePoint[2]; 38922 this.amin = range[0]; 38923 this.amax = range[1]; 38924 this.bmin = range[2]; 38925 this.bmax = range[3]; 38926 this.XB = blackPoint[0]; 38927 this.YB = blackPoint[1]; 38928 this.ZB = blackPoint[2]; 38929 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 38930 error('Invalid WhitePoint components, no fallback available'); 38931 } 38932 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 38933 info('Invalid BlackPoint, falling back to default'); 38934 this.XB = this.YB = this.ZB = 0; 38935 } 38936 if (this.amin > this.amax || this.bmin > this.bmax) { 38937 info('Invalid Range, falling back to defaults'); 38938 this.amin = -100; 38939 this.amax = 100; 38940 this.bmin = -100; 38941 this.bmax = 100; 38942 } 38943 } 38944 function fn_g(x) { 38945 var result; 38946 if (x >= 6 / 29) { 38947 result = x * x * x; 38948 } else { 38949 result = 108 / 841 * (x - 4 / 29); 38950 } 38951 return result; 38952 } 38953 function decode(value, high1, low2, high2) { 38954 return low2 + value * (high2 - low2) / high1; 38955 } 38956 function convertToRgb(cs, src, srcOffset, maxVal, dest, destOff
38956set) { 38957 var Ls = src[srcOffset]; 38958 var as = src[srcOffset + 1]; 38959 var bs = src[srcOffset + 2]; 38960 if (maxVal !== false) { 38961 Ls = decode(Ls, maxVal, 0, 100); 38962 as = decode(as, maxVal, cs.amin, cs.amax); 38963 bs = decode(bs, maxVal, cs.bmin, cs.bmax); 38964 } 38965 as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as; 38966 bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs; 38967 var M = (Ls + 16) / 116; 38968 var L = M + as / 500; 38969 var N = M - bs / 200; 38970 var X = cs.XW * fn_g(L); 38971 var Y = cs.YW * fn_g(M); 38972 var Z = cs.ZW * fn_g(N); 38973 var r, g, b; 38974 if (cs.ZW < 1) { 38975 r = X * 3.1339 + Y * -1.6170 + Z * -0.4906; 38976 g = X * -0.9785 + Y * 1.9160 + Z * 0.0333; 38977 b = X * 0.0720 + Y * -0.2290 + Z * 1.4057; 38978 } else { 38979 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 38980 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 38981 b = X * 0.0557 + Y * -0.2040 + Z * 1.0570; 38982 } 38983 dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0; 38984 dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0; 38985 dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0; 38986 } 38987 LabCS.prototype = { 38988 getRgb: ColorSpace.prototype.getRgb, 38989 getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) { 38990 convertToRgb(this, src, srcOffset, false, dest, destOffset); 38991 }, 38992 getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 38993 var maxVal = (1 << bits) - 1; 38994 for (var i = 0; i < count; i++) { 38995 convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); 38996 srcOffset += 3; 38997 destOffset += 3 + alpha01; 38998 } 38999 }, 39000 getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) { 39001 return inputLength * (3 + alpha01) / 3 | 0; 39002 }, 39003 isPassthrough: ColorSpace.prototype.isPassthrough, 39004 fillRgb: ColorSpace.prototype.fillRgb, 39005 isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) { 39006 return true; 39007 }, 39008 usesZeroToOneRange: false 39009 }; 39010 return LabCS; 39011 }(); 39012 exports.ColorSpace = ColorSpace; 39013 })); 39014 (function (root, factory) { 39015 factory(root.pdfjsCoreFonts = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreGlyphList, root.pdfjsCoreFontRenderer, root.pdfjsCoreEncodings, root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode, root.pdfjsCoreType1Parser, root.pdfjsCoreCFFParser); 39016 }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreGlyphList, coreFontRenderer, coreEncodings, coreStandardFonts, coreUnicode, coreType1Parser, coreCFFParser) { 39017 var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX; 39018 var FontType = sharedUtil.FontType; 39019 var assert = sharedUtil.assert; 39020 var bytesToString = sharedUtil.bytesToString; 39021 var error = sharedUtil.error; 39022 var info = sharedUtil.info; 39023 var isArray = sharedUtil.isArray; 39024 var isInt = sharedUtil.isInt; 39025 var isNum = sharedUtil.isNum; 39026 var readUint32 = sharedUtil.readUint32; 39027 var shadow = sharedUtil.shadow; 39028 var string32 = sharedUtil.string32; 39029 var warn = sharedUtil.warn; 39030 var MissingDataException = sharedUtil.MissingDataException; 39031 var isSpace = sharedUtil.isSpace; 39032 var Stream = coreStream.Stream; 39033 var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode; 39034 var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode; 39035 var FontRendererFactory = coreFontRenderer.FontRendererFactory; 39036 var StandardEncoding = coreEncodings.StandardEncoding; 39037 var MacRomanEncoding = coreEncodings.MacRomanEncoding; 39038 var SymbolSetEncoding = coreEncodings.SymbolSetEncoding; 39039 var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding; 39040 var getEncoding = coreEncodings.getEncoding; 39041 var getStdFontMap = coreStandardFonts.getStdFontMap; 39042 var getNonStdFontMap = coreStandardFonts.getNonStdFontMap; 39043 var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts; 39044 var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack; 39045 var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor; 39046 var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues; 39047 var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph; 39048 var Type1Parser = coreType1Parser.Type1Parser; 39049 var CFFStandardStrings = coreCFFParser.CFFStandardStrings; 39050 var CFFParser = coreCFFParser.CFFParser; 39051 var CFFCompiler = coreCFFParser.CFFCompiler; 39052 var CFF = coreCFFParser.CFF; 39053 var CFFHeader = coreCFFParser.CFFHeader; 39054 var CFFTopDict = coreCFFParser.CFFTopDict;
39055 var CFFPrivateDict = coreCFFParser.CFFPrivateDict; 39056 var CFFStrings = coreCFFParser.CFFStrings; 39057 var CFFIndex = coreCFFParser.CFFIndex; 39058 var CFFCharset = coreCFFParser.CFFCharset; 39059 var PRIVATE_USE_OFFSET_START = 0xE000; 39060 var PRIVATE_USE_OFFSET_END = 0xF8FF; 39061 var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false; 39062 var PDF_GLYPH_SPACE_UNITS = 1000; 39063 var SEAC_ANALYSIS_ENABLED = false; 39064 var FontFlags = { 39065 FixedPitch: 1, 39066 Serif: 2, 39067 Symbolic: 4, 39068 Script: 8, 39069 Nonsymbolic: 32, 39070 Italic: 64, 39071 AllCap: 65536, 39072 SmallCap: 131072, 39073 ForceBold: 262144 39074 }; 39075 var MacStandardGlyphOrdering = [ 39076 '.notdef', 39077 '.null', 39078 'nonmarkingreturn', 39079 'space', 39080 'exclam', 39081 'quotedbl', 39082 'numbersign', 39083 'dollar', 39084 'percent', 39085 'ampersand', 39086 'quotesingle', 39087 'parenleft', 39088 'parenright', 39089 'asterisk', 39090 'plus', 39091 'comma', 39092 'hyphen', 39093 'period', 39094 'slash', 39095 'zero', 39096 'one', 39097 'two', 39098 'three', 39099 'four', 39100 'five', 39101 'six', 39102 'seven', 39103 'eight', 39104 'nine', 39105 'colon', 39106 'semicolon', 39107 'less', 39108 'equal', 39109 'greater', 39110 'question', 39111 'at', 39112 'A', 39113 'B', 39114 'C', 39115 'D', 39116 'E', 39117 'F', 39118 'G', 39119 'H', 39120 'I', 39121 'J', 39122 'K', 39123 'L', 39124 'M', 39125 'N', 39126 'O', 39127 'P', 39128 'Q', 39129 'R', 39130 'S', 39131 'T', 39132 'U', 39133 'V', 39134 'W', 39135 'X', 39136 'Y', 39137 'Z', 39138 'bracketleft', 39139 'backslash', 39140 'bracketright', 39141 'asciicircum', 39142 'underscore', 39143 'grave', 39144 'a', 39145 'b', 39146 'c', 39147 'd', 39148 'e', 39149 'f', 39150 'g', 39151 'h', 39152 'i', 39153 'j', 39154 'k', 39155 'l', 39156 'm', 39157 'n', 39158 'o', 39159 'p', 39160 'q', 39161 'r', 39162 's', 39163 't', 39164 'u', 39165 'v', 39166 'w', 39167 'x', 39168 'y', 39169 'z', 39170 'braceleft', 39171 'bar', 39172 'braceright', 39173 'asciitilde', 39174 'Adieresis', 39175 'Aring', 39176 'Ccedilla', 39177 'Eacute', 39178 'Ntilde', 39179 'Odieresis', 39180 'Udieresis', 39181 'aacute', 39182 'agrave', 39183 'acircumflex', 39184 'adieresis', 39185 'atilde', 39186 'aring', 39187 'ccedilla', 39188 'eacute', 39189 'egrave', 39190 'ecircumflex', 39191 'edieresis', 39192 'iacute', 39193 'igrave', 39194 'icircumflex', 39195 'idieresis', 39196 'ntilde', 39197 'oacute', 39198 'ograve', 39199 'ocircumflex', 39200 'odieresis', 39201 'otilde', 39202 'uacute', 39203 'ugrave', 39204 'ucircumflex', 39205 'udieresis', 39206 'dagger', 39207 'degree', 39208 'cent', 39209 'sterling', 39210 'section', 39211 'bullet', 39212 'paragraph', 39213 'germandbls', 39214 'registered', 39215 'copyright', 39216 'trademark', 39217 'acute', 39218 'dieresis', 39219 'notequal', 39220 'AE', 39221 'Oslash', 39222 'infinity', 39223 'plusminus', 39224 'lessequal', 39225 'greaterequal', 39226 'yen', 39227 'mu', 39228 'partialdiff', 39229 'summation', 39230 'product', 39231 'pi', 39232 'integral', 39233 'ordfeminine', 39234 'ordmasculine', 39235 'Omega', 39236 'ae', 39237 'oslash', 39238 'questiondown', 39239 'exclamdown', 39240 'logicalnot', 39241 'radical', 39242 'florin', 39243 'approxequal', 39244 'Delta', 39245 'guillemotleft', 39246 'guillemotright', 39247 'ellipsis', 39248 'nonbreakingspace', 39249 'Agrave', 39250 'Atilde', 39251 'Otilde', 39252 'OE', 39253 'oe', 39254 'endash', 39255 'emdash', 39256 'quotedblleft', 39257 'quotedblright', 39258 'quoteleft', 39259 'quoteright', 39260 'divide', 39261 'lozenge', 39262 'ydieresis', 39263 'Ydieresis', 39264 'fraction', 39265 'currency', 39266 'guilsinglleft', 39267 'guilsinglright', 39268 'fi', 39269 'fl', 39270 'daggerdbl',
39271 'periodcentered', 39272 'quotesinglbase', 39273 'quotedblbase', 39274 'perthousand', 39275 'Acircumflex', 39276 'Ecircumflex', 39277 'Aacute', 39278 'Edieresis', 39279 'Egrave', 39280 'Iacute', 39281 'Icircumflex', 39282 'Idieresis', 39283 'Igrave', 39284 'Oacute', 39285 'Ocircumflex', 39286 'apple', 39287 'Ograve', 39288 'Uacute', 39289 'Ucircumflex', 39290 'Ugrave', 39291 'dotlessi', 39292 'circumflex', 39293 'tilde', 39294 'macron', 39295 'breve', 39296 'dotaccent', 39297 'ring', 39298 'cedilla', 39299 'hungarumlaut', 39300 'ogonek', 39301 'caron', 39302 'Lslash', 39303 'lslash', 39304 'Scaron', 39305 'scaron', 39306 'Zcaron', 39307 'zcaron', 39308 'brokenbar', 39309 'Eth', 39310 'eth', 39311 'Yacute', 39312 'yacute', 39313 'Thorn', 39314 'thorn', 39315 'minus', 39316 'multiply', 39317 'onesuperior', 39318 'twosuperior', 39319 'threesuperior', 39320 'onehalf', 39321 'onequarter', 39322 'threequarters', 39323 'franc', 39324 'Gbreve', 39325 'gbreve', 39326 'Idotaccent', 39327 'Scedilla', 39328 'scedilla', 39329 'Cacute', 39330 'cacute', 39331 'Ccaron', 39332 'ccaron', 39333 'dcroat' 39334 ]; 39335 function adjustWidths(properties) { 39336 if (!properties.fontMatrix) { 39337 return; 39338 } 39339 if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) { 39340 return; 39341 } 39342 var scale = 0.001 / properties.fontMatrix[0]; 39343 var glyphsWidths = properties.widths; 39344 for (var glyph in glyphsWidths) { 39345 glyphsWidths[glyph] *= scale; 39346 } 39347 properties.defaultWidth *= scale; 39348 } 39349 function adjustToUnicode(properties, builtInEncoding) { 39350 if (properties.hasIncludedToUnicodeMap) { 39351 return; 39352 } 39353 if (properties.hasEncoding) { 39354 return; 39355 } 39356 if (builtInEncoding === properties.defaultEncoding) { 39357 return; 39358 } 39359 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 39360 return; 39361 } 39362 var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode(); 39363 for (var charCode in builtInEncoding) { 39364 var glyphName = builtInEncoding[charCode]; 39365 var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 39366 if (unicode !== -1) { 39367 toUnicode[charCode] = String.fromCharCode(unicode); 39368 } 39369 } 39370 properties.toUnicode.amend(toUnicode); 39371 } 39372 function getFontType(type, subtype) { 39373 switch (type) { 39374 case 'Type1': 39375 return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1; 39376 case 'CIDFontType0': 39377 return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0; 39378 case 'OpenType': 39379 return FontType.OPENTYPE; 39380 case 'TrueType': 39381 return FontType.TRUETYPE; 39382 case 'CIDFontType2': 39383 return FontType.CIDFONTTYPE2; 39384 case 'MMType1': 39385 return FontType.MMTYPE1; 39386 case 'Type0': 39387 return FontType.TYPE0; 39388 default: 39389 return FontType.UNKNOWN; 39390 } 39391 } 39392 function recoverGlyphName(name, glyphsUnicodeMap) { 39393 if (glyphsUnicodeMap[name] !== undefined) { 39394 return name; 39395 } 39396 var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); 39397 if (unicode !== -1) { 39398 for (var key in glyphsUnicodeMap) { 39399 if (glyphsUnicodeMap[key] === unicode) { 39400 return key; 39401 } 39402 } 39403 } 39404 info('Unable to recover a standard glyph name for: ' + name); 39405 return name; 39406 } 39407 var Glyph = function GlyphClosure() { 39408 function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 39409 this.fontChar = fontChar; 39410 this.unicode = unicode; 39411 this.accent = accent; 39412 this.width = width; 39413 this.vmetric = vmetric; 39414 this.operatorListId = operatorListId; 39415 this.isSpace = isSpace; 39416 this.isInFont = isInFont; 39417 } 39418 Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 39419 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; 39420 }; 39421 return Glyph; 39422 }(); 39423 var ToUnicodeMap = function ToUnicodeMapClosure() { 39424 function ToUnicodeMap(cmap) { 39425 this._map = cmap; 39426 } 39427 ToUnicodeMap.prototype = { 39428 get length() { 39429 return this._map.length; 39430 },
39431 forEach: function (callback) { 39432 for (var charCode in this._map) { 39433 callback(charCode, this._map[charCode].charCodeAt(0)); 39434 } 39435 }, 39436 has: function (i) { 39437 return this._map[i] !== undefined; 39438 }, 39439 get: function (i) { 39440 return this._map[i]; 39441 }, 39442 charCodeOf: function (v) { 39443 return this._map.indexOf(v); 39444 }, 39445 amend: function (map) { 39446 for (var charCode in map) { 39447 this._map[charCode] = map[charCode]; 39448 } 39449 } 39450 }; 39451 return ToUnicodeMap; 39452 }(); 39453 var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() { 39454 function IdentityToUnicodeMap(firstChar, lastChar) { 39455 this.firstChar = firstChar; 39456 this.lastChar = lastChar; 39457 } 39458 IdentityToUnicodeMap.prototype = { 39459 get length() { 39460 return this.lastChar + 1 - this.firstChar; 39461 }, 39462 forEach: function (callback) { 39463 for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 39464 callback(i, i); 39465 } 39466 }, 39467 has: function (i) { 39468 return this.firstChar <= i && i <= this.lastChar; 39469 }, 39470 get: function (i) { 39471 if (this.firstChar <= i && i <= this.lastChar) { 39472 return String.fromCharCode(i); 39473 } 39474 return undefined; 39475 },
39476 charCodeOf: function (v) { 39477 return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 39478 }, 39479 amend: function (map) { 39480 error('Should not call amend()'); 39481 } 39482 }; 39483 return IdentityToUnicodeMap; 39484 }(); 39485 var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() { 39486 function writeInt16(dest, offset, num) { 39487 dest[offset] = num >> 8 & 0xFF; 39488 dest[offset + 1] = num & 0xFF; 39489 } 39490 function writeInt32(dest, offset, num) { 39491 dest[offset] = num >> 24 & 0xFF; 39492 dest[offset + 1] = num >> 16 & 0xFF; 39493 dest[offset + 2] = num >> 8 & 0xFF; 39494 dest[offset + 3] = num & 0xFF; 39495 } 39496 function writeData(dest, offset, data) { 39497 var i, ii; 39498 if (data instanceof Uint8Array) { 39499 dest.set(data, offset); 39500 } else if (typeof data === 'string') { 39501 for (i = 0, ii = data.length; i < ii; i++) { 39502 dest[offset++] = data.charCodeAt(i) & 0xFF; 39503 } 39504 } else { 39505 for (i = 0, ii = data.length; i < ii; i++) { 39506 dest[offset++] = data[i] & 0xFF; 39507 } 39508 } 39509 } 39510 function OpenTypeFileBuilder(sfnt) { 39511 this.sfnt = sfnt; 39512 this.tables = Object.create(null); 39513 } 39514 OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) { 39515 var maxPower2 = 1, log2 = 0; 39516 while ((maxPower2 ^ entriesCount) > maxPower2) { 39517 maxPower2 <<= 1; 39518 log2++; 39519 } 39520 var searchRange = maxPower2 * entrySize; 39521 return { 39522 range: searchRange, 39523 entry: log2, 39524 rangeShift: entrySize * entriesCount - searchRange 39525 }; 39526 }; 39527 var OTF_HEADER_SIZE = 12; 39528 var OTF_TABLE_ENTRY_SIZE = 16; 39529 OpenTypeFileBuilder.prototype = { 39530 toArray: function OpenTypeFileBuilder_toArray() { 39531 var sfnt = this.sfnt; 39532 var tables = this.tables; 39533 var tablesNames = Object.keys(tables); 39534 tablesNames.sort(); 39535 var numTables = tablesNames.length; 39536 var i, j, jj, table, tableName; 39537 var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 39538 var tableOffsets = [offset]; 39539 for (i = 0; i < numTables; i++) { 39540 table = tables[tablesNames[i]]; 39541 var paddedLength = (table.length + 3 & ~3) >>> 0; 39542 offset += paddedLength; 39543 tableOffsets.push(offset); 39544 } 39545 var file = new Uint8Array(offset); 39546 for (i = 0; i < numTables; i++) { 39547 table = tables[tablesNames[i]]; 39548 writeData(file, tableOffsets[i], table); 39549 } 39550 if (sfnt === 'true') { 39551 sfnt = string32(0x00010000); 39552 } 39553 file[0] = sfnt.charCodeAt(0) & 0xFF; 39554 file[1] = sfnt.charCodeAt(1) & 0xFF; 39555 file[2] = sfnt.charCodeAt(2) & 0xFF; 39556 file[3] = sfnt.charCodeAt(3) & 0xFF; 39557 writeInt16(file, 4, numTables); 39558 var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 39559 writeInt16(file, 6, searchParams.range); 39560 writeInt16(file, 8, searchParams.entry); 39561 writeInt16(file, 10, searchParams.rangeShift); 39562 offset = OTF_HEADER_SIZE; 39563 for (i = 0; i < numTables; i++) { 39564 tableName = tablesNames[i]; 39565 file[offset] = tableName.charCodeAt(0) & 0xFF; 39566 file[offset + 1] = tableName.charCodeAt(1) & 0xFF; 39567 file[offset + 2] = tableName.charCodeAt(2) & 0xFF; 39568 file[offset + 3] = tableName.charCodeAt(3) & 0xFF; 39569 var checksum = 0; 39570 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 39571 var quad = readUint32(file, j); 39572 checksum = checksum + quad >>> 0; 39573 } 39574 writeInt32(file, offset + 4, checksum); 39575 writeInt32(file, offset + 8, tableOffsets[i]); 39576 writeInt32(file, offset + 12, tables[tableName].length); 39577 offset += OTF_TABLE_ENTRY_SIZE; 39578 } 39579 return file; 39580 }, 39581 addTable: function OpenTypeFileBuilder_addTable(tag, data) { 39582 if (tag in this.tables) { 39583 throw new Error('Table ' + tag + ' already exists'); 39584 } 39585 this.tables[tag] = data; 39586 } 39587 }; 39588 return OpenTypeFileBuilder; 39589 }(); 39590 var ProblematicCharRanges = new Int32Array([ 39591 0x0000, 39592 0x0020, 39593 0x007F, 39594 0x00A1, 39595 0x00AD, 39596 0x00AE, 39597 0x0600, 39598 0x0780, 39599 0x08A0, 39600 0x10A0, 39601 0x1780, 39602 0x1800, 39603 0x1C00, 39604 0x1C50, 39605 0x2000, 39606 0x2010, 39607 0x2011, 39608 0x2012, 39609 0x2028, 39610 0x2030, 39611 0x205F, 39612 0x2070, 39613 0x25CC, 39614 0x25CD, 39615 0x3000, 39616 0x3001, 39617 0xAA60, 39618 0xAA80, 39619 0xFFF0, 39620 0x10000 39621 ]); 39622 var Font = function FontClosure() { 39623 function Font(name, file, properties) {
39624 var charCode, glyphName, unicode; 39625 this.name = name; 39626 this.loadedName = properties.loadedName; 39627 this.isType3Font = properties.isType3Font; 39628 this.sizes = []; 39629 this.missingFile = false; 39630 this.glyphCache = Object.create(null); 39631 this.isSerifFont = !!(properties.flags & FontFlags.Serif); 39632 this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 39633 this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); 39634 var type = properties.type; 39635 var subtype = properties.subtype; 39636 this.type = type; 39637 this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif'; 39638 this.differences = properties.differences; 39639 this.widths = properties.widths; 39640 this.defaultWidth = properties.defaultWidth; 39641 this.composite = properties.composite; 39642 this.wideChars = properties.wideChars; 39643 this.cMap = properties.cMap; 39644 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 39645 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 39646 this.fontMatrix = properties.fontMatrix; 39647 this.bbox = properties.bbox; 39648 this.toUnicode = properties.toUnicode; 39649 this.toFontChar = []; 39650 if (properties.type === 'Type3') { 39651 for (charCode = 0; charCode < 256; charCode++) { 39652 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 39653 } 39654 this.fontType = FontType.TYPE3; 39655 return; 39656 } 39657 this.cidEncoding = properties.cidEncoding; 39658 this.vertical = properties.vertical; 39659 if (this.vertical) { 39660 this.vmetrics = properties.vmetrics; 39661 this.defaultVMetrics = properties.defaultVMetrics; 39662 } 39663 var glyphsUnicodeMap; 39664 if (!file || file.isEmpty) { 39665 if (file) { 39666 warn('Font file is empty in "' + name + '" (' + this.loadedName + ')'); 39667 } 39668 this.missingFile = true; 39669 var fontName = name.replace(/[,_]/g, '-'); 39670 var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap(); 39671 var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 39672 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 39673 this.bold = fontName.search(/bold/gi) !== -1; 39674 this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; 39675 this.black = name.search(/Black/g) !== -1; 39676 this.remeasure = Object.keys(this.widths).length > 0; 39677 if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) { 39678 var GlyphMapForStandardFonts = getGlyphMapForStandardFonts(); 39679 var map = []; 39680 for (charCode in GlyphMapForStandardFonts) { 39681 map[+charCode] = GlyphMapForStandardFonts[charCode]; 39682 } 39683 if (/Arial-?Black/i.test(name)) { 39684 var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack(); 39685 for (charCode in SupplementalGlyphMapForArialBlack) { 39686 map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; 39687 } 39688 } 39689 var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; 39690 if (!isIdentityUnicode) { 39691 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 39692 map[+charCode] = unicodeCharCode; 39693 }); 39694 } 39695 this.toFontChar = map; 39696 this.toUnicode = new ToUnicodeMap(map); 39697 } else if (/Symbol/i.test(fontName)) { 39698 this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences); 39699 } else if (/Dingbats/i.test(fontName)) { 39700 if (/Wingdings/i.test(name)) { 39701 warn('Non-embedded Wingdings font, falling back to ZapfDingbats.'); 39702 } 39703 this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences); 39704 } else if (isStandardFont) { 39705 this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences); 39706 } else { 39707 glyphsUnicodeMap = getGlyphsUnicode(); 39708 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 39709 if (!this.composite) { 39710 glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode]; 39711 unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 39712 if (unicode !== -1) { 39713 unicodeCharCode = unicode; 39714 } 39715 } 39716 this.toFontChar[charCode] = unicodeCharCode; 39717 }.bind(this)); 39718 } 39719 this.loadedName = fontName.split('-')[0]; 39720 this.loading = false;
39721 this.fontType = getFontType(type, subtype); 39722 return; 39723 } 39724 if (subtype === 'Type1C') { 39725 if (type !== 'Type1' && type !== 'MMType1') { 39726 if (isTrueTypeFile(file)) { 39727 subtype = 'TrueType'; 39728 } else { 39729 type = 'Type1'; 39730 } 39731 } else if (isOpenTypeFile(file)) { 39732 type = subtype = 'OpenType'; 39733 } 39734 } 39735 if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { 39736 type = 'CIDFontType0'; 39737 } 39738 if (subtype === 'OpenType') { 39739 type = 'OpenType'; 39740 } 39741 if (type === 'CIDFontType0') { 39742 if (isType1File(file)) { 39743 subtype = 'CIDFontType0'; 39744 } else if (isOpenTypeFile(file)) { 39745 type = subtype = 'OpenType'; 39746 } else { 39747 subtype = 'CIDFontType0C'; 39748 } 39749 } 39750 var data; 39751 switch (type) { 39752 case 'MMType1': 39753 info('MMType1 font (' + name + '), falling back to Type1.'); 39754 case 'Type1': 39755 case 'CIDFontType0': 39756 this.mimetype = 'font/opentype'; 39757 var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties); 39758 adjustWidths(properties); 39759 data = this.convert(name, cff, properties); 39760 break; 39761 case 'OpenType': 39762 case 'TrueType': 39763 case 'CIDFontType2': 39764 this.mimetype = 'font/opentype'; 39765 data = this.checkAndRepair(name, file, properties); 39766 if (this.isOpenType) { 39767 adjustWidths(properties); 39768 type = 'OpenType'; 39769 } 39770 break; 39771 default: 39772 error('Font ' + type + ' is not supported'); 39773 break; 39774 } 39775 this.data = data; 39776 this.fontType = getFontType(type, subtype); 39777 this.fontMatrix = properties.fontMatrix; 39778 this.widths = properties.widths; 39779 this.defaultWidth = properties.defaultWidth; 39780 this.toUnicode = properties.toUnicode; 39781 this.encoding = properties.baseEncoding; 39782 this.seacMap = properties.seacMap; 39783 this.loading = true; 39784 } 39785 Font.getFontID = function () { 39786 var ID = 1; 39787 return function Font_getFontID() { 39788 return String(ID++); 39789 }; 39790 }(); 39791 function int16(b0, b1) { 39792 return (b0 << 8) + b1; 39793 } 39794 function signedInt16(b0, b1) { 39795 var value = (b0 << 8) + b1; 39796 return value & 1 << 15 ? value - 0x10000 : value; 39797 } 39798 function int32(b0, b1, b2, b3) { 39799 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 39800 } 39801 function string16(value) { 39802 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 39803 } 39804 function safeString16(value) { 39805 value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value; 39806 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 39807 } 39808 function isTrueTypeFile(file) { 39809 var header = file.peekBytes(4); 39810 return readUint32(header, 0) === 0x00010000; 39811 } 39812 function isOpenTypeFile(file) { 39813 var header = file.peekBytes(4); 39814 return bytesToString(header) === 'OTTO'; 39815 } 39816 function isType1File(file) { 39817 var header = file.peekBytes(2); 39818 if (header[0] === 0x25 && header[1] === 0x21) { 39819 return true; 39820 } 39821 if (header[0] === 0x80 && header[1] === 0x01) { 39822 return true; 39823 } 39824 return false; 39825 } 39826 function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 39827 var toFontChar = [], unicode; 39828 for (var i = 0, ii = encoding.length; i < ii; i++) { 39829 unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap); 39830 if (unicode !== -1) { 39831 toFontChar[i] = unicode; 39832 } 39833 } 39834 for (var charCode in differences) { 39835 unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap); 39836 if (unicode !== -1) { 39837 toFontChar[+charCode] = unicode; 39838 } 39839 } 39840 return toFontChar; 39841 } 39842 function isProblematicUnicodeLocation(code) { 39843 var i = 0, j = ProblematicCharRanges.length - 1; 39844 while (i < j) { 39845 var c = i + j + 1 >> 1; 39846 if (code < ProblematicCharRanges[c]) { 39847 j = c - 1; 39848 } else { 39849 i = c; 39850 } 39851 } 39852 return !(i & 1); 39853 } 39854 function adjustMapping(charCodeToGlyphId, properties) { 39855 var toUnicode = properties.toUnicode; 39856 var isSymbolic = !!(properties.flags & FontFlags.Symbolic); 39857 var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap; 39858 var newMap = Object.create(null); 39859 var toFontChar = []; 39860 var usedFontCharCodes = []; 39861 var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START; 39862 for (var originalCharCode in charCodeToGlyphId) { 39863 originalCharCode |= 0; 39864 var glyphId = charCodeToGlyphId[originalCharCode]; 39865 var fontCharCode = originalCharCode; 39866 var hasUnicodeValue = false;
39867 if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { 39868 hasUnicodeValue = true; 39869 var unicode = toUnicode.get(fontCharCode); 39870 if (unicode.length === 1) { 39871 fontCharCode = unicode.charCodeAt(0); 39872 } 39873 } 39874 if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { 39875 do { 39876 fontCharCode = nextAvailableFontCharCode++; 39877 if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) { 39878 fontCharCode = 0xF020; 39879 nextAvailableFontCharCode = fontCharCode + 1; 39880 } 39881 } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END); 39882 } 39883 newMap[fontCharCode] = glyphId; 39884 toFontChar[originalCharCode] = fontCharCode; 39885 usedFontCharCodes[fontCharCode] = true; 39886 } 39887 return { 39888 toFontChar: toFontChar, 39889 charCodeToGlyphId: newMap, 39890 nextAvailableFontCharCode: nextAvailableFontCharCode 39891 }; 39892 } 39893 function getRanges(glyphs, numGlyphs) { 39894 var codes = []; 39895 for (var charCode in glyphs) { 39896 if (glyphs[charCode] >= numGlyphs) { 39897 continue; 39898 } 39899 codes.push({ 39900 fontCharCode: charCode | 0, 39901 glyphId: glyphs[charCode] 39902 }); 39903 } 39904 codes.sort(function fontGetRangesSort(a, b) { 39905 return a.fontCharCode - b.fontCharCode; 39906 }); 39907 var ranges = []; 39908 var length = codes.length; 39909 for (var n = 0; n < length;) { 39910 var start = codes[n].fontCharCode; 39911 var codeIndices = [codes[n].glyphId]; 39912 ++n; 39913 var end = start; 39914 while (n < length && end + 1 === codes[n].fontCharCode) { 39915 codeIndices.push(codes[n].glyphId); 39916 ++end; 39917 ++n; 39918 if (end === 0xFFFF) { 39919 break; 39920 } 39921 } 39922 ranges.push([ 39923 start, 39924 end, 39925 codeIndices 39926 ]); 39927 } 39928 return ranges; 39929 } 39930 function createCmapTable(glyphs, numGlyphs) { 39931 var ranges = getRanges(glyphs, numGlyphs); 39932 var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1; 39933 var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8); 39934 var i, ii, j, jj; 39935 for (i = ranges.length - 1; i >= 0; --i) { 39936 if (ranges[i][0] <= 0xFFFF) { 39937 break; 39938 } 39939 } 39940 var bmpLength = i + 1; 39941 if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) { 39942 ranges[i][1] = 0xFFFE; 39943 } 39944 var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0; 39945 var segCount = bmpLength + trailingRangesCount; 39946 var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); 39947 var startCount = ''; 39948 var endCount = ''; 39949 var idDeltas = ''; 39950 var idRangeOffsets = ''; 39951 var glyphsIds = ''; 39952 var bias = 0; 39953 var range, start, end, codes; 39954 for (i = 0, ii = bmpLength; i < ii; i++) { 39955 range = ranges[i]; 39956 start = range[0]; 39957 end = range[1]; 39958 startCount += string16(start); 39959 endCount += string16(end); 39960 codes = range[2]; 39961 var contiguous = true; 39962 for (j = 1, jj = codes.length; j < jj; ++j) { 39963 if (codes[j] !== codes[j - 1] + 1) { 39964 contiguous = false; 39965 break; 39966 } 39967 } 39968 if (!contiguous) { 39969 var offset = (segCount - i) * 2 + bias * 2; 39970 bias += end - start + 1; 39971 idDeltas += string16(0); 39972 idRangeOffsets += string16(offset); 39973 for (j = 0, jj = codes.length; j < jj; ++j) { 39974 glyphsIds += string16(codes[j]); 39975 } 39976 } else { 39977 var startCode = codes[0]; 39978 idDeltas += string16(startCode - start & 0xFFFF); 39979 idRangeOffsets += string16(0); 39980 } 39981 } 39982 if (trailingRangesCount > 0) { 39983 endCount += '\xFF\xFF'; 39984 startCount += '\xFF\xFF'; 39985 idDeltas += '\x00\x01'; 39986 idRangeOffsets += '\x00\x00'; 39987 } 39988 var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds; 39989 var format31012 = ''; 39990 var header31012 = ''; 39991 if (numTables > 1) { 39992 cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length); 39993 format31012 = ''; 39994 for (i = 0, ii = ranges.length; i < ii; i++) { 39995 range = ranges[i]; 39996 start = range[0]; 39997 codes = range[2]; 39998 var code = codes[0]; 39999 for (j = 1, jj = codes.length; j < jj; ++j) { 40000 if (codes[j] !== codes[j - 1] + 1) { 40001 end = range[0] + j - 1; 40002 format31012 += string32(start) + string32(end) + string32(code); 40003 start = end + 1; 40004 code = codes[j]; 40005 } 40006 } 40007 format31012 += string32(start) + string32(range[1]) + string32(code); 40008 } 40009 header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12); 40010 } 40011 return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012; 40012 } 40013 function validateOS2Table(os2) { 40014 var stream = new Stream(os2.data); 40015 var version = stream.getUint16(); 40016 stream.getBytes(60); 40017 var selection = stream.getUint16(); 40018 if (version < 4 && selection & 0x0300) { 40019 return false;
40020 } 40021 var firstChar = stream.getUint16(); 40022 var lastChar = stream.getUint16(); 40023 if (firstChar > lastChar) { 40024 return false; 40025 } 40026 stream.getBytes(6); 40027 var usWinAscent = stream.getUint16(); 40028 if (usWinAscent === 0) { 40029 return false; 40030 } 40031 os2.data[8] = os2.data[9] = 0; 40032 return true; 40033 } 40034 function createOS2Table(properties, charstrings, override) { 40035 override = override || { 40036 unitsPerEm: 0, 40037 yMax: 0, 40038 yMin: 0, 40039 ascent: 0, 40040 descent: 0 40041 }; 40042 var ulUnicodeRange1 = 0; 40043 var ulUnicodeRange2 = 0; 40044 var ulUnicodeRange3 = 0; 40045 var ulUnicodeRange4 = 0; 40046 var firstCharIndex = null; 40047 var lastCharIndex = 0; 40048 if (charstrings) { 40049 for (var code in charstrings) { 40050 code |= 0; 40051 if (firstCharIndex > code || !firstCharIndex) { 40052 firstCharIndex = code; 40053 } 40054 if (lastCharIndex < code) { 40055 lastCharIndex = code; 40056 } 40057 var position = getUnicodeRangeFor(code); 40058 if (position < 32) { 40059 ulUnicodeRange1 |= 1 << position; 40060 } else if (position < 64) { 40061 ulUnicodeRange2 |= 1 << position - 32; 40062 } else if (position < 96) { 40063 ulUnicodeRange3 |= 1 << position - 64; 40064 } else if (position < 123) { 40065 ulUnicodeRange4 |= 1 << position - 96; 40066 } else { 40067 error('Unicode ranges Bits > 123 are reserved for internal usage'); 40068 } 40069 } 40070 } else { 40071 firstCharIndex = 0; 40072 lastCharIndex = 255; 40073 } 40074 var bbox = properties.bbox || [ 40075 0, 40076 0, 40077 0, 40078 0 40079 ]; 40080 var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]; 40081 var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 40082 var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 40083 var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 40084 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 40085 typoDescent = -typoDescent; 40086 } 40087 var winAscent = override.yMax || typoAscent; 40088 var winDescent = -override.yMin || -typoDescent; 40089 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' + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + 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'; 40090 } 40091 function createPostTable(properties) { 40092 var angle = Math.floor(properties.italicAngle * Math.pow(2, 16)); 40093 return '\x00\x03\x00\x00' + string32(angle) + '\x00\x00' + '\x00\x00' + string32(properties.fixedPitch) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00'; 40094 } 40095 function createNameTable(name, proto) { 40096 if (!proto) { 40097 proto = [ 40098 [], 40099 [] 40100 ]; 40101 } 40102 var strings = [ 40103 proto[0][0] || 'Original licence', 40104 proto[0][1] || name, 40105 proto[0][2] || 'Unknown', 40106 proto[0][3] || 'uniqueID', 40107 proto[0][4] || name, 40108 proto[0][5] || 'Version 0.11', 40109 proto[0][6] || '', 40110 proto[0][7] || 'Unknown', 40111 proto[0][8] || 'Unknown', 40112 proto[0][9] || 'Unknown' 40113 ]; 40114 var stringsUnicode = []; 40115 var i, ii, j, jj, str; 40116 for (i = 0, ii = strings.length; i < ii; i++) { 40117 str = proto[1][i] || strings[i]; 40118 var strBufUnicode = []; 40119 for (j = 0, jj = str.length; j < jj; j++) { 40120 strBufUnicode.push(string16(str.charCodeAt(j))); 40121 }
40122 stringsUnicode.push(strBufUnicode.join('')); 40123 } 40124 var names = [ 40125 strings, 40126 stringsUnicode 40127 ]; 40128 var platforms = [ 40129 '\x00\x01', 40130 '\x00\x03' 40131 ]; 40132 var encodings = [ 40133 '\x00\x00', 40134 '\x00\x01' 40135 ]; 40136 var languages = [ 40137 '\x00\x00', 40138 '\x04\x09' 40139 ]; 40140 var namesRecordCount = strings.length * platforms.length; 40141 var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 40142 var strOffset = 0; 40143 for (i = 0, ii = platforms.length; i < ii; i++) { 40144 var strs = names[i]; 40145 for (j = 0, jj = strs.length; j < jj; j++) { 40146 str = strs[j]; 40147 var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 40148 nameTable += nameRecord; 40149 strOffset += str.length; 40150 } 40151 } 40152 nameTable += strings.join('') + stringsUnicode.join(''); 40153 return nameTable; 40154 } 40155 Font.prototype = { 40156 name: null, 40157 font: null, 40158 mimetype: null, 40159 encoding: null, 40160 get renderer() { 40161 var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED); 40162 return shadow(this, 'renderer', renderer); 40163 }, 40164 exportData: function Font_exportData() { 40165 var data = {}; 40166 for (var i in this) { 40167 if (this.hasOwnProperty(i)) { 40168 data[i] = this[i]; 40169 } 40170 } 40171 return data; 40172 }, 40173 checkAndRepair: function Font_checkAndRepair(name, font, properties) { 40174 function readTableEntry(file) { 40175 var tag = bytesToString(file.getBytes(4)); 40176 var checksum = file.getInt32() >>> 0; 40177 var offset = file.getInt32() >>> 0; 40178 var length = file.getInt32() >>> 0; 40179 var previousPosition = file.pos; 40180 file.pos = file.start ? file.start : 0; 40181 file.skip(offset); 40182 var data = file.getBytes(length); 40183 file.pos = previousPosition; 40184 if (tag === 'head') { 40185 data[8] = data[9] = data[10] = data[11] = 0; 40186 data[17] |= 0x20; 40187 } 40188 return { 40189 tag: tag, 40190 checksum: checksum, 40191 length: length, 40192 offset: offset, 40193 data: data 40194 }; 40195 } 40196 function readOpenTypeHeader(ttf) { 40197 return { 40198 version: bytesToString(ttf.getBytes(4)), 40199 numTables: ttf.getUint16(), 40200 searchRange: ttf.getUint16(), 40201 entrySelector: ttf.getUint16(), 40202 rangeShift: ttf.getUint16() 40203 }; 40204 } 40205 function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) { 40206 if (!cmap) { 40207 warn('No cmap table available.'); 40208 return { 40209 platformId: -1, 40210 encodingId: -1, 40211 mappings: [], 40212 hasShortCmap: false 40213 }; 40214 } 40215 var segment; 40216 var start = (font.start ? font.start : 0) + cmap.offset; 40217 font.pos = start; 40218 font.getUint16(); 40219 var numTables = font.getUint16(); 40220 var potentialTable; 40221 var canBreak = false; 40222 for (var i = 0; i < numTables; i++) { 40223 var platformId = font.getUint16(); 40224 var encodingId = font.getUint16(); 40225 var offset = font.getInt32() >>> 0; 40226 var useTable = false; 40227 if (platformId === 0 && encodingId === 0) { 40228 useTable = true; 40229 } else if (platformId === 1 && encodingId === 0) { 40230 useTable = true; 40231 } else if (platformId === 3 && encodingId === 1 && (!isSymbolicFont && hasEncoding || !potentialTable)) { 40232 useTable = true; 40233 if (!isSymbolicFont) { 40234 canBreak = true; 40235 } 40236 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 40237 useTable = true; 40238 canBreak = true; 40239 } 40240 if (useTable) { 40241 potentialTable = { 40242 platformId: platformId, 40243 encodingId: encodingId, 40244 offset: offset 40245 }; 40246 } 40247 if (canBreak) { 40248 break; 40249 } 40250 } 40251 if (potentialTable) { 40252 font.pos = start + potentialTable.offset; 40253 } 40254 if (!potentialTable || font.peekByte() === -1) { 40255 warn('Could not find a preferred cmap table.'); 40256 return { 40257 platformId: -1, 40258 encodingId: -1, 40259 mappings: [], 40260 hasShortCmap: false 40261 }; 40262 } 40263 var format = font.getUint16(); 40264 font.getUint16(); 40265 font.getUint16(); 40266 var hasShortCmap = false;
40267 var mappings = []; 40268 var j, glyphId; 40269 if (format === 0) { 40270 for (j = 0; j < 256; j++) { 40271 var index = font.getByte(); 40272 if (!index) { 40273 continue; 40274 } 40275 mappings.push({ 40276 charCode: j, 40277 glyphId: index 40278 }); 40279 } 40280 hasShortCmap = true; 40281 } else if (format === 4) { 40282 var segCount = font.getUint16() >> 1; 40283 font.getBytes(6); 40284 var segIndex, segments = []; 40285 for (segIndex = 0; segIndex < segCount; segIndex++) { 40286 segments.push({ end: font.getUint16() }); 40287 } 40288 font.getUint16(); 40289 for (segIndex = 0; segIndex < segCount; segIndex++) { 40290 segments[segIndex].start = font.getUint16(); 40291 } 40292 for (segIndex = 0; segIndex < segCount; segIndex++) { 40293 segments[segIndex].delta = font.getUint16(); 40294 } 40295 var offsetsCount = 0; 40296 for (segIndex = 0; segIndex < segCount; segIndex++) { 40297 segment = segments[segIndex]; 40298 var rangeOffset = font.getUint16(); 40299 if (!rangeOffset) { 40300 segment.offsetIndex = -1; 40301 continue; 40302 } 40303 var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 40304 segment.offsetIndex = offsetIndex; 40305 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 40306 } 40307 var offsets = []; 40308 for (j = 0; j < offsetsCount; j++) { 40309 offsets.push(font.getUint16()); 40310 } 40311 for (segIndex = 0; segIndex < segCount; segIndex++) { 40312 segment = segments[segIndex]; 40313 start = segment.start; 40314 var end = segment.end; 40315 var delta = segment.delta; 40316 offsetIndex = segment.offsetIndex; 40317 for (j = start; j <= end; j++) { 40318 if (j === 0xFFFF) { 40319 continue; 40320 } 40321 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 40322 glyphId = glyphId + delta & 0xFFFF; 40323 if (glyphId === 0) { 40324 continue; 40325 } 40326 mappings.push({ 40327 charCode: j, 40328 glyphId: glyphId 40329 }); 40330 } 40331 } 40332 } else if (format === 6) { 40333 var firstCode = font.getUint16(); 40334 var entryCount = font.getUint16(); 40335 for (j = 0; j < entryCount; j++) { 40336 glyphId = font.getUint16(); 40337 var charCode = firstCode + j; 40338 mappings.push({ 40339 charCode: charCode, 40340 glyphId: glyphId 40341 }); 40342 } 40343 } else { 40344 warn('cmap table has unsupported format: ' + format); 40345 return { 40346 platformId: -1, 40347 encodingId: -1, 40348 mappings: [], 40349 hasShortCmap: false 40350 }; 40351 } 40352 mappings.sort(function (a, b) { 40353 return a.charCode - b.charCode; 40354 }); 40355 for (i = 1; i < mappings.length; i++) { 40356 if (mappings[i - 1].charCode === mappings[i].charCode) { 40357 mappings.splice(i, 1); 40358 i--; 40359 } 40360 } 40361 return { 40362 platformId: potentialTable.platformId, 40363 encodingId: potentialTable.encodingId, 40364 mappings: mappings, 40365 hasShortCmap: hasShortCmap 40366 }; 40367 } 40368 function sanitizeMetrics(font, header, metrics, numGlyphs) { 40369 if (!header) { 40370 if (metrics) { 40371 metrics.data = null; 40372 } 40373 return; 40374 } 40375 font.pos = (font.start ? font.start : 0) + header.offset; 40376 font.pos += header.length - 2; 40377 var numOfMetrics = font.getUint16(); 40378 if (numOfMetrics > numGlyphs) { 40379 info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')'); 40380 numOfMetrics = numGlyphs; 40381 header.data[34] = (numOfMetrics & 0xff00) >> 8; 40382 header.data[35] = numOfMetrics & 0x00ff; 40383 } 40384 var numOfSidebearings = numGlyphs - numOfMetrics; 40385 var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 40386 if (numMissing > 0) { 40387 var entries = new Uint8Array(metrics.length + numMissing * 2); 40388 entries.set(metrics.data); 40389 metrics.data = entries; 40390 } 40391 } 40392 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 40393 if (sourceEnd - sourceStart <= 12) { 40394 return 0; 40395 } 40396 var glyf = source.subarray(sourceStart, sourceEnd); 40397 var contoursCount = glyf[0] << 8 | glyf[1]; 40398 if (contoursCount & 0x8000) { 40399 dest.set(glyf, destStart); 40400 return glyf.length; 40401 } 40402 var i, j = 10, flagsCount = 0; 40403 for (i = 0; i < contoursCount; i++) { 40404 var endPoint = glyf[j] << 8 | glyf[j + 1]; 40405 flagsCount = endPoint + 1; 40406 j += 2; 40407 } 40408 var instructionsStart = j; 40409 var instructionsLength = glyf[j] << 8 | glyf[j + 1]; 40410 j += 2 + instructionsLength; 40411 var instructionsEnd = j; 40412 var coordinatesLength = 0; 40413 for (i = 0; i < flagsCount; i++) { 40414 var flag = glyf[j++]; 40415 if (flag & 0xC0) { 40416 glyf[j - 1] = flag & 0x3F; 40417 } 40418 var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2); 40419 coordinatesLength += xyLength; 40420 if (flag & 8) { 40421 var repeat = glyf[j++]; 40422 i += repeat;
40423 coordinatesLength += repeat * xyLength; 40424 } 40425 } 40426 if (coordinatesLength === 0) { 40427 return 0; 40428 } 40429 var glyphDataLength = j + coordinatesLength; 40430 if (glyphDataLength > glyf.length) { 40431 return 0; 40432 } 40433 if (!hintsValid && instructionsLength > 0) { 40434 dest.set(glyf.subarray(0, instructionsStart), destStart); 40435 dest.set([ 40436 0, 40437 0 40438 ], destStart + instructionsStart); 40439 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 40440 glyphDataLength -= instructionsLength; 40441 if (glyf.length - glyphDataLength > 3) { 40442 glyphDataLength = glyphDataLength + 3 & ~3; 40443 } 40444 return glyphDataLength; 40445 } 40446 if (glyf.length - glyphDataLength > 3) { 40447 glyphDataLength = glyphDataLength + 3 & ~3; 40448 dest.set(glyf.subarray(0, glyphDataLength), destStart); 40449 return glyphDataLength; 40450 } 40451 dest.set(glyf, destStart); 40452 return glyf.length; 40453 } 40454 function sanitizeHead(head, numGlyphs, locaLength) { 40455 var data = head.data; 40456 var version = int32(data[0], data[1], data[2], data[3]); 40457 if (version >> 16 !== 1) { 40458 info('Attempting to fix invalid version in head table: ' + version); 40459 data[0] = 0; 40460 data[1] = 1; 40461 data[2] = 0; 40462 data[3] = 0; 40463 } 40464 var indexToLocFormat = int16(data[50], data[51]); 40465 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 40466 info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat); 40467 var numGlyphsPlusOne = numGlyphs + 1; 40468 if (locaLength === numGlyphsPlusOne << 1) { 40469 data[50] = 0; 40470 data[51] = 0; 40471 } else if (locaLength === numGlyphsPlusOne << 2) { 40472 data[50] = 0; 40473 data[51] = 1; 40474 } else { 40475 warn('Could not fix indexToLocFormat: ' + indexToLocFormat); 40476 } 40477 } 40478 } 40479 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) { 40480 var itemSize, itemDecode, itemEncode; 40481 if (isGlyphLocationsLong) { 40482 itemSize = 4; 40483 itemDecode = function fontItemDecodeLong(data, offset) { 40484 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 40485 }; 40486 itemEncode = function fontItemEncodeLong(data, offset, value) { 40487 data[offset] = value >>> 24 & 0xFF; 40488 data[offset + 1] = value >> 16 & 0xFF; 40489 data[offset + 2] = value >> 8 & 0xFF; 40490 data[offset + 3] = value & 0xFF; 40491 }; 40492 } else { 40493 itemSize = 2; 40494 itemDecode = function fontItemDecode(data, offset) { 40495 return data[offset] << 9 | data[offset + 1] << 1; 40496 }; 40497 itemEncode = function fontItemEncode(data, offset, value) { 40498 data[offset] = value >> 9 & 0xFF; 40499 data[offset + 1] = value >> 1 & 0xFF; 40500 }; 40501 } 40502 var locaData = loca.data; 40503 var locaDataSize = itemSize * (1 + numGlyphs); 40504 if (locaData.length !== locaDataSize) { 40505 locaData = new Uint8Array(locaDataSize); 40506 locaData.set(loca.data.subarray(0, locaDataSize)); 40507 loca.data = locaData; 40508 } 40509 var oldGlyfData = glyf.data; 40510 var oldGlyfDataLength = oldGlyfData.length; 40511 var newGlyfData = new Uint8Array(oldGlyfDataLength); 40512 var startOffset = itemDecode(locaData, 0); 40513 var writeOffset = 0; 40514 var missingGlyphData = Object.create(null); 40515 itemEncode(locaData, 0, writeOffset); 40516 var i, j; 40517 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 40518 var endOffset = itemDecode(locaData, j); 40519 if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) { 40520 endOffset = oldGlyfDataLength; 40521 } 40522 if (endOffset > oldGlyfDataLength) { 40523 itemEncode(locaData, j, writeOffset); 40524 startOffset = endOffset; 40525 continue; 40526 } 40527 if (startOffset === endOffset) { 40528 missingGlyphData[i] = true; 40529 } 40530 var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid); 40531 writeOffset += newLength; 40532 itemEncode(locaData, j, writeOffset); 40533 startOffset = endOffset; 40534 } 40535 if (writeOffset === 0) { 40536 var simpleGlyph = new Uint8Array([ 40537 0, 40538 1, 40539 0, 40540 0, 40541 0, 40542 0, 40543 0, 40544 0, 40545 0, 40546 0, 40547 0, 40548 0, 40549 0, 40550 0, 40551 49, 40552 0 40553 ]); 40554 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 40555 itemEncode(locaData, j, simpleGlyph.length); 40556 } 40557 glyf.data = simpleGlyph; 40558 return missingGlyphData; 40559 } 40560 if (dupFirstEntry) { 40561 var firstEntryLength = itemDecode(locaData, itemSize); 40562 if (newGlyfData.length > firstEntryLength + writeOffset) { 40563 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 40564 } else { 40565 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 40566 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 40567 } 40568 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 40569 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 40570 } else { 40571 glyf.data = newGlyfData.subarray(0, writeOffset); 40572 } 40573 return missingGlyphData; 40574 } 40575 function readPostScriptTable(post, properties, maxpNumGlyphs) { 40576 var start = (font.start ? font.start : 0) + post.offset; 40577 font.pos = start; 40578 var length = post.length, end = start + length; 40579 var version = font.getInt32(); 40580 font.getBytes(28); 40581 var glyphNames;
40582 var valid = true; 40583 var i; 40584 switch (version) { 40585 case 0x00010000: 40586 glyphNames = MacStandardGlyphOrdering; 40587 break; 40588 case 0x00020000: 40589 var numGlyphs = font.getUint16(); 40590 if (numGlyphs !== maxpNumGlyphs) { 40591 valid = false; 40592 break; 40593 } 40594 var glyphNameIndexes = []; 40595 for (i = 0; i < numGlyphs; ++i) { 40596 var index = font.getUint16(); 40597 if (index >= 32768) { 40598 valid = false; 40599 break; 40600 } 40601 glyphNameIndexes.push(index); 40602 } 40603 if (!valid) { 40604 break; 40605 } 40606 var customNames = []; 40607 var strBuf = []; 40608 while (font.pos < end) { 40609 var stringLength = font.getByte(); 40610 strBuf.length = stringLength; 40611 for (i = 0; i < stringLength; ++i) { 40612 strBuf[i] = String.fromCharCode(font.getByte()); 40613 } 40614 customNames.push(strBuf.join('')); 40615 } 40616 glyphNames = []; 40617 for (i = 0; i < numGlyphs; ++i) { 40618 var j = glyphNameIndexes[i]; 40619 if (j < 258) { 40620 glyphNames.push(MacStandardGlyphOrdering[j]); 40621 continue; 40622 } 40623 glyphNames.push(customNames[j - 258]); 40624 } 40625 break; 40626 case 0x00030000: 40627 break; 40628 default: 40629 warn('Unknown/unsupported post table version ' + version); 40630 valid = false; 40631 if (properties.defaultEncoding) { 40632 glyphNames = properties.defaultEncoding; 40633 } 40634 break; 40635 } 40636 properties.glyphNames = glyphNames; 40637 return valid; 40638 } 40639 function readNameTable(nameTable) { 40640 var start = (font.start ? font.start : 0) + nameTable.offset; 40641 font.pos = start; 40642 var names = [ 40643 [], 40644 [] 40645 ]; 40646 var length = nameTable.length, end = start + length; 40647 var format = font.getUint16(); 40648 var FORMAT_0_HEADER_LENGTH = 6; 40649 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 40650 return names; 40651 } 40652 var numRecords = font.getUint16(); 40653 var stringsStart = font.getUint16(); 40654 var records = []; 40655 var NAME_RECORD_LENGTH = 12; 40656 var i, ii; 40657 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 40658 var r = { 40659 platform: font.getUint16(), 40660 encoding: font.getUint16(), 40661 language: font.getUint16(), 40662 name: font.getUint16(), 40663 length: font.getUint16(), 40664 offset: font.getUint16() 40665 }; 40666 if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) { 40667 records.push(r); 40668 } 40669 } 40670 for (i = 0, ii = records.length; i < ii; i++) { 40671 var record = records[i]; 40672 if (record.length <= 0) { 40673 continue; 40674 } 40675 var pos = start + stringsStart + record.offset; 40676 if (pos + record.length > end) { 40677 continue; 40678 } 40679 font.pos = pos; 40680 var nameIndex = record.name; 40681 if (record.encoding) { 40682 var str = ''; 40683 for (var j = 0, jj = record.length; j < jj; j += 2) { 40684 str += String.fromCharCode(font.getUint16()); 40685 } 40686 names[1][nameIndex] = str; 40687 } else { 40688 names[0][nameIndex] = bytesToString(font.getBytes(record.length)); 40689 } 40690 } 40691 return names; 40692 } 40693 var TTOpsStackDeltas = [ 40694 0, 40695 0, 40696 0, 40697 0, 40698 0, 40699 0, 40700 0, 40701 0, 40702 -2, 40703 -2, 40704 -2, 40705 -2, 40706 0, 40707 0, 40708 -2, 40709 -5, 40710 -1, 40711 -1, 40712 -1, 40713 -1, 40714 -1, 40715 -1, 40716 -1, 40717 -1, 40718 0, 40719 0, 40720 -1, 40721 0, 40722 -1, 40723 -1, 40724 -1, 40725 -1, 40726 1, 40727 -1, 40728 -999, 40729 0, 40730 1, 40731 0, 40732 -1, 40733 -2, 40734 0, 40735 -1, 40736 -2, 40737 -1, 40738 -1, 40739 0, 40740 -1, 40741 -1, 40742 0, 40743 0, 40744 -999, 40745 -999, 40746 -1, 40747 -1, 40748 -1, 40749 -1, 40750 -2, 40751 -999, 40752 -2, 40753 -2, 40754 -999, 40755 0, 40756 -2, 40757 -2, 40758 0, 40759 0, 40760 -2, 40761 0, 40762 -2, 40763 0, 40764 0, 40765 0, 40766 -2, 40767 -1, 40768 -1, 40769 1, 40770 1, 40771 0, 40772 0, 40773 -1, 40774 -1, 40775 -1, 40776 -1, 40777 -1, 40778 -1, 40779 -1, 40780 0, 40781 0, 40782 -1, 40783 0, 40784 -1, 40785 -1, 40786 0, 40787 -999, 40788 -1, 40789 -1, 40790 -1, 40791 -1, 40792 -1, 40793 -1, 40794 0, 40795 0, 40796 0, 40797 0, 40798 0, 40799 0, 40800 0, 40801 0, 40802 0, 40803 0, 40804 0, 40805 0, 40806 -2, 40807 -999, 40808 -999, 40809 -999, 40810 -999, 40811 -999, 40812 -1, 40813 -1, 40814 -2, 40815 -2, 40816 0, 40817 0, 40818 0, 40819 0, 40820 -1, 40821 -1, 40822 -999, 40823 -2, 40824 -2, 40825 0, 40826 0, 40827 -1, 40828 -2, 40829 -2, 40830 0, 40831 0, 40832 0, 40833 -1, 40834 -1, 40835 -1, 40836 -2 40837 ]; 40838 function sanitizeTTProgram(table, ttContext) { 40839 var data = table.data; 40840 var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0; 40841 var stack = []; 40842 var callstack = []; 40843 var functionsCalled = []; 40844 var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 40845 var inFDEF = false, ifLevel = 0, inELSE = 0; 40846 for (var ii = data.length; i < ii;) { 40847 var op = data[i++]; 40848 if (op === 0x40) { 40849 n = data[i++]; 40850 if (inFDEF || inELSE) { 40851 i += n; 40852 } else { 40853 for (j = 0; j < n; j++) { 40854 stack.push(data[i++]); 40855 } 40856 } 40857 } else if (op === 0x41) { 40858 n = data[i++]; 40859 if (inFDEF || inELSE) { 40860 i += n * 2; 40861 } else { 40862 for (j = 0; j < n; j++) { 40863 b = data[i++]; 40864 stack.push(b << 8 | data[i++]); 40865 } 40866 } 40867 } else if ((op & 0xF8) === 0xB0) { 40868 n = op - 0xB0 + 1; 40869 if (inFDEF || inELSE) { 40870 i += n; 40871 } else { 40872 for (j = 0; j < n; j++) { 40873 stack.push(data[i++]); 40874 } 40875 } 40876 } else if ((op & 0xF8) === 0xB8) { 40877 n = op - 0xB8 + 1; 40878 if (inFDEF || inELSE) { 40879 i += n * 2; 40880 } else { 40881 for (j = 0; j < n; j++) { 40882 b = data[i++]; 40883 stack.push(b << 8 | data[i++]); 40884 } 40885 } 40886 } else if (op === 0x2B && !tooComplexToFollowFunctions) { 40887 if (!inFDEF && !inELSE) { 40888 funcId = stack[stack.length - 1]; 40889 ttContext.functionsUsed[funcId] = true; 40890 if (funcId in ttContext.functionsStackDeltas) { 40891 stack.length += ttContext.functionsStackDeltas[funcId]; 40892 } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) { 40893 callstack.push({ 40894 data: data, 40895 i: i, 40896 stackTop: stack.length - 1 40897 }); 40898 functionsCalled.push(funcId); 40899 pc = ttContext.functionsDefined[funcId]; 40900 if (!pc) { 40901 warn('TT: CALL non-existent function'); 40902 ttContext.hintsValid = false;
40903 return; 40904 } 40905 data = pc.data; 40906 i = pc.i; 40907 } 40908 } 40909 } else if (op === 0x2C && !tooComplexToFollowFunctions) { 40910 if (inFDEF || inELSE) { 40911 warn('TT: nested FDEFs not allowed'); 40912 tooComplexToFollowFunctions = true; 40913 } 40914 inFDEF = true; 40915 lastDeff = i; 40916 funcId = stack.pop(); 40917 ttContext.functionsDefined[funcId] = { 40918 data: data, 40919 i: i 40920 }; 40921 } else if (op === 0x2D) { 40922 if (inFDEF) { 40923 inFDEF = false; 40924 lastEndf = i; 40925 } else { 40926 pc = callstack.pop(); 40927 if (!pc) { 40928 warn('TT: ENDF bad stack'); 40929 ttContext.hintsValid = false; 40930 return; 40931 } 40932 funcId = functionsCalled.pop(); 40933 data = pc.data; 40934 i = pc.i; 40935 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 40936 } 40937 } else if (op === 0x89) { 40938 if (inFDEF || inELSE) { 40939 warn('TT: nested IDEFs not allowed'); 40940 tooComplexToFollowFunctions = true; 40941 } 40942 inFDEF = true; 40943 lastDeff = i; 40944 } else if (op === 0x58) { 40945 ++ifLevel; 40946 } else if (op === 0x1B) { 40947 inELSE = ifLevel; 40948 } else if (op === 0x59) { 40949 if (inELSE === ifLevel) { 40950 inELSE = 0; 40951 } 40952 --ifLevel; 40953 } else if (op === 0x1C) { 40954 if (!inFDEF && !inELSE) { 40955 var offset = stack[stack.length - 1]; 40956 if (offset > 0) { 40957 i += offset - 1; 40958 } 40959 } 40960 } 40961 if (!inFDEF && !inELSE) { 40962 var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0; 40963 if (op >= 0x71 && op <= 0x75) { 40964 n = stack.pop(); 40965 if (!isNaN(n)) { 40966 stackDelta = -n * 2; 40967 } 40968 } 40969 while (stackDelta < 0 && stack.length > 0) { 40970 stack.pop(); 40971 stackDelta++; 40972 } 40973 while (stackDelta > 0) { 40974 stack.push(NaN); 40975 stackDelta--; 40976 } 40977 } 40978 } 40979 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 40980 var content = [data]; 40981 if (i > data.length) { 40982 content.push(new Uint8Array(i - data.length)); 40983 } 40984 if (lastDeff > lastEndf) { 40985 warn('TT: complementing a missing function tail'); 40986 content.push(new Uint8Array([ 40987 0x22, 40988 0x2D 40989 ])); 40990 } 40991 foldTTTable(table, content); 40992 } 40993 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 40994 if (ttContext.tooComplexToFollowFunctions) { 40995 return; 40996 } 40997 if (ttContext.functionsDefined.length > maxFunctionDefs) { 40998 warn('TT: more functions defined than expected'); 40999 ttContext.hintsValid = false; 41000 return; 41001 } 41002 for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 41003 if (j > maxFunctionDefs) { 41004 warn('TT: invalid function id: ' + j); 41005 ttContext.hintsValid = false; 41006 return; 41007 } 41008 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 41009 warn('TT: undefined function: ' + j); 41010 ttContext.hintsValid = false; 41011 return; 41012 } 41013 } 41014 } 41015 function foldTTTable(table, content) { 41016 if (content.length > 1) { 41017 var newLength = 0; 41018 var j, jj; 41019 for (j = 0, jj = content.length; j < jj; j++) { 41020 newLength += content[j].length; 41021 } 41022 newLength = newLength + 3 & ~3; 41023 var result = new Uint8Array(newLength); 41024 var pos = 0; 41025 for (j = 0, jj = content.length; j < jj; j++) { 41026 result.set(content[j], pos); 41027 pos += content[j].length; 41028 } 41029 table.data = result; 41030 table.length = newLength; 41031 } 41032 } 41033 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 41034 var ttContext = { 41035 functionsDefined: [], 41036 functionsUsed: [], 41037 functionsStackDeltas: [], 41038 tooComplexToFollowFunctions: false, 41039 hintsValid: true 41040 }; 41041 if (fpgm) { 41042 sanitizeTTProgram(fpgm, ttContext); 41043 } 41044 if (prep) { 41045 sanitizeTTProgram(prep, ttContext); 41046 } 41047 if (fpgm) { 41048 checkInvalidFunctions(ttContext, maxFunctionDefs); 41049 } 41050 if (cvt && cvt.length & 1) { 41051 var cvtData = new Uint8Array(cvt.length + 1); 41052 cvtData.set(cvt.data); 41053 cvt.data = cvtData; 41054 } 41055 return ttContext.hintsValid; 41056 } 41057 font = new Stream(new Uint8Array(font.getBytes())); 41058 var VALID_TABLES = [ 41059 'OS/2', 41060 'cmap', 41061 'head', 41062 'hhea', 41063 'hmtx', 41064 'maxp', 41065 'name', 41066 'post', 41067 'loca', 41068 'glyf', 41069 'fpgm', 41070 'prep', 41071 'cvt ', 41072 'CFF ' 41073 ]; 41074 var header = readOpenTypeHeader(font); 41075 var numTables = header.numTables; 41076 var cff, cffFile; 41077 var tables = Object.create(null);
41078 tables['OS/2'] = null; 41079 tables['cmap'] = null; 41080 tables['head'] = null; 41081 tables['hhea'] = null; 41082 tables['hmtx'] = null; 41083 tables['maxp'] = null; 41084 tables['name'] = null; 41085 tables['post'] = null; 41086 var table; 41087 for (var i = 0; i < numTables; i++) { 41088 table = readTableEntry(font); 41089 if (VALID_TABLES.indexOf(table.tag) < 0) { 41090 continue; 41091 } 41092 if (table.length === 0) { 41093 continue; 41094 } 41095 tables[table.tag] = table; 41096 } 41097 var isTrueType = !tables['CFF ']; 41098 if (!isTrueType) { 41099 if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) { 41100 cffFile = new Stream(tables['CFF '].data); 41101 cff = new CFFFont(cffFile, properties); 41102 adjustWidths(properties); 41103 return this.convert(name, cff, properties); 41104 } 41105 delete tables['glyf']; 41106 delete tables['loca']; 41107 delete tables['fpgm']; 41108 delete tables['prep']; 41109 delete tables['cvt ']; 41110 this.isOpenType = true; 41111 } else { 41112 if (!tables['loca']) { 41113 error('Required "loca" table is not found'); 41114 } 41115 if (!tables['glyf']) { 41116 warn('Required "glyf" table is not found -- trying to recover.'); 41117 tables['glyf'] = { 41118 tag: 'glyf', 41119 data: new Uint8Array(0) 41120 }; 41121 } 41122 this.isOpenType = false;
41123 } 41124 if (!tables['maxp']) { 41125 error('Required "maxp" table is not found'); 41126 } 41127 font.pos = (font.start || 0) + tables['maxp'].offset; 41128 var version = font.getInt32(); 41129 var numGlyphs = font.getUint16(); 41130 var maxFunctionDefs = 0; 41131 if (version >= 0x00010000 && tables['maxp'].length >= 22) { 41132 font.pos += 8; 41133 var maxZones = font.getUint16(); 41134 if (maxZones > 2) { 41135 tables['maxp'].data[14] = 0; 41136 tables['maxp'].data[15] = 2; 41137 } 41138 font.pos += 4; 41139 maxFunctionDefs = font.getUint16(); 41140 } 41141 var dupFirstEntry = false; 41142 if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') { 41143 dupFirstEntry = true; 41144 numGlyphs++; 41145 tables['maxp'].data[4] = numGlyphs >> 8; 41146 tables['maxp'].data[5] = numGlyphs & 255; 41147 } 41148 var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs); 41149 if (!hintsValid) { 41150 delete tables['fpgm']; 41151 delete tables['prep']; 41152 delete tables['cvt ']; 41153 } 41154 sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs); 41155 if (!tables['head']) { 41156 error('Required "head" table is not found'); 41157 } 41158 sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0); 41159 var missingGlyphs = Object.create(null); 41160 if (isTrueType) { 41161 var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]); 41162 missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry); 41163 } 41164 if (!tables['hhea']) { 41165 error('Required "hhea" table is not found'); 41166 } 41167 if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) { 41168 tables['hhea'].data[10] = 0xFF; 41169 tables['hhea'].data[11] = 0xFF; 41170 } 41171 var metricsOverride = { 41172 unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]), 41173 yMax: int16(tables['head'].data[42], tables['head'].data[43]), 41174 yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]), 41175 ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]), 41176 descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7]) 41177 }; 41178 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 41179 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 41180 if (tables['post']) { 41181 var valid = readPostScriptTable(tables['post'], properties, numGlyphs); 41182 if (!valid) { 41183 tables['post'] = null; 41184 } 41185 } 41186 var charCodeToGlyphId = [], charCode; 41187 var toUnicode = properties.toUnicode, widths = properties.widths; 41188 var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000; 41189 function hasGlyph(glyphId, charCode, widthCode) { 41190 if (!missingGlyphs[glyphId]) { 41191 return true; 41192 } 41193 if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) { 41194 return true; 41195 } 41196 if (widths && widthCode >= 0 && isNum(widths[widthCode])) { 41197 return true; 41198 } 41199 return false; 41200 } 41201 if (properties.composite) { 41202 var cidToGidMap = properties.cidToGidMap || []; 41203 var isCidToGidMapEmpty = cidToGidMap.length === 0; 41204 properties.cMap.forEach(function (charCode, cid) { 41205 assert(cid <= 0xffff, 'Max size of CID is 65,535'); 41206 var glyphId = -1; 41207 if (isCidToGidMapEmpty) { 41208 glyphId = cid; 41209 } else if (cidToGidMap[cid] !== undefined) { 41210 glyphId = cidToGidMap[cid]; 41211 } 41212 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) { 41213 charCodeToGlyphId[charCode] = glyphId; 41214 } 41215 }); 41216 if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) { 41217 charCodeToGlyphId[0] = numGlyphs - 1; 41218 } 41219 } else { 41220 var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding); 41221 var cmapPlatformId = cmapTable.platformId; 41222 var cmapEncodingId = cmapTable.encodingId; 41223 var cmapMappings = cmapTable.mappings; 41224 var cmapMappingsLength = cmapMappings.length; 41225 if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) { 41226 var baseEncoding = []; 41227 if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') { 41228 baseEncoding = getEncoding(properties.baseEncodingName); 41229 } 41230 var glyphsUnicodeMap = getGlyphsUnicode(); 41231 for (charCode = 0; charCode < 256; charCode++) { 41232 var glyphName, standardGlyphName;
41233 if (this.differences && charCode in this.differences) { 41234 glyphName = this.differences[charCode]; 41235 } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') { 41236 glyphName = baseEncoding[charCode]; 41237 } else { 41238 glyphName = StandardEncoding[charCode]; 41239 } 41240 if (!glyphName) { 41241 continue; 41242 } 41243 standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 41244 var unicodeOrCharCode, isUnicode = false; 41245 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 41246 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 41247 isUnicode = true; 41248 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 41249 unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName); 41250 } 41251 var found = false; 41252 for (i = 0; i < cmapMappingsLength; ++i) { 41253 if (cmapMappings[i].charCode !== unicodeOrCharCode) { 41254 continue; 41255 } 41256 var code = isUnicode ? charCode : unicodeOrCharCode; 41257 if (hasGlyph(cmapMappings[i].glyphId, code, -1)) { 41258 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 41259 found = true; 41260 break; 41261 } 41262 } 41263 if (!found && properties.glyphNames) { 41264 var glyphId = properties.glyphNames.indexOf(glyphName); 41265 if (glyphId === -1 && standardGlyphName !== glyphName) { 41266 glyphId = properties.glyphNames.indexOf(standardGlyphName); 41267 } 41268 if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) { 41269 charCodeToGlyphId[charCode] = glyphId; 41270 found = true; 41271 } 41272 } 41273 if (!found) { 41274 charCodeToGlyphId[charCode] = 0; 41275 } 41276 } 41277 } else if (cmapPlatformId === 0 && cmapEncodingId === 0) { 41278 for (i = 0; i < cmapMappingsLength; ++i) { 41279 charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId; 41280 } 41281 } else { 41282 for (i = 0; i < cmapMappingsLength; ++i) { 41283 charCode = cmapMappings[i].charCode & 0xFF; 41284 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 41285 } 41286 } 41287 } 41288 if (charCodeToGlyphId.length === 0) { 41289 charCodeToGlyphId[0] = 0; 41290 } 41291 var newMapping = adjustMapping(charCodeToGlyphId, properties); 41292 this.toFontChar = newMapping.toFontChar; 41293 tables['cmap'] = { 41294 tag: 'cmap', 41295 data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs) 41296 }; 41297 if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) { 41298 tables['OS/2'] = { 41299 tag: 'OS/2', 41300 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 41301 }; 41302 } 41303 if (!tables['post']) { 41304 tables['post'] = { 41305 tag: 'post', 41306 data: createPostTable(properties) 41307 }; 41308 } 41309 if (!isTrueType) { 41310 try { 41311 cffFile = new Stream(tables['CFF '].data); 41312 var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED); 41313 cff = parser.parse(); 41314 var compiler = new CFFCompiler(cff); 41315 tables['CFF '].data = compiler.compile(); 41316 } catch (e) { 41317 warn('Failed to compile font ' + properties.loadedName); 41318 } 41319 } 41320 if (!tables['name']) { 41321 tables['name'] = { 41322 tag: 'name', 41323 data: createNameTable(this.name) 41324 }; 41325 } else { 41326 var namePrototype = readNameTable(tables['name']); 41327 tables['name'].data = createNameTable(name, namePrototype); 41328 } 41329 var builder = new OpenTypeFileBuilder(header.version); 41330 for (var tableTag in tables) { 41331 builder.addTable(tableTag, tables[tableTag].data); 41332 } 41333 return builder.toArray(); 41334 }, 41335 convert: function Font_convert(fontName, font, properties) { 41336 properties.fixedPitch = false; 41337 if (properties.builtInEncoding) { 41338 adjustToUnicode(properties, properties.builtInEncoding); 41339 } 41340 var mapping = font.getGlyphMapping(properties); 41341 var newMapping = adjustMapping(mapping, properties); 41342 this.toFontChar = newMapping.toFontChar; 41343 var numGlyphs = font.numGlyphs; 41344 function getCharCodes(charCodeToGlyphId, glyphId) {
41345 var charCodes = null; 41346 for (var charCode in charCodeToGlyphId) { 41347 if (glyphId === charCodeToGlyphId[charCode]) { 41348 if (!charCodes) { 41349 charCodes = []; 41350 } 41351 charCodes.push(charCode | 0); 41352 } 41353 } 41354 return charCodes; 41355 } 41356 function createCharCode(charCodeToGlyphId, glyphId) { 41357 for (var charCode in charCodeToGlyphId) { 41358 if (glyphId === charCodeToGlyphId[charCode]) { 41359 return charCode | 0; 41360 } 41361 } 41362 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 41363 return newMapping.nextAvailableFontCharCode++; 41364 } 41365 var seacs = font.seacs; 41366 if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { 41367 var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX; 41368 var charset = font.getCharset(); 41369 var seacMap = Object.create(null); 41370 for (var glyphId in seacs) { 41371 glyphId |= 0; 41372 var seac = seacs[glyphId]; 41373 var baseGlyphName = StandardEncoding[seac[2]]; 41374 var accentGlyphName = StandardEncoding[seac[3]]; 41375 var baseGlyphId = charset.indexOf(baseGlyphName); 41376 var accentGlyphId = charset.indexOf(accentGlyphName); 41377 if (baseGlyphId < 0 || accentGlyphId < 0) { 41378 continue; 41379 } 41380 var accentOffset = { 41381 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 41382 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 41383 }; 41384 var charCodes = getCharCodes(mapping, glyphId); 41385 if (!charCodes) { 41386 continue; 41387 } 41388 for (var i = 0, ii = charCodes.length; i < ii; i++) { 41389 var charCode = charCodes[i]; 41390 var charCodeToGlyphId = newMapping.charCodeToGlyphId; 41391 var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 41392 var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 41393 seacMap[charCode] = { 41394 baseFontCharCode: baseFontCharCode, 41395 accentFontCharCode: accentFontCharCode, 41396 accentOffset: accentOffset 41397 }; 41398 } 41399 } 41400 properties.seacMap = seacMap; 41401 } 41402 var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0]; 41403 var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F'); 41404 builder.addTable('CFF ', font.data); 41405 builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId)); 41406 builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)); 41407 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'); 41408 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)); 41409 builder.addTable('hmtx', function fontFieldsHmtx() { 41410 var charstrings = font.charstrings; 41411 var cffWidths = font.cff ? font.cff.widths : null; 41412 var hmtx = '\x00\x00\x00\x00'; 41413 for (var i = 1, ii = numGlyphs; i < ii; i++) { 41414 var width = 0; 41415 if (charstrings) { 41416 var charstring = charstrings[i - 1]; 41417 width = 'width' in charstring ? charstring.width : 0; 41418 } else if (cffWidths) { 41419 width = Math.ceil(cffWidths[i] || 0); 41420 } 41421 hmtx += string16(width) + string16(0); 41422 } 41423 return hmtx; 41424 }()); 41425 builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs)); 41426 builder.addTable('name', createNameTable(fontName)); 41427 builder.addTable('post', createPostTable(properties)); 41428 return builder.toArray(); 41429 }, 41430 get spaceWidth() { 41431 if ('_shadowWidth' in this) { 41432 return this._shadowWidth; 41433 } 41434 var possibleSpaceReplacements = [ 41435 'space', 41436 'minus', 41437 'one', 41438 'i', 41439 'I' 41440 ]; 41441 var width; 41442 for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { 41443 var glyphName = possibleSpaceReplacements[i]; 41444 if (glyphName in this.widths) { 41445 width = this.widths[glyphName]; 41446 break; 41447 } 41448 var glyphsUnicodeMap = getGlyphsUnicode(); 41449 var glyphUnicode = glyphsUnicodeMap[glyphName]; 41450 var charcode = 0; 41451 if (this.composite) { 41452 if (this.cMap.contains(glyphUnicode)) { 41453 charcode = this.cMap.lookup(glyphUnicode); 41454 } 41455 } 41456 if (!charcode && this.toUnicode) { 41457 charcode = this.toUnicode.charCodeOf(glyphUnicode); 41458 } 41459 if (charcode <= 0) { 41460 charcode = glyphUnicode; 41461 } 41462 width = this.widths[charcode]; 41463 if (width) { 41464 break; 41465 } 41466 } 41467 width = width || this.defaultWidth; 41468 this._shadowWidth = width; 41469 return width; 41470 }, 41471 charToGlyph: function Font_charToGlyph(charcode, isSpace) { 41472 var fontCharCode, width, operatorListId;
41473 var widthCode = charcode; 41474 if (this.cMap && this.cMap.contains(charcode)) { 41475 widthCode = this.cMap.lookup(charcode); 41476 } 41477 width = this.widths[widthCode]; 41478 width = isNum(width) ? width : this.defaultWidth; 41479 var vmetric = this.vmetrics && this.vmetrics[widthCode]; 41480 var unicode = this.toUnicode.get(charcode) || charcode; 41481 if (typeof unicode === 'number') { 41482 unicode = String.fromCharCode(unicode); 41483 } 41484 var isInFont = charcode in this.toFontChar; 41485 fontCharCode = this.toFontChar[charcode] || charcode; 41486 if (this.missingFile) { 41487 fontCharCode = mapSpecialUnicodeValues(fontCharCode); 41488 } 41489 if (this.isType3Font) { 41490 operatorListId = fontCharCode; 41491 } 41492 var accent = null; 41493 if (this.seacMap && this.seacMap[charcode]) { 41494 isInFont = true; 41495 var seac = this.seacMap[charcode]; 41496 fontCharCode = seac.baseFontCharCode; 41497 accent = { 41498 fontChar: String.fromCharCode(seac.accentFontCharCode), 41499 offset: seac.accentOffset 41500 }; 41501 } 41502 var fontChar = String.fromCharCode(fontCharCode); 41503 var glyph = this.glyphCache[charcode]; 41504 if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { 41505 glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 41506 this.glyphCache[charcode] = glyph; 41507 } 41508 return glyph; 41509 }, 41510 charsToGlyphs: function Font_charsToGlyphs(chars) { 41511 var charsCache = this.charsCache; 41512 var glyphs, glyph, charcode; 41513 if (charsCache) { 41514 glyphs = charsCache[chars]; 41515 if (glyphs) { 41516 return glyphs; 41517 } 41518 } 41519 if (!charsCache) { 41520 charsCache = this.charsCache = Object.create(null); 41521 } 41522 glyphs = []; 41523 var charsCacheKey = chars; 41524 var i = 0, ii; 41525 if (this.cMap) { 41526 var c = Object.create(null); 41527 while (i < chars.length) { 41528 this.cMap.readCharCode(chars, i, c); 41529 charcode = c.charcode; 41530 var length = c.length; 41531 i += length; 41532 var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20; 41533 glyph = this.charToGlyph(charcode, isSpace); 41534 glyphs.push(glyph); 41535 } 41536 } else { 41537 for (i = 0, ii = chars.length; i < ii; ++i) { 41538 charcode = chars.charCodeAt(i); 41539 glyph = this.charToGlyph(charcode, charcode === 0x20); 41540 glyphs.push(glyph); 41541 } 41542 } 41543 return charsCache[charsCacheKey] = glyphs; 41544 } 41545 }; 41546 return Font; 41547 }(); 41548 var ErrorFont = function ErrorFontClosure() { 41549 function ErrorFont(error) { 41550 this.error = error; 41551 this.loadedName = 'g_font_error'; 41552 this.loading = false; 41553 } 41554 ErrorFont.prototype = { 41555 charsToGlyphs: function ErrorFont_charsToGlyphs() { 41556 return []; 41557 }, 41558 exportData: function ErrorFont_exportData() { 41559 return { error: this.error }; 41560 } 41561 }; 41562 return ErrorFont; 41563 }(); 41564 function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 41565 var charCodeToGlyphId = Object.create(null); 41566 var glyphId, charCode, baseEncoding; 41567 var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 41568 if (properties.baseEncodingName) { 41569 baseEncoding = getEncoding(properties.baseEncodingName); 41570 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 41571 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 41572 if (glyphId >= 0) { 41573 charCodeToGlyphId[charCode] = glyphId; 41574 } else { 41575 charCodeToGlyphId[charCode] = 0; 41576 } 41577 } 41578 } else if (isSymbolicFont) { 41579 for (charCode in builtInEncoding) { 41580 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 41581 } 41582 } else { 41583 baseEncoding = StandardEncoding; 41584 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 41585 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 41586 if (glyphId >= 0) { 41587 charCodeToGlyphId[charCode] = glyphId; 41588 } else { 41589 charCodeToGlyphId[charCode] = 0; 41590 } 41591 } 41592 } 41593 var differences = properties.differences, glyphsUnicodeMap; 41594 if (differences) { 41595 for (charCode in differences) { 41596 var glyphName = differences[charCode]; 41597 glyphId = glyphNames.indexOf(glyphName); 41598 if (glyphId === -1) { 41599 if (!glyphsUnicodeMap) { 41600 glyphsUnicodeMap = getGlyphsUnicode(); 41601 } 41602 var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 41603 if (standardGlyphName !== glyphName) { 41604 glyphId = glyphNames.indexOf(standardGlyphName); 41605 } 41606 } 41607 if (glyphId >= 0) {
41608 charCodeToGlyphId[charCode] = glyphId; 41609 } else { 41610 charCodeToGlyphId[charCode] = 0; 41611 } 41612 } 41613 } 41614 return charCodeToGlyphId; 41615 } 41616 var Type1Font = function Type1FontClosure() { 41617 function findBlock(streamBytes, signature, startIndex) { 41618 var streamBytesLength = streamBytes.length; 41619 var signatureLength = signature.length; 41620 var scanLength = streamBytesLength - signatureLength; 41621 var i = startIndex, j, found = false; 41622 while (i < scanLength) { 41623 j = 0; 41624 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 41625 j++; 41626 } 41627 if (j >= signatureLength) { 41628 i += j; 41629 while (i < streamBytesLength && isSpace(streamBytes[i])) { 41630 i++; 41631 } 41632 found = true; 41633 break; 41634 } 41635 i++; 41636 } 41637 return { 41638 found: found, 41639 length: i 41640 }; 41641 } 41642 function getHeaderBlock(stream, suggestedLength) { 41643 var EEXEC_SIGNATURE = [ 41644 0x65, 41645 0x65, 41646 0x78, 41647 0x65, 41648 0x63 41649 ]; 41650 var streamStartPos = stream.pos; 41651 var headerBytes, headerBytesLength, block; 41652 try { 41653 headerBytes = stream.getBytes(suggestedLength); 41654 headerBytesLength = headerBytes.length; 41655 } catch (ex) { 41656 if (ex instanceof MissingDataException) { 41657 throw ex; 41658 } 41659 } 41660 if (headerBytesLength === suggestedLength) { 41661 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 41662 if (block.found && block.length === suggestedLength) { 41663 return { 41664 stream: new Stream(headerBytes), 41665 length: suggestedLength 41666 }; 41667 } 41668 } 41669 warn('Invalid "Length1" property in Type1 font -- trying to recover.'); 41670 stream.pos = streamStartPos; 41671 var SCAN_BLOCK_LENGTH = 2048; 41672 var actualLength; 41673 while (true) { 41674 var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 41675 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 41676 if (block.length === 0) { 41677 break; 41678 } 41679 stream.pos += block.length; 41680 if (block.found) { 41681 actualLength = stream.pos - streamStartPos; 41682 break; 41683 } 41684 } 41685 stream.pos = streamStartPos; 41686 if (actualLength) { 41687 return { 41688 stream: new Stream(stream.getBytes(actualLength)), 41689 length: actualLength 41690 }; 41691 } 41692 warn('Unable to recover "Length1" property in Type1 font -- using as is.'); 41693 return { 41694 stream: new Stream(stream.getBytes(suggestedLength)), 41695 length: suggestedLength 41696 }; 41697 } 41698 function getEexecBlock(stream, suggestedLength) { 41699 var eexecBytes = stream.getBytes(); 41700 return { 41701 stream: new Stream(eexecBytes), 41702 length: eexecBytes.length 41703 }; 41704 } 41705 function Type1Font(name, file, properties) { 41706 var PFB_HEADER_SIZE = 6; 41707 var headerBlockLength = properties.length1; 41708 var eexecBlockLength = properties.length2; 41709 var pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 41710 var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 41711 if (pfbHeaderPresent) { 41712 file.skip(PFB_HEADER_SIZE); 41713 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 41714 } 41715 var headerBlock = getHeaderBlock(file, headerBlockLength); 41716 headerBlockLength = headerBlock.length; 41717 var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED); 41718 headerBlockParser.extractFontHeader(properties); 41719 if (pfbHeaderPresent) { 41720 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 41721 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 41722 } 41723 var eexecBlock = getEexecBlock(file, eexecBlockLength); 41724 eexecBlockLength = eexecBlock.length; 41725 var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED); 41726 var data = eexecBlockParser.extractFontProgram(); 41727 for (var info in data.properties) { 41728 properties[info] = data.properties[info]; 41729 } 41730 var charstrings = data.charstrings; 41731 var type2Charstrings = this.getType2Charstrings(charstrings); 41732 var subrs = this.getType2Subrs(data.subrs); 41733 this.charstrings = charstrings; 41734 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
41735 this.seacs = this.getSeacs(data.charstrings); 41736 } 41737 Type1Font.prototype = { 41738 get numGlyphs() { 41739 return this.charstrings.length + 1; 41740 }, 41741 getCharset: function Type1Font_getCharset() { 41742 var charset = ['.notdef']; 41743 var charstrings = this.charstrings; 41744 for (var glyphId = 0; glyphId < charstrings.length; glyphId++) { 41745 charset.push(charstrings[glyphId].glyphName); 41746 } 41747 return charset; 41748 }, 41749 getGlyphMapping: function Type1Font_getGlyphMapping(properties) { 41750 var charstrings = this.charstrings; 41751 var glyphNames = ['.notdef'], glyphId; 41752 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 41753 glyphNames.push(charstrings[glyphId].glyphName); 41754 } 41755 var encoding = properties.builtInEncoding; 41756 if (encoding) { 41757 var builtInEncoding = Object.create(null); 41758 for (var charCode in encoding) { 41759 glyphId = glyphNames.indexOf(encoding[charCode]); 41760 if (glyphId >= 0) { 41761 builtInEncoding[charCode] = glyphId; 41762 } 41763 } 41764 } 41765 return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); 41766 }, 41767 getSeacs: function Type1Font_getSeacs(charstrings) { 41768 var i, ii; 41769 var seacMap = []; 41770 for (i = 0, ii = charstrings.length; i < ii; i++) { 41771 var charstring = charstrings[i]; 41772 if (charstring.seac) { 41773 seacMap[i + 1] = charstring.seac; 41774 } 41775 } 41776 return seacMap; 41777 }, 41778 getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) { 41779 var type2Charstrings = []; 41780 for (var i = 0, ii = type1Charstrings.length; i < ii; i++) { 41781 type2Charstrings.push(type1Charstrings[i].charstring); 41782 } 41783 return type2Charstrings; 41784 }, 41785 getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) { 41786 var bias = 0; 41787 var count = type1Subrs.length; 41788 if (count < 1133) { 41789 bias = 107; 41790 } else if (count < 33769) { 41791 bias = 1131; 41792 } else { 41793 bias = 32768; 41794 } 41795 var type2Subrs = []; 41796 var i; 41797 for (i = 0; i < bias; i++) { 41798 type2Subrs.push([0x0B]); 41799 } 41800 for (i = 0; i < count; i++) { 41801 type2Subrs.push(type1Subrs[i]); 41802 } 41803 return type2Subrs; 41804 }, 41805 wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) { 41806 var cff = new CFF(); 41807 cff.header = new CFFHeader(1, 0, 4, 4); 41808 cff.names = [name]; 41809 var topDict = new CFFTopDict(); 41810 topDict.setByName('version', 391); 41811 topDict.setByName('Notice', 392); 41812 topDict.setByName('FullName', 393); 41813 topDict.setByName('FamilyName', 394); 41814 topDict.setByName('Weight', 395); 41815 topDict.setByName('Encoding', null); 41816 topDict.setByName('FontMatrix', properties.fontMatrix); 41817 topDict.setByName('FontBBox', properties.bbox); 41818 topDict.setByName('charset', null); 41819 topDict.setByName('CharStrings', null); 41820 topDict.setByName('Private', null); 41821 cff.topDict = topDict; 41822 var strings = new CFFStrings(); 41823 strings.add('Version 0.11'); 41824 strings.add('See original notice'); 41825 strings.add(name); 41826 strings.add(name); 41827 strings.add('Medium'); 41828 cff.strings = strings; 41829 cff.globalSubrIndex = new CFFIndex(); 41830 var count = glyphs.length; 41831 var charsetArray = [0]; 41832 var i, ii; 41833 for (i = 0; i < count; i++) { 41834 var index = CFFStandardStrings.indexOf(charstrings[i].glyphName); 41835 if (index === -1) { 41836 index = 0; 41837 } 41838 charsetArray.push(index >> 8 & 0xff, index & 0xff); 41839 } 41840 cff.charset = new CFFCharset(false, 0, [], charsetArray); 41841 var charStringsIndex = new CFFIndex(); 41842 charStringsIndex.add([ 41843 0x8B, 41844 0x0E 41845 ]); 41846 for (i = 0; i < count; i++) { 41847 var glyph = glyphs[i]; 41848 if (glyph.length === 0) { 41849 charStringsIndex.add([ 41850 0x8B, 41851 0x0E 41852 ]); 41853 continue; 41854 } 41855 charStringsIndex.add(glyph); 41856 } 41857 cff.charStrings = charStringsIndex; 41858 var privateDict = new CFFPrivateDict(); 41859 privateDict.setByName('Subrs', null); 41860 var fields = [ 41861 'BlueValues', 41862 'OtherBlues', 41863 'FamilyBlues', 41864 'FamilyOtherBlues', 41865 'StemSnapH', 41866 'StemSnapV', 41867 'BlueShift', 41868 'BlueFuzz', 41869 'BlueScale', 41870 'LanguageGroup', 41871 'ExpansionFactor', 41872 'ForceBold', 41873 'StdHW', 41874 'StdVW' 41875 ]; 41876 for (i = 0, ii = fields.length; i < ii; i++) { 41877 var field = fields[i]; 41878 if (!(field in properties.privateData)) { 41879 continue; 41880 } 41881 var value = properties.privateData[field]; 41882 if (isArray(value)) { 41883 for (var j = value.length - 1; j > 0; j--) { 41884 value[j] -= value[j - 1]; 41885 } 41886 } 41887 privateDict.setByName(field, value); 41888 } 41889 cff.topDict.privateDict = privateDict; 41890 var subrIndex = new CFFIndex(); 41891 for (i = 0, ii = subrs.length; i < ii; i++) { 41892 subrIndex.add(subrs[i]); 41893 } 41894 privateDict.subrsIndex = subrIndex; 41895 var compiler = new CFFCompiler(cff); 41896 return compiler.compile(); 41897 } 41898 }; 41899 return Type1Font; 41900 }(); 41901 var CFFFont = function CFFFontClosure() { 41902 function CFFFont(file, properties) { 41903 this.properties = properties; 41904 var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED); 41905 this.cff = parser.parse(); 41906 var compiler = new CFFCompiler(this.cff); 41907 this.seacs = this.cff.seacs; 41908 try { 41909 this.data = compiler.compile(); 41910 } catch (e) { 41911 warn('Failed to compile font ' + properties.loadedName); 41912 this.data = file; 41913 } 41914 } 41915 CFFFont.prototype = { 41916 get numGlyphs() { 41917 return this.cff.charStrings.count; 41918 },
41919 getCharset: function CFFFont_getCharset() { 41920 return this.cff.charset.charset; 41921 }, 41922 getGlyphMapping: function CFFFont_getGlyphMapping() { 41923 var cff = this.cff; 41924 var properties = this.properties; 41925 var charsets = cff.charset.charset; 41926 var charCodeToGlyphId; 41927 var glyphId; 41928 if (properties.composite) { 41929 charCodeToGlyphId = Object.create(null); 41930 if (cff.isCIDFont) { 41931 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 41932 var cid = charsets[glyphId]; 41933 var charCode = properties.cMap.charCodeOf(cid); 41934 charCodeToGlyphId[charCode] = glyphId; 41935 } 41936 } else { 41937 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 41938 charCodeToGlyphId[glyphId] = glyphId; 41939 } 41940 } 41941 return charCodeToGlyphId; 41942 } 41943 var encoding = cff.encoding ? cff.encoding.encoding : null; 41944 charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); 41945 return charCodeToGlyphId; 41946 } 41947 }; 41948 return CFFFont; 41949 }(); 41950 (function checkSeacSupport() { 41951 if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) { 41952 SEAC_ANALYSIS_ENABLED = true; 41953 } 41954 }()); 41955 (function checkChromeWindows() { 41956 if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) { 41957 SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true; 41958 } 41959 }()); 41960 exports.ErrorFont = ErrorFont; 41961 exports.Font = Font; 41962 exports.FontFlags = FontFlags; 41963 exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 41964 exports.ToUnicodeMap = ToUnicodeMap; 41965 exports.getFontType = getFontType; 41966 })); 41967 (function (root, factory) { 41968 factory(root.pdfjsCoreImage = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreColorSpace, root.pdfjsCoreStream, root.pdfjsCoreJpx); 41969 }(this, function (exports, sharedUtil, corePrimitives, coreColorSpace, coreStream, coreJpx) { 41970 var ImageKind = sharedUtil.ImageKind; 41971 var assert = sharedUtil.assert; 41972 var error = sharedUtil.error; 41973 var info = sharedUtil.info; 41974 var isArray = sharedUtil.isArray; 41975 var warn = sharedUtil.warn; 41976 var Name = corePrimitives.Name; 41977 var isStream = corePrimitives.isStream; 41978 var ColorSpace = coreColorSpace.ColorSpace; 41979 var DecodeStream = coreStream.DecodeStream; 41980 var JpegStream = coreStream.JpegStream; 41981 var JpxImage = coreJpx.JpxImage; 41982 var PDFImage = function PDFImageClosure() { 41983 function handleImageData(image, nativeDecoder) { 41984 if (nativeDecoder && nativeDecoder.canDecode(image)) { 41985 return nativeDecoder.decode(image); 41986 } 41987 return Promise.resolve(image); 41988 } 41989 function decodeAndClamp(value, addend, coefficient, max) { 41990 value = addend + value * coefficient; 41991 return value < 0 ? 0 : value > max ? max : value; 41992 } 41993 function resizeImageMask(src, bpc, w1, h1, w2, h2) { 41994 var length = w2 * h2; 41995 var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length); 41996 var xRatio = w1 / w2; 41997 var yRatio = h1 / h2; 41998 var i, j, py, newIndex = 0, oldIndex; 41999 var xScaled = new Uint16Array(w2); 42000 var w1Scanline = w1; 42001 for (i = 0; i < w2; i++) { 42002 xScaled[i] = Math.floor(i * xRatio); 42003 } 42004 for (i = 0; i < h2; i++) { 42005 py = Math.floor(i * yRatio) * w1Scanline; 42006 for (j = 0; j < w2; j++) { 42007 oldIndex = py + xScaled[j]; 42008 dest[newIndex++] = src[oldIndex]; 42009 } 42010 } 42011 return dest; 42012 } 42013 function PDFImage(xref, res, image, inline, smask, mask, isMask) { 42014 this.image = image; 42015 var dict = image.dict; 42016 if (dict.has('Filter')) { 42017 var filter = dict.get('Filter').name; 42018 if (filter === 'JPXDecode') { 42019 var jpxImage = new JpxImage(); 42020 jpxImage.parseImageProperties(image.stream); 42021 image.stream.reset(); 42022 image.bitsPerComponent = jpxImage.bitsPerComponent; 42023 image.numComps = jpxImage.componentsCount; 42024 } else if (filter === 'JBIG2Decode') { 42025 image.bitsPerComponent = 1; 42026 image.numComps = 1; 42027 } 42028 } 42029 this.width = dict.get('Width', 'W'); 42030 this.height = dict.get('Height', 'H'); 42031 if (this.width < 1 || this.height < 1) { 42032 error('Invalid image width: ' + this.width + ' or height: ' + this.height); 42033 } 42034 this.interpolate = dict.get('Interpolate', 'I') || false; 42035 this.imageMask = dict.get('ImageMask', 'IM') || false; 42036 this.matte = dict.get('Matte') || false; 42037 var bitsPerComponent = image.bitsPerComponent; 42038 if (!bitsPerComponent) {
42039 bitsPerComponent = dict.get('BitsPerComponent', 'BPC'); 42040 if (!bitsPerComponent) { 42041 if (this.imageMask) { 42042 bitsPerComponent = 1; 42043 } else { 42044 error('Bits per component missing in image: ' + this.imageMask); 42045 } 42046 } 42047 } 42048 this.bpc = bitsPerComponent; 42049 if (!this.imageMask) { 42050 var colorSpace = dict.get('ColorSpace', 'CS'); 42051 if (!colorSpace) { 42052 info('JPX images (which do not require color spaces)'); 42053 switch (image.numComps) { 42054 case 1: 42055 colorSpace = Name.get('DeviceGray'); 42056 break; 42057 case 3: 42058 colorSpace = Name.get('DeviceRGB'); 42059 break; 42060 case 4: 42061 colorSpace = Name.get('DeviceCMYK'); 42062 break; 42063 default: 42064 error('JPX images with ' + this.numComps + ' color components not supported.'); 42065 } 42066 } 42067 this.colorSpace = ColorSpace.parse(colorSpace, xref, res); 42068 this.numComps = this.colorSpace.numComps; 42069 } 42070 this.decode = dict.getArray('Decode', 'D'); 42071 this.needsDecode = false; 42072 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) { 42073 this.needsDecode = true; 42074 var max = (1 << bitsPerComponent) - 1; 42075 this.decodeCoefficients = []; 42076 this.decodeAddends = []; 42077 for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 42078 var dmin = this.decode[i]; 42079 var dmax = this.decode[i + 1]; 42080 this.decodeCoefficients[j] = dmax - dmin; 42081 this.decodeAddends[j] = max * dmin; 42082 } 42083 } 42084 if (smask) { 42085 this.smask = new PDFImage(xref, res, smask, false); 42086 } else if (mask) { 42087 if (isStream(mask)) { 42088 var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM'); 42089 if (!imageMask) { 42090 warn('Ignoring /Mask in image without /ImageMask.'); 42091 } else { 42092 this.mask = new PDFImage(xref, res, mask, false, null, null, true); 42093 } 42094 } else { 42095 this.mask = mask; 42096 } 42097 } 42098 } 42099 PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) { 42100 var imagePromise = handleImageData(image, nativeDecoder); 42101 var smaskPromise; 42102 var maskPromise; 42103 var smask = image.dict.get('SMask'); 42104 var mask = image.dict.get('Mask'); 42105 if (smask) { 42106 smaskPromise = handleImageData(smask, nativeDecoder); 42107 maskPromise = Promise.resolve(null); 42108 } else { 42109 smaskPromise = Promise.resolve(null); 42110 if (mask) { 42111 if (isStream(mask)) { 42112 maskPromise = handleImageData(mask, nativeDecoder); 42113 } else if (isArray(mask)) { 42114 maskPromise = Promise.resolve(mask); 42115 } else { 42116 warn('Unsupported mask format.'); 42117 maskPromise = Promise.resolve(null); 42118 } 42119 } else { 42120 maskPromise = Promise.resolve(null); 42121 } 42122 } 42123 return Promise.all([ 42124 imagePromise, 42125 smaskPromise, 42126 maskPromise 42127 ]).then(function (results) { 42128 var imageData = results[0]; 42129 var smaskData = results[1]; 42130 var maskData = results[2]; 42131 return new PDFImage(xref, res, imageData, inline, smaskData, maskData); 42132 }); 42133 }; 42134 PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) { 42135 var computedLength = (width + 7 >> 3) * height; 42136 var actualLength = imgArray.byteLength; 42137 var haveFullData = computedLength === actualLength; 42138 var data, i; 42139 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 42140 data = imgArray; 42141 } else if (!inverseDecode) { 42142 data = new Uint8Array(actualLength); 42143 data.set(imgArray); 42144 } else { 42145 data = new Uint8Array(computedLength); 42146 data.set(imgArray); 42147 for (i = actualLength; i < computedLength; i++) { 42148 data[i] = 0xff; 42149 } 42150 } 42151 if (inverseDecode) { 42152 for (i = 0; i < actualLength; i++) { 42153 data[i] = ~data[i]; 42154 } 42155 } 42156 return { 42157 data: data, 42158 width: width, 42159 height: height 42160 }; 42161 }; 42162 PDFImage.prototype = { 42163 get drawWidth() { 42164 return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0); 42165 }, 42166 get drawHeight() { 42167 return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0
42167); 42168 }, 42169 decodeBuffer: function PDFImage_decodeBuffer(buffer) { 42170 var bpc = this.bpc; 42171 var numComps = this.numComps; 42172 var decodeAddends = this.decodeAddends; 42173 var decodeCoefficients = this.decodeCoefficients; 42174 var max = (1 << bpc) - 1; 42175 var i, ii; 42176 if (bpc === 1) { 42177 for (i = 0, ii = buffer.length; i < ii; i++) { 42178 buffer[i] = +!buffer[i]; 42179 } 42180 return; 42181 } 42182 var index = 0; 42183 for (i = 0, ii = this.width * this.height; i < ii; i++) { 42184 for (var j = 0; j < numComps; j++) { 42185 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 42186 index++; 42187 } 42188 } 42189 }, 42190 getComponents: function PDFImage_getComponents(buffer) { 42191 var bpc = this.bpc; 42192 if (bpc === 8) { 42193 return buffer; 42194 } 42195 var width = this.width; 42196 var height = this.height; 42197 var numComps = this.numComps; 42198 var length = width * height * numComps; 42199 var bufferPos = 0; 42200 var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length); 42201 var rowComps = width * numComps; 42202 var max = (1 << bpc) - 1; 42203 var i = 0, ii, buf; 42204 if (bpc === 1) { 42205 var mask, loop1End, loop2End; 42206 for (var j = 0; j < height; j++) { 42207 loop1End = i + (rowComps & ~7); 42208 loop2End = i + rowComps; 42209 while (i < loop1End) { 42210 buf = buffer[bufferPos++]; 42211 output[i] = buf >> 7 & 1; 42212 output[i + 1] = buf >> 6 & 1; 42213 output[i + 2] = buf >> 5 & 1; 42214 output[i + 3] = buf >> 4 & 1; 42215 output[i + 4] = buf >> 3 & 1; 42216 output[i + 5] = buf >> 2 & 1; 42217 output[i + 6] = buf >> 1 & 1; 42218 output[i + 7] = buf & 1; 42219 i += 8; 42220 } 42221 if (i < loop2End) { 42222 buf = buffer[bufferPos++]; 42223 mask = 128; 42224 while (i < loop2End) { 42225 output[i++] = +!!(buf & mask); 42226 mask >>= 1; 42227 } 42228 } 42229 } 42230 } else { 42231 var bits = 0; 42232 buf = 0; 42233 for (i = 0, ii = length; i < ii; ++i) { 42234 if (i % rowComps === 0) { 42235 buf = 0; 42236 bits = 0; 42237 } 42238 while (bits < bpc) { 42239 buf = buf << 8 | buffer[bufferPos++]; 42240 bits += 8; 42241 } 42242 var remainingBits = bits - bpc; 42243 var value = buf >> remainingBits; 42244 output[i] = value < 0 ? 0 : value > max ? max : value; 42245 buf = buf & (1 << remainingBits) - 1; 42246 bits = remainingBits; 42247 } 42248 } 42249 return output; 42250 }, 42251 fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) { 42252 var smask = this.smask; 42253 var mask = this.mask; 42254 var alphaBuf, sw, sh, i, ii, j; 42255 if (smask) { 42256 sw = smask.width; 42257 sh = smask.height; 42258 alphaBuf = new Uint8Array(sw * sh); 42259 smask.fillGrayBuffer(alphaBuf); 42260 if (sw !== width || sh !== height) { 42261 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 42262 } 42263 } else if (mask) { 42264 if (mask instanceof PDFImage) { 42265 sw = mask.width; 42266 sh = mask.height; 42267 alphaBuf = new Uint8Array(sw * sh); 42268 mask.numComps = 1; 42269 mask.fillGrayBuffer(alphaBuf); 42270 for (i = 0, ii = sw * sh; i < ii; ++i) { 42271 alphaBuf[i] = 255 - alphaBuf[i]; 42272 } 42273 if (sw !== width || sh !== height) { 42274 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 42275 } 42276 } else if (isArray(mask)) { 42277 alphaBuf = new Uint8Array(width * height); 42278 var numComps = this.numComps; 42279 for (i = 0, ii = width * height; i < ii; ++i) { 42280 var opacity = 0; 42281 var imageOffset = i * numComps; 42282 for (j = 0; j < numComps; ++j) { 42283 var color = image[imageOffset + j]; 42284 var maskOffset = j * 2; 42285 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 42286 opacity = 255; 42287 break; 42288 } 42289 } 42290 alphaBuf[i] = opacity; 42291 } 42292 } else { 42293 error('Unknown mask format.'); 42294 } 42295 } 42296 if (alphaBuf) { 42297 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 42298 rgbaBuf[j] = alphaBuf[i]; 42299 } 42300 } else { 42301 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 42302 rgbaBuf[j] = 255; 42303 } 42304 } 42305 }, 42306 undoPreblend: function PDFImage_undoPreblend(buffer, width, height) { 42307 var matte = this.smask && this.smask.matte; 42308 if (!matte) { 42309 return; 42310 } 42311 var matteRgb = this.colorSpace.getRgb(matte, 0); 42312 var matteR = matteRgb[0]; 42313 var matteG = matteRgb[1]; 42314 var matteB = matteRgb[2]; 42315 var length = width * height * 4; 42316 var r, g, b; 42317 for (var i = 0; i < length; i += 4) { 42318 var alpha = buffer[i + 3]; 42319 if (alpha === 0) { 42320 buffer[i] = 255; 42321 buffer[i + 1] = 255; 42322 buffer[i + 2] = 255; 42323 continue; 42324 } 42325 var k = 255 / alpha; 42326 r = (buffer[i] - matteR) * k + matteR; 42327 g = (buffer[i + 1] - matteG) * k + matteG; 42328 b = (buffer[i + 2] - matteB) * k + matteB; 42329 buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0; 42330 buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0; 42331 buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0; 42332 } 42333 }, 42334 createImageData: function PDFImage_createImageData(forceRGBA) { 42335 var drawWidth = this.drawWidth; 42336 var drawHeight = this.drawHeight; 42337 var imgData = { 42338 width: drawWidth, 42339 height: drawHeight 42340 }; 42341 var numComps = this.numComps; 42342 var originalWidth = this.width; 42343 var originalHeight = this.height; 42344 var bpc = this.bpc; 42345 var rowBytes = originalWidth * numComps * bpc + 7 >> 3; 42346 var imgArray; 42347 if (!forceRGBA) { 42348 var kind; 42349 if (this.colorSpace.name === 'DeviceGray' && bpc === 1) { 42350 kind = ImageKind.GRAYSCALE_1BPP; 42351 } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) { 42352 kind = ImageKind.RGB_24BPP; 42353 } 42354 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 42355 imgData.kind = kind; 42356 imgArray = this.getImageBytes(originalHeight * rowBytes); 42357 if (this.image instanceof DecodeStream) { 42358 imgData.data = imgArray; 42359 } else { 42360 var newArray = new Uint8Array(imgArray.length); 42361 newArray.set(imgArray); 42362 imgData.data = newArray; 42363 } 42364 if (this.needsDecode) { 42365 assert(kind === ImageKind.GRAYSCALE_1BPP); 42366 var buffer = imgData.data; 42367 for (var i = 0, ii = buffer.length; i < ii; i++) { 42368 buffer[i] ^= 0xff; 42369 } 42370 } 42371 return imgData; 42372 } 42373 if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) { 42374 imgData.kind = ImageKind.RGB_24BPP; 42375 imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true); 42376 return imgData; 42377 } 42378 } 42379 imgArray = this.getImageBytes(originalHeight * rowBytes); 42380 var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 42381 var comps = this.getComponents(imgArray); 42382 var alpha01, maybeUndoPreblend; 42383 if (!forceRGBA && !this.smask && !this.mask) { 42384 imgData.kind = ImageKind.RGB_24BPP; 42385 imgData.data = new Uint8Array(drawWidth * drawHeight * 3); 42386 alpha01 = 0; 42387 maybeUndoPreblend = false;
42388 } else { 42389 imgData.kind = ImageKind.RGBA_32BPP; 42390 imgData.data = new Uint8Array(drawWidth * drawHeight * 4); 42391 alpha01 = 1; 42392 maybeUndoPreblend = true; 42393 this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps); 42394 } 42395 if (this.needsDecode) { 42396 this.decodeBuffer(comps); 42397 } 42398 this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 42399 if (maybeUndoPreblend) { 42400 this.undoPreblend(imgData.data, drawWidth, actualHeight); 42401 } 42402 return imgData; 42403 }, 42404 fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) { 42405 var numComps = this.numComps; 42406 if (numComps !== 1) { 42407 error('Reading gray scale from a color image: ' + numComps); 42408 } 42409 var width = this.width; 42410 var height = this.height; 42411 var bpc = this.bpc; 42412 var rowBytes = width * numComps * bpc + 7 >> 3; 42413 var imgArray = this.getImageBytes(height * rowBytes); 42414 var comps = this.getComponents(imgArray); 42415 var i, length; 42416 if (bpc === 1) { 42417 length = width * height; 42418 if (this.needsDecode) { 42419 for (i = 0; i < length; ++i) { 42420 buffer[i] = comps[i] - 1 & 255; 42421 } 42422 } else { 42423 for (i = 0; i < length; ++i) { 42424 buffer[i] = -comps[i] & 255; 42425 } 42426 } 42427 return; 42428 } 42429 if (this.needsDecode) { 42430 this.decodeBuffer(comps); 42431 } 42432 length = width * height; 42433 var scale = 255 / ((1 << bpc) - 1); 42434 for (i = 0; i < length; ++i) { 42435 buffer[i] = scale * comps[i] | 0; 42436 } 42437 }, 42438 getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) { 42439 this.image.reset(); 42440 this.image.drawWidth = drawWidth || this.width; 42441 this.image.drawHeight = drawHeight || this.height; 42442 this.image.forceRGB = !!forceRGB; 42443 return this.image.getBytes(length); 42444 } 42445 }; 42446 return PDFImage; 42447 }(); 42448 exports.PDFImage = PDFImage; 42449 })); 42450 (function (root, factory) { 42451 factory(root.pdfjsCoreObj = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreCrypto, root.pdfjsCoreParser, root.pdfjsCoreChunkedStream, root.pdfjsCoreColorSpace); 42452 }(this, function (exports, sharedUtil, corePrimitives, coreCrypto, coreParser, coreChunkedStream, coreColorSpace) { 42453 var InvalidPDFException = sharedUtil.InvalidPDFException; 42454 var MissingDataException = sharedUtil.MissingDataException; 42455 var XRefParseException = sharedUtil.XRefParseException; 42456 var assert = sharedUtil.assert; 42457 var bytesToString = sharedUtil.bytesToString; 42458 var createPromiseCapability = sharedUtil.createPromiseCapability; 42459 var error = sharedUtil.error; 42460 var info = sharedUtil.info; 42461 var isArray = sharedUtil.isArray; 42462 var isBool = sharedUtil.isBool; 42463 var isInt = sharedUtil.isInt; 42464 var isString = sharedUtil.isString; 42465 var shadow = sharedUtil.shadow; 42466 var stringToPDFString = sharedUtil.stringToPDFString; 42467 var stringToUTF8String = sharedUtil.stringToUTF8String; 42468 var warn = sharedUtil.warn; 42469 var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl; 42470 var Util = sharedUtil.Util; 42471 var Ref = corePrimitives.Ref; 42472 var RefSet = corePrimitives.RefSet; 42473 var RefSetCache = corePrimitives.RefSetCache; 42474 var isName = corePrimitives.isName; 42475 var isCmd = corePrimitives.isCmd; 42476 var isDict = corePrimitives.isDict; 42477 var isRef = corePrimitives.isRef; 42478 var isRefsEqual = corePrimitives.isRefsEqual; 42479 var isStream = corePrimitives.isStream; 42480 var CipherTransformFactory = coreCrypto.CipherTransformFactory; 42481 var Lexer = coreParser.Lexer; 42482 var Parser = coreParser.Parser; 42483 var ChunkedStream = coreChunkedStream.ChunkedStream; 42484 var ColorSpace = coreColorSpace.ColorSpace; 42485 var Catalog = function CatalogClosure() { 42486 function Catalog(pdfManager, xref, pageFactory) { 42487 this.pdfManager = pdfManager; 42488 this.xref = xref; 42489 this.catDict = xref.getCatalogObj(); 42490 this.fontCache = new RefSetCache(); 42491 assert(isDict(this.catDict), 'catalog object is not a dictionary'); 42492 this.pageFactory = pageFactory; 42493 this.pagePromises = []; 42494 } 42495 Catalog.prototype = { 42496 get metadata() { 42497 var streamRef = this.catDict.getRaw('Metadata'); 42498 if (!isRef(streamRef)) { 42499 return shadow(this, 'metadata', null); 42500 } 42501 var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata; 42502 var stream = this.xref.fetch(streamRef, !encryptMetadata); 42503 var metadata; 42504 if (stream && isDict(stream.dict)) { 42505 var type = stream.dict.get('Type'); 42506 var subtype = stream.dict.get('Subtype'); 42507 if (isName(type, 'Metadata') && isName(subtype, 'XML')) { 42508 try { 42509 metadata = stringToUTF8String(bytesToString(stream.getBytes())); 42510 } catch (e) { 42511 info('Skipping invalid metadata.'); 42512 } 42513 } 42514 } 42515 return shadow(this, 'metadata', metadata); 42516 }, 42517 get toplevelPagesDict() { 42518 var pagesObj = this.catDict.get('Pages'); 42519 assert(isDict(pagesObj), 'invalid top-level pages dictionary'); 42520 return shadow(this, 'toplevelPagesDict', pagesObj); 42521 }, 42522 get documentOutline() { 42523 var obj = null;
42524 try { 42525 obj = this.readDocumentOutline(); 42526 } catch (ex) { 42527 if (ex instanceof MissingDataException) { 42528 throw ex; 42529 } 42530 warn('Unable to read document outline'); 42531 } 42532 return shadow(this, 'documentOutline', obj); 42533 }, 42534 readDocumentOutline: function Catalog_readDocumentOutline() { 42535 var obj = this.catDict.get('Outlines'); 42536 if (!isDict(obj)) { 42537 return null; 42538 } 42539 obj = obj.getRaw('First'); 42540 if (!isRef(obj)) { 42541 return null; 42542 } 42543 var root = { items: [] }; 42544 var queue = [{ 42545 obj: obj, 42546 parent: root 42547 }]; 42548 var processed = new RefSet(); 42549 processed.put(obj); 42550 var xref = this.xref, blackColor = new Uint8Array(3); 42551 while (queue.length > 0) { 42552 var i = queue.shift(); 42553 var outlineDict = xref.fetchIfRef(i.obj); 42554 if (outlineDict === null) { 42555 continue; 42556 } 42557 assert(outlineDict.has('Title'), 'Invalid outline item'); 42558 var data = { 42559 url: null, 42560 dest: null 42561 }; 42562 Catalog.parseDestDictionary({ 42563 destDict: outlineDict, 42564 resultObj: data, 42565 docBaseUrl: this.pdfManager.docBaseUrl 42566 }); 42567 var title = outlineDict.get('Title'); 42568 var flags = outlineDict.get('F') || 0; 42569 var color = outlineDict.getArray('C'), rgbColor = blackColor; 42570 if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 42571 rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0); 42572 } 42573 var outlineItem = { 42574 dest: data.dest, 42575 url: data.url, 42576 unsafeUrl: data.unsafeUrl, 42577 newWindow: data.newWindow, 42578 title: stringToPDFString(title), 42579 color: rgbColor, 42580 count: outlineDict.get('Count'), 42581 bold: !!(flags & 2), 42582 italic: !!(flags & 1), 42583 items: [] 42584 }; 42585 i.parent.items.push(outlineItem); 42586 obj = outlineDict.getRaw('First'); 42587 if (isRef(obj) && !processed.has(obj)) { 42588 queue.push({ 42589 obj: obj, 42590 parent: outlineItem 42591 }); 42592 processed.put(obj); 42593 } 42594 obj = outlineDict.getRaw('Next'); 42595 if (isRef(obj) && !processed.has(obj)) { 42596 queue.push({ 42597 obj: obj, 42598 parent: i.parent 42599 }); 42600 processed.put(obj); 42601 } 42602 } 42603 return root.items.length > 0 ? root.items : null; 42604 }, 42605 get numPages() { 42606 var obj = this.toplevelPagesDict.get('Count'); 42607 assert(isInt(obj), 'page count in top level pages object is not an integer'); 42608 return shadow(this, 'num', obj); 42609 }, 42610 get destinations() { 42611 function fetchDestination(dest) { 42612 return isDict(dest) ? dest.get('D') : dest; 42613 } 42614 var xref = this.xref; 42615 var dests = {}, nameTreeRef, nameDictionaryRef; 42616 var obj = this.catDict.get('Names'); 42617 if (obj && obj.has('Dests')) { 42618 nameTreeRef = obj.getRaw('Dests'); 42619 } else if (this.catDict.has('Dests')) { 42620 nameDictionaryRef = this.catDict.get('Dests'); 42621 } 42622 if (nameDictionaryRef) { 42623 obj = nameDictionaryRef; 42624 obj.forEach(function catalogForEach(key, value) { 42625 if (!value) { 42626 return; 42627 } 42628 dests[key] = fetchDestination(value); 42629 }); 42630 } 42631 if (nameTreeRef) { 42632 var nameTree = new NameTree(nameTreeRef, xref); 42633 var names = nameTree.getAll(); 42634 for (var name in names) { 42635 dests[name] = fetchDestination(names[name]); 42636 } 42637 } 42638 return shadow(this, 'destinations', dests); 42639 }, 42640 getDestination: function Catalog_getDestination(destinationId) { 42641 function fetchDestination(dest) { 42642 return isDict(dest) ? dest.get('D') : dest; 42643 } 42644 var xref = this.xref; 42645 var dest = null, nameTreeRef, nameDictionaryRef; 42646 var obj = this.catDict.get('Names'); 42647 if (obj && obj.has('Dests')) { 42648 nameTreeRef = obj.getRaw('Dests'); 42649 } else if (this.catDict.has('Dests')) { 42650 nameDictionaryRef = this.catDict.get('Dests'); 42651 } 42652 if (nameDictionaryRef) { 42653 var value = nameDictionaryRef.get(destinationId); 42654 if (value) { 42655 dest = fetchDestination(value); 42656 } 42657 } 42658 if (nameTreeRef) {
42659 var nameTree = new NameTree(nameTreeRef, xref); 42660 dest = fetchDestination(nameTree.get(destinationId)); 42661 } 42662 return dest; 42663 }, 42664 get pageLabels() { 42665 var obj = null; 42666 try { 42667 obj = this.readPageLabels(); 42668 } catch (ex) { 42669 if (ex instanceof MissingDataException) { 42670 throw ex; 42671 } 42672 warn('Unable to read page labels.'); 42673 } 42674 return shadow(this, 'pageLabels', obj); 42675 }, 42676 readPageLabels: function Catalog_readPageLabels() { 42677 var obj = this.catDict.getRaw('PageLabels'); 42678 if (!obj) { 42679 return null; 42680 } 42681 var pageLabels = new Array(this.numPages); 42682 var style = null; 42683 var prefix = ''; 42684 var numberTree = new NumberTree(obj, this.xref); 42685 var nums = numberTree.getAll(); 42686 var currentLabel = '', currentIndex = 1; 42687 for (var i = 0, ii = this.numPages; i < ii; i++) { 42688 if (i in nums) { 42689 var labelDict = nums[i]; 42690 assert(isDict(labelDict), 'The PageLabel is not a dictionary.'); 42691 var type = labelDict.get('Type'); 42692 assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.'); 42693 var s = labelDict.get('S'); 42694 assert(!s || isName(s), 'Invalid style in PageLabel dictionary.'); 42695 style = s ? s.name : null; 42696 var p = labelDict.get('P'); 42697 assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.'); 42698 prefix = p ? stringToPDFString(p) : ''; 42699 var st = labelDict.get('St'); 42700 assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.'); 42701 currentIndex = st || 1; 42702 } 42703 switch (style) { 42704 case 'D': 42705 currentLabel = currentIndex; 42706 break; 42707 case 'R': 42708 case 'r': 42709 currentLabel = Util.toRoman(currentIndex, style === 'r'); 42710 break; 42711 case 'A': 42712 case 'a': 42713 var LIMIT = 26; 42714 var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61; 42715 var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE; 42716 var letterIndex = currentIndex - 1; 42717 var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 42718 var charBuf = []; 42719 for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) { 42720 charBuf.push(character); 42721 } 42722 currentLabel = charBuf.join(''); 42723 break; 42724 default: 42725 assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.'); 42726 } 42727 pageLabels[i] = prefix + currentLabel; 42728 currentLabel = ''; 42729 currentIndex++; 42730 } 42731 return pageLabels; 42732 }, 42733 get attachments() { 42734 var xref = this.xref; 42735 var attachments = null, nameTreeRef; 42736 var obj = this.catDict.get('Names'); 42737 if (obj) { 42738 nameTreeRef = obj.getRaw('EmbeddedFiles'); 42739 } 42740 if (nameTreeRef) { 42741 var nameTree = new NameTree(nameTreeRef, xref); 42742 var names = nameTree.getAll(); 42743 for (var name in names) { 42744 var fs = new FileSpec(names[name], xref); 42745 if (!attachments) { 42746 attachments = Object.create(null); 42747 } 42748 attachments[stringToPDFString(name)] = fs.serializable; 42749 } 42750 } 42751 return shadow(this, 'attachments', attachments); 42752 }, 42753 get javaScript() { 42754 var xref = this.xref; 42755 var obj = this.catDict.get('Names'); 42756 var javaScript = []; 42757 function appendIfJavaScriptDict(jsDict) { 42758 var type = jsDict.get('S'); 42759 if (!isName(type, 'JavaScript')) { 42760 return; 42761 } 42762 var js = jsDict.get('JS'); 42763 if (isStream(js)) { 42764 js = bytesToString(js.getBytes()); 42765 } else if (!isString(js)) { 42766 return; 42767 } 42768 javaScript.push(stringToPDFString(js)); 42769 } 42770 if (obj && obj.has('JavaScript')) { 42771 var nameTree = new NameTree(obj.getRaw('JavaScript'), xref); 42772 var names = nameTree.getAll(); 42773 for (var name in names) { 42774 var jsDict = names[name]; 42775 if (isDict(jsDict)) { 42776 appendIfJavaScriptDict(jsDict); 42777 } 42778 } 42779 } 42780 var openactionDict = this.catDict.get('OpenAction'); 42781 if (isDict(openactionDict, 'Action')) { 42782 var actionType = openactionDict.get('S'); 42783 if (isName(actionType, 'Named')) { 42784 var action = openactionDict.get('N'); 42785 if (isName(action, 'Print')) { 42786 javaScript.push('print({});'); 42787 } 42788 } else { 42789 appendIfJavaScriptDict(openactionDict); 42790 } 42791 } 42792 return shadow(this, 'javaScript', javaScript); 42793 }, 42794 cleanup: function Catalog_cleanup() { 42795 var promises = []; 42796 this.fontCache.forEach(function (promise) { 42797 promises.push(promise); 42798 }); 42799 return Promise.all(promises).then(function (translatedFonts) { 42800 for (var i = 0, ii = translatedFonts.length; i < ii; i++) { 42801 var font = translatedFonts[i].dict; 42802 delete font.translated; 42803 } 42804 this.fontCache.clear(); 42805 }.bind(this)); 42806 }, 42807 getPage: function Catalog_getPage(pageIndex) { 42808 if (!(pageIndex in this.pagePromises)) { 42809 this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) { 42810 var dict = a[0]; 42811 var ref = a[1]; 42812 return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache); 42813 }.bind(this)); 42814 } 42815 return this.pagePromises[pageIndex]; 42816 }, 42817 getPageDict: function Catalog_getPageDict(pageIndex) { 42818 var capability = createPromiseCapability(); 42819 var nodesToVisit = [this.catDict.getRaw('Pages')]; 42820 var currentPageIndex = 0; 42821 var xref = this.xref; 42822 var checkAllKids = false;
42823 function next() { 42824 while (nodesToVisit.length) { 42825 var currentNode = nodesToVisit.pop(); 42826 if (isRef(currentNode)) { 42827 xref.fetchAsync(currentNode).then(function (obj) { 42828 if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) { 42829 if (pageIndex === currentPageIndex) { 42830 capability.resolve([ 42831 obj, 42832 currentNode 42833 ]); 42834 } else { 42835 currentPageIndex++; 42836 next(); 42837 } 42838 return; 42839 } 42840 nodesToVisit.push(obj); 42841 next(); 42842 }, capability.reject); 42843 return; 42844 } 42845 assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object'); 42846 var count = currentNode.get('Count'); 42847 if (count === 0) { 42848 checkAllKids = true; 42849 } 42850 if (currentPageIndex + count <= pageIndex) { 42851 currentPageIndex += count; 42852 continue; 42853 } 42854 var kids = currentNode.get('Kids'); 42855 assert(isArray(kids), 'page dictionary kids object is not an array'); 42856 if (!checkAllKids && count === kids.length) { 42857 nodesToVisit = [kids[pageIndex - currentPageIndex]]; 42858 currentPageIndex = pageIndex; 42859 continue; 42860 } else { 42861 for (var last = kids.length - 1; last >= 0; last--) { 42862 nodesToVisit.push(kids[last]); 42863 } 42864 } 42865 } 42866 capability.reject('Page index ' + pageIndex + ' not found.'); 42867 } 42868 next(); 42869 return capability.promise; 42870 }, 42871 getPageIndex: function Catalog_getPageIndex(pageRef) { 42872 var xref = this.xref; 42873 function pagesBeforeRef(kidRef) { 42874 var total = 0; 42875 var parentRef; 42876 return xref.fetchAsync(kidRef).then(function (node) { 42877 if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) { 42878 throw new Error('The reference does not point to a /Page Dict.'); 42879 } 42880 if (!node) { 42881 return null; 42882 } 42883 assert(isDict(node), 'node must be a Dict.'); 42884 parentRef = node.getRaw('Parent'); 42885 return node.getAsync('Parent'); 42886 }).then(function (parent) { 42887 if (!parent) { 42888 return null; 42889 } 42890 assert(isDict(parent), 'parent must be a Dict.'); 42891 return parent.getAsync('Kids'); 42892 }).then(function (kids) { 42893 if (!kids) { 42894 return null; 42895 } 42896 var kidPromises = []; 42897 var found = false; 42898 for (var i = 0; i < kids.length; i++) { 42899 var kid = kids[i]; 42900 assert(isRef(kid), 'kid must be a Ref.'); 42901 if (kid.num === kidRef.num) { 42902 found = true; 42903 break; 42904 } 42905 kidPromises.push(xref.fetchAsync(kid).then(function (kid) { 42906 if (kid.has('Count')) { 42907 var count = kid.get('Count'); 42908 total += count; 42909 } else { 42910 total++; 42911 } 42912 })); 42913 } 42914 if (!found) { 42915 error('kid ref not found in parents kids'); 42916 } 42917 return Promise.all(kidPromises).then(function () { 42918 return [ 42919 total, 42920 parentRef 42921 ]; 42922 }); 42923 }); 42924 } 42925 var total = 0; 42926 function next(ref) { 42927 return pagesBeforeRef(ref).then(function (args) { 42928 if (!args) { 42929 return total; 42930 } 42931 var count = args[0]; 42932 var parentRef = args[1]; 42933 total += count; 42934 return next(parentRef); 42935 }); 42936 } 42937 return next(pageRef); 42938 } 42939 }; 42940 Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) { 42941 function addDefaultProtocolToUrl(url) { 42942 if (url.indexOf('www.') === 0) { 42943 return 'http://' + url; 42944 } 42945 return url; 42946 } 42947 function tryConvertUrlEncoding(url) { 42948 try { 42949 return stringToUTF8String(url); 42950 } catch (e) { 42951 return url; 42952 } 42953 } 42954 var destDict = params.destDict; 42955 if (!isDict(destDict)) { 42956 warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.'); 42957 return; 42958 } 42959 var resultObj = params.resultObj; 42960 if (typeof resultObj !== 'object') { 42961 warn('Catalog_parseDestDictionary: "resultObj" must be an object.'); 42962 return; 42963 } 42964 var docBaseUrl = params.docBaseUrl || null; 42965 var action = destDict.get('A'), url, dest; 42966 if (isDict(action)) { 42967 var linkType = action.get('S').name; 42968 switch (linkType) { 42969 case 'URI': 42970 url = action.get('URI'); 42971 if (isName(url)) { 42972 url = '/' + url.name; 42973 } else if (isString(url)) { 42974 url = addDefaultProtocolToUrl(url); 42975 } 42976 break; 42977 case 'GoTo': 42978 dest = action.get('D'); 42979 break; 42980 case 'Launch': 42981 case 'GoToR': 42982 var urlDict = action.get('F'); 42983 if (isDict(urlDict)) { 42984 url = urlDict.get('F') || null; 42985 } else if (isString(urlDict)) { 42986 url = urlDict; 42987 } 42988 var remoteDest = action.get('D'); 42989 if (remoteDest) { 42990 if (isName(remoteDest)) { 42991 remoteDest = remoteDest.name; 42992 } 42993 if (isString(url)) { 42994 var baseUrl = url.split('#')[0]; 42995 if (isString(remoteDest)) { 42996 url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest; 42997 } else if (isArray(remoteDest)) { 42998 url = baseUrl + '#' + JSON.stringify(remoteDest); 42999 } 43000 } 43001 } 43002 var newWindow = action.get('NewWindow'); 43003 if (isBool(newWindow)) { 43004 resultObj.newWindow = newWindow; 43005 } 43006 break; 43007 case 'Named': 43008 var namedAction = action.get('N'); 43009 if (isName(namedAction)) { 43010 resultObj.action = namedAction.name; 43011 } 43012 break; 43013 case 'JavaScript': 43014 var jsAction = action.get('JS'), js; 43015 if (isStream(jsAction)) { 43016 js = bytesToString(jsAction.getBytes()); 43017 } else if (isString(jsAction)) { 43018 js = jsAction; 43019 } 43020 if (js) { 43021 var URL_OPEN_METHODS = [ 43022 'app.launchURL', 43023 'window.open'
43024 ]; 43025 var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))'); 43026 var jsUrl = regex.exec(stringToPDFString(js), 'i'); 43027 if (jsUrl && jsUrl[1]) { 43028 url = jsUrl[1]; 43029 break; 43030 } 43031 } 43032 default: 43033 warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".'); 43034 break; 43035 } 43036 } else if (destDict.has('Dest')) { 43037 dest = destDict.get('Dest'); 43038 } 43039 if (isString(url)) { 43040 url = tryConvertUrlEncoding(url); 43041 var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl); 43042 if (absoluteUrl) { 43043 resultObj.url = absoluteUrl.href; 43044 } 43045 resultObj.unsafeUrl = url; 43046 } 43047 if (dest) { 43048 if (isName(dest)) { 43049 dest = dest.name; 43050 } 43051 if (isString(dest) || isArray(dest)) { 43052 resultObj.dest = dest; 43053 } 43054 } 43055 }; 43056 return Catalog; 43057 }(); 43058 var XRef = function XRefClosure() { 43059 function XRef(stream, pdfManager) { 43060 this.stream = stream; 43061 this.pdfManager = pdfManager; 43062 this.entries = []; 43063 this.xrefstms = Object.create(null); 43064 this.cache = []; 43065 this.stats = { 43066 streamTypes: [], 43067 fontTypes: [] 43068 }; 43069 } 43070 XRef.prototype = { 43071 setStartXRef: function XRef_setStartXRef(startXRef) { 43072 this.startXRefQueue = [startXRef]; 43073 }, 43074 parse: function XRef_parse(recoveryMode) { 43075 var trailerDict; 43076 if (!recoveryMode) { 43077 trailerDict = this.readXRef(); 43078 } else { 43079 warn('Indexing all PDF objects'); 43080 trailerDict = this.indexObjects(); 43081 } 43082 trailerDict.assignXref(this); 43083 this.trailer = trailerDict; 43084 var encrypt = trailerDict.get('Encrypt'); 43085 if (isDict(encrypt)) { 43086 var ids = trailerDict.get('ID'); 43087 var fileId = ids && ids.length ? ids[0] : ''; 43088 encrypt.suppressEncryption = true; 43089 this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 43090 } 43091 if (!(this.root = trailerDict.get('Root'))) { 43092 error('Invalid root reference'); 43093 } 43094 }, 43095 processXRefTable: function XRef_processXRefTable(parser) { 43096 if (!('tableState' in this)) { 43097 this.tableState = { 43098 entryNum: 0, 43099 streamPos: parser.lexer.stream.pos, 43100 parserBuf1: parser.buf1, 43101 parserBuf2: parser.buf2 43102 }; 43103 } 43104 var obj = this.readXRefTable(parser); 43105 if (!isCmd(obj, 'trailer')) { 43106 error('Invalid XRef table: could not find trailer dictionary'); 43107 } 43108 var dict = parser.getObj(); 43109 if (!isDict(dict) && dict.dict) { 43110 dict = dict.dict; 43111 } 43112 if (!isDict(dict)) { 43113 error('Invalid XRef table: could not parse trailer dictionary'); 43114 } 43115 delete this.tableState; 43116 return dict; 43117 }, 43118 readXRefTable: function XRef_readXRefTable(parser) { 43119 var stream = parser.lexer.stream; 43120 var tableState = this.tableState; 43121 stream.pos = tableState.streamPos; 43122 parser.buf1 = tableState.parserBuf1; 43123 parser.buf2 = tableState.parserBuf2; 43124 var obj; 43125 while (true) { 43126 if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) { 43127 if (isCmd(obj = parser.getObj(), 'trailer')) { 43128 break; 43129 } 43130 tableState.firstEntryNum = obj; 43131 tableState.entryCount = parser.getObj(); 43132 } 43133 var first = tableState.firstEntryNum; 43134 var count = tableState.entryCount; 43135 if (!isInt(first) || !isInt(count)) { 43136 error('Invalid XRef table: wrong types in subsection header'); 43137 } 43138 for (var i = tableState.entryNum; i < count; i++) { 43139 tableState.streamPos = stream.pos; 43140 tableState.entryNum = i; 43141 tableState.parserBuf1 = parser.buf1; 43142 tableState.parserBuf2 = parser.buf2; 43143 var entry = {}; 43144 entry.offset = parser.getObj(); 43145 entry.gen = parser.getObj(); 43146 var type = parser.getObj(); 43147 if (isCmd(type, 'f')) { 43148 entry.free = true; 43149 } else if (isCmd(type, 'n')) { 43150 entry.uncompressed = true; 43151 } 43152 if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) { 43153 error('Invalid entry in XRef subsection: ' + first + ', ' + count); 43154 } 43155 if (i === 0 && entry.free && first === 1) { 43156 first = 0; 43157 } 43158 if (!this.entries[i + first]) { 43159 this.entries[i + first] = entry; 43160 } 43161 } 43162 tableState.entryNum = 0; 43163 tableState.streamPos = stream.pos; 43164 tableState.parserBuf1 = parser.buf1; 43165 tableState.parserBuf2 = parser.buf2; 43166 delete tableState.firstEntryNum; 43167 delete tableState.entryCount; 43168 } 43169 if (this.entries[0] && !this.entries[0].free) { 43170 error('Invalid XRef table: unexpected first object'); 43171 } 43172 return obj; 43173 }, 43174 processXRefStream: function XRef_processXRefStream(stream) { 43175 if (!('streamState' in this)) { 43176 var streamParameters = stream.dict;
43177 var byteWidths = streamParameters.get('W'); 43178 var range = streamParameters.get('Index'); 43179 if (!range) { 43180 range = [ 43181 0, 43182 streamParameters.get('Size') 43183 ]; 43184 } 43185 this.streamState = { 43186 entryRanges: range, 43187 byteWidths: byteWidths, 43188 entryNum: 0, 43189 streamPos: stream.pos 43190 }; 43191 } 43192 this.readXRefStream(stream); 43193 delete this.streamState; 43194 return stream.dict; 43195 }, 43196 readXRefStream: function XRef_readXRefStream(stream) { 43197 var i, j; 43198 var streamState = this.streamState; 43199 stream.pos = streamState.streamPos; 43200 var byteWidths = streamState.byteWidths; 43201 var typeFieldWidth = byteWidths[0]; 43202 var offsetFieldWidth = byteWidths[1]; 43203 var generationFieldWidth = byteWidths[2]; 43204 var entryRanges = streamState.entryRanges; 43205 while (entryRanges.length > 0) { 43206 var first = entryRanges[0]; 43207 var n = entryRanges[1]; 43208 if (!isInt(first) || !isInt(n)) { 43209 error('Invalid XRef range fields: ' + first + ', ' + n); 43210 } 43211 if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) { 43212 error('Invalid XRef entry fields length: ' + first + ', ' + n); 43213 } 43214 for (i = streamState.entryNum; i < n; ++i) { 43215 streamState.entryNum = i; 43216 streamState.streamPos = stream.pos; 43217 var type = 0, offset = 0, generation = 0; 43218 for (j = 0; j < typeFieldWidth; ++j) { 43219 type = type << 8 | stream.getByte(); 43220 } 43221 if (typeFieldWidth === 0) { 43222 type = 1; 43223 } 43224 for (j = 0; j < offsetFieldWidth; ++j) { 43225 offset = offset << 8 | stream.getByte(); 43226 } 43227 for (j = 0; j < generationFieldWidth; ++j) { 43228 generation = generation << 8 | stream.getByte(); 43229 } 43230 var entry = {}; 43231 entry.offset = offset; 43232 entry.gen = generation; 43233 switch (type) { 43234 case 0: 43235 entry.free = true; 43236 break; 43237 case 1: 43238 entry.uncompressed = true; 43239 break; 43240 case 2: 43241 break; 43242 default: 43243 error('Invalid XRef entry type: ' + type); 43244 } 43245 if (!this.entries[first + i]) { 43246 this.entries[first + i] = entry; 43247 } 43248 } 43249 streamState.entryNum = 0; 43250 streamState.streamPos = stream.pos; 43251 entryRanges.splice(0, 2); 43252 } 43253 }, 43254 indexObjects: function XRef_indexObjects() { 43255 var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20; 43256 var PERCENT = 0x25, LT = 0x3C; 43257 function readToken(data, offset) { 43258 var token = '', ch = data[offset]; 43259 while (ch !== LF && ch !== CR && ch !== LT) { 43260 if (++offset >= data.length) { 43261 break; 43262 } 43263 token += String.fromCharCode(ch); 43264 ch = data[offset]; 43265 } 43266 return token; 43267 } 43268 function skipUntil(data, offset, what) { 43269 var length = what.length, dataLength = data.length; 43270 var skipped = 0; 43271 while (offset < dataLength) { 43272 var i = 0; 43273 while (i < length && data[offset + i] === what[i]) { 43274 ++i; 43275 } 43276 if (i >= length) { 43277 break; 43278 } 43279 offset++; 43280 skipped++; 43281 } 43282 return skipped; 43283 } 43284 var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 43285 var trailerBytes = new Uint8Array([ 43286 116,
43287 114, 43288 97, 43289 105, 43290 108, 43291 101, 43292 114 43293 ]); 43294 var startxrefBytes = new Uint8Array([ 43295 115, 43296 116, 43297 97, 43298 114, 43299 116, 43300 120, 43301 114, 43302 101, 43303 102 43304 ]); 43305 var endobjBytes = new Uint8Array([ 43306 101, 43307 110, 43308 100, 43309 111, 43310 98, 43311 106 43312 ]); 43313 var xrefBytes = new Uint8Array([ 43314 47, 43315 88, 43316 82, 43317 101, 43318 102 43319 ]); 43320 this.entries.length = 0; 43321 var stream = this.stream; 43322 stream.pos = 0; 43323 var buffer = stream.getBytes(); 43324 var position = stream.start, length = buffer.length; 43325 var trailers = [], xrefStms = []; 43326 while (position < length) { 43327 var ch = buffer[position]; 43328 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 43329 ++position; 43330 continue; 43331 } 43332 if (ch === PERCENT) { 43333 do { 43334 ++position; 43335 if (position >= length) { 43336 break; 43337 } 43338 ch = buffer[position]; 43339 } while (ch !== LF && ch !== CR); 43340 continue; 43341 } 43342 var token = readToken(buffer, position); 43343 var m; 43344 if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) { 43345 position += skipUntil(buffer, position, trailerBytes); 43346 trailers.push(position); 43347 position += skipUntil(buffer, position, startxrefBytes); 43348 } else if (m = objRegExp.exec(token)) { 43349 if (typeof this.entries[m[1]] === 'undefined') { 43350 this.entries[m[1]] = { 43351 offset: position - stream.start, 43352 gen: m[2] | 0, 43353 uncompressed: true 43354 }; 43355 } 43356 var contentLength = skipUntil(buffer, position, endobjBytes) + 7; 43357 var content = buffer.subarray(position, position + contentLength); 43358 var xrefTagOffset = skipUntil(content, 0, xrefBytes); 43359 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 43360 xrefStms.push(position - stream.start); 43361 this.xrefstms[position - stream.start] = 1; 43362 } 43363 position += contentLength; 43364 } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) { 43365 trailers.push(position); 43366 position += skipUntil(buffer, position, startxrefBytes); 43367 } else { 43368 position += token.length + 1; 43369 } 43370 } 43371 var i, ii; 43372 for (i = 0, ii = xrefStms.length; i < ii; ++i) { 43373 this.startXRefQueue.push(xrefStms[i]); 43374 this.readXRef(true); 43375 } 43376 var dict; 43377 for (i = 0, ii = trailers.length; i < ii; ++i) { 43378 stream.pos = trailers[i]; 43379 var parser = new Parser(new Lexer(stream), true, this, true); 43380 var obj = parser.getObj(); 43381 if (!isCmd(obj, 'trailer')) { 43382 continue; 43383 } 43384 dict = parser.getObj(); 43385 if (!isDict(dict)) { 43386 continue; 43387 } 43388 if (dict.has('ID')) { 43389 return dict; 43390 } 43391 } 43392 if (dict) { 43393 return dict; 43394 } 43395 throw new InvalidPDFException('Invalid PDF structure'); 43396 }, 43397 readXRef: function XRef_readXRef(recoveryMode) { 43398 var stream = this.stream; 43399 try { 43400 while (this.startXRefQueue.length) { 43401 var startXRef = this.startXRefQueue[0]; 43402 stream.pos = startXRef + stream.start; 43403 var parser = new Parser(new Lexer(stream), true, this); 43404 var obj = parser.getObj(); 43405 var dict; 43406 if (isCmd(obj, 'xref')) { 43407 dict = this.processXRefTable(parser); 43408 if (!this.topDict) { 43409 this.topDict = dict; 43410 } 43411 obj = dict.get('XRefStm'); 43412 if (isInt(obj)) { 43413 var pos = obj; 43414 if (!(pos in this.xrefstms)) { 43415 this.xrefstms[pos] = 1; 43416 this.startXRefQueue.push(pos); 43417 } 43418 } 43419 } else if (isInt(obj)) { 43420 if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) { 43421 error('Invalid XRef stream'); 43422 } 43423 dict = this.processXRefStream(obj); 43424 if (!this.topDict) { 43425 this.topDict = dict; 43426 } 43427 if (!dict) { 43428 error('Failed to read XRef stream'); 43429 } 43430 } else { 43431 error('Invalid XRef stream header'); 43432 } 43433 obj = dict.get('Prev'); 43434 if (isInt(obj)) { 43435 this.startXRefQueue.push(obj); 43436 } else if (isRef(obj)) { 43437 this.startXRefQueue.push(obj.num); 43438 } 43439 this.startXRefQueue.shift(); 43440 } 43441 return this.topDict; 43442 } catch (e) { 43443 if (e instanceof MissingDataException) { 43444 throw e; 43445 } 43446 info('(while reading XRef): ' + e); 43447 } 43448 if (recoveryMode) { 43449 return; 43450 } 43451 throw new XRefParseException(); 43452 }, 43453 getEntry: function XRef_getEntry(i) { 43454 var xrefEntry = this.entries[i]; 43455 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 43456 return xrefEntry; 43457 } 43458 return null; 43459 }, 43460 fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) { 43461 if (!isRef(obj)) { 43462 return obj; 43463 } 43464 return this.fetch(obj, suppressEncryption); 43465 }, 43466 fetch: function XRef_fetch(ref, suppressEncryption) { 43467 assert(isRef(ref), 'ref object is not a reference'); 43468 var num = ref.num; 43469 if (num in this.cache) { 43470 var cacheEntry = this.cache[num]; 43471 return cacheEntry; 43472 } 43473 var xrefEntry = this.getEntry(num); 43474 if (xrefEntry === null) { 43475 return this.cache[num] = null; 43476 } 43477 if (xrefEntry.uncompressed) { 43478 xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); 43479 } else { 43480 xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption); 43481 } 43482 if (isDict(xrefEntry)) { 43483 xrefEntry.objId = ref.toString(); 43484 } else if (isStream(xrefEntry)) { 43485 xrefEntry.dict.objId = ref.toString(); 43486 } 43487 return xrefEntry; 43488 }, 43489 fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) { 43490 var gen = ref.gen; 43491 var num = ref.num; 43492 if (xrefEntry.gen !== gen) { 43493 error('inconsistent generation in XRef'); 43494 } 43495 var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 43496 var parser = new Parser(new Lexer(stream), true, this); 43497 var obj1 = parser.getObj(); 43498 var obj2 = parser.getObj(); 43499 var obj3 = parser.getObj(); 43500 if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) { 43501 error('bad XRef entry'); 43502 } 43503 if (!isCmd(obj3, 'obj')) { 43504 if (obj3.cmd.indexOf('obj') === 0) { 43505 num = parseInt(obj3.cmd.substring(3), 10); 43506 if (!isNaN(num)) { 43507 return num; 43508 } 43509 } 43510 error('bad XRef entry'); 43511 } 43512 if (this.encrypt && !suppressEncryption) { 43513 xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); 43514 } else { 43515 xrefEntry = parser.getObj(); 43516 } 43517 if (!isStream(xrefEntry)) { 43518 this.cache[num] = xrefEntry; 43519 } 43520 return xrefEntry; 43521 }, 43522 fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) { 43523 var tableOffset = xrefEntry.offset; 43524 var stream = this.fetch(new Ref(tableOffset, 0)); 43525 if (!isStream(stream)) { 43526 error('bad ObjStm stream'); 43527 } 43528 var first = stream.dict.get('First'); 43529 var n = stream.dict.get('N'); 43530 if (!isInt(first) || !isInt(n)) { 43531 error('invalid first and n parameters for ObjStm stream'); 43532 } 43533 var parser = new Parser(new Lexer(stream), false, this); 43534 parser.allowStreams = true;
43535 var i, entries = [], num, nums = []; 43536 for (i = 0; i < n; ++i) { 43537 num = parser.getObj(); 43538 if (!isInt(num)) { 43539 error('invalid object number in the ObjStm stream: ' + num); 43540 } 43541 nums.push(num); 43542 var offset = parser.getObj(); 43543 if (!isInt(offset)) { 43544 error('invalid object offset in the ObjStm stream: ' + offset); 43545 } 43546 } 43547 for (i = 0; i < n; ++i) { 43548 entries.push(parser.getObj()); 43549 if (isCmd(parser.buf1, 'endobj')) { 43550 parser.shift(); 43551 } 43552 num = nums[i]; 43553 var entry = this.entries[num]; 43554 if (entry && entry.offset === tableOffset && entry.gen === i) { 43555 this.cache[num] = entries[i]; 43556 } 43557 } 43558 xrefEntry = entries[xrefEntry.gen]; 43559 if (xrefEntry === undefined) { 43560 error('bad XRef entry for compressed object'); 43561 } 43562 return xrefEntry; 43563 }, 43564 fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) { 43565 if (!isRef(obj)) { 43566 return Promise.resolve(obj); 43567 } 43568 return this.fetchAsync(obj, suppressEncryption); 43569 }, 43570 fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) { 43571 var streamManager = this.stream.manager; 43572 var xref = this; 43573 return new Promise(function tryFetch(resolve, reject) { 43574 try { 43575 resolve(xref.fetch(ref, suppressEncryption)); 43576 } catch (e) { 43577 if (e instanceof MissingDataException) { 43578 streamManager.requestRange(e.begin, e.end).then(function () { 43579 tryFetch(resolve, reject); 43580 }, reject); 43581 return; 43582 } 43583 reject(e); 43584 } 43585 }); 43586 }, 43587 getCatalogObj: function XRef_getCatalogObj() { 43588 return this.root; 43589 } 43590 }; 43591 return XRef; 43592 }(); 43593 var NameOrNumberTree = function NameOrNumberTreeClosure() { 43594 function NameOrNumberTree(root, xref) { 43595 throw new Error('Cannot initialize NameOrNumberTree.'); 43596 } 43597 NameOrNumberTree.prototype = { 43598 getAll: function NameOrNumberTree_getAll() { 43599 var dict = Object.create(null); 43600 if (!this.root) { 43601 return dict; 43602 } 43603 var xref = this.xref; 43604 var processed = new RefSet(); 43605 processed.put(this.root); 43606 var queue = [this.root]; 43607 while (queue.length > 0) { 43608 var i, n; 43609 var obj = xref.fetchIfRef(queue.shift()); 43610 if (!isDict(obj)) { 43611 continue; 43612 } 43613 if (obj.has('Kids')) { 43614 var kids = obj.get('Kids'); 43615 for (i = 0, n = kids.length; i < n; i++) { 43616 var kid = kids[i]; 43617 assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.'); 43618 queue.push(kid); 43619 processed.put(kid); 43620 } 43621 continue; 43622 } 43623 var entries = obj.get(this._type); 43624 if (isArray(entries)) { 43625 for (i = 0, n = entries.length; i < n; i += 2) { 43626 dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]); 43627 } 43628 } 43629 } 43630 return dict; 43631 }, 43632 get: function NameOrNumberTree_get(key) { 43633 if (!this.root) { 43634 return null; 43635 } 43636 var xref = this.xref; 43637 var kidsOrEntries = xref.fetchIfRef(this.root); 43638 var loopCount = 0; 43639 var MAX_LEVELS = 10; 43640 var l, r, m; 43641 while (kidsOrEntries.has('Kids')) { 43642 if (++loopCount > MAX_LEVELS) { 43643 warn('Search depth limit reached for "' + this._type + '" tree.'); 43644 return null; 43645 } 43646 var kids = kidsOrEntries.get('Kids'); 43647 if (!isArray(kids)) { 43648 return null; 43649 } 43650 l = 0; 43651 r = kids.length - 1; 43652 while (l <= r) { 43653 m = l + r >> 1; 43654 var kid = xref.fetchIfRef(kids[m]); 43655 var limits = kid.get('Limits'); 43656 if (key < xref.fetchIfRef(limits[0])) { 43657 r = m - 1; 43658 } else if (key > xref.fetchIfRef(limits[1])) { 43659 l = m + 1; 43660 } else { 43661 kidsOrEntries = xref.fetchIfRef(kids[m]); 43662 break; 43663 } 43664 } 43665 if (l > r) { 43666 return null; 43667 } 43668 } 43669 var entries = kidsOrEntries.get(this._type); 43670 if (isArray(entries)) { 43671 l = 0; 43672 r = entries.length - 2; 43673 while (l <= r) { 43674 m = l + r & ~1; 43675 var currentKey = xref.fetchIfRef(entries[m]); 43676 if (key < currentKey) { 43677 r = m - 2; 43678 } else if (key > currentKey) { 43679 l = m + 2; 43680 } else { 43681 return xref.fetchIfRef(entries[m + 1]); 43682 } 43683 } 43684 } 43685 return null; 43686 } 43687 }; 43688 return NameOrNumberTree; 43689 }(); 43690 var NameTree = function NameTreeClosure() { 43691 function NameTree(root, xref) { 43692 this.root = root; 43693 this.xref = xref; 43694 this._type = 'Names'; 43695 } 43696 Util.inherit(NameTree, NameOrNumberTree, {}); 43697 return NameTree; 43698 }(); 43699 var NumberTree = function NumberTreeClosure() { 43700 function NumberTree(root, xref) { 43701 this.root = root; 43702 this.xref = xref; 43703 this._type = 'Nums'; 43704 } 43705 Util.inherit(NumberTree, NameOrNumberTree, {}); 43706 return NumberTree; 43707 }(); 43708 var FileSpec = function FileSpecClosure() { 43709 function FileSpec(root, xref) { 43710 if (!root || !isDict(root)) { 43711 return; 43712 } 43713 this.xref = xref; 43714 this.root = root; 43715 if (root.has('FS')) { 43716 this.fs = root.get('FS'); 43717 } 43718 this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : ''; 43719 if (root.has('RF')) { 43720 warn('Related file specifications are not supported'); 43721 } 43722 this.contentAvailable = true; 43723 if (!root.has('EF')) { 43724 this.contentAvailable = false;
43725 warn('Non-embedded file specifications are not supported'); 43726 } 43727 } 43728 function pickPlatformItem(dict) { 43729 if (dict.has('UF')) { 43730 return dict.get('UF'); 43731 } else if (dict.has('F')) { 43732 return dict.get('F'); 43733 } else if (dict.has('Unix')) { 43734 return dict.get('Unix'); 43735 } else if (dict.has('Mac')) { 43736 return dict.get('Mac'); 43737 } else if (dict.has('DOS')) { 43738 return dict.get('DOS'); 43739 } 43740 return null; 43741 } 43742 FileSpec.prototype = { 43743 get filename() { 43744 if (!this._filename && this.root) { 43745 var filename = pickPlatformItem(this.root) || 'unnamed'; 43746 this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/'); 43747 } 43748 return this._filename; 43749 }, 43750 get content() { 43751 if (!this.contentAvailable) { 43752 return null; 43753 } 43754 if (!this.contentRef && this.root) { 43755 this.contentRef = pickPlatformItem(this.root.get('EF')); 43756 } 43757 var content = null; 43758 if (this.contentRef) { 43759 var xref = this.xref; 43760 var fileObj = xref.fetchIfRef(this.contentRef); 43761 if (fileObj && isStream(fileObj)) { 43762 content = fileObj.getBytes(); 43763 } else { 43764 warn('Embedded file specification points to non-existing/invalid ' + 'content'); 43765 } 43766 } else { 43767 warn('Embedded file specification does not have a content'); 43768 } 43769 return content; 43770 }, 43771 get serializable() { 43772 return { 43773 filename: this.filename, 43774 content: this.content 43775 }; 43776 } 43777 }; 43778 return FileSpec; 43779 }(); 43780 var ObjectLoader = function () { 43781 function mayHaveChildren(value) { 43782 return isRef(value) || isDict(value) || isArray(value) || isStream(value); 43783 } 43784 function addChildren(node, nodesToVisit) { 43785 var value; 43786 if (isDict(node) || isStream(node)) { 43787 var map; 43788 if (isDict(node)) { 43789 map = node.map; 43790 } else { 43791 map = node.dict.map; 43792 } 43793 for (var key in map) { 43794 value = map[key]; 43795 if (mayHaveChildren(value)) { 43796 nodesToVisit.push(value); 43797 } 43798 } 43799 } else if (isArray(node)) { 43800 for (var i = 0, ii = node.length; i < ii; i++) { 43801 value = node[i]; 43802 if (mayHaveChildren(value)) { 43803 nodesToVisit.push(value); 43804 } 43805 } 43806 } 43807 } 43808 function ObjectLoader(obj, keys, xref) { 43809 this.obj = obj; 43810 this.keys = keys; 43811 this.xref = xref; 43812 this.refSet = null; 43813 this.capability = null; 43814 } 43815 ObjectLoader.prototype = { 43816 load: function ObjectLoader_load() { 43817 var keys = this.keys; 43818 this.capability = createPromiseCapability(); 43819 if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) { 43820 this.capability.resolve(); 43821 return this.capability.promise; 43822 } 43823 this.refSet = new RefSet(); 43824 var nodesToVisit = []; 43825 for (var i = 0; i < keys.length; i++) { 43826 nodesToVisit.push(this.obj[keys[i]]); 43827 } 43828 this._walk(nodesToVisit); 43829 return this.capability.promise; 43830 }, 43831 _walk: function ObjectLoader_walk(nodesToVisit) { 43832 var nodesToRevisit = []; 43833 var pendingRequests = []; 43834 while (nodesToVisit.length) { 43835 var currentNode = nodesToVisit.pop(); 43836 if (isRef(currentNode)) { 43837 if (this.refSet.has(currentNode)) { 43838 continue; 43839 } 43840 try { 43841 var ref = currentNode; 43842 this.refSet.put(ref); 43843 currentNode = this.xref.fetch(currentNode); 43844 } catch (e) { 43845 if (!(e instanceof MissingDataException)) { 43846 throw e; 43847 } 43848 nodesToRevisit.push(currentNode); 43849 pendingRequests.push({ 43850 begin: e.begin, 43851 end: e.end 43852 }); 43853 } 43854 } 43855 if (currentNode && currentNode.getBaseStreams) { 43856 var baseStreams = currentNode.getBaseStreams(); 43857 var foundMissingData = false; 43858 for (var i = 0; i < baseStreams.length; i++) { 43859 var stream = baseStreams[i]; 43860 if (stream.getMissingChunks && stream.getMissingChunks().length) { 43861 foundMissingData = true; 43862 pendingRequests.push({ 43863 begin: stream.start, 43864 end: stream.end 43865 }); 43866 } 43867 } 43868 if (foundMissingData) { 43869 nodesToRevisit.push(currentNode); 43870 } 43871 } 43872 addChildren(currentNode, nodesToVisit); 43873 } 43874 if (pendingRequests.length) { 43875 this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() { 43876 nodesToVisit = nodesToRevisit; 43877 for (var i = 0; i < nodesToRevisit.length; i++) { 43878 var node = nodesToRevisit[i]; 43879 if (isRef(node)) { 43880 this.refSet.remove(node); 43881 } 43882 } 43883 this._walk(nodesToVisit); 43884 }.bind(this), this.capability.reject); 43885 return; 43886 } 43887 this.refSet = null; 43888 this.capability.resolve(); 43889 } 43890 }; 43891 return ObjectLoader; 43892 }(); 43893 exports.Catalog = Catalog; 43894 exports.ObjectLoader = ObjectLoader; 43895 exports.XRef = XRef; 43896 exports.FileSpec = FileSpec; 43897 })); 43898 (function (root, factory) { 43899 factory(root.pdfjsCorePattern = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreFunction, root.pdfjsCoreColorSpace); 43900 }(this, function (exports, sharedUtil, corePrimitives, coreFunction, coreColorSpace) { 43901 var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES; 43902 var MissingDataException = sharedUtil.MissingDataException; 43903 var Util = sharedUtil.Util; 43904 var assert = sharedUtil.assert; 43905 var error = sharedUtil.error; 43906 var info = sharedUtil.info; 43907 var warn = sharedUtil.warn; 43908 var isStream = corePrimitives.isStream; 43909 var PDFFunction = coreFunction.PDFFunction; 43910 var ColorSpace = coreColorSpace.ColorSpace; 43911 var ShadingType = { 43912 FUNCTION_BASED: 1, 43913 AXIAL: 2, 43914 RADIAL: 3, 43915 FREE_FORM_MESH: 4, 43916 LATTICE_FORM_MESH: 5, 43917 COONS_PATCH_MESH: 6, 43918 TENSOR_PATCH_MESH: 7 43919 }; 43920 var Pattern = function PatternClosure() { 43921 function Pattern() { 43922 error('should not call Pattern constructor'); 43923 } 43924 Pattern.prototype = { 43925 getPattern: function Pattern_getPattern(ctx) { 43926 error('Should not call Pattern.getStyle: ' + ctx); 43927 } 43928 }; 43929 Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) { 43930 var dict = isStream(shading) ? shading.dict : shading; 43931 var type = dict.get('ShadingType'); 43932 try { 43933 switch (type) { 43934 case ShadingType.AXIAL: 43935 case ShadingType.RADIAL: 43936 return new Shadings.RadialAxial(dict, matrix, xref, res); 43937 case ShadingType.FREE_FORM_MESH: 43938 case ShadingType.LATTICE_FORM_MESH: 43939 case ShadingType.COONS_PATCH_MESH: 43940 case ShadingType.TENSOR_PATCH_MESH: 43941 return new Shadings.Mesh(shading, matrix, xref, res); 43942 default: 43943 throw new Error('Unsupported ShadingType: ' + type); 43944 } 43945 } catch (ex) { 43946 if (ex instanceof MissingDataException) { 43947 throw ex; 43948 } 43949 handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern }); 43950 warn(ex); 43951 return new Shadings.Dummy(); 43952 } 43953 }; 43954 return Pattern; 43955 }(); 43956 var Shadings = {}; 43957 Shadings.SMALL_NUMBER = 1e-6; 43958 Shadings.RadialAxial = function RadialAxialClosure() { 43959 function RadialAxial(dict, matrix, xref, res) { 43960 this.matrix = matrix; 43961 this.coordsArr = dict.getArray('Coords'); 43962 this.shadingType = dict.get('ShadingType'); 43963 this.type = 'Pattern'; 43964 var cs = dict.get('ColorSpace', 'CS'); 43965 cs = ColorSpace.parse(cs, xref, res); 43966 this.cs = cs; 43967 var t0 = 0.0, t1 = 1.0; 43968 if (dict.has('Domain')) { 43969 var domainArr = dict.getArray('Domain'); 43970 t0 = domainArr[0]; 43971 t1 = domainArr[1]; 43972 } 43973 var extendStart = false, extendEnd = false;
43974 if (dict.has('Extend')) { 43975 var extendArr = dict.getArray('Extend'); 43976 extendStart = extendArr[0]; 43977 extendEnd = extendArr[1]; 43978 } 43979 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 43980 var x1 = this.coordsArr[0]; 43981 var y1 = this.coordsArr[1]; 43982 var r1 = this.coordsArr[2]; 43983 var x2 = this.coordsArr[3]; 43984 var y2 = this.coordsArr[4]; 43985 var r2 = this.coordsArr[5]; 43986 var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 43987 if (r1 <= r2 + distance && r2 <= r1 + distance) { 43988 warn('Unsupported radial gradient.'); 43989 } 43990 } 43991 this.extendStart = extendStart; 43992 this.extendEnd = extendEnd; 43993 var fnObj = dict.get('Function'); 43994 var fn = PDFFunction.parseArray(xref, fnObj); 43995 var diff = t1 - t0; 43996 var step = diff / 10; 43997 var colorStops = this.colorStops = []; 43998 if (t0 >= t1 || step <= 0) { 43999 info('Bad shading domain.'); 44000 return; 44001 } 44002 var color = new Float32Array(cs.numComps), ratio = new Float32Array(1); 44003 var rgbColor; 44004 for (var i = t0; i <= t1; i += step) { 44005 ratio[0] = i; 44006 fn(ratio, 0, color, 0); 44007 rgbColor = cs.getRgb(color, 0); 44008 var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 44009 colorStops.push([ 44010 (i - t0) / diff, 44011 cssColor 44012 ]); 44013 } 44014 var background = 'transparent'; 44015 if (dict.has('Background')) { 44016 rgbColor = cs.getRgb(dict.get('Background'), 0); 44017 background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 44018 } 44019 if (!extendStart) { 44020 colorStops.unshift([ 44021 0, 44022 background 44023 ]); 44024 colorStops[1][0] += Shadings.SMALL_NUMBER; 44025 } 44026 if (!extendEnd) { 44027 colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER; 44028 colorStops.push([ 44029 1, 44030 background 44031 ]); 44032 } 44033 this.colorStops = colorStops; 44034 } 44035 RadialAxial.prototype = { 44036 getIR: function RadialAxial_getIR() { 44037 var coordsArr = this.coordsArr; 44038 var shadingType = this.shadingType; 44039 var type, p0, p1, r0, r1; 44040 if (shadingType === ShadingType.AXIAL) { 44041 p0 = [ 44042 coordsArr[0], 44043 coordsArr[1] 44044 ]; 44045 p1 = [ 44046 coordsArr[2], 44047 coordsArr[3] 44048 ]; 44049 r0 = null; 44050 r1 = null; 44051 type = 'axial'; 44052 } else if (shadingType === ShadingType.RADIAL) { 44053 p0 = [ 44054 coordsArr[0], 44055 coordsArr[1] 44056 ]; 44057 p1 = [ 44058 coordsArr[3], 44059 coordsArr[4] 44060 ]; 44061 r0 = coordsArr[2]; 44062 r1 = coordsArr[5]; 44063 type = 'radial'; 44064 } else { 44065 error('getPattern type unknown: ' + shadingType); 44066 } 44067 var matrix = this.matrix; 44068 if (matrix) { 44069 p0 = Util.applyTransform(p0, matrix); 44070 p1 = Util.applyTransform(p1, matrix); 44071 if (shadingType === ShadingType.RADIAL) { 44072 var scale = Util.singularValueDecompose2dScale(matrix); 44073 r0 *= scale[0]; 44074 r1 *= scale[1]; 44075 } 44076 } 44077 return [ 44078 'RadialAxial', 44079 type, 44080 this.colorStops, 44081 p0, 44082 p1, 44083 r0, 44084 r1 44085 ]; 44086 } 44087 }; 44088 return RadialAxial; 44089 }(); 44090 Shadings.Mesh = function MeshClosure() { 44091 function MeshStreamReader(stream, context) { 44092 this.stream = stream; 44093 this.context = context; 44094 this.buffer = 0; 44095 this.bufferLength = 0; 44096 var numComps = context.numComps; 44097 this.tmpCompsBuf = new Float32Array(numComps); 44098 var csNumComps = context.colorSpace.numComps; 44099 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 44100 } 44101 MeshStreamReader.prototype = { 44102 get hasData() { 44103 if (this.stream.end) { 44104 return this.stream.pos < this.stream.end; 44105 } 44106 if (this.bufferLength > 0) { 44107 return true; 44108 } 44109 var nextByte = this.stream.getByte(); 44110 if (nextByte < 0) { 44111 return false; 44112 } 44113 this.buffer = nextByte; 44114 this.bufferLength = 8; 44115 return true; 44116 }, 44117 readBits: function MeshStreamReader_readBits(n) { 44118 var buffer = this.buffer; 44119 var bufferLength = this.bufferLength; 44120 if (n === 32) { 44121 if (bufferLength === 0) { 44122 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 44123 } 44124 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 44125 var nextByte = this.stream.getByte(); 44126 this.buffer = nextByte & (1 << bufferLength) - 1; 44127 return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0; 44128 } 44129 if (n === 8 && bufferLength === 0) { 44130 return this.stream.getByte(); 44131 } 44132 while (bufferLength < n) { 44133 buffer = buffer << 8 | this.stream.getByte(); 44134 bufferLength += 8; 44135 } 44136 bufferLength -= n; 44137 this.bufferLength = bufferLength; 44138 this.buffer = buffer & (1 << bufferLength) - 1; 44139 return buffer >> bufferLength; 44140 }, 44141 align: function MeshStreamReader_align() { 44142 this.buffer = 0; 44143 this.bufferLength = 0; 44144 }, 44145 readFlag: function MeshStreamReader_readFlag() { 44146 return this.readBits(this.context.bitsPerFlag); 44147 }, 44148 readCoordinate: function MeshStreamReader_readCoordinate() { 44149 var bitsPerCoordinate = this.context.bitsPerCoordinate; 44150 var xi = this.readBits(bitsPerCoordinate); 44151 var yi = this.readBits(bitsPerCoordinate); 44152 var decode = this.context.decode; 44153 var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 44154 return [ 44155 xi * scale * (decode[1] - decode[0]) + decode[0], 44156 yi * scale * (decode[3] - decode[2]) + decode[2] 44157 ]; 44158 }, 44159 readComponents: function MeshStreamReader_readComponents() { 44160 var numComps = this.context.numComps; 44161 var bitsPerComponent = this.context.bitsPerComponent; 44162 var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 44163 var decode = this.context.decode; 44164 var components = this.tmpCompsBuf; 44165 for (var i = 0, j = 4; i < numComps; i++, j += 2) { 44166 var ci = this.readBits(bitsPerComponent); 44167 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 44168 } 44169 var color = this.tmpCsCompsBuf; 44170 if (this.context.colorFn) { 44171 this.context.colorFn(components, 0, color, 0); 44172 } 44173 return this.context.colorSpace.getRgb(color, 0); 44174 } 44175 }; 44176 function decodeType4Shading(mesh, reader) { 44177 var coords = mesh.coords; 44178 var colors = mesh.colors; 44179 var operators = []; 44180 var ps = []; 44181 var verticesLeft = 0; 44182 while (reader.hasData) { 44183 var f = reader.readFlag(); 44184 var coord = reader.readCoordinate(); 44185 var color = reader.readComponents(); 44186 if (verticesLeft === 0) { 44187 assert(0 <= f && f <= 2, 'Unknown type4 flag'); 44188 switch (f) { 44189 case 0: 44190 verticesLeft = 3; 44191 break; 44192 case 1: 44193 ps.push(ps[ps.length - 2], ps[ps.length - 1]); 44194 verticesLeft = 1; 44195 break; 44196 case 2: 44197 ps.push(ps[ps.length - 3], ps[ps.length - 1]); 44198 verticesLeft = 1; 44199 break; 44200 } 44201 operators.push(f); 44202 } 44203 ps.push(coords.length); 44204 coords.push(coord); 44205 colors.push(color); 44206 verticesLeft--; 44207 reader.align(); 44208 } 44209 mesh.figures.push({ 44210 type: 'triangles', 44211 coords: new Int32Array(ps), 44212 colors: new Int32Array(ps) 44213 }); 44214 } 44215 function decodeType5Shading(mesh, reader, verticesPerRow) { 44216 var coords = mesh.coords; 44217 var colors = mesh.colors; 44218 var ps = []; 44219 while (reader.hasData) { 44220 var coord = reader.readCoordinate(); 44221 var color = reader.readComponents(); 44222 ps.push(coords.length); 44223 coords.push(coord); 44224 colors.push(color); 44225 } 44226 mesh.figures.push({ 44227 type: 'lattice', 44228 coords: new Int32Array(ps), 44229 colors: new Int32Array(ps), 44230 verticesPerRow: verticesPerRow 44231 }); 44232 } 44233 var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; 44234 var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; 44235 var TRIANGLE_DENSITY = 20; 44236 var getB = function getBClosure() { 44237 function buildB(count) { 44238 var lut = []; 44239 for (var i = 0; i <= count; i++) { 44240 var t = i / count, t_ = 1 - t; 44241 lut.push(new Float32Array([ 44242 t_ * t_ * t_, 44243 3 * t * t_ * t_, 44244 3 * t * t * t_, 44245 t * t * t 44246 ])); 44247 } 44248 return lut; 44249 } 44250 var cache = []; 44251 return function getB(count) { 44252 if (!cache[count]) { 44253 cache[count] = buildB(count); 44254 } 44255 return cache[count]; 44256 }; 44257 }(); 44258 function buildFigureFromPatch(mesh, index) { 44259 var figure = mesh.figures[index]; 44260 assert(figure.type === 'patch', 'Unexpected patch mesh figure'); 44261 var coords = mesh.coords, colors = mesh.colors; 44262 var pi = figure.coords; 44263 var ci = figure.colors; 44264 var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 44265 var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 44266 var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 44267 var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 44268 var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0])); 44269 splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 44270 var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1])); 44271 splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 44272 var verticesPerRow = splitXBy + 1; 44273 var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 44274 var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 44275 var k = 0; 44276 var cl = new Uint8Array(3), cr = new Uint8Array(3); 44277 var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]]; 44278 var bRow = getB(splitYBy), bCol = getB(splitXBy); 44279 for (var row = 0; row <= splitYBy; row++) { 44280 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 44281 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 44282 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 44283 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 44284 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 44285 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 44286 for (var col = 0; col <= splitXBy; col++, k++) { 44287 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 44288 continue; 44289 } 44290 var x = 0, y = 0; 44291 var q = 0; 44292 for (var i = 0; i <= 3; i++) { 44293 for (var j = 0; j <= 3; j++, q++) { 44294 var m = bRow[row][i] * bCol[col][j]; 44295 x += coords[pi[q]][0] * m; 44296 y += coords[pi[q]][1] * m; 44297 } 44298 } 44299 figureCoords[k] = coords.length; 44300 coords.push([ 44301 x, 44302 y 44303 ]); 44304 figureColors[k] = colors.length; 44305 var newColor = new Uint8Array(3); 44306 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 44307 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 44308 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 44309 colors.push(newColor); 44310 } 44311 } 44312 figureCoords[0] = pi[0]; 44313 figureColors[0] = ci[0]; 44314 figureCoords[splitXBy] = pi[3];
44315 figureColors[splitXBy] = ci[1]; 44316 figureCoords[verticesPerRow * splitYBy] = pi[12]; 44317 figureColors[verticesPerRow * splitYBy] = ci[2]; 44318 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 44319 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 44320 mesh.figures[index] = { 44321 type: 'lattice', 44322 coords: figureCoords, 44323 colors: figureColors, 44324 verticesPerRow: verticesPerRow 44325 }; 44326 } 44327 function decodeType6Shading(mesh, reader) { 44328 var coords = mesh.coords; 44329 var colors = mesh.colors; 44330 var ps = new Int32Array(16); 44331 var cs = new Int32Array(4); 44332 while (reader.hasData) { 44333 var f = reader.readFlag(); 44334 assert(0 <= f && f <= 3, 'Unknown type6 flag'); 44335 var i, ii; 44336 var pi = coords.length; 44337 for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 44338 coords.push(reader.readCoordinate()); 44339 } 44340 var ci = colors.length; 44341 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 44342 colors.push(reader.readComponents()); 44343 } 44344 var tmp1, tmp2, tmp3, tmp4; 44345 switch (f) { 44346 case 0: 44347 ps[12] = pi + 3; 44348 ps[13] = pi + 4; 44349 ps[14] = pi + 5; 44350 ps[15] = pi + 6; 44351 ps[8] = pi + 2; 44352 ps[11] = pi + 7; 44353 ps[4] = pi + 1; 44354 ps[7] = pi + 8; 44355 ps[0] = pi; 44356 ps[1] = pi + 11; 44357 ps[2] = pi + 10; 44358 ps[3] = pi + 9; 44359 cs[2] = ci + 1; 44360 cs[3] = ci + 2; 44361 cs[0] = ci; 44362 cs[1] = ci + 3; 44363 break; 44364 case 1: 44365 tmp1 = ps[12]; 44366 tmp2 = ps[13]; 44367 tmp3 = ps[14]; 44368 tmp4 = ps[15]; 44369 ps[12] = tmp4; 44370 ps[13] = pi + 0; 44371 ps[14] = pi + 1; 44372 ps[15] = pi + 2; 44373 ps[8] = tmp3; 44374 ps[11] = pi + 3; 44375 ps[4] = tmp2; 44376 ps[7] = pi + 4; 44377 ps[0] = tmp1; 44378 ps[1] = pi + 7; 44379 ps[2] = pi + 6; 44380 ps[3] = pi + 5; 44381 tmp1 = cs[2]; 44382 tmp2 = cs[3]; 44383 cs[2] = tmp2; 44384 cs[3] = ci; 44385 cs[0] = tmp1; 44386 cs[1] = ci + 1; 44387 break; 44388 case 2: 44389 tmp1 = ps[15]; 44390 tmp2 = ps[11]; 44391 ps[12] = ps[3]; 44392 ps[13] = pi + 0; 44393 ps[14] = pi + 1; 44394 ps[15] = pi + 2; 44395 ps[8] = ps[7]; 44396 ps[11] = pi + 3; 44397 ps[4] = tmp2; 44398 ps[7] = pi + 4; 44399 ps[0] = tmp1; 44400 ps[1] = pi + 7; 44401 ps[2] = pi + 6; 44402 ps[3] = pi + 5; 44403 tmp1 = cs[3]; 44404 cs[2] = cs[1]; 44405 cs[3] = ci; 44406 cs[0] = tmp1; 44407 cs[1] = ci + 1; 44408 break; 44409 case 3: 44410 ps[12] = ps[0]; 44411 ps[13] = pi + 0; 44412 ps[14] = pi + 1; 44413 ps[15] = pi + 2; 44414 ps[8] = ps[1]; 44415 ps[11] = pi + 3; 44416 ps[4] = ps[2]; 44417 ps[7] = pi + 4; 44418 ps[0] = ps[3]; 44419 ps[1] = pi + 7; 44420 ps[2] = pi + 6; 44421 ps[3] = pi + 5; 44422 cs[2] = cs[0]; 44423 cs[3] = ci; 44424 cs[0] = cs[1]; 44425 cs[1] = ci + 1; 44426 break; 44427 } 44428 ps[5] = coords.length; 44429 coords.push([ 44430 (-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, 44431 (-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 44432 ]); 44433 ps[6] = coords.length; 44434 coords.push([ 44435 (-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, 44436 (-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 44437 ]); 44438 ps[9] = coords.length; 44439 coords.push([ 44440 (-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, 44441 (-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 44442 ]); 44443 ps[10] = coords.length; 44444 coords.push([ 44445 (-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, 44446 (-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 44447 ]); 44448 mesh.figures.push({ 44449 type: 'patch', 44450 coords: new Int32Array(ps), 44451 colors: new Int32Array(cs) 44452 }); 44453 } 44454 } 44455 function decodeType7Shading(mesh, reader) { 44456 var coords = mesh.coords; 44457 var colors = mesh.colors; 44458 var ps = new Int32Array(16); 44459 var cs = new Int32Array(4); 44460 while (reader.hasData) { 44461 var f = reader.readFlag(); 44462 assert(0 <= f && f <= 3, 'Unknown type7 flag'); 44463 var i, ii; 44464 var pi = coords.length; 44465 for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 44466 coords.push(reader.readCoordinate()); 44467 } 44468 var ci = colors.length; 44469 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 44470 colors.push(reader.readComponents()); 44471 } 44472 var tmp1, tmp2, tmp3, tmp4; 44473 switch (f) { 44474 case 0: 44475 ps[12] = pi + 3; 44476 ps[13] = pi + 4;
44477 ps[14] = pi + 5; 44478 ps[15] = pi + 6; 44479 ps[8] = pi + 2; 44480 ps[9] = pi + 13; 44481 ps[10] = pi + 14; 44482 ps[11] = pi + 7; 44483 ps[4] = pi + 1; 44484 ps[5] = pi + 12; 44485 ps[6] = pi + 15; 44486 ps[7] = pi + 8; 44487 ps[0] = pi; 44488 ps[1] = pi + 11; 44489 ps[2] = pi + 10; 44490 ps[3] = pi + 9; 44491 cs[2] = ci + 1; 44492 cs[3] = ci + 2; 44493 cs[0] = ci; 44494 cs[1] = ci + 3; 44495 break; 44496 case 1: 44497 tmp1 = ps[12]; 44498 tmp2 = ps[13]; 44499 tmp3 = ps[14]; 44500 tmp4 = ps[15]; 44501 ps[12] = tmp4; 44502 ps[13] = pi + 0; 44503 ps[14] = pi + 1; 44504 ps[15] = pi + 2; 44505 ps[8] = tmp3; 44506 ps[9] = pi + 9; 44507 ps[10] = pi + 10; 44508 ps[11] = pi + 3; 44509 ps[4] = tmp2; 44510 ps[5] = pi + 8; 44511 ps[6] = pi + 11; 44512 ps[7] = pi + 4; 44513 ps[0] = tmp1; 44514 ps[1] = pi + 7; 44515 ps[2] = pi + 6; 44516 ps[3] = pi + 5; 44517 tmp1 = cs[2]; 44518 tmp2 = cs[3]; 44519 cs[2] = tmp2; 44520 cs[3] = ci; 44521 cs[0] = tmp1; 44522 cs[1] = ci + 1; 44523 break; 44524 case 2: 44525 tmp1 = ps[15]; 44526 tmp2 = ps[11]; 44527 ps[12] = ps[3]; 44528 ps[13] = pi + 0; 44529 ps[14] = pi + 1; 44530 ps[15] = pi + 2; 44531 ps[8] = ps[7]; 44532 ps[9] = pi + 9; 44533 ps[10] = pi + 10; 44534 ps[11] = pi + 3; 44535 ps[4] = tmp2; 44536 ps[5] = pi + 8; 44537 ps[6] = pi + 11; 44538 ps[7] = pi + 4; 44539 ps[0] = tmp1; 44540 ps[1] = pi + 7; 44541 ps[2] = pi + 6; 44542 ps[3] = pi + 5; 44543 tmp1 = cs[3]; 44544 cs[2] = cs[1]; 44545 cs[3] = ci; 44546 cs[0] = tmp1; 44547 cs[1] = ci + 1; 44548 break; 44549 case 3: 44550 ps[12] = ps[0]; 44551 ps[13] = pi + 0; 44552 ps[14] = pi + 1; 44553 ps[15] = pi + 2; 44554 ps[8] = ps[1]; 44555 ps[9] = pi + 9; 44556 ps[10] = pi + 10; 44557 ps[11] = pi + 3; 44558 ps[4] = ps[2]; 44559 ps[5] = pi + 8; 44560 ps[6] = pi + 11; 44561 ps[7] = pi + 4; 44562 ps[0] = ps[3]; 44563 ps[1] = pi + 7; 44564 ps[2] = pi + 6; 44565 ps[3] = pi + 5; 44566 cs[2] = cs[0]; 44567 cs[3] = ci; 44568 cs[0] = cs[1]; 44569 cs[1] = ci + 1; 44570 break; 44571 } 44572 mesh.figures.push({ 44573 type: 'patch', 44574 coords: new Int32Array(ps), 44575 colors: new Int32Array(cs) 44576 }); 44577 } 44578 } 44579 function updateBounds(mesh) { 44580 var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY; 44581 for (var i = 1, ii = mesh.coords.length; i < ii; i++) { 44582 var x = mesh.coords[i][0], y = mesh.coords[i][1]; 44583 minX = minX > x ? x : minX; 44584 minY = minY > y ? y : minY; 44585 maxX = maxX < x ? x : maxX; 44586 maxY = maxY < y ? y : maxY; 44587 } 44588 mesh.bounds = [ 44589 minX, 44590 minY, 44591 maxX, 44592 maxY 44593 ]; 44594 } 44595 function packData(mesh) { 44596 var i, ii, j, jj; 44597 var coords = mesh.coords; 44598 var coordsPacked = new Float32Array(coords.length * 2); 44599 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 44600 var xy = coords[i]; 44601 coordsPacked[j++] = xy[0]; 44602 coordsPacked[j++] = xy[1]; 44603 } 44604 mesh.coords = coordsPacked; 44605 var colors = mesh.colors; 44606 var colorsPacked = new Uint8Array(colors.length * 3); 44607 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 44608 var c = colors[i]; 44609 colorsPacked[j++] = c[0]; 44610 colorsPacked[j++] = c[1]; 44611 colorsPacked[j++] = c[2]; 44612 } 44613 mesh.colors = colorsPacked; 44614 var figures = mesh.figures; 44615 for (i = 0, ii = figures.length; i < ii; i++) { 44616 var figure = figures[i], ps = figure.coords, cs = figure.colors; 44617 for (j = 0, jj = ps.length; j < jj; j++) { 44618 ps[j] *= 2; 44619 cs[j] *= 3; 44620 } 44621 } 44622 } 44623 function Mesh(stream, matrix, xref, res) { 44624 assert(isStream(stream), 'Mesh data is not a stream'); 44625 var dict = stream.dict; 44626 this.matrix = matrix; 44627 this.shadingType = dict.get('ShadingType'); 44628 this.type = 'Pattern'; 44629 this.bbox = dict.getArray('BBox'); 44630 var cs = dict.get('ColorSpace', 'CS'); 44631 cs = ColorSpace.parse(cs, xref, res); 44632 this.cs = cs; 44633 this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null; 44634 var fnObj = dict.get('Function'); 44635 var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null; 44636 this.coords = []; 44637 this.colors = []; 44638 this.figures = []; 44639 var decodeContext = {
44640 bitsPerCoordinate: dict.get('BitsPerCoordinate'), 44641 bitsPerComponent: dict.get('BitsPerComponent'), 44642 bitsPerFlag: dict.get('BitsPerFlag'), 44643 decode: dict.getArray('Decode'), 44644 colorFn: fn, 44645 colorSpace: cs, 44646 numComps: fn ? 1 : cs.numComps 44647 }; 44648 var reader = new MeshStreamReader(stream, decodeContext); 44649 var patchMesh = false; 44650 switch (this.shadingType) { 44651 case ShadingType.FREE_FORM_MESH: 44652 decodeType4Shading(this, reader); 44653 break; 44654 case ShadingType.LATTICE_FORM_MESH: 44655 var verticesPerRow = dict.get('VerticesPerRow') | 0; 44656 assert(verticesPerRow >= 2, 'Invalid VerticesPerRow'); 44657 decodeType5Shading(this, reader, verticesPerRow); 44658 break; 44659 case ShadingType.COONS_PATCH_MESH: 44660 decodeType6Shading(this, reader); 44661 patchMesh = true; 44662 break; 44663 case ShadingType.TENSOR_PATCH_MESH: 44664 decodeType7Shading(this, reader); 44665 patchMesh = true; 44666 break; 44667 default: 44668 error('Unsupported mesh type.'); 44669 break; 44670 } 44671 if (patchMesh) { 44672 updateBounds(this); 44673 for (var i = 0, ii = this.figures.length; i < ii; i++) { 44674 buildFigureFromPatch(this, i); 44675 } 44676 } 44677 updateBounds(this); 44678 packData(this); 44679 } 44680 Mesh.prototype = { 44681 getIR: function Mesh_getIR() { 44682 return [ 44683 'Mesh', 44684 this.shadingType, 44685 this.coords, 44686 this.colors, 44687 this.figures, 44688 this.bounds, 44689 this.matrix, 44690 this.bbox, 44691 this.background 44692 ]; 44693 } 44694 }; 44695 return Mesh; 44696 }(); 44697 Shadings.Dummy = function DummyClosure() { 44698 function Dummy() { 44699 this.type = 'Pattern'; 44700 } 44701 Dummy.prototype = { 44702 getIR: function Dummy_getIR() { 44703 return ['Dummy']; 44704 } 44705 }; 44706 return Dummy; 44707 }(); 44708 function getTilingPatternIR(operatorList, dict, args) { 44709 var matrix = dict.getArray('Matrix'); 44710 var bbox = dict.getArray('BBox'); 44711 var xstep = dict.get('XStep'); 44712 var ystep = dict.get('YStep'); 44713 var paintType = dict.get('PaintType'); 44714 var tilingType = dict.get('TilingType'); 44715 return [ 44716 'TilingPattern', 44717 args, 44718 operatorList, 44719 matrix, 44720 bbox, 44721 xstep, 44722 ystep, 44723 paintType, 44724 tilingType 44725 ]; 44726 } 44727 exports.Pattern = Pattern; 44728 exports.getTilingPatternIR = getTilingPatternIR; 44729 })); 44730 (function (root, factory) { 44731 factory(root.pdfjsCoreEvaluator = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser, root.pdfjsCoreImage, root.pdfjsCoreColorSpace, root.pdfjsCoreMurmurHash3, root.pdfjsCoreFonts, root.pdfjsCoreFunction, root.pdfjsCorePattern, root.pdfjsCoreCMap, root.pdfjsCoreMetrics, root.pdfjsCoreBidi, root.pdfjsCoreEncodings, root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode, root.pdfjsCoreGlyphList); 44732 }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser, coreImage, coreColorSpace, coreMurmurHash3, coreFonts, coreFunction, corePattern, coreCMap, coreMetrics, coreBidi, coreEncodings, coreStandardFonts, coreUnicode, coreGlyphList) { 44733 var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX; 44734 var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; 44735 var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES; 44736 var ImageKind = sharedUtil.ImageKind; 44737 var OPS = sharedUtil.OPS; 44738 var TextRenderingMode = sharedUtil.TextRenderingMode; 44739 var Util = sharedUtil.Util; 44740 var assert = sharedUtil.assert; 44741 var createPromiseCapability = sharedUtil.createPromiseCapability; 44742 var error = sharedUtil.error; 44743 var info = sharedUtil.info; 44744 var isArray = sharedUtil.isArray; 44745 var isNum = sharedUtil.isNum; 44746 var isString = sharedUtil.isString; 44747 var getLookupTableFactory = sharedUtil.getLookupTableFactory; 44748 var warn = sharedUtil.warn; 44749 var Dict = corePrimitives.Dict; 44750 var Name = corePrimitives.Name; 44751 var isEOF = corePrimitives.isEOF; 44752 var isCmd = corePrimitives.isCmd; 44753 var isDict = corePrimitives.isDict; 44754 var isName = corePrimitives.isName; 44755 var isRef = corePrimitives.isRef; 44756 var isStream = corePrimitives.isStream; 44757 var DecodeStream = coreStream.DecodeStream; 44758 var JpegStream = coreStream.JpegStream; 44759 var Stream = coreStream.Stream; 44760 var Lexer = coreParser.Lexer; 44761 var Parser = coreParser.Parser; 44762 var PDFImage = coreImage.PDFImage; 44763 var ColorSpace = coreColorSpace.ColorSpace; 44764 var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64; 44765 var ErrorFont = coreFonts.ErrorFont; 44766 var FontFlags = coreFonts.FontFlags; 44767 var Font = coreFonts.Font; 44768 var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap; 44769 var ToUnicodeMap = coreFonts.ToUnicodeMap; 44770 var getFontType = coreFonts.getFontType; 44771 var isPDFFunction = coreFunction.isPDFFunction; 44772 var PDFFunction = coreFunction.PDFFunction; 44773 var Pattern = corePattern.Pattern; 44774 var getTilingPatternIR = corePattern.getTilingPatternIR; 44775 var CMapFactory = coreCMap.CMapFactory; 44776 var IdentityCMap = coreCMap.IdentityCMap; 44777 var getMetrics = coreMetrics.getMetrics; 44778 var bidi = coreBidi.bidi; 44779 var WinAnsiEncoding = coreEncodings.WinAnsiEncoding; 44780 var StandardEncoding = coreEncodings.StandardEncoding; 44781 var MacRomanEncoding = coreEncodings.MacRomanEncoding; 44782 var SymbolSetEncoding = coreEncodings.SymbolSetEncoding; 44783 var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding; 44784 var getEncoding = coreEncodings.getEncoding; 44785 var getStdFontMap = coreStandardFonts.getStdFontMap; 44786 var getSerifFonts = coreStandardFonts.getSerifFonts; 44787 var getSymbolsFonts = coreStandardFonts.getSymbolsFonts; 44788 var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes; 44789 var reverseIfRtl = coreUnicode.reverseIfRtl; 44790 var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph; 44791 var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode; 44792 var PartialEvaluator = function PartialEvaluatorClosure() { 44793 var DefaultPartialEvaluatorOptions = { 44794 forceDataSchema: false, 44795 maxImageSize: -1, 44796 disableFontFace: false, 44797 cMapOptions: { 44798 url: null,
44799 packed: false 44800 } 44801 }; 44802 function NativeImageDecoder(xref, resources, handler, forceDataSchema) { 44803 this.xref = xref; 44804 this.resources = resources; 44805 this.handler = handler; 44806 this.forceDataSchema = forceDataSchema; 44807 } 44808 NativeImageDecoder.prototype = { 44809 canDecode: function (image) { 44810 return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources); 44811 }, 44812 decode: function (image) { 44813 var dict = image.dict; 44814 var colorSpace = dict.get('ColorSpace', 'CS'); 44815 colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources); 44816 var numComps = colorSpace.numComps; 44817 var decodePromise = this.handler.sendWithPromise('JpegDecode', [ 44818 image.getIR(this.forceDataSchema), 44819 numComps 44820 ]); 44821 return decodePromise.then(function (message) { 44822 var data = message.data; 44823 return new Stream(data, 0, data.length, image.dict); 44824 }); 44825 } 44826 }; 44827 NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) { 44828 var dict = image.dict; 44829 if (dict.has('DecodeParms') || dict.has('DP')) { 44830 return false; 44831 } 44832 var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); 44833 return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D')); 44834 }; 44835 NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) { 44836 var dict = image.dict; 44837 if (dict.has('DecodeParms') || dict.has('DP')) { 44838 return false; 44839 } 44840 var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); 44841 return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D')); 44842 }; 44843 function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, options) { 44844 this.pdfManager = pdfManager; 44845 this.xref = xref; 44846 this.handler = handler; 44847 this.pageIndex = pageIndex; 44848 this.idFactory = idFactory; 44849 this.fontCache = fontCache; 44850 this.options = options || DefaultPartialEvaluatorOptions; 44851 } 44852 var TIME_SLOT_DURATION_MS = 20; 44853 var CHECK_TIME_EVERY = 100; 44854 function TimeSlotManager() { 44855 this.reset(); 44856 } 44857 TimeSlotManager.prototype = { 44858 check: function TimeSlotManager_check() { 44859 if (++this.checked < CHECK_TIME_EVERY) { 44860 return false; 44861 } 44862 this.checked = 0; 44863 return this.endTime <= Date.now(); 44864 }, 44865 reset: function TimeSlotManager_reset() { 44866 this.endTime = Date.now() + TIME_SLOT_DURATION_MS; 44867 this.checked = 0; 44868 } 44869 }; 44870 var deferred = Promise.resolve(); 44871 var TILING_PATTERN = 1, SHADING_PATTERN = 2; 44872 PartialEvaluator.prototype = { 44873 hasBlendModes: function PartialEvaluator_hasBlendModes(resources) { 44874 if (!isDict(resources)) { 44875 return false; 44876 } 44877 var processed = Object.create(null); 44878 if (resources.objId) { 44879 processed[resources.objId] = true; 44880 } 44881 var nodes = [resources], xref = this.xref; 44882 while (nodes.length) { 44883 var key, i, ii; 44884 var node = nodes.shift(); 44885 var graphicStates = node.get('ExtGState'); 44886 if (isDict(graphicStates)) { 44887 var graphicStatesKeys = graphicStates.getKeys(); 44888 for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) { 44889 key = graphicStatesKeys[i]; 44890 var graphicState = graphicStates.get(key); 44891 var bm = graphicState.get('BM'); 44892 if (isName(bm) && bm.name !== 'Normal') { 44893 return true; 44894 } 44895 } 44896 } 44897 var xObjects = node.get('XObject'); 44898 if (!isDict(xObjects)) { 44899 continue; 44900 } 44901 var xObjectsKeys = xObjects.getKeys(); 44902 for (i = 0, ii = xObjectsKeys.length; i < ii; i++) { 44903 key = xObjectsKeys[i]; 44904 var xObject = xObjects.getRaw(key); 44905 if (isRef(xObject)) { 44906 if (processed[xObject.toString()]) { 44907 continue; 44908 } 44909 xObject = xref.fetch(xObject); 44910 } 44911 if (!isStream(xObject)) { 44912 continue; 44913 } 44914 if (xObject.dict.objId) { 44915 if (processed[xObject.dict.objId]) { 44916 continue; 44917 } 44918 processed[xObject.dict.objId] = true; 44919 } 44920 var xResources = xObject.dict.get('Resources'); 44921 if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) { 44922 nodes.push(xResources); 44923 if (xResources.objId) { 44924 processed[xResources.objId] = true; 44925 } 44926 } 44927 } 44928 } 44929 return false;
44930 }, 44931 buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) { 44932 var matrix = xobj.dict.getArray('Matrix'); 44933 var bbox = xobj.dict.getArray('BBox'); 44934 var group = xobj.dict.get('Group'); 44935 if (group) { 44936 var groupOptions = { 44937 matrix: matrix, 44938 bbox: bbox, 44939 smask: smask, 44940 isolated: false, 44941 knockout: false 44942 }; 44943 var groupSubtype = group.get('S'); 44944 var colorSpace; 44945 if (isName(groupSubtype, 'Transparency')) { 44946 groupOptions.isolated = group.get('I') || false; 44947 groupOptions.knockout = group.get('K') || false; 44948 colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null; 44949 } 44950 if (smask && smask.backdrop) { 44951 colorSpace = colorSpace || ColorSpace.singletons.rgb; 44952 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 44953 } 44954 operatorList.addOp(OPS.beginGroup, [groupOptions]); 44955 } 44956 operatorList.addOp(OPS.paintFormXObjectBegin, [ 44957 matrix, 44958 bbox 44959 ]); 44960 return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () { 44961 operatorList.addOp(OPS.paintFormXObjectEnd, []); 44962 if (group) { 44963 operatorList.addOp(OPS.endGroup, [groupOptions]); 44964 } 44965 }); 44966 }, 44967 buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) { 44968 var self = this; 44969 var dict = image.dict; 44970 var w = dict.get('Width', 'W'); 44971 var h = dict.get('Height', 'H'); 44972 if (!(w && isNum(w)) || !(h && isNum(h))) { 44973 warn('Image dimensions are missing, or not numbers.'); 44974 return; 44975 } 44976 var maxImageSize = this.options.maxImageSize; 44977 if (maxImageSize !== -1 && w * h > maxImageSize) { 44978 warn('Image exceeded maximum allowed size and was removed.'); 44979 return; 44980 } 44981 var imageMask = dict.get('ImageMask', 'IM') || false; 44982 var imgData, args; 44983 if (imageMask) { 44984 var width = dict.get('Width', 'W'); 44985 var height = dict.get('Height', 'H'); 44986 var bitStrideLength = width + 7 >> 3; 44987 var imgArray = image.getBytes(bitStrideLength * height); 44988 var decode = dict.getArray('Decode', 'D'); 44989 var inverseDecode = !!decode && decode[0] > 0; 44990 imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode); 44991 imgData.cached = true; 44992 args = [imgData]; 44993 operatorList.addOp(OPS.paintImageMaskXObject, args); 44994 if (cacheKey) { 44995 imageCache[cacheKey] = { 44996 fn: OPS.paintImageMaskXObject, 44997 args: args 44998 }; 44999 } 45000 return; 45001 } 45002 var softMask = dict.get('SMask', 'SM') || false; 45003 var mask = dict.get('Mask') || false; 45004 var SMALL_IMAGE_DIMENSIONS = 200; 45005 if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) { 45006 var imageObj = new PDFImage(this.xref, resources, image, inline, null, null); 45007 imgData = imageObj.createImageData(true); 45008 operatorList.addOp(OPS.paintInlineImageXObject, [imgData]); 45009 return; 45010 } 45011 var objId = 'img_' + this.idFactory.createObjId(); 45012 operatorList.addDependency(objId); 45013 args = [ 45014 objId, 45015 w, 45016 h 45017 ]; 45018 if (!softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) { 45019 operatorList.addOp(OPS.paintJpegXObject, args); 45020 this.handler.send('obj', [ 45021 objId, 45022 this.pageIndex, 45023 'JpegStream', 45024 image.getIR(this.options.forceDataSchema) 45025 ]); 45026 return; 45027 } 45028 var nativeImageDecoder = null; 45029 if (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream) { 45030 nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema); 45031 } 45032 PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) { 45033 var imgData = imageObj.createImageData(false); 45034 self.handler.send('obj', [ 45035 objId, 45036 self.pageIndex, 45037 'Image', 45038 imgData 45039 ], [imgData.data.buffer]); 45040 }).then(undefined, function (reason) { 45041 warn('Unable to decode image: ' + reason); 45042 self.handler.send('obj', [ 45043 objId, 45044 self.pageIndex, 45045 'Image', 45046 null 45047 ]); 45048 }); 45049 operatorList.addOp(OPS.paintImageXObject, args); 45050 if (cacheKey) { 45051 imageCache[cacheKey] = { 45052 fn: OPS.paintImageXObject, 45053 args: args 45054 }; 45055 } 45056 }, 45057 handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { 45058 var smaskContent = smask.get('G'); 45059 var smaskOptions = { 45060 subtype: smask.get('S').name, 45061 backdrop: smask.get('BC') 45062 }; 45063 var transferObj = smask.get('TR');
45064 if (isPDFFunction(transferObj)) { 45065 var transferFn = PDFFunction.parse(this.xref, transferObj); 45066 var transferMap = new Uint8Array(256); 45067 var tmp = new Float32Array(1); 45068 for (var i = 0; i < 256; i++) { 45069 tmp[0] = i / 255; 45070 transferFn(tmp, 0, tmp, 0); 45071 transferMap[i] = tmp[0] * 255 | 0; 45072 } 45073 smaskOptions.transferMap = transferMap; 45074 } 45075 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone()); 45076 }, 45077 handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) { 45078 var tilingOpList = new OperatorList(); 45079 var resourcesArray = [ 45080 patternDict.get('Resources'), 45081 resources 45082 ]; 45083 var patternResources = Dict.merge(this.xref, resourcesArray); 45084 return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () { 45085 operatorList.addDependencies(tilingOpList.dependencies); 45086 operatorList.addOp(fn, getTilingPatternIR({ 45087 fnArray: tilingOpList.fnArray, 45088 argsArray: tilingOpList.argsArray 45089 }, patternDict, args)); 45090 }); 45091 }, 45092 handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) { 45093 var fontName; 45094 if (fontArgs) { 45095 fontArgs = fontArgs.slice(); 45096 fontName = fontArgs[0].name; 45097 } 45098 var self = this; 45099 return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) { 45100 if (!translated.font.isType3Font) { 45101 return translated; 45102 } 45103 return translated.loadType3Data(self, resources, operatorList, task).then(function () { 45104 return translated; 45105 }, function (reason) { 45106 self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font }); 45107 return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font); 45108 }); 45109 }).then(function (translated) { 45110 state.font = translated.font; 45111 translated.send(self.handler); 45112 return translated.loadedName; 45113 }); 45114 },
45115 handleText: function PartialEvaluator_handleText(chars, state) { 45116 var font = state.font; 45117 var glyphs = font.charsToGlyphs(chars); 45118 var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG); 45119 if (font.data && (isAddToPathSet || this.options.disableFontFace)) { 45120 var buildPath = function (fontChar) { 45121 if (!font.renderer.hasBuiltPath(fontChar)) { 45122 var path = font.renderer.getPathJs(fontChar); 45123 this.handler.send('commonobj', [ 45124 font.loadedName + '_path_' + fontChar, 45125 'FontPath', 45126 path 45127 ]); 45128 } 45129 }.bind(this); 45130 for (var i = 0, ii = glyphs.length; i < ii; i++) { 45131 var glyph = glyphs[i]; 45132 buildPath(glyph.fontChar); 45133 var accent = glyph.accent; 45134 if (accent && accent.fontChar) { 45135 buildPath(accent.fontChar); 45136 } 45137 } 45138 } 45139 return glyphs; 45140 }, 45141 setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) { 45142 var gStateObj = []; 45143 var gStateKeys = gState.getKeys(); 45144 var self = this; 45145 var promise = Promise.resolve(); 45146 for (var i = 0, ii = gStateKeys.length; i < ii; i++) { 45147 var key = gStateKeys[i]; 45148 var value = gState.get(key); 45149 switch (key) { 45150 case 'Type': 45151 break; 45152 case 'LW': 45153 case 'LC': 45154 case 'LJ': 45155 case 'ML': 45156 case 'D': 45157 case 'RI': 45158 case 'FL': 45159 case 'CA': 45160 case 'ca': 45161 gStateObj.push([ 45162 key, 45163 value 45164 ]); 45165 break; 45166 case 'Font': 45167 promise = promise.then(function () { 45168 return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 45169 operatorList.addDependency(loadedName); 45170 gStateObj.push([ 45171 key, 45172 [ 45173 loadedName, 45174 value[1] 45175 ] 45176 ]); 45177 }); 45178 }); 45179 break; 45180 case 'BM': 45181 gStateObj.push([ 45182 key, 45183 value 45184 ]); 45185 break; 45186 case 'SMask': 45187 if (isName(value, 'None')) { 45188 gStateObj.push([ 45189 key, 45190 false 45191 ]); 45192 break; 45193 } 45194 if (isDict(value)) { 45195 promise = promise.then(function (dict) { 45196 return self.handleSMask(dict, resources, operatorList, task, stateManager); 45197 }.bind(this, value)); 45198 gStateObj.push([ 45199 key, 45200 true 45201 ]); 45202 } else { 45203 warn('Unsupported SMask type'); 45204 } 45205 break; 45206 case 'OP': 45207 case 'op': 45208 case 'OPM': 45209 case 'BG': 45210 case 'BG2': 45211 case 'UCR': 45212 case 'UCR2': 45213 case 'TR': 45214 case 'TR2': 45215 case 'HT': 45216 case 'SM': 45217 case 'SA': 45218 case 'AIS': 45219 case 'TK': 45220 info('graphic state operator ' + key); 45221 break; 45222 default: 45223 info('Unknown graphic state operator ' + key); 45224 break; 45225 } 45226 } 45227 return promise.then(function () { 45228 if (gStateObj.length > 0) { 45229 operatorList.addOp(OPS.setGState, [gStateObj]); 45230 } 45231 }); 45232 }, 45233 loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) { 45234 function errorFont() { 45235 return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font)); 45236 } 45237 var fontRef; 45238 if (font) { 45239 assert(isRef(font)); 45240 fontRef = font; 45241 } else { 45242 var fontRes = resources.get('Font'); 45243 if (fontRes) { 45244 fontRef = fontRes.getRaw(fontName); 45245 } else { 45246 warn('fontRes not available'); 45247 return errorFont(); 45248 } 45249 } 45250 if (!fontRef) { 45251 warn('fontRef not available'); 45252 return errorFont(); 45253 } 45254 if (this.fontCache.has(fontRef)) { 45255 return this.fontCache.get(fontRef); 45256 } 45257 font = xref.fetchIfRef(fontRef); 45258 if (!isDict(font)) { 45259 return errorFont(); 45260 } 45261 if (font.translated) { 45262 return font.translated; 45263 } 45264 var fontCapability = createPromiseCapability(); 45265 var preEvaluatedFont = this.preEvaluateFont(font, xref); 45266 var descriptor = preEvaluatedFont.descriptor; 45267 var fontRefIsRef = isRef(fontRef), fontID; 45268 if (fontRefIsRef) { 45269 fontID = fontRef.toString(); 45270 } 45271 if (isDict(descriptor)) { 45272 if (!descriptor.fontAliases) { 45273 descriptor.fontAliases = Object.create(null); 45274 } 45275 var fontAliases = descriptor.fontAliases; 45276 var hash = preEvaluatedFont.hash; 45277 if (fontAliases[hash]) { 45278 var aliasFontRef = fontAliases[hash].aliasRef; 45279 if (fontRefIsRef && aliasFontRef && this.fontCache.has(ali
45279asFontRef)) { 45280 this.fontCache.putAlias(fontRef, aliasFontRef); 45281 return this.fontCache.get(fontRef); 45282 } 45283 } else { 45284 fontAliases[hash] = { fontID: Font.getFontID() }; 45285 } 45286 if (fontRefIsRef) { 45287 fontAliases[hash].aliasRef = fontRef; 45288 } 45289 fontID = fontAliases[hash].fontID; 45290 } 45291 if (fontRefIsRef) { 45292 this.fontCache.put(fontRef, fontCapability.promise); 45293 } else { 45294 if (!fontID) { 45295 fontID = this.idFactory.createObjId(); 45296 } 45297 this.fontCache.put('id_' + fontID, fontCapability.promise); 45298 } 45299 assert(fontID, 'The "fontID" must be defined.'); 45300 font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID; 45301 font.translated = fontCapability.promise; 45302 var translatedPromise; 45303 try { 45304 translatedPromise = this.translateFont(preEvaluatedFont, xref); 45305 } catch (e) { 45306 translatedPromise = Promise.reject(e); 45307 } 45308 var self = this; 45309 translatedPromise.then(function (translatedFont) { 45310 if (translatedFont.fontType !== undefined) { 45311 var xrefFontStats = xref.stats.fontTypes; 45312 xrefFontStats[translatedFont.fontType] = true; 45313 } 45314 fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font)); 45315 }, function (reason) { 45316 self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font }); 45317 try { 45318 var descriptor = preEvaluatedFont.descriptor; 45319 var fontFile3 = descriptor && descriptor.get('FontFile3'); 45320 var subtype = fontFile3 && fontFile3.get('Subtype'); 45321 var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name); 45322 var xrefFontStats = xref.stats.fontTypes; 45323 xrefFontStats[fontType] = true; 45324 } catch (ex) { 45325 } 45326 fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font)); 45327 }); 45328 return fontCapability.promise; 45329 }, 45330 buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) { 45331 var lastIndex = operatorList.length - 1; 45332 if (!args) { 45333 args = []; 45334 } 45335 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) { 45336 operatorList.addOp(OPS.constructPath, [ 45337 [fn], 45338 args 45339 ]); 45340 } else { 45341 var opArgs = operatorList.argsArray[lastIndex]; 45342 opArgs[0].push(fn); 45343 Array.prototype.push.apply(opArgs[1], args); 45344 } 45345 }, 45346 handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) { 45347 var patternName = args[args.length - 1]; 45348 var pattern; 45349 if (isName(patternName) && (pattern = patterns.get(patternName.name))) { 45350 var dict = isStream(pattern) ? pattern.dict : pattern; 45351 var typeNum = dict.get('PatternType'); 45352 if (typeNum === TILING_PATTERN) { 45353 var color = cs.base ? cs.base.getRgb(args, 0) : null; 45354 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task); 45355 } else if (typeNum === SHADING_PATTERN) { 45356 var shading = dict.get('Shading'); 45357 var matrix = dict.getArray('Matrix'); 45358 pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler); 45359 operatorList.addOp(fn, pattern.getIR()); 45360 return Promise.resolve(); 45361 } 45362 return Promise.reject('Unknown PatternType: ' + typeNum); 45363 } 45364 operatorList.addOp(fn, args); 45365 return Promise.resolve(); 45366 }, 45367 getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) { 45368 var self = this; 45369 var xref = this.xref; 45370 var imageCache = Object.create(null); 45371 assert(operatorList); 45372 resources = resources || Dict.empty; 45373 var xobjs = resources.get('XObject') || Dict.empty; 45374 var patterns = resources.get('Pattern') || Dict.empty; 45375 var stateManager = new StateManager(initialState || new EvalState()); 45376 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 45377 var timeSlotManager = new TimeSlotManager(); 45378 return new Promise(function promiseBody(resolve, reject) { 45379 var next = function (promise) { 45380 promise.then(function () { 45381 try { 45382 promiseBody(resolve, reject); 45383 } catch (ex) { 45384 reject(ex); 45385 } 45386 }, reject); 45387 }; 45388 task.ensureNotTerminated(); 45389 timeSlotManager.reset(); 45390 var stop, operation = {}, i, ii, cs; 45391 while (!(stop = timeSlotManager.check())) { 45392 operation.args = null; 45393 if (!preprocessor.read(operation)) { 45394 break; 45395 } 45396 var args = operation.args; 45397 var fn = operation.fn; 45398 switch (fn | 0) { 45399 case OPS.paintXObject:
45400 if (args[0].code) { 45401 break; 45402 } 45403 var name = args[0].name; 45404 if (!name) { 45405 warn('XObject must be referred to by name.'); 45406 continue; 45407 } 45408 if (imageCache[name] !== undefined) { 45409 operatorList.addOp(imageCache[name].fn, imageCache[name].args); 45410 args = null; 45411 continue; 45412 } 45413 var xobj = xobjs.get(name); 45414 if (xobj) { 45415 assert(isStream(xobj), 'XObject should be a stream'); 45416 var type = xobj.dict.get('Subtype'); 45417 assert(isName(type), 'XObject should have a Name subtype'); 45418 if (type.name === 'Form') { 45419 stateManager.save(); 45420 next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () { 45421 stateManager.restore(); 45422 })); 45423 return; 45424 } else if (type.name === 'Image') { 45425 self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache); 45426 args = null; 45427 continue; 45428 } else if (type.name === 'PS') { 45429 info('Ignored XObject subtype PS'); 45430 continue; 45431 } else { 45432 error('Unhandled XObject subtype ' + type.name); 45433 } 45434 } 45435 break; 45436 case OPS.setFont: 45437 var fontSize = args[1]; 45438 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) { 45439 operatorList.addDependency(loadedName); 45440 operatorList.addOp(OPS.setFont, [ 45441 loadedName, 45442 fontSize 45443 ]); 45444 })); 45445 return; 45446 case OPS.endInlineImage: 45447 var cacheKey = args[0].cacheKey; 45448 if (cacheKey) { 45449 var cacheEntry = imageCache[cacheKey]; 45450 if (cacheEntry !== undefined) { 45451 operatorList.addOp(cacheEntry.fn, cacheEntry.args); 45452 args = null; 45453 continue; 45454 } 45455 } 45456 self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache); 45457 args = null; 45458 continue; 45459 case OPS.showText: 45460 args[0] = self.handleText(args[0], stateManager.state); 45461 break; 45462 case OPS.showSpacedText: 45463 var arr = args[0]; 45464 var combinedGlyphs = []; 45465 var arrLength = arr.length; 45466 var state = stateManager.state; 45467 for (i = 0; i < arrLength; ++i) { 45468 var arrItem = arr[i]; 45469 if (isString(arrItem)) { 45470 Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); 45471 } else if (isNum(arrItem)) { 45472 combinedGlyphs.push(arrItem); 45473 } 45474 } 45475 args[0] = combinedGlyphs; 45476 fn = OPS.showText; 45477 break; 45478 case OPS.nextLineShowText: 45479 operatorList.addOp(OPS.nextLine); 45480 args[0] = self.handleText(args[0], stateManager.state); 45481 fn = OPS.showText; 45482 break; 45483 case OPS.nextLineSetSpacingShowText: 45484 operatorList.addOp(OPS.nextLine); 45485 operatorList.addOp(OPS.setWordSpacing, [args.shift()]); 45486 operatorList.addOp(OPS.setCharSpacing, [args.shift()]); 45487 args[0] = self.handleText(args[0], stateManager.state); 45488 fn = OPS.showText; 45489 break; 45490 case OPS.setTextRenderingMode: 45491 stateManager.state.textRenderingMode = args[0]; 45492 break; 45493 case OPS.setFillColorSpace: 45494 stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources); 45495 continue; 45496 case OPS.setStrokeColorSpace: 45497 stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources); 45498 continue; 45499 case OPS.setFillColor: 45500 cs = stateManager.state.fillColorSpace; 45501 args = cs.getRgb(args, 0); 45502 fn = OPS.setFillRGBColor; 45503 break; 45504 case OPS.setStrokeColor: 45505 cs = stateManager.state.strokeColorSpace; 45506 args = cs.getRgb(args, 0); 45507 fn = OPS.setStrokeRGBColor; 45508 break; 45509 case OPS.setFillGray: 45510 stateManager.state.fillColorSpace = ColorSpace.singletons.gray; 45511 args = ColorSpace.singletons.gray.getRgb(args, 0); 45512 fn = OPS.setFillRGBColor; 45513 break; 45514 case OPS.setStrokeGray: 45515 stateManager.state.strokeColorSpace = ColorSpace.singletons.gray; 45516 args = ColorSpace.singletons.gray.getRgb(args, 0); 45517 fn = OPS.setStrokeRGBColor; 45518 break; 45519 case OPS.setFillCMYKColor: 45520 stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk; 45521 args = ColorSpace.singletons.cmyk.getRgb(args, 0); 45522 fn = OPS.setFillRGBColor; 45523 break; 45524 case OPS.setStrokeCMYKColor: 45525 stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk; 45526 args = ColorSpace.singletons.cmyk.getRgb(args, 0); 45527 fn = OPS.setStrokeRGBColor; 45528 break; 45529 case OPS.setFillRGBColor: 45530 stateManager.state.fillColorSpace = ColorSpace.singletons.rgb; 45531 args = ColorSpace.singletons.rgb.getRgb(args, 0); 45532 break; 45533 case OPS.setStrokeRGBColor: 45534 stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb; 45535 args = ColorSpace.singletons.rgb.getRgb(args, 0); 45536 break; 45537 case OPS.setFillColorN: 45538 cs = stateManager.state.fillColorSpace; 45539 if (cs.name === 'Pattern') { 45540 next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref)); 45541 return; 45542 } 45543 args = cs.getRgb(args, 0); 45544 fn = OPS.setFillRGBColor; 45545 break; 45546 case OPS.setStrokeColorN: 45547 cs = stateManager.state.strokeColorSpace; 45548 if (cs.name === 'Pattern') { 45549 next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref)); 45550 return; 45551 } 45552 args = cs.getRgb(args, 0); 45553 fn = OPS.setStrokeRGBColor; 45554 break; 45555 case OPS.shadingFill: 45556 var shadingRes = resources.get('Shading'); 45557 if (!shadingRes) { 45558 error('No shading resource found'); 45559 } 45560 var shading = shadingRes.get(args[0].name); 45561 if (!shading) { 45562 error('No shading object found'); 45563 } 45564 var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler); 45565 var patternIR = shadingFill.getIR(); 45566 args = [patternIR]; 45567 fn = OPS.shadingFill; 45568 break; 45569 case OPS.setGState: 45570 var dictName = args[0]; 45571 var extGState = resources.get('ExtGState'); 45572 if (!isDict(extGState) || !extGState.has(dictName.name)) { 45573 break; 45574 } 45575 var gState = extGState.get(dictName.name); 45576 next(self.setGState(resources, gState, operatorList, task, xref, stateManager)); 45577 return; 45578 case OPS.moveTo: 45579 case OPS.lineTo: 45580 case OPS.curveTo: 45581 case OPS.curveTo2: 45582 case OPS.curveTo3: 45583 case OPS.closePath: 45584 self.buildPath(operatorList, fn, args); 45585 continue; 45586 case OPS.rectangle: 45587 self.buildPath(operatorList, fn, args); 45588 continue; 45589 case OPS.markPoint: 45590 case OPS.markPointProps: 45591 case OPS.beginMarkedContent: 45592 case OPS.beginMarkedContentProps: 45593 case OPS.endMarkedContent: 45594 case OPS.beginCompat: 45595 case OPS.endCompat: 45596 continue; 45597 default: 45598 if (args !== null) { 45599 for (i = 0, ii = args.length; i < ii; i++) { 45600 if (args[i] instanceof Dict) { 45601 break; 45602 } 45603 } 45604 if (i < ii) { 45605 warn('getOperatorList - ignoring operator: ' + fn); 45606 continue; 45607 } 45608 } 45609 } 45610 operatorList.addOp(fn, args); 45611 } 45612 if (stop) { 45613 next(deferred); 45614 return; 45615 } 45616 for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 45617 operatorList.addOp(OPS.restore, []); 45618 } 45619 resolve(); 45620 }); 45621 }, 45622 getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) { 45623 stateManager = stateManager || new StateManager(new TextState()); 45624 var WhitespaceRegexp = /\s/g; 45625 var textContent = { 45626 items: [], 45627 styles: Object.create(null) 45628 }; 45629 var textContentItem = { 45630 initialized: false, 45631 str: [], 45632 width: 0, 45633 height: 0, 45634 vertical: false, 45635 lastAdvanceWidth: 0, 45636 lastAdvanceHeight: 0, 45637 textAdvanceScale: 0, 45638 spaceWidth: 0, 45639 fakeSpaceMin: Infinity, 45640 fakeMultiSpaceMin: Infinity, 45641 fakeMultiSpaceMax: -0,
45642 textRunBreakAllowed: false, 45643 transform: null, 45644 fontName: null 45645 }; 45646 var SPACE_FACTOR = 0.3; 45647 var MULTI_SPACE_FACTOR = 1.5; 45648 var MULTI_SPACE_FACTOR_MAX = 4; 45649 var self = this; 45650 var xref = this.xref; 45651 resources = xref.fetchIfRef(resources) || Dict.empty; 45652 var xobjs = null; 45653 var xobjsCache = Object.create(null); 45654 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 45655 var textState; 45656 function ensureTextContentItem() { 45657 if (textContentItem.initialized) { 45658 return textContentItem; 45659 } 45660 var font = textState.font; 45661 if (!(font.loadedName in textContent.styles)) { 45662 textContent.styles[font.loadedName] = { 45663 fontFamily: font.fallbackName, 45664 ascent: font.ascent, 45665 descent: font.descent, 45666 vertical: font.vertical 45667 }; 45668 } 45669 textContentItem.fontName = font.loadedName; 45670 var tsm = [ 45671 textState.fontSize * textState.textHScale, 45672 0, 45673 0, 45674 textState.fontSize, 45675 0, 45676 textState.textRise 45677 ]; 45678 if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) { 45679 var glyphHeight = font.bbox[3] - font.bbox[1]; 45680 if (glyphHeight > 0) { 45681 glyphHeight = glyphHeight * textState.fontMatrix[3]; 45682 tsm[3] *= glyphHeight; 45683 } 45684 } 45685 var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm)); 45686 textContentItem.transform = trm; 45687 if (!font.vertical) { 45688 textContentItem.width = 0; 45689 textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]); 45690 textContentItem.vertical = false;
45691 } else { 45692 textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]); 45693 textContentItem.height = 0; 45694 textContentItem.vertical = true; 45695 } 45696 var a = textState.textLineMatrix[0]; 45697 var b = textState.textLineMatrix[1]; 45698 var scaleLineX = Math.sqrt(a * a + b * b); 45699 a = textState.ctm[0]; 45700 b = textState.ctm[1]; 45701 var scaleCtmX = Math.sqrt(a * a + b * b); 45702 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 45703 textContentItem.lastAdvanceWidth = 0; 45704 textContentItem.lastAdvanceHeight = 0; 45705 var spaceWidth = font.spaceWidth / 1000 * textState.fontSize; 45706 if (spaceWidth) { 45707 textContentItem.spaceWidth = spaceWidth; 45708 textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR; 45709 textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR; 45710 textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX; 45711 textContentItem.textRunBreakAllowed = !font.isMonospace; 45712 } else { 45713 textContentItem.spaceWidth = 0; 45714 textContentItem.fakeSpaceMin = Infinity; 45715 textContentItem.fakeMultiSpaceMin = Infinity; 45716 textContentItem.fakeMultiSpaceMax = 0; 45717 textContentItem.textRunBreakAllowed = false; 45718 } 45719 textContentItem.initialized = true; 45720 return textContentItem; 45721 } 45722 function replaceWhitespace(str) { 45723 var i = 0, ii = str.length, code; 45724 while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) { 45725 i++; 45726 } 45727 return i < ii ? str.replace(WhitespaceRegexp, ' ') : str; 45728 } 45729 function runBidiTransform(textChunk) { 45730 var str = textChunk.str.join(''); 45731 var bidiResult = bidi(str, -1, textChunk.vertical); 45732 return { 45733 str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str, 45734 dir: bidiResult.dir, 45735 width: textChunk.width, 45736 height: textChunk.height, 45737 transform: textChunk.transform, 45738 fontName: textChunk.fontName 45739 }; 45740 } 45741 function handleSetFont(fontName, fontRef) { 45742 return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) { 45743 textState.font = translated.font; 45744 textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX; 45745 }); 45746 } 45747 function buildTextContentItem(chars) { 45748 var font = textState.font; 45749 var textChunk = ensureTextContentItem(); 45750 var width = 0; 45751 var height = 0; 45752 var glyphs = font.charsToGlyphs(chars); 45753 for (var i = 0; i < glyphs.length; i++) { 45754 var glyph = glyphs[i]; 45755 var glyphWidth = null; 45756 if (font.vertical && glyph.vmetric) { 45757 glyphWidth = glyph.vmetric[0]; 45758 } else { 45759 glyphWidth = glyph.width; 45760 } 45761 var glyphUnicode = glyph.unicode; 45762 var NormalizedUnicodes = getNormalizedUnicodes(); 45763 if (NormalizedUnicodes[glyphUnicode] !== undefined) { 45764 glyphUnicode = NormalizedUnicodes[glyphUnicode]; 45765 } 45766 glyphUnicode = reverseIfRtl(glyphUnicode); 45767 var charSpacing = textState.charSpacing; 45768 if (glyph.isSpace) { 45769 var wordSpacing = textState.wordSpacing; 45770 charSpacing += wordSpacing; 45771 if (wordSpacing > 0) { 45772 addFakeSpaces(wordSpacing, textChunk.str); 45773 } 45774 } 45775 var tx = 0; 45776 var ty = 0; 45777 if (!font.vertical) { 45778 var w0 = glyphWidth * textState.fontMatrix[0]; 45779 tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale; 45780 width += tx; 45781 } else { 45782 var w1 = glyphWidth * textState.fontMatrix[0]; 45783 ty = w1 * textState.fontSize + charSpacing; 45784 height += ty; 45785 } 45786 textState.translateTextMatrix(tx, ty); 45787 textChunk.str.push(glyphUnicode); 45788 } 45789 if (!font.vertical) { 45790 textChunk.lastAdvanceWidth = width; 45791 textChunk.width += width; 45792 } else { 45793 textChunk.lastAdvanceHeight = height; 45794 textChunk.height += Math.abs(height); 45795 } 45796 return textChunk; 45797 } 45798 function addFakeSpaces(width, strBuf) { 45799 if (width < textContentItem.fakeSpaceMin) { 45800 return; 45801 } 45802 if (width < textContentItem.fakeMultiSpaceMin) { 45803 strBuf.push(' '); 45804 return; 45805 } 45806 var fakeSpaces = Math.round(width / textContentItem.spaceWi
45806dth); 45807 while (fakeSpaces-- > 0) { 45808 strBuf.push(' '); 45809 } 45810 } 45811 function flushTextContentItem() { 45812 if (!textContentItem.initialized) { 45813 return; 45814 } 45815 textContentItem.width *= textContentItem.textAdvanceScale; 45816 textContentItem.height *= textContentItem.textAdvanceScale; 45817 textContent.items.push(runBidiTransform(textContentItem)); 45818 textContentItem.initialized = false; 45819 textContentItem.str.length = 0; 45820 } 45821 var timeSlotManager = new TimeSlotManager(); 45822 return new Promise(function promiseBody(resolve, reject) { 45823 var next = function (promise) { 45824 promise.then(function () { 45825 try { 45826 promiseBody(resolve, reject); 45827 } catch (ex) { 45828 reject(ex); 45829 } 45830 }, reject); 45831 }; 45832 task.ensureNotTerminated(); 45833 timeSlotManager.reset(); 45834 var stop, operation = {}, args = []; 45835 while (!(stop = timeSlotManager.check())) { 45836 args.length = 0; 45837 operation.args = args; 45838 if (!preprocessor.read(operation)) { 45839 break; 45840 } 45841 textState = stateManager.state; 45842 var fn = operation.fn; 45843 args = operation.args; 45844 var advance, diff; 45845 switch (fn | 0) { 45846 case OPS.setFont: 45847 var fontNameArg = args[0].name, fontSizeArg = args[1]; 45848 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 45849 break; 45850 } 45851 flushTextContentItem(); 45852 textState.fontName = fontNameArg; 45853 textState.fontSize = fontSizeArg; 45854 next(handleSetFont(fontNameArg, null)); 45855 return; 45856 case OPS.setTextRise: 45857 flushTextContentItem(); 45858 textState.textRise = args[0]; 45859 break; 45860 case OPS.setHScale: 45861 flushTextContentItem(); 45862 textState.textHScale = args[0] / 100; 45863 break; 45864 case OPS.setLeading: 45865 flushTextContentItem(); 45866 textState.leading = args[0]; 45867 break; 45868 case OPS.moveText: 45869 var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0; 45870 advance = args[0] - args[1]; 45871 if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) { 45872 textState.translateTextLineMatrix(args[0], args[1]); 45873 textContentItem.width += args[0] - textContentItem.lastAdvanceWidth; 45874 textContentItem.height += args[1] - textContentItem.lastAdvanceHeight; 45875 diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight); 45876 addFakeSpaces(diff, textContentItem.str); 45877 break; 45878 } 45879 flushTextContentItem(); 45880 textState.translateTextLineMatrix(args[0], args[1]);
45881 textState.textMatrix = textState.textLineMatrix.slice(); 45882 break; 45883 case OPS.setLeadingMoveText: 45884 flushTextContentItem(); 45885 textState.leading = -args[1]; 45886 textState.translateTextLineMatrix(args[0], args[1]); 45887 textState.textMatrix = textState.textLineMatrix.slice(); 45888 break; 45889 case OPS.nextLine: 45890 flushTextContentItem(); 45891 textState.carriageReturn(); 45892 break; 45893 case OPS.setTextMatrix: 45894 advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]); 45895 if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) { 45896 textState.translateTextLineMatrix(advance.width, advance.height); 45897 textContentItem.width += advance.width - textContentItem.lastAdvanceWidth; 45898 textContentItem.height += advance.height - textContentItem.lastAdvanceHeight; 45899 diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight); 45900 addFakeSpaces(diff, textContentItem.str); 45901 break; 45902 } 45903 flushTextContentItem(); 45904 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 45905 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 45906 break; 45907 case OPS.setCharSpacing: 45908 textState.charSpacing = args[0]; 45909 break; 45910 case OPS.setWordSpacing: 45911 textState.wordSpacing = args[0]; 45912 break; 45913 case OPS.beginText: 45914 flushTextContentItem(); 45915 textState.textMatrix = IDENTITY_MATRIX.slice();
45916 textState.textLineMatrix = IDENTITY_MATRIX.slice(); 45917 break; 45918 case OPS.showSpacedText: 45919 var items = args[0]; 45920 var offset; 45921 for (var j = 0, jj = items.length; j < jj; j++) { 45922 if (typeof items[j] === 'string') { 45923 buildTextContentItem(items[j]); 45924 } else if (isNum(items[j])) { 45925 ensureTextContentItem(); 45926 advance = items[j] * textState.fontSize / 1000; 45927 var breakTextRun = false; 45928 if (textState.font.vertical) { 45929 offset = advance; 45930 textState.translateTextMatrix(0, offset); 45931 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 45932 if (!breakTextRun) { 45933 textContentItem.height += offset; 45934 } 45935 } else { 45936 advance = -advance; 45937 offset = advance * textState.textHScale; 45938 textState.translateTextMatrix(offset, 0); 45939 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 45940 if (!breakTextRun) { 45941 textContentItem.width += offset; 45942 } 45943 } 45944 if (breakTextRun) { 45945 flushTextContentItem(); 45946 } else if (advance > 0) { 45947 addFakeSpaces(advance, textContentItem.str); 45948 } 45949 } 45950 } 45951 break; 45952 case OPS.showText: 45953 buildTextContentItem(args[0]); 45954 break; 45955 case OPS.nextLineShowText: 45956 flushTextContentItem(); 45957 textState.carriageReturn(); 45958 buildTextContentItem(args[0]); 45959 break; 45960 case OPS.nextLineSetSpacingShowText: 45961 flushTextContentItem(); 45962 textState.wordSpacing = args[0]; 45963 textState.charSpacing = args[1]; 45964 textState.carriageReturn(); 45965 buildTextContentItem(args[2]); 45966 break; 45967 case OPS.paintXObject: 45968 flushTextContentItem(); 45969 if (args[0].code) { 45970 break; 45971 } 45972 if (!xobjs) { 45973 xobjs = resources.get('XObject') || Dict.empty; 45974 } 45975 var name = args[0].name; 45976 if (xobjsCache.key === name) { 45977 if (xobjsCache.texts) { 45978 Util.appendToArray(textContent.items, xobjsCache.texts.items); 45979 Util.extendObj(textContent.styles, xobjsCache.texts.styles); 45980 } 45981 break; 45982 } 45983 var xobj = xobjs.get(name); 45984 if (!xobj) { 45985 break; 45986 } 45987 assert(isStream(xobj), 'XObject should be a stream'); 45988 var type = xobj.dict.get('Subtype'); 45989 assert(isName(type), 'XObject should have a Name subtype'); 45990 if ('Form' !== type.name) { 45991 xobjsCache.key = name; 45992 xobjsCache.texts = null; 45993 break; 45994 } 45995 stateManager.save(); 45996 var matrix = xobj.dict.getArray('Matrix'); 45997 if (isArray(matrix) && matrix.length === 6) { 45998 stateManager.transform(matrix); 45999 } 46000 next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) { 46001 Util.appendToArray(textContent.items, formTextContent.items); 46002 Util.extendObj(textContent.styles, formTextContent.styles); 46003 stateManager.restore(); 46004 xobjsCache.key = name; 46005 xobjsCache.texts = formTextContent; 46006 })); 46007 return; 46008 case OPS.setGState: 46009 flushTextContentItem(); 46010 var dictName = args[0]; 46011 var extGState = resources.get('ExtGState'); 46012 if (!isDict(extGState) || !isName(dictName)) { 46013 break; 46014 } 46015 var gState = extGState.get(dictName.name); 46016 if (!isDict(gState)) { 46017 break; 46018 } 46019 var gStateFont = gState.get('Font'); 46020 if (gStateFont) { 46021 textState.fontName = null; 46022 textState.fontSize = gStateFont[1]; 46023 next(handleSetFont(null, gStateFont[0])); 46024 return; 46025 } 46026 break; 46027 } 46028 } 46029 if (stop) { 46030 next(deferred); 46031 return; 46032 } 46033 flushTextContentItem(); 46034 resolve(textContent); 46035 }); 46036 }, 46037 extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) { 46038 var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); 46039 var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); 46040 if (properties.composite) { 46041 var cidSystemInfo = dict.get('CIDSystemInfo'); 46042 if (isDict(cidSystemInfo)) { 46043 properties.cidSystemInfo = { 46044 registry: cidSystemInfo.get('Registry'), 46045 ordering: cidSystemInfo.get('Ordering'), 46046 supplement: cidSystemInfo.get('Supplement') 46047 }; 46048 } 46049 var cidToGidMap = dict.get('CIDToGIDMap'); 46050 if (isStream(cidToGidMap)) { 46051 properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); 46052 } 46053 } 46054 var differences = []; 46055 var baseEncodingName = null; 46056 var encoding; 46057 if (dict.has('Encoding')) { 46058 encoding = dict.get('Encoding'); 46059 if (isDict(encoding)) { 46060 baseEncodingName = encoding.get('BaseEncoding'); 46061 baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null; 46062 if (encoding.has('Differences')) { 46063 var diffEncoding = encoding.get('Differences'); 46064 var index = 0; 46065 for (var j = 0, jj = diffEncoding.length; j < jj; j++) { 46066 var data = xref.fetchIfRef(diffEncoding[j]); 46067 if (isNum(data)) { 46068 index = data; 46069 } else if (isName(data)) { 46070 differences[index++] = data.name; 46071 } else { 46072 error('Invalid entry in \'Differences\' array: ' + data); 46073 } 46074 } 46075 } 46076 } else if (isName(encoding)) { 46077 baseEncodingName = encoding.name; 46078 } else { 46079 error('Encoding is not a Name nor a Dict'); 46080 } 46081 if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') { 46082 baseEncodingName = null; 46083 } 46084 } 46085 if (baseEncodingName) { 46086 properties.defaultEncoding = getEncoding(baseEncodingName).slice(); 46087 } else { 46088 var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 46089 var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic); 46090 encoding = StandardEncoding; 46091 if (properties.type === 'TrueType' && !isNonsymbolicFont) { 46092 encoding = WinAnsiEncoding; 46093 } 46094 if (isSymbolicFont) { 46095 encoding = MacRomanEncoding; 46096 if (!properties.file) { 46097 if (/Symbol/i.test(properties.name)) { 46098 encoding = SymbolSetEncoding; 46099 } else if (/Dingbats/i.test(properties.name)) { 46100 encoding = ZapfDingbatsEncoding; 46101 } 46102 } 46103 } 46104 properties.defaultEncoding = encoding; 46105 } 46106 properties.differences = differences; 46107 properties.baseEncodingName = baseEncodingName; 46108 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 46109 properties.dict = dict; 46110 return toUnicodePromise.then(function (toUnicode) { 46111 properties.toUnicode = toUnicode; 46112 return this.buildToUnicode(properties); 46113 }.bind(this)).then(function (toUnicode) { 46114 properties.toUnicode = toUnicode; 46115 return properties; 46116 }); 46117 }, 46118 buildToUnicode: function PartialEvaluator_buildToUnicode(properties) { 46119 properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; 46120 if (properties.hasIncludedToUnicodeMap) { 46121 return Promise.resolve(properties.toUnicode); 46122 } 46123 var toUnicode, charcode, glyphName; 46124 if (!properties.composite) 46125 { 46126 toUnicode = []; 46127 var encoding = properties.defaultEncoding.slice(); 46128 var baseEncodingName = properties.baseEncodingName; 46129 var differences = properties.differences; 46130 for (charcode in differences) { 46131 glyphName = differences[charcode]; 46132 if (glyphName === '.notdef') { 46133 continue; 46134 } 46135 encoding[charcode] = glyphName; 46136 } 46137 var glyphsUnicodeMap = getGlyphsUnicode(); 46138 for (charcode in encoding) { 46139 glyphName = encoding[charcode]; 46140 if (glyphName === '') { 46141 continue; 46142 } else if (glyphsUnicodeMap[glyphName] === undefined) { 46143 var code = 0; 46144 switch (glyphName[0]) { 46145 case 'G': 46146 if (glyphName.length === 3) { 46147 code = parseInt(glyphName.substr(1), 16); 46148 } 46149 break; 46150 case 'g': 46151 if (glyphName.length === 5) { 46152 code = parseInt(glyphName.substr(1), 16); 46153 } 46154 break; 46155 case 'C': 46156 case 'c': 46157 if (glyphName.length >= 3) { 46158 code = +glyphName.substr(1); 46159 } 46160 break; 46161 default: 46162 var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 46163 if (unicode !== -1) { 46164 code = unicode; 46165 } 46166 } 46167 if (code) { 46168 if (baseEncodingName && code === +charcode) { 46169 var baseEncoding = getEncoding(baseEncodingName); 46170 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 46171 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 46172 continue; 46173 } 46174 } 46175 toUnicode[charcode] = String.fromCharCode(code); 46176 } 46177 continue; 46178 } 46179 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 46180 } 46181 return Promise.resolve(new ToUnicodeMap(toUnicode)); 46182 } 46183 if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) { 46184 var registry = properties.cidSystemInfo.registry; 46185 var ordering = properties.cidSystemInfo.ordering; 46186 var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2'); 46187 return CMapFactory.create(ucs2CMapName, this.options.cMapOptions, null).then(function (ucs2CMap) { 46188 var cMap = properties.cMap; 46189 toUnicode = [];
46190 cMap.forEach(function (charcode, cid) { 46191 assert(cid <= 0xffff, 'Max size of CID is 65,535'); 46192 var ucs2 = ucs2CMap.lookup(cid); 46193 if (ucs2) { 46194 toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); 46195 } 46196 }); 46197 return new ToUnicodeMap(toUnicode); 46198 }); 46199 } 46200 return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); 46201 }, 46202 readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) { 46203 var cmapObj = toUnicode; 46204 if (isName(cmapObj)) { 46205 return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) { 46206 if (cmap instanceof IdentityCMap) { 46207 return new IdentityToUnicodeMap(0, 0xFFFF); 46208 } 46209 return new ToUnicodeMap(cmap.getMap()); 46210 }); 46211 } else if (isStream(cmapObj)) { 46212 return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) { 46213 if (cmap instanceof IdentityCMap) { 46214 return new IdentityToUnicodeMap(0, 0xFFFF); 46215 } 46216 var map = new Array(cmap.length); 46217 cmap.forEach(function (charCode, token) { 46218 var str = []; 46219 for (var k = 0; k < token.length; k += 2) {
46220 var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 46221 if ((w1 & 0xF800) !== 0xD800) { 46222 str.push(w1); 46223 continue; 46224 } 46225 k += 2; 46226 var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 46227 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 46228 } 46229 map[charCode] = String.fromCharCode.apply(String, str); 46230 }); 46231 return new ToUnicodeMap(map); 46232 }); 46233 } 46234 return Promise.resolve(null); 46235 }, 46236 readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) { 46237 var glyphsData = cidToGidStream.getBytes(); 46238 var result = []; 46239 for (var j = 0, jj = glyphsData.length; j < jj; j++) { 46240 var glyphID = glyphsData[j++] << 8 | glyphsData[j]; 46241 if (glyphID === 0) { 46242 continue; 46243 } 46244 var code = j >> 1; 46245 result[code] = glyphID; 46246 } 46247 return result; 46248 }, 46249 extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) { 46250 var glyphsWidths = []; 46251 var defaultWidth = 0; 46252 var glyphsVMetrics = []; 46253 var defaultVMetrics; 46254 var i, ii, j, jj, start, code, widths; 46255 if (properties.composite) { 46256 defaultWidth = dict.get('DW') || 1000; 46257 widths = dict.get('W'); 46258 if (widths) { 46259 for (i = 0, ii = widths.length; i < ii; i++) { 46260 start = xref.fetchIfRef(widths[i++]); 46261 code = xref.fetchIfRef(widths[i]); 46262 if (isArray(code)) { 46263 for (j = 0, jj = code.length; j < jj; j++) { 46264 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 46265 } 46266 } else { 46267 var width = xref.fetchIfRef(widths[++i]); 46268 for (j = start; j <= code; j++) { 46269 glyphsWidths[j] = width; 46270 } 46271 } 46272 } 46273 } 46274 if (properties.vertical) { 46275 var vmetrics = dict.getArray('DW2') || [ 46276 880, 46277 -1000 46278 ]; 46279 defaultVMetrics = [ 46280 vmetrics[1], 46281 defaultWidth * 0.5, 46282 vmetrics[0] 46283 ]; 46284 vmetrics = dict.get('W2'); 46285 if (vmetrics) { 46286 for (i = 0, ii = vmetrics.length; i < ii; i++) { 46287 start = xref.fetchIfRef(vmetrics[i++]); 46288 code = xref.fetchIfRef(vmetrics[i]); 46289 if (isArray(code)) { 46290 for (j = 0, jj = code.length; j < jj; j++) { 46291 glyphsVMetrics[start++] = [ 46292 xref.fetchIfRef(code[j++]), 46293 xref.fetchIfRef(code[j++]), 46294 xref.fetchIfRef(code[j]) 46295 ]; 46296 } 46297 } else { 46298 var vmetric = [ 46299 xref.fetchIfRef(vmetrics[++i]), 46300 xref.fetchIfRef(vmetrics[++i]), 46301 xref.fetchIfRef(vmetrics[++i]) 46302 ]; 46303 for (j = start; j <= code; j++) { 46304 glyphsVMetrics[j] = vmetric; 46305 } 46306 } 46307 } 46308 } 46309 } 46310 } else { 46311 var firstChar = properties.firstChar; 46312 widths = dict.get('Widths'); 46313 if (widths) { 46314 j = firstChar; 46315 for (i = 0, ii = widths.length; i < ii; i++) { 46316 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 46317 } 46318 defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0; 46319 } else { 46320 var baseFontName = dict.get('BaseFont'); 46321 if (isName(baseFontName)) { 46322 var metrics = this.getBaseFontMetrics(baseFontName.name); 46323 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 46324 defaultWidth = metrics.defaultWidth; 46325 } 46326 } 46327 } 46328 var isMonospace = true; 46329 var firstWidth = defaultWidth; 46330 for (var glyph in glyphsWidths) { 46331 var glyphWidth = glyphsWidths[glyph]; 46332 if (!glyphWidth) { 46333 continue; 46334 } 46335 if (!firstWidth) { 46336 firstWidth = glyphWidth; 46337 continue; 46338 } 46339 if (firstWidth !== glyphWidth) { 46340 isMonospace = false; 46341 break; 46342 } 46343 } 46344 if (isMonospace) { 46345 properties.flags |= FontFlags.FixedPitch; 46346 } 46347 properties.defaultWidth = defaultWidth; 46348 properties.widths = glyphsWidths; 46349 properties.defaultVMetrics = defaultVMetrics; 46350 properties.vmetrics = glyphsVMetrics; 46351 }, 46352 isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) { 46353 var fontNameWoStyle = baseFontName.split('-')[0]; 46354 return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1; 46355 }, 46356 getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) { 46357 var defaultWidth = 0; 46358 var widths = []; 46359 var monospace = false;
46360 var stdFontMap = getStdFontMap(); 46361 var lookupName = stdFontMap[name] || name; 46362 var Metrics = getMetrics(); 46363 if (!(lookupName in Metrics)) { 46364 if (this.isSerifFont(name)) { 46365 lookupName = 'Times-Roman'; 46366 } else { 46367 lookupName = 'Helvetica'; 46368 } 46369 } 46370 var glyphWidths = Metrics[lookupName]; 46371 if (isNum(glyphWidths)) { 46372 defaultWidth = glyphWidths; 46373 monospace = true; 46374 } else { 46375 widths = glyphWidths(); 46376 } 46377 return { 46378 defaultWidth: defaultWidth, 46379 monospace: monospace, 46380 widths: widths 46381 }; 46382 }, 46383 buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) { 46384 var widths = Object.create(null); 46385 var differences = properties.differences; 46386 var encoding = properties.defaultEncoding; 46387 for (var charCode = 0; charCode < 256; charCode++) { 46388 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 46389 widths[charCode] = widthsByGlyphName[differences[charCode]]; 46390 continue; 46391 } 46392 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 46393 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 46394 continue; 46395 } 46396 } 46397 return widths; 46398 }, 46399 preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) { 46400 var baseDict = dict; 46401 var type = dict.get('Subtype'); 46402 assert(isName(type), 'invalid font Subtype'); 46403 var composite = false; 46404 var uint8array; 46405 if (type.name === 'Type0') { 46406 var df = dict.get('DescendantFonts'); 46407 if (!df) { 46408 error('Descendant fonts are not specified'); 46409 } 46410 dict = isArray(df) ? xref.fetchIfRef(df[0]) : df; 46411 type = dict.get('Subtype'); 46412 assert(isName(type), 'invalid font Subtype'); 46413 composite = true; 46414 } 46415 var descriptor = dict.get('FontDescriptor'); 46416 if (descriptor) { 46417 var hash = new MurmurHash3_64(); 46418 var encoding = baseDict.getRaw('Encoding'); 46419 if (isName(encoding)) { 46420 hash.update(encoding.name); 46421 } else if (isRef(encoding)) { 46422 hash.update(encoding.toString()); 46423 } else if (isDict(encoding)) { 46424 var keys = encoding.getKeys(); 46425 for (var i = 0, ii = keys.length; i < ii; i++) { 46426 var entry = encoding.getRaw(keys[i]); 46427 if (isName(entry)) { 46428 hash.update(entry.name); 46429 } else if (isRef(entry)) { 46430 hash.update(entry.toString()); 46431 } else if (isArray(entry)) { 46432 var diffLength = entry.length, diffBuf = new Array(diffLength); 46433 for (var j = 0; j < diffLength; j++) { 46434 var diffEntry = entry[j]; 46435 if (isName(diffEntry)) { 46436 diffBuf[j] = diffEntry.name; 46437 } else if (isNum(diffEntry) || isRef(diffEntry)) { 46438 diffBuf[j] = diffEntry.toString(); 46439 } 46440 } 46441 hash.update(diffBuf.join()); 46442 } 46443 } 46444 } 46445 var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); 46446 if (isStream(toUnicode)) { 46447 var stream = toUnicode.str || toUnicode; 46448 uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 46449 hash.update(uint8array); 46450 } else if (isName(toUnicode)) { 46451 hash.update(toUnicode.name); 46452 } 46453 var widths = dict.get('Widths') || baseDict.get('Widths'); 46454 if (widths) { 46455 uint8array = new Uint8Array(new Uint32Array(widths).buffer); 46456 hash.update(uint8array); 46457 } 46458 } 46459 return { 46460 descriptor: descriptor, 46461 dict: dict, 46462 baseDict: baseDict, 46463 composite: composite, 46464 type: type.name, 46465 hash: hash ? hash.hexdigest() : '' 46466 }; 46467 }, 46468 translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) { 46469 var baseDict = preEvaluatedFont.baseDict; 46470 var dict = preEvaluatedFont.dict; 46471 var composite = preEvaluatedFont.composite; 46472 var descriptor = preEvaluatedFont.descriptor; 46473 var type = preEvaluatedFont.type; 46474 var maxCharIndex = composite ? 0xFFFF : 0xFF; 46475 var cMapOptions = this.options.cMapOptions; 46476 var properties; 46477 if (!descriptor) { 46478 if (type === 'Type3') { 46479 descriptor = new Dict(null); 46480 descriptor.set('FontName', Name.get(type)); 46481 descriptor.set('FontBBox', dict.getArray('FontBBox')); 46482 } else { 46483 var baseFontName = dict.get('BaseFont'); 46484 if (!isName(baseFontName)) { 46485 error('Base font is not specified'); 46486 } 46487 baseFontName = baseFontName.name.replace(/[,_]/g, '-'); 46488 var metrics = this.getBaseFontMetrics(baseFontName); 46489 var fontNameWoStyle = baseFontName.split('-')[0]; 46490 var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic
46490: FontFlags.Nonsymbolic); 46491 properties = { 46492 type: type, 46493 name: baseFontName, 46494 widths: metrics.widths, 46495 defaultWidth: metrics.defaultWidth, 46496 flags: flags, 46497 firstChar: 0, 46498 lastChar: maxCharIndex 46499 }; 46500 return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) { 46501 properties.widths = this.buildCharCodeToWidth(metrics.widths, properties); 46502 return new Font(baseFontName, null, properties); 46503 }.bind(this)); 46504 } 46505 } 46506 var firstChar = dict.get('FirstChar') || 0; 46507 var lastChar = dict.get('LastChar') || maxCharIndex; 46508 var fontName = descriptor.get('FontName'); 46509 var baseFont = dict.get('BaseFont'); 46510 if (isString(fontName)) { 46511 fontName = Name.get(fontName); 46512 } 46513 if (isString(baseFont)) { 46514 baseFont = Name.get(baseFont); 46515 } 46516 if (type !== 'Type3') { 46517 var fontNameStr = fontName && fontName.name; 46518 var baseFontStr = baseFont && baseFont.name; 46519 if (fontNameStr !== baseFontStr) { 46520 info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"'); 46521 if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) { 46522 fontName = baseFont; 46523 } 46524 } 46525 } 46526 fontName = fontName || baseFont; 46527 assert(isName(fontName), 'invalid font name'); 46528 var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3'); 46529 if (fontFile) { 46530 if (fontFile.dict) { 46531 var subtype = fontFile.dict.get('Subtype'); 46532 if (subtype) { 46533 subtype = subtype.name; 46534 } 46535 var length1 = fontFile.dict.get('Length1'); 46536 var length2 = fontFile.dict.get('Length2'); 46537 var length3 = fontFile.dict.get('Length3'); 46538 } 46539 } 46540 properties = { 46541 type: type, 46542 name: fontName.name, 46543 subtype: subtype, 46544 file: fontFile, 46545 length1: length1, 46546 length2: length2, 46547 length3: length3, 46548 loadedName: baseDict.loadedName, 46549 composite: composite, 46550 wideChars: composite, 46551 fixedPitch: false, 46552 fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX, 46553 firstChar: firstChar || 0, 46554 lastChar: lastChar || maxCharIndex, 46555 bbox: descriptor.getArray('FontBBox'), 46556 ascent: descriptor.get('Ascent'), 46557 descent: descriptor.get('Descent'), 46558 xHeight: descriptor.get('XHeight'), 46559 capHeight: descriptor.get('CapHeight'), 46560 flags: descriptor.get('Flags'), 46561 italicAngle: descriptor.get('ItalicAngle'), 46562 coded: false 46563 }; 46564 var cMapPromise; 46565 if (composite) { 46566 var cidEncoding = baseDict.get('Encoding'); 46567 if (isName(cidEncoding)) { 46568 properties.cidEncoding = cidEncoding.name; 46569 } 46570 cMapPromise = CMapFactory.create(cidEncoding, cMapOptions, null).then(function (cMap) { 46571 properties.cMap = cMap; 46572 properties.vertical = properties.cMap.vertical; 46573 }); 46574 } else { 46575 cMapPromise = Promise.resolve(undefined); 46576 } 46577 return cMapPromise.then(function () { 46578 return this.extractDataStructures(dict, baseDict, xref, properties); 46579 }.bind(this)).then(function (properties) { 46580 this.extractWidths(dict, xref, descriptor, properties); 46581 if (type === 'Type3') { 46582 properties.isType3Font = true; 46583 } 46584 return new Font(fontName.name, fontFile, properties); 46585 }.bind(this)); 46586 } 46587 }; 46588 return PartialEvaluator; 46589 }(); 46590 var TranslatedFont = function TranslatedFontClosure() { 46591 function TranslatedFont(loadedName, font, dict) { 46592 this.loadedName = loadedName; 46593 this.font = font; 46594 this.dict = dict; 46595 this.type3Loaded = null; 46596 this.sent = false; 46597 } 46598 TranslatedFont.prototype = { 46599 send: function (handler) { 46600 if (this.sent) { 46601 return; 46602 } 46603 var fontData = this.font.exportData(); 46604 handler.send('commonobj', [ 46605 this.loadedName, 46606 'Font', 46607 fontData 46608 ]); 46609 this.sent = true; 46610 }, 46611 loadType3Data: function (evaluator, resources, parentOperatorList, task) { 46612 assert(this.font.isType3Font);
46613 if (this.type3Loaded) { 46614 return this.type3Loaded; 46615 } 46616 var translatedFont = this.font; 46617 var loadCharProcsPromise = Promise.resolve(); 46618 var charProcs = this.dict.get('CharProcs'); 46619 var fontResources = this.dict.get('Resources') || resources; 46620 var charProcKeys = charProcs.getKeys(); 46621 var charProcOperatorList = Object.create(null); 46622 for (var i = 0, n = charProcKeys.length; i < n; ++i) { 46623 loadCharProcsPromise = loadCharProcsPromise.then(function (key) { 46624 var glyphStream = charProcs.get(key); 46625 var operatorList = new OperatorList(); 46626 return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () { 46627 charProcOperatorList[key] = operatorList.getIR(); 46628 parentOperatorList.addDependencies(operatorList.dependencies); 46629 }, function (reason) { 46630 warn('Type3 font resource \"' + key + '\" is not available'); 46631 var operatorList = new OperatorList(); 46632 charProcOperatorList[key] = operatorList.getIR(); 46633 }); 46634 }.bind(this, charProcKeys[i])); 46635 } 46636 this.type3Loaded = loadCharProcsPromise.then(function () { 46637 translatedFont.charProcOperatorList = charProcOperatorList; 46638 }); 46639 return this.type3Loaded; 46640 } 46641 }; 46642 return TranslatedFont; 46643 }(); 46644 var OperatorList = function OperatorListClosure() { 46645 var CHUNK_SIZE = 1000; 46646 var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; 46647 function getTransfers(queue) { 46648 var transfers = []; 46649 var fnArray = queue.fnArray, argsArray = queue.argsArray; 46650 for (var i = 0, ii = queue.length; i < ii; i++) { 46651 switch (fnArray[i]) { 46652 case OPS.paintInlineImageXObject: 46653 case OPS.paintInlineImageXObjectGroup: 46654 case OPS.paintImageMaskXObject: 46655 var arg = argsArray[i][0]; 46656 if (!arg.cached) { 46657 transfers.push(arg.data.buffer); 46658 } 46659 break; 46660 } 46661 } 46662 return transfers; 46663 } 46664 function OperatorList(intent, messageHandler, pageIndex) { 46665 this.messageHandler = messageHandler; 46666 this.fnArray = []; 46667 this.argsArray = []; 46668 this.dependencies = Object.create(null); 46669 this._totalLength = 0; 46670 this.pageIndex = pageIndex; 46671 this.intent = intent; 46672 } 46673 OperatorList.prototype = { 46674 get length() { 46675 return this.argsArray.length; 46676 }, 46677 get totalLength() { 46678 return this._totalLength + this.length; 46679 }, 46680 addOp: function (fn, args) { 46681 this.fnArray.push(fn); 46682 this.argsArray.push(args); 46683 if (this.messageHandler) { 46684 if (this.fnArray.length >= CHUNK_SIZE) { 46685 this.flush(); 46686 } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) { 46687 this.flush(); 46688 } 46689 } 46690 }, 46691 addDependency: function (dependency) { 46692 if (dependency in this.dependencies) { 46693 return; 46694 } 46695 this.dependencies[dependency] = true; 46696 this.addOp(OPS.dependency, [dependency]); 46697 }, 46698 addDependencies: function (dependencies) { 46699 for (var key in dependencies) { 46700 this.addDependency(key); 46701 } 46702 }, 46703 addOpList: function (opList) { 46704 Util.extendObj(this.dependencies, opList.dependencies); 46705 for (var i = 0, ii = opList.length; i < ii; i++) { 46706 this.addOp(opList.fnArray[i], opList.argsArray[i]); 46707 } 46708 }, 46709 getIR: function () { 46710 return { 46711 fnArray: this.fnArray, 46712 argsArray: this.argsArray, 46713 length: this.length 46714 }; 46715 }, 46716 flush: function (lastChunk) { 46717 if (this.intent !== 'oplist') { 46718 new QueueOptimizer().optimize(this); 46719 } 46720 var transfers = getTransfers(this); 46721 var length = this.length; 46722 this._totalLength += length; 46723 this.messageHandler.send('RenderPageChunk', { 46724 operatorList: { 46725 fnArray: this.fnArray, 46726 argsArray: this.argsArray, 46727 lastChunk: lastChunk, 46728 length: length 46729 }, 46730 pageIndex: this.pageIndex, 46731 intent: this.intent 46732 }, transfers); 46733 this.dependencies = Object.create(null); 46734 this.fnArray.length = 0; 46735 this.argsArray.length = 0; 46736 } 46737 }; 46738 return OperatorList; 46739 }(); 46740 var StateManager = function StateManagerClosure() { 46741 function StateManager(initialState) { 46742 this.state = initialState; 46743 this.stateStack = []; 46744 } 46745 StateManager.prototype = { 46746 save: function () { 46747 var old = this.state; 46748 this.stateStack.push(this.state); 46749 this.state = old.clone(); 46750 }, 46751 restore: function () { 46752 var prev = this.stateStack.pop(); 46753 if (prev) { 46754 this.state = prev; 46755 } 46756 }, 46757 transform: function (args) {
46758 this.state.ctm = Util.transform(this.state.ctm, args); 46759 } 46760 }; 46761 return StateManager; 46762 }(); 46763 var TextState = function TextStateClosure() { 46764 function TextState() { 46765 this.ctm = new Float32Array(IDENTITY_MATRIX); 46766 this.fontName = null; 46767 this.fontSize = 0; 46768 this.font = null; 46769 this.fontMatrix = FONT_IDENTITY_MATRIX; 46770 this.textMatrix = IDENTITY_MATRIX.slice(); 46771 this.textLineMatrix = IDENTITY_MATRIX.slice(); 46772 this.charSpacing = 0; 46773 this.wordSpacing = 0; 46774 this.leading = 0; 46775 this.textHScale = 1; 46776 this.textRise = 0; 46777 } 46778 TextState.prototype = { 46779 setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 46780 var m = this.textMatrix; 46781 m[0] = a; 46782 m[1] = b; 46783 m[2] = c; 46784 m[3] = d; 46785 m[4] = e; 46786 m[5] = f; 46787 }, 46788 setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 46789 var m = this.textLineMatrix; 46790 m[0] = a; 46791 m[1] = b; 46792 m[2] = c; 46793 m[3] = d; 46794 m[4] = e; 46795 m[5] = f; 46796 }, 46797 translateTextMatrix: function TextState_translateTextMatrix(x, y) { 46798 var m = this.textMatrix; 46799 m[4] = m[0] * x + m[2] * y + m[4]; 46800 m[5] = m[1] * x + m[3] * y + m[5]; 46801 }, 46802 translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
46803 var m = this.textLineMatrix; 46804 m[4] = m[0] * x + m[2] * y + m[4]; 46805 m[5] = m[1] * x + m[3] * y + m[5]; 46806 }, 46807 calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) { 46808 var font = this.font; 46809 if (!font) { 46810 return null; 46811 } 46812 var m = this.textLineMatrix; 46813 if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) { 46814 return null; 46815 } 46816 var txDiff = e - m[4], tyDiff = f - m[5]; 46817 if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) { 46818 return null; 46819 } 46820 var tx, ty, denominator = a * d - b * c; 46821 if (font.vertical) { 46822 tx = -tyDiff * c / denominator; 46823 ty = tyDiff * a / denominator; 46824 } else { 46825 tx = txDiff * d / denominator; 46826 ty = -txDiff * b / denominator; 46827 } 46828 return { 46829 width: tx, 46830 height: ty, 46831 value: font.vertical ? ty : tx 46832 }; 46833 }, 46834 calcRenderMatrix: function TextState_calcRendeMatrix(ctm) { 46835 var tsm = [ 46836 this.fontSize * this.textHScale, 46837 0, 46838 0, 46839 this.fontSize, 46840 0, 46841 this.textRise 46842 ]; 46843 return Util.transform(ctm, Util.transform(this.textMatrix, tsm)); 46844 }, 46845 carriageReturn: function TextState_carriageReturn() { 46846 this.translateTextLineMatrix(0, -this.leading);
46847 this.textMatrix = this.textLineMatrix.slice(); 46848 }, 46849 clone: function TextState_clone() { 46850 var clone = Object.create(this); 46851 clone.textMatrix = this.textMatrix.slice(); 46852 clone.textLineMatrix = this.textLineMatrix.slice(); 46853 clone.fontMatrix = this.fontMatrix.slice(); 46854 return clone; 46855 } 46856 }; 46857 return TextState; 46858 }(); 46859 var EvalState = function EvalStateClosure() { 46860 function EvalState() { 46861 this.ctm = new Float32Array(IDENTITY_MATRIX); 46862 this.font = null; 46863 this.textRenderingMode = TextRenderingMode.FILL; 46864 this.fillColorSpace = ColorSpace.singletons.gray; 46865 this.strokeColorSpace = ColorSpace.singletons.gray; 46866 } 46867 EvalState.prototype = { 46868 clone: function CanvasExtraState_clone() { 46869 return Object.create(this); 46870 } 46871 }; 46872 return EvalState; 46873 }(); 46874 var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { 46875 var getOPMap = getLookupTableFactory(function (t) { 46876 t['w'] = { 46877 id: OPS.setLineWidth, 46878 numArgs: 1, 46879 variableArgs: false 46880 }; 46881 t['J'] = { 46882 id: OPS.setLineCap, 46883 numArgs: 1, 46884 variableArgs: false 46885 }; 46886 t['j'] = { 46887 id: OPS.setLineJoin, 46888 numArgs: 1, 46889 variableArgs: false 46890 }; 46891 t['M'] = { 46892 id: OPS.setMiterLimit, 46893 numArgs: 1, 46894 variableArgs: false 46895 }; 46896 t['d'] = { 46897 id: OPS.setDash, 46898 numArgs: 2, 46899 variableArgs: false 46900 }; 46901 t['ri'] = { 46902 id: OPS.setRenderingIntent, 46903 numArgs: 1, 46904 variableArgs: false 46905 }; 46906 t['i'] = { 46907 id: OPS.setFlatness, 46908 numArgs: 1, 46909 variableArgs: false 46910 }; 46911 t['gs'] = { 46912 id: OPS.setGState, 46913 numArgs: 1, 46914 variableArgs: false 46915 }; 46916 t['q'] = { 46917 id: OPS.save, 46918 numArgs: 0, 46919 variableArgs: false 46920 }; 46921 t['Q'] = { 46922 id: OPS.restore, 46923 numArgs: 0, 46924 variableArgs: false 46925 }; 46926 t['cm'] = { 46927 id: OPS.transform, 46928 numArgs: 6, 46929 variableArgs: false 46930 }; 46931 t['m'] = { 46932 id: OPS.moveTo, 46933 numArgs: 2, 46934 variableArgs: false 46935 }; 46936 t['l'] = { 46937 id: OPS.lineTo, 46938 numArgs: 2, 46939 variableArgs: false 46940 }; 46941 t['c'] = { 46942 id: OPS.curveTo, 46943 numArgs: 6, 46944 variableArgs: false 46945 }; 46946 t['v'] = { 46947 id: OPS.curveTo2, 46948 numArgs: 4, 46949 variableArgs: false 46950 }; 46951 t['y'] = { 46952 id: OPS.curveTo3, 46953 numArgs: 4, 46954 variableArgs: false 46955 }; 46956 t['h'] = { 46957 id: OPS.closePath, 46958 numArgs: 0, 46959 variableArgs: false 46960 }; 46961 t['re'] = { 46962 id: OPS.rectangle, 46963 numArgs: 4, 46964 variableArgs: false 46965 }; 46966 t['S'] = { 46967 id: OPS.stroke, 46968 numArgs: 0, 46969 variableArgs: false 46970 }; 46971 t['s'] = { 46972 id: OPS.closeStroke, 46973 numArgs: 0, 46974 variableArgs: false 46975 }; 46976 t['f'] = { 46977 id: OPS.fill, 46978 numArgs: 0, 46979 variableArgs: false 46980 }; 46981 t['F'] = { 46982 id: OPS.fill, 46983 numArgs: 0, 46984 variableArgs: false 46985 }; 46986 t['f*'] = { 46987 id: OPS.eoFill, 46988 numArgs: 0, 46989 variableArgs: false 46990 }; 46991 t['B'] = { 46992 id: OPS.fillStroke, 46993 numArgs: 0, 46994 variableArgs: false 46995 }; 46996 t['B*'] = { 46997 id: OPS.eoFillStroke, 46998 numArgs: 0, 46999 variableArgs: false 47000 }; 47001 t['b'] = { 47002 id: OPS.closeFillStroke, 47003 numArgs: 0, 47004 variableArgs: false 47005 }; 47006 t['b*'] = { 47007 id: OPS.closeEOFillStroke, 47008 numArgs: 0, 47009 variableArgs: false 47010 }; 47011 t['n'] = { 47012 id: OPS.endPath, 47013 numArgs: 0, 47014 variableArgs: false 47015 }; 47016 t['W'] = { 47017 id: OPS.clip, 47018 numArgs: 0, 47019 variableArgs: false 47020 }; 47021 t['W*'] = { 47022 id: OPS.eoClip, 47023 numArgs: 0, 47024 variableArgs: false 47025 }; 47026 t['BT'] = { 47027 id: OPS.beginText, 47028 numArgs: 0, 47029 variableArgs: false 47030 }; 47031 t['ET'] = { 47032 id: OPS.endText, 47033 numArgs: 0, 47034 variableArgs: false 47035 }; 47036 t['Tc'] = { 47037 id: OPS.setCharSpacing, 47038 numArgs: 1, 47039 variableArgs: false 47040 }; 47041 t['Tw'] = { 47042 id: OPS.setWordSpacing, 47043 numArgs: 1, 47044 variableArgs: false 47045 }; 47046 t['Tz'] = { 47047 id: OPS.setHScale, 47048 numArgs: 1, 47049 variableArgs: false 47050 }; 47051 t['TL'] = { 47052 id: OPS.setLeading, 47053 numArgs: 1, 47054 variableArgs: false 47055 }; 47056 t['Tf'] = { 47057 id: OPS.setFont, 47058 numArgs: 2, 47059 variableArgs: false 47060 }; 47061 t['Tr'] = { 47062 id: OPS.setTextRenderingMode, 47063 numArgs: 1, 47064 variableArgs: false 47065 }; 47066 t['Ts'] = { 47067 id: OPS.setTextRise, 47068 numArgs: 1, 47069 variableArgs: false 47070 }; 47071 t['Td'] = { 47072 id: OPS.moveText, 47073 numArgs: 2, 47074 variableArgs: false 47075 }; 47076 t['TD'] = { 47077 id: OPS.setLeadingMoveText, 47078 numArgs: 2, 47079 variableArgs: false 47080 }; 47081 t['Tm'] = { 47082 id: OPS.setTextMatrix, 47083 numArgs: 6, 47084 variableArgs: false 47085 }; 47086 t['T*'] = { 47087 id: OPS.nextLine, 47088 numArgs: 0, 47089 variableArgs: false 47090 }; 47091 t['Tj'] = { 47092 id: OPS.showText, 47093 numArgs: 1, 47094 variableArgs: false 47095 }; 47096 t['TJ'] = { 47097 id: OPS.showSpacedText, 47098 numArgs: 1, 47099 variableArgs: false 47100 }; 47101 t['\''] = { 47102 id: OPS.nextLineShowText, 47103 numArgs: 1, 47104 variableArgs: false 47105 }; 47106 t['"'] = { 47107 id: OPS.nextLineSetSpacingShowText, 47108 numArgs: 3, 47109 variableArgs: false 47110 }; 47111 t['d0'] = { 47112 id: OPS.setCharWidth, 47113 numArgs: 2, 47114 variableArgs: false 47115 }; 47116 t['d1'] = { 47117 id: OPS.setCharWidthAndBounds, 47118 numArgs: 6, 47119 variableArgs: false 47120 }; 47121 t['CS'] = { 47122 id: OPS.setStrokeColorSpace, 47123 numArgs: 1, 47124 variableArgs: false 47125 };
47126 t['cs'] = { 47127 id: OPS.setFillColorSpace, 47128 numArgs: 1, 47129 variableArgs: false 47130 }; 47131 t['SC'] = { 47132 id: OPS.setStrokeColor, 47133 numArgs: 4, 47134 variableArgs: true 47135 }; 47136 t['SCN'] = { 47137 id: OPS.setStrokeColorN, 47138 numArgs: 33, 47139 variableArgs: true 47140 }; 47141 t['sc'] = { 47142 id: OPS.setFillColor, 47143 numArgs: 4, 47144 variableArgs: true 47145 }; 47146 t['scn'] = { 47147 id: OPS.setFillColorN, 47148 numArgs: 33, 47149 variableArgs: true 47150 }; 47151 t['G'] = { 47152 id: OPS.setStrokeGray, 47153 numArgs: 1, 47154 variableArgs: false 47155 }; 47156 t['g'] = { 47157 id: OPS.setFillGray, 47158 numArgs: 1, 47159 variableArgs: false 47160 }; 47161 t['RG'] = { 47162 id: OPS.setStrokeRGBColor, 47163 numArgs: 3, 47164 variableArgs: false 47165 }; 47166 t['rg'] = { 47167 id: OPS.setFillRGBColor, 47168 numArgs: 3, 47169 variableArgs: false 47170 }; 47171 t['K'] = { 47172 id: OPS.setStrokeCMYKColor, 47173 numArgs: 4, 47174 variableArgs: false 47175 }; 47176 t['k'] = { 47177 id: OPS.setFillCMYKColor, 47178 numArgs: 4, 47179 variableArgs: false 47180 }; 47181 t['sh'] = { 47182 id: OPS.shadingFill, 47183 numArgs: 1, 47184 variableArgs: false 47185 }; 47186 t['BI'] = { 47187 id: OPS.beginInlineImage, 47188 numArgs: 0, 47189 variableArgs: false 47190 }; 47191 t['ID'] = { 47192 id: OPS.beginImageData, 47193 numArgs: 0, 47194 variableArgs: false 47195 }; 47196 t['EI'] = { 47197 id: OPS.endInlineImage, 47198 numArgs: 1, 47199 variableArgs: false 47200 }; 47201 t['Do'] = { 47202 id: OPS.paintXObject, 47203 numArgs: 1, 47204 variableArgs: false 47205 }; 47206 t['MP'] = { 47207 id: OPS.markPoint, 47208 numArgs: 1, 47209 variableArgs: false 47210 }; 47211 t['DP'] = { 47212 id: OPS.markPointProps, 47213 numArgs: 2, 47214 variableArgs: false 47215 }; 47216 t['BMC'] = { 47217 id: OPS.beginMarkedContent, 47218 numArgs: 1, 47219 variableArgs: false 47220 }; 47221 t['BDC'] = { 47222 id: OPS.beginMarkedContentProps, 47223 numArgs: 2, 47224 variableArgs: false 47225 }; 47226 t['EMC'] = { 47227 id: OPS.endMarkedContent, 47228 numArgs: 0, 47229 variableArgs: false 47230 };
47231 t['BX'] = { 47232 id: OPS.beginCompat, 47233 numArgs: 0, 47234 variableArgs: false 47235 }; 47236 t['EX'] = { 47237 id: OPS.endCompat, 47238 numArgs: 0, 47239 variableArgs: false 47240 }; 47241 t['BM'] = null; 47242 t['BD'] = null; 47243 t['true'] = null; 47244 t['fa'] = null; 47245 t['fal'] = null; 47246 t['fals'] = null; 47247 t['false'] = null; 47248 t['nu'] = null; 47249 t['nul'] = null; 47250 t['null'] = null; 47251 }); 47252 function EvaluatorPreprocessor(stream, xref, stateManager) { 47253 this.opMap = getOPMap(); 47254 this.parser = new Parser(new Lexer(stream, this.opMap), false, xref); 47255 this.stateManager = stateManager; 47256 this.nonProcessedArgs = []; 47257 } 47258 EvaluatorPreprocessor.prototype = { 47259 get savedStatesDepth() { 47260 return this.stateManager.stateStack.length; 47261 }, 47262 read: function EvaluatorPreprocessor_read(operation) { 47263 var args = operation.args; 47264 while (true) { 47265 var obj = this.parser.getObj(); 47266 if (isCmd(obj)) { 47267 var cmd = obj.cmd; 47268 var opSpec = this.opMap[cmd]; 47269 if (!opSpec) { 47270 warn('Unknown command "' + cmd + '"'); 47271 continue; 47272 } 47273 var fn = opSpec.id; 47274 var numArgs = opSpec.numArgs; 47275 var argsLength = args !== null ? args.length : 0; 47276 if (!opSpec.variableArgs) { 47277 if (argsLength !== numArgs) { 47278 var nonProcessedArgs = this.nonProcessedArgs; 47279 while (argsLength > numArgs) { 47280 nonProcessedArgs.push(args.shift()); 47281 argsLength--; 47282 } 47283 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 47284 if (args === null) { 47285 args = []; 47286 } 47287 args.unshift(nonProcessedArgs.pop()); 47288 argsLength++; 47289 } 47290 } 47291 if (argsLength < numArgs) { 47292 warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.'); 47293 if (args !== null) { 47294 args.length = 0; 47295 } 47296 continue; 47297 } 47298 } else if (argsLength > numArgs) { 47299 info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.'); 47300 } 47301 this.preprocessCommand(fn, args); 47302 operation.fn = fn; 47303 operation.args = args; 47304 return true; 47305 } 47306 if (isEOF(obj)) { 47307 return false; 47308 } 47309 if (obj !== null) { 47310 if (args === null) { 47311 args = []; 47312 } 47313 args.push(obj); 47314 assert(args.length <= 33, 'Too many arguments'); 47315 } 47316 } 47317 }, 47318 preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) { 47319 switch (fn | 0) { 47320 case OPS.save: 47321 this.stateManager.save(); 47322 break; 47323 case OPS.restore: 47324 this.stateManager.restore(); 47325 break; 47326 case OPS.transform: 47327 this.stateManager.transform(args); 47328 break; 47329 } 47330 } 47331 }; 47332 return EvaluatorPreprocessor; 47333 }(); 47334 var QueueOptimizer = function QueueOptimizerClosure() { 47335 function addState(parentState, pattern, fn) { 47336 var state = parentState; 47337 for (var i = 0, ii = pattern.length - 1; i < ii; i++) { 47338 var item = pattern[i]; 47339 state = state[item] || (state[item] = []); 47340 } 47341 state[pattern[pattern.length - 1]] = fn; 47342 } 47343 function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) { 47344 var iFirstPIMXO = iFirstSave + 2; 47345 for (var i = 0; i < count; i++) { 47346 var arg = argsArray[iFirstPIMXO + 4 * i]; 47347 var imageMask = arg.length === 1 && arg[0]; 47348 if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) { 47349 fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask; 47350 continue; 47351 } 47352 break; 47353 } 47354 return count - i; 47355 } 47356 var InitialState = []; 47357 addState(InitialState, [ 47358 OPS.save, 47359 OPS.transform, 47360 OPS.paintInlineImageXObject, 47361 OPS.restore 47362 ], function foundInlineImageGroup(context) { 47363 var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 47364 var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 47365 var MAX_WIDTH = 1000; 47366 var IMAGE_PADDING = 1; 47367 var fnArray = context.fnArray, argsArray = context.argsArray;
47368 var curr = context.iCurr; 47369 var iFirstSave = curr - 3; 47370 var iFirstTransform = curr - 2; 47371 var iFirstPIIXO = curr - 1; 47372 var i = iFirstSave + 4; 47373 var ii = fnArray.length; 47374 while (i + 3 < ii) { 47375 if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) { 47376 break; 47377 } 47378 i += 4; 47379 } 47380 var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 47381 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 47382 return i; 47383 } 47384 var maxX = 0; 47385 var map = [], maxLineHeight = 0; 47386 var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING; 47387 var q; 47388 for (q = 0; q < count; q++) { 47389 var transform = argsArray[iFirstTransform + (q << 2)]; 47390 var img = argsArray[iFirstPIIXO + (q << 2)][0]; 47391 if (currentX + img.width > MAX_WIDTH) { 47392 maxX = Math.max(maxX, currentX); 47393 currentY += maxLineHeight + 2 * IMAGE_PADDING; 47394 currentX = 0; 47395 maxLineHeight = 0; 47396 } 47397 map.push({ 47398 transform: transform, 47399 x: currentX, 47400 y: currentY, 47401 w: img.width, 47402 h: img.height 47403 }); 47404 currentX += img.width + 2 * IMAGE_PADDING; 47405 maxLineHeight = Math.max(maxLineHeight, img.height); 47406 } 47407 var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 47408 var imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 47409 var imgData = new Uint8Array(imgWidth * imgHeight * 4); 47410 var imgRowSize = imgWidth << 2; 47411 for (q = 0; q < count; q++) { 47412 var data = argsArray[iFirstPIIXO + (q << 2)][0].data; 47413 var rowSize = map[q].w << 2; 47414 var dataOffset = 0; 47415 var offset = map[q].x + map[q].y * imgWidth << 2; 47416 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 47417 for (var k = 0, kk = map[q].h; k < kk; k++) { 47418 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 47419 dataOffset += rowSize; 47420 offset += imgRowSize; 47421 } 47422 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 47423 while (offset >= 0) { 47424 data[offset - 4] = data[offset]; 47425 data[offset - 3] = data[offset + 1]; 47426 data[offset - 2] = data[offset + 2]; 47427 data[offset - 1] = data[offset + 3]; 47428 data[offset + rowSize] = data[offset + rowSize - 4]; 47429 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 47430 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 47431 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 47432 offset -= imgRowSize; 47433 } 47434 } 47435 fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup); 47436 argsArray.splice(iFirstSave, count * 4, [ 47437 { 47438 width: imgWidth, 47439 height: imgHeight, 47440 kind: ImageKind.RGBA_32BPP, 47441 data: imgData 47442 }, 47443 map 47444 ]); 47445 return iFirstSave + 1; 47446 }); 47447 addState(InitialState, [ 47448 OPS.save, 47449 OPS.transform, 47450 OPS.paintImageMaskXObject, 47451 OPS.restore 47452 ], function foundImageMaskGroup(context) { 47453 var MIN_IMAGES_IN_MASKS_BLOCK = 10; 47454 var MAX_IMAGES_IN_MASKS_BLOCK = 100; 47455 var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 47456 var fnArray = context.fnArray, argsArray = context.argsArray; 47457 var curr = context.iCurr; 47458 var iFirstSave = curr - 3; 47459 var iFirstTransform = curr - 2; 47460 var iFirstPIMXO = curr - 1; 47461 var i = iFirstSave + 4; 47462 var ii = fnArray.length; 47463 while (i + 3 < ii) { 47464 if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) { 47465 break; 47466 } 47467 i += 4; 47468 } 47469 var count = (i - iFirstSave) / 4; 47470 count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray); 47471 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 47472 return i; 47473 } 47474 var q; 47475 var isSameImage = false; 47476 var iTransform, transformArgs; 47477 var firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 47478 if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) { 47479 isSameImage = true; 47480 var firstTransformArg0 = argsArray[iFirstTransform][0]; 47481 var firstTransformArg3 = argsArray[iFirstTransform][3]; 47482 iTransform = iFirstTransform + 4; 47483 var iPIMXO = iFirstPIMXO + 4; 47484 for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 47485 transformArgs = argsArray[iTransform]; 47486 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) { 47487 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 47488 isSameImage = false;
47489 } else { 47490 count = q; 47491 } 47492 break; 47493 } 47494 } 47495 } 47496 if (isSameImage) { 47497 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 47498 var positions = new Float32Array(count * 2); 47499 iTransform = iFirstTransform; 47500 for (q = 0; q < count; q++, iTransform += 4) { 47501 transformArgs = argsArray[iTransform]; 47502 positions[q << 1] = transformArgs[4]; 47503 positions[(q << 1) + 1] = transformArgs[5]; 47504 } 47505 fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat); 47506 argsArray.splice(iFirstSave, count * 4, [ 47507 firstPIMXOArg0, 47508 firstTransformArg0, 47509 firstTransformArg3, 47510 positions 47511 ]); 47512 } else { 47513 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 47514 var images = []; 47515 for (q = 0; q < count; q++) { 47516 transformArgs = argsArray[iFirstTransform + (q << 2)]; 47517 var maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 47518 images.push({ 47519 data: maskParams.data, 47520 width: maskParams.width, 47521 height: maskParams.height, 47522 transform: transformArgs 47523 }); 47524 } 47525 fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup); 47526 argsArray.splice(iFirstSave, count * 4, [images]); 47527 } 47528 return iFirstSave + 1; 47529 }); 47530 addState(InitialState, [ 47531 OPS.save, 47532 OPS.transform, 47533 OPS.paintImageXObject, 47534 OPS.restore 47535 ], function (context) { 47536 var MIN_IMAGES_IN_BLOCK = 3; 47537 var MAX_IMAGES_IN_BLOCK = 1000; 47538 var fnArray = context.fnArray, argsArray = context.argsArray; 47539 var curr = context.iCurr; 47540 var iFirstSave = curr - 3; 47541 var iFirstTransform = curr - 2; 47542 var iFirstPIXO = curr - 1; 47543 var iFirstRestore = curr; 47544 if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) { 47545 return iFirstRestore + 1; 47546 } 47547 var firstPIXOArg0 = argsArray[iFirstPIXO][0]; 47548 var firstTransformArg0 = argsArray[iFirstTransform][0]; 47549 var firstTransformArg3 = argsArray[iFirstTransform][3]; 47550 var i = iFirstSave + 4; 47551 var ii = fnArray.length; 47552 while (i + 3 < ii) { 47553 if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) { 47554 break; 47555 } 47556 if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) { 47557 break; 47558 } 47559 if (argsArray[i + 2][0] !== firstPIXOArg0) { 47560 break; 47561 } 47562 i += 4; 47563 } 47564 var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK); 47565 if (count < MIN_IMAGES_IN_BLOCK) { 47566 return i; 47567 } 47568 var positions = new Float32Array(count * 2); 47569 var iTransform = iFirstTransform; 47570 for (var q = 0; q < count; q++, iTransform += 4) { 47571 var transformArgs = argsArray[iTransform]; 47572 positions[q << 1] = transformArgs[4]; 47573 positions[(q << 1) + 1] = transformArgs[5]; 47574 } 47575 var args = [ 47576 firstPIXOArg0, 47577 firstTransformArg0, 47578 firstTransformArg3, 47579 positions 47580 ]; 47581 fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat); 47582 argsArray.splice(iFirstSave, count * 4, args); 47583 return iFirstSave + 1; 47584 }); 47585 addState(InitialState, [ 47586 OPS.beginText, 47587 OPS.setFont, 47588 OPS.setTextMatrix, 47589 OPS.showText, 47590 OPS.endText 47591 ], function (context) { 47592 var MIN_CHARS_IN_BLOCK = 3; 47593 var MAX_CHARS_IN_BLOCK = 1000; 47594 var fnArray = context.fnArray, argsArray = context.argsArray; 47595 var curr = context.iCurr; 47596 var iFirstBeginText = curr - 4; 47597 var iFirstSetFont = curr - 3; 47598 var iFirstSetTextMatrix = curr - 2; 47599 var iFirstShowText = curr - 1; 47600 var iFirstEndText = curr; 47601 var firstSetFontArg0 = argsArray[iFirstSetFont][0]; 47602 var firstSetFontArg1 = argsArray[iFirstSetFont][1]; 47603 var i = iFirstBeginText + 5; 47604 var ii = fnArray.length; 47605 while (i + 4 < ii) { 47606 if (fnArray[i] !== OPS.beginText || fnArray[i + 1] !== OPS.setFont || fnArray[i + 2] !== OPS.setTextMatrix || fnArray[i + 3] !== OPS.showText || fnArray[i + 4] !== OPS.endText) { 47607 break; 47608 } 47609 if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) { 47610 break; 47611 } 47612 i += 5; 47613 } 47614 var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK); 47615 if (count < MIN_CHARS_IN_BLOCK) { 47616 return i; 47617 } 47618 var iFirst = iFirstBeginText; 47619 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) { 47620 count++; 47621 iFirst -= 5; 47622 } 47623 var iEndText = iFirst + 4; 47624 for (var q = 1; q < count; q++) { 47625 fnArray.splice(iEndText, 3); 47626 argsArray.splice(iEndText, 3); 47627 iEndText += 2; 47628 } 47629 return iEndText + 1; 47630 }); 47631 function QueueOptimizer() { 47632 } 47633 QueueOptimizer.prototype = { 47634 optimize: function QueueOptimizer_optimize(queue) { 47635 var fnArray = queue.fnArray, argsArray = queue.argsArray; 47636 var context = { 47637 iCurr: 0, 47638 fnArray: fnArray, 47639 argsArray: argsArray 47640 }; 47641 var state; 47642 var i = 0, ii = fnArray.length; 47643 while (i < ii) { 47644 state = (state || InitialState)[fnArray[i]]; 47645 if (typeof state === 'function') {
47646 context.iCurr = i; 47647 i = state(context); 47648 state = undefined; 47649 ii = context.fnArray.length; 47650 } else { 47651 i++; 47652 } 47653 } 47654 } 47655 }; 47656 return QueueOptimizer; 47657 }(); 47658 exports.OperatorList = OperatorList; 47659 exports.PartialEvaluator = PartialEvaluator; 47660 })); 47661 (function (root, factory) { 47662 factory(root.pdfjsCoreAnnotation = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreColorSpace, root.pdfjsCoreObj, root.pdfjsCoreEvaluator); 47663 }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreColorSpace, coreObj, coreEvaluator) { 47664 var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType; 47665 var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag; 47666 var AnnotationFlag = sharedUtil.AnnotationFlag; 47667 var AnnotationType = sharedUtil.AnnotationType; 47668 var OPS = sharedUtil.OPS; 47669 var Util = sharedUtil.Util; 47670 var isArray = sharedUtil.isArray; 47671 var isInt = sharedUtil.isInt; 47672 var stringToBytes = sharedUtil.stringToBytes; 47673 var stringToPDFString = sharedUtil.stringToPDFString; 47674 var warn = sharedUtil.warn; 47675 var Dict = corePrimitives.Dict; 47676 var isDict = corePrimitives.isDict; 47677 var isName = corePrimitives.isName; 47678 var isRef = corePrimitives.isRef; 47679 var Stream = coreStream.Stream; 47680 var ColorSpace = coreColorSpace.ColorSpace; 47681 var Catalog = coreObj.Catalog; 47682 var ObjectLoader = coreObj.ObjectLoader; 47683 var FileSpec = coreObj.FileSpec; 47684 var OperatorList = coreEvaluator.OperatorList; 47685 function AnnotationFactory() { 47686 } 47687 AnnotationFactory.prototype = { 47688 create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) { 47689 var dict = xref.fetchIfRef(ref); 47690 if (!isDict(dict)) { 47691 return; 47692 } 47693 var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId(); 47694 var subtype = dict.get('Subtype'); 47695 subtype = isName(subtype) ? subtype.name : null; 47696 var parameters = { 47697 xref: xref, 47698 dict: dict, 47699 ref: isRef(ref) ? ref : null, 47700 subtype: subtype, 47701 id: id, 47702 pdfManager: pdfManager 47703 }; 47704 switch (subtype) { 47705 case 'Link': 47706 return new LinkAnnotation(parameters); 47707 case 'Text': 47708 return new TextAnnotation(parameters); 47709 case 'Widget': 47710 var fieldType = Util.getInheritableProperty(dict, 'FT'); 47711 fieldType = isName(fieldType) ? fieldType.name : null; 47712 switch (fieldType) { 47713 case 'Tx': 47714 return new TextWidgetAnnotation(parameters); 47715 case 'Btn': 47716 return new ButtonWidgetAnnotation(parameters); 47717 case 'Ch': 47718 return new ChoiceWidgetAnnotation(parameters); 47719 } 47720 warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.'); 47721 return new WidgetAnnotation(parameters); 47722 case 'Popup': 47723 return new PopupAnnotation(parameters); 47724 case 'Highlight': 47725 return new HighlightAnnotation(parameters); 47726 case 'Underline': 47727 return new UnderlineAnnotation(parameters); 47728 case 'Squiggly': 47729 return new SquigglyAnnotation(parameters); 47730 case 'StrikeOut': 47731 return new StrikeOutAnnotation(parameters); 47732 case 'FileAttachment': 47733 return new FileAttachmentAnnotation(parameters); 47734 default: 47735 if (!subtype) { 47736 warn('Annotation is missing the required /Subtype.'); 47737 } else { 47738 warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.'); 47739 } 47740 return new Annotation(parameters); 47741 } 47742 } 47743 }; 47744 var Annotation = function AnnotationClosure() { 47745 function getTransformMatrix(rect, bbox, matrix) { 47746 var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix); 47747 var minX = bounds[0]; 47748 var minY = bounds[1]; 47749 var maxX = bounds[2]; 47750 var maxY = bounds[3]; 47751 if (minX === maxX || minY === maxY) { 47752 return [ 47753 1, 47754 0, 47755 0, 47756 1, 47757 rect[0], 47758 rect[1] 47759 ]; 47760 } 47761 var xRatio = (rect[2] - rect[0]) / (maxX - minX); 47762 var yRatio = (rect[3] - rect[1]) / (maxY - minY); 47763 return [ 47764 xRatio, 47765 0, 47766 0, 47767 yRatio, 47768 rect[0] - minX * xRatio, 47769 rect[1] - minY * yRatio 47770 ]; 47771 } 47772 function getDefaultAppearance(dict) { 47773 var appearanceState = dict.get('AP'); 47774 if (!isDict(appearanceState)) { 47775 return; 47776 } 47777 var appearance; 47778 var appearances = appearanceState.get('N'); 47779 if (isDict(appearances)) { 47780 var as = dict.get('AS'); 47781 if (as && appearances.has(as.name)) { 47782 appearance = appearances.get(as.name); 47783 } 47784 } else { 47785 appearance = appearances; 47786 } 47787 return appearance; 47788 } 47789 function Annotation(params) { 47790 var dict = params.dict; 47791 this.setFlags(dict.get('F')); 47792 this.setRectangle(dict.getArray('Rect')); 47793 this.setColor(dict.getArray('C')); 47794 this.setBorderStyle(dict); 47795 this.appearance = getDefaultAppearance(dict); 47796 this.data = {}; 47797 this.data.id = params.id; 47798 this.data.subtype = params.subtype; 47799 this.data.annotationFlags = this.flags; 47800 this.data.rect = this.rectangle; 47801 this.data.color = this.color; 47802 this.data.borderStyle = this.borderStyle; 47803 this.data.hasAppearance = !!this.appearance; 47804 } 47805 Annotation.prototype = { 47806 _hasFlag: function Annotation_hasFlag(flags, flag) { 47807 return !!(flags & flag); 47808 }, 47809 _isViewable: function Annotation_isViewable(flags) { 47810 return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW); 47811 }, 47812 _isPrintable: function AnnotationFlag_isPrintable(flags) { 47813 return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN); 47814 }, 47815 get viewable() { 47816 if (this.flags === 0) { 47817 return true; 47818 } 47819 return this._isViewable(this.flags); 47820 }, 47821 get printable() { 47822 if (this.flags === 0) { 47823 return false;
47824 } 47825 return this._isPrintable(this.flags); 47826 }, 47827 setFlags: function Annotation_setFlags(flags) { 47828 this.flags = isInt(flags) && flags > 0 ? flags : 0; 47829 }, 47830 hasFlag: function Annotation_hasFlag(flag) { 47831 return this._hasFlag(this.flags, flag); 47832 }, 47833 setRectangle: function Annotation_setRectangle(rectangle) { 47834 if (isArray(rectangle) && rectangle.length === 4) { 47835 this.rectangle = Util.normalizeRect(rectangle); 47836 } else { 47837 this.rectangle = [ 47838 0, 47839 0, 47840 0, 47841 0 47842 ]; 47843 } 47844 }, 47845 setColor: function Annotation_setColor(color) { 47846 var rgbColor = new Uint8Array(3); 47847 if (!isArray(color)) { 47848 this.color = rgbColor; 47849 return; 47850 } 47851 switch (color.length) { 47852 case 0: 47853 this.color = null; 47854 break; 47855 case 1: 47856 ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 47857 this.color = rgbColor; 47858 break; 47859 case 3: 47860 ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 47861 this.color = rgbColor; 47862 break; 47863 case 4: 47864 ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 47865 this.color = rgbColor; 47866 break; 47867 default: 47868 this.color = rgbColor; 47869 break; 47870 } 47871 }, 47872 setBorderStyle: function Annotation_setBorderStyle(borderStyle) { 47873 this.borderStyle = new AnnotationBorderStyle(); 47874 if (!isDict(borderStyle)) { 47875 return; 47876 } 47877 if (borderStyle.has('BS')) { 47878 var dict = borderStyle.get('BS'); 47879 var dictType = dict.get('Type'); 47880 if (!dictType || isName(dictType, 'Border')) { 47881 this.borderStyle.setWidth(dict.get('W')); 47882 this.borderStyle.setStyle(dict.get('S')); 47883 this.borderStyle.setDashArray(dict.getArray('D')); 47884 } 47885 } else if (borderStyle.has('Border')) { 47886 var array = borderStyle.getArray('Border'); 47887 if (isArray(array) && array.length >= 3) { 47888 this.borderStyle.setHorizontalCornerRadius(array[0]); 47889 this.borderStyle.setVerticalCornerRadius(array[1]); 47890 this.borderStyle.setWidth(array[2]); 47891 if (array.length === 4) { 47892 this.borderStyle.setDashArray(array[3]); 47893 } 47894 } 47895 } else { 47896 this.borderStyle.setWidth(0); 47897 } 47898 }, 47899 _preparePopup: function Annotation_preparePopup(dict) { 47900 if (!dict.has('C')) { 47901 this.data.color = null; 47902 } 47903 this.data.hasPopup = dict.has('Popup'); 47904 this.data.title = stringToPDFString(dict.get('T') || ''); 47905 this.data.contents = stringToPDFString(dict.get('Contents') || ''); 47906 }, 47907 loadResources: function Annotation_loadResources(keys) { 47908 return new Promise(function (resolve, reject) { 47909 this.appearance.dict.getAsync('Resources').then(function (resources) { 47910 if (!resources) { 47911 resolve(); 47912 return; 47913 } 47914 var objectLoader = new ObjectLoader(resources.map, keys, resources.xref); 47915 objectLoader.load().then(function () { 47916 resolve(resources); 47917 }, reject); 47918 }, reject); 47919 }.bind(this)); 47920 }, 47921 getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) { 47922 if (!this.appearance) { 47923 return Promise.resolve(new OperatorList()); 47924 } 47925 var data = this.data; 47926 var appearanceDict = this.appearance.dict; 47927 var resourcesPromise = this.loadResources([ 47928 'ExtGState', 47929 'ColorSpace', 47930 'Pattern', 47931 'Shading', 47932 'XObject', 47933 'Font' 47934 ]); 47935 var bbox = appearanceDict.getArray('BBox') || [ 47936 0, 47937 0, 47938 1, 47939 1 47940 ]; 47941 var matrix = appearanceDict.getArray('Matrix') || [ 47942 1, 47943 0, 47944 0, 47945 1, 47946 0, 47947 0 47948 ]; 47949 var transform = getTransformMatrix(data.rect, bbox, matrix); 47950 var self = this; 47951 return resourcesPromise.then(function (resources) { 47952 var opList = new OperatorList(); 47953 opList.addOp(OPS.beginAnnotation, [ 47954 data.rect, 47955 transform, 47956 matrix 47957 ]); 47958 return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () { 47959 opList.addOp(OPS.endAnnotation, []); 47960 self.appearance.reset(); 47961 return opList; 47962 }); 47963 }); 47964 } 47965 }; 47966 Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) { 47967 var annotationPromises = []; 47968 for (var i = 0, n = annotations.length; i < n; ++i) { 47969 if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) { 47970 annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms)); 47971 } 47972 } 47973 return Promise.all(annotationPromises).then(function (operatorLists) { 47974 opList.addOp(OPS.beginAnnotations, []); 47975 for (var i = 0, n = operatorLists.length; i < n; ++i) { 47976 opList.addOpList(operatorLists[i]); 47977 } 47978 opList.addOp(OPS.endAnnotations, []); 47979 }); 47980 }; 47981 return Annotation; 47982 }(); 47983 var AnnotationBorderStyle = function AnnotationBorderStyleClosure() { 47984 function AnnotationBorderStyle() { 47985 this.width = 1; 47986 this.style = AnnotationBorderStyleType.SOLID; 47987 this.dashArray = [3]; 47988 this.horizontalCornerRadius = 0; 47989 this.verticalCornerRadius = 0; 47990 } 47991 AnnotationBorderStyle.prototype = {
47992 setWidth: function AnnotationBorderStyle_setWidth(width) { 47993 if (width === (width | 0)) { 47994 this.width = width; 47995 } 47996 }, 47997 setStyle: function AnnotationBorderStyle_setStyle(style) { 47998 if (!style) { 47999 return; 48000 } 48001 switch (style.name) { 48002 case 'S': 48003 this.style = AnnotationBorderStyleType.SOLID; 48004 break; 48005 case 'D': 48006 this.style = AnnotationBorderStyleType.DASHED; 48007 break; 48008 case 'B': 48009 this.style = AnnotationBorderStyleType.BEVELED; 48010 break; 48011 case 'I': 48012 this.style = AnnotationBorderStyleType.INSET; 48013 break; 48014 case 'U': 48015 this.style = AnnotationBorderStyleType.UNDERLINE; 48016 break; 48017 default: 48018 break; 48019 } 48020 }, 48021 setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) { 48022 if (isArray(dashArray) && dashArray.length > 0) { 48023 var isValid = true; 48024 var allZeros = true; 48025 for (var i = 0, len = dashArray.length; i < len; i++) { 48026 var element = dashArray[i]; 48027 var validNumber = +element >= 0; 48028 if (!validNumber) { 48029 isValid = false; 48030 break; 48031 } else if (element > 0) { 48032 allZeros = false; 48033 } 48034 } 48035 if (isValid && !allZeros) { 48036 this.dashArray = dashArray; 48037 } else { 48038 this.width = 0; 48039 } 48040 } else if (dashArray) { 48041 this.width = 0; 48042 } 48043 }, 48044 setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) { 48045 if (radius === (radius | 0)) { 48046 this.horizontalCornerRadius = radius; 48047 } 48048 }, 48049 setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) { 48050 if (radius === (radius | 0)) { 48051 this.verticalCornerRadius = radius; 48052 } 48053 } 48054 }; 48055 return AnnotationBorderStyle; 48056 }(); 48057 var WidgetAnnotation = function WidgetAnnotationClosure() { 48058 function WidgetAnnotation(params) { 48059 Annotation.call(this, params); 48060 var dict = params.dict; 48061 var data = this.data; 48062 data.annotationType = AnnotationType.WIDGET; 48063 data.fieldName = this._constructFieldName(dict); 48064 data.fieldValue = Util.getInheritableProperty(dict, 'V', true); 48065 data.alternativeText = stringToPDFString(dict.get('TU') || ''); 48066 data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || ''; 48067 var fieldType = Util.getInheritableProperty(dict, 'FT'); 48068 data.fieldType = isName(fieldType) ? fieldType.name : null; 48069 this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty; 48070 data.fieldFlags = Util.getInheritableProperty(dict, 'Ff'); 48071 if (!isInt(data.fieldFlags) || data.fieldFlags < 0) { 48072 data.fieldFlags = 0; 48073 } 48074 data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY); 48075 if (data.fieldType === 'Sig') { 48076 this.setFlags(AnnotationFlag.HIDDEN); 48077 } 48078 } 48079 Util.inherit(WidgetAnnotation, Annotation, { 48080 _constructFieldName: function WidgetAnnotation_constructFieldName(dict) { 48081 if (!dict.has('T') && !dict.has('Parent')) { 48082 warn('Unknown field name, falling back to empty field name.'); 48083 return ''; 48084 } 48085 if (!dict.has('Parent')) { 48086 return stringToPDFString(dict.get('T')); 48087 } 48088 var fieldName = []; 48089 if (dict.has('T')) { 48090 fieldName.unshift(stringToPDFString(dict.get('T'))); 48091 } 48092 var loopDict = dict; 48093 while (loopDict.has('Parent')) { 48094 loopDict = loopDict.get('Parent'); 48095 if (loopDict.has('T')) { 48096 fieldName.unshift(stringToPDFString(loopDict.get('T'))); 48097 } 48098 } 48099 return fieldName.join('.'); 48100 }, 48101 hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) { 48102 return !!(this.data.fieldFlags & flag); 48103 } 48104 }); 48105 return WidgetAnnotation; 48106 }(); 48107 var TextWidgetAnnotation = function TextWidgetAnnotationClosure() { 48108 function TextWidgetAnnotation(params) { 48109 WidgetAnnotation.call(this, params); 48110 this.data.fieldValue = stringToPDFString(this.data.fieldValue || ''); 48111 var alignment = Util.getInheritableProperty(params.dict, 'Q'); 48112 if (!isInt(alignment) || alignment < 0 || alignment > 2) { 48113 alignment = null; 48114 } 48115 this.data.textAlignment = alignment; 48116 var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen'); 48117 if (!isInt(maximumLength) || maximumLength < 0) { 48118 maximumLength = null; 48119 } 48120 this.data.maxLen = maximumLength; 48121 this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE); 48122 this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; 48123 } 48124 Util.inherit(TextWidgetAnnotation, WidgetAnnotation, { 48125 getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { 48126 var operatorList = new OperatorList(); 48127 if (renderForms) { 48128 return Promise.resolve(operatorList); 48129 } 48130 if (this.appearance) { 48131 return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); 48132 } 48133 if (!this.data.defaultAppearance) { 48134 return Promise.resolve(operatorList); 48135 } 48136 var stream = new Stream(stringToBytes(this.data.defaultAppearance)); 48137 return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () { 48138 return operatorList; 48139 }); 48140 } 48141 }); 48142 return TextWidgetAnnotation; 48143 }(); 48144 var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() { 48145 function ButtonWidgetAnnotation(params) { 48146 WidgetAnnotation.call(this, params); 48147 this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); 48148 if (this.data.checkBox) { 48149 if (!isName(this.data.fieldValue)) { 48150 return; 48151 } 48152 this.data.fieldValue = this.data.fieldValue.name; 48153 } 48154 this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); 48155 if (this.data.radioButton) { 48156 this.data.fieldValue = this.data.buttonValue = null; 48157 var fieldParent = params.dict.get('Parent'); 48158 if (!isDict(fieldParent) || !fieldParent.has('V')) { 48159 return; 48160 } 48161 var fieldParentValue = fieldParent.get('V'); 48162 if (!isName(fieldParentValue)) { 48163 return; 48164 } 48165 this.data.fieldValue = fieldParentValue.name; 48166 var appearanceStates = params.dict.get('AP'); 48167 if (!isDict(appearanceStates)) { 48168 return; 48169 } 48170 var normalAppearanceState = appearanceStates.get('N'); 48171 if (!isDict(normalAppearanceState)) { 48172 return; 48173 } 48174 var keys = normalAppearanceState.getKeys(); 48175 for (var i = 0, ii = keys.length; i < ii; i++) { 48176 if (keys[i] !== 'Off') { 48177 this.data.buttonValue = keys[i]; 48178 break; 48179 } 48180 } 48181 } 48182 } 48183 Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, { 48184 getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { 48185 var operatorList = new OperatorList(); 48186 if (renderForms) { 48187 return Promise.resolve(operatorList); 48188 } 48189 if (this.appearance) { 48190 return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); 48191 } 48192 return Promise.resolve(operatorList); 48193 } 48194 }); 48195 return ButtonWidgetAnnotation; 48196 }(); 48197 var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() { 48198 function ChoiceWidgetAnnotation(params) { 48199 WidgetAnnotation.call(this, params); 48200 this.data.options = []; 48201 var options = params.dict.get('Opt'); 48202 if (isArray(options)) { 48203 var xref = params.xref; 48204 for (var i = 0, ii = options.length; i < ii; i++) { 48205 var option = xref.fetchIfRef(options[i]); 48206 var isOptionArray = isArray(option); 48207 this.data.options[i] = { 48208 exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option, 48209 displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option 48210 }; 48211 } 48212 } 48213 if (!isArray(this.data.fieldValue)) { 48214 this.data.fieldValue = [this.data.fieldValue]; 48215 } 48216 this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO); 48217 this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT); 48218 } 48219 Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, { 48220 getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { 48221 var operatorList = new OperatorList(); 48222 if (renderForms) { 48223 return Promise.resolve(operatorList); 48224 } 48225 return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); 48226 } 48227 }); 48228 return ChoiceWidgetAnnotation; 48229 }(); 48230 var TextAnnotation = function TextAnnotationClosure() {
48231 var DEFAULT_ICON_SIZE = 22; 48232 function TextAnnotation(parameters) { 48233 Annotation.call(this, parameters); 48234 this.data.annotationType = AnnotationType.TEXT; 48235 if (this.data.hasAppearance) { 48236 this.data.name = 'NoIcon'; 48237 } else { 48238 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 48239 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 48240 this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note'; 48241 } 48242 this._preparePopup(parameters.dict); 48243 } 48244 Util.inherit(TextAnnotation, Annotation, {}); 48245 return TextAnnotation; 48246 }(); 48247 var LinkAnnotation = function LinkAnnotationClosure() { 48248 function LinkAnnotation(params) { 48249 Annotation.call(this, params); 48250 var data = this.data; 48251 data.annotationType = AnnotationType.LINK; 48252 Catalog.parseDestDictionary({ 48253 destDict: params.dict, 48254 resultObj: data, 48255 docBaseUrl: params.pdfManager.docBaseUrl 48256 }); 48257 } 48258 Util.inherit(LinkAnnotation, Annotation, {}); 48259 return LinkAnnotation; 48260 }(); 48261 var PopupAnnotation = function PopupAnnotationClosure() { 48262 function PopupAnnotation(parameters) { 48263 Annotation.call(this, parameters); 48264 this.data.annotationType = AnnotationType.POPUP; 48265 var dict = parameters.dict; 48266 var parentItem = dict.get('Parent'); 48267 if (!parentItem) { 48268 warn('Popup annotation has a missing or invalid parent annotation.'); 48269 return; 48270 } 48271 this.data.parentId = dict.getRaw('Parent').toString(); 48272 this.data.title = stringToPDFString(parentItem.get('T') || ''); 48273 this.data.contents = stringToPDFString(parentItem.get('Contents') || ''); 48274 if (!parentItem.has('C')) { 48275 this.data.color = null; 48276 } else { 48277 this.setColor(parentItem.getArray('C')); 48278 this.data.color = this.color; 48279 } 48280 if (!this.viewable) { 48281 var parentFlags = parentItem.get('F'); 48282 if (this._isViewable(parentFlags)) { 48283 this.setFlags(parentFlags); 48284 } 48285 } 48286 } 48287 Util.inherit(PopupAnnotation, Annotation, {}); 48288 return PopupAnnotation; 48289 }(); 48290 var HighlightAnnotation = function HighlightAnnotationClosure() { 48291 function HighlightAnnotation(parameters) { 48292 Annotation.call(this, parameters); 48293 this.data.annotationType = AnnotationType.HIGHLIGHT; 48294 this._preparePopup(parameters.dict); 48295 this.data.borderStyle.setWidth(0); 48296 } 48297 Util.inherit(HighlightAnnotation, Annotation, {}); 48298 return HighlightAnnotation; 48299 }(); 48300 var UnderlineAnnotation = function UnderlineAnnotationClosure() { 48301 function UnderlineAnnotation(parameters) { 48302 Annotation.call(this, parameters); 48303 this.data.annotationType = AnnotationType.UNDERLINE; 48304 this._preparePopup(parameters.dict); 48305 this.data.borderStyle.setWidth(0); 48306 } 48307 Util.inherit(UnderlineAnnotation, Annotation, {}); 48308 return UnderlineAnnotation; 48309 }(); 48310 var SquigglyAnnotation = function SquigglyAnnotationClosure() { 48311 function SquigglyAnnotation(parameters) { 48312 Annotation.call(this, parameters); 48313 this.data.annotationType = AnnotationType.SQUIGGLY; 48314 this._preparePopup(parameters.dict); 48315 this.data.borderStyle.setWidth(0); 48316 } 48317 Util.inherit(SquigglyAnnotation, Annotation, {}); 48318 return SquigglyAnnotation; 48319 }(); 48320 var StrikeOutAnnotation = function StrikeOutAnnotationClosure() { 48321 function StrikeOutAnnotation(parameters) { 48322 Annotation.call(this, parameters); 48323 this.data.annotationType = AnnotationType.STRIKEOUT; 48324 this._preparePopup(parameters.dict); 48325 this.data.borderStyle.setWidth(0); 48326 } 48327 Util.inherit(StrikeOutAnnotation, Annotation, {}); 48328 return StrikeOutAnnotation; 48329 }(); 48330 var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() { 48331 function FileAttachmentAnnotation(parameters) { 48332 Annotation.call(this, parameters); 48333 var file = new FileSpec(parameters.dict.get('FS'), parameters.xref); 48334 this.data.annotationType = AnnotationType.FILEATTACHMENT; 48335 this.data.file = file.serializable; 48336 this._preparePopup(parameters.dict); 48337 } 48338 Util.inherit(FileAttachmentAnnotation, Annotation, {}); 48339 return FileAttachmentAnnotation; 48340 }(); 48341 exports.Annotation = Annotation; 48342 exports.AnnotationBorderStyle = AnnotationBorderStyle; 48343 exports.AnnotationFactory = AnnotationFactory; 48344 })); 48345 (function (root, factory) { 48346 factory(root.pdfjsCoreDocument = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreObj, root.pdfjsCoreParser, root.pdfjsCoreCrypto, root.pdfjsCoreEvaluator, root.pdfjsCoreAnnotation); 48347 }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreObj, coreParser, coreCrypto, coreEvaluator, coreAnnotation) { 48348 var MissingDataException = sharedUtil.MissingDataException; 48349 var Util = sharedUtil.Util; 48350 var assert = sharedUtil.assert; 48351 var error = sharedUtil.error; 48352 var info = sharedUtil.info; 48353 var isArray = sharedUtil.isArray; 48354 var isArrayBuffer = sharedUtil.isArrayBuffer; 48355 var isNum = sharedUtil.isNum; 48356 var isString = sharedUtil.isString; 48357 var shadow = sharedUtil.shadow; 48358 var stringToBytes = sharedUtil.stringToBytes; 48359 var stringToPDFString = sharedUtil.stringToPDFString; 48360 var warn = sharedUtil.warn; 48361 var isSpace = sharedUtil.isSpace; 48362 var Dict = corePrimitives.Dict; 48363 var isDict = corePrimitives.isDict; 48364 var isName = corePrimitives.isName; 48365 var isStream = corePrimitives.isStream; 48366 var NullStream = coreStream.NullStream; 48367 var Stream = coreStream.Stream; 48368 var StreamsSequenceStream = coreStream.StreamsSequenceStream;
48369 var Catalog = coreObj.Catalog; 48370 var ObjectLoader = coreObj.ObjectLoader; 48371 var XRef = coreObj.XRef; 48372 var Linearization = coreParser.Linearization; 48373 var calculateMD5 = coreCrypto.calculateMD5; 48374 var OperatorList = coreEvaluator.OperatorList; 48375 var PartialEvaluator = coreEvaluator.PartialEvaluator; 48376 var Annotation = coreAnnotation.Annotation; 48377 var AnnotationFactory = coreAnnotation.AnnotationFactory; 48378 var Page = function PageClosure() { 48379 var DEFAULT_USER_UNIT = 1.0; 48380 var LETTER_SIZE_MEDIABOX = [ 48381 0, 48382 0, 48383 612, 48384 792 48385 ]; 48386 function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) { 48387 this.pdfManager = pdfManager; 48388 this.pageIndex = pageIndex; 48389 this.pageDict = pageDict; 48390 this.xref = xref; 48391 this.ref = ref; 48392 this.fontCache = fontCache; 48393 this.evaluatorOptions = pdfManager.evaluatorOptions; 48394 this.resourcesPromise = null; 48395 var uniquePrefix = 'p' + this.pageIndex + '_'; 48396 var idCounters = { obj: 0 }; 48397 this.idFactory = { 48398 createObjId: function () { 48399 return uniquePrefix + ++idCounters.obj; 48400 } 48401 }; 48402 } 48403 Page.prototype = { 48404 getPageProp: function Page_getPageProp(key) { 48405 return this.pageDict.get(key); 48406 }, 48407 getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) { 48408 var dict = this.pageDict, valueArray = null, loopCount = 0; 48409 var MAX_LOOP_COUNT = 100; 48410 getArray = getArray || false; 48411 while (dict) { 48412 var value = getArray ? dict.getArray(key) : dict.get(key); 48413 if (value) { 48414 if (!valueArray) { 48415 valueArray = []; 48416 } 48417 valueArray.push(value); 48418 } 48419 if (++loopCount > MAX_LOOP_COUNT) { 48420 warn('Page_getInheritedPageProp: maximum loop count exceeded.'); 48421 break; 48422 } 48423 dict = dict.get('Parent'); 48424 } 48425 if (!valueArray) { 48426 return Dict.empty; 48427 } 48428 if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) { 48429 return valueArray[0]; 48430 } 48431 return Dict.merge(this.xref, valueArray); 48432 }, 48433 get content() { 48434 return this.getPageProp('Contents'); 48435 }, 48436 get resources() { 48437 return shadow(this, 'resources', this.getInheritedPageProp('Resources')); 48438 }, 48439 get mediaBox() { 48440 var mediaBox = this.getInheritedPageProp('MediaBox', true); 48441 if (!isArray(mediaBox) || mediaBox.length !== 4) { 48442 return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX); 48443 } 48444 return shadow(this, 'mediaBox', mediaBox); 48445 }, 48446 get cropBox() { 48447 var cropBox = this.getInheritedPageProp('CropBox', true); 48448 if (!isArray(cropBox) || cropBox.length !== 4) { 48449 return shadow(this, 'cropBox', this.mediaBox); 48450 } 48451 return shadow(this, 'cropBox', cropBox); 48452 }, 48453 get userUnit() { 48454 var obj = this.getPageProp('UserUnit'); 48455 if (!isNum(obj) || obj <= 0) { 48456 obj = DEFAULT_USER_UNIT; 48457 } 48458 return shadow(this, 'userUnit', obj); 48459 }, 48460 get view() { 48461 var mediaBox = this.mediaBox, cropBox = this.cropBox; 48462 if (mediaBox === cropBox) { 48463 return shadow(this, 'view', mediaBox); 48464 } 48465 var intersection = Util.intersect(cropBox, mediaBox); 48466 return shadow(this, 'view', intersection || mediaBox); 48467 }, 48468 get rotate() { 48469 var rotate = this.getInheritedPageProp('Rotate') || 0; 48470 if (rotate % 90 !== 0) { 48471 rotate = 0; 48472 } else if (rotate >= 360) { 48473 rotate = rotate % 360; 48474 } else if (rotate < 0) { 48475 rotate = (rotate % 360 + 360) % 360; 48476 } 48477 return shadow(this, 'rotate', rotate); 48478 }, 48479 getContentStream: function Page_getContentStream() { 48480 var content = this.content; 48481 var stream; 48482 if (isArray(content)) { 48483 var xref = this.xref; 48484 var i, n = content.length; 48485 var streams = []; 48486 for (i = 0; i < n; ++i) { 48487 streams.push(xref.fetchIfRef(content[i])); 48488 } 48489 stream = new StreamsSequenceStream(streams); 48490 } else if (isStream(content)) { 48491 stream = content; 48492 } else { 48493 stream = new NullStream(); 48494 } 48495 return stream; 48496 }, 48497 loadResources: function Page_loadResources(keys) { 48498 if (!this.resourcesPromise) { 48499 this.resourcesPromise = this.pdfManager.ensure(this, 'resources'); 48500 } 48501 return this.resourcesPromise.then(function resourceSuccess() { 48502 var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref); 48503 return objectLoader.load(); 48504 }.bind(this)); 48505 }, 48506 getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) { 48507 var self = this; 48508 var pdfManager = this.pdfManager; 48509 var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []); 48510 var resourcesPromise = this.loadResources([ 48511 'ExtGState', 48512 'ColorSpace', 48513 'Pattern', 48514 'Shading', 48515 'XObject', 48516 'Font' 48517 ]); 48518 var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.evaluatorOptions); 48519 var dataPromises = Promise.all([ 48520 contentStreamPromise, 48521 resourcesPromise 48522 ]); 48523 var pageListPromise = dataPromises.then(function (data) { 48524 var contentStream = data[0]; 48525 var opList = new OperatorList(intent, handler, self.pageIndex); 48526 handler.send('StartRenderPage', { 48527 transparency: partialEvaluator.hasBlendModes(self.resources), 48528 pageIndex: self.pageIndex, 48529 intent: intent 48530 }); 48531 return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () { 48532 return opList; 48533 }); 48534 });
48535 var annotationsPromise = pdfManager.ensure(this, 'annotations'); 48536 return Promise.all([ 48537 pageListPromise, 48538 annotationsPromise 48539 ]).then(function (datas) { 48540 var pageOpList = datas[0]; 48541 var annotations = datas[1]; 48542 if (annotations.length === 0) { 48543 pageOpList.flush(true); 48544 return pageOpList; 48545 } 48546 var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms); 48547 return annotationsReadyPromise.then(function () { 48548 pageOpList.flush(true); 48549 return pageOpList; 48550 }); 48551 }); 48552 }, 48553 extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) { 48554 var handler = { 48555 on: function nullHandlerOn() { 48556 }, 48557 send: function nullHandlerSend() { 48558 } 48559 }; 48560 var self = this; 48561 var pdfManager = this.pdfManager; 48562 var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []); 48563 var resourcesPromise = this.loadResources([ 48564 'ExtGState', 48565 'XObject', 48566 'Font' 48567 ]); 48568 var dataPromises = Promise.all([ 48569 contentStreamPromise, 48570 resourcesPromise 48571 ]); 48572 return dataPromises.then(function (data) { 48573 var contentStream = data[0]; 48574 var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.evaluatorOptions); 48575 return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems); 48576 }); 48577 }, 48578 getAnnotationsData: function Page_getAnnotationsData(intent) { 48579 var annotations = this.annotations; 48580 var annotationsData = []; 48581 for (var i = 0, n = annotations.length; i < n; ++i) { 48582 if (intent) { 48583 if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) { 48584 continue; 48585 } 48586 } 48587 annotationsData.push(annotations[i].data); 48588 } 48589 return annotationsData; 48590 }, 48591 get annotations() { 48592 var annotations = []; 48593 var annotationRefs = this.getInheritedPageProp('Annots') || []; 48594 var annotationFactory = new AnnotationFactory(); 48595 for (var i = 0, n = annotationRefs.length; i < n; ++i) { 48596 var annotationRef = annotationRefs[i]; 48597 var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory); 48598 if (annotation) { 48599 annotations.push(annotation); 48600 } 48601 } 48602 return shadow(this, 'annotations', annotations); 48603 } 48604 }; 48605 return Page; 48606 }(); 48607 var PDFDocument = function PDFDocumentClosure() { 48608 var FINGERPRINT_FIRST_BYTES = 1024; 48609 var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00'; 48610 function PDFDocument(pdfManager, arg) { 48611 var stream; 48612 if (isStream(arg)) { 48613 stream = arg; 48614 } else if (isArrayBuffer(arg)) { 48615 stream = new Stream(arg); 48616 } else { 48617 error('PDFDocument: Unknown argument type'); 48618 } 48619 assert(stream.length > 0, 'stream must have data'); 48620 this.pdfManager = pdfManager; 48621 this.stream = stream; 48622 this.xref = new XRef(stream, pdfManager); 48623 } 48624 function find(stream, needle, limit, backwards) { 48625 var pos = stream.pos; 48626 var end = stream.end; 48627 var strBuf = []; 48628 if (pos + limit > end) { 48629 limit = end - pos; 48630 } 48631 for (var n = 0; n < limit; ++n) { 48632 strBuf.push(String.fromCharCode(stream.getByte())); 48633 } 48634 var str = strBuf.join(''); 48635 stream.pos = pos; 48636 var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle); 48637 if (index === -1) { 48638 return false; 48639 } 48640 stream.pos += index; 48641 return true; 48642 } 48643 var DocumentInfoValidators = { 48644 get entries() { 48645 return shadow(this, 'entries', { 48646 Title: isString, 48647 Author: isString, 48648 Subject: isString, 48649 Keywords: isString, 48650 Creator: isString, 48651 Producer: isString, 48652 CreationDate: isString, 48653 ModDate: isString, 48654 Trapped: isName 48655 }); 48656 } 48657 }; 48658 PDFDocument.prototype = { 48659 parse: function PDFDocument_parse(recoveryMode) { 48660 this.setup(recoveryMode); 48661 var version = this.catalog.catDict.get('Version'); 48662 if (isName(version)) { 48663 this.pdfFormatVersion = version.name; 48664 }
48665 try { 48666 this.acroForm = this.catalog.catDict.get('AcroForm'); 48667 if (this.acroForm) { 48668 this.xfa = this.acroForm.get('XFA'); 48669 var fields = this.acroForm.get('Fields'); 48670 if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) { 48671 this.acroForm = null; 48672 } 48673 } 48674 } catch (ex) { 48675 info('Something wrong with AcroForm entry'); 48676 this.acroForm = null; 48677 } 48678 }, 48679 get linearization() { 48680 var linearization = null; 48681 if (this.stream.length) { 48682 try { 48683 linearization = Linearization.create(this.stream); 48684 } catch (err) { 48685 if (err instanceof MissingDataException) { 48686 throw err; 48687 } 48688 info(err); 48689 } 48690 } 48691 return shadow(this, 'linearization', linearization); 48692 }, 48693 get startXRef() { 48694 var stream = this.stream; 48695 var startXRef = 0; 48696 var linearization = this.linearization; 48697 if (linearization) { 48698 stream.reset(); 48699 if (find(stream, 'endobj', 1024)) { 48700 startXRef = stream.pos + 6; 48701 } 48702 } else { 48703 var step = 1024; 48704 var found = false, pos = stream.end; 48705 while (!found && pos > 0) { 48706 pos -= step - 'startxref'.length; 48707 if (pos < 0) { 48708 pos = 0; 48709 } 48710 stream.pos = pos; 48711 found = find(stream, 'startxref', step, true); 48712 } 48713 if (found) { 48714 stream.skip(9); 48715 var ch; 48716 do { 48717 ch = stream.getByte(); 48718 } while (isSpace(ch)); 48719 var str = ''; 48720 while (ch >= 0x20 && ch <= 0x39) { 48721 str += String.fromCharCode(ch); 48722 ch = stream.getByte(); 48723 } 48724 startXRef = parseInt(str, 10); 48725 if (isNaN(startXRef)) { 48726 startXRef = 0; 48727 } 48728 } 48729 } 48730 return shadow(this, 'startXRef', startXRef); 48731 }, 48732 get mainXRefEntriesOffset() { 48733 var mainXRefEntriesOffset = 0; 48734 var linearization = this.linearization; 48735 if (linearization) { 48736 mainXRefEntriesOffset = linearization.mainXRefEntriesOffset; 48737 } 48738 return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset); 48739 }, 48740 checkHeader: function PDFDocument_checkHeader() { 48741 var stream = this.stream; 48742 stream.reset(); 48743 if (find(stream, '%PDF-', 1024)) { 48744 stream.moveStart(); 48745 var MAX_VERSION_LENGTH = 12; 48746 var version = '', ch; 48747 while ((ch = stream.getByte()) > 0x20) { 48748 if (version.length >= MAX_VERSION_LENGTH) { 48749 break; 48750 } 48751 version += String.fromCharCode(ch); 48752 } 48753 if (!this.pdfFormatVersion) { 48754 this.pdfFormatVersion = version.substring(5); 48755 } 48756 return; 48757 } 48758 }, 48759 parseStartXRef: function PDFDocument_parseStartXRef() { 48760 var startXRef = this.startXRef; 48761 this.xref.setStartXRef(startXRef); 48762 }, 48763 setup: function PDFDocument_setup(recoveryMode) { 48764 this.xref.parse(recoveryMode); 48765 var self = this; 48766 var pageFactory = { 48767 createPage: function (pageIndex, dict, ref, fontCache) { 48768 return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache); 48769 } 48770 }; 48771 this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory); 48772 }, 48773 get numPages() { 48774 var linearization = this.linearization; 48775 var num = linearization ? linearization.numPages : this.catalog.numPages; 48776 return shadow(this, 'numPages', num); 48777 }, 48778 get documentInfo() { 48779 var docInfo = { 48780 PDFFormatVersion: this.pdfFormatVersion, 48781 IsAcroFormPresent: !!this.acroForm, 48782 IsXFAPresent: !!this.xfa 48783 }; 48784 var infoDict; 48785 try { 48786 infoDict = this.xref.trailer.get('Info'); 48787 } catch (err) {
48788 info('The document information dictionary is invalid.'); 48789 } 48790 if (infoDict) { 48791 var validEntries = DocumentInfoValidators.entries; 48792 for (var key in validEntries) { 48793 if (infoDict.has(key)) { 48794 var value = infoDict.get(key); 48795 if (validEntries[key](value)) { 48796 docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value); 48797 } else { 48798 info('Bad value in document info for "' + key + '"'); 48799 } 48800 } 48801 } 48802 } 48803 return shadow(this, 'documentInfo', docInfo); 48804 }, 48805 get fingerprint() { 48806 var xref = this.xref, hash, fileID = ''; 48807 var idArray = xref.trailer.get('ID'); 48808 if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) { 48809 hash = stringToBytes(idArray[0]); 48810 } else { 48811 if (this.stream.ensureRange) { 48812 this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end)); 48813 } 48814 hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 48815 } 48816 for (var i = 0, n = hash.length; i < n; i++) { 48817 var hex = hash[i].toString(16); 48818 fileID += hex.length === 1 ? '0' + hex : hex; 48819 } 48820 return shadow(this, 'fingerprint', fileID); 48821 }, 48822 getPage: function PDFDocument_getPage(pageIndex) { 48823 return this.catalog.getPage(pageIndex); 48824 }, 48825 cleanup: function PDFDocument_cleanup() { 48826 return this.catalog.cleanup(); 48827 } 48828 }; 48829 return PDFDocument; 48830 }(); 48831 exports.Page = Page; 48832 exports.PDFDocument = PDFDocument; 48833 })); 48834 (function (root, factory) { 48835 factory(root.pdfjsCorePdfManager = {}, root.pdfjsSharedUtil, root.pdfjsCoreStream, root.pdfjsCoreChunkedStream, root.pdfjsCoreDocument); 48836 }(this, function (exports, sharedUtil, coreStream, coreChunkedStream, coreDocument) { 48837 var warn = sharedUtil.warn; 48838 var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl; 48839 var shadow = sharedUtil.shadow; 48840 var NotImplementedException = sharedUtil.NotImplementedException; 48841 var MissingDataException = sharedUtil.MissingDataException; 48842 var createPromiseCapability = sharedUtil.createPromiseCapability; 48843 var Util = sharedUtil.Util; 48844 var Stream = coreStream.Stream; 48845 var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager; 48846 var PDFDocument = coreDocument.PDFDocument; 48847 var BasePdfManager = function BasePdfManagerClosure() { 48848 function BasePdfManager() { 48849 throw new Error('Cannot initialize BaseManagerManager'); 48850 } 48851 BasePdfManager.prototype = { 48852 get docId() { 48853 return this._docId; 48854 }, 48855 get password() { 48856 return this._password; 48857 }, 48858 get docBaseUrl() { 48859 var docBaseUrl = null; 48860 if (this._docBaseUrl) { 48861 var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl); 48862 if (absoluteUrl) { 48863 docBaseUrl = absoluteUrl.href; 48864 } else { 48865 warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".'); 48866 } 48867 } 48868 return shadow(this, 'docBaseUrl', docBaseUrl); 48869 }, 48870 onLoadedStream: function BasePdfManager_onLoadedStream() { 48871 throw new NotImplementedException(); 48872 }, 48873 ensureDoc: function BasePdfManager_ensureDoc(prop, args) { 48874 return this.ensure(this.pdfDocument, prop, args); 48875 }, 48876 ensureXRef: function BasePdfManager_ensureXRef(prop, args) { 48877 return this.ensure(this.pdfDocument.xref, prop, args); 48878 }, 48879 ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) { 48880 return this.ensure(this.pdfDocument.catalog, prop, args); 48881 }, 48882 getPage: function BasePdfManager_getPage(pageIndex) { 48883 return this.pdfDocument.getPage(pageIndex); 48884 }, 48885 cleanup: function BasePdfManager_cleanup() { 48886 return this.pdfDocument.cleanup(); 48887 }, 48888 ensure: function BasePdfManager_ensure(obj, prop, args) { 48889 return new NotImplementedException(); 48890 }, 48891 requestRange: function BasePdfManager_requestRange(begin, end) { 48892 return new NotImplementedException(); 48893 }, 48894 requestLoadedStream: function BasePdfManager_requestLoadedStream() { 48895 return new NotImplementedException(); 48896 }, 48897 sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) { 48898 return new NotImplementedException(); 48899 }, 48900 updatePassword: function BasePdfManager_updatePassword(password) { 48901 this._password = password; 48902 }, 48903 terminate: function BasePdfManager_terminate() { 48904 return new NotImplementedException(); 48905 } 48906 }; 48907 return BasePdfManager; 48908 }(); 48909 var LocalPdfManager = function LocalPdfManagerClosure() { 48910 function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) { 48911 this._docId = docId; 48912 this._password = password; 48913 this._docBaseUrl = docBaseUrl; 48914 this.evaluatorOptions = evaluatorOptions; 48915 var stream = new Stream(data); 48916 this.pdfDocument = new PDFDocument(this, stream); 48917 this._loadedStreamCapability = createPromiseCapability(); 48918 this._loadedStreamCapability.resolve(stream); 48919 } 48920 Util.inherit(LocalPdfManager, BasePdfManager, { 48921 ensure: function LocalPdfManager_ensure(obj, prop, args) { 48922 return new Promise(function (resolve, reject) { 48923 try { 48924 var value = obj[prop]; 48925 var result; 48926 if (typeof value === 'function') {
48927 result = value.apply(obj, args); 48928 } else { 48929 result = value; 48930 } 48931 resolve(result); 48932 } catch (e) { 48933 reject(e); 48934 } 48935 }); 48936 }, 48937 requestRange: function LocalPdfManager_requestRange(begin, end) { 48938 return Promise.resolve(); 48939 }, 48940 requestLoadedStream: function LocalPdfManager_requestLoadedStream() { 48941 }, 48942 onLoadedStream: function LocalPdfManager_onLoadedStream() { 48943 return this._loadedStreamCapability.promise; 48944 }, 48945 terminate: function LocalPdfManager_terminate() { 48946 } 48947 }); 48948 return LocalPdfManager; 48949 }(); 48950 var NetworkPdfManager = function NetworkPdfManagerClosure() { 48951 function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) { 48952 this._docId = docId; 48953 this._password = args.password; 48954 this._docBaseUrl = docBaseUrl; 48955 this.msgHandler = args.msgHandler; 48956 this.evaluatorOptions = evaluatorOptions; 48957 var params = { 48958 msgHandler: args.msgHandler, 48959 url: args.url, 48960 length: args.length, 48961 disableAutoFetch: args.disableAutoFetch, 48962 rangeChunkSize: args.rangeChunkSize 48963 }; 48964 this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params); 48965 this.pdfDocument = new PDFDocument(this, this.streamManager.getStream()); 48966 } 48967 Util.inherit(NetworkPdfManager, BasePdfManager, { 48968 ensure: function NetworkPdfManager_ensure(obj, prop, args) { 48969 var pdfManager = this; 48970 return new Promise(function (resolve, reject) { 48971 function ensureHelper() { 48972 try { 48973 var result; 48974 var value = obj[prop]; 48975 if (typeof value === 'function') { 48976 result = value.apply(obj, args); 48977 } else { 48978 result = value; 48979 } 48980 resolve(result); 48981 } catch (e) { 48982 if (!(e instanceof MissingDataException)) { 48983 reject(e); 48984 return; 48985 } 48986 pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject); 48987 } 48988 } 48989 ensureHelper(); 48990 }); 48991 }, 48992 requestRange: function NetworkPdfManager_requestRange(begin, end) { 48993 return this.streamManager.requestRange(begin, end); 48994 }, 48995 requestLoadedStream: function NetworkPdfManager_requestLoadedStream() { 48996 this.streamManager.requestAllChunks(); 48997 }, 48998 sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) { 48999 this.streamManager.onReceiveData({ chunk: chunk }); 49000 }, 49001 onLoadedStream: function NetworkPdfManager_onLoadedStream() { 49002 return this.streamManager.onLoadedStream(); 49003 }, 49004 terminate: function NetworkPdfManager_terminate() { 49005 this.streamManager.abort(); 49006 } 49007 }); 49008 return NetworkPdfManager; 49009 }(); 49010 exports.LocalPdfManager = LocalPdfManager; 49011 exports.NetworkPdfManager = NetworkPdfManager; 49012 })); 49013 (function (root, factory) { 49014 factory(root.pdfjsCoreWorker = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCorePdfManager); 49015 }(this, function (exports, sharedUtil, corePrimitives, corePdfManager) { 49016 var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES; 49017 var InvalidPDFException = sharedUtil.InvalidPDFException; 49018 var MessageHandler = sharedUtil.MessageHandler; 49019 var MissingPDFException = sharedUtil.MissingPDFException; 49020 var UnexpectedResponseException = sharedUtil.UnexpectedResponseException; 49021 var PasswordException = sharedUtil.PasswordException; 49022 var UnknownErrorException = sharedUtil.UnknownErrorException; 49023 var XRefParseException = sharedUtil.XRefParseException; 49024 var arrayByteLength = sharedUtil.arrayByteLength; 49025 var arraysToBytes = sharedUtil.arraysToBytes; 49026 var assert = sharedUtil.assert; 49027 var createPromiseCapability = sharedUtil.createPromiseCapability; 49028 var error = sharedUtil.error; 49029 var info = sharedUtil.info; 49030 var warn = sharedUtil.warn; 49031 var setVerbosityLevel = sharedUtil.setVerbosityLevel; 49032 var Ref = corePrimitives.Ref; 49033 var LocalPdfManager = corePdfManager.LocalPdfManager; 49034 var NetworkPdfManager = corePdfManager.NetworkPdfManager; 49035 var globalScope = sharedUtil.globalScope; 49036 var WorkerTask = function WorkerTaskClosure() { 49037 function WorkerTask(name) { 49038 this.name = name; 49039 this.terminated = false;
49040 this._capability = createPromiseCapability(); 49041 } 49042 WorkerTask.prototype = { 49043 get finished() { 49044 return this._capability.promise; 49045 }, 49046 finish: function () { 49047 this._capability.resolve(); 49048 }, 49049 terminate: function () { 49050 this.terminated = true; 49051 }, 49052 ensureNotTerminated: function () { 49053 if (this.terminated) { 49054 throw new Error('Worker task was terminated'); 49055 } 49056 } 49057 }; 49058 return WorkerTask; 49059 }(); 49060 var PDFWorkerStream = function PDFWorkerStreamClosure() { 49061 function PDFWorkerStream(params, msgHandler) { 49062 this._queuedChunks = []; 49063 var initialData = params.initialData; 49064 if (initialData && initialData.length > 0) { 49065 this._queuedChunks.push(initialData); 49066 } 49067 this._msgHandler = msgHandler; 49068 this._isRangeSupported = !params.disableRange; 49069 this._isStreamingSupported = !params.disableStream; 49070 this._contentLength = params.length; 49071 this._fullRequestReader = null; 49072 this._rangeReaders = []; 49073 msgHandler.on('OnDataRange', this._onReceiveData.bind(this)); 49074 msgHandler.on('OnDataProgress', this._onProgress.bind(this)); 49075 } 49076 PDFWorkerStream.prototype = { 49077 _onReceiveData: function PDFWorkerStream_onReceiveData(args) { 49078 if (args.begin === undefined) { 49079 if (this._fullRequestReader) { 49080 this._fullRequestReader._enqueue(args.chunk); 49081 } else { 49082 this._queuedChunks.push(args.chunk); 49083 } 49084 } else { 49085 var found = this._rangeReaders.some(function (rangeReader) { 49086 if (rangeReader._begin !== args.begin) { 49087 return false; 49088 } 49089 rangeReader._enqueue(args.chunk); 49090 return true; 49091 }); 49092 assert(found); 49093 } 49094 }, 49095 _onProgress: function PDFWorkerStream_onProgress(evt) { 49096 if (this._rangeReaders.length > 0) { 49097 var firstReader = this._rangeReaders[0]; 49098 if (firstReader.onProgress) { 49099 firstReader.onProgress({ loaded: evt.loaded }); 49100 } 49101 } 49102 }, 49103 _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) { 49104 var i = this._rangeReaders.indexOf(reader); 49105 if (i >= 0) { 49106 this._rangeReaders.splice(i, 1); 49107 } 49108 }, 49109 getFullReader: function PDFWorkerStream_getFullReader() { 49110 assert(!this._fullRequestReader); 49111 var queuedChunks = this._queuedChunks; 49112 this._queuedChunks = null; 49113 return new PDFWorkerStreamReader(this, queuedChunks); 49114 }, 49115 getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) { 49116 var reader = new PDFWorkerStreamRangeReader(this, begin, end); 49117 this._msgHandler.send('RequestDataRange', { 49118 begin: begin, 49119 end: end 49120 }); 49121 this._rangeReaders.push(reader); 49122 return reader; 49123 }, 49124 cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) { 49125 if (this._fullRequestReader) { 49126 this._fullRequestReader.cancel(reason); 49127 } 49128 var readers = this._rangeReaders.slice(0); 49129 readers.forEach(function (rangeReader) { 49130 rangeReader.cancel(reason); 49131 }); 49132 } 49133 }; 49134 function PDFWorkerStreamReader(stream, queuedChunks) { 49135 this._stream = stream; 49136 this._done = false; 49137 this._queuedChunks = queuedChunks || []; 49138 this._requests = []; 49139 this._headersReady = Promise.resolve(); 49140 stream._fullRequestReader = this; 49141 this.onProgress = null; 49142 } 49143 PDFWorkerStreamReader.prototype = { 49144 _enqueue: function PDFWorkerStreamReader_enqueue(chunk) { 49145 if (this._done) { 49146 return; 49147 } 49148 if (this._requests.length > 0) { 49149 var requestCapability = this._requests.shift(); 49150 requestCapability.resolve({ 49151 value: chunk, 49152 done: false 49153 }); 49154 return; 49155 } 49156 this._queuedChunks.push(chunk); 49157 }, 49158 get headersReady() { 49159 return this._headersReady; 49160 }, 49161 get isRangeSupported() { 49162 return this._stream._isRangeSupported; 49163 }, 49164 get isStreamingSupported() { 49165 return this._stream._isStreamingSupported; 49166 }, 49167 get contentLength() { 49168 return this._stream._contentLength; 49169 }, 49170 read: function PDFWorkerStreamReader_read() { 49171 if (this._queuedChunks.length > 0) { 49172 var chunk = this._queuedChunks.shift(); 49173 return Promise.resolve({ 49174 value: chunk, 49175 done: false 49176 }); 49177 } 49178 if (this._done) { 49179 return Promise.resolve({ 49180 value: undefined, 49181 done: true 49182 }); 49183 } 49184 var requestCapability = createPromiseCapability(); 49185 this._requests.push(requestCapability); 49186 return requestCapability.promise; 49187 },
49188 cancel: function PDFWorkerStreamReader_cancel(reason) { 49189 this._done = true; 49190 this._requests.forEach(function (requestCapability) { 49191 requestCapability.resolve({ 49192 value: undefined, 49193 done: true 49194 }); 49195 }); 49196 this._requests = []; 49197 } 49198 }; 49199 function PDFWorkerStreamRangeReader(stream, begin, end) { 49200 this._stream = stream; 49201 this._begin = begin; 49202 this._end = end; 49203 this._queuedChunk = null; 49204 this._requests = []; 49205 this._done = false; 49206 this.onProgress = null; 49207 } 49208 PDFWorkerStreamRangeReader.prototype = { 49209 _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) { 49210 if (this._done) { 49211 return; 49212 } 49213 if (this._requests.length === 0) { 49214 this._queuedChunk = chunk; 49215 } else { 49216 var requestsCapability = this._requests.shift(); 49217 requestsCapability.resolve({ 49218 value: chunk, 49219 done: false 49220 }); 49221 this._requests.forEach(function (requestCapability) { 49222 requestCapability.resolve({ 49223 value: undefined, 49224 done: true 49225 }); 49226 }); 49227 this._requests = []; 49228 } 49229 this._done = true; 49230 this._stream._removeRangeReader(this); 49231 }, 49232 get isStreamingSupported() { 49233 return false; 49234 }, 49235 read: function PDFWorkerStreamRangeReader_read() { 49236 if (this._queuedChunk) { 49237 return Promise.resolve({ 49238 value: this._queuedChunk, 49239 done: false 49240 }); 49241 } 49242 if (this._done) { 49243 return Promise.resolve({ 49244 value: undefined, 49245 done: true 49246 }); 49247 } 49248 var requestCapability = createPromiseCapability(); 49249 this._requests.push(requestCapability); 49250 return requestCapability.promise; 49251 }, 49252 cancel: function PDFWorkerStreamRangeReader_cancel(reason) { 49253 this._done = true; 49254 this._requests.forEach(function (requestCapability) { 49255 requestCapability.resolve({ 49256 value: undefined, 49257 done: true 49258 }); 49259 }); 49260 this._requests = []; 49261 this._stream._removeRangeReader(this); 49262 } 49263 }; 49264 return PDFWorkerStream; 49265 }(); 49266 var PDFNetworkStream; 49267 function setPDFNetworkStreamClass(cls) { 49268 PDFNetworkStream = cls; 49269 } 49270 var WorkerMessageHandler = { 49271 setup: function wphSetup(handler, port) { 49272 var testMessageProcessed = false; 49273 handler.on('test', function wphSetupTest(data) { 49274 if (testMessageProcessed) { 49275 return; 49276 } 49277 testMessageProcessed = true; 49278 if (!(data instanceof Uint8Array)) { 49279 handler.send('test', 'main', false); 49280 return; 49281 } 49282 var supportTransfers = data[0] === 255; 49283 handler.postMessageTransfers = supportTransfers; 49284 var xhr = new XMLHttpRequest(); 49285 var responseExists = 'response' in xhr; 49286 try { 49287 xhr.responseType; 49288 } catch (e) { 49289 responseExists = false; 49290 } 49291 if (!responseExists) { 49292 handler.send('test', false); 49293 return; 49294 } 49295 handler.send('test', { 49296 supportTypedArray: true, 49297 supportTransfers: supportTransfers 49298 }); 49299 }); 49300 handler.on('configure', function wphConfigure(data) { 49301 setVerbosityLevel(data.verbosity); 49302 }); 49303 handler.on('GetDocRequest', function wphSetupDoc(data) { 49304 return WorkerMessageHandler.createDocumentHandler(data, port); 49305 }); 49306 }, 49307 createDocumentHandler: function wphCreateDocumentHandler(docParams, port) { 49308 var pdfManager; 49309 var terminated = false; 49310 var cancelXHRs = null; 49311 var WorkerTasks = []; 49312 var docId = docParams.docId; 49313 var docBaseUrl = docParams.docBaseUrl; 49314 var workerHandlerName = docParams.docId + '_worker'; 49315 var handler = new MessageHandler(workerHandlerName, docId, port); 49316 handler.postMessageTransfers = docParams.postMessageTransfers; 49317 function ensureNotTerminated() { 49318 if (terminated) { 49319 throw new Error('Worker was terminated'); 49320 } 49321 } 49322 function startWorkerTask(task) { 49323 WorkerTasks.push(task); 49324 } 49325 function finishWorkerTask(task) { 49326 task.finish(); 49327 var i = WorkerTasks.indexOf(task); 49328 WorkerTasks.splice(i, 1); 49329 } 49330 function loadDocument(recoveryMode) { 49331 var loadDocumentCapability = createPromiseCapability(); 49332 var parseSuccess = function parseSuccess() { 49333 var numPagesPromise = pdfManager.ensureDoc('numPages'); 49334 var fingerprintPromise = pdfManager.ensureDoc('fingerprint'); 49335 var encryptedPromise = pdfManager.ensureXRef('encrypt'); 49336 Promise.all([ 49337 numPagesPromise, 49338 fingerprintPromise, 49339 encryptedPromise 49340 ]).then(function onDocReady(results) { 49341 var doc = { 49342 numPages: results[0], 49343 fingerprint: results[1], 49344 encrypted: !!results[2] 49345 }; 49346 loadDocumentCapability.resolve(doc); 49347 }, parseFailure); 49348 }; 49349 var parseFailure = function parseFailure(e) { 49350 loadDocumentCapability.reject(e); 49351 }; 49352 pdfManager.ensureDoc('checkHeader', []).then(function () { 49353 pdfManager.ensureDoc('parseStartXRef', []).then(function () { 49354 pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure); 49355 }, parseFailure); 49356 }, parseFailure); 49357 return loadDocumentCapability.promise; 49358 } 49359 function getPdfManager(data, evaluatorOptions) { 49360 var pdfManagerCapability = createPromiseCapability(); 49361 var pdfManager; 49362 var source = data.source; 49363 if (source.data) { 49364 try { 49365 pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl); 49366 pdfManagerCapability.resolve(pdfManager); 49367 } catch (ex) { 49368 pdfManagerCapability.reject(ex); 49369 } 49370 return pdfManagerCapability.promise; 49371 } 49372 var pdfStream;
49373 try { 49374 if (source.chunkedViewerLoading) { 49375 pdfStream = new PDFWorkerStream(source, handler); 49376 } else { 49377 assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded'); 49378 pdfStream = new PDFNetworkStream(data); 49379 } 49380 } catch (ex) { 49381 pdfManagerCapability.reject(ex); 49382 return pdfManagerCapability.promise; 49383 } 49384 var fullRequest = pdfStream.getFullReader(); 49385 fullRequest.headersReady.then(function () { 49386 if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) { 49387 fullRequest.onProgress = function (evt) { 49388 handler.send('DocProgress', { 49389 loaded: evt.loaded, 49390 total: evt.total 49391 }); 49392 }; 49393 } 49394 if (!fullRequest.isRangeSupported) { 49395 return; 49396 } 49397 var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; 49398 pdfManager = new NetworkPdfManager(docId, pdfStream, { 49399 msgHandler: handler, 49400 url: source.url, 49401 password: source.password, 49402 length: fullRequest.contentLength, 49403 disableAutoFetch: disableAutoFetch, 49404 rangeChunkSize: source.rangeChunkSize 49405 }, evaluatorOptions, docBaseUrl); 49406 pdfManagerCapability.resolve(pdfManager); 49407 cancelXHRs = null; 49408 }).catch(function (reason) { 49409 pdfManagerCapability.reject(reason); 49410 cancelXHRs = null; 49411 }); 49412 var cachedChunks = [], loaded = 0; 49413 var flushChunks = function () { 49414 var pdfFile = arraysToBytes(cachedChunks); 49415 if (source.length && pdfFile.length !== source.length) { 49416 warn('reported HTTP length is different from actual'); 49417 } 49418 try { 49419 pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl); 49420 pdfManagerCapability.resolve(pdfManager); 49421 } catch (ex) { 49422 pdfManagerCapability.reject(ex); 49423 } 49424 cachedChunks = []; 49425 }; 49426 var readPromise = new Promise(function (resolve, reject) { 49427 var readChunk = function (chunk) { 49428 try { 49429 ensureNotTerminated(); 49430 if (chunk.done) { 49431 if (!pdfManager) { 49432 flushChunks(); 49433 } 49434 cancelXHRs = null; 49435 return; 49436 } 49437 var data = chunk.value; 49438 loaded += arrayByteLength(data); 49439 if (!fullRequest.isStreamingSupported) { 49440 handler.send('DocProgress', { 49441 loaded: loaded, 49442 total: Math.max(loaded, fullRequest.contentLength || 0) 49443 }); 49444 } 49445 if (pdfManager) { 49446 pdfManager.sendProgressiveData(data); 49447 } else { 49448 cachedChunks.push(data); 49449 } 49450 fullRequest.read().then(readChunk, reject); 49451 } catch (e) { 49452 reject(e); 49453 } 49454 }; 49455 fullRequest.read().then(readChunk, reject); 49456 }); 49457 readPromise.catch(function (e) { 49458 pdfManagerCapability.reject(e); 49459 cancelXHRs = null; 49460 }); 49461 cancelXHRs = function () { 49462 pdfStream.cancelAllRequests('abort'); 49463 }; 49464 return pdfManagerCapability.promise; 49465 } 49466 function setupDoc(data) { 49467 function onSuccess(doc) { 49468 ensureNotTerminated(); 49469 handler.send('GetDoc', { pdfInfo: doc }); 49470 } 49471 function onFailure(e) { 49472 if (e instanceof PasswordException) { 49473 var task = new WorkerTask('PasswordException: response ' + e.code); 49474 startWorkerTask(task); 49475 handler.sendWithPromise('PasswordRequest', e).then(function (data) { 49476 finishWorkerTask(task); 49477 pdfManager.updatePassword(data.password); 49478 pdfManagerReady(); 49479 }).catch(function (ex) { 49480 finishWorkerTask(task); 49481 handler.send('PasswordException', ex); 49482 }.bind(null, e)); 49483 } else if (e instanceof InvalidPDFException) { 49484 handler.send('InvalidPDF', e); 49485 } else if (e instanceof MissingPDFException) { 49486 handler.send('MissingPDF', e); 49487 } else if (e instanceof UnexpectedResponseException) { 49488 handler.send('UnexpectedResponse', e); 49489 } else { 49490 handler.send('UnknownError', new UnknownErrorException(e.message, e.toString())); 49491 } 49492 } 49493 function pdfManagerReady() { 49494 ensureNotTerminated(); 49495 loadDocument(false).then(onSuccess, function loadFailure(ex) { 49496 ensureNotTerminated(); 49497 if (!(ex instanceof XRefParseException)) { 49498 onFailure(ex); 49499 return; 49500 } 49501 pdfManager.requestLoadedStream(); 49502 pdfManager.onLoadedStream().then(function () { 49503 ensureNotTerminated();
49504 loadDocument(true).then(onSuccess, onFailure); 49505 }); 49506 }, onFailure); 49507 } 49508 ensureNotTerminated(); 49509 var cMapOptions = { 49510 url: data.cMapUrl === undefined ? null : data.cMapUrl, 49511 packed: data.cMapPacked === true 49512 }; 49513 var evaluatorOptions = { 49514 forceDataSchema: data.disableCreateObjectURL, 49515 maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize, 49516 disableFontFace: data.disableFontFace, 49517 cMapOptions: cMapOptions 49518 }; 49519 getPdfManager(data, evaluatorOptions).then(function (newPdfManager) { 49520 if (terminated) { 49521 newPdfManager.terminate(); 49522 throw new Error('Worker was terminated'); 49523 } 49524 pdfManager = newPdfManager; 49525 handler.send('PDFManagerReady', null); 49526 pdfManager.onLoadedStream().then(function (stream) { 49527 handler.send('DataLoaded', { length: stream.bytes.byteLength }); 49528 }); 49529 }).then(pdfManagerReady, onFailure); 49530 } 49531 handler.on('GetPage', function wphSetupGetPage(data) { 49532 return pdfManager.getPage(data.pageIndex).then(function (page) { 49533 var rotatePromise = pdfManager.ensure(page, 'rotate'); 49534 var refPromise = pdfManager.ensure(page, 'ref'); 49535 var userUnitPromise = pdfManager.ensure(page, 'userUnit'); 49536 var viewPromise = pdfManager.ensure(page, 'view'); 49537 return Promise.all([ 49538 rotatePromise, 49539 refPromise, 49540 userUnitPromise, 49541 viewPromise 49542 ]).then(function (results) { 49543 return { 49544 rotate: results[0], 49545 ref: results[1], 49546 userUnit: results[2], 49547 view: results[3] 49548 }; 49549 }); 49550 }); 49551 }); 49552 handler.on('GetPageIndex', function wphSetupGetPageIndex(data) { 49553 var ref = new Ref(data.ref.num, data.ref.gen); 49554 var catalog = pdfManager.pdfDocument.catalog; 49555 return catalog.getPageIndex(ref); 49556 }); 49557 handler.on('GetDestinations', function wphSetupGetDestinations(data) { 49558 return pdfManager.ensureCatalog('destinations'); 49559 }); 49560 handler.on('GetDestination', function wphSetupGetDestination(data) { 49561 return pdfManager.ensureCatalog('getDestination', [data.id]); 49562 }); 49563 handler.on('GetPageLabels', function wphSetupGetPageLabels(data) { 49564 return pdfManager.ensureCatalog('pageLabels'); 49565 }); 49566 handler.on('GetAttachments', function wphSetupGetAttachments(data) { 49567 return pdfManager.ensureCatalog('attachments'); 49568 }); 49569 handler.on('GetJavaScript', function wphSetupGetJavaScript(data) { 49570 return pdfManager.ensureCatalog('javaScript'); 49571 }); 49572 handler.on('GetOutline', function wphSetupGetOutline(data) { 49573 return pdfManager.ensureCatalog('documentOutline'); 49574 }); 49575 handler.on('GetMetadata', function wphSetupGetMetadata(data) { 49576 return Promise.all([ 49577 pdfManager.ensureDoc('documentInfo'), 49578 pdfManager.ensureCatalog('metadata') 49579 ]); 49580 }); 49581 handler.on('GetData', function wphSetupGetData(data) { 49582 pdfManager.requestLoadedStream(); 49583 return pdfManager.onLoadedStream().then(function (stream) { 49584 return stream.bytes; 49585 }); 49586 }); 49587 handler.on('GetStats', function wphSetupGetStats(data) { 49588 return pdfManager.pdfDocument.xref.stats; 49589 }); 49590 handler.on('GetAnnotations', function wphSetupGetAnnotations(data) { 49591 return pdfManager.getPage(data.pageIndex).then(function (page) { 49592 return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]); 49593 }); 49594 }); 49595 handler.on('RenderPageRequest', function wphSetupRenderPage(data) { 49596 var pageIndex = data.pageIndex; 49597 pdfManager.getPage(pageIndex).then(function (page) { 49598 var task = new WorkerTask('RenderPageRequest: page ' + pageIndex); 49599 startWorkerTask(task); 49600 var pageNum = pageIndex + 1; 49601 var start = Date.now(); 49602 page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) { 49603 finishWorkerTask(task); 49604 info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength); 49605 }, function (e) { 49606 finishWorkerTask(task); 49607 if (task.terminated) { 49608 return; 49609 } 49610 handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown }); 49611 var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()'; 49612 var wrappedException; 49613 if (typeof e === 'string') { 49614 wrappedException = { 49615 message: e, 49616 stack: minimumStackMessage 49617 }; 49618 } else if (typeof e === 'object') { 49619 wrappedException = { 49620 message: e.message || e.toString(), 49621 stack: e.stack || minimumStackMessage 49622 }; 49623 } else { 49624 wrappedException = { 49625 message: 'Unknown exception type: ' + typeof e, 49626 stack: minimumStackMessage 49627 }; 49628 } 49629 handler.send('PageError', { 49630 pageNum: pageNum, 49631 error: wrappedException, 49632 intent: data.intent 49633 }); 49634 }); 49635 }); 49636 }, this); 49637 handler.on('GetTextContent', function wphExtractText(data) { 49638 var pageIndex = data.pageIndex; 49639 var normalizeWhitespace = data.normalizeWhitespace; 49640 var combineTextItems = data.combineTextItems; 49641 return pdfManager.getPage(pageIndex).then(function (page) { 49642 var task = new WorkerTask('GetTextContent: page ' + pageIndex); 49643 startWorkerTask(task); 49644 var pageNum = pageIndex + 1; 49645 var start = Date.now(); 49646 return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) { 49647 finishWorkerTask(task); 49648 info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms'); 49649 return textContent; 49650 }, function (reason) { 49651 finishWorkerTask(task); 49652 if (task.terminated) { 49653 return; 49654 } 49655 throw reason; 49656 }); 49657 }); 49658 }); 49659 handler.on('Cleanup', function wphCleanup(data) { 49660 return pdfManager.cleanup(); 49661 }); 49662 handler.on('Terminate', function wphTerminate(data) { 49663 terminated = true; 49664 if (pdfManager) { 49665 pdfManager.terminate(); 49666 pdfManager = null; 49667 } 49668 if (cancelXHRs) { 49669 cancelXHRs(); 49670 } 49671 var waitOn = []; 49672 WorkerTasks.forEach(function (task) { 49673 waitOn.push(task.finished); 49674 task.terminate(); 49675 }); 49676 return Promise.all(waitOn).then(function () { 49677 handler.destroy(); 49678 handler = null; 49679 }); 49680 }); 49681 handler.on('Ready', function wphReady(data) { 49682 setupDoc(docParams); 49683 docParams = null; 49684 }); 49685 return workerHandlerName; 49686 } 49687 }; 49688 function initializeWorker() { 49689 if (!('console' in globalScope)) { 49690 var consoleTimer = {}; 49691 var workerConsole = { 49692 log: function log() { 49693 var args = Array.prototype.slice.call(arguments); 49694 globalScope.postMessage({ 49695 targetName: 'main', 49696 action: 'console_log', 49697 data: args 49698 }); 49699 }, 49700 error: function error() { 49701 var args = Array.prototype.slice.call(arguments); 49702 globalScope.postMessage({ 49703 targetName: 'main', 49704 action: 'console_error', 49705 data: args 49706 }); 49707 throw 'pdf.js execution error'; 49708 }, 49709 time: function time(name) { 49710 consoleTimer[name] = Date.now(); 49711 }, 49712 timeEnd: function timeEnd(name) { 49713 var time = consoleTimer[name]; 49714 if (!time) { 49715 error('Unknown timer name ' + name); 49716 } 49717 this.log('Timer:', name, Date.now() - time); 49718 } 49719 }; 49720 globalScope.console = workerConsole; 49721 } 49722 var handler = new MessageHandler('worker', 'main', self); 49723 WorkerMessageHandler.setup(handler, self); 49724 handler.send('ready', null); 49725 } 49726 if (typeof window === 'undefined' && !(typeof module !== 'undefined' && module.require)) { 49727 initializeWorker(); 49728 } 49729 exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass; 49730 exports.WorkerTask = WorkerTask; 49731 exports.WorkerMessageHandler = WorkerMessageHandler; 49732 })); 49733 (function (root, factory) { 49734 factory(root.pdfjsCoreNetwork = {}, root.pdfjsSharedUtil, root.pdfjsCoreWorker); 49735 }(this, function (exports, sharedUtil, coreWorker) { 49736 var OK_RESPONSE = 200; 49737 var PARTIAL_CONTENT_RESPONSE = 206; 49738 function NetworkManager(url, args) { 49739 this.url = url; 49740 args = args || {}; 49741 this.isHttp = /^https?:/i.test(url); 49742 this.httpHeaders = this.isHttp && args.httpHeaders || {}; 49743 this.withCredentials = args.withCredentials || false; 49744 this.getXhr = args.getXhr || function NetworkManager_getXhr() { 49745 return new XMLHttpRequest(); 49746 }; 49747 this.currXhrId = 0; 49748 this.pendingRequests = Object.create(null); 49749 this.loadedRequests = Object.create(null); 49750 } 49751 function getArrayBuffer(xhr) { 49752 var data = xhr.response; 49753 if (typeof data !== 'string') { 49754 return data; 49755 } 49756 var length = data.length; 49757 var array = new Uint8Array(length); 49758 for (var i = 0; i < length; i++) { 49759 array[i] = data.charCodeAt(i) & 0xFF; 49760 } 49761 return array.buffer; 49762 }
49763 var supportsMozChunked = function supportsMozChunkedClosure() { 49764 try { 49765 var x = new XMLHttpRequest(); 49766 x.open('GET', 'https://example.com'); 49767 x.responseType = 'moz-chunked-arraybuffer'; 49768 return x.responseType === 'moz-chunked-arraybuffer'; 49769 } catch (e) { 49770 return false; 49771 } 49772 }(); 49773 NetworkManager.prototype = { 49774 requestRange: function NetworkManager_requestRange(begin, end, listeners) { 49775 var args = { 49776 begin: begin, 49777 end: end 49778 }; 49779 for (var prop in listeners) { 49780 args[prop] = listeners[prop]; 49781 } 49782 return this.request(args); 49783 }, 49784 requestFull: function NetworkManager_requestFull(listeners) { 49785 return this.request(listeners); 49786 }, 49787 request: function NetworkManager_request(args) { 49788 var xhr = this.getXhr(); 49789 var xhrId = this.currXhrId++; 49790 var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr }; 49791 xhr.open('GET', this.url); 49792 xhr.withCredentials = this.withCredentials; 49793 for (var property in this.httpHeaders) { 49794 var value = this.httpHeaders[property]; 49795 if (typeof value === 'undefined') { 49796 continue; 49797 } 49798 xhr.setRequestHeader(property, value); 49799 } 49800 if (this.isHttp && 'begin' in args && 'end' in args) { 49801 var rangeStr = args.begin + '-' + (args.end - 1); 49802 xhr.setRequestHeader('Range', 'bytes=' + rangeStr); 49803 pendingRequest.expectedStatus = 206; 49804 } else { 49805 pendingRequest.expectedStatus = 200; 49806 } 49807 var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData; 49808 if (useMozChunkedLoading) { 49809 xhr.responseType = 'moz-chunked-arraybuffer'; 49810 pendingRequest.onProgressiveData = args.onProgressiveData; 49811 pendingRequest.mozChunked = true; 49812 } else { 49813 xhr.responseType = 'arraybuffer'; 49814 } 49815 if (args.onError) { 49816 xhr.onerror = function (evt) { 49817 args.onError(xhr.status); 49818 }; 49819 } 49820 xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); 49821 xhr.onprogress = this.onProgress.bind(this, xhrId); 49822 pendingRequest.onHeadersReceived = args.onHeadersReceived; 49823 pendingRequest.onDone = args.onDone; 49824 pendingRequest.onError = args.onError; 49825 pendingRequest.onProgress = args.onProgress; 49826 xhr.send(null); 49827 return xhrId; 49828 }, 49829 onProgress: function NetworkManager_onProgress(xhrId, evt) { 49830 var pendingRequest = this.pendingRequests[xhrId]; 49831 if (!pendingRequest) { 49832 return; 49833 } 49834 if (pendingRequest.mozChunked) { 49835 var chunk = getArrayBuffer(pendingRequest.xhr); 49836 pendingRequest.onProgressiveData(chunk); 49837 } 49838 var onProgress = pendingRequest.onProgress; 49839 if (onProgress) { 49840 onProgress(evt); 49841 } 49842 }, 49843 onStateChange: function NetworkManager_onStateChange(xhrId, evt) { 49844 var pendingRequest = this.pendingRequests[xhrId]; 49845 if (!pendingRequest) { 49846 return; 49847 } 49848 var xhr = pendingRequest.xhr; 49849 if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { 49850 pendingRequest.onHeadersReceived(); 49851 delete pendingRequest.onHeadersReceived; 49852 } 49853 if (xhr.readyState !== 4) { 49854 return; 49855 } 49856 if (!(xhrId in this.pendingRequests)) { 49857 return; 49858 } 49859 delete this.pendingRequests[xhrId]; 49860 if (xhr.status === 0 && this.isHttp) { 49861 if (pendingRequest.onError) { 49862 pendingRequest.onError(xhr.status); 49863 } 49864 return; 49865 } 49866 var xhrStatus = xhr.status || OK_RESPONSE; 49867 var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; 49868 if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { 49869 if (pendingRequest.onError) { 49870 pendingRequest.onError(xhr.status); 49871 } 49872 return; 49873 } 49874 this.loadedRequests[xhrId] = true; 49875 var chunk = getArrayBuffer(xhr); 49876 if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { 49877 var rangeHeader = xhr.getResponseHeader('Content-Range'); 49878 var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); 49879 var begin = parseInt(matches[1], 10); 49880 pendingRequest.onDone({ 49881 begin: begin, 49882 chunk: chunk 49883 }); 49884 } else if (pendingRequest.onProgressiveData) { 49885 pendingRequest.onDone(null); 49886 } else if (chunk) { 49887 pendingRequest.onDone({ 49888 begin: 0, 49889 chunk: chunk 49890 }); 49891 } else if (pendingRequest.onError) { 49892 pendingRequest.onError(xhr.status); 49893 } 49894 }, 49895 hasPendingRequests: function NetworkManager_hasPendingRequests() { 49896 for (var xhrId in this.pendingRequests) { 49897 return true; 49898 } 49899 return false;
49900 }, 49901 getRequestXhr: function NetworkManager_getXhr(xhrId) { 49902 return this.pendingRequests[xhrId].xhr; 49903 }, 49904 isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) { 49905 return !!this.pendingRequests[xhrId].onProgressiveData; 49906 }, 49907 isPendingRequest: function NetworkManager_isPendingRequest(xhrId) { 49908 return xhrId in this.pendingRequests; 49909 }, 49910 isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) { 49911 return xhrId in this.loadedRequests; 49912 }, 49913 abortAllRequests: function NetworkManager_abortAllRequests() { 49914 for (var xhrId in this.pendingRequests) { 49915 this.abortRequest(xhrId | 0); 49916 } 49917 }, 49918 abortRequest: function NetworkManager_abortRequest(xhrId) { 49919 var xhr = this.pendingRequests[xhrId].xhr; 49920 delete this.pendingRequests[xhrId]; 49921 xhr.abort(); 49922 } 49923 }; 49924 var assert = sharedUtil.assert; 49925 var createPromiseCapability = sharedUtil.createPromiseCapability; 49926 var isInt = sharedUtil.isInt; 49927 var MissingPDFException = sharedUtil.MissingPDFException; 49928 var UnexpectedResponseException = sharedUtil.UnexpectedResponseException; 49929 function PDFNetworkStream(options) { 49930 this._options = options; 49931 var source = options.source; 49932 this._manager = new NetworkManager(source.url, { 49933 httpHeaders: source.httpHeaders, 49934 withCredentials: source.withCredentials 49935 }); 49936 this._rangeChunkSize = source.rangeChunkSize; 49937 this._fullRequestReader = null; 49938 this._rangeRequestReaders = []; 49939 } 49940 PDFNetworkStream.prototype = { 49941 _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) { 49942 var i = this._rangeRequestReaders.indexOf(reader); 49943 if (i >= 0) { 49944 this._rangeRequestReaders.splice(i, 1); 49945 } 49946 }, 49947 getFullReader: function PDFNetworkStream_getFullReader() { 49948 assert(!this._fullRequestReader); 49949 this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options); 49950 return this._fullRequestReader; 49951 }, 49952 getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) { 49953 var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); 49954 reader.onClosed = this._onRangeRequestReaderClosed.bind(this); 49955 this._rangeRequestReaders.push(reader); 49956 return reader; 49957 }, 49958 cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) { 49959 if (this._fullRequestReader) { 49960 this._fullRequestReader.cancel(reason); 49961 } 49962 var readers = this._rangeRequestReaders.slice(0); 49963 readers.forEach(function (reader) { 49964 reader.cancel(reason); 49965 }); 49966 } 49967 }; 49968 function PDFNetworkStreamFullRequestReader(manager, options) { 49969 this._manager = manager; 49970 var source = options.source; 49971 var args = { 49972 onHeadersReceived: this._onHeadersReceived.bind(this), 49973 onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this), 49974 onDone: this._onDone.bind(this), 49975 onError: this._onError.bind(this), 49976 onProgress: this._onProgress.bind(this) 49977 }; 49978 this._url = source.url; 49979 this._fullRequestId = manager.requestFull(args); 49980 this._headersReceivedCapability = createPromiseCapability(); 49981 this._disableRange = options.disableRange || false; 49982 this._contentLength = source.length; 49983 this._rangeChunkSize = source.rangeChunkSize; 49984 if (!this._rangeChunkSize && !this._disableRange) { 49985 this._disableRange = true; 49986 } 49987 this._isStreamingSupported = false; 49988 this._isRangeSupported = false; 49989 this._cachedChunks = []; 49990 this._requests = []; 49991 this._done = false; 49992 this._storedError = undefined; 49993 this.onProgress = null; 49994 } 49995 PDFNetworkStreamFullRequestReader.prototype = { 49996 _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() { 49997 if (this._disableRange) { 49998 return false; 49999 } 50000 var networkManager = this._manager; 50001 if (!networkManager.isHttp) { 50002 return false; 50003 } 50004 var fullRequestXhrId = this._fullRequestId; 50005 var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId); 50006 if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') { 50007 return false;
50008 } 50009 var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity'; 50010 if (contentEncoding !== 'identity') { 50011 return false; 50012 } 50013 var length = fullRequestXhr.getResponseHeader('Content-Length'); 50014 length = parseInt(length, 10); 50015 if (!isInt(length)) { 50016 return false; 50017 } 50018 this._contentLength = length; 50019 if (length <= 2 * this._rangeChunkSize) { 50020 return false; 50021 } 50022 return true; 50023 }, 50024 _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() { 50025 if (this._validateRangeRequestCapabilities()) { 50026 this._isRangeSupported = true; 50027 } 50028 var networkManager = this._manager; 50029 var fullRequestXhrId = this._fullRequestId; 50030 if (networkManager.isStreamingRequest(fullRequestXhrId)) { 50031 this._isStreamingSupported = true; 50032 } else if (this._isRangeSupported) { 50033 networkManager.abortRequest(fullRequestXhrId); 50034 } 50035 this._headersReceivedCapability.resolve(); 50036 }, 50037 _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) { 50038 if (this._requests.length > 0) { 50039 var requestCapability = this._requests.shift(); 50040 requestCapability.resolve({ 50041 value: chunk, 50042 done: false 50043 }); 50044 } else { 50045 this._cachedChunks.push(chunk); 50046 } 50047 }, 50048 _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) { 50049 if (args) { 50050 this._onProgressiveData(args.chunk); 50051 } 50052 this._done = true; 50053 if (this._cachedChunks.length > 0) { 50054 return; 50055 } 50056 this._requests.forEach(function (requestCapability) { 50057 requestCapability.resolve({ 50058 value: undefined, 50059 done: true 50060 }); 50061 }); 50062 this._requests = []; 50063 }, 50064 _onError: function PDFNetworkStreamFullRequestReader_onError(status) { 50065 var url = this._url; 50066 var exception; 50067 if (status === 404 || status === 0 && /^file:/.test(url)) { 50068 exception = new MissingPDFException('Missing PDF "' + url + '".'); 50069 } else { 50070 exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status); 50071 } 50072 this._storedError = exception; 50073 this._headersReceivedCapability.reject(exception); 50074 this._requests.forEach(function (requestCapability) { 50075 requestCapability.reject(exception); 50076 }); 50077 this._requests = []; 50078 this._cachedChunks = []; 50079 }, 50080 _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) { 50081 if (this.onProgress) { 50082 this.onProgress({ 50083 loaded: data.loaded, 50084 total: data.lengthComputable ? data.total : this._contentLength 50085 }); 50086 } 50087 }, 50088 get isRangeSupported() { 50089 return this._isRangeSupported; 50090 }, 50091 get isStreamingSupported() { 50092 return this._isStreamingSupported; 50093 }, 50094 get contentLength() { 50095 return this._contentLength; 50096 }, 50097 get headersReady() { 50098 return this._headersReceivedCapability.promise; 50099 }, 50100 read: function PDFNetworkStreamFullRequestReader_read() { 50101 if (this._storedError) { 50102 return Promise.reject(this._storedError); 50103 } 50104 if (this._cachedChunks.length > 0) { 50105 var chunk = this._cachedChunks.shift(); 50106 return Promise.resolve(chunk); 50107 } 50108 if (this._done) { 50109 return Promise.resolve({ 50110 value: undefined, 50111 done: true 50112 }); 50113 } 50114 var requestCapability = createPromiseCapability(); 50115 this._requests.push(requestCapability); 50116 return requestCapability.promise; 50117 }, 50118 cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) { 50119 this._done = true; 50120 this._headersReceivedCapability.reject(reason); 50121 this._requests.forEach(function (requestCapability) { 50122 requestCapability.resolve({ 50123 value: undefined, 50124 done: true 50125 }); 50126 }); 50127 this._requests = []; 50128 if (this._manager.isPendingRequest(this._fullRequestId)) { 50129 this._manager.abortRequest(this._fullRequestId); 50130 } 50131 this._fullRequestReader = null; 50132 } 50133 }; 50134 function PDFNetworkStreamRangeRequestReader(manager, begin, end) { 50135 this._manager = manager; 50136 var args = { 50137 onDone: this._onDone.bind(this), 50138 onProgress: this._onProgress.bind(this) 50139 }; 50140 this._requestId = manager.requestRange(begin, end, args); 50141 this._requests = []; 50142 this._queuedChunk = null; 50143 this._done = false;
50144 this.onProgress = null; 50145 this.onClosed = null; 50146 } 50147 PDFNetworkStreamRangeRequestReader.prototype = { 50148 _close: function PDFNetworkStreamRangeRequestReader_close() { 50149 if (this.onClosed) { 50150 this.onClosed(this); 50151 } 50152 }, 50153 _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) { 50154 var chunk = data.chunk; 50155 if (this._requests.length > 0) { 50156 var requestCapability = this._requests.shift(); 50157 requestCapability.resolve({ 50158 value: chunk, 50159 done: false 50160 }); 50161 } else { 50162 this._queuedChunk = chunk; 50163 } 50164 this._done = true; 50165 this._requests.forEach(function (requestCapability) { 50166 requestCapability.resolve({ 50167 value: undefined, 50168 done: true 50169 }); 50170 }); 50171 this._requests = []; 50172 this._close(); 50173 }, 50174 _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) { 50175 if (!this.isStreamingSupported && this.onProgress) { 50176 this.onProgress({ loaded: evt.loaded }); 50177 } 50178 }, 50179 get isStreamingSupported() { 50180 return false; 50181 }, 50182 read: function PDFNetworkStreamRangeRequestReader_read() { 50183 if (this._queuedChunk !== null) { 50184 var chunk = this._queuedChunk; 50185 this._queuedChunk = null; 50186 return Promise.resolve({ 50187 value: chunk, 50188 done: false 50189 }); 50190 } 50191 if (this._done) { 50192 return Promise.resolve({ 50193 value: undefined, 50194 done: true 50195 }); 50196 } 50197 var requestCapability = createPromiseCapability(); 50198 this._requests.push(requestCapability); 50199 return requestCapability.promise; 50200 }, 50201 cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) { 50202 this._done = true; 50203 this._requests.forEach(function (requestCapability) { 50204 requestCapability.resolve({ 50205 value: undefined, 50206 done: true 50207 }); 50208 }); 50209 this._requests = []; 50210 if (this._manager.isPendingRequest(this._requestId)) { 50211 this._manager.abortRequest(this._requestId); 50212 } 50213 this._close(); 50214 } 50215 }; 50216 coreWorker.setPDFNetworkStreamClass(PDFNetworkStream); 50217 exports.PDFNetworkStream = PDFNetworkStream; 50218 exports.NetworkManager = NetworkManager; 50219 })); 50220 }.call(pdfjsLibs)); 50221 exports.WorkerMessageHandler = pdfjsLibs.pdfjsCoreWorker.WorkerMessageHandler; 50222}));
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.