1/* Simple JavaScript Inheritance 2 * By John Resig http://ejohn.org/ 3 * MIT Licensed. 4 */(function(){var d=!1,g=/xyz/.test(function(){})?/\b_super\b/:/.*/;this.SimpleClass=function(){};SimpleClass.extend=function(b){function c(){!d&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;d=!0;var f=new this;d=!1;for(var a in b)f[a]=typeof b[a]=="function"&&typeof e[a]=="function"&&g.test(b[a])?function(a,b){return function(){var c=this._super;this._super=e[a];var d=b.apply(this,arguments);this._super=c;return d}}(a,b[a]):b[a];c.prototype=f;c.constructor=c;c.extend=arguments.callee; 5return c}})();; 6/*! PhotoSwipe Default UI - 4.1.2 - 2017-04-05 7* http://photoswipe.com 8* Copyright (c) 2017 Dmitry Semenov; */ 9/** 10* 11* UI on top of main sliding area (caption, arrows, close button, etc.). 12* Built just using public methods/properties of PhotoSwipe. 13* 14*/ 15(function (root, factory) { 16 if (typeof define === 'function' && define.amd) { 17 define(factory); 18 } else if (typeof exports === 'object') { 19 module.exports = factory(); 20 } else { 21 root.PhotoSwipeUI_BaT = factory(); 22 } 23})(this, function () { 24 25 'use strict'; 26 27 28 29var PhotoSwipeUI_BaT = 30 function(pswp, framework) { 31 32 var ui = this; 33 var _overlayUIUpdated = false, 34 _controlsVisible = true, 35 _fullscrenAPI, 36 _controls, 37 _captionContainer, 38 _fakeCaptionContainer, 39 _votesContainer, 40 _indexIndicator, 41 _shareButton, 42 _shareModal, 43 _shareModalHidden = true, 44 _initalCloseOnScrollValue, 45 _isIdle, 46 _listen, 47 48 _loadingIndicator, 49 _loadingIndicatorHidden, 50 _loadingIndicatorTimeout, 51 52 _galleryHasOneSlide, 53 54 _options, 55 _defaultUIOptions = { 56 barsSize: {top:44, bottom:'auto'}, 57 closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'], 58 timeToIdle: 4000, 59 timeToIdleOutside: 1000, 60 loadingIndicatorDelay: 1000, // 2s 61 62 addCaptionHTMLFn: function(item, captionEl /*, isFake */) { 63 if(!item.title) { 64 captionEl.children[0].innerHTML = ''; 65 return false; 66 } 67 captionEl.children[0].innerHTML = item.title; 68 return true; 69 }, 70 71 closeEl:true, 72 captionEl: true, 73 fullscreenEl: true, 74 zoomEl: true, 75 shareEl: true, 76 counterEl: true, 77 arrowEl: true, 78 preloaderEl: true, 79 votesEl: true, 80 81 tapToClose: false, 82 tapToToggleControls: true, 83 84 clickToAdvanceImage: false, 85 clickToCloseNonZoomable: true, 86 87 shareButtons: [ 88 {id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'}, 89 {id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'}, 90 {id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/'+ 91 '?url={{url}}&media={{image_url}}&description={{text}}'}, 92 {id:'download', label:'Download image', url:'{{raw_image_url}}', download:true} 93 ], 94 getImageURLForShare: function( /* shareButtonData */ ) { 95 return pswp.currItem.src || ''; 96 }, 97 getPageURLForShare: function( /* shareButtonData */ ) { 98 return window.location.href; 99 }, 100 getTextForShare: function( /* shareButtonData */ ) { 101 return pswp.currItem.title || ''; 102 }, 103 104 indexIndicatorSep: ' / ', 105 fitControlsWidth: 1200 106 107 }, 108 _blockControlsTap, 109 _blockControlsTapTimeout; 110 111 112 113 var _onControlsTap = function(e) { 114 if(_blockControlsTap) { 115 return true; 116 } 117 118 119 e = e || window.event; 120 121 if(_options.timeToIdle && _options.mouseUsed && !_isIdle) { 122 // reset idle timer 123 _onIdleMouseMove(); 124 } 125 126 127 var target = e.target || e.srcElement, 128 uiElement, 129 clickedClass = target.getAttribute('class') || '', 130 found; 131 132 for(var i = 0; i < _uiElements.length; i++) { 133 uiElement = _uiElements[i]; 134 if(uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name ) > -1 ) { 135 uiElement.onTap(); 136 found = true; 137 138 } 139 } 140 141 if(found) { 142 if(e.stopPropagation) { 143 e.stopPropagation(); 144 } 145 _blockControlsTap = true; 146 147 // Some versions of Android don't prevent ghost click event 148 // when preventDefault() was called on touchstart and/or touchend. 149 // 150 // This happens on v4.3, 4.2, 4.1, 151 // older versions strangely work correctly, 152 // but just in case we add delay on all of them) 153 var tapDelay = framework.features.isOldAndroid ? 600 : 30; 154 _blockControlsTapTimeout = setTimeout(function() { 155 _blockControlsTap = false;
156 }, tapDelay); 157 } 158 159 }, 160 _fitControlsInViewport = function() { 161 return !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth; 162 }, 163 _togglePswpClass = function(el, cName, add) { 164 framework[ (add ? 'add' : 'remove') + 'Class' ](el, 'pswp__' + cName); 165 }, 166 167 // add class when there is just one item in the gallery 168 // (by default it hides left/right arrows and 1ofX counter) 169 _countNumItems = function() { 170 var hasOneSlide = (_options.getNumItemsFn() === 1); 171 172 if(hasOneSlide !== _galleryHasOneSlide) { 173 _togglePswpClass(_controls, 'ui--one-slide', hasOneSlide); 174 _galleryHasOneSlide = hasOneSlide; 175 } 176 }, 177 _toggleShareModalClass = function() { 178 _togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden); 179 }, 180 _toggleShareModal = function() { 181 182 _shareModalHidden = !_shareModalHidden; 183 184 185 if(!_shareModalHidden) { 186 _toggleShareModalClass(); 187 setTimeout(function() { 188 if(!_shareModalHidden) { 189 framework.addClass(_shareModal, 'pswp__share-modal--fade-in'); 190 } 191 }, 30); 192 } else { 193 framework.removeClass(_shareModal, 'pswp__share-modal--fade-in'); 194 setTimeout(function() { 195 if(_shareModalHidden) { 196 _toggleShareModalClass(); 197 } 198 }, 300); 199 } 200 201 if(!_shareModalHidden) { 202 _updateShareURLs(); 203 } 204 return false; 205 }, 206 207 _openWindowPopup = function(e) { 208 e = e || window.event; 209 var target = e.target || e.srcElement; 210 211 pswp.shout('shareLinkClick', e, target); 212 213 if(!target.href) { 214 return false; 215 } 216 217 if( target.hasAttribute('download') ) { 218 return true; 219 } 220 221 window.open(target.href, 'pswp_share', 'scrollbars=yes,resizable=yes,toolbar=no,'+ 222 'location=yes,width=550,height=420,top=100,left=' + 223 (window.screen ? Math.round(screen.width / 2 - 275) : 100) ); 224 225 if(!_shareModalHidden) { 226 _toggleShareModal(); 227 } 228 229 return false; 230 }, 231 _updateShareURLs = function() { 232 var shareButtonOut = '', 233 shareButtonData, 234 shareURL, 235 image_url, 236 page_url, 237 share_text; 238 239 for(var i = 0; i < _options.shareButtons.length; i++) { 240 shareButtonData = _options.shareButtons[i]; 241 242 image_url = _options.getImageURLForShare(shareButtonData); 243 page_url = _options.getPageURLForShare(shareButtonData); 244 share_text = _options.getTextForShare(shareButtonData); 245 246 shareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(page_url) ) 247 .replace('{{image_url}}', encodeURIComponent(image_url) ) 248 .replace('{{raw_image_url}}', image_url ) 249 .replace('{{text}}', encodeURIComponent(share_text) ); 250 251 shareButtonOut += '<a href="' + shareURL + '" target="_blank" '+ 252 'class="pswp__share--' + shareButtonData.id + '"' + 253 (shareButtonData.download ? 'download' : '') + '>' + 254 shareButtonData.label + '</a>'; 255 256 if(_options.parseShareButtonOut) { 257 shareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut); 258 } 259 } 260 _shareModal.children[0].innerHTML = shareButtonOut; 261 _shareModal.children[0].onclick = _openWindowPopup; 262 263 }, 264 _updateVotesContainer = function(currItem) { 265 if(currItem.id) { 266 // %23 is the urlencoded pound sign, necessary for logged out url interpolation 267 _votesContainer.innerHTML = (currItem.voted ? BAT_PHOTOSWIPE_UI.votedTemplate : BAT_PHOTOSWIPE_UI.voteTemplate).replace(/#CONTEXT_ID/g, currItem.context).replace(/#VOTES_ID/g, currItem.id).replace(/%23CONTEXT_ID/g, currItem.context).replace(/%23VOTES_ID/g, currItem.id).replace(/#VOTES_NUMBER/g, currItem.votes); 268 } else { 269 _votesContainer.innerHTML = ''; 270 } 271 }, 272 _hasCloseClass = function(target) { 273 for(var i = 0; i < _options.closeElClasses.length; i++) { 274 if( framework.hasClass(target, 'pswp__' + _options.closeElClasses[i]) ) { 275 return true; 276 } 277 } 278 }, 279 _idleInterval, 280 _idleTimer, 281 _idleIncrement = 0, 282 _onIdleMouseMove = function() { 283 clearTimeout(_idleTimer); 284 _idleIncrement = 0; 285 if(_isIdle) { 286 ui.setIdle(false); 287 } 288 }, 289 _onMouseLeaveWindow = function(e) { 290 e = e ? e : window.event; 291 var from = e.relatedTarget || e.toElement; 292 if (!from || from.nodeName === 'HTML') { 293 clearTimeout(_idleTimer); 294 _idleTimer = setTimeout(function() { 295 ui.setIdle(true); 296 }, _options.timeToIdleOutside); 297 } 298 }, 299 _setupFullscreenAPI = function() { 300 if(_options.fullscreenEl && !framework.features.isOldAndroid) { 301 if(!_fullscrenAPI) { 302 _fullscrenAPI = ui.getFullscreenAPI(); 303 } 304 if(_fullscrenAPI) { 305 framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 306 ui.updateFullscreen();
307 framework.addClass(pswp.template, 'pswp--supports-fs'); 308 } else { 309 framework.removeClass(pswp.template, 'pswp--supports-fs'); 310 } 311 } 312 }, 313 _setupLoadingIndicator = function() { 314 // Setup loading indicator 315 if(_options.preloaderEl) { 316 317 _toggleLoadingIndicator(true); 318 319 _listen('beforeChange', function() { 320 321 clearTimeout(_loadingIndicatorTimeout); 322 323 // display loading indicator with delay 324 _loadingIndicatorTimeout = setTimeout(function() { 325 326 if(pswp.currItem && pswp.currItem.loading) { 327 328 if( !pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth) ) { 329 // show preloader if progressive loading is not enabled, 330 // or image width is not defined yet (because of slow connection) 331 _toggleLoadingIndicator(false); 332 // items-controller.js function allowProgressiveImg 333 } 334 335 } else { 336 _toggleLoadingIndicator(true); // hide preloader 337 } 338 339 }, _options.loadingIndicatorDelay); 340 341 }); 342 _listen('imageLoadComplete', function(index, item) { 343 if(pswp.currItem === item) { 344 _toggleLoadingIndicator(true); 345 } 346 }); 347 348 } 349 }, 350 _toggleLoadingIndicator = function(hide) { 351 if( _loadingIndicatorHidden !== hide ) { 352 _togglePswpClass(_loadingIndicator, 'preloader--active', !hide); 353 _loadingIndicatorHidden = hide; 354 } 355 }, 356 _applyNavBarGaps = function(item) { 357 var gap = item.vGap; 358 359 if( _fitControlsInViewport() ) { 360 361 var bars = _options.barsSize; 362 if(_options.captionEl && bars.bottom === 'auto') { 363 if(!_fakeCaptionContainer) { 364 _fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake'); 365 _fakeCaptionContainer.appendChild( framework.createEl('pswp__caption__center') ); 366 _controls.insertBefore(_fakeCaptionContainer, _captionContainer); 367 framework.addClass(_controls, 'pswp__ui--fit'); 368 } 369 if( _options.addCaptionHTMLFn(item, _fakeCaptionContainer, true) ) { 370 371 var captionSize = _fakeCaptionContainer.clientHeight; 372 gap.bottom = parseInt(captionSize,10) || 44; 373 } else { 374 gap.bottom = bars.top; // if no caption, set size of bottom gap to size of top 375 } 376 } else { 377 gap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom; 378 } 379 380 // height of top bar is static, no need to calculate it 381 gap.top = bars.top; 382 } else { 383 gap.top = gap.bottom = 0; 384 } 385 }, 386 _setupIdle = function() { 387 // Hide controls when mouse is used 388 if(_options.timeToIdle) { 389 _listen('mouseUsed', function() { 390 391 framework.bind(document, 'mousemove', _onIdleMouseMove); 392 framework.bind(document, 'mouseout', _onMouseLeaveWindow); 393 394 _idleInterval = setInterval(function() { 395 _idleIncrement++; 396 if(_idleIncrement === 2) { 397 ui.setIdle(true); 398 } 399 }, _options.timeToIdle / 2); 400 }); 401 } 402 }, 403 _setupHidingControlsDuringGestures = function() { 404 405 // Hide controls on vertical drag 406 _listen('onVerticalDrag', function(now) { 407 if(_controlsVisible && now < 0.95) { 408 ui.hideControls(); 409 } else if(!_controlsVisible && now >= 0.95) { 410 ui.showControls(); 411 } 412 }); 413 414 // Hide controls when pinching to close 415 var pinchControlsHidden; 416 _listen('onPinchClose' , function(now) { 417 if(_controlsVisible && now < 0.9) { 418 ui.hideControls(); 419 pinchControlsHidden = true; 420 } else if(pinchControlsHidden && !_controlsVisible && now > 0.9) { 421 ui.showControls(); 422 } 423 }); 424 425 _listen('zoomGestureEnded', function() { 426 pinchControlsHidden = false; 427 if(pinchControlsHidden && !_controlsVisible) { 428 ui.showControls(); 429 } 430 }); 431 432 }; 433 434 435 436 var _uiElements = [ 437 { 438 name: 'caption', 439 option: 'captionEl', 440 onInit: function(el) { 441 _captionContainer = el; 442 } 443 }, 444 { 445 name: 'share-modal', 446 option: 'shareEl', 447 onInit: function(el) { 448 _shareModal = el; 449 }, 450 onTap: function() { 451 _toggleShareModal(); 452 } 453 }, 454 { 455 name: 'button--share', 456 option: 'shareEl', 457 onInit: function(el) { 458 _shareButton = el; 459 }, 460 onTap: function() { 461 _toggleShareModal(); 462 } 463 }, 464 { 465 name: 'button--zoom', 466 option: 'zoomEl', 467 onTap: pswp.toggleDesktopZoom 468 }, 469 { 470 name: 'counter', 471 option: 'counterEl', 472 onInit: function(el) { 473 _indexIndicator = el; 474 } 475 }, 476 { 477 name: 'button--close', 478 option: 'closeEl', 479 onTap: pswp.close 480 }, 481 { 482 name: 'button--arrow--left', 483 option: 'arrowEl', 484 onTap: pswp.prev 485 }, 486 { 487 name: 'button--arrow--right', 488 option: 'arrowEl', 489 onTap: pswp.next 490 }, 491 { 492 name: 'button--votes', 493 option: 'votesEl', 494 onInit: function(el) { 495 _votesContainer = el; 496 } 497 }, 498 { 499 name: 'button--fs', 500 option: 'fullscreenEl', 501 onTap: function() { 502 if(_fullscrenAPI.isFullscreen()) { 503 _fullscrenAPI.exit(); 504 } else { 505 _fullscrenAPI.enter(); 506 } 507 } 508 }, 509 { 510 name: 'preloader', 511 option: 'preloaderEl', 512 onInit: function(el) { 513 _loadingIndicator = el; 514 } 515 } 516 517 ]; 518 519 var _setupUIElements = function() { 520 var item, 521 classAttr, 522 uiElement; 523 524 var loopThroughChildElements = function(sChildren) { 525 if(!sChildren) { 526 return; 527 } 528 529 var l = sChildren.length; 530 for(var i = 0; i < l; i++) { 531 item = sChildren[i]; 532 classAttr = item.className; 533
534 for(var a = 0; a < _uiElements.length; a++) { 535 uiElement = _uiElements[a]; 536 537 if(classAttr.indexOf('pswp__' + uiElement.name) > -1 ) { 538 539 if( _options[uiElement.option] ) { // if element is not disabled from options 540 541 framework.removeClass(item, 'pswp__element--disabled'); 542 if(uiElement.onInit) { 543 uiElement.onInit(item); 544 } 545 546 //item.style.display = 'block'; 547 } else { 548 framework.addClass(item, 'pswp__element--disabled'); 549 //item.style.display = 'none'; 550 } 551 } 552 } 553 } 554 }; 555 loopThroughChildElements(_controls.children); 556 557 var topBar = framework.getChildByClass(_controls, 'pswp__top-bar'); 558 if(topBar) { 559 loopThroughChildElements( topBar.children ); 560 } 561 }; 562 563 564 565 566 ui.init = function() { 567 568 // extend options 569 framework.extend(pswp.options, _defaultUIOptions, true); 570 571 // create local link for fast access 572 _options = pswp.options; 573 574 // find pswp__ui element 575 _controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui'); 576 577 // create local link 578 _listen = pswp.listen; 579 580 581 _setupHidingControlsDuringGestures(); 582 583 // update controls when slides change 584 _listen('beforeChange', ui.update); 585 586 // toggle zoom on double-tap 587 _listen('doubleTap', function(point) { 588 if('mouse' === point.type) { return; } 589 590 var initialZoomLevel = pswp.currItem.initialZoomLevel; 591 if(pswp.getZoomLevel() !== initialZoomLevel) { 592 pswp.zoomTo(initialZoomLevel, point, 333); 593 } else { 594 pswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333); 595 } 596 }); 597 598 // Allow text selection in caption 599 _listen('preventDragEvent', function(e, isDown, preventObj) { 600 var t = e.target || e.srcElement; 601 if ( 602 t && 603 t.getAttribute('class') && e.type.indexOf('mouse') > -1 && 604 (t.getAttribute('class').indexOf('__caption') > 0 || (/(SMALL|STRONG|EM)/i).test(t.tagName)) 605 ) { 606 preventObj.prevent = false; 607 } 608 }); 609 610 // bind events for UI 611 _listen('bindEvents', function() { 612 framework.bind(_controls, 'pswpTap click', _onControlsTap); 613 framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 614 615 if(!pswp.likelyTouchDevice) { 616 framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 617 } 618 }); 619 620 // unbind events for UI 621 _listen('unbindEvents', function() { 622 if(!_shareModalHidden) { 623 _toggleShareModal(); 624 } 625 626 if(_idleInterval) { 627 clearInterval(_idleInterval); 628 } 629 framework.unbind(document, 'mouseout', _onMouseLeaveWindow); 630 framework.unbind(document, 'mousemove', _onIdleMouseMove); 631 framework.unbind(_controls, 'pswpTap click', _onControlsTap); 632 framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 633 framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 634 635 if(_fullscrenAPI) { 636 framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 637 if(_fullscrenAPI.isFullscreen()) { 638 _options.hideAnimationDuration = 0; 639 _fullscrenAPI.exit(); 640 } 641 _fullscrenAPI = null; 642 } 643 }); 644 645 646 // clean up things when gallery is destroyed 647 _listen('destroy', function() { 648 if(_options.captionEl) { 649 if(_fakeCaptionContainer) { 650 _controls.removeChild(_fakeCaptionContainer); 651 } 652 framework.removeClass(_captionContainer, 'pswp__caption--empty'); 653 } 654 655 if(_shareModal) { 656 _shareModal.children[0].onclick = null; 657 } 658 framework.removeClass(_controls, 'pswp__ui--over-close'); 659 framework.addClass( _controls, 'pswp__ui--hidden'); 660 ui.setIdle(false); 661 }); 662 663 664 if(!_options.showAnimationDuration) { 665 framework.removeClass( _controls, 'pswp__ui--hidden'); 666 } 667 _listen('initialZoomIn', function() { 668 if(_options.showAnimationDuration) { 669 framework.removeClass( _controls, 'pswp__ui--hidden'); 670 } 671 }); 672 _listen('initialZoomOut', function() { 673 framework.addClass( _controls, 'pswp__ui--hidden'); 674 }); 675 676 _listen('parseVerticalMargin', _applyNavBarGaps); 677 678 _setupUIElements(); 679 680 if(_options.shareEl && _shareButton && _shareModal) { 681 _shareModalHidden = true; 682 } 683 684 _countNumItems(); 685 686 _setupIdle(); 687 688 _setupFullscreenAPI(); 689 690 _setupLoadingIndicator(); 691 }; 692 693 ui.setIdle = function(isIdle) { 694 _isIdle = isIdle; 695 _togglePswpClass(_controls, 'ui--idle', isIdle); 696 }; 697 698 ui.update = function() { 699 // Don't update UI if it's hidden 700 if(_controlsVisible && pswp.currItem) { 701 ui.updateIndexIndicator(); 702 703 if(_options.captionEl) { 704 _options.addCaptionHTMLFn(pswp.currItem, _captionContainer); 705 706 _togglePswpClass(_captionContainer, 'caption--empty', !pswp.currItem.title); 707 } 708 709 _updateVotesContainer(pswp.currItem); 710 711 _overlayUIUpdated = true; 712 } else { 713 _overlayUIUpdated = false;
714 } 715 716 if(!_shareModalHidden) { 717 _toggleShareModal(); 718 } 719 720 _countNumItems(); 721 }; 722 723 ui.updateFullscreen = function(e) { 724 725 if(e) { 726 // some browsers change window scroll position during the fullscreen 727 // so PhotoSwipe updates it just in case 728 setTimeout(function() { 729 pswp.setScrollOffset( 0, framework.getScrollY() ); 730 }, 50); 731 } 732 733 // toogle pswp--fs class on root element 734 framework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs'); 735 }; 736 737 ui.updateIndexIndicator = function() { 738 if(_options.counterEl) { 739 _indexIndicator.innerHTML = (pswp.getCurrentIndex()+1) + 740 _options.indexIndicatorSep + 741 _options.getNumItemsFn(); 742 } 743 }; 744 745 ui.onGlobalTap = function(e) { 746 e = e || window.event; 747 var target = e.target || e.srcElement; 748 749 if(_blockControlsTap) { 750 return; 751 } 752 753 if(e.detail && e.detail.pointerType === 'mouse') { 754 755 // close gallery if clicked outside of the image 756 if(_hasCloseClass(target)) { 757 pswp.close(); 758 return; 759 } 760 761 if (framework.hasClass(target, 'pswp__img')) { 762 if (_options.clickToAdvanceImage) { 763 if ((pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) || pswp.getZoomLevel() === pswp.currItem.fitRatio) { 764 pswp.next(); 765 } else { 766 pswp.toggleDesktopZoom(e.detail.releasePoint); 767 } 768 } else { 769 if (pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) { 770 if (_options.clickToCloseNonZoomable) { 771 pswp.close(); 772 } 773 } else { 774 pswp.toggleDesktopZoom(e.detail.releasePoint); 775 } 776 } 777 } 778 779 } else { 780 781 // tap anywhere (except buttons) to toggle visibility of controls 782 if(_options.tapToToggleControls) { 783 if(_controlsVisible) { 784 ui.hideControls(); 785 } else { 786 ui.showControls(); 787 } 788 } 789 790 // tap to close gallery 791 if(_options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target)) ) { 792 pswp.close(); 793 return; 794 } 795 796 } 797 }; 798 ui.onMouseOver = function(e) { 799 e = e || window.event; 800 var target = e.target || e.srcElement; 801 802 // add class when mouse is over an element that should close the gallery 803 _togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target)); 804 }; 805 806 ui.hideControls = function() { 807 framework.addClass(_controls,'pswp__ui--hidden'); 808 _controlsVisible = false; 809 }; 810 811 ui.showControls = function() { 812 _controlsVisible = true; 813 if(!_overlayUIUpdated) { 814 ui.update(); 815 } 816 framework.removeClass(_controls,'pswp__ui--hidden'); 817 }; 818 819 ui.supportsFullscreen = function() { 820 var d = document; 821 return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen); 822 }; 823 824 ui.getFullscreenAPI = function() { 825 var dE = document.documentElement, 826 api, 827 tF = 'fullscreenchange'; 828 829 if (dE.requestFullscreen) { 830 api = { 831 enterK: 'requestFullscreen', 832 exitK: 'exitFullscreen', 833 elementK: 'fullscreenElement', 834 eventK: tF 835 }; 836 837 } else if(dE.mozRequestFullScreen ) { 838 api = { 839 enterK: 'mozRequestFullScreen', 840 exitK: 'mozCancelFullScreen', 841 elementK: 'mozFullScreenElement', 842 eventK: 'moz' + tF 843 }; 844 845 846 847 } else if(dE.webkitRequestFullscreen) { 848 api = { 849 enterK: 'webkitRequestFullscreen', 850 exitK: 'webkitExitFullscreen', 851 elementK: 'webkitFullscreenElement', 852 eventK: 'webkit' + tF 853 }; 854 855 } else if(dE.msRequestFullscreen) { 856 api = { 857 enterK: 'msRequestFullscreen', 858 exitK: 'msExitFullscreen', 859 elementK: 'msFullscreenElement', 860 eventK: 'MSFullscreenChange' 861 }; 862 } 863 864 if(api) { 865 api.enter = function() { 866 // disable close-on-scroll in fullscreen 867 _initalCloseOnScrollValue = _options.closeOnScroll; 868 _options.closeOnScroll = false; 869 870 if(this.enterK === 'webkitRequestFullscreen') { 871 pswp.template[this.enterK]( Element.ALLOW_KEYBOARD_INPUT ); 872 } else { 873 return pswp.template[this.enterK](); 874 } 875 }; 876 api.exit = function() { 877 _options.closeOnScroll = _initalCloseOnScrollValue; 878 879 return document[this.exitK](); 880 881 }; 882 api.isFullscreen = function() { return document[this.elementK]; }; 883 } 884 885 return api; 886 }; 887 888 889 890}; 891return PhotoSwipeUI_BaT; 892 893 894}); 895; 896ko.extenders.trim = function trim (target) { 897 target.subscribe(function () { 898 target(target().trim()) 899 }) 900} 901 902ko.bindingHandlers.fadeVisible = { 903 init: function (element, valueAccessor) { 904 var value = valueAccessor(); 905 jQuery(element).toggle(ko.unwrap(value)); 906 }, 907 update: function (element, valueAccessor) { 908 var value = valueAccessor(); 909 ko.unwrap(value) ? jQuery(element).fadeIn() : jQuery(element).fadeOut(); 910 } 911}; 912; 913/*! 914 Knockout Fast Foreach v0.6.0 (2016-07-28T11:02:54.197Z) 915 By: Brian M Hunt (C) 2015 | License: MIT 916 917 Adds `fastForEach` to `ko.bindingHandlers`. 918*/ 919!function(e,t){"function"==typeof define&&define.amd?define(["knockout"],t):"object"==typeof exports?module.exports=t(require("knockout")):e.KnockoutFastForeach=t(e.ko)}(this,function(e){"use strict";function t(e){return!!e&&"object"==typeof e&&e.constructor===Object}function n(e){return 8===e.nodeType&&h.test(u?e.text:e.nodeValue)}function s(t){var n,s=document.createElement("div");return t.content?n=t.content:"SCRIPT"===t.tagName?(n=document.createElement("div"),n.innerHTML=t.text):n=t,e.utils.arrayForEach(e.virtualElements.childNodes(n),function(e){e&&s.insertBefore(e.cloneNode(!0),null)}),s}function i(e,t){return{status:"added",value:e,index:t}}function o(e){return"function"==typeof Symbol?Symbol(e):e}function r(t){this.element=t.element,this.container=n(this.element)?this.element.parentNode:this.element,this.$context=t.$context,this.data=t.data,this.as=t.as,this.noContext=t.noContext,this.noIndex=t.noIndex,this.afterAdd=t.afterAdd,this.beforeRemove=t.beforeRemove,this.templateNode=s(t.templateNode||(t.name?document.getElementById(t.name).cloneNode(!0):t.element)),this.afterQueueFlush=t.afterQueueFlush,this.beforeQueueFlush=t.beforeQueueFlush,this.changeQueue=[],this.firstLastNodesList=[],this.indexesToDelete=[],this.rendering_queued=!1,this.pendingDeletes=[],e.virtualElements.emptyNode(this.element);var o=e.unwrap(this.data);o.map&&this.onArrayChange(o.map(i),!0),e.isObservable(this.data)&&(this.data.indexOf||(this.data=this.data.extend({trackArrayChanges:!0})),this.changeSubs=this.data.subscribe(this.onArrayChange,this,"arrayChange"))}function a(t){t.$index=e.observable()}var d=9007199254740991,u=document&&"<!--test-->"===document.createComment("test").text,h=u?/^<!--\s*ko(?:\s+([\s\S]+))?\s*-->$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,l=document&&"function"==typeof document.createDocumentFragment,c=o("_ko_ffe_pending_delete_index");r.PENDING_DELETE_INDEX_KEY=c,r.animateFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)},r.prototype.dispose=function(){this.changeSubs&&this.changeSubs.dispose(),this.flushPendingDeletes()},r.prototype.onArrayChange=function(e,t){for(var n=this,s={added:[],deleted:[]},i=0,o=e.length;i<o;i++){if(s.added.length&&"added"==e[i].status){var a=s.added[s.added.length-1],d=a.isBatch?a.index+a.values.length-1:a.index;if(d+1==e[i].index){a.isBatch||(a={isBatch:!0,status:"added",index:a.index,values:[a.value]},s.added.splice(s.added.length-1,1,a)),a.values.push(e[i].value);continue}}s[e[i].status].push(e[i])}s.deleted.length>0&&(this.changeQueue.push.apply(this.changeQueue,s.deleted),this.changeQueue.push({status:"clearDeletedIndexes"})),this.changeQueue.push.apply(this.changeQueue,s.added),this.changeQueue.length>0&&!this.rendering_queued&&(this.rendering_queued=!0,t?n.processQueue():r.animateFrame.call(window,function(){n.processQueue()}))},r.prototype.processQueue=function(){var t=this,n=d;"function"==typeof this.beforeQueueFlush&&this.beforeQueueFlush(this.changeQueue),e.utils.arrayForEach(this.changeQueue,function(e){"number"==typeof e.index&&(n=Math.min(n,e.index)),t[e.status](e)}),this.flushPendingDeletes(),this.rendering_queued=!1,this.noIndex||this.updateIndexes(n),"function"==typeof this.afterQueueFlush&&this.afterQueueFlush(this.changeQueue),this.changeQueue=[]},r.prototype.added=function(t){for(var n=t.index,s=t.isBatch?t.values:[t.value],i=this.getLastNodeBeforeIndex(n),o=[],r=0,d=s.length;r<d;++r){var u,h=this.getPendingDeleteFor(s[r]);if(h&&h.nodesets.length)u=h.nodesets.pop();else{var l,c=this.templateNode.cloneNode(!0);l=this.noContext?this.$context.extend({$item:s[r],$index:this.noIndex?void 0:e.observable()}):this.$context.createChildContext(s[r],this.as||null,this.noIndex?void 0:a),e.applyBindingsToDescendants(l,c),u=e.virtualElements.childNodes(c)}o.push.apply(o,Array.prototype.slice.call(u)),this.firstLastNodesList.splice(n+r,0,{first:u[0],last:u[u.length-1]})}"function"==typeof this.afterAdd?this.afterAdd({nodeOrArrayInserted:this.insertAllAfter(o,i),foreachInstance:this}):this.insertAllAfter(o,i)},r.prototype.getNodesForIndex=function(e){var t=[],n=this.firstLastNodesList[e].first,s=this.firstLastNodesList[e].last;for(t.push(n);n&&n!==s;)n=n.nextSibling,t.push(n);return t},r.prototype.getLastNodeBeforeIndex=function(e){return e<1||e-1>=this.firstLastNodesList.length?null:this.firstLastNodesList[e-1].last},r.prototype.insertAllAfter=function(t,n){var s,i,o,r=this.element;if(void 0===t.nodeType&&void 0===t.length)throw new Error("Expected a single node or a node array");if(void 0!==t.nodeType)return e.virtualElements.insertAfter(r,t,n),[t];if(1===t.length)e.virtualElements.insertAfter(r,t[0],n);else if(l){for(s=document.createDocumentFragment(),o=0,i=t.length;o!==i;++o)s.appendChild(t[o]);e.virtualElements.insertAfter(r,s,n)}else for(o=t.length-1;o>=0;--o){var a=t[o];if(!a)break;e.virtualElements.insertAfter(r,a,n)}return t},r.prototype.shouldDelayDeletion=function(e){return e&&("object"==typeof e||"function"==typeof e)},r.prototype.getPendingDeleteFor=function(e){var t=e&&e[c];return void 0===t?null:this.pendingDeletes[t]},r.prototype.getOrCreatePendingDeleteFor=function(e){var t=this.getPendingDeleteFor(e);return t?t:(t={data:e,nodesets:[]},e[c]=this.pendingDeletes.length,this.pendingDeletes.push(t),t)},r.prototype.deleted=function(e){if(this.shouldDelayDeletion(e.value)){var t=this.getOrCreatePendingDeleteFor(e.value);t.nodesets.push(this.getNodesForIndex(e.index))}else this.removeNodes(this.getNodesForIndex(e.index));this.indexesToDelete.push(e.index)},r.prototype.removeNodes=function(t){if(t.length){var n=function(){for(var n=t[0].parentNode,s=t.length-1;s>=0;--s)e.cleanNode(t[s]),n.removeChild(t[s])};if(this.beforeRemove){var s=this.beforeRemove({nodesToRemove:t,foreachInstance:this})||{};"function"==typeof s.then&&s.then(n,e.onError?e.onError:void 0)}else n()}},r.prototype.flushPendingDeletes=function(){for(var e=0,t=this.pendingDeletes.length;e!=t;++e){for(var n=this.pendingDeletes[e];n.nodesets.length;)this.removeNodes(n.nodesets.pop());n.data&&void 0!==n.data[c]&&delete n.data[c]}this.pendingDeletes=[]},r.prototype.clearDeletedIndexes=function(){for(var e=this.indexesToDelete.length-1;e>=0;--e)this.firstLastNodesList.splice(this.indexesToDelete[e],1);this.indexesToDelete=[]},r.prototype.getContextStartingFrom=function(t){for(var n;t;){if(n=e.contextFor(t))return n;t=t.nextSibling}},r.prototype.updateIndexes=function(e){for(var t,n=e,s=this.firstLastNodesList.length;n<s;++n)t=this.getContextStartingFrom(this.firstLastNodesList[n].first),t&&t.$index(n)},e.bindingHandlers.fastForEach={init:function(n,s,i,o,a){var d,u=s();return t(u)?(u.element=u.element||n,u.$context=a,d=new r(u)):d=new r({element:n,data:e.unwrap(a.$rawData)===u?a.$rawData:u,$context:a}),e.utils.domNodeDisposal.addDisposeCallback(n,function(){d.dispose()}),{controlsDescendantBindings:!0}},FastForEach:r},e.virtualElements.allowedBindings.fastForEach=!0});; 920/*============================================================================= 921 Author: Eric M. Barnard - @ericmbarnard 922 License: MIT (http://opensource.org/licenses/mit-license.php) 923 924 Description: Validation Library for KnockoutJS 925 Version: 2.0.4 926=============================================================================== 927*/ 928 929!function(e){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?e(require("knockout"),exports
929):"function"==typeof define&&define.amd?define(["knockout","exports"],e):e(ko,ko.validation={})}(function(f,e){if(void 0===f)throw new Error("Knockout is required, please ensure it is loaded before loading this validation plug-in");f.validation=e;var t,i,a,c=f.validation,o=f.utils,p=o.unwrapObservable,n=o.arrayForEach,u=o.extend,r={registerExtenders:!0,messagesOnModified:!0,errorsAsTitle:!0,errorsAsTitleOnModified:!1,messageTemplate:null,insertMessages:!0,parseInputAttributes:!1,writeInputAttributes:!1,decorateInputElement:!1,decorateElementOnModified:!0,errorClass:null,errorElementClass:"validationElement",errorMessageClass:"validationMessage",allowHtmlMessages:!1,grouping:{deep:!1,observable:!0,live:!1},validate:{}},s=u({},r);s.html5Attributes=["required","pattern","min","max","step"],s.html5InputTypes=["email","number","date"],s.reset=function(){u(s,r)},c.configuration=s,c.utils=(t=(new Date).getTime(),i={},a="__ko_validation__",{isArray:function(e){return e.isArray||"[object Array]"===Object.prototype.toString.call(e)},isObject:function(e){return null!==e&&"object"==typeof e},isNumber:function(e){return!isNaN(e)},isObservableArray:function(e){return!!e&&"function"==typeof e.remove&&"function"==typeof e.removeAll&&"function"==typeof e.destroy&&"function"==typeof e.destroyAll&&"function"==typeof e.indexOf&&"function"==typeof e.replace},values:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t},getValue:function(e){return"function"==typeof e?e():e},hasAttribute:function(e,t){return null!==e.getAttribute(t)},getAttribute:function(e,t){return e.getAttribute(t)},setAttribute:function(e,t,r){return e.setAttribute(t,r)},isValidatable:function(e){return!!(e&&e.rules&&e.isValid&&e.isModified)},insertAfter:function(e,t){e.parentNode.insertBefore(t,e.nextSibling)},newId:function(){return t+=1},getConfigOptions:function(e){return c.utils.contextFor(e)||c.configuration},setDomData:function(e,t){var r=e[a];r||(e[a]=r=c.utils.newId()),i[r]=t},getDomData:function(e){var t=e[a];if(t)return i[t]},contextFor:function(e){switch(e.nodeType){case 1:case 8:var t=c.utils.getDomData(e);if(t)return t;if(e.parentNode)return c.utils.contextFor(e.parentNode)}},isEmptyVal:function(e){return null==e||""===e},getOriginalElementTitle:function(e){var t=c.utils.getAttribute(e,"data-orig-title"),r=e.title;return c.utils.hasAttribute(e,"data-orig-title")?t:r},async:function(e){window.setImmediate?window.setImmediate(e):window.setTimeout(e,0)},forEach:function(e,t){if(c.utils.isArray(e))return n(e,t);for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)}});var l,d,v,g=(l=0,d=c.configuration,v=c.utils,{init:function(e,t){0<l&&!t||((e=e||{}).errorElementClass=e.errorElementClass||e.errorClass||d.errorElementClass,e.errorMessageClass=e.errorMessageClass||e.errorClass||d.errorMessageClass,u(d,e),d.registerExtenders&&c.registerExtenders(),l=1)},reset:c.configuration.reset,group:function(t,r){var i={options:r=u(u({},d.grouping),r),graphMonitor:f.observable(),flagged:[],subscriptions:[],validatables:[]},a=null;return(a=r.observable?f.computed(function(){return i.graphMonitor(),b(t,i),F(i.validatables)}):function(){return b(t,i),F(i.validatables)}).showAllMessages=function(t){void 0===t&&(t=!0),a.forEach(function(e){v.isValidatable(e)&&e.isModified(t)})},a.isAnyMessageShown=function(){return!!a.find(function(e){return v.isValidatable(e)&&!e.isValid()&&e.isModified()})},a.filter=function(e){return e=e||function(){return!0},a(),o.arrayFilter(i.validatables,e)},a.find=function(e){return e=e||function(){return!0},a(),o.arrayFirst(i.validatables,e)},a.forEach=function(e){e=e||function(){},a(),n(i.validatables,e)},a.map=function(e){return e=e||function(e){return e},a(),o.arrayMap(i.validatables,e)},a._updateState=function(e){if(!v.isObject(e))throw new Error("An object is required.");if(t=e,!r.observable)return b(e,i),F(i.validatables);i.graphMonitor.valueHasMutated()},a},formatMessage:function(e,t,r){if(v.isObject(t)&&t.typeAttr&&(t=t.value),"function"==typeof e)return e(t,r);var i=p(t);return null==i&&(i=[]),v.isArray(i)||(i=[i]),e.replace(/{(\d+)}/gi,function(e,t){return void 0!==i[t]?i[t]:e})},addRule:function(e,t){return e.extend({validatable:!0}),o.arrayFirst(e.rules(),function(e){return e.rule&&e.rule===t.rule})||e.rules.push(t),e}
929,addAnonymousRule:function(e,t){void 0===t.message&&(t.message="Error"),t.onlyIf&&(t.condition=t.onlyIf),c.addRule(e,t)},addExtender:function(r){f.extenders[r]=function(e,t){return t&&(t.message||t.onlyIf)?c.addRule(e,{rule:r,message:t.message,params:!!v.isEmptyVal(t.params)||t.params,condition:t.onlyIf}):c.addRule(e,{rule:r,params:t})}},registerExtenders:function(){if(d.registerExtenders)for(var e in c.rules)c.rules.hasOwnProperty(e)&&(f.extenders[e]||c.addExtender(e))},insertValidationMessage:function(e){var t=document.createElement("SPAN");return t.className=v.getConfigOptions(e).errorMessageClass,v.insertAfter(e,t),t},parseInputValidationAttributes:function(i,a){n(c.configuration.html5Attributes,function(e){if(v.hasAttribute(i,e)){var t=i.getAttribute(e)||!0;if("min"===e||"max"===e){var r=i.getAttribute("type");void 0!==r&&r||(r="text"),t={typeAttr:r,value:t}}c.addRule(a(),{rule:e,params:t})}});var t=i.getAttribute("type");n(c.configuration.html5InputTypes,function(e){e===t&&c.addRule(a(),{rule:"date"===e?"dateISO":e,params:!0})})},writeInputValidationAttributes:function(i,e){var t=e();if(t&&t.rules){var a=t.rules();n(c.configuration.html5Attributes,function(t){var r=o.arrayFirst(a,function(e){return e.rule&&e.rule.toLowerCase()===t.toLowerCase()});r&&f.computed({read:function(){var e=f.unwrap(r.params);"pattern"===r.rule&&e instanceof RegExp&&(e=e.source),i.setAttribute(t,e)},disposeWhenNodeIsRemoved:i})}),a=null}},makeBindingHandlerValidatable:function(e){var n=f.bindingHandlers[e].init;f.bindingHandlers[e].init=function(e,t,r,i,a){return n(e,t,r,i,a),f.bindingHandlers.validationCore.init(e,t,r,i,a)}},setRules:function(e,t){var d=function(e,t){if(e&&t)for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(e[r]){var a=e[r],n=p(a),s={},u={};for(var l in i)i.hasOwnProperty(l)&&(c.rules[l]?s[l]=i[l]:u[l]=i[l]);if(f.isObservable(a)&&a.extend(s),n&&v.isArray(n))for(var o=0;o<n.length;o++)d(n[o],u);else d(n,u)}}};d(e,t)}});function m(e){n(e.subscriptions,function(e){e.dispose()}),e.subscriptions=[]}function b(e,t){t.validatables=[],m(t),function t(e,r,i){var a=[],n=e.peek?e.peek():e;!0!==e.__kv_traversed&&(r.options.deep&&(e.__kv_traversed=!0,r.flagged.push(e)),i=void 0!==i?i:r.options.deep?1:-1,f.isObservable(e)&&(e.errors||v.isValidatable(e)||e.extend({validatable:!0}),r.validatables.push(e),r.options.live&&v.isObservableArray(e)&&r.subscriptions.push(e.subscribe(function(){r.graphMonitor.valueHasMutated()}))),n&&!n._destroy&&(v.isArray(n)?a=n:v.isObject(n)&&(a=v.values(n))),0!==i&&v.forEach(a,function(e){!e||e.nodeType||f.isComputed(e)&&!e.rules||t(e,r,i+1)}))}(e,t),function(e){e.options.deep&&(n(e.flagged,function(e){delete e.__kv_traversed}),e.flagged.length=0),e.options.live||m(e)}(t)}function F(e){var t=[];return n(e,function(e){v.isValidatable(e)&&!e.isValid()&&t.push(e.error.peek())}),t}function y(u){var l="max"===u;return function(e,t){if(c.utils.isEmptyVal(e))return!0;var r,i,a,n,s;switch(r=void 0===t.typeAttr?(i="text",t):(i=t.typeAttr,t.value),isNaN(r)||r instanceof Date||(i="number"),i.toLowerCase()){case"week":if(a=/^(\d{4})-W(\d{2})$/,null===(n=e.match(a)))throw new Error("Invalid value for "+u+" attribute for week input. Should look like '2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min");return!!(s=r.match(a))&&(l?n[1]<s[1]||n[1]===s[1]&&n[2]<=s[2]:n[1]>s[1]||n[1]===s[1]&&n[2]>=s[2]);case"month":if(a=/^(\d{4})-(\d{2})$/,null===(n=e.match(a)))throw new Error("Invalid value for "+u+" attribute for month input. Should look like '2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min");return!!(s=r.match(a))&&(l?n[1]<s[1]||n[1]===s[1]&&n[2]<=s[2]:n[1]>s[1]||n[1]===s[1]&&n[2]>=s[2]);case"number":case"range":return l?!isNaN(e)&&parseFloat(e)<=parseFloat(r):!isNaN(e)&&parseFloat(e)>=parseFloat(r);default:return l?e<=r:r<=e}}}function h(i,a,n){i.isValidating(!0);function e(e){var t=!1,r="";i.__valid__()&&(e.message?(t=e.isValid,r=e.message):t=e,t||(i.error(c.formatMessage(r||n.message||a.message,p(n.params),i)),i.__valid__(t))),i.isValidating(!1)}c.utils.async(function(){a.validator(i(),void 0===n.params||p(n.params),e)})}u(f.validation,g),c.rules={},c.rules.required={validator:function(e,t){var r;return null==e?!t:("string"==typeof(r=e)&&(r=String.prototype.trim?e.trim():e.replace(/^\s+|\s+$/g,"")),!t||0<(r+"").length)},message:"This field is required."},c.rules.min={validator:y("min"),message:"Please enter a value greater than or equal to {0}."},c.rules.max={validator:y("max"),message:"Please enter a value less than or equal to {0}."},c.rules.minLength={validator:function(e,t){return!!c.utils.isEmptyVal(e)||(c.utils.isNumber(e)?""+e:e).length>=t},message:"Please enter at least {0} characters."},c.rules.maxLength={validator:function(e,t){return!!c.utils.isEmptyVal(e)||(c.utils.isNumber(e)?""+e:e).length<=t},message:"Please enter no more than {0} characters."},c.rules.pattern={validator:function(e,t){return c.utils.isEmptyVal(e)||null!==e.toString().match(t)},message:"Please check this value."},c.rules.step={validator:function(e,t){if(c.utils.isEmptyVal(e)||"any"===t)return!0;var r=100*e%(100*t);return Math.abs(r)<1e-5||Math.abs(1-r)<1e-5},message:"The value must increment by {0}."},c.rules.email={validator:function(e,t){return!t||(c.utils.isEmptyVal(e)||t&&/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(e))},message:"Please enter a proper email address."},c.rules.date={validator:function(e,t){return!t||(c.utils.isEmptyVal(e)||t&&!/Invalid|NaN/.test(new Date(e)))},message:"Please enter a proper date."},c.rules.dateISO={validator:function(e,t){return!t||(c.utils.isEmptyVal(e)||t&&/^\d{4}[-/](?:0?[1-9]|1[012])[-/](?:0?[1-9]|[12][0-9]|3[01])$/.test(e))},message:"Please enter a proper date."},c.rules.number={validator:function(e,t){return!t||(c.utils.isEmptyVal(e)||t&&/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e))},message:"Please enter a number."},c.rules.digit={validator:function(e,t){return!t||(c.utils.isEmptyVal(e)||t&&/^\d+$/.test(e))},message:"Please enter a digit."},c.rules.phoneUS={validator:function(e,t){return!t||(!!c.utils.isEmptyVal(e)||"string"==typeof e&&(e=e.replace(/\s+/g,""),t&&9<e.length&&e.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/)))},message:"Please specify a valid phone number."},c.rules.equal={validator:function(e,t){var r=t;return e===c.utils.getValue(r)},message:"Values must equal."},c.rules.notEqual={validator:function(e,t){var r=t;return e!==c.utils.getValue(r)},message:"Please choose another value."},c.rules.unique={validator:function(t,r){var e=c.utils.getValue(r.collection),i=c.utils.getValue(r.externalValue),a=0;return!t||!e||(o.arrayFilter(e,function(e){t===(r.valueAccessor?r.valueAccessor(e):e)&&a++}),a<(i?1:2))},message:"Please make sure the value is unique."},c.registerExtenders(),f.bindingHandlers.validationCore={init:function(e,t,r,i,a){var n=c.utils.getConfigOptions(e),s=t();if(n.parseInputAttributes&&c.utils.async(function(){c.parseInputValidationAttributes(e,t)}),n.insertMessages&&c.utils.isValidatable(s)){var u=c.insertValidationMessage(e);n.messageTemplate?f.renderTemplate(n.messageTemplate,{field:s},null,u,"replaceNode"):f.applyBindingsToNode(u,{validationMessage:s})}n.writeInputAttributes&&c.utils.isValidatable(s)&&c.writeInputValidationAttributes(e,t),n.decorateInputElement&&c.utils.isValidatable(s)&&f.applyBindingsToNode(e,{val
929idationElement:s})}},c.makeBindingHandlerValidatable("value"),c.makeBindingHandlerValidatable("checked"),f.bindingHandlers.textInput&&c.makeBindingHandlerValidatable("textInput"),c.makeBindingHandlerValidatable("selectedOptions"),f.bindingHandlers.validationMessage={update:function(e,t){var r,i,a=t(),n=c.utils.getConfigOptions(e);p(a);if(null==a)throw new Error("Cannot bind validationMessage to undefined value. data-bind expression: "+e.getAttribute("data-bind"));r=a.isModified&&a.isModified(),i=a.isValid&&a.isValid();var s=null;n.messagesOnModified&&!r||(s=i?null:a.error);var u=!(n.messagesOnModified&&!r)&&!i,l="none"!==e.style.display;n.allowHtmlMessages?o.setHtml(e,s):f.bindingHandlers.text.update(e,function(){return s}),l&&!u?e.style.display="none":!l&&u&&(e.style.display="")}},f.bindingHandlers.validationElement={update:function(r,e,t){var i,a,n=e(),s=c.utils.getConfigOptions(r);p(n);if(null==n)throw new Error("Cannot bind validationElement to undefined value. data-bind expression: "+r.getAttribute("data-bind"));i=n.isModified&&n.isModified(),a=n.isValid&&n.isValid();f.bindingHandlers.css.update(r,function(){var e={},t=!(s.decorateElementOnModified&&!i)&&!a;return e[s.errorElementClass]=t,e},t),s.errorsAsTitle&&f.bindingHandlers.attr.update(r,function(){var e=!s.errorsAsTitleOnModified||i,t=c.utils.getOriginalElementTitle(r);return e&&!a?{title:n.error,"data-orig-title":t}:!e||a?{title:t,"data-orig-title":null}:void 0})}},f.bindingHandlers.validationOptions={init:function(e,t,r,i,a){var n=p(t());if(n){var s=u({},c.configuration);u(s,n),c.utils.setDomData(e,s)}}},f.extenders.validation=function(t,e){return n(c.utils.isArray(e)?e:[e],function(e){c.addAnonymousRule(t,e)}),t},f.extenders.validatable=function(i,e){if(c.utils.isObject(e)||(e={enable:e}),"enable"in e||(e.enable=!0),e.enable&&!c.utils.isValidatable(i)){var t=c.configuration.validate||{},r={throttleEvaluation:e.throttle||t.throttle};i.error=f.observable(null),i.rules=f.observableArray(),i.isValidating=f.observable(!1),i.__valid__=f.observable(!0),i.isModified=f.observable(!1),i.isValid=f.computed(i.__valid__),i.setError=function(e){var t=i.error.peek(),r=i.__valid__.peek();i.error(e),i.__valid__(!1),t===e||r||i.isValid.notifySubscribers()},i.clearError=function(){return i.error(null),i.__valid__(!0),i};var a=i.subscribe(function(){i.isModified(!0)}),n=f.computed(u({read:function(){i(),i.rules();return c.validateObservable(i),!0}},r));u(n,r),i._disposeValidation=function(){i.isValid.dispose(),i.rules.removeAll(),a.dispose(),n.dispose(),delete i.rules,delete i.error,delete i.isValid,delete i.isValidating,delete i.__valid__,delete i.isModified,delete i.setError,delete i.clearError,delete i._disposeValidation}}else!1===e.enable&&i._disposeValidation&&i._disposeValidation();return i},c.validateObservable=function(e){for(var t,r,i,a,n,s=0,u=e.rules(),l=u.length;s<l;s++)if(!(r=u[s]).condition||r.condition())if((t=r.rule?c.rules[r.rule]:r).async||r.async)h(e,t,r);else if(i=e,n=r,!(a=t).validator(i(),void 0===n.params||p(n.params))&&(i.setError(c.formatMessage(n.message||a.message,p(n.params),i)),1))return!1;return e.clearError(),!0};var x,E={};c.defineLocale=function(e,t){return e&&t?E[e.toLowerCase()]=t:null},c.locale=function(e){if(e){if(e=e.toLowerCase(),!E.hasOwnProperty(e))throw new Error("Localization "+e+" has not been loaded.");c.localize(E[e]),x=e}return x},c.localize=function(e){var t=c.rules;for(var r in e)t.hasOwnProperty(r)&&(t[r].message=e[r])},function(){var e={},t=c.rules;for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r].message);c.defineLocale("en-us",e)}(),x="en-us",f.applyBindingsWithValidation=function(e,t,r){var i,a=document.body;i=t&&t.nodeType?(a=t,r):t,c.init(),i&&(i=u(u({},c.configuration),i),c.utils.setDomData(a,i)),f.applyBindings(e,a)};var A=f.applyBindings;f.applyBindings=function(){c.init(),A.apply(this,arguments)},f.validatedObservable=function(e,t){if(!t&&!c.utils.isObject(e))return f.observable(e).extend({validatable:!0});var r=f.observable(e);return r.errors=c.group(c.utils.isObject(e)?e:{},t),r.isValid=f.observable(0===r.errors().length),f.isObservable(r.errors)?r.errors.subscribe(function(e){r.isValid(0===e.length)}):f.computed(r.errors).subscribe(function(e){r.isValid(0===e.length)}),r.subscribe(function(e){c.utils.isObject(e)||(e={}),r.errors._updateState(e),r.isValid(0===r.errors().length)}),r}}); 930//# sourceMappingURL=knockout-validation.min.js.map; 931/// Knockout Mapping plugin v2.4.1 932/// (c) 2013 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/ 933/// License: MIT (http://www.opensource.org/licenses/mit-license.php) 934(function(e){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?e(require("knockout"),exports
934):"function"===typeof define&&define.amd?define(["knockout","exports"],e):e(ko,ko.mapping={})})(function(e,f){function y(b,c){var a,d;for(d in c)if(c.hasOwnProperty(d)&&c[d])if(a=f.getType(b[d]),d&&b[d]&&"array"!==a&&"string"!==a)y(b[d],c[d]);else if("array"===f.getType(b[d])&&"array"===f.getType(c[d])){a=b;for(var e=d,l=b[d],n=c[d],t={},g=l.length-1;0<=g;--g)t[l[g]]=l[g];for(g= 935n.length-1;0<=g;--g)t[n[g]]=n[g];l=[];n=void 0;for(n in t)l.push(t[n]);a[e]=l}else b[d]=c[d]}function E(b,c){var a={};y(a,b);y(a,c);return a}function z(b,c){for(var a=E({},b),e=L.length-1;0<=e;e--){var f=L[e];a[f]&&(a[""]instanceof Object||(a[""]={}),a[""][f]=a[f],delete a[f])}c&&(a.ignore=h(c.ignore,a.ignore),a.include=h(c.include,a.include),a.copy=h(c.copy,a.copy),a.observe=h(c.observe,a.observe));a.ignore=h(a.ignore,j.ignore);a.include=h(a.include,j.include);a.copy=h(a.copy,j.copy);a.observe=h(a.observe, 936j.observe);a.mappedProperties=a.mappedProperties||{};a.copiedProperties=a.copiedProperties||{};return a}function h(b,c){"array"!==f.getType(b)&&(b="undefined"===f.getType(b)?[]:[b]);"array"!==f.getType(c)&&(c="undefined"===f.getType(c)?[]:[c]);return e.utils.arrayGetDistinctValues(b.concat(c))}function F(b,c,a,d,k,l,n){var t="array"===f.getType(e.utils.unwrapObservable(c));l=l||"";if(f.isMapped(b)){var g=e.utils.unwrapObservable(b)[p];a=E(g,a)}var j=n||k,h=function(){return a[d]&&a[d].create instanceof 937Function},x=function(b){var f=G,g=e.dependentObservable;e.dependentObservable=function(a,b,c){c=c||{};a&&"object"==typeof a&&(c=a);var d=c.deferEvaluation,M=!1;c.deferEvaluation=!0;a=new H(a,b,c);if(!d){var g=a,d=e.dependentObservable;e.dependentObservable=H;a=e.isWriteableObservable(g);e.dependentObservable=d;d=H({read:function(){M||(e.utils.arrayRemoveItem(f,g),M=!0);return g.apply(g,arguments)},write:a&&function(a){return g(a)},deferEvaluation:!0});d.__DO=g;a=d;f.push(a)}return a};e.dependentObservable.fn= 938H.fn;e.computed=e.dependentObservable;b=e.utils.unwrapObservable(k)instanceof Array?a[d].create({data:b||c,parent:j,skip:N}):a[d].create({data:b||c,parent:j});e.dependentObservable=g;e.computed=e.dependentObservable;return b},u=function(){return a[d]&&a[d].update instanceof Function},v=function(b,f){var g={data:f||c,parent:j,target:e.utils.unwrapObservable(b)};e.isWriteableObservable(b)&&(g.observable=b);return a[d].update(g)};if(n=I.get(c))return n;d=d||"";if(t){var t=[],s=!1,m=function(a){return a}; 939a[d]&&a[d].key&&(m=a[d].key,s=!0);e.isObservable(b)||(b=e.observableArray([]),b.mappedRemove=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.remove(function(a){return c(m(a))})},b.mappedRemoveAll=function(a){var c=C(a,m);return b.remove(function(a){return-1!=e.utils.arrayIndexOf(c,m(a))})},b.mappedDestroy=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.destroy(function(a){return c(m(a))})},b.mappedDestroyAll=function(a){var c=C(a,m);return b.destroy(function(a){return-1!= 940e.utils.arrayIndexOf(c,m(a))})},b.mappedIndexOf=function(a){var c=C(b(),m);a=m(a);return e.utils.arrayIndexOf(c,a)},b.mappedGet=function(a){return b()[b.mappedIndexOf(a)]},b.mappedCreate=function(a){if(-1!==b.mappedIndexOf(a))throw Error("There already is an object with the key that you specified.");var c=h()?x(a):a;u()&&(a=v(c,a),e.isWriteableObservable(c)?c(a):c=a);b.push(c);return c});n=C(e.utils.unwrapObservable(b),m).sort();g=C(c,m);s&&g.sort();s=e.utils.compareArrays(n,g);n={};var J,A=e.utils.unwrapObservable(c), 941y={},z=!0,g=0;for(J=A.length;g<J;g++){var r=m(A[g]);if(void 0===r||r instanceof Object){z=!1;break}y[r]=A[g]}var A=[],B=0,g=0;for(J=s.length;g<J;g++){var r=s[g],q,w=l+"["+g+"]";switch(r.status){case "added":var D=z?y[r.value]:K(e.utils.unwrapObservable(c),r.value,m);q=F(void 0,D,a,d,b,w,k);h()||(q=e.utils.unwrapObservable(q));w=O(e.utils.unwrapObservable(c),D,n);q===N?B++:A[w-B]=q;n[w]=!0;break;case "retained":D=z?y[r.value]:K(e.utils.unwrapObservable(c),r.value,m);q=K(b,r.value,m);F(q,D,a,d,b,w, 942k);w=O(e.utils.unwrapObservable(c),D,n);A[w]=q;n[w]=!0;break;case "deleted":q=K(b,r.value,m)}t.push({event:r.status,item:q})}b(A);a[d]&&a[d].arrayChanged&&e.utils.arrayForEach(t,function(b){a[d].arrayChanged(b.event,b.item)})}else if(P(c)){b=e.utils.unwrapObservable(b);if(!b){if(h())return s=x(),u()&&(s=v(s)),s;if(u())return v(s);b={}}u()&&(b=v(b));I.save(c,b);
942if(u())return b;Q(c,function(d){var f=l.length?l+"."+d:d;if(-1==e.utils.arrayIndexOf(a.ignore,f))if(-1!=e.utils.arrayIndexOf(a.copy,f))b[d]= 943c[d];else if("object"!=typeof c[d]&&"array"!=typeof c[d]&&0<a.observe.length&&-1==e.utils.arrayIndexOf(a.observe,f))b[d]=c[d],a.copiedProperties[f]=!0;else{var g=I.get(c[d]),k=F(b[d],c[d],a,d,b,f,b),g=g||k;if(0<a.observe.length&&-1==e.utils.arrayIndexOf(a.observe,f))b[d]=g(),a.copiedProperties[f]=!0;else{if(e.isWriteableObservable(b[d])){if(g=e.utils.unwrapObservable(g),b[d]()!==g)b[d](g)}else g=void 0===b[d]?g:e.utils.unwrapObservable(g),b[d]=g;a.mappedProperties[f]=!0}}})}else switch(f.getType(c)){case "function":u()? 944e.isWriteableObservable(c)?(c(v(c)),b=c):b=v(c):b=c;break;default:if(e.isWriteableObservable(b))return q=u()?v(b):e.utils.unwrapObservable(c),b(q),q;h()||u();b=h()?x():e.observable(e.utils.unwrapObservable(c));u()&&b(v(b))}return b}function O(b,c,a){for(var d=0,e=b.length;d<e;d++)if(!0!==a[d]&&b[d]===c)return d;return null}function R(b,c){var a;c&&(a=c(b));"undefined"===f.getType(a)&&(a=b);return e.utils.unwrapObservable(a)}function K(b,c,a){b=e.utils.unwrapObservable(b);for(var d=0,f=b.length;d< 945f;d++){var l=b[d];if(R(l,a)===c)return l}throw Error("When calling ko.update*, the key '"+c+"' was not found!");}function C(b,c){return e.utils.arrayMap(e.utils.unwrapObservable(b),function(a){return c?R(a,c):a})}function Q(b,c){if("array"===f.getType(b))for(var a=0;a<b.length;a++)c(a);else for(a in b)c(a)}function P(b){var c=f.getType(b);return("object"===c||"array"===c)&&null!==b}function T(){var b=[],c=[];this.save=function(a,d){var f=e.utils.arrayIndexOf(b,a);0<=f?c[f]=d:(b.push(a),c.push(d))}; 946this.get=function(a){a=e.utils.arrayIndexOf(b,a);return 0<=a?c[a]:void 0}}function S(){var b={},c=function(a){var c;try{c=a}catch(e){c="$$$"}a=b[c];void 0===a&&(a=new T,b[c]=a);return a};this.save=function(a,b){c(a).save(a,b)};this.get=function(a){return c(a).get(a)}}var p="__ko_mapping__",H=e.dependentObservable,B=0,G,I,L=["create","update","key","arrayChanged"],N={},x={include:["_destroy"],ignore:[],copy:[],observe:[]},j=x;f.isMapped=function(b){return(b=e.utils.unwrapObservable(b))&&b[p]};f.fromJS= 947function(b){if(0==arguments.length)throw Error("When calling ko.fromJS, pass the object you want to convert.");try{B++||(G=[],I=new S);var c,a;2==arguments.length&&(arguments[1][p]?a=arguments[1]:c=arguments[1]);3==arguments.length&&(c=arguments[1],a=arguments[2]);a&&(c=E(c,a[p]));c=z(c);var d=F(a,b,c);a&&(d=a);if(!--B)for(;G.length;){var e=G.pop();e&&(e(),e.__DO.throttleEvaluation=e.throttleEvaluation)}d[p]=E(d[p],c);return d}catch(f){throw B=0,f;}};f.fromJSON=function(b){var c=e.utils.parseJson(b); 948arguments[0]=c;return f.fromJS.apply(this,arguments)};f.updateFromJS=function(){throw Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");};f.updateFromJSON=function(){throw Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");};f.toJS=function(b,c){j||f.resetDefaultOptions();if(0==arguments.length)throw Error("When calling ko.mapping.toJS, pass the object you want to convert."); 949if("array"!==f.getType(j.ignore))throw Error("ko.mapping.defaultOptions().ignore should be an array.");if("array"!==f.getType(j.include))throw Error("ko.mapping.defaultOptions().include should be an array.");if("array"!==f.getType(j.copy))throw Error("ko.mapping.defaultOptions().copy should be an array.");c=z(c,b[p]);return f.visitModel(b,function(a){return e.utils.unwrapObservable(a)},c)};f.toJSON=function(b,c){var a=f.toJS(b,c);return e.utils.stringifyJson(a)};f.defaultOptions=function(){if(0<arguments.length)j= 950arguments[0];else return j};f.resetDefaultOptions=function(){j={include:x.include.slice(0),ignore:x.ignore.slice(0),copy:x.copy.slice(0)}};f.getType=function(b){if(b&&"object"===typeof b){if(b.constructor===Date)return"date";if(b.constructor===Array)return"array"}return typeof b};f.visitModel=function(b,c,a){a=a||{};a.visitedObjects=a.visitedObjects||new S;var d,k=e.utils.unwrapObservable(b);if(P(k))a=z(a,k[p]),c(b,a.parentName),d="array"===f.getType(k)?[]:{};else return c(b,a.parentName);a.visitedObjects.save(b, 951d);var l=a.parentName;Q(k,function(b){if(!(a.ignore&&-1!=e.utils.arrayIndexOf(a.ignore,b))){var j=k[b],g=a,h=l||"";"array"===f.getType(k)?l&&(h+="["+b+"]"):(l&&(h+="."),h+=b);g.parentName=h;if(!(-1===e.utils.arrayIndexOf(a.copy,b)&&-1===e.utils.arrayIndexOf(a.include,b)&&k[p]&&k[p].mappedProperties&&!k[p].mappedProperties[b]&&k[p].copiedProperties&&!k[p].copiedProperties[b]&&"array"!==f.getType(k)))switch(f.getType(e.utils.unwrapObservable(j))){case "object":case "array":case "undefined":g=a.visitedObjects.get(j); 952d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.parentName)}}});return d}}); 953; 954!function(d,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((d="undefined"!=typeof globalThis?globalThis:d||self).libphonenumber={})}(this,(function(d){"use strict";var t={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6],0,0,0,0,0,0,0,[["6[2-467]\\d{3}",[5]],["4\\d{4}",[5]],0,0,0,0,["(?:0[1-9]|[1589]\\d)\\d{4}",[6]]]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[["[78]\\d{5}",[6]],["690\\d{6}|[356]\\d{5}",[6,9]],["180[02]\\d{4}",[8]],["[19]\\d{5}",[6]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4}
954)","$1 $2 $3",["5"],"0$1"]],"0",0,0,0,0,0,[["[2-4679][2-8]\\d{6}",[8]],["5[024-68]\\d{7}",[9]],["400\\d{6}|800\\d{2,9}"],["900[02]\\d{5}",[9]],0,0,["600[25]\\d{5}",[9]],0,0,["700[05]\\d{5}",[9]]]],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0",0,0,0,0,0,[["(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}"],["7\\d{8}"]]],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268",[["268(?:4(?:6[0-38]|84)|56[0-2])\\d{4}"],["268(?:464|7(?:1[3-9]|[28]\\d|3[0246]|64|7[0-689]))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["26840[69]\\d{4}"],["26848[01]\\d{4}"]]],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264",[["264(?:292|4(?:6[12]|9[78]))\\d{4}"],["264(?:235|4(?:69|76)|5(?:3[6-9]|8[1-4])|7(?:29|72))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["264724\\d{4}"]]],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0",0,0,0,0,0,[["4505[0-2]\\d{3}|(?:[2358][16-9]\\d[2-9]|4410)\\d{4}|(?:[2358][2-5][2-9]|4(?:[2-57-9][2-9]|6\\d))\\d{5}",[8]],["6(?:[78][2-9]|9\\d)\\d{6}",[9]],["800\\d{4}",[7]],["900[1-9]\\d\\d",[6]],["700[2-9]\\d{4}",[8]],0,0,0,0,["808[1-9]\\d\\d",[6]]]],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:1[0-25]|47)\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2)\\d{5}"],["(?:33|4[1349]|55|77|88|9[13-9])\\d{6}"],["800\\d{5}"],["90[016]\\d{5}"],0,0,0,0,["60(?:2[78]|3[5-9]|4[02-9]|5[0-46-9]|[6-8]\\d|9[0-2])\\d{4}"],["80[1-4]\\d{5}"]]],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]],0,0,0,0,0,0,[["2\\d(?:[0134][25-9]|[25-9]\\d)\\d{5}"],["9[1-59]\\d{7}"]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-4
9546-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1",0,0,[["3888[013-9]\\d{5}|3(?:7(?:1[15]|81)|8(?:21|4[16]|69|9[12]))[46]\\d{5}|(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}|(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:(?:11[1-8]|670)\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-8]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6])))\\d{6}|2(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}",[10]],["93(?:7(?:1[15]|81)[46]|8(?:(?:21|4[16]|69|9[12])[46]|88[013-9]))\\d{5}|9(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}
954|9(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|9(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|9(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:675\\d|9(?:11[1-8]\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-8]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6]))))\\d{6}|92(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|9(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|9(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}"],["800\\d{7,8}"],["60[04579]\\d{7}",[10]],0,0,["810\\d{7}",[10]]]],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684",[["6846(?:22|33|44|55|77|88|9[19])\\d{4}"],["684(?:2(?:48|5[2468]|7[26])|7(?:3[13]|70|82))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0",0,0,0,0,0,[["1(?:11\\d|[2-9]\\d{3,11})|(?:316|463|(?:51|66|73)2)\\d{3,10}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-578]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|7[1368]|8[2457])|5(?:2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[135-8]|5[468])|7(?:2[1-8]|35|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{4,10}"],["6(?:5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}",[7,8,9,10,11,12,13]],["800\\d{6,10}",[9,10,11,12,13]],["(?:8[69][2-68]|9(?:0[01]|3[019]))\\d{6,10}",[9,10,11,12,13]],0,0,0,0,["5(?:0[1-9]|17|[79]\\d)\\d{2,10}|7[28]0\\d{6,10}",[5,6,7,8,9,10,11,12,13]],["8(?:10|2[018])\\d{6,10}|828\\d{5}",[8,9,10,11,12,13]]]],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-26-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]],0,0,0,0,0,0,[["5(?:2\\d|8[1-9])\\d{4}"],["(?:290|5[69]\\d|6(?:[03]0|22|4[0-2]|[69]\\d)|7(?:[34]\\d|7[07])|9(?:6[45]|9[4
954-8]))\\d{4}"],["800\\d{4}"],["900\\d{4}"],0,0,0,0,["(?:28\\d|501)\\d{4}"]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",[["18[1-8]\\d{3,6}",[6,7,8,9]],["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}",[6,7,8,9,10]],["800\\d{4,6}",[7,8,9]],["[67]00\\d{5,6}",[8,9]],0,0,["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]],"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[12]428|3655[02])\\d{4}|(?:2(?:22[0-79]|63[0-28])|3654)\\d{5}|(?:(?:1[28]|46)\\d|2(?:[014-6]2|[23]3))\\d{6}"],["36554\\d{4}|(?:[16]0|4[04]|5[015]|7[07]|99)\\d{7}"],["88\\d{7}"],["900200\\d{3}"]]],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:[05-79][2-9]|1[4579]|[23][24-9]|4[2-4689]|8[2457-9])|49[2-579]|5(?:0[2-49]|[13][2-9]|[268][2-4679]|4[4689]|5[2-79]|7[2-69]|9[2-4689]))\\d{5}",[8]],["6040\\d{5}|6(?:03|[1-356]|44|7\\d)\\d{6}"],["8[08]\\d{6}",[8]],["9[0246]\\d{6}",[8]],0,0,["703[235]0\\d{3}|70(?:2[0-5]|3[0146]|[56]0)\\d{4}",[8]],0,0,["8[12]\\d{6}",[8]]]],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246",[["246521[0369]\\d{3}|246(?:2(?:2[78]|7[0-4])|4(?:1[024-6]|2\\d|3[2-9])|5(?:20|[34]\\d|54|7[1-3])|6(?:2\\d|38)|7[35]7|9(?:1[89]|63))\\d{4}"],["246(?:(?:2(?:[3568]\\d|4[0-57-9])|3(?:5[2-9]|6[0-6])|4(?:46|5\\d)|69[5-7]|8(?:[2-5]\\d|83))\\d|52(?:1[147]|20))\\d{3}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["(?:246976|900[2-9]\\d\\d)\\d{4}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,["246(?:292|367|4(?:1[7-9]|3[01]|4[47-9]|67)|7(?:1[2-9]|2\\d|3[016]|53))\\d{4}"],0,["24631\\d{5}"]]],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0",0,0,0,0,0,[["(?:4(?:31\\d\\d|423)|5222)\\d{3}(?:\\d{2})?|8332[6-9]\\d\\d|(?:3(?:03[56]|224)|4(?:22[25]|653))\\d{3,4}|(?:3(?:42[47]|529|823)|4(?:027|525|65(?:28|8))|562|6257|7(?:1(?:5[3-5]|6[12]|7[156]|89)|22[589]56|32|42675|52(?:[25689](?:56|8)|[347]8)|71(?:6[1267]|75|89)|92374)|82(?:2[59]|32)56|9(?:03[23]56|23(?:256|373)|31|5(?:1|2[4589]56)))\\d{3}|(?:3(?:02[348]|22[35]|324|422)|4(?:22[67]|32[236-9]|6(?:2[46]|5[57])|953)|5526|6(?:024|6655)|81)\\d{4,5}|(?:2(?:7(?:1[0-267]|2[0-289]|3[0-29]|4[01]|5[1-3]|6[013]|7[0178]|91)|8(?:0[125]|1[1-6]|2[0157-9]|3[1-69]|41|6[1-35]|7[1-5]|8[1-8]|9[0-6])|9(?:0[0-2]|1[0-4]|2[568]|3[3-6]|5[5-7]|6[0136-9]|7[0-7]|8[014-9]))|3(?:0(?:2[025-79]|3[2-4])|181|22[12]|32[2356]|824)|4(?:02[09]|22[348]|32[045]|523|6(?:27|54))|666(?:22|53)|7(?:22[57-9]|42[56]|82[35])8|8(?:0[124-9]|2(?:181|2[02-4679]8)|4[12]|[5-7]2)|9(?:[04]2|2(?:2|328)|81))\\d{4}|(?:2(?:222|[45]\\d)\\d|3(?:1(?:2[5-7]|[5-7])|425|822)|4(?:033|1\\d|[257]1|332|4(?:2[246]|5[25])|6(?:2[35]|56|62)|8(?:23|54)|92[2-5])|5(?:02[03489]|22[457]|32[35-79]|42[46]|6(?:[18]|53)|724|826)|6(?:023|2(?:2[2-5]|5[3-5]|8)|32[3478]|42[34]|52[47]|6(?:[18]|6(?:2[34]|5[24]))|[78]2[2-5]|92[2-6])|7(?:02|21\\d|[3-589]1|6[12]|72[24])|8(?:217|3[12]|[5-7]1)|9[24]1)\\d{5}|(?:(?:3[2-8]|5[2-57-9]|6[03-589])1|4[4689][18])\\d{5}|[59]1\\d{5}"],["(?:1[13-9]\\d|644)\\d{7}|(?:3[78]|44|66)[02-9]\\d{7}",[10]],["80[03]\\d{7}",[10]],0,0,0,0,0,["96(?:0[469]|1[0-47]|3[389]|43|6[69]|7[78])\\d{6}",[10]]]],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0",0,0,0,0,0,[["80[2-8]\\d{5}|(?:1[0-69]|[23][2-8]|4[23]|5\\d|6[013-57-9]|71|8[1-79]|9[2-4])\\d{6}",[8]],["4[5-9]\\d{7}",[9]],["800[1-9]\\d{4}",[8]],["(?:70(?:2[0-57]|3[04-7]|44|6[4-69]|7[0579])|90\\d\\d)\\d{4}",[8]],0,0,["78(?:0[57]|1[014-8]|2[25]|3[15-8]|48|[56]0|7[06-8]|9\\d)\\d{4}",[8]],0,0,["7879\\d{4}",[8]]]],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]],0,0,0,0,0,0,[["2(?:0(?:49|5[23]|6[5-7]|9[016-9])|4(?:4[569]|5[4-6]|6[5-7]|7[01
95479])|5(?:[34]\\d|50|6[5-7]))\\d{4}"],["(?:0[1-35-7]|5[0-8]|[67]\\d)\\d{6}"]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["2\\d{5,7}|(?:43[1-6]|70[1-9])\\d{4,5}|(?:[36]\\d|4[124-7]|[57][1-9]|8[1-6]|9[1-7])\\d{5,6}",[6,7,8]],["(?:43[07-9]|99[69]\\d)\\d{5}|(?:8[7-9]|98)\\d{7}",[8,9]],["(?:00800\\d\\d|800)\\d{5}",[8,12]],["90\\d{6}",[8]],0,0,0,0,0,["700\\d{5}",[8]]]],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]],0,0,0,0,0,0,[["(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|7[7-9]|88)|9[69][69])|7(?:[07]\\d\\d|1(?:11|78)))\\d{4}"],["(?:3(?:[0-79]\\d|8[0-57-9])\\d|6(?:3(?:00|33|6[16])|441|6(?:3[03-9]|[69]\\d|7[0-6])))\\d{4}"],["8[02369]\\d{6}"],["(?:87|9[0-8])\\d{6}"],0,0,0,0,0,["84\\d{6}"]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]],0,0,0,0,0,0,[["(?:22|31)\\d{6}"],["(?:29|[67][125-9])\\d{6}"]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]],0,0,0,0,0,0,[["2(?:02|1[037]|2[45]|3[68]|4\\d)\\d{5}"],["(?:4[0-356]|[56]\\d|9[013-9])\\d{6}"],0,0,0,0,["81\\d{6}"],0,["857[58]\\d{4}"]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441",[["441(?:[46]\\d\\d|5(?:4\\d|60|89))\\d{4}"],["441(?:[2378]\\d|5[0-39]|92)\\d{5}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]],0,0,0,0,0,0,[["22[0-7]\\d{4}|(?:2[013-9]|[34]\\d|5[0-25-9])\\d{5}"],["(?:22[89]|[78]\\d\\d)\\d{4}"],0,0,0,0,0,0,["5[34]\\d{5}"]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?",0,0,0,[["(?:2(?:2\\d\\d|5(?:11|[258]\\d|9[67])|6(?:12|2\\d|9[34])|8(?:2[34]|39|62))|3(?:3\\d\\d|4(?:6\\d|8[24])|8(?:25|42|5[257]|86|9[25])|9(?:[27]\\d|3[2-4]|4[248]|5[24]|6[2-6]))|4(?:4\\d\\d|6(?:11|[24689]\\d|72)))\\d{4}",[8]],["[67]\\d{7}",[8]],["8001[07]\\d{4}",[9]]]],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]",[["(?:318[023]|41(?:6[023]|70)|7(?:1[578]|2[05]|50)\\d)\\d{3}"],["(?:31(?:8[14-8]|9[14578])|416[14-9]|7(?:0[01]|7[07]|8\\d|9[056])\\d)\\d{3}"]]],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2",0,0,[["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}",[10]],["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])(?:7|9\\d)\\d{7}",[10,11]],["800\\d{6,7}",[9,10]],["300\\d{6}|[59]00\\d{6,7}",[9,10]],0,0,0,0,0,["(?:30[03]\\d{3}|4(?:0(?:0\\d|20)|370))\\d{4}|300\\d{5}",[8,10]]]],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242",[["242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[347]|8[0-4]|9[2-467])|461|502|6(?:0[1-5]|12|2[013]|[45]0|7[67]|8[78]|9[89])|7(?:02|88))\\d{4}"],["242(?:3(?:5[79]|7[56]|95)|4(?:[23][1-9]|4[1-35-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-46-9]|65|77)|6[34]6|7(?:27|38)|8(?:0[1-9]|1[02-9]|2\\d|[89]9))\\d{4}"],["242300\\d{4}|8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,["242225\\d{4}"]]],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]],0,0,0,0,0,0,[["(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}",[7]],["(?:1[67]|77)\\d{6}",[8]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0-35-9]|55|[69]\\d|7[013]|81)|4(?:6[03]|7[1267]|9[0-5])|5(?:3[03489]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}",[7]],["(?:321|7[1-8]\\d)\\d{5}",[8]],["(?:0800|800\\d)\\d{6}",[10]],["90\\d{5}",[7]],0,0,0,0,["79(?:1(?:[01]\\d|2[0-7])|2[0-7]\\d)\\d{3}",[8]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,[["(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d\\d)|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}",[9]],["(?:2(?:5[5-79]|9[1-9])|(?:33|44)\\d)\\d{6}",[9]],["800\\d{3,7}|8(?:0[13]|20\\d)\\d{7}"],["(?:810|902)\\d{7}",[10]],0,0,0,0,["249\\d{6}",[9]]],"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]],0,0,0,0,0,0,[["(?:2(?:[02]\\d|36|[68]0)|[3-58](?:[02]\\d|[68]0)|7(?:[02]\\d|32|[68]0))\\d{4}",[7]],["6[0-35-7]\\d{5}",[7]],["0800\\d{7}",[11]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-26-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["12\\d{7}|[1-6]\\d{6}"],["88\\d{5}|(?:8[0-59]|9[017-9])\\d{7}"]]],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]],0,0,0,0,0,0,[["2[12]\\d{6}"],["7[024-7]\\d{6}"],0,["8776\\d{4}"]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]],0,0,0,0,0,0,[["222[1-589]\\d{5}"],["026(?:1[0-5]|6[6-9])\\d{4}|0(?:[14-6]\\d\\d|2(?:40|5[5-8]|6[07-9]))\\d{5}"],0,["80[0-2]\\d{6}"]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:2[12467]|3[1-4]|4[134]|5[256]|6[12]|[7-9]1)\\d{7}"],["7[35-9]\\d{7}"],["800\\d{6}"],["90[016]\\d{6}"],["878\\d{6}"],0,["5[18]\\d{7}"],["74[0248]\\d{6}"],0,["84[0248]\\d{6}"]]],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]],0,0,0,0,0,0,[["2(?:[15]\\d{3}|7(?:2(?:0[23]|1[2357]|2[245]|3[45]|4[3-5])|3(?:06|1[69]|[2-6]7)))\\d{5}"],["0[157]\\d{8}"]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]],0,0,0,0,0,0,[["(?:2\\d|3[13-7]|4[1-5])\\d{3}"],["[578]\\d{4}"]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]],0,0,0,0,0,0,[["2(?:1982[0-6]|3314[05-9])\\d{3}|(?:2(?:1(?:160|962)|3(?:2\\d\\d|3(?:[03467]\\d|1[0-35-9]|2[1-9]|5[0-24-9]|8[0-3])|600)|646[59])|80[1-9]\\d\\d|9(?:3(?:[0-57-9]\\d\\d|6(?:0[02-9]|[1-9]\\d))|6(?:[0-8]\\d\\d|9(?:[02-79]\\d|1[05-9]))|7[1-9]\\d\\d|9(?:[03-9]\\d\\d|1(?:[0235-9]\\d|4[0-24-9])|2(?:[0-79]\\d|8[0-46-9]))))\\d{4}|(?:22|3[2-5]|[47][1-35]|5[1-3578]|6[13-57]|8[1-9]|9[2458])\\d{7}",[9]],["",[9]],["(?:123|8)00\\d{6}",[9,11]],0,0,0,0,0,["44\\d{7}",[9]],["600\\d{7,8}",[10,11]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]],0,0,0,0,0,0,[["2(?:22|33)\\d{6}",[9]],["(?:24[23]|6[25-9]\\d)\\d{6}",[9]],["88\\d{6,7}"]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4}
954)","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,[["(?:10(?:[02-79]\\d\\d|[18](?:0[1-9]|[1-9]\\d))|21(?:[18](?:0[1-9]|[1-9]\\d)|[2-79]\\d\\d))\\d{5}|(?:43[35]|754)\\d{7,8}|8(?:078\\d{7}|51\\d{7,8})|(?:10|(?:2|85)1|43[35]|754)(?:100\\d\\d|95\\d{3,4})|(?:2[02-57-9]|3(?:11|7[179])|4(?:[15]1|3[12])|5(?:1\\d|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[57]|6[09])|8(?:71|98))(?:[02-8]\\d{7}|1(?:0(?:0\\d\\d(?:\\d{3})?|[1-9]\\d{5})|[1-9]\\d{6})|9(?:[0-46-9]\\d{6}|5\\d{3}(?:\\d(?:\\d{2})?)?))|(?:3(?:1[02-9]|35|49|5\\d|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|3[46-9]|5[2-9]|6[47-9]|7\\d|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[17]\\d|2[248]|3[04-9]|4[3-6]|5[0-3689]|6[2368]|9[02-9])|8(?:1[236-8]|2[5-7]|3\\d|5[2-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[02-8]\\d{6}|1(?:0(?:0\\d\\d(?:\\d{2})?|[1-9]\\d{4})|[1-9]\\d{5})|9(?:[0-46-9]\\d{5}|5\\d{3,5}))",[7,8,9,10,11]],["1740[0-5]\\d{6}|1(?:[38]\\d|4[57]|[59][0-35-9]|6[25-7]|7[0-35-8])\\d{8}",[11]],["(?:(?:10|21)8|8)00\\d{7}",[10,12]],["16[08]\\d{5}",[8]],0,0,0,0,0,["10(?:10\\d{4}|96\\d{3,4})|400\\d{7}|950\\d{7,8}|(?:2[0-57-9]|3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))96\\d{3,4}",[7,8,9,10,11]]],"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?",0,0,0,[["601055(?:[0-4]\\d|50)\\d\\d|6010(?:[0-4]\\d|5[0-4])\\d{4}|60(?:[124-7][2-9]|8[1-9])\\d{6}",[10]],["333301[0-5]\\d{3}|3333(?:00|2[5-9]|[3-9]\\d)\\d{4}|(?:3(?:24[1-9]|3(?:00|3[0-24-9]))|9101)\\d{6}|3(?:0[0-5]|1\\d|2[0-3]|5[01]|70)\\d{7}",[10]],["1800\\d{7}",[11]],["19(?:0[01]|4[78])\\d{7}",[11]]]],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))",0,0,0,[["210[7-9]\\d{4}|2(?:[024-7]\\d|1[1-9])\\d{5}",[8]],["(?:3005\\d|6500[01])\\d{3}|(?:5[07]|6[0-4]|7[0-3]|8[3-9])\\d{6}",[8]],["800\\d{7}",[10]],["90[059]\\d{7}",[10]],0,0,0,0,["(?:210[0-6]|4\\d{3}|5100)\\d{4}",[8]]]],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:3[23]|4[89])\\d{4,6}|(?:31|4[36]|8(?:0[25]|78)\\d)\\d{6}|(?:2[1-4]|4[1257]|7\\d)\\d{5,6}"],["(?:5\\d|63)\\d{6}",[8]],["800\\d{7}",[10]],0,0,0,0,0,0,["807\\d{7}",[10]]]],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]],0,0,0,0,0,0,[["2(?:2[1-7]|3[0-8]|4[12]|5[1256]|6\\d|7[1-3]|8[1-5])\\d{4}"],["(?:36|5[1-389]|9\\d)\\d{5}"],["800\\d{4}"],0,0,0,0,0,["(?:3[3-5]|4[356])\\d{5}"]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]",[["9(?:4(?:3[0-5]|4[14]|6\\d)|50\\d|7(?:2[014]|3[02-9]|4[4-9]|6[357]|77|8[7-9])|8(?:3[39]|[46]\\d|7[01]|8[57-9]))\\d{4}"],["953[01]\\d{4}|9(?:5[12467]|6[5-9])\\d{5}"],0,0,0,0,0,["955\\d{5}",[8]],0,["60[0-2]\\d{4}",[7]]]],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-26-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]],0,0,0,0,0,0,[["2[2-6]\\d{6}"],["9(?:10|[4-79]\\d)\\d{5}"],["800\\d{5}"],["90[09]\\d{5}"],["700\\d{5}"],0,["(?:50|77)\\d{6}"],0,0,["80[1-9]\\d{5}"]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,[["(?:2\\d|3[1257-9]|4[16-9]|5[13-9])\\d{7}"],["(?:60[1-8]|7(?:0[2-5]|[2379]\\d))\\d{6}"],["800\\d{6}"],["9(?:0[05689]|76)\\d{6}"],["70[01]\\d{6}"],0,["9(?:5\\d|7[2-4])\\d{6}"],0,["9[17]0\\d{6}"],["8[134]\\d{7}"]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0",0,0,0,0,0,[["32\\d{9,11}|49[1-6]\\d{10}|322\\d{6}|49[0-7]\\d{3,9}|(?:[34]0|[68]9)\\d{3,13}|(?:2(?:0[1-689]|[1-3569]\\d|4[0-8]|7[1-7]|8[0-7])|3(?:[3569]\\d|4[0-79]|7[1-7]|8[1-8])|4(?:1[02-9]|[2-48]\\d|5[0-6]|6[0-8]|7[0-79])|5(?:0[2-8]|[124-6]\\d|[38][0-8]|[79][0-7])|6(?:0[02-9]|[1-358]\\d|[47][0-8]|6[1-9])|7(?:0[2-8]|1[1-9]|[27][0-7]|3\\d|[4-6][
9540-8]|8[0-5]|9[013-7])|8(?:0[2-9]|1[0-79]|2\\d|3[0-46-9]|4[0-6]|5[013-9]|6[1-8]|7[0-8]|8[0-24-6])|9(?:0[6-9]|[1-4]\\d|[589][0-7]|6[0-8]|7[0-467]))\\d{3,12}",[5,6,7,8,9,10,11,12,13,14,15]],["15[0-25-9]\\d{8}|1(?:6[023]|7\\d)\\d{7,8}",[10,11]],["800\\d{7,12}",[10,11,12,13,14,15]],["(?:137[7-9]|900(?:[135]|9\\d))\\d{6}",[10,11]],["700\\d{8}",[11]],0,["18(?:1\\d{5,11}|[2-9]\\d{8})",[8,9,10,11,12,13,14]],["16(?:4\\d{1,10}|[89]\\d{1,11})",[4,5,6,7,8,9,10,11,12,13,14]],0,["180\\d{5,11}|13(?:7[1-6]\\d\\d|8)\\d{4}",[7,8,9,10,11,12,13,14]]]],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]],0,0,0,0,0,0,[["2(?:1[2-5]|7[45])\\d{5}"],["77\\d{6}"]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]],0,0,0,0,0,0,[["(?:[2-7]\\d|8[126-9]|9[1-46-9])\\d{6}"],[""],["80\\d{6}"],["90\\d{6}"]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767",[["767(?:2(?:55|66)|4(?:2[01]|4[0-25-9])|50[0-4])\\d{4}"],["767(?:2(?:[2-4689]5|7[5-7])|31[5-7]|61[1-8]|70[1-6])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9",[["8(?:[04]9[2-9]\\d\\d|29(?:2(?:[0-59]\\d|6[04-9]|7[0-27]|8[0237-9])|3(?:[0-35-9]\\d|4[7-9])|[45]\\d\\d|6(?:[0-27-9]\\d|[3-5][1-9]|6[0135-8])|7(?:0[013-9]|[1-37]\\d|4[1-35689]|5[1-4689]|6[1-57-9]|8[1-79]|9[1-8])|8(?:0[146-9]|1[0-48]|[248]\\d|3[1-79]|5[01589]|6[013-68]|7[124-8]|9[0-8])|9(?:[0-24]\\d|3[02-46-9]|5[0-79]|60|7[0169]|8[57-9]|9[02-9])))\\d{4}"],["8[024]9[2-9]\\d{6}"],["8(?:00(?:14|[2-9]\\d)|(?:33|44|55|66|77|88)[2-9]\\d)\\d{5}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0",0,0,0,0,0,[["9619\\d{5}|(?:1\\d|2[013-79]|3[0-8]|4[013-689])\\d{6}"],["(?:5(?:4[0-29]|5\\d|6[0-2])|6(?:[569]\\d|7[0-6])|7[7-9]\\d)\\d{6}",[9]],["800\\d{6}",[9]],["80[3-689]1\\d{5}",[9]],0,0,0,0,["98[23]\\d{6}",[9]],["80[12]1\\d{5}",[9]]]],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["[2-7][2-7]\\d{6}",[8]],["964[0-2]\\d{5}|9(?:39|[57][89]|6[0-36-9]|[89]\\d)\\d{6}",[9]],["1800\\d{7}|1[78]00\\d{6}",[10,11]],0,0,0,0,0,["[2-7]890\\d{4}",[8]]]],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:3[23589]|4[3-8]|6\\d|7[1-9]|88)\\d{5}",[7]],["(?:5\\d{5}|8(?:1(?:0(?:000|[3-9]\\d\\d)|(?:1(?:0[236]|1\\d)|(?:2[0-59]|[3-79]\\d)\\d)\\d)|2(?:0(?:000|(?:19|[2-7]\\d)\\d)|(?:(?:[124-6]\\d|3[5-9])\\d|7(?:[
9540-79]\\d|8[13-9])|8(?:[2-6]\\d|7[01]))\\d)|[349]\\d{4}))\\d\\d|5(?:(?:[02]\\d|5[0-478])\\d|1(?:[0-8]\\d|95)|6(?:4[0-4]|5[1-589]))\\d{3}",[7,8]],["800(?:(?:0\\d\\d|1)\\d|[2-9])\\d{3}"],["(?:40\\d\\d|900)\\d{4}",[7,8]],["70[0-2]\\d{5}",[8]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0",0,0,0,0,0,[["13[23]\\d{6}|(?:15|57)\\d{6,7}|(?:2[2-4]|3|4[05-8]|5[05]|6[24-689]|8[2468]|9[235-7])\\d{7}",[8,9]],["1[0-25]\\d{8}",[10]],["800\\d{7}",[10]],["900\\d{7}",[10]]]],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]",[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1[12568]|[24]0|55|6[146])|8\\d\\d)\\d{4}"],["(?:17[1-3]|7\\d\\d)\\d{4}"]]],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]],0,0,0,0,0,0,[["96906(?:0[0-8]|1[1-9]|[2-9]\\d)\\d\\d|9(?:69(?:0[0-57-9]|[1-9]\\d)|73(?:[0-8]\\d|9[1-9]))\\d{4}|(?:8(?:[1356]\\d|[28][0-8]|[47][1-9])|9(?:[135]\\d|[268][0-8]|4[1-9]|7[124-9]))\\d{6}"],["(?:590[16]00\\d|9(?:6906(?:09|10)|7390\\d\\d))\\d\\d|(?:6\\d|7[1-48])\\d{7}"],["[89]00\\d{6}"],["80[367]\\d{6}"],["70\\d{7}"],0,["51\\d{7}"],0,0,["90[12]\\d{6}"]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0",0,0,0,0,0,[["11667[01]\\d{3}|(?:11(?:1(?:1[124]|2[2-7]|3[1-5]|5[5-8]|8[6-8])|2(?:13|3[6-8]|5[89]|7[05-9]|8[2-6])|3(?:2[01]|3[0-289]|4[1289]|7[1-4]|87)|4(?:1[69]|3[2-49]|4[0-3]|6[5-8])|5(?:1[578]|44|5[0-4])|6(?:1[578]|2[69]|39|4[5-7]|5[0-5]|6[0-59]|8[015-8]))|2(?:2(?:11[1-9]|22[0-7]|33\\d|44[1467]|66[1-68])|5(?:11[124-6]|33[2-8]|44[1467]|55[14]|66[1-3679]|77[124-79]|880))|3(?:3(?:11[0-46-8]|(?:22|55)[0-6]|33[0134689]|44[04]|66[01467])|4(?:44[0-8]|55[0-69]|66[0-3]|77[1-5]))|4(?:6(?:119|22[0-24-7]|33[1-5]|44[13-69]|55[14-689]|660|88[1-4])|7(?:(?:11|22)[1-9]|33[13-7]|44[13-6]|55[1-689]))|5(?:7(?:227|55[05]|(?:66|77)[14-8])|8(?:11[149]|22[013-79]|33[0-68]|44[013-8]|550|66[1-5]|77\\d)))\\d{4}"],["700[1-9]\\d{5}|(?:7(?:0[1-9]|1[0-8]|22|77|86|99)|9\\d\\d)\\d{6}"]]],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",[["(?:1[3-79][1-8]|[235689][1-8]\\d)\\d{2,6}",[5,6,7,8,9]],["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}",[6,7,8,9,10]],["800\\d{4,6}",[7,8,9]],["[67]00\\d{5,6}",[8,9]],0,0,["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]],"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,[["603\\d{4}|(?:3[0-5]|6[25-7]|8[58])\\d{5}",[7]],["(?:[279]\\d|45|5[01568]|8[034679])\\d{5}",[7]],["0800\\d{7}",[11]]],"00"],FK:["500","00","[2-7]\\d{4}",[5],0,0,0,0,0,0,0,[["[2-47]\\d{4}"],["[56]\\d{4}"]]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]],0,0,0,0,0,0,[["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-6]\\d)\\d)\\d{3}"],["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-7]\\d)\\d)\\d{3}"]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))",0,0,0,[["(?:20|[34]\\d|8[19])\\d{4}"],["(?:[27][1-9]|5\\d|9[16])\\d{4}"],["80[257-9]\\d{3}"],["90(?:[13-5][15-7]|2[125-7]|9\\d)\\d\\d"],0,0,0,0,["(?:6[0-36]|88)\\d{4}"]]],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0",0,0,0,0,0,[["59[1-9]\\d{6}|(?:[1-3]\\d|4[1-9]|5[0-8])\\d{7}"],["(?:6(?:[0-24-8]\\d|3[0-8]|9[589])|7[3-9]\\d)\\d{6}"],["80[0-5]\\d{6}"],["836(?:0[0-36-9]|[1-9]\\d)\\d{4}|8(?:1[2-9]|2[2-47-9]|3[0-57-9]|[569]\\d|8[0-35-9])\\d{6}"],0,0,["80[6-9]\\d{6}"],0,["9\\d{8}"],["8(?:1[01]|2[0156]|4[02]|84)\\d{6}"]]],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1",0,0,[["[01]1\\d{6}",[8]],["(?:(?:0[2-7]|7[467])\\d|6(?:0[0-4]|10|[256]\\d))\\d{5}|[2-7]\\d{6}"]]],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])
954))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473",[["473(?:2(?:3[0-2]|69)|3(?:2[89]|86)|4(?:[06]8|3[5-9]|4[0-49]|5[5-79]|73|90)|63[68]|7(?:58|84)|800|938)\\d{4}"],["473(?:4(?:0[2-79]|1[04-9]|2[0-5]|58)|5(?:2[01]|3[3-8])|901)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:[256]\\d|4[124-9]|7[0-4])|4(?:1\\d|2[2-7]|3[1-79]|4[2-8]|7[239]|9[1-7]))\\d{6}"],["5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:00(?:0\\d|11|22|33|44|5[05]|77|88|99)|1(?:1(?:00|[124]\\d|3[01])|4\\d\\d)|(?:44|68)\\d\\d|5(?:[0157-9]\\d\\d|200)|7(?:[0147-9]\\d\\d|5(?:00|[57]5))|8(?:0(?:[018]\\d|2[0-4])|58[89]|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}|5(?:0(?:070|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|(?:40[04]|900)0|5222)[0-4]\\d{3}"],["800\\d{6}"],0,0,0,0,0,["70[67]\\d{6}"]]],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0",0,0,0,0,0,[["594(?:[02-49]\\d|1[0-4]|5[6-9]|6[0-3]|80)\\d{4}"],["694(?:[0-249]\\d|3[0-8])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:396|76\\d)\\d|476[0-5])\\d{4}"]]],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0",0,0,0,0,0,[["3082[0-5]\\d{4}|3(?:0(?:[237]\\d|8[01])|[167](?:2[0-6]|7\\d|80)|2(?:2[0-5]|7\\d|80)|3(?:2[0-3]|7\\d|80)|4(?:2[013-9]|3[01]|7\\d|80)|5(?:2[0-7]|7\\d|80)|8(?:2[0-2]|7\\d|80)|9(?:[28]0|7\\d))\\d{5}",[9]],["(?:2(?:[0346-9]\\d|5[67])|5(?:[03-7]\\d|9[1-9]))\\d{6}",[9]],["800\\d{5}",[8]]]],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]],0,0,0,0,0,0,[["2190[0-2]\\d{3}|2(?:0(?:[02]\\d|3[01])|16[24-9]|2[2-5]\\d)\\d{4}"],["5251[0-4]\\d{3}|(?:5(?:[146-8]\\d\\d|250)|60(?:1[01]|6\\d))\\d{4}"]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]],0,0,0,0,0,0,[["(?:19|3[1-7]|[68][1-9]|70|9\\d)\\d{4}"],["[245]\\d{5}"],["80\\d{4}"],0,0,0,0,0,["3[89]\\d{4}"]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]],0,0,0,0,0,0,[["(?:4(?:[23]\\d\\d|4(?:1[024679]|[6-9]\\d))|5(?:5(?:3\\d|4[0-7])|6[67]\\d|7(?:1[04]|2[035]|3[58]|48))|8\\d{3})\\d{3}"],["(?:[23679]\\d|5[0-489])\\d{5}"]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]],0,0,0,0,0,0,[["3(?:0(?:24|3[12]|4[1-35-7]|5[13]|6[189]|[78]1|9[1478])|1\\d\\d)\\d{4}",[8]],["6[0-356]\\d{7}",[9]],0,0,0,0,0,0,["722\\d{6}",[9]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]],0,0,0,0,0,0,[["33[0-24-9]\\d[46]\\d{4}|3(?:33|5\\d)\\d[7-9]\\d{4}"],["(?:222|55\\d)\\d{6}"],["80\\d[1-9]\\d{5}"],["90\\d[1-9]\\d{5}
954"]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["2(?:1\\d\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\d|2[1-5]|[34][1-4]|9[1-57]))\\d{6}",[10]],["68[57-9]\\d{7}|(?:69|94)\\d{8}",[10]],["800\\d{7,9}"],["90[19]\\d{7}",[10]],["70\\d{8}",[10]],0,["5005000\\d{3}",[10]],0,0,["8(?:0[16]|12|[27]5|50)\\d{7}",[10]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[["[267][2-9]\\d{6}",[8]],["[3-5]\\d{7}",[8]],["18[01]\\d{8}",[11]],["19\\d{9}",[11]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671",[["671(?:3(?:00|3[39]|4[349]|55|6[26])|4(?:00|56|7[1-9]|8[02-46-9])|5(?:55|6[2-5]|88)|6(?:3[2-578]|4[24-9]|5[34]|78|8[235-9])|7(?:[0479]7|2[0167]|3[45]|8[7-9])|8(?:[2-57-9]8|6[48])|9(?:2[29]|6[79]|7[1279]|8[7-9]|9[78]))\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]],0,0,0,0,0,0,[["443\\d{6}",[9]],["9(?:5\\d|6[569]|77)\\d{6}",[9]],0,0,0,0,0,0,["40\\d{5}",[7]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|510|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]],0,0,0,0,0,0,[["(?:2(?:1[6-9]|2[0-35-9]|3[1-4]|5[3-9]|6\\d|7[0-24-79])|3(?:2[25-9]|3\\d)|4(?:4[0-24]|5[56]
954)|77[1-57])\\d{4}"],["(?:510|6\\d\\d|7(?:0\\d|1[0-8]|25|49))\\d{4}"],["(?:289|862)\\d{4}"],["9008\\d{3}"]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,[["(?:2(?:[13-9]\\d|2[013-9])\\d|3(?:(?:[1569][0-24-9]|4[0-246-9]|7[0-24-69])\\d|8(?:[45][0-8]|6[01]|9\\d))|58(?:0[1-9]|1[2-9]))\\d{4}",[8]],["(?:4(?:44[5-9]|6(?:0[0-7]|1[0-6]|4[0-57-9]|6[0-4]|7[0-8]))|573[0-6]|6(?:26[013-8]|66[0-3])|70(?:7[1-5]|8[0-4])|848[015-9]|9(?:29[013-9]|59[0-4]))\\d{4}|(?:4(?:4[01]|6[2358])|5(?:[1-59][0-46-9]|6[0-4689]|7[0-246-9])|6(?:0[1-9]|[13-59]\\d|[268][0-57-9]|7[0-79])|84[09]|9(?:0[1-9]|1[02-9]|[2358][0-8]|[467]\\d))\\d{5}",[8]],["800\\d{6}",[9]],["900(?:[0-24-9]\\d{7}|3\\d{1,4})",[5,6,7,8,11]],["8(?:1[0-4679]\\d|2(?:[0-36]\\d|7[0-4])|3(?:[034]\\d|2[09]|70))\\d{4}",[8]],0,["30(?:0[1-9]|[15-7]\\d|2[047]|89)\\d{4}",[8]],["7(?:1(?:0[0-38]|1[0-3679]|3[013]|69|9[0136])|2(?:[02389]\\d|1[18]|7[27-9])|3(?:[0-38]\\d|7[0-369]|9[2357-9])|47\\d|5(?:[178]\\d|5[0-5])|6(?:0[0-7]|2[236-9]|[35]\\d)|7(?:[27]\\d|8[7-9])|8(?:[23689]\\d|7[1-9])|9(?:[025]\\d|6[0-246-8]|7[0-36-9]|8[238]))\\d{4}",[8]]],"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]],0,0,0,0,0,0,[["2(?:2(?:0[0-59]|1[1-9]|[23]\\d|4[02-6]|5[57]|6[245]|7[0135689]|8[01346-9]|9[0-2])|4(?:0[578]|2[3-59]|3[13-9]|4[0-68]|5[1-3589])|5(?:0[2357-9]|1[1-356]|4[03-5]|5\\d|6[014-69]|7[04]|80)|6(?:[056]\\d|17|2[067]|3[047]|4[0-378]|[78][0-8]|9[01])|7(?:0[5-79]|6[46-9]|7[02-9]|8[034]|91)|8(?:79|8[0-357-9]|9[1-57-9]))\\d{4}",[8]],["[37-9]\\d{7}",[8]],["8002\\d{7}",[11]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["1\\d{7}|(?:2[0-3]|3[1-5]|4[02-47-9]|5[1-3])\\d{6,7}",[8,9]],["9(?:(?:0[1-9]|[12589]\\d)\\d\\d|7(?:[0679]\\d\\d|5(?:[01]\\d|44|77|9[67])))\\d{4}|98\\d{6}",[8,9]],["80[01]\\d{4,6}",[7,8,9]],["6[01459]\\d{6}|6[01]\\d{4,5}",[6,7,8]],["7[45]\\d{6}",[8]],0,["62\\d{6,7}|72\\d{6}",[8,9]]]],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]],0,0,0,0,0,0,[["2(?:2\\d|5[1-5]|81|9[149])\\d{5}"],["(?:[34]\\d|55)\\d{6}"],["8\\d{7}"],0,0,0,0,0,["9(?:[67][0-4]|8[0-3589]|9\\d)\\d{5}"]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06",0,0,0,0,0,[["(?:1\\d|[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6[23689]|8[2-57-9]|9[2-69])\\d{6}",[8]],["(?:[257]0|3[01])\\d{7}",[9]],["(?:[48]0\\d|680[29])\\d{5}"],["9[01]\\d{6}",[8]],0,0,["38\\d{7}",[9]],0,["21\\d{7}",[9]]]],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0",0,0,0,0,0,[["2[124]\\d{7,8}|619\\d{8}|2(?:1(?:14|500)|2\\d{3})\\d{3}|61\\d{5,8}|(?:2(?:[35][1-4]|6[0-8]|7[1-6]|8\\d|9[1-8])|3(?:1|[25][1-8]|3[1-68]|4[1-3]|6[1-3568]|7[0-469]|8\\d)|4(?:0[1-589]|1[01347-9]|2[0-36-8]|3[0-24-68]|43|5[1-378]|6[1-5]|7[134]|8[1245])|5(?:1[1-35-9]|2[25-8]|3[124-9]|4[1-3589]|5[1-46]|6[1-8])|6(?:[25]\\d|3[1-69]|4[1-6])|7(?:02|[125][1-9]|[36]\\d|4[1-8]|7[0-36-9])|9(?:0[12]|1[013-8]|2[0-479]|5[125-8]|6[23679]|7[159]|8[01346]))\\d{5,8}",[7,8,9,10,11]],["8[1-35-9]\\d{7,10}",[9,10,11,12]],["00[17]803\\d{7}|(?:177\\d|800)\\d{5,7}|001803\\d{6}",[8,9,10,11,12,13]],["809\\d{7}",[10]],0,0,["(?:1500|8071\\d{3})\\d{3}",[7,10]],0,0,["804\\d{7}",[10]]]],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:1\\d|21)\\d{6,7}|(?:2[24-9]|4(?:0[24]|5\\d|7)|5(?:0[45]|1\\d|8)|6(?:1\\d|[237-9])|9(?:1\\d|[35-9]))\\d{5}|(?:23|4(?:[1-469]|8\\d)|5[23679]|6[4-6]|7[14]|9[04])\\d{7}"],["8(?:22|[35-9]\\d)\\d{6}",[9]],["1800\\d{6}",[10]],["15(?:1[2-8]|[2-8]0|9[089])\\d{6}",[10]],["700\\d{6}",[9]],0,["818\\d{6}",[9]],0,["76\\d{7}",[9]],["18[59]0\\d{6}",[10]]]],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0",0,0,0,0,0,[["153\\d{8,9}|29[1-9]\\d{5}|(?:2[0-8]|[3489]\\d)\\d{6}",[8,11,12]],["55410\\d{4}|5(?:(?:[02][02-9]|[149][2-9]|[36]\\d|8[3-7])\\d|5(?:01|2\\d|3[0-3]|4[34]|5[0-25689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}",[9]],["1(?:255|80[019]\\d{3})\\d{3}",[7,10]],["1212\\d{4}|1(?:200|9(?:0[0-2]|19))\\d{6}",[8,10]],0,0,["1599\\d{6}",[10]],0,["7(?:38(?:0\\d|5[09]|88)|8(?:33|55|77|81)\\d)\\d{4}|7(?:18|2[23]|3[237]|47|6[258]|7\\d|82|9[2-9])\\d{6}",[9]],["1700\\d{6}",[10]]]],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24",[["1624(?:230|[5-8]\\d\\d)\\d{3}"],["76245[06]\\d{4}|7(?:4576|[59]24\\d|624[0-4689])\\d{5}"],["808162\\d{4}"],["8(?:440[49]06|72299\\d)\\d{3}|(?:8(?:45|70)|90[0167])624\\d{4}"],["70\\d{8}"],0,["3440[49]06\\d{3}|(?:3(?:08162|3\\d{4}|45624|7(?:0624|2299))|55\\d{4})\\d{4}"],0,["56\\d{8}"]]],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2
954-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0",0,0,0,0,0,[["2717(?:[2-7]\\d|95)\\d{4}|(?:271[0-689]|782[0-6])[2-7]\\d{5}|(?:170[24]|2(?:(?:[02][2-79]|90)\\d|80[13468])|(?:3(?:23|80)|683|79[1-7])\\d|4(?:20[24]|72[2-8])|552[1-7])\\d{6}|(?:11|33|4[04]|80)[2-7]\\d{7}|(?:342|674|788)(?:[0189][2-7]|[2-7]\\d)\\d{5}|(?:1(?:2[0-249]|3[0-25]|4[145]|[59][14]|6[014]|7[1257]|8[01346])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568]|9[14])|3(?:26|4[13]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[014-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|2[14]|3[134]|4[47]|5[15]|[67]1)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91))[2-7]\\d{6}|(?:1(?:2[35-8]|3[346-9]|4[236-9]|[59][0235-9]|6[235-9]|7[34689]|8[257-9])|2(?:1[134689]|3[24-8]|4[2-8]|5[25689]|6[2-4679]|7[3-79]|8[2-479]|9[235-9])|3(?:01|1[79]|2[1245]|4[5-8]|5[125689]|6[235-7]|7[157-9]|8[2-46-8])|4(?:1[14578]|2[5689]|3[2-467]|5[4-7]|6[35]|73|8[2689]|9[2389])|5(?:[16][146-9]|2[14-8]|3[1346]|4[14-69]|5[46]|7[2-4]|8[2-8]|9[246])|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])|7(?:1[013-9]|2[0235-9]|3[2679]|4[1-35689]|5[2-46-9]|[67][02-9]|8[013-7]|9[089])|8(?:1[1357-9]|2[235-8]|3[03-57-9]|4[0-24-9]|5\\d|6[2457-9]|7[1-6]|8[1256]|9[2-4]))\\d[2-7]\\d{5}",[10]],["(?:61279|7(?:887[02-9]|9(?:313|79[07-9]))|8(?:079[04-9]|(?:84|91)7[02-8]))\\d{5}|(?:6(?:12|[2-47]1|5[17]|6[13]|80)[0189]|7(?:1(?:2[0189]|9[0-5])|2(?:[14][017-9]|8[0-59])|3(?:2[5-8]|[34][017-9]|9[016-9])|4(?:1[015-9]|[29][89]|39|8[389])|5(?:[15][017-9]|2[04-9]|9[7-9])|6(?:0[0-47]|1[0-257-9]|2[0-4]|3[19]|5[4589])|70[0289]|88[089]|97[02-8])|8(?:0(?:6[67]|7[02-8])|70[017-9]|84[01489]|91[0-289]))\\d{6}|(?:7(?:31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[0189]\\d|7[02-8])\\d{5}|(?:6(?:[09]\\d|1[04679]|2[03689]|3[05-9]|4[0489]|50|6[069]|7[07]|8[7-9])|7(?:0\\d|2[0235-79]|3[05-8]|40|5[0346-8]|6[6-9]|7[1-9]|8[0-79]|9[089])|8(?:0[01589]|1[0-57-9]|2[235-9]|3[03-57-9]|[45]\\d|6[02457-9]|7[1-69]|8[0-25-9]|9[02-9])|9\\d\\d)\\d{7}|(?:6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|8[124-6])\\d|7(?:[235689]\\d|4[0189]))|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-5])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]|881))[0189]\\d{5}",[10]],["000800\\d{7}|1(?:600\\d{6}|80(?:0\\d{4,9}|3\\d{9}))"],["186[12]\\d{9}",[13]],0,0,["140\\d{7}",[10]],0,0,["1860\\d{7}",[11]]]],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]],0,0,0,0,0,0,[["37\\d{5}"],["38\\d{5}"]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["1\\d{7}|(?:2[13-5]|3[02367]|4[023]|5[03]|6[026])\\d{6,7}",[8,9]],["7[3-9]\\d{8}",[10]]]],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0",0,0,0,0,0,[["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])(?:[03-57]\\d{7}|[16]\\d{3}(?:\\d{4})?|[289]\\d{3}(?:\\d(?:\\d{3})?)?)|94(?:000[09]|2(?:121|[2689]0\\d)|30[0-2]\\d|4(?:111|40\\d))\\d{4}",[6,7,10]],["9(?:(?:0(?:[0-35]\\d|4[4-6])|(?:[13]\\d|2[0-3])\\d)\\d|9(?:[0-46]\\d\\d|5[15]0|8(?:[12]\\d|88)|9(?:0[0-3]|[19]\\d|21|69|77|8[7-9])))\\d{5}",[10]],0,0,0,0,["96(?:0[12]|2[16-8]|3(?:08|[14]5|[23]|66)|4(?:0|80)|5[01]|6[89]|86|9[19])",[4,5]]]],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["(?:4(?:1[0-24-69]|2[0-7]|[37][0-8]|4[0-24589]|5[0-68]|6\\d|8[0-36-8])|5(?:05|[156]\\d|2[02578]|3[0-579]|4[03-7]|7[0-2578]|8[0-35-9]|9[013-689])|872)\\d{4}",[7]],["(?:38[589]\\d\\d|6(?:1[1-8]|2[0-6]|3[026-9]|4[014679]|5[0159]|6[0-69]|70|8[06-8]|9\\d)|7(?:5[057]|[6-9]\\d)|8(?:2[0-59]|[3-69]\\d|8[238]))\\d{4}"],["80[0-8]\\d{4}",[7]],["90(?:0\\d|1[5-79]|2[015-79]|3[135-79]|4[125-7]|5[25-79]|7[1-37]|8[0-35-7])\\d{3}",[7]],0,0,["809\\d{4}",[7]],0,["49[0-24-79]\\d{4}",[7]]],"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876",[["8766060\\d{3}|(?:658(?:2(?:[0-8]\\d|9[0-46-9])|[3-9]\\d\\d)|876(?:52[35]|6(?:0[1-3579]|1[0235-9]|[23]\\d|40|5[06]|6[2-589]|7[0-25-9]|8[04]|9[4-9])|7(?:0[2-689]|[1-6]\\d|8[056]|9[45])|9(?:0[1-8]|1[02378]|[2-8]\\d|9[2-468])))\\d{4}"],["(?:658295|876(?:2(?:0[1-9]|[13-9]\\d|2[013-9])|[348]\\d\\d|5(?:0[1-9]|[1-9]\\d)|6(?:4[89]|6[
95467])|7(?:0[07]|7\\d|8[1-47-9]|9[0-36-9])|9(?:[01]9|9[0579])))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["87(?:000|90[01])\\d{3}|(?:2(?:6(?:2[0-35-9]|3[0-578]|4[24-7]|5[0-24-8]|[6-8][023]|9[0-3])|7(?:0[1-79]|10|2[014-7]|3[0-689]|4[019]|5[0-3578]))|32(?:0[1-69]|1[1-35-7]|2[024-7]|3\\d|4[0-3]|[5-7][023])|53(?:0[0-3]|[13][023]|2[0-59]|49|5[0-35-9]|6[15]|7[45]|8[1-6]|9[0-36-9])|6(?:2(?:[05]0|22)|3(?:00|33)|4(?:0[0-25]|1[2-7]|2[0569]|[38][07-9]|4[025689]|6[0-589]|7\\d|9[0-2])|5(?:[01][056]|2[034]|3[0-57-9]|4[178]|5[0-69]|6[0-35-9]|7[1-379]|8[0-68]|9[0239]))|87(?:20|7[078]|99))\\d{4}",[8]],["7(?:[78][0-25-9]|9\\d)\\d{6}",[9]],["80\\d{6}",[8]],["9\\d{7}",[8]],["70\\d{7}",[9]],0,["8(?:10|8\\d)\\d{5}",[8]],["74(?:66|77)\\d{5}",[9]],0,["85\\d{6}",[8]]]],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1",0,0,[["(?:1(?:1[235-8]|2[3-6]|3[3-9]|4[2-6]|[58][2-8]|6[2-7]|7[2-9]|9[1-9])|(?:2[2-9]|[36][1-9])\\d|4(?:[2-578]\\d|6[02-8]|9[2-59])|5(?:[2-589]\\d|6[1-9]|7[2-8])|7(?:[25-9]\\d|3[4-9]|4[02-9])|8(?:[2679]\\d|3[2-9]|4[5-9]|5[1-9]|8[03-9])|9(?:[2-58]\\d|[679][1-9]))\\d{6}",[9]],["[7-9]0[1-9]\\d{7}",[10]],["00777(?:[01]|5\\d)\\d\\d|(?:00(?:7778|882[1245])|(?:120|800\\d)\\d\\d)\\d{4}|00(?:37|66|78)\\d{6,13}"],["990\\d{6}",[9]],["60\\d{7}",[9]],0,["570\\d{6}",[9]],["20\\d{8}",[10]],["50[1-9]\\d{7}",[10]]]],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["(?:4[245]|5[1-79]|6[01457-9])\\d{5,7}|(?:4[136]|5[08]|62)\\d{7}|(?:[24]0|66)\\d{6,7}",[7,8,9]],["(?:1(?:0[0-6]|1[0-5]|2[014]|30)|7\\d\\d)\\d{6}",[9]],["800[2-8]\\d{5,6}",[9,10]],["900[02-9]\\d{5}",[9]]]],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["312(?:5[0-79]\\d|9(?:[0-689]\\d|7[0-24-9]))\\d{3}|(?:3(?:1(?:2[0-46-8]|3[1-9]|47|[56]\\d)|2(?:22|3[0-479]|6[0-7])|4(?:22|5[6-9]|6\\d)|5(?:22|3[4-7]|59|6\\d)|6(?:22|5[35-7]|6\\d)|7(?:22|3[468]|4[1-9]|59|[67]\\d)|9(?:22|4[1-8]|6\\d))|6(?:09|12|2[2-4])\\d)\\d{5}",[9]],["312(?:58\\d|973)\\d{3}|(?:2(?:0[0-35]|2\\d)|5[0-24-7]\\d|600|7(?:[07]\\d|55)|88[08]|9(?:12|9[05-9]))\\d{6}",[9]],["800\\d{6,7}"]]],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["23(?:4(?:[2-4]|[56]\\d)|[568]\\d\\d)\\d{4}|23[236-9]\\d{5}
954|(?:2[4-6]|3[2-6]|4[2-4]|[5-7][2-5])(?:(?:[237-9]|4[56]|5\\d)\\d{5}|6\\d{5,6})",[8,9]],["(?:(?:1[28]|3[18]|9[67])\\d|6[016-9]|7(?:[07-9]|[16]\\d)|8(?:[013-79]|8\\d))\\d{6}|(?:1\\d|9[0-57-9])\\d{6}|(?:2[3-6]|3[2-6]|4[2-4]|[5-7][2-5])48\\d{5}",[8,9]],["1800(?:1\\d|2[019])\\d{4}",[10]],["1900(?:1\\d|2[09])\\d{4}",[10]]]],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0",0,0,0,0,0,[["(?:[24]\\d|3[1-9]|50|65(?:02[12]|12[56]|22[89]|[3-5]00)|7(?:27\\d\\d|3100|5(?:02[12]|12[56]|22[89]|[34](?:00|81)|500))|8[0-5])\\d{3}"],["(?:6200[01]|7(?:310[1-9]|5(?:02[03-9]|12[0-47-9]|22[0-7]|[34](?:0[1-9]|8[02-9])|50[1-9])))\\d{3}|(?:63\\d\\d|7(?:(?:[0146-9]\\d|2[0-689])\\d|3(?:[02-9]\\d|1[1-9])|5(?:[0-2][013-9]|[34][1-79]|5[1-9]|[6-9]\\d)))\\d{4}",[8]],0,0,0,0,0,0,["30(?:0[01]\\d\\d|12(?:11|20))\\d\\d",[8]]]],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]],0,0,0,0,0,0,[["7[4-7]\\d{5}"],["[34]\\d{6}"],0,["8\\d{6}"]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869",[["869(?:2(?:29|36)|302|4(?:6[015-9]|70)|56[5-7])\\d{4}"],["869(?:48[89]|55[6-8]|66\\d|76[02-7])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:195|2)\\d|3[19]|4[159]|5[37]|6[17]|7[39]|85)\\d{6}"],["19[1-3]\\d{7}",[10]]]],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?",0,0,0,[["(?:2|3[1-3]|[46][1-4]|5[1-5])[1-9]\\d{6,7}|(?:3[1-3]|[46][1-4]|5[1-5])1\\d{2,3}",[5,6,8,9,10]],["1(?:05(?:[0-8]\\d|9[0-6])|22[13]\\d)\\d{4,5}|1(?:0[0-46-9]|[16-9]\\d|2[013-9])\\d{6,7}",[9,10]],["00(?:308\\d{6,7}|798\\d{7,9})|(?:00368|80)\\d{7}",[9,11,12,13,14]],["60[2-9]\\d{6}",[9]],["50\\d{8,9}",[10,11]],0,["1(?:5(?:22|33|44|66|77|88|99)|6(?:[07]0|44|6[168]|88)|8(?:00|33|55|77|99))\\d{4}",[8]],["15\\d{7,8}",[9,10]],["70\\d{8}",[10]]]],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]],0,0,0,0,0,0,[["2(?:[23]\\d\\d|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7]))\\d{4}",[8]],["(?:41\\d\\d|5(?:(?:[05]\\d|1[0-7]|6[56])\\d|2(?:22|5[25])|7(?:55|77)|88[58])|6(?:(?:0[034679]|5[015-9]|6\\d)\\d|1(?:00|11|66)|222|3[36]3|444|7(?:0[013-9]|[67]\\d)|888|9(?:[069]\\d|3[039]))|9(?:(?:0[09]|[4679]\\d|8[057-9])\\d|1(?:1[01]|99)|2(?:00|2\\d)|3(?:00|3[03])|5(?:00|5\\d)))\\d{4}",[8]],["18\\d{5}",[7]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345",[["345(?:2(?:22|3[23]|44|66)|333|444|6(?:23|38|40)|7(?:30|4[35-79]|6[6-9]|77)|8(?:00|1[45]|[48]8)|9(?:14|4[035-9]))\\d{4}"],["345(?:32[1-9]|42[0-4]|5(?:1[67]|2[5-79]|4[6-9]|50|76)|649|82[56]|9(?:1[679]|2[2-9]|3[06-9]|90))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["(?:345976|900[2-9]\\d\\d)\\d{4}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["345849\\d{4}"]]],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",[["(?:33622|7(?:1(?:0(?:[23]\\d|4[0-3]|59|63)|1(?:[23]\\d|4[0-79]|59)|2(?:[23]\\d|59)|3(?:2\\d|3[0-79]|4[0-35-9]|59)|4(?:[24]\\d|3[013-9]|5[1-9]|97)|5(?:2\\d|3[1-9]|4[0-7]|59)|6(?:[2-4]\\d|5[19]|61)|72\\d|8(?:[27]\\d|3[1-46-9]|4[0-5]|59))|2(?:1(?:[23]\\d|4[46-9]|5[3469])|2(?:2\\d|3[0679]|46|5[12679])|3(?:[2-4]\\d|5[139])|4(?:2\\d|3[1-35-9]|59)|5(?:[23]\\d|4[0-8]|59|61)|6(?:2\\d|3[1-9]|4[0-4]|59)|7(?:[2379]\\d|40|5[279])|8(?:[23]\\d|4[0-3]|59)|9(?:2\\d|3[124578]|59))))\\d{5}",[10]],["7(?:0[0-25-8]|47|6[0-4]|7[15-8]|85)\\d{7}",[10]],["8(?:00|108\\d{3})\\d{7}"],["809\\d{7}",[10]],["808\\d{7}",[10]],0,0,0,["751\\d{7}",[10]]],"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[13]|[35-7][14]|41|8[1468])\\d{6}",[8]],["(?:20(?:[2359]\\d|7[6-8]|88)|302\\d)\\d{6}",[10]],0,0,0,0,["30[013-9]\\d{6}",[9]]]],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0",0,0,0,0,0,[["7(?:62|8[0-7]|9[04-9])\\d{4}|(?:[14-69]\\d|2(?:[14-69]\\d|[78][1-9])|7[2-57]|8[02-9])\\d{5}"],["793(?:[01]\\d|2[0-4])\\d{3}
954|(?:(?:3|81)\\d|7(?:[01]\\d|6[013-9]|8[89]|9[12]))\\d{5}"],0,["9[01]\\d{6}",[8]],0,0,0,0,0,["80\\d{6}",[8]]]],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758",[["758(?:234|4(?:30|5\\d|6[2-9]|8[0-2])|57[0-2]|(?:63|75)8)\\d{4}"],["758(?:28[4-7]|384|4(?:6[01]|8[4-9])|5(?:1[89]|20|84)|7(?:1[2-9]|2\\d|3[0-3])|812)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0",0,0,0,[["(?:2(?:01|1[27]|2[02]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}",[7]],["(?:6(?:(?:4[5-9]|5[0-469])\\d|6(?:[0245]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}"],["8002[28]\\d\\d|80(?:05\\d|9)\\d{4}"],["90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",[7]],0,0,["870(?:28|87)\\d\\d",[7]]]],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0",0,0,0,0,0,[["(?:12[2-9]|602|8[12]\\d|9(?:1\\d|22|9[245]))\\d{6}|(?:11|2[13-7]|3[1-8]|4[157]|5[12457]|6[35-7])[2-57]\\d{6}"],["7(?:[0-25-8]\\d|4[0-4])\\d{6}"],0,0,0,0,["1973\\d{5}"]]],LR:["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0",0,0,0,0,0,[["2\\d{7}",[8]],["(?:(?:(?:22|33)0|555|(?:77|88)\\d)\\d|4[67])\\d{5}|[56]\\d{6}",[7,9]],0,["332(?:02|[34]\\d)\\d{4}",[9]]]],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]],0,0,0,0,0,0,[["2\\d{7}"],["[56]\\d{7}"],["800[256]\\d{4}"]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]",0,0,0,[["(?:3[1478]|4[124-6]|52)\\d{6}"],["6\\d{7}"],["80[02]\\d{5}"],["9(?:0[0239]|10)\\d{5}"],["70[05]\\d{5}"],0,["70[67]\\d{5}"],0,["[89]01\\d{5}"],["808\\d{5}"]]],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)",0,0,0,[["(?:35[013-9]|80[2-9]|90[89])\\d{1,8}|(?:2[2-9]|3[0-46-9]|[457]\\d|8[13-9]|9[2-579])\\d{2,9}"],["6(?:[269][18]|5[1568]|7[189]|81)\\d{6}",[9]],["800\\d{5}",[8]],["90[015]\\d{5}",[8]],0,0,0,0,["20(?:1\\d{5}|[2-689]\\d{1,7})",[4,5,6,7,8,9,10]],["801\\d{5}",[8]]]],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]],0,0,0,0,0,0,[["6\\d{7}"],["23(?:23[0-57-9]|33[0238])\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[024-9]|3[0-24-9]))\\d{4}"],["80\\d{6}"],["90\\d{6}"],0,0,0,0,0,["81\\d{6}"]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:0[56]|[1-6]\\d|7[124579]|8[124])|3(?:1\\d|2[2356])|4(?:[17]\\d|2[1-357]|5[2-4]|8[124])|5(?:[1347]\\d|2[1-469]|5[13-5]|8[1-4])|6(?:[1-479]\\d|5[2-57]|8[1-5])|7(?:[13]\\d|2[13-79])|8(?:[124]\\d|5[124]|84))\\d{6}"],["9[1-6]\\d{7}"]]],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0",0,0,0,0,0,[["(?:870|9[2-47-9]\\d)\\d{5}",[8]],["4(?:[46]\\d|5[1-9])\\d{5}|(?:3|6\\d)\\d{7}"],["(?:800|90\\d)\\d{5}",[8]]]],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:2[1-9]|3[1-79])\\d|5(?:33|5[257]))\\d{5}"],["562\\d{5}|(?:6\\d|7[16-9])\\d{6}"],["800\\d{5}"],["90[056]\\d{5}"],0,0,["803\\d{5}"],0,["3[08]\\d{6}"],["808\\d{5}
954"]]],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:20[2-8]|3(?:[0-2][2-7]|3[24-7])|4(?:0[2-467]|1[2467])|5(?:0[2467]|1[24-7]|2[2-467]))\\d{5}",[8]],["6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}",[8]],["80(?:[0-2578]|9\\d)\\d{5}"],["9(?:4[1568]|5[178])\\d{5}",[8]],0,0,["77[1-9]\\d{5}",[8]],0,["78[1-49]\\d{5}",[8]]]],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1",0,0,[["2072[29]\\d{4}|20(?:2\\d|4[47]|5[3467]|6[279]|7[35]|8[268]|9[245])\\d{5}"],["3[2-47-9]\\d{7}"],0,0,0,0,0,0,["22\\d{7}"]]],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1",0,0,0,0,0,[["(?:247|45[78]|528|625)\\d{4}"],["(?:(?:23|54)5|329|45[356])\\d{4}"],0,0,0,0,0,0,["635\\d{4}"]]],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:2(?:62|77)0|3444)\\d|4[56]440)\\d{3}|(?:34|4[357])700\\d{3}|(?:2(?:[0-3]\\d|5[0-578]|6[01]|82)|3(?:1[3-68]|[23][2-68]|4[23568])|4(?:[23][2-68]|4[3-68]|5[2568]|6[25-8]|7[24-68]|8[4-68]))\\d{5}"],["7(?:3555|(?:474|9[019]7)7)\\d{3}|7(?:[0-25-8]\\d\\d|3(?:[1-48]\\d|60|7[01578])|4(?:2\\d|60|7[01578])|9(?:[2-4]\\d|5[01]|7[015]))\\d{4}"],["800\\d{5}"],["5\\d{7}"],0,0,0,0,0,["8(?:0[1-9]|[1-9]\\d)\\d{5}"]]],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]],0,0,0,0,0,0,[["2(?:07[0-8]|12[67])\\d{4}|(?:2(?:02|1[4-689])|4(?:0[0-4]|4[1-39]))\\d{5}"],["2(?:0(?:01|79)|17\\d)\\d{4}|(?:5[01]|[679]\\d|8[2-49])\\d{6}"],["80\\d{6}"]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:(?:2\\d|3[56]|[89][0-6])\\d|4(?:2[29]|62|7[0-2]|83)|6)|2(?:2(?:00|8[34])|4(?:0\\d|[26]2|7[0-2]|83)|51\\d\\d)|4(?:2(?:2\\d\\d|48[013])|3(?:20\\d|4(?:70|83)|56)|420\\d|5470)|6(?:0(?:[23]|88\\d)|(?:124|[56]2\\d)\\d|2472|3(?:20\\d|470)|4(?:2[04]\\d|472)|7(?:(?:3\\d|8[01459])\\d|4[67]0)))\\d{4}|5(?:2(?:2\\d{5,6}|47[02]\\d{4})|(?:3472|4(?:2(?:1|86)|470)|522\\d|6(?:20\\d|483)|7(?:20\\d|48[01])|8(?:20\\d|47[02])|9(?:20\\d|470))\\d{4})|7(?:(?:0470|4(?:25\\d|470)|5(?:202|470|96\\d))\\d{4}|1(?:20\\d{4,5}|4(?:70|83)\\d{4}))|8(?:1(?:2\\d{5,6}|4(?:10|7[01]\\d)\\d{3})|2(?:2\\d{5,6}|(?:320|490\\d)\\d{3})|(?:3(?:2\\d\\d|470)|4[24-7]|5(?:(?:2\\d|51)\\d|4(?:[1-35-9]\\d|4[0-57-9]))|6[23])\\d{4})|(?:1[2-6]\\d|4(?:2[24-8]|3[2-7]|[46][2-6]|5[3-5])|5(?:[27][2-8]|3[2-68]|4[24-8]|5[23]|6[2-4]|8[24-7]|9[2-7])|6(?:[19]20|42[03-6]|(?:52|7[45])\\d)|7(?:[04][24-8]|[15][2-7]|22|3[2-4])|8(?:1[2-689]|2[2-8]|[35]2\\d))\\d{4}|25\\d{5,6}|(?:2[2-9]|6(?:1[2356]|[24][2-6]|3[24-6]|5[2-4]|6[2-8]|7[235-7]|8[245]|9[24])|8(?:3[24]|5[245]))\\d{4}",[6,7,8,9]],["(?:17[01]|9(?:2(?:[0-4]|[56]\\d\\d)|(?:3(?:[0-36]|4\\d)|(?:6\\d|8[89]|9[4-8])\\d|7(?:3|40|[5-9]\\d))\\d|4(?:(?:[0245]\\d|[1379])\\d|88)|5[0-6])\\d)\\d{4}|9[69]1\\d{6}|9(?:[68]\\d|9[089])\\d{5}",[7,8,9,10]],["80080(?:0[1-9]|2\\d)\\d{3}",[10]],0,0,0,0,0,["1333\\d{4}|[12]468\\d{4}",[8]]]],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0",0,0,0,0,0,[["[12]2[1-3]\\d{5,6}|(?:(?:[12](?:1|27)|5[368])\\d\\d|7(?:0(?:[0-5]\\d|7[078]|80)|128))\\d{4}|[12](?:3[2-8]|4[2-68]|5[1-4689])\\d{6,7}"],["(?:83[01]|92[039])\\d{5}|(?:5[05]|6[069]|8[015689]|9[013-9])\\d{6}",[8]],0,0,0,0,0,0,["712[0-79]\\d{4}|7(?:1[013-9]|[25-9]\\d)\\d{5}",[8]]]],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]],0,0,0,0,0,0,[["(?:28[2-9]|8(?:11|[2-57-9]\\d))\\d{5}",[8]],["6800[0-79]\\d{3}|6(?:[235]\\d\\d|6(?:0[0-5]|[1-9]\\d)|8(?:0[1-9]|[14-8]\\d|2[5-9]|[39][0-4]))\\d{4}",[8]],["0800\\d{3}",[7]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670",[["670(?:2(?:3[3-7]|56|8[4-8])|32[1-38]|4(?:33|8[348])|5(?:32|55|88)|6(?:64|70|82)|78[3589]|8[3-9]8|989)\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["596(?:[03-7]\\d|10|2[7-9]|8[0-39]|9[04-9])\\d{4}"],["69(?:6(?:[0-46-9]\\d|5[0-6])|727)\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:397[0-2]|477[0-5]|76(?:6\\d|7[0-367]))\\d{4}"]]],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]],0,0,0,0,0,0,[["(?:25[08]|35\\d|45[1-7])\\d{5}"],["[2-4][0-46-9]\\d{6}"],["800\\d{5}"]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664",[["6644(?:1[0-3]|91)\\d{4}"],["664(?:3(?:49|9[1-6])|49[2-6])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]],0,0,0,0,0,0,[["20(?:3[1-4]|6[059])\\d{4}|2(?:0[19]|[1-357]\\d|60)\\d{5}"],["(?:7(?:210|[79]\\d\\d)|9(?:[29]\\d\\d|69[67]|8(?:1[1-3]|89|97)))\\d{4}"],["800(?:02|[3467]\\d)\\d{3}"],["5(?:0(?:0(?:37|43)|(?:6\\d|70|9[0168])\\d)|[12]\\d0[1-5])\\d{3}"],0,0,["501\\d{5}"],["7117\\d{4}"],["3550\\d{4}"]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,[["(?:2(?:[0346-8]\\d|1[0-7])|4(?:[013568]\\d|2[4-8])|54(?:[3-5]\\d|71)|6\\d\\d|8(?:14|3[129]))\\d{4}",[7,8]],["5(?:4(?:2[1-389]|7[1-9])|87[15-8])\\d{4}|(?:5(?:2[5-9]|4[3-689]|[57]\\d|8[0-689]|9[0-8])|7(?:0[0-2]|3[013]))\\d{5}",[8]],["802\\d{7}|80[0-2]\\d{4}",[7,10]],["30\\d{5}",[7]],0,0,0,0,["3(?:20|9\\d)\\d{4}",[7]]],"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,[["(?:3(?:0[0-3]|3[0-59])|6(?:[58][024689]|6[024-68]|7[02468]))\\d{4}",[7]],["(?:46[46]|[79]\\d\\d)\\d{4}",[7]],["800\\d{7}",[10]],["900\\d{7}",[10]],0,0,["4(?:0[01]|50)\\d{4}",[7]]],"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:1[2-9]|2[12]\\d\\d)\\d{5}"],["111\\d{6}|(?:31|77|[89][89])\\d{7}",[9]]]],MX:["52","0[09]","1(?:(?:[27]2|44|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,[["657[12]\\d{6}|(?:2(?:0[01]|2\\d|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-
95457-9]|7[1-7]|8[67]|9[4-8])|7(?:[13467][1-9]|2\\d|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[0-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}",[10]],["657[12]\\d{6}|(?:1(?:2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-7][1-9]|3[1-8]|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))|2(?:2\\d|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[13467][1-9]|2\\d|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[0-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}"],["8(?:00|88)\\d{7}",[10]],["900\\d{7}",[10]],["500\\d{7}",[10]],0,0,0,0,["300\\d{7}",[10]]],"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:2[0-36-9]|3[0-368]|4[0-278]|5[0-24-8]|6[0-467]|7[1246-9]|8\\d|9[0-57])\\d|4(?:2[0-689]|[3-79]\\d|8[1-35689])|5(?:2[0-589]|[3468]\\d|5[0-489]|7[1-9]|9[23])|6(?:2[2-9]|3[1357-9]|[46]\\d|5[0-6]|7[0-35-9]|85|9[015-8])|7(?:[2579]\\d|3[03-68]|4[0-8]|6[5-9]|8[0-35-9])|8(?:[24][2-8]|3[2-5]|5[2-7]|6[2-589]|7[2-578]|[89][2-9])|9(?:0[57]|13|[25-7]\\d|[3489][0-8]))\\d{5}",[8,9]],["1(?:1888[689]|4400|8(?:47|8[27])[0-4])\\d{4}|1(?:0(?:[23568]\\d|4[0-6]|7[016-9]|9[0-8])|1(?:[1-5]\\d\\d|6(?:0[5-9]|[1-9]\\d)|7(?:[0-4]\\d|5[0-7]))|(?:[269]\\d|[37][1-9]|4[235-9])\\d|5(?:31|9\\d\\d)|8(?:1[23]|[236]\\d|4[06]|5(?:46|[7-9])|7[016-9]|8[01]|9[0-8]))\\d{5}",[9,10]],["1[378]00\\d{6}",[10]],["1600\\d{6}",[10]],0,0,0,0,["15(?:4(?:6[0-4]\\d|8(?:0[125]|[17]\\d|21|3[01]|4[01589]|5[014]|6[02]))|6(?:32[0-6]|78\\d))\\d{4}",[10]]]],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["2(?:[1346]\\d|5[0-2]|[78][12]|93)\\d{5}",[8]],["8[2-79]\\d{7}",[9]],["800\\d{6}",[9]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["64426\\d{3}|6(?:1(?:2[2-7]|3[01378]|4[0-4])|254|32[0237]|4(?:27|41|5[25])|52[236-8]|626|7(?:2[2-4]|30))\\d{4,5}|6(?:1(?:(?:0\\d|2[0189]|3[24-69]|4[5-9])\\d|17|69|7[014])|2(?:17|5[0-36-8]|69|70)|3(?:17|2[14-689]|34|6[289]|7[01]|81)|4(?:17|2[0-2]|4[06]|5[0137]|69|7[01])|5(?:17|2[0459]|69|7[01])|6(?:17|25|38|42|69|7[01])|7(?:17|2[569]|3[13]|6[89]|7[01]))\\d{4}"],["(?:60|8[1245])\\d{7}",[9]],["80\\d{7}",[9]],["8701\\d{5}",[9]],0,0,0,0,["8(?:3\\d\\d|86)\\d{5}"]]],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]],0,0,0,0,0,0,[["(?:2[03-9]|3[0-5]|4[1-7]|88)\\d{4}"],["(?:5[0-4]|[79]\\d|8[0-79])\\d{4}"],["050\\d{3}"],["36\\d{4}"]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]],0,0,0,0,0,0,[["2(?:0(?:20|3[1-8]|4[13-5]|5[14]|6[14578]|7[1-578])|1(?:4[145]|5[14]|6[14-68]|7[169]|88))\\d{4}"],["(?:23|7[047]|[89]\\d)\\d{6}"],["08\\d{6}"],["09\\d{6}"]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1",0,0,[["(?:1(?:06|17|28|39)|3[0-2]\\d)\\d{3}"],["(?:14|3[58])\\d{4}"]]],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:[1-356]\\d|4[02-8]|8[2-9])\\d|9(?:0[3-9]|[1-9]\\d))\\d{5}|7(?:0(?:[013-689]\\d|2[0-24-9])\\d{3,4}|[1-79]\\d{6})|(?:[12]\\d|4[147]|5[14579]|6[1578]|7[1-3578])\\d{5}",[7,8]],["(?:702[0-24-9]|819[01])\\d{6}|(?:70[13-689]|8(?:0[1-9]|1[0-8])|9(?:0[1-9]|1[1-356]))\\d{7}",[10]],["800\\d{7,11}",[10,11,12,13,14]],0,0,0,["700\\d{7,11}",[10,11,12,13,14]]]],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]],0,0,0,0,0,0,[["2\\d{7}"],["(?:5(?:5[0-7]|[78]\\d)|6(?:20|3[035]|4[045]|5[05]|77|8[1-9]|9[059])|(?:7[5-8]|8\\d)\\d)\\d{5}"],["1800\\d{4}"]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:[035]\\d|1[13-578]|6[124-8]|7[24]|8[0-467])|2(?:[0346]\\d|2[2-46-9]|5[125]|9[479])|3(?:[03568]\\d|1[3-8]|2[01]|4[1-8])|4(?:[0356]\\d|1[1-368]|7[58]|8[15-8]|9[23579])|5(?:[
9540358]\\d|[19][1-9]|2[1-57-9]|4[13-8]|6[126]|7[0-3578])|7\\d\\d)\\d{6}",[9]],["(?:6[1-58]|970\\d)\\d{7}",[9,11]],["800\\d{4,7}",[7,8,9,10]],["90[069]\\d{4,7}",[7,8,9,10]],0,0,["140(?:1[035]|2[0346]|3[03568]|4[0356]|5[0358]|8[458])|(?:140(?:1[16-8]|2[259]|3[124]|4[17-9]|5[124679]|7)|8[478]\\d{6})\\d",[5,6,9]],["66\\d{7}",[9]],["(?:85|91)\\d{7}",[9]]]],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]",[["(?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7[0-8])\\d{6}",[8]],["(?:4[015-8]|9\\d)\\d{6}",[8]],["80[01]\\d{5}",[8]],["82[09]\\d{5}",[8]],["880\\d{5}",[8]],0,["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"],0,["85[0-5]\\d{5}",[8]],["810(?:0[0-6]|[2-8]\\d)\\d{3}",[8]]]],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0",0,0,0,0,0,[["(?:1[0-6]\\d|99[02-6])\\d{5}|(?:2[13-79]|3[135-8]|4[146-9]|5[135-7]|6[13-9]|7[15-9]|8[1-46-9]|9[1-7])[2-6]\\d{5}",[8]],["9(?:6[0-3]|7[024-6]|8[0-24-68])\\d{7}",[10]],["1(?:66001|800\\d\\d)\\d{5}",[11]]]],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]],0,0,0,0,0,0,[["444\\d{4}"],["(?:55[3-9]|666|8\\d\\d)\\d{4}"]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]],0,0,0,0,0,0,[["[47]\\d{3}",[4]],["888[1-9]\\d{3}",[7]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,[["24099\\d{3}|(?:3[2-79]|[49][2-9]|6[235-9]|7[2-57-9])\\d{6}",[8]],["2(?:[0-27-9]\\d|6)\\d{6,7}|2(?:1\\d|75)\\d{5}",[8,9,10]],["508\\d{6,7}|80\\d{6,8}",[8,9,10]],["(?:1[13-57-9]\\d{5}|50(?:0[08]|30|66|77|88))\\d{3}|90\\d{6,8}",[7,8,9,10]],["70\\d{7}",[9]],0,["8(?:1[16-9]|22|3\\d|4[045]|5[459]|6[235-9]|7[0-3579]|90)\\d{2,7}"]],"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]],0,0,0,0,0,0,[["2[1-6]\\d{6}",[8]],["1505\\d{4}|(?:7(?:[1289]\\d|6[89]|7[0-5])|9(?:0[1-9]|[1-9]\\d))\\d{5}",[8]],["8007\\d{4,5}|(?:500|800[05])\\d{4}"],["900\\d{5}",[8]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:1(?:0\\d|1[479]|2[37]|3[0137]|4[17]|5[05]|6[58]|7[0167]|8[2358]|9[1389])|2(?:[0235-79]\\d|1[0-7]|4[013-9]|8[02-9])|3(?:[089]\\d|1[0-7]|2[0-5]|33|4[0-79]|5[0-35]|6[068]|7[0-8])|4(?:00|3[0-579]|4\\d|7[0-57-9])|5(?:[01]\\d|2[0-7]|[56]0|79)|7(?:0[09]|2[0-26-8]|3[03]|4[04]|5[05-9]|6[056]|7[0-24-9]|8[5-9]|90)|8(?:09|2[89]|3\\d|4[0-24-689]|5[014]|8[02])|9(?:0[5-9]|1[0135-8]|2[036-9]|3[35-79]|40|5[0457-9]|6[05-9]|7[04-9]|8[35-8]|9\\d))\\d{4}",[7]],["(?:1[16]1|21[89]|6\\d{3}|8(?:1[01]|7[23]))\\d{4}",[7,8]],["800\\d{4,5}|(?:00800|800\\d)\\d{6}"],["(?:8(?:22|55|60|7[78]|86)|9(?:00|81))\\d{4}",[7]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,[["(?:(?:4[34]|5[14])[0-8]\\d|7(?:173|3[0-8]\\d)|8(?:10[05689]|6(?:0[06-9]|1[6-9]|29)|7(?:0[569]|[56]0)))\\d{4}|(?:1[0-8]|4[12]|5[236]|6[1-7]|7[246]|8[2-4])\\d{6}",[8]],["9\\d{8}",[9]],["800\\d{5}",[8]],["805\\d{5}",[8]],["80[24]\\d{5}",[8]],0,0,0,0,["801\\d{5}",[8]]],"00"," Anexo "],PF:["689","00","4\\d{5}
954(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]],0,0,0,0,0,0,[["4(?:0[4-689]|9[4-68])\\d{5}",[8]],["8[7-9]\\d{6}",[8]],["80[0-5]\\d{6}",[9]],0,0,0,["44\\d{4}",[6]],0,["499\\d{5}",[8]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,[["(?:(?:3[0-2]|4[257]|5[34]|9[78])\\d|64[1-9]|85[02-46-9])\\d{4}",[7]],["(?:7\\d|8[128])\\d{6}",[8]],["180\\d{4}",[7]],0,0,0,0,["27[01]\\d{4}",[7]],["2(?:0[0-57]|7[568])\\d{4}",[7]]],"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0",0,0,0,0,0,[["(?:(?:2[3-8]|3[2-68]|4[2-9]|5[2-6]|6[2-58]|7[24578])\\d{3}|88(?:22\\d\\d|42))\\d{4}|(?:2|8[2-8]\\d\\d)\\d{5}",[6,8,9,10]],["(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\\d|4[2-9]|8[135-9]|9[1-9]))\\d{7}",[10]],["1800\\d{7,9}",[11,12,13]]]],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0",0,0,0,0,0,[["(?:(?:21|42)[2-9]|58[126])\\d{7}|(?:2[25]|4[0146-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\\d{6,7}|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8]))[2-9]\\d{5,6}",[9,10]],["3(?:[0-24]\\d|3[0-79]|55|64)\\d{7}",[10]],["800\\d{5}(?:\\d{3})?",[8,11]],["900\\d{5}",[8]],["122\\d{6}",[9]],0,["(?:2(?:[125]|3[2358]|4[2-4]|9[2-8])|4(?:[0-246-9]|5[3479])|5(?:[1-35-7]|4[2-467])|6(?:0[468]|[1-8])|7(?:[14]|2[236])|8(?:[16]|2[2-689]|3[23578]|4[3478]|5[2356])|9(?:1|22|3[27-9]|4[2-6]|6[3569]|9[2-7]))111\\d{6}",[11,12]]]],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["47\\d{7}|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])(?:[02-9]\\d{6}|1(?:[0-8]\\d{5}|9\\d{3}(?:\\d{2})?))",[7,9]],["21(?:1(?:[145]\\d|3[1-5])|2\\d\\d)\\d{4}|(?:45|5[0137]|6[069]|7[2389]|88)\\d{7}",[9]],["800\\d{6,7}",[9,10]],["70[01346-8]\\d{6}",[9]],0,0,["804\\d{6}",[9]],["64\\d{4,7}",[6,7,8,9]],["39\\d{7}",[9]],["801\\d{6}",[9]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:4[1-35-7]|5[01])\\d{4}",[6]],["(?:4[02-4]|5[056]|708[45][0-5])\\d{4}"],["80[0-5]\\d{6}",[9]]]],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}
954",[10],0,"1",0,0,0,0,"787|939",[["(?:787|939)[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["(?:22[2-47-9]|42[45]|82[014-68]|92[3569])\\d{5}",[8]],["5[69]\\d{7}",[9]],["1800\\d{6}",[10]],0,0,0,0,0,0,["1700\\d{6}",[10]]]],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]],0,0,0,0,0,0,[["2(?:[12]\\d|3[1-689]|4[1-59]|[57][1-9]|6[1-35689]|8[1-69]|9[1256])\\d{6}"],["6(?:[06]92(?:30|9\\d)|[35]92(?:3[03]|9\\d))\\d{3}|(?:(?:16|6[0356])93|9(?:[1-36]\\d\\d|480))\\d{5}"],["80[02]\\d{6}"],["(?:6(?:0[178]|4[68])\\d|76(?:0[1-57]|1[2-47]|2[237]))\\d{5}"],["884[0-4689]\\d{5}"],0,["70(?:38[01]|596|(?:7\\d|8[17])\\d)\\d{4}"],["6222\\d{5}"],["30\\d{7}"],["80(?:8\\d|9[1579])\\d{5}"]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]],0,0,0,0,0,0,[["(?:2(?:55|77)|345|488|5(?:35|44|87)|6(?:22|54|79)|7(?:33|47)|8(?:24|55|76)|900)\\d{4}"],["(?:(?:46|83)[0-5]|6[2-4689]0)\\d{4}|(?:45|77|88)\\d{5}"]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,[["(?:[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36])\\d{5,7}|(?:2(?:2[4-68]|[4-68]\\d|7[15]|9[1-5])|3(?:18|3[167]|4[2357]|51|[67]\\d)|4(?:3[12]|5[13]|9[1-47])|5(?:[1-4]\\d|5[02-4])|6(?:3[1-3]|44|7[1-8])|7(?:4[0-4]|5\\d|6[1-578]|75|8[0-8])|858)\\d{5,6}",[7,8,9]],["9(?:51|6[129]|[78][1-6]|9[1-5])\\d{6}",[9]],["9800\\d{5,7}",[9,10,11]],0,0,0,["[2-9]0\\d{4,7}",[6,7,8,9]],0,["8700[0-4]\\d{4}",[9]]]],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]],0,0,0,0,0,0,[["4(?:1111|2022)\\d{3}|4(?:[04]\\d\\d|14[0-6]|999)\\d{4}",[8]],["[35-7]\\d{7}",[8]],["800\\d{4}|(?:0080[01]|800)\\d{6}",[7,9,11]],0,0,0,0,["2[16]\\d{5}",[7]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,[["[23][13-6]\\d{7}|(?:2(?:19\\d|[3-6]\\d9)|31\\d\\d)\\d\\d"],["7020\\d{5}|7(?:0[013-9]|1[0-3]|[2-7]\\d|8[03-8]|9[0-29])\\d{6}",[9]],["800\\d{6}",[9]],["90[0136]\\d{6}",[9]],0,0,["(?:37\\d|80[578])\\d{6}",[9]],0,0,["801\\d{6}",[9]]],0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0",0,0,0,0,0,[["(?:11[1-9]\\d|(?:2[389]|39)(?:0[2-9]|[2-9]\\d))\\d{3,8}|(?:1[02-9]|2[0-24-7]|3[0-8])[2-9]\\d{4,9}",[7,8,9,10,11,12]],["6(?:[0-689]|7\\d)\\d{6,7}",[8,9,10]],["800\\d{3,9}"],["(?:78\\d|90[0169])\\d{3,7}",[6,7,8,9,10]],0,0,["7[06]\\d{4,10}"]]],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",[["(?:3(?:0[12]|4[1-35-79]|5[1-3]|65|8[1-58]|9[0145])|4(?:01|1[1356]|2[13467]|7[1-5]|8[1-7]|9[1-689])|8
954(?:1[1-8]|2[01]|3[13-6]|4[0-8]|5[15]|6[1-35-79]|7[1-37-9]))\\d{7}",[10]],["9\\d{9}",[10]],["8(?:0[04]|108\\d{3})\\d{7}"],["80[39]\\d{7}",[10]],["808\\d{7}",[10]]],"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:06|2[23568]\\d)\\d{6}"],["7[237-9]\\d{7}",[9]],["800\\d{6}",[9]],["900\\d{6}",[9]]]],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0",0,0,0,0,0,[["1(?:1\\d|2[24-8]|3[35-8]|4[3-68]|6[2-5]|7[235-7])\\d{6}",[9]],["579[01]\\d{5}|5(?:[013-689]\\d|7[0-8])\\d{6}",[9]],["800\\d{7}",[10]],["925\\d{6}",[9]],0,0,["811\\d{7}",[10]],0,0,["920\\d{6}",[9]]]],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]],0,0,0,0,0,0,[["(?:1[4-79]|[23]\\d|4[0-2]|5[03]|6[0-37])\\d{3}",[5]],["48\\d{3}|(?:(?:7[1-9]|8[4-9])\\d|9(?:1[2-9]|2[013-9]|3[0-2]|[46]\\d|5[0-46-9]|7[0-689]|8[0-79]|9[0-8]))\\d{4}"],["1[38]\\d{3}",[5]],0,0,0,0,0,["5[12]\\d{3}",[5]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,[["4[2-46]\\d{5}"],["2[125-8]\\d{5}"],["800[08]\\d{3}"],0,0,0,0,0,["971\\d{4}|(?:64|95)\\d{5}"]],"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0",0,0,0,0,0,[["1(?:5\\d|8[35-7])\\d{6}"],["(?:1[0-2]|9[0-3569])\\d{7}"]]],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0",0,0,0,0,0,[["(?:(?:[12][136]|3[356]|4[0246]|6[03]|8\\d)\\d|90[1-9])\\d{4,6}|(?:1(?:2[0-35]|4[0-4]|5[0-25-9]|7[13-6]|[89]\\d)|2(?:2[0-7]|4[0136-8]|5[0138]|7[018]|8[01]|9[0-57])|3(?:0[0-4]|1\\d|2[0-25]|4[056]|7[0-2]|8[0-3]|9[023])|4(?:1[013-8]|3[0135]|5[14-79]|7[0-246-9]|8[0156]|9[0-689])|5(?:0[0-6]|[15][0-5]|2[0-68]|3[0-4]|4\\d|6[03-5]|7[013]|8[0-79]|9[01])|6(?:1[1-3]|2[0-4]|4[02-57]|5[0-37]|6[0-3]|7[0-2]|8[0247]|9[0-356])|9(?:1[0-68]|2\\d|3[02-5]|4[0-3]|5[0-4]|[68][01]|7[0135-8]))\\d{5,6}",[7,8,9]],["7[02369]\\d{7}",[9]],["20\\d{4,7}",[6,7,8,9]],["649\\d{6}|99[1-59]\\d{4}(?:\\d{3})?|9(?:00|39|44)[1-8]\\d{3,6}",[7,8,9,10]],["75[1-8]\\d{6}",[9]],0,["10[1-8]\\d{6}",[9]],["74[02-9]\\d{6}",[9]],0,["77[0-7]\\d{6}",[9]]]],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-8]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[["662[0-24-9]\\d{4}|6(?:[0-578]\\d|6[013-57-9]|9[0-35-9])\\d{5}",[8]],["8(?:08[01]|95[0-2])\\d{4}|(?:8(?:0[1-7]|[1-8]\\d|9[0-4])|9[0-8]\\d)\\d{5}",[8]],["(?:18|8)00\\d{7}",[10,11]],["1900\\d{7}",[11]],0,0,["7000\\d{7}",[11]],0,["(?:3[12]\\d|666)\\d{5}",[8]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]",[["2(?:[0-57-9]\\d|6[4-9])\\d\\d"],["[56]\\d{4}",[5]],0,0,0,0,0,0,["262\\d\\d",[5]]]],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,[["(?:[1-357][2-8]|4[24-8])\\d{6}",[8]],["65(?:[178]\\d|5[56]|6[01])\\d{4}|(?:[37][01]|4[0139]|51|6[489])\\d{6}",[8]],["80\\d{4,6}",[6,7,8]],["89[1-3]\\d{2,5}|90\\d{4,6}"],0,0,0,0,["(?:59\\d\\d|8(?:1(?:[67]\\d|8[0-589])|2(?:0\\d|2[0-37-9]|8[0-2489])|3[389]\\d))\\d{4}",[8]]],"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79",[["79\\d{6}",[8]],["(?:4[015-8]|9\\d)\\d{6}",[8]],["80[01]\\d{5}",[8]],["82[09]\\d{5}",[8]],["880\\d{5}",[8]],0,["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"],0,["85[0-5]\\d{5}
954",[8]],["810(?:0[0-6]|[2-8]\\d)\\d{3}",[8]]]],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:16|[2-9]\\d{3})|(?:(?:[3-5][1-8]\\d|819)\\d|601[1-5])\\d)\\d{4}|(?:2|[3-5][1-8])1[67]\\d{3}|[3-5][1-8]16\\d\\d"],["909[1-9]\\d{5}|9(?:0[1-8]|1[0-24-9]|4[03-57-9]|5\\d)\\d{6}",[9]],["800\\d{6}",[9]],["9(?:00|[78]\\d)\\d{6}",[9]],0,0,["96\\d{7}",[9]],["9090\\d{3}",[7]],["6(?:02|5[0-4]|9[0-6])\\d{6}",[9]],["8[5-9]\\d{7}",[9]]]],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0",0,0,0,0,0,[["22[2-4][2-9]\\d{4}"],["(?:25|3[0-5]|66|7[2-9]|8[08]|9[09])\\d{6}"]]],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1",0,0,[["0549(?:8[0157-9]|9\\d)\\d{4}",[10]],["6[16]\\d{6}",[8]],0,["7[178]\\d{6}",[8]],0,0,0,0,["5[158]\\d{6}",[8]]]],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]],0,0,0,0,0,0,[["3(?:0(?:1[0-2]|80)|282|3(?:8[1-9]|9[3-9])|611)\\d{5}"],["7(?:(?:[06-8]\\d|21|90)\\d|5(?:01|[19]0|25|[38]3|[4-7]\\d))\\d{5}"],["800\\d{6}"],["88[4689]\\d{6}
954"],0,0,0,0,["(?:3(?:392|9[01]\\d)\\d|93(?:3[13]0|929))\\d{4}"],["81[02468]\\d{6}"]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0",0,0,0,0,0,[["(?:1\\d|2[0-79]|3[0-46-8]|4[0-7]|5[57-9])\\d{5}|(?:[134]\\d|8[125])\\d{4}",[6,7]],["(?:(?:15|(?:3[59]|4[89]|6\\d|7[79]|8[08])\\d|9(?:0\\d|[2-9]))\\d|2(?:4\\d|8))\\d{5}|(?:[67]\\d\\d|904)\\d{5}",[7,8,9]]]],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]],0,0,0,0,0,0,[["(?:2[1-3]|3[0-7]|(?:4|68)\\d|5[2-58])\\d{4}"],["(?:7[124-7]|8[124-9])\\d{5}",[7]],0,0,0,0,0,0,["56\\d{4}",[6]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0",0,0,0,0,0,[["1[89]\\d{7}"],["(?:12|9[1257-9])\\d{7}"]]],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]],0,0,0,0,0,0,[["22\\d{5}"],["900[5-9]\\d{3}|9(?:0[1-9]|[89]\\d)\\d{4}"]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,[["2(?:79(?:0[0347-9]|[1-9]\\d)|89(?:0[024589]|[1-9]\\d))\\d{3}|2(?:[1-69]\\d|[78][0-8])\\d{5}",[8]],["[67]\\d{7}",[8]],["800\\d{4}(?:\\d{4})?",[7,11]],["900\\d{4}(?:\\d{4})?",[7,11]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721",[["7215(?:4[2-8]|8[239]|9[056])\\d{4}"],["7215(?:1[02]|2\\d|5[034679]|8[014-8])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0",0,0,0,0,0,[["21\\d{6,7}|(?:1(?:[14]\\d|[2356])|2[235]|3(?:[13]\\d|4)|4[134]|5[1-3])\\d{6}"],["9[1-689]\\d{7}",[9]]]],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]],0,0,0,0,0,0,[["[23][2-5]\\d{6}",[8]],["7[6-9]\\d{6}",[8]],["0800\\d{4}",[8]],["900\\d{6}",[9]],0,0,0,0,["70\\d{6}",[8]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8",[["8\\d{3}"]]],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649",[["649(?:266|712|9(?:4\\d|50))\\d{4}"],["649(?:2(?:3[129]|4[1-79])|3\\d\\d|4[34][1-3])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["649(?:71[01]|966)\\d{4}"]]],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,[["22(?:[37-9]0|5[0-5]|6[89])\\d{4}"],["(?:6[0235689]|77|9\\d)\\d{6}"]],"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]],0,0,0,0,0,0,[["2(?:2[2-7]|3[23]|4[45]|55|6[67]|77)\\d{5}"],["(?:7[019]|9[0-36-9])\\d{6}"]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["(?:1[0689]|2\\d|3[2-9]|4[2-5]|5[2-6]|7[3-7])\\d{6}",[8]],["671[0-8]\\d{5}|(?:14|6[1-6]|[89]\\d)\\d{7}",[9]],["(?:001800\\d|1800)\\d{6}",[10,13]],["1900\\d{6}",[10]],0,0,0,0,["6[08]\\d{7}",[9]]]],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[04]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,[["(?:3(?:1[3-5]|2[245]|3[12]|4[24-7]|5[25]|72)|4(?:4[046]|74|87))\\d{6}"],["(?:41[18]|81[1-9])\\d{6}|(?:0[0-57-9]|1[017]|2[02]|[34]0|5[05]|7[0178]|8[078]|9\\d)\\d{7}"]],"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7],0,0,0,0,0,0,0,[["(?:2[2-4]|[34]\\d)\\d{2,5}
954"],["7[2-4]\\d{2,5}"]]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]],0,0,0,0,0,0,[["(?:2[1-5]|3[1-9]|4[1-4])\\d{5}",[7]],["7[2-8]\\d{6}",[8]],["80\\d{5}",[7]],["90\\d{5}",[7]],["70\\d{5}",[7]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,[["(?:1(?:2\\d|3[1-9])|2(?:22|4[0-35-8])|3(?:22|4[03-9])|4(?:22|3[128]|4\\d|6[15])|5(?:22|5[7-9]|6[014-689]))\\d{5}"],["6\\d{7}"]],"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]],0,0,0,0,0,0,[["81200\\d{3}|(?:3[0-2]|7\\d)\\d{6}"],["3(?:001|[12]40)\\d{4}|(?:(?:[259]\\d|4[0-8])\\d|3(?:1[1-35]|6[0-4]|91))\\d{5}"],["8010\\d{4}"],["88\\d{6}"],0,0,0,0,0,["8[12]10\\d{4}"]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]],0,0,0,0,0,0,[["(?:2\\d|3[0-8]|4[0-4]|50|6[09]|7[0-24-69]|8[05])\\d{3}",[5]],["(?:55[4-6]|6(?:[09]\\d|3[02]|8[15-9])|(?:7\\d|8[46-9])\\d|999)\\d{4}",[7]],["0800\\d{3}",[7]],0,0,0,0,0,["55[0-37-9]\\d{4}",[7]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0",0,0,0,0,0,[["(?:2(?:[13][26]|[28][2468]|[45][268]|[67][246])|3(?:[13][28]|[24-6][2468]|[78][02468]|92)|4(?:[16][246]|[23578][2468]|4[26]))\\d{7}",[10]],["561(?:011|61\\d)\\d{4}|5(?:0[15-7]|1[06]|24|[34]\\d|5[1-59]|9[46])\\d{7}",[10]],["8(?:00\\d{7}(?:\\d{2,3})?|11\\d{7})",[10,12,13]],["(?:8[89]8|900)\\d{7}",[10]],["592(?:21[12]|461)\\d{4}",[10]],0,["444\\d{4}",[7]],["512\\d{7}",[10]],["850\\d{7}",[10]]]],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868",[["868(?:2(?:01|1[5-9]|[23]\\d|4[0-2])|6(?:0[7-9]|1[02-8]|2[1-9]|[3-69]\\d|7[0-79])|82[124])\\d{4}"],["868(?:(?:2[5-9]|3\\d)\\d|4(?:3[0-6]|[6-9]\\d)|6(?:20|78|8\\d)|7(?:0[1-9]|1[02-9]|[2-9]\\d))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]],0,0,0,0,0,0,[["2[02-9]\\d{3}",[5]],["(?:7[01]\\d|90)\\d{4}",[6,7]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["(?:2[2-8]\\d|370|55[01]|7[1-9])\\d{6}|4(?:(?:0(?:0[1-9]|[2-48]\\d)|1[023]\\d)\\d{4,5}|(?:[239]\\d\\d|4(?:0[56]|12|49))\\d{5})|6(?:[01]\\d{7}|4(?:0[56]|12|24|4[09])\\d{4,5})|8(?:(?:2(?:3\\d|4[0-269]|[578]0|66)|36[24-9]|90\\d\\d)\\d{4}|4(?:0[56]|12|24|4[09])\\d{4,5})|(?:2(?:2(?:0\\d\\d|4(?:0[68]|[249]0|3[0-467]|5[0-25-9]|6[0235689]))|(?:3(?:[09]\\d|1[0-4])|(?:4\\d|5[0-49]|6[0-29]|7[0-5])\\d)\\d)|(?:(?:3[2-9]|5[2-8]|6[0-35-79]|8[7-9])\\d\\d|4(?:2(?:[089]\\d|7[1-9])|(?:3[0-4]|[78]\\d|9[01])\\d))\\d)\\d{3}",[8,9]],["(?:40001[0-2]|9[0-8]\\d{4})\\d{3}",[9]],["80[0-79]\\d{6}|800\\d{5}",[8,9]],["20(?:[013-9]\\d\\d|2)\\d{4}",[7,9]],["99\\d{7}",[9]],0,["50[0-46-9]\\d{6}
954",[9]],0,["7010(?:[0-2679]\\d|3[0-7]|8[0-5])\\d{5}|70\\d{8}",[10,11]]],0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0",0,0,0,0,0,[["2[2-8]\\d{7}"],["77[2-9]\\d{6}|(?:6[125-9]|7[13-689])\\d{7}"],["80[08]\\d{6}"],["90\\d{7}"],0,0,0,0,["41\\d{7}"],["8(?:40|6[01])\\d{6}"]]],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["(?:3[1-8]|4[13-8]|5[1-7]|6[12459])\\d{7}",[9]],["(?:39|50|6[36-8]|7[1-3]|9[1-9])\\d{7}",[9]],["800[1-8]\\d{5,6}"],["900[239]\\d{5,6}"],0,0,0,0,["89[1-579]\\d{6}",[9]]],"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0",0,0,0,0,0,[["20(?:(?:240|30[67])\\d|6(?:00[0-2]|30[0-4]))\\d{3}|(?:20(?:[017]\\d|2[5-9]|32|5[0-4]|6[15-9])|[34]\\d{3})\\d{5}"],["726[01]\\d{5}|7(?:[01578]\\d|20|36|4[0-4]|6[0-6]|9[89])\\d{6}"],["800[1-3]\\d{5}"],["90[1-3]\\d{6}"]]],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9]|983[29])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,[["(?:1(?:770|9(?:20|87))|(?:2\\d|4[2-7])\\d\\d)\\d{4}",[8]],["9[1-9]\\d{6}",[8]],["0004\\d{2,9}|(?:405|80[05])\\d{4}"],["90[0-8]\\d{4}",[7]]],"00"," int. "],UZ:["998","810","200\\d{6}|(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,[["(?:55\\d\\d|6(?:1(?:22|3[124]|4[1-4]|5[1-3578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\d\\d|7(?:[23]\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[124-6]|9[135-8])|(?:1[12]|8\\d)\\d|2(?:22|3[13-57-9]|4[1-3579]|5[14])|3(?:2\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|6(?:22|3[12457]|4[13-8])|9(?:22|5[1-9])))\\d{5}"],["(?:(?:200[01]|(?:33|50|88|9[0-57-9])\\d\\d)\\d|6(?:1(?:2(?:2[01]|98)|35[0-4]|50\\d|61[23]|7(?:[01][017]|4\\d|55|9[5-9]))|2(?:(?:11|7\\d)\\d|2(?:[12]1|9[01379])|5(?:[126]\\d|3[0-4]))|5(?:19[01]|2(?:27|9[26])|(?:30|59|7\\d)\\d)|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|(?:3[79]|9[0-3])\\d|4(?:56|83)|7(?:[07]\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79]))|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\d|[39][07])|9(?:0\\d|7[079]))|9(?:2(?:1[1267]|3[01]|5\\d|7[0-4])|(?:5[67]|7\\d)\\d|6(?:2[0-26]|8\\d)))|7(?:[07]\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\d|7(?:0\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|(?:33|9[4-6])\\d|5(?:0[0-4]|5[579]|9\\d)|7(?:[0-3579]\\d|4[0467]|6[67]|8[078]))|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\d|9[5-9])|7(?:0\\d|1[024589]|2[0-27]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\d))|5(?:112|2(?:0\\d|2[29]|[49]4)|3[1568]\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\d|8[78]|9[079]))|6(?:2(?:2[1245]|4[2-4])|39\\d|41[179]|5(?:[349]\\d|5[0-2])|7(?:0[017]|[13]\\d|22|44|55|67|88))|9(?:22[128]|3(?:2[0-4]|7\\d)|57[02569]|7(?:2[05-9]|3[37]|4\\d|60|7[2579]|87|9[07]))))\\d{4}"]],"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698",[["06698\\d{1,6}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784",[["784(?:266|3(?:6[6-9]|7\\d|8[0-6])|4(?:38|5[0-36-8]|8[0-8])|5(?:55|7[0-2]|93)|638|784)\\d{4}"],["784(?:4(?:3[0-5]|5[45]|89|9[0-8])|5(?:2[6-9]|3[0-4])|720)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["78451[0-2]\\d{4}"]]],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:12|3[457-9]|[467]\\d|[58][1-9]|9[1-6])|[4-6]00)\\d{7}"],["4(?:1[24-8]|2[46])\\d{7}"],["800\\d{7}"],["90[01]\\d{7}"],0,0,["501\\d{7}"]]],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284",[["284(?:229|4(?:22|9[45])|774|8(?:52|6[459]))\\d{4}"],["284(?:245|3(?:0[0-3]|4[0-7]|68|9[34])|4(?:4[0-6]|68|9[69])|5(?:4[0-7]|68|9[69]))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340",[["340(?:2(?:0[0-368]|2[06-8]|4[49]|77)|3(?:32|44)|4(?:2[23]|44|7[34]|89)|5(?:1[34]|55)|6(?:2[56]|4[23]|77|9[023])|7(?:1[2-57-9]|2[57]|7\\d)|884|998)\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0",0,0,0,0,0,[["2(?:0[3-9]|1[0-689]|2[0-25-9]|[38][2-9]|4[2-8]|5[124-9]|6[0-39]|7[0-7]|9[0-4679])\\d{7}",[10]],["(?:5(?:2[238]|59)|89[6-9]|99[013-9])\\d{6}|(?:3\\d|5[689]|7[06-9]|8[1-8]|9[0-8])\\d{7}",[9]],["1800\\d{4,6}|12(?:0[13]|28)\\d{4}",[8,9,10]],["1900\\d{4,6}",[8,9,10]],0,0,["(?:[17]99|80\\d)\\d{4}|69\\d{5,6}",[7,8]],0,["672\\d{6}",[9]]]],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]],0,0,0,0,0,0,[["(?:38[0-8]|48[4-9])\\d\\d|(?:2[02-9]|3[4-7]|88)\\d{3}",[5]],["(?:[58]\\d|7[013-7])\\d{5}",[7]],["81[18]\\d\\d",[5]],0,0,0,["(?:3[03]|900\\d)\\d{3}"],0,["9(?:0[1-9]|1[01])\\d{4}",[7]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]],0,0,0,0,0,0,[["72\\d{4}",[6]],["(?:72|8[23])\\d{4}",[6]],["80[0-5]\\d{6}",[9]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]],0,0,0,0,0,0,[["6[1-9]\\d{3}|(?:[2-5]|60)\\d{4}",[5,6]],["(?:7[1-35-7]|8(?:[3-7]|9\\d{3}))\\d{5}",[7,10]],["800\\d{3}",[6]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[89]|39)0\\d{6}|[23][89]\\d{6}"],["4[3-9]\\d{6}",[8]],["800\\d{5}",[8]],["900\\d{5}",[8]]]],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["78[0-7]\\d{4}|17\\d{6}|(?:[12][2-68]|3[2358]|4[2-58]|5[2-6]|6[3-58]|7[24-6])\\d{5}",[7,8]],["7[01378]\\d{7}",[9]]]],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:0330|4302)|52087)0\\d{3}|(?:1[0-8]|2[1-378]|3[1-69]|4\\d|5[1346-8])\\d{7}",[9]],["(?:1(?:3492[0-25]|4495[0235]|549(?:20|5[01]))|4[34]492[01])\\d{3}|8[1-4]\\d{3,7}|(?:2[27]|47|54)4950\\d{3}|(?:1(?:049[2-4]|9[12]\\d\\d)|(?:6\\d|7[0-46-9])\\d{3}|8(?:5\\d{3}|7(?:08[67]|158|28[5-9]|310)))\\d{4}|(?:1[6-8]|28|3[2-69]|4[025689]|5[36-8])4920\\d{3}|(?:12|[2-5]1)492\\d{4}",[5,6,7,8,9]],["80\\d{7}",[9]],["(?:86[2-9]|9[0-2]\\d)\\d{6}",[9]],0,0,["861\\d{6,7}",[9,10]],0,["87(?:08[0-589]|15[0-79]|28[0-4]|31[1-9])\\d{4}|87(?:[02][0-79]|1[0-46-9]|3[02-9]|[4-9]\\d)\\d{5}",[9]],["860\\d{6}",[9]]]],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0",0,0,0,0,0,[["21[1-8]\\d{6}"],["(?:7[5-79]|9[5-8])\\d{7}"],["800\\d{6}"],0,0,0,0,0,["63\\d{7}"]]],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:(?:3\\d|9)\\d|[4-8])|2(?:(?:(?
954:0(?:2[014]|5)|(?:2[0157]|31|84|9)\\d\\d|[56](?:[14]\\d\\d|20)|7(?:[089]|2[03]|[35]\\d\\d))\\d|4(?:2\\d\\d|8))\\d|1(?:2|[39]\\d{4}))|3(?:(?:123|(?:29\\d|92)\\d)\\d\\d|7(?:[19]|[56]\\d))|5(?:0|1[2-478]|26|[37]2|4(?:2\\d{3}|83)|5(?:25\\d\\d|[78])|[689]\\d)|6(?:(?:[16-8]21|28|52[013])\\d\\d|[39])|8(?:[1349]28|523)\\d\\d)\\d{3}|(?:4\\d\\d|9[2-9])\\d{4,5}|(?:(?:2(?:(?:(?:0|8[146])\\d|7[1-7])\\d|2(?:[278]\\d|92)|58(?:2\\d|3))|3(?:[26]|9\\d{3})|5(?:4\\d|5)\\d\\d)\\d|6(?:(?:(?:[0-246]|[78]\\d)\\d|37)\\d|5[2-8]))\\d\\d|(?:2(?:[569]\\d|8[2-57-9])|3(?:[013-59]\\d|8[37])|6[89]8)\\d{3}"],["7(?:[178]\\d|3[1-9])\\d{6}",[9]],["80(?:[01]\\d|20|8[0-8])\\d{3}",[7]],0,0,0,0,0,["86(?:1[12]|22|30|44|55|77|8[368])\\d{6}",[10]]]]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function e(d,e){var n=Array.prototype.slice.call(e);return n.push(t),d.apply(this,n)}function n(d){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(d){return typeof d}:function(d){return d&&"function"==typeof Symbol&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},n(d)}function r(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}function a(d,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(d)}function i(d){if(void 0===d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function o(d){var t="function"==typeof Map?new Map:void 0;return o=function(d){if(null===d||(e=d,-1===Function.toString.call(e).indexOf("[native code]")))return d;var e;if("function"!=typeof d)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(d))return t.get(d);t.set(d,n)}function n(){return $(d,arguments,c(this).constructor)}return n.prototype=Object.create(d.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,d)},o(d)}function $(d,t,e){return $=u()?Reflect.construct:function(d,t,e){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(d,n));return e&&l(r,e.prototype),r},$.apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(d){return!1}}function l(d,t){return l=Object.setPrototypeOf||function(d,t){return d.__proto__=t,d},l(d,t)}
vendor: 8,021 bytes, line 954
954function c(d){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},c(d)}var s=function(d){!function(d,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");d.prototype=Object.create(t&&t.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),Object.defineProperty(d,"prototype",{writable:!1}),t&&l(d,t)}(f,d);var t,e,n,o,$,s=(t=f,e=u(),function(){var d,n=c(t);if(e){var r=c(this).constructor;d=Reflect.construct(n,arguments,r)}else d=n.apply(this,arguments);return a(this,d)});function f(d){var t;return function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),t=s.call(this,d),Object.setPrototypeOf(i(t),f.prototype),t.name=t.constructor.name,t}return n=f,o&&r(n.prototype,o),$&&r(n,$),Object.defineProperty(n,"prototype",{writable:!1}),n}(o(Error)),f="0-9ï¼-ï¼Ù -Ù©Û°-Û¹",h="".concat("-â-ââã¼ï¼").concat("ï¼/").concat("ï¼.").concat(" Âââ ã").concat("()ï¼ï¼ï¼»ï¼½\\[\\]").concat("~ââ¼ï½"),g="+ï¼";function y(d,t){d=d.split("-"),t=t.split("-");for(var e=d[0].split("."),n=t[0].split("."),r=0;r<3;r++){var a=Number(e[r]),i=Number(n[r]);if(a>i)return 1;if(i>a)return-1;if(!isNaN(a)&&isNaN(i))return 1;if(isNaN(a)&&!isNaN(i))return-1}return d[1]&&t[1]?d[1]>t[1]?1:d[1]<t[1]?-1:0:!d[1]&&t[1]?1:d[1]&&!t[1]?-1:0}var m={}.constructor;function p(d){return null!=d&&d.constructor===m}function b(d){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(d){return typeof d}:function(d){return d&&"function"==typeof Symbol&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},b(d)}function v(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}function C(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}function N(d,t,e){return t&&C(d.prototype,t),e&&C(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}var P=" ext. ",O=/^\d+$/,x=function(){function d(t){v(this,d),function(d){if(!d)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!p(d)||!p(d.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(p(d)?"an object of shape: { "+Object.keys(d).join(", ")+" }":"a "+T(d)+": "+d,"."))}(t),this.metadata=t,M.call(this,t)}return N(d,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(d){return"001"!==d}))}},{key:"getCountryMetadata",value:function(d){return this.metadata.countries[d]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(d){return void 0!==this.getCountryMetadata(d)}},{key:"hasCallingCode",value:function(d){if(this.getCountryCodesForCallingCode(d))return!0;if(this.nonGeographic()){if(this.nonGeographic()[d])return!0}else{var t=this.countryCallingCodes()[d];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(d){return this.nonGeographic()?!!this.nonGeographic()[d]:!this.getCountryCodesForCallingCode(d)}},{key:"country",value:function(d){return this.selectNumberingPlan(d)}},{key:"selectNumberingPlan",value:function(d,t){if(d&&O.test(d)&&(t=d,d=null),d&&"001"!==d){if(!this.hasCountry(d))throw new Error("Unknown country: ".concat(d));this.numberingPlan=new w(this.getCountryMetadata(d),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new w(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(d){var t=this.countryCallingCodes()[d];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(d){var t=this.getCountryCodesForCallingCode(d);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(d){var t=this.getCountryCodeForCallingCode(d);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var e=this.nonGeographic()[d];if(e)return e}else{var n=this.countryCallingCodes()[d];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(d){return this.numberingPlan.type(d)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(d){return this.selectNumberingPlan(d)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),d}(),w=function(){function d(t,e){v(this,d),this.globalMetadataObject=e,this.metadata=t,M.call(this,e.metadata)}return N(d,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(d){return d[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var d=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map((function(t){return new S(t,d)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(d){return d[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}}
vendor: 1,336 bytes, line 954
954,{key:"type",value:function(d){if(this.hasTypes()&&A(this.types(),d))return new I(A(this.types(),d),this)}},{key:"ext",value:function(){return this.v1||this.v2?P:this.metadata[13]||P}}]),d}(),S=function(){function d(t,e){v(this,d),this._format=t,this.metadata=e}return N(d,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||E.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),d}(),E=/^\(?\$1\)?$/,I=function(){function d(t,e){v(this,d),this.type=t,this.metadata=e}return N(d,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.t
954ype[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),d}();function A(d,t){switch(t){case"FIXED_LINE":return d[0];case"MOBILE":return d[1];case"TOLL_FREE":return d[2];case"PREMIUM_RATE":return d[3];case"PERSONAL_NUMBER":return d[4];case"VOICEMAIL":return d[5];case"UAN":return d[6];case"PAGER":return d[7];case"VOIP":return d[8];case"SHARED_COST":return d[9]}}var T=function(d){return b(d)};function j(d,t){return(t=new x(t)).hasCountry(d)?t.country(d).ext():P}function k(d,t){if((t=new x(t)).hasCountry(d))return t.country(d).countryCallingCode();throw new Error("Unknown country: ".concat(d))}function F(d,t){return t.countries.hasOwnProperty(d)}function M(d){var t=d.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===y(t,"1.2.0")?this.v2=!0:-1===y(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var D=function(d){return"([".concat(f,"]{1,").concat(d,"})")};function R(d){var t="#?";return";ext="+D("20")+"|"+("[ \\t,]*(?:e?xt(?:ensi(?:oÌ?|ó))?n?|ï½
?ï½ï½ï½?|доб|anexo)[:\\.ï¼]?[ \\t,-]*"+D("20")+t)+"|"+("[ \\t,]*(?:[xï½#ï¼~ï½]|int|ï½ï½ï½)[:\\.ï¼]?[ \\t,-]*"+D("9")+t)+"|"+("[- ]+"+D("6")+"#")+"|"+("[ \\t]*(?:,{2}|;)[:\\.ï¼]?[ \\t,-]*"+D("15")+t)+"|"+("[ \\t]*(?:,)+[:\\.ï¼]?[ \\t,-]*"+D("9")+t)}var _="[+ï¼]{0,1}(?:["+h+"]*["+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]){3,}["+h+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]*",L=new RegExp("^[+ï¼]{0,1}(?:["+h+"]*["+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]){1,2}$","i"),G=_+"(?:"+R()+")?",B=new RegExp("^[0-9ï¼-ï¼Ù -Ù©Û°-Û¹]{2}$|^"+G+"$","i");function U(d){return d.length>=2&&B.test(d)}var H=new RegExp("(?:"+R()+")$","i");function W(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return V(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return V(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function V(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}var K={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","ï¼":"0","ï¼":"1","ï¼":"2","ï¼":"3","ï¼":"4","ï¼":"5","ï¼":"6","ï¼":"7","ï¼":"8","ï¼":"9","Ù ":"0","Ù¡":"1","Ù¢":"2","Ù£":"3","Ù¤":"4","Ù¥":"5","Ù¦":"6","Ù§":"7","Ù¨":"8","Ù©":"9","Û°":"0","Û±":"1","Û²":"2","Û³":"3","Û´":"4","Ûµ":"5","Û¶":"6","Û·":"7","Û¸":"8","Û¹":"9"};function Y(d){return K[d]}function Z(d){for(var t,e="",n=W(d.split(""));!(t=n()).done;){var r=Y(t.value);r&&(e+=r)}return e}function X(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return J(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return J(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function Q(d){for(var t,e="",n=X(d.split(""));!(t=n()).done;){e+=z(t.value,e)||""}return e}function z(d,t){if("+"===d){if(t)return;return"+"}return Y(d)}function q(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);
vendor: 4,123 bytes, line 954
954if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return dd(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return dd(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function dd(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function td(d,t){return ed(d,void 0,t)}function ed(d,t,e){var n=e.type(t),r=n&&n.possibleLengths()||e.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!e.type("FIXED_LINE"))return ed(d,"MOBILE",e);var a=e.type("MOBILE");a&&(r=function(d,t){for(var e,n=d.slice(),r=q(t);!(e=r()).done;){var a=e.value;d.indexOf(a)<0&&n.push(a)}return n.sort((function(d,t){return d-t}))}(r,a.possibleLengths()))}else if(t&&!n)return"INVALID_LENGTH";var i=d.length,o=r[0];return o===i?"IS_POSSIBLE":o>i?"TOO_SHORT":r[r.length-1]<i?"TOO_LONG":r.indexOf(i,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function nd(d,t){return"IS_POSSIBLE"===td(d,t)}function rd(d,t){return d=d||"",new RegExp("^(?:"+t+")$").test(d)}function ad(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return id(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return id(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function id(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}var od=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function $d(d,t,e){if(t=t||{},d.country||d.countryCallingCode){(e=new x(e)).selectNumberingPlan(d.country,d.countryCallingCode);var n=t.v2?d.nationalNumber:d.phone;if(rd(n,e.nationalNumberPattern())){if(ud(n,"FIXED_LINE",e))return e.type("MOBILE")&&""===e.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":e.type("MOBILE")?ud(n,"MOBILE",e)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,a=ad(od);!(r=a()).done;){var i=r.value;if(ud(n,i,e))return i}}}}function ud(d,t,e){return!(!(t=e.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(d.length)<0)&&rd(d,t.pattern()))}function ld(d,t,e){var n=new x(e).getCountryCodesForCallingCode(d);return n?n.filter((function(d){return function(d,t,e){var n=new x(e);if(n.selectNumberingPlan(t),n.numberingPlan.possibleLengths().indexOf(d.length)>=0)return!0;return!1}(t,d,e)})):[]}function cd(d){return d.replace(new RegExp("[".concat(h,"]+"),"g")," ").trim()}var sd=/(\$\d)/;function fd(d,t,e){var n=e.useInternationalFormat,r=e.withNationalPrefix;e.carrierCode,e.metadata;var a=d.replace(new RegExp(t.pattern()),n?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(sd,t.nationalPrefixFormattingRule()):t.format());return n?cd(a):a}var hd=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function gd(d,t){return function(d){if(Array.isArray(d))return d}(d)||function(d,t){var e=null==d?null:"undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(null==e)return;var n,r,a=[],i=!0,o=!1;try{for(e=e.call(d);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(d){o=!0,r=d}finally{try{i||null==e.return||e.return()}finally{if(o)throw r}}return a}(d,t)||yd(d,t)||function(){throw new TypeError("Invalid attempt to de
954structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yd(d,t){if(d){if("string"==typeof d)return md(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);return"Object"===e&&d.constructor&&(e=d.constructor.name),"Map"===e||"Set"===e?Array.from(d):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?md(d,t):void 0}}function md(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function pd(d){var t=d.number,e=d.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(e?";ext="+e:"")}function bd(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return vd(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return vd(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vd(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function Cd(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function Nd(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?Cd(Object(e),!0).forEach((function(t){Pd(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Cd(Object(e)).forEac
vendor: 2,569 bytes, line 954
954h((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function Pd(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}var Od={formatExtension:function(d,t,e){return"".concat(d).concat(e.ext()).concat(t)}};function xd(d,t,e,n){if(e=e?Nd(Nd({},Od),e):Od,n=new x(n),d.country&&"001"!==d.country){if(!n.hasCountry(d.country))throw new Error("Unknown country: ".concat(d.country));n.country(d.country)}else{if(!d.countryCallingCode)return d.phone||"";n.selectNumberingPlan(d.countryCallingCode)}var r,a=n.countryCallingCode(),i=e.v2?d.nationalNumber:d.phone;switch(t){case"NATIONAL":return i?Ed(r=wd(i,d.carrierCode,"NATIONAL",n,e),d.ext,n,e.formatExtension):"";case"INTERNATIONAL":return i?(r=wd(i,null,"INTERNATIONAL",n,e),Ed(r="+".concat(a," ").concat(r),d.ext,n,e.formatExtension)):"+".concat(a);case"E.164":return"+".concat(a).concat(i);case"RFC3966":return pd({number:"+".concat(a).concat(i),ext:d.ext});case"IDD":if(!e.fromCountry)return;var o=function(d,t,e,n,r){if(k(n,r.metadata)===e){var a=wd(d,t,"NATIONAL",r);return"1"===e?e+" "+a:a}var i=function(d,t,e){var n=new x(e);return n.selectNumberingPlan(d,t),n.defaultIDDPrefix()?n.defaultIDDPrefix():hd.test(n.IDDPrefix())?n.IDDPrefix():void 0}(n,void 0,r.metadata);if(i)return"".concat(i," ").concat(e," ").concat(wd(d,null,"INTERNATIONAL",r))}(i,d.carrierCode,a,e.fromCountry,n);return Ed(o,d.ext,n,e.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function wd(d,t,e,n,r){var a=Sd(n.formats(),d);return a?fd(d,a,{useInternationalFormat:"INTERNATIONAL"===e,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:n}):d}function Sd(d,t){for(var e,n=bd(d);!(e=n()).done;){var r=e.value;if(r.leadingDigitsPatterns().length>0){var a=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue}if(rd(t,r.pattern()))return r}}function Ed(d,t,e,n){return t?n(d,t,e):d}function Id(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function Ad(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?Id(Object(e),!0).forEach((function(t){Td(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Id(Object(e)).forEac
vendor: 5,282 bytes, line 954
954h((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function Td(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function jd(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var kd=function(){function d(t,e,n){if(function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!e)throw new TypeError("`nationalNumber` not passed");if(!n)throw new TypeError("`metadata` not passed");var r=function(d,t){var e,n,r=new x(t);a=d,/^[A-Z]{2}$/.test(a)?(e=d,r.selectNumberingPlan(e),n=r.countryCallingCode()):n=d;var a;return{country:e,countryCallingCode:n}}(t,n),a=r.country,i=r.countryCallingCode;this.country=a,this.countryCallingCode=i,this.nationalNumber=e,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}var t,e,n;return t=d,e=[{key:"setExt",value:function(d){this.ext=d}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:ld(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(d,t,e){if(void 0===t&&(t={}),e=new x(e),t.v2){if(!d.countryCallingCode)throw new Error("Invalid phone number object passed");e.selectNumberingPlan(d.countryCallingCode)}else{if(!d.phone)return!1;if(d.country){if(!e.hasCountry(d.country))throw new Error("Unknown country: ".concat(d.country));e.country(d.country)}else{if(!d.countryCallingCode)throw new Error("Invalid phone number object passed");e.selectNumberingPlan(d.countryCallingCode)}}if(e.possibleLengths())return nd(d.phone||d.nationalNumber,e);if(d.countryCallingCode&&e.isNonGeographicCallingCode(d.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(d,t,e){return t=t||{},(e=new x(e)).selectNumberingPlan(d.country,d.countryCallingCode),e.hasTypes()?void 0!==$d(d,t,e.metadata):rd(t.v2?d.nationalNumber:d.phone,e.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new x(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(d){return this.number===d.number&&this.ext===d.ext}},{key:"getType",value:function(){return $d(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(d,t){return xd(this,d,t?Ad(Ad({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(d){return this.format("NATIONAL",d)}},{key:"formatInternational",value:function(d){return this.format("INTERNATIONAL",d)}},{key:"getURI",value:function(d){return this.format("RFC3966",d)}}],e&&jd(t.prototype,e),n&&jd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();var Fd=new RegExp("([0-9ï¼-ï¼Ù -Ù©Û°-Û¹])");function Md(d,t,e,n){if(t){var r=new x(n);r.selectNumberingPlan(t,e);var a=new RegExp(r.IDDPrefix());if(0===d.search(a)){var i=(d=d.slice(d.match(a)[0].length)).match(Fd);if(!(i&&null!=i[1]&&i[1].length>0&&"0"===i[1]))return d}}}function Dd(d,t){if(d&&t.numberingPlan.nationalPrefixForParsing()){var e=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=e.exec(d);if(n){var r,a,i,o=n.length-1,$=o>0&&n[o];if(t.nationalPrefixTransformRule()&&$)r=d.replace(e,t.nationalPrefixTransformRule()),o>1&&(a=n[1]);else{var u=n[0];r=d.slice(u.length),$&&(a=n[1])}if($){var l=d.indexOf(n[1]);d.slice(0,l)===t.numberingPlan.nationalPrefix()&&(i=t.numberingPlan.nationalPrefix())}else i=n[0];return{nationalNumber:r,nationalPrefix:i,carrierCode:a}}}return{nationalNumber:d}}function Rd(d,t){var e=Dd(d,t),n=e.carrierCode,r=e.nationalNumber;if(r!==d){if(!function(d,t,e){if(rd(d,e.nationalNumberPattern())&&!rd(t,e.nationalNumberPattern()))return!1;return!0}(d,r,t))return{nationalNumber:d};if(t.possibleLengths()&&!function(d,t){switch(td(d,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:d}}return{nationalNumber:r,carrierCode:n}}function _d(d,t,e,n){var r=t?k(t,n):e;if(0===d.indexOf(r)){(n=new x(n)).selectNumberingPlan(t,e);var a=d.slice(r.length),i=Rd(a,n).nationalNumber,o=Rd(d,n).nationalNumber;if(!rd(o,n.nationalNumberPattern())&&rd(i,n.nationalNumberPattern())||"TOO_LONG"===td(o,n))return{countryCallingCode:r,number:a}}return{number:d}}function Ld(d,t,e,n){if(!d)return{};var r;if("+"!==d[0]){var a=Md(d,t,e,n);if(!a||a===d){if(t||e){var i=_d(d,t,e,n),o=i.countryCallingCode,$=i.number;if(o)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:o,number:$}}return{number:d}}r=!0,d="+"+a}if("0"===d[1])return{};n=new x(n);for(var u=2;u-1<=3&&u<=d.length;){var l=d.slice(1,u);if(n.hasCallingCode(l))return n.selectNumberingPlan(l),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:l,number:d.slice(u)};u++}return{}}function Gd(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);
vendor: 4,669 bytes, line 954
954if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return Bd(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Bd(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bd(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function Ud(d,t){var e=t.countries,n=t.defaultCountry,r=t.metadata;r=new x(r);for(var a,i=[],o=Gd(e);!(a=o()).done;){var $=a.value;if(r.country($),r.leadingDigits()){if(d&&0===d.search(r.leadingDigits()))return $}else if($d({phone:d,country:$},void 0,r.metadata)){if(!n)return $;if($===n)return $;i.push($)}}if(i.length>0)return i[0]}function Hd(d,t){var e=t.nationalNumber,n=t.defaultCountry,r=t.metadata,a=r.getCountryCodesForCallingCode(d);if(a)return 1===a.length?a[0]:Ud(e,{countries:a,defaultCountry:n,metadata:r.metadata})}var Wd=new RegExp("^\\+([0-9ï¼-ï¼Ù -Ù©Û°-Û¹]|[\\-\\.\\(\\)]?)*[0-9ï¼-ï¼Ù -Ù©Û°-Û¹]([0-9ï¼-ï¼Ù -Ù©Û°-Û¹]|[\\-\\.\\(\\)]?)*$","g"),Vd=new RegExp("^([0-9ï¼-ï¼Ù -Ù©Û°-Û¹]+((\\-)*[0-9ï¼-ï¼Ù -Ù©Û°-Û¹])*\\.)*[a-zA-Z]+((\\-)*[0-9ï¼-ï¼Ù -Ù©Û°-Û¹])*\\.?$","g"),Kd="tel:",Yd=";phone-context=";function Zd(d,t){var e,n=t.extractFormattedPhoneNumber,r=function(d){var t=d.indexOf(Yd);if(t<0)return null;var e=t+Yd.length;if(e>=d.length)return"";var n=d.indexOf(";",e);return n>=0?d.substring(e,n):d.substring(e)}(d);if(!function(d){return null===d||0!==d.length&&(Wd.test(d)||Vd.test(d))}(r))throw new s("NOT_A_NUMBER");if(null===r)e=n(d)||"";else{e="","+"===r.charAt(0)&&(e+=r);var a,i=d.indexOf(Kd);a=i>=0?i+Kd.length:0;var o=d.indexOf(Yd);e+=d.substring(a,o)}var $=e.indexOf(";isub=");if($>0&&(e=e.substring(0,$)),""!==e)return e}var Xd=new RegExp("[+ï¼0-9ï¼-ï¼Ù -Ù©Û°-Û¹]"),Jd=new RegExp("[^0-9ï¼-ï¼Ù -Ù©Û°-Û¹#]+$");function Qd(d,t,e){if(t=t||{},e=new x(e),t.defaultCountry&&!e.hasCountry(t.defaultCountry)){if(t.v2)throw new s("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var n=function(d,t,e){var n=Zd(d,{extractFormattedPhoneNumber:function(d){return function(d,t,e){if(!d)return;if(d.length>250){if(e)throw new s("TOO_LONG");return}if(!1===t)return d;var n=d.search(Xd);if(n<0)return;return d.slice(n).replace(Jd,"")}(d,e,t)}});if(!n)return{};if(!U(n))return function(d){return L.test(d)}(n)?{error:"TOO_SHORT"}:{};var r=function(d){var t=d.search(H);if(t<0)return{};for(var e=d.slice(0,t),n=d.match(H),r=1;r<n.length;){if(n[r])return{number:e,ext:n[r]};r++}}(n);if(r.ext)return r;return{number:n}}(d,t.v2,t.extract),r=n.number,a=n.ext,i=n.error;if(!r){if(t.v2){if("TOO_SHORT"===i)throw new s("TOO_SHORT");throw new s("NOT_A_NUMBER")}return{}}var o=function(d,t,e,n){var r,a=Ld(Q(d),t,e,n.metadata),i=a.countryCallingCodeSource,o=a.countryCallingCode,$=a.number;if(o)n.selectNumberingPlan(o);else{if(!$||!t&&!e)return{};n.selectNumberingPlan(t,e),t&&(r=t),o=e||k(t,n.metadata)}if(!$)return{countryCallingCodeSource:i,countryCallingCode:o};var u=Rd(Q($),n),l=u.nationalNumber,c=u.carrierCode,s=Hd(o,{nationalNumber:l,defaultCountry:t,metadata:n});s&&(r=s,"001"===s||n.country(r));return{country:r,countryCallingCode:o,countryCallingCodeSource:i,nationalNumber:l,carrierCode:c}}(r,t.defaultCountry,t.defaultCallingCode,e),$=o.country,u=o.nationalNumber,l=o.countryCallingCode,c=o.countryCallingCodeSource,f=o.carrierCode;if(!e.hasSelectedNumberingPlan()){if(t.v2)throw new s("INVALID_COUNTRY");return{}}if(!u||u.length<2){if(t.v2)throw new s("TOO_SHORT");return{}}if(u.length>17){if(t.v2)throw new s("TOO_LONG");return{}}if(t.v2){var h=new kd(l,u,e.metadata);return $&&(h.country=$),f&&(h.carrierCode=f),a&&(h.ext=a),h.__countryCallingCodeSource=c,h}var g=!!(t.extended?e.hasSelectedNumberingPlan():$)&&rd(u,e.nationalNumberPattern());return t.extended?{country:$,countryCallingCode:l,carrierCode:f,valid:g,possible:!!g||!(!0!==t.extended||!e.possibleLengths()||!nd(u,e)),phone:u,ext:a}:g?function(d,t,e){var n={country:d,phone:t};e&&(n.ext=e);return n}($,u,a):{}}function zd(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function qd(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};
vendor: 2,352 bytes, line 954
954t%2?zd(Object(e),!0).forEach((function(t){dt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):zd(Object(e)).forEach((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function dt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function tt(d,t,e){return Qd(d,qd(qd({},t),{},{v2:!0}),e)}function et(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function nt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function rt(d,t){return function(d){if(Array.isArray(d))return d}(d)||function(d,t){var e=null==d?null:"undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(null==e)return;var n,r,a=[],i=!0,o=!1;try{for(e=e.call(d);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(d){o=!0,r=d}finally{try{i||null==e.return||e.return()}finally{if(o)throw r}}return a}(d,t)||function(d,t){if(!d)return;if("string"==typeof d)return at(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return at(d,t)}(d,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function it(d){var t,e,n,r=rt(Array.prototype.slice.call(d),4),a=r[0],i=r[1],o=r[2],$=r[3];if("string"!=typeof a)throw new TypeError("A text for parsing must be a string.");if(t=a,i&&"string"!=typeof i){if(!p(i))throw new Error("Invalid second argument: ".concat(i));o?(e=i,n=o):n=i}else $?(e=o,n=$):(e=void 0,n=o),i&&(e=function(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?et(Object(e),!0).forEach((function(t){nt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):et(Object(e)).forEac
vendor: 1,679 bytes, line 954
954h((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}({defaultCountry:i},e));return{text:t,options:e,metadata:n}}function ot(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata;return tt(t,e,n)}function $t(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function ut(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?$t(Object(e),!0).forEach((function(t){lt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):$t(Object(e)).forEach((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function lt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function ct(d,t,e){t&&t.defaultCountry&&!F(t.defaultCountry,e)&&(t=ut(ut({},t),{},{defaultCountry:void 0}));try{return tt(d,t,e)}catch(d){if(!(d instanceof s))throw d}}function st(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata;return ct(t,e,n)}function ft(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function ht(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(e),!0).forEach((function(t){gt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):ft(Object(e)).forEac
vendor: 1,675 bytes, line 954
954h((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function gt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function yt(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=ct(t,e=ht(ht({},e),{},{extract:!1}),n);return r&&r.isValid()||!1}function mt(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function pt(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(e),!0).forEach((function(t){bt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):mt(Object(e)).forEach((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function bt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function vt(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=ct(t,e=pt(pt({},e),{},{extract:!1}),n);return r&&r.isPossible()||!1}function Ct(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function Nt(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(e),!0).forEach((function(t){Pt(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Ct(Object(e)).forEac
vendor: 4,323 bytes, line 954
954h((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function Pt(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function Ot(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata;e=Nt(Nt({},e),{},{extract:!1});try{var r=tt(t,e,n);(n=new x(n)).selectNumberingPlan(r.countryCallingCode);var a=td(r.nationalNumber,n);if("IS_POSSIBLE"!==a)return a}catch(d){if(d instanceof s)return d.message;throw d}}function xt(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}function wt(d,t,e){return t&&xt(d.prototype,t),e&&xt(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function St(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}var Et=wt((function d(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;St(this,d),this.key=t,this.value=e,this.next=n,this.prev=r})),It=function(){function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;St(this,d),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return wt(d,[{key:"put",value:function(d,t){if(this.ensureLimit(),this.head){var e=new Et(d,t,this.head);this.head.prev=e,this.head=e}else this.head=this.tail=new Et(d,t);this.cache[d]=this.head,this.size++}},{key:"get",value:function(d){if(this.cache[d]){var t=this.cache[d].value;return this.remove(d),this.put(d,t),t}console.log("Item not available in cache for key ".concat(d))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(d){var t=this.cache[d];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[d],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),d}();function At(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var Tt=function(){function d(t){!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.cache=new It(t)}var t,e,n;return t=d,(e=[{key:"getPatternForRegExp",value:function(d){var t=this.cache.get(d);return t||(t=new RegExp("^"+d),this.cache.put(d,t)),t}}])&&At(t.prototype,e),n&&At(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function jt(d,t){if(d<0||t<=0||t<d)throw new TypeError;return"{".concat(d,",").concat(t,"}")}function kt(d,t){var e=t.search(d);return e>=0?t.slice(0,e):t}var Ft=" áá â-â\u2028\u2029â¯âã",Mt="[".concat(Ft,"]"),Dt="[^".concat(Ft,"]"),Rt="[".concat("0-9Ù -Ù©Û°-Û¹ß-ß०-९০-৯੦-੯૦-૯à¦-à¯à¯¦-௯౦-౯೦-೯൦-൯à¹-à¹à»-à»à¼ -༩á-áá-áá -á©á -á á¥-á¥á§-á§áª-áªáª-áªá-áá®°-᮹á±-á±á±-á±ê -ê©ê£-ê£ê¤-ê¤ê§-ê§ê©-ê©ê¯°-꯹ï¼-ï¼","]"),_t="A-Za-zªµºÃ-ÃÃ-öø-ËË-ËË -ˤˬˮͰ-ʹͶͷͺ-ͽÎÎ-ÎÎÎ-ΡΣ-ϵϷ-ÒÒ-Ô§Ô±-ÕÕÕ¡-Ö×-תװ-×²Ø -Ùٮٯٱ-ÛÛÛ¥Û¦Û®Û¯Ûº-Û¼Û¿ÜÜ-ܯÝ-Þ¥Þ±ß-ߪߴߵߺà -à à à ¤à ¨à¡-à¡à¢ ࢢ-ࢬà¤-हऽà¥à¥-ॡॱ-ॷॹ-ॿà¦
-à¦à¦à¦à¦-নপ-রলশ-হঽà§à§à§à§-à§¡à§°à§±à¨
-à¨à¨à¨à¨-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹà©-à©à©à©²-à©´àª
-àªàª-àªàª-નપ-રલળવ-હઽà«à« à«¡à¬
-à¬à¬à¬à¬-ନପ-ରଲଳଵ-ହଽààà-à¡à±à®à®
-à®à®-à®à®-à®à®à®à®à®à®à®£à®¤à®¨-பம-ஹà¯à°
-à°à°-à°à°-నప-ళవ-హఽà±à±à± ౡà²
-à²à²-à²à²-ನಪ-ಳವ-ಹಽà³à³ ೡೱೲà´
-à´à´-à´à´-ഺഽàµàµ ൡൺ-ൿà¶
-à¶à¶-නඳ-රලà·-à·à¸-ะาำà¹-à¹àºàºàºàºàºàºàºàº-àºàº-àºàº¡-ຣລວສຫàº-ະາຳຽà»-à»à»à»-à»à¼à½-à½à½-ཬà¾-à¾á-áªá¿á-áá-áá¡á¥á¦á®-á°áµ-ááá -á
ááá-áºá¼-áá-áá-ááá-áá -áá-áá-á°á²-áµá¸-á¾áá-á
á-áá-áá-áá-áá-áá -á´á-á¬á¯-á¿á-áá -áªá-áá-áá -á±á-áá -á¬á®-á°á-á³ááá -á¡·á¢-ᢨᢪᢰ-ᣵá¤-á¤á¥-á¥á¥°-ᥴá¦-ᦫá§-á§á¨-á¨á¨ -á©áª§á¬
-ᬳá
-áá®-ᮠᮮᮯᮺ-ᯥá°-á°£á±-á±á±-ᱽᳩ-ᳬá
954³®-ᳱᳵᳶá´-á¶¿á¸-á¼á¼-á¼á¼ -á½
á½-á½á½-á½á½á½á½á½-á½½á¾-á¾´á¾¶-ᾼιá¿-á¿á¿-á¿á¿-á¿á¿-á¿á¿ -Ῥῲ-á¿´á¿¶-ῼâ±â¿â-ââââ-âââ-ââ¤â¦â¨âª-ââ¯-â¹â¼-â¿â
-â
â
âââ°-Ⱞⰰ-â±â± -ⳤⳫ-ⳮⳲⳳâ´-ⴥⴧâ´â´°-ⵧⵯâ¶-â¶â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-â¶¾â·-â·â·-â·â·-â·â·-â·â¸¯ã
ãã±-ãµã»ã¼ã-ãã-ãã¡-ãºã¼-ã¿ã
-ãã±-ãã -ãºã°-ã¿ã-ä¶µä¸-é¿ê-êê-ê½ê-êê-êêªê«ê-ê®ê¿-êê -ê¥ê-êê¢-êê-êê-êê -êªê¸-ê ê -ê
ê -ê ê -ê ¢ê¡-ꡳê¢-ꢳꣲ-ꣷꣻê¤-ꤥꤰ-ê¥ê¥ -ꥼê¦-ꦲê§ê¨-ꨨê©-ê©ê©-ê©ê© -ꩶꩺêª-ꪯꪱꪵꪶꪹ-ꪽê«ê«ê«-ê«ê« -ꫪꫲ-ê«´ê¬-ê¬ê¬-ê¬ê¬-ê¬ê¬ -ꬦꬨ-ꬮê¯-ꯢê°-í£í°-íí-í»ï¤-ï©ï©°-ï«ï¬-ï¬ï¬-ï¬ï¬ï¬-ﬨשׁ-זּטּ-לּמּïïïïï-ï®±ï¯-ï´½ïµ-ï¶ï¶-ï·ï·°-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-ï½ï½¦-ï¾¾ï¿-ï¿ï¿-ï¿ï¿-ï¿ï¿-ï¿",Lt="[".concat(_t,"]"),Gt=new RegExp(Lt),Bt="[".concat("$¢-Â¥ÖØà§²à§³à§»à«±à¯¹à¸¿áâ -â¹ê ¸ï·¼ï¹©ï¼ï¿ £¥₩","]"),Ut=new RegExp(Bt),Ht="[".concat("Ì-ͯÒ-ÒÖ-Ö½Ö¿××××
ר-ØÙ-ÙÙ°Û-ÛÛ-Û¤Û§Û¨Ûª-ÛÜܰ-ÝÞ¦-Þ°ß«-ß³à -à à -à £à ¥-à §à ©-à à¡-à¡à£¤-ࣾà¤-à¤à¤ºà¤¼à¥-à¥à¥à¥-à¥à¥¢à¥£à¦à¦¼à§-à§à§à§¢à§£à¨à¨à¨¼à©à©à©à©à©-à©à©à©°à©±à©µàªàªàª¼à«-à«
à«à«à«à«¢à«£à¬à¬¼à¬¿à-àààà¢à£à®à¯à¯à°¾-à±à±-à±à±-à±à±à±à±¢à±£à²¼à²¿à³à³à³à³¢à³£àµ-àµàµàµ¢àµ£à·à·-à·à·à¸±à¸´-ฺà¹-à¹àº±àº´-ູົຼà»-à»à¼à¼à¼µà¼·à¼¹à½±-ཾà¾-à¾à¾à¾à¾-à¾à¾-ྼà¿á-á°á²-á·á¹áºá½á¾ááá-á á±-á´áá
áááá-áá-áá²-á´ááá²á³á´áµá·-á½áá-ááá -á ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻á¨á¨á©á©-á©á© ᩢᩥ-ᩬᩳ-᩿᩼á¬-á¬á¬´á¬¶-ᬺᬼáá«-á³á®á®á®¢-ᮥᮨᮩ᯦᮫ᯨᯩá¯á¯¯-ᯱᰬ-ᰳᰶ᰷á³-á³á³-á³ á³¢-᳨á³á³´á·-ᷦ᷼-á·¿â-ââ¡â¥-â°â³¯-⵿⳱ⷠ-â·¿ãª-ãããê¯ê´-ê½êê°ê±ê ê ê ê ¥ê ¦ê£ê£ -꣱ꤦ-ê¤ê¥-ê¥ê¦-ê¦ê¦³ê¦¶-ꦹꦼꨩ-ꨮꨱꨲꨵꨶê©ê©êª°êª²-ꪴꪷꪸꪾ꪿ê«ê«¬ê«ê«¶ê¯¥ê¯¨ê¯ï¬ï¸-ï¸ï¸ -︦","]"),Wt=new RegExp(Ht),Vt=new RegExp("[\0-�Â-ÿÄ-Å¿á¸-ỿÆ-ÉÌ-ͯ]");function Kt(d){return!(!Gt.test(d)&&!Wt.test(d))&&Vt.test(d)}function Yt(d){return"%"===d||Ut.test(d)}function Zt(d,t,e){var n=!0,r=st(d,e);if(r||(n=!1,r=st(d,{defaultCallingCode:t.countryCallingCode},e)),!r)return"INVALID_NUMBER";if(t.ext){if(r.ext!==t.ext)return"NO_MATCH"}else if(r.ext)return"NO_MATCH";return n&&t.countryCallingCode!==r.countryCallingCode?"NO_MATCH":t.number===r.number?n?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(r.nationalNumber)||0===r.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var Xt={POSSIBLE:function(d,t){return t.candidate,t.metadata,!0},VALID:function(d,t){var e=t.candidate;t.defaultCountry;var n=t.metadata;return!(!d.isValid()||!Jt(d,e,n))},STRICT_GROUPING:function(d,t){var e=t.candidate,n=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!d.isValid()||!Jt(d,e,r)||zt(d,e)||!Qt(d,{defaultCountry:n,metadata:r}))&&qt()},EXACT_GROUPING:function(d,t){var e=t.candidate,n=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!d.isValid()||!Jt(d,e,r)||zt(d,e)||!Qt(d,{defaultCountry:n,metadata:r}))&&qt()}};function Jt(d,t,e){for(var n=0;n<t.length-1;n++){var r=t.charAt(n);if("x"===r||"X"===r){var a=t.charAt(n+1);if("x"===a||"X"===a){if(n++,"NSN_MATCH"!==Zt(t.substring(n),d,e))return!1}else{var i=Z(t.substring(n));if(i){if(d.ext!==i)return!1}else if(d.ext)return!1}}}return!0}function Qt(d,t){var e=t.defaultCountry,n=t.metadata;if("FROM_DEFAULT_COUNTRY"!==d.__countryCallingCodeSource)return!0;var r=new x(n);r.selectNumberingPlan(d.countryCallingCode),d.country||Hd(d.countryCallingCode,{nationalNumber:d.nationalNumber,defaultCountry:e,metadata:r});var a=d.nationalNumber,i=Sd(r.numberingPlan.formats(),a);return!i.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!i.usesNationalPrefix()||Boolean(d.nationalPrefix)))}function zt(d,t){var e=t.indexOf("/");if(e<0)return!1;var n=t.indexOf("/",e+1);return!(n<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===d.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===d.__countryCallingCodeSource)||Z(t.substring(0,e))!==d.countryCallingCode||t.slice(n+1).indexOf("/")>=0)}function qt(d,t,e,n,r){throw new Error("This part of code hasn't been ported")}var de=/[\\/] *x/;function te(d){return kt(de,d)}
954var ee=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,ne=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,re=/^:[0-5]\d/;function ae(d,t,e){if(ee.test(d))return!1;if(ne.test(d)){var n=e.slice(t+d.length);if(re.test(n))return!1}return!0}var ie="(\\[ï¼ï¼»",oe=")\\]ï¼ï¼½",$e="[^".concat(ie).concat(oe,"]"),ue="[".concat(ie).concat(g,"]"),le=new RegExp("^"+ue),ce=jt(0,3),se=new RegExp("^(?:[(\\[ï¼ï¼»])?(?:"+$e+"+["+")\\]ï¼ï¼½])?"+$e+"+(?:["+"(\\[ï¼ï¼»]"+$e+"+["+")\\]ï¼ï¼½])"+ce+$e+"*$"),fe=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function he(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return ge(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ge(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ge(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function ye(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}function me(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var pe=R(),be=["\\/+(.*)/","(\\([^(]*)","(?:".concat(Mt,"-|-").concat(Mt,")").concat(Mt,"*(.+)"),"[â-âï¼]".concat(Mt,"*(.+)"),"\\.+".concat(Mt,"*([^.]+)"),"".concat(Mt,"+(").concat(Dt,"+)")],ve=jt(0,2),Ce=jt(0,4),Ne=jt(0,20),Pe="[".concat(h,"]")+Ce,Oe=Rt+jt(1,20),xe="(?:"+ue+Pe+")"+ve+Oe+"(?:"+Pe+Oe+")"+Ne+"(?:"+pe+")?",we=new RegExp("[^".concat("0-9²³¹¼-¾٠-Ù©Û°-Û¹ß-ß०-९০-৯৴-৹੦-੯૦-૯à¦-à¯à²-à·à¯¦-௲౦-౯౸-౾೦-೯൦-൵à¹-à¹à»-à»à¼ -༳á-áá-áá©-á¼á®-á°á -á©á°-á¹á -á á¥-á¥á§-á§áª-áªáª-áªá-áá®°-᮹á±-á±á±-á±â°â´-â¹â-ââ
-ââ
-ââ -ââª-â¿â¶-ââ³½ãã¡-ã©ã¸-ãºã-ãã -ã©ã-ãã-ãã-ãã±-ã¿ê -ê©ê¦-ê¯ê °-ê µê£-ê£ê¤-ê¤ê§-ê§ê©-ê©ê¯°-꯹ï¼-ï¼").concat(_t,"#]+$")),Se=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Ee=function(){function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(ye(this,d),!(e={v2:e.v2,defaultCallingCode:e.defaultCallingCode,defaultCountry:e.defaultCountry&&F(e.defaultCountry,n)?e.defaultCountry:void 0,leniency:e.leniency||(e.extended?"POSSIBLE":"VALID"),maxTries:e.maxTries||Se}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==e.leniency&&"VALID"!==e.leniency)throw new TypeError('Invalid `leniency`: "'.concat(e.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(e.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=t,this.options=e,this.metadata=n,this.leniency=Xt[e.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(e.leniency,'"'));this.maxTries=e.maxTries,this.PATTERN=new RegExp(xe,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new Tt(32)}var t,e,n;return t=d,e=[{key:"find",value:function(){for(var d;this.maxTries>0&&null!==(d=this.PATTERN.exec(this.text));){var t=d[0],e=d.index;if(ae(t=te(t),e,this.text)){var n=this.parseAndVerify(t,e,this.text)||this.extractInnerMatch(t,e,this.text);if(n){if(this.options.v2)return{startsAt:n.startsAt,endsAt:n.endsAt,number:n.phoneNumber};var r=n.phoneNumber,a={startsAt:n.startsAt,endsAt:n.endsAt,phone:r.nationalNumber};return r.country?a.country=r.country:a.countryCallingCode=r.countryCallingCode,r.ext&&(a.ext=r.ext),a}}this.maxTries--}}},{key:"extractInnerMatch",value:function(d,t,e){for(var n,r=he(be);!(n=r()).done;)for(var a=n.value,i=!0,o=void 0,$=new RegExp(a,"g");this.maxTries>0&&null!==(o=$.exec(d));){if(i){var u=kt(we,d.slice(0,o.index)),l=this.parseAndVerify(u,t,e);if(l)return l;this.maxTries--,i=!1}var c=kt(we,o[1]),s=d.indexOf(c,o.index),f=this.parseAndVerify(c,t+s,e);if(f)return f;this.maxTries--}}},{key:"parseAndVerify",value:function(d,t,e){if(function(d,t,e,n){if(se.test(d)&&!fe.test(d)){if("POSSIBLE"!==n){if(t>0&&!le.test(d)){var r=e[t-1];if(Yt(r)||Kt(r))return!1}var a=t+d.length;if(a<e.length){var i=e[a];if(Yt(i)||Kt(i))return!1}}return!0}}(d,t,e,this.options.leniency)){var n=st(d,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(n&&n.isPossible())return this.leniency(n,{candidate:d,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+d.length,phoneNumber:n}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var d=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",d}}],e&&me(t.prototype,e),n&&me(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function Ie(){for(var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=new Ee(t,e,n),a=[];r.hasNext();)a.push(r.next());return a}function Ae(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function Te(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=new Ee(t,e,n);return Ae({},Symbol.iterator,(function(){return{next:function(){return r.hasNext()?{done:!1,value:r.next()}:{done:!0}}}}))}function je(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function ke(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};
vendor: 7,209 bytes, line 954
954t%2?je(Object(e),!0).forEach((function(t){Fe(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):je(Object(e)).forEach((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function Fe(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function Me(){for(var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=new Ee(t,ke(ke({},e),{},{v2:!0}),n),a=[];r.hasNext();)a.push(r.next());return a}function De(d,t){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(d);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(d,t).enumerable}))),e.push.apply(e,n)}return e}function Re(d){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?De(Object(e),!0).forEach((function(t){_e(d,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):De(Object(e)).forEach((function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))}))}return d}function _e(d,t,e){return t in d?Object.defineProperty(d,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[t]=e,d}function Le(){var d=it(arguments),t=d.text,e=d.options,n=d.metadata,r=new Ee(t,Re(Re({},e),{},{v2:!0}),n);return _e({},Symbol.iterator,(function(){return{next:function(){return r.hasNext()?{done:!1,value:r.next()}:{done:!0}}}}))}function Ge(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var Be=function(){function d(t){var e=t.onCountryChange,n=t.onCallingCodeChange;!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.onCountryChange=e,this.onCallingCodeChange=n}var t,e,n;return t=d,(e=[{key:"reset",value:function(d){var t=d.country,e=d.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,e)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(d){for(var t=0,e=Object.keys(d);t<e.length;t++){var n=e[t];this[n]=d[n]}}},{key:"initCountryAndCallingCode",value:function(d,t){this.setCountry(d),this.setCallingCode(t)}},{key:"setCountry",value:function(d){this.country=d,this.onCountryChange(d)}},{key:"setCallingCode",value:function(d){this.callingCode=d,this.onCallingCodeChange(d,this.country)}},{key:"startInternationalNumber",value:function(d,t){this.international=!0,this.initCountryAndCallingCode(d,t)}},{key:"appendDigits",value:function(d){this.digits+=d}},{key:"appendNationalSignificantNumberDigits",value:function(d){this.nationalSignificantNumber+=d}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])&&Ge(t.prototype,e),n&&Ge(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function Ue(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return He(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return He(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function He(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}var We="x",Ve=new RegExp(We);function Ke(d,t){if(t<1)return"";for(var e="";t>1;)1&t&&(e+=d),t>>=1,d+=d;return e+d}function Ye(d,t){return")"===d[t]&&t++,function(d){var t=[],e=0;for(;e<d.length;)"("===d[e]?t.push(e):")"===d[e]&&t.pop(),e++;var n=0,r="";t.push(d.length);for(var a=0,i=t;a<i.length;a++){var o=i[a];r+=d.slice(n,o),n=o+1}return r}(d.slice(0,t))}function Ze(d,t,e){var n=e.metadata,r=e.shouldTryNationalPrefixFormattingRule,a=e.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(d.nationalSignificantNumber))return function(d,t,e){var n=e.metadata,r=e.shouldTryNationalPrefixFormattingRule,a=e.getSeparatorAfterNationalPrefix;if(d.nationalSignificantNumber,d.international,d.nationalPrefix,d.carrierCode,r(t)){var i=Xe(d,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:n});if(i)return i}return Xe(d,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:n})}(d,t,{metadata:n,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:a})}function Xe(d,t,e){var n=e.metadata,r=e.useNationalPrefixFormattingRule,a=e.getSeparatorAfterNationalPrefix,i=fd(d.nationalSignificantNumber,t,{carrierCode:d.carrierCode,useInternationalFormat:d.international,withNationalPrefix:r,metadata:n});if(r||(d.nationalPrefix?i=d.nationalPrefix+a(t)+i:d.complexPrefixBeforeNationalSignificantNumber&&(i=d.complexPrefixBeforeNationalSignificantNumber+" "+i)),function(d,t){return Z(d)===t.getNationalDigits()}(i,d))return i}function Je(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var Qe=function(){function d(){!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d)}var t,e,n;return t=d,(e=[{key:"parse",value:function(d){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(d),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],e=t.branches,n=t.instructions;if(e)return{op:"|",args:e.concat([tn(n)])};if(0===n.length)throw new Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(d){this.context.push(d)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(d){if(!d)throw new Error("Pattern is required");var t=d.match(dn);if(t){var e=t[1],n=d.slice(0,t.index),r=d.slice(t.index+e.length);switch(e){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw new Error('No instructions foun
954d after "|" operator in an "or" group');var a=this.getContext().branches;a.push(tn(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:a});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(tn(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:ze(n)});break;default:throw new Error("Unknown operator: ".concat(e))}r&&this.parsePattern(r)}else{if(qe.test(d))throw new Error("Illegal characters found in a pattern: ".concat(d));this.getContext().instructions=this.getContext().instructions.concat(d.split(""))}}}])&&Je(t.prototype,e),n&&Je(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function ze(d){for(var t=[],e=0;e<d.length;){if("-"===d[e]){if(0===e||e===d.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(d));for(var n=d[e-1].charCodeAt(0)+1,r=d[e+1].charCodeAt(0)-1,a=n;a<=r;)t.push(String.fromCharCode(a)),a++}else t.push(d[e]);e++}return t}var qe=/[\(\)\[\]\?\:\|]/,dn=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function tn(d){return 1===d.length?d[0]:d}function en(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return nn(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return nn(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function nn(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function rn(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var an=function(){function d(t){!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.matchTree=(new Qe).parse(t)}var t,e,n;return t=d,e=[{key:"match",value:function(d){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.allowOverflow;if(!d)throw new Error("String is required");var n=on(d.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||e)return n}}],e&&rn(t.prototype,e),n&&rn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function on(d,t,e){if("string"==typeof t){var n=d.join("");return 0===t.indexOf(n)?d.length===t.length?{match:!0,matchedChars:d}:{partialMatch:!0}:0===n.indexOf(t)?e&&d.length>t.length?{overflow:!0}:{match:!0,matchedChars:d.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var r=d.slice(),a=0;a<t.length;){var i=on(r,t[a],e&&a===t.length-1);if(!i)return;if(i.overflow)return i;if(!i.match){if(i.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(i,null,2)))}if(0===(r=r.slice(i.matchedChars.length)).length)return a===t.length-1?{match:!0,matchedChars:d}:{partialMatch:!0};a++}return e?{overflow:!0}:{match:!0,matchedChars:d.slice(0,d.length-r.length)}}switch(t.op){case"|":for(var o,$,u=en(t.args);!($=u()).done;){var l=on(d,$.value,e);if(l){if(l.overflow)return l;if(l.match)return{match:!0,matchedChars:l.matchedChars};if(!l.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(l,null,2)));o=!0}}return o?{partialMatch:!0}:void 0;case"[]":for(var c,s=en(t.args);!(c=s()).done;){var f=c.value;if(d[0]===f)return 1===d.length?{match:!0,matchedChars:d}:e?{overflow:!0}:{match:!0,matchedChars:[f]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function $n(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);
vendor: 5,464 bytes, line 954
954if(Array.isArray(d)||(e=function(d,t){if(!d)return;if("string"==typeof d)return un(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return un(d,t)}(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function ln(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var cn=Ke("9",15),sn=/[- ]/,fn=new RegExp("["+h+"]*\\$1["+h+"]*(\\$\\d["+h+"]*)*$"),hn=function(){function d(t){t.state;var e=t.metadata;!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.metadata=e,this.resetFormat()}var t,e,n;return t=d,e=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(d,t){this.resetFormat(),d?(this.isNANP="1"===d.callingCode(),this.matchingFormats=d.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(d,t){var e=this;if(function(d,t){return"IS_POSSIBLE"===td(d,t)}(t.nationalSignificantNumber,this.metadata))for(var n,r=$n(this.matchingFormats);!(n=r()).done;){var a=n.value,i=Ze(t,a,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(d){return e.shouldTryNationalPrefixFormattingRule(d,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(d){return e.getSeparatorAfterNationalPrefix(d)}});if(i)return this.resetFormat(),this.chosenFormat=a,this.setNationalNumberTemplate(i.replace(/\d/g,We),t),this.populatedNationalNumberTemplate=i,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(We),i}return this.formatNationalNumberWithNextDigits(d,t)}},{key:"formatNationalNumberWithNextDigits",value:function(d,t){var e=this.chosenFormat,n=this.chooseFormat(t);if(n)return n===e?this.formatNextNationalNumberDigits(d):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(d){var t=this,e=d.nationalSignificantNumber,n=d.nationalPrefix,r=d.international,a=e,i=a.length-3;i<0&&(i=0),this.matchingFormats=this.matchingFormats.filter((function(d){return t.formatSuits(d,r,n)&&t.formatMatches(d,a,i)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(d,t,e){return!(e&&!d.usesNationalPrefix()&&!d.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!e&&d.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(d,t,e){var n=d.leadingDigitsPatterns().length;if(0===n)return!0;e=Math.min(e,n-1);var r=d.leadingDigitsPatterns()[e];if(t.length<3)try{return void 0!==new an(r).match(t,{allowOverflow:!0})}catch(d){return console.error(d),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(d,t){return t?d.internationalFormat():d.format()}},{key:"chooseFormat",value:function(d){for(var t,e=this,n=function(){var n=t.value;return e.chosenFormat===n?"break":fn.test(e.getFormatFormat(n,d.international))?e.createTemplateForFormat(n,d)?(e.chosenFormat=n,"break"):(e.matchingFormats=e.matchingFormats.filter((function(d){return d!==n})),"continue"):"continue"},r=$n(this.matchingFormats.slice());!(t=r()).done;){var a=n();if("break"===a)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(d,t){if(!(d.pattern().indexOf("|")>=0)){var e=this.getTemplateForFormat(d,t);return e?(this.setNationalNumberTemplate(e,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(d){return this.isNANP||d&&d.nationalPrefixFormattingRule()&&sn.test(d.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(d,t){var e=d.IDDPrefix,n=d.missingPlus;return e?t&&!1===t.spacing?e:e+" ":n?"":"+"}},{key:"getTemplate",value:function(d){if(this.template){for(var t=-1,e=0,n=d.international?this.getInternationalPrefixBeforeCountryCallingCode(d,{spacing:!1}):"";e<n.length+d.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(We,t+1),e++;return Ye(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(d,t){this.nationalNumberTemplate=d,this.populatedNationalNumberTemplate=d,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,We)+Ke(We,t.callingCode.length)+" "+d:this.template=d}},{key:"getTemplateForFormat",value:function(d,t){var e=t.nationalSignificantNumber,n=t.international,r=t.nationalPrefix,a=t.complexPrefixBeforeNationalSignificantNumber,i=d.pattern();i=i.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var o=cn.match(i)[0];if(!(e.length>
vendor: 5,058 bytes, line 954
954o.length)){var $=new RegExp("^"+i+"$"),u=e.replace(/\d/g,"9");$.test(u)&&(o=u);var l,c=this.getFormatFormat(d,n);if(this.shouldTryNationalPrefixFormattingRule(d,{international:n,nationalPrefix:r})){var s=c.replace(sd,d.nationalPrefixFormattingRule());if(Z(d.nationalPrefixFormattingRule())===(r||"")+Z("$1")&&(c=s,l=!0,r))for(var f=r.length;f>0;)c=c.replace(/\d/,We),f--}var h=o.replace(new RegExp(i),c).replace(new RegExp("9","g"),We);return l||(a?h=Ke(We,a.length)+" "+h:r&&(h=Ke(We,r.length)+this.getSeparatorAfterNationalPrefix(d)+h)),n&&(h=cd(h)),h}}},{key:"formatNextNationalNumberDigits",value:function(d){var t=function(d,t,e){for(var n,r=Ue(e.split(""));!(n=r()).done;){var a=n.value;if(d.slice(t+1).search(Ve)<0)return;t=d.search(Ve),d=d.replace(Ve,a)}return[d,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,d);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Ye(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(d,t){var e=t.international,n=t.nationalPrefix;if(d.nationalPrefixFormattingRule()){var r=d.usesNationalPrefix();if(r&&n||!r&&!e)return!0}}}],e&&ln(t.prototype,e),n&&ln(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function gn(d,t){return function(d){if(Array.isArray(d))return d}(d)||function(d,t){var e=null==d?null:"undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(null==e)return;var n,r,a=[],i=!0,o=!1;try{for(e=e.call(d);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(d){o=!0,r=d}finally{try{i||null==e.return||e.return()}finally{if(o)throw r}}return a}(d,t)||function(d,t){if(!d)return;if("string"==typeof d)return yn(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return yn(d,t)}(d,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yn(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function mn(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var pn=new RegExp("^"+("["+h+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]+")+"$","i"),bn="(?:[+ï¼]["+h+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]*|["+h+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]+)",vn=new RegExp("[^"+h+"0-9ï¼-ï¼Ù -Ù©Û°-Û¹]+.*$"),Cn=/[^\d\[\]]/,Nn=function(){function d(t){var e=t.defaultCountry,n=t.defaultCallingCode,r=t.metadata,a=t.onNationalSignificantNumberChange;!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.defaultCountry=e,this.defaultCallingCode=n,this.metadata=r,this.onNationalSignificantNumberChange=a}var t,e,n;return t=d,(e=[{key:"input",value:function(d,t){var e,n=function(d){var t=gn(function(d){var t=function(d){var t,e=d.search(bn);if(!(e<0))return"+"===(d=d.slice(e))[0]&&(t=!0,d=d.slice("+".length)),d=d.replace(vn,""),t&&(d="+"+d),d}(d)||"";return"+"===t[0]?[t.slice("+".length),!0]:[t]}(d),2),e=t[0],n=t[1];return pn.test(e)||(e=""),[e,n]}(d),r=gn(n,2),a=r[0],i=r[1],o=Z(a);return i&&(t.digits||(t.startInternationalNumber(),o||(e=!0))),o&&this.inputDigits(o,t),{digits:o,justLeadingPlus:e}}},{key:"inputDigits",value:function(d,t){var e=t.digits,n=e.length<3&&e.length+d.length>=3;if(t.appendDigits(d),n&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(d);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(d){return t.update(d)}))}},{key:"isWaitingForCountryCallingCode",value:function(d){var t=d.international,e=d.callingCode;return t&&!e}},{key:"extractCountryCallingCode",value:function(d){var t=Ld("+"+d.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),e=t.countryCallingCode,n=t.number;if(e)return d.setCallingCode(e),d.update({nationalSignificantNumber:n}),!0}},{key:"reset",value:function(d){if(d){this.hasSelectedNumberingPlan=!0;var t=d._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Cn.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(d,t){if(this.hasSelectedNumberingPlan){var e=Dd(d,this.metadata),n=e.nationalPrefix,r=e.nationalNumber,a=e.carrierCode;if(r!==d)return this.onExtractedNationalNumber(n,a,r,d,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(d,t,e){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(d,e);
vendor: 4,311 bytes, line 954
954if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=Dd(d,this.metadata),r=n.nationalPrefix,a=n.nationalNumber,i=n.carrierCode;if(a!==t)return this.onExtractedNationalNumber(r,i,a,d,e),!0}}},{key:"onExtractedNationalNumber",value:function(d,t,e,n,r){var a,i,o=n.lastIndexOf(e);if(o>=0&&o===n.length-e.length){i=!0;var $=n.slice(0,o);$!==d&&(a=$)}r({nationalPrefix:d,carrierCode:t,nationalSignificantNumber:e,nationalSignificantNumberMatchesInput:i,complexPrefixBeforeNationalSignificantNumber:a}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(d){return!!this.extractAnotherNationalSignificantNumber(d.getNationalDigits(),d.nationalSignificantNumber,(function(t){return d.update(t)}))||(this.extractIddPrefix(d)||this.fixMissingPlus(d)?(this.extractCallingCodeAndNationalSignificantNumber(d),!0):void 0)}},{key:"extractIddPrefix",value:function(d){var t=d.international,e=d.IDDPrefix,n=d.digits;if(d.nationalSignificantNumber,!t&&!e){var r=Md(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==n?(d.update({IDDPrefix:n.slice(0,n.length-r.length)}),this.startInternationalNumber(d,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(d){if(!d.international){var t=_d(d.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),e=t.countryCallingCode;if(t.number,e)return d.update({missingPlus:!0}),this.startInternationalNumber(d,{country:d.country,callingCode:e}),!0}}},{key:"startInternationalNumber",value:function(d,t){var e=t.country,n=t.callingCode;d.startInternationalNumber(e,n),d.nationalSignificantNumber&&(d.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(d){this.extractCountryCallingCode(d)&&this.extractNationalSignificantNumber(d.getNationalDigits(),(function(t){return d.update(t)}))}}])&&mn(t.prototype,e),n&&mn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function Pn(d,t){return function(d){if(Array.isArray(d))return d}(d)||function(d,t){var e=null==d?null:"undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(null==e)return;var n,r,a=[],i=!0,o=!1;try{for(e=e.call(d);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(d){o=!0,r=d}finally{try{i||null==e.return||e.return()}finally{if(o)throw r}}return a}(d,t)||function(d,t){if(!d)return;if("string"==typeof d)return On(d,t);var e=Object.prototype.toString.call(d).slice(8,-1);"Object"===e&&d.constructor&&(e=d.constructor.name);if("Map"===e||"Set"===e)return Array.from(d);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return On(d,t)}(d,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function On(d,t){(null==t||t>d.length)&&(t=d.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=d[e];return n}function xn(d,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(d,n.key,n)}}var wn=function(){function d(t,e){!function(d,t){if(!(d instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),this.metadata=new x(e);var n=Pn(this.getCountryAndCallingCode(t),2),r=n[0],a=n[1];this.defaultCountry=r,this.defaultCallingCode=a,this.reset()}var t,e,n;return t=d,e=[{key:"getCountryAndCallingCode",value:function(d){var t,e;return d&&(p(d)?(t=d.defaultCountry,e=d.defaultCallingCode):t=d),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,e]}},{key:"input",value:function(d){var t=this.parser.input(d,this.state),e=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(e){var n;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(n=this.formatter.format(e,this.state)),void 0===n&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(n=this.formatter.format(r,this.state))}
vendor: 5,532 bytes, line 954
954this.formattedOutput=n?this.getFullNumber(n):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var d=this;return this.state=new Be({onCountryChange:function(t){d.country=t},onCallingCodeChange:function(t,e){d.metadata.selectNumberingPlan(e,t),d.formatter.reset(d.metadata.numberingPlan,d.state),d.parser.reset(d.metadata.numberingPlan)}}),this.formatter=new hn({state:this.state,metadata:this.metadata}),this.parser=new Nn({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){d.determineTheCountryIfNeeded(),d.formatter.reset(d.metadata.numberingPlan,d.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(d){var t=this;if(this.isInternational()){var e=function(d){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!d})+d},n=this.state.callingCode;return e(n?d?"".concat(n," ").concat(d):n:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return d}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var d=this.state,t=d.nationalSignificantNumber,e=d.complexPrefixBeforeNationalSignificantNumber,n=d.nationalPrefix,r=t,a=e||n;return a&&(r=a+r),r}},{key:"getNonFormattedNumber",value:function(){var d=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(d?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var d=this.getNonFormattedNumber();if(d)return d.replace(/[\+\d]/g,We)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var d=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(d);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(Hd(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var d=this.state,t=d.digits,e=d.callingCode,n=d.country,r=d.nationalSignificantNumber;if(t)return this.isInternational()?e?"+"+e+r:"+"+t:n||e?"+"+(n?this.metadata.countryCallingCode():e)+r:void 0}},{key:"getNumber",value:function(){var d=this.state,t=d.nationalSignificantNumber,e=d.carrierCode,n=d.callingCode,r=this._getCountry();if(t&&(r||n)){if(r&&r===this.defaultCountry){var a=new x(this.metadata.metadata);a.selectNumberingPlan(r);var i=a.numberingPlan.callingCode(),o=this.metadata.getCountryCodesForCallingCode(i);if(o.length>1){var $=Ud(t,{countries:o,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});$&&(r=$)}}var u=new kd(r||n,t,this.metadata.metadata);return e&&(u.carrierCode=e),u}}},{key:"isPossible",value:function(){var d=this.getNumber();return!!d&&d.isPossible()}},{key:"isValid",value:function(){var d=this.getNumber();return!!d&&d.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}],e&&xn(t.prototype,e),n&&xn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}();function Sn(d){return new x(d).getCountries()}function En(d,t,e){if(t[d])return new kd(d,t[d],e)}function In(d,t,e){return e||(e=t,t=void 0),new wn(t,e).input(d)}function An(){return e(ot,arguments)}function Tn(){return e(st,arguments)}function jn(d,e){return Ee.call(this,d,e,t)}function kn(d){return wn.call(this,d,t)}function Fn(){return x.call(this,t)}jn.prototype=Object.create(Ee.prototype,{}),jn.prototype.constructor=jn,kn.prototype=Object.create(wn.prototype,{}),kn.prototype.constructor=kn,Fn.prototype=Object.create(x.prototype,{}),Fn.prototype.constructor=Fn,d.AsYouType=kn,d.DIGIT_PLACEHOLDER=We,d.Metadata=Fn,d.ParseError=s,d.PhoneNumberMatcher=jn,d.default=Tn,d.findNumbers=function(){return e(Ie,arguments)},d.findPhoneNumbersInText=function(){return e(Me,arguments)},d.formatIncompletePhoneNumber=function(){return e(In,arguments)},d.formatRFC3966=pd,d.getCountries=function(){return e(Sn,arguments)},d.getCountryCallingCode=function(){return e(k,arguments)},d.getExampleNumber=function(){return e(En,arguments)},d.getExtPrefix=function(){return e(j,arguments)},d.isPossiblePhoneNumber=function(){return e(vt,arguments)},d.isSupportedCountry=function(){return e(F,arguments)},d.isValidPhoneNumber=function(){return e(yt,arguments)},d.parseDigits=Z,d.parseIncompletePhoneNumber=Q,d.parsePhoneNumber=An,d.parsePhoneNumberCharacter=z,d.parsePhoneNumberFromString=Tn,d.parsePhoneNumberWithError=An,d.parseRFC3966=function(d){for(var t,e,n,r=function(d,t){var e="undefined"!=typeof Symbol&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);
954if(Array.isArray(d)||(e=yd(d))||t&&d&&"number"==typeof d.length){e&&(d=e);var n=0;return function(){return n>=d.length?{done:!0}:{done:!1,value:d[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}((d=d.replace(/^tel:/,"tel=")).split(";"));!(n=r()).done;){var a=gd(n.value.split("="),2),i=a[0],o=a[1];switch(i){case"tel":t=o;break;case"ext":e=o;break;case"phone-context":"+"===o[0]&&(t=o+t)}}if(!U(t))return{};var $={number:t};return e&&($.ext=e),$},d.searchNumbers=function(){return e(Te,arguments)},d.searchPhoneNumbersInText=function(){return e(Le,arguments)},d.validatePhoneNumberLength=function(){return e(Ot,arguments)},Object.defineProperty(d,"__esModule",{value:!0})})); 955//# sourceMappingURL=libphonenumber-max.js.map; 956/** 957 * @licstart The following is the entire license notice for the 958 * Javascript code in this page 959 * 960 * Copyright 2020 Mozilla Foundation 961 * 962 * Licensed under the Apache License, Version 2.0 (the "License"); 963 * you may not use this file except in compliance with the License. 964 * You may obtain a copy of the License at 965 * 966 * http://www.apache.org/licenses/LICENSE-2.0 967 * 968 * Unless required by applicable law or agreed to in writing, software 969 * distributed under the License is distributed on an "AS IS" BASIS, 970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 971 * See the License for the specific language governing permissions and 972 * limitations under the License. 973 * 974 * @licend The above is the entire license notice for the 975 * Javascript code in this page 976 */ 977 978(function webpackUniversalModuleDefinition(root, factory) { 979 if(typeof exports === 'object' && typeof module === 'object') 980 module.exports = factory(); 981 else if(typeof define === 'function' && define.amd) 982 define("pdfjs-dist/build/pdf", [], factory); 983 else if(typeof exports === 'object') 984 exports["pdfjs-dist/build/pdf"] = factory(); 985 else 986 root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory(); 987})(this, function() { 988return /******/ (function(modules) { // webpackBootstrap 989/******/ // The module cache 990/******/ var installedModules = {}; 991/******/ 992/******/ // The require function 993/******/ function __w_pdfjs_require__(moduleId) { 994/******/ 995/******/ // Check if module is in cache 996/******/ if(installedModules[moduleId]) { 997/******/ return installedModules[moduleId].exports; 998/******/ } 999/******/ // Create a new module (and put it into the cache) 1000/******/ var module = installedModules[moduleId] = { 1001/******/ i: moduleId, 1002/******/ l: false, 1003/******/ exports: {} 1004/******/ }; 1005/******/ 1006/******/ // Execute the module function 1007/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); 1008/******/ 1009/******/ // Flag the module as loaded 1010/******/ module.l = true; 1011/******/ 1012/******/ // Return the exports of the module 1013/******/ return module.exports; 1014/******/ } 1015/******/ 1016/******/ 1017/******/ // expose the modules object (__webpack_modules__) 1018/******/ __w_pdfjs_require__.m = modules; 1019/******/ 1020/******/ // expose the module cache 1021/******/ __w_pdfjs_require__.c = installedModules; 1022/******/ 1023/******/ // define getter function for harmony exports 1024/******/ __w_pdfjs_require__.d = function(exports, name, getter) { 1025/******/ if(!__w_pdfjs_require__.o(exports, name)) { 1026/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 1027/******/ } 1028/******/ }; 1029/******/ 1030/******/ // define __esModule on exports 1031/******/ __w_pdfjs_require__.r = function(exports) { 1032/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1033/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1034/******/ } 1035/******/ Object.defineProperty(exports, '__esModule', { value: true }); 1036/******/ }; 1037/******/ 1038/******/ // create a fake namespace object 1039/******/ // mode & 1: value is a module id, require it 1040/******/ // mode & 2: merge all properties of value into the ns 1041/******/ // mode & 4: return value when already ns object 1042/******/ // mode & 8|1: behave like require 1043/******/ __w_pdfjs_require__.t = function(value, mode) { 1044/******/ if(mode & 1) value = __w_pdfjs_require__(value); 1045/******/ if(mode & 8) return value; 1046/******/ if((mode & 4) && typeof value === 'object' && value && value.__esMo
1046dule) return value; 1047/******/ var ns = Object.create(null); 1048/******/ __w_pdfjs_require__.r(ns); 1049/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 1050/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 1051/******/ return ns; 1052/******/ }; 1053/******/ 1054/******/ // getDefaultExport function for compatibility with non-harmony modules 1055/******/ __w_pdfjs_require__.n = function(module) { 1056/******/ var getter = module && module.__esModule ? 1057/******/ function getDefault() { return module['default']; } : 1058/******/ function getModuleExports() { return module; }; 1059/******/ __w_pdfjs_require__.d(getter, 'a', getter); 1060/******/ return getter; 1061/******/ }; 1062/******/ 1063/******/ // Object.prototype.hasOwnProperty.call 1064/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 1065/******/ 1066/******/ // __webpack_public_path__ 1067/******/ __w_pdfjs_require__.p = ""; 1068/******/ 1069/******/ 1070/******/ // Load entry module and return exports 1071/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); 1072/******/ }) 1073/************************************************************************/ 1074/******/ ([ 1075/* 0 */ 1076/***/ (function(module, exports, __w_pdfjs_require__) { 1077 1078"use strict"; 1079 1080 1081Object.defineProperty(exports, "__esModule", { 1082 value: true 1083}); 1084Object.defineProperty(exports, "addLinkAttributes", { 1085 enumerable: true, 1086 get: function () { 1087 return _display_utils.addLinkAttributes; 1088 } 1089}); 1090Object.defineProperty(exports, "getFilenameFromUrl", { 1091 enumerable: true, 1092 get: function () { 1093 return _display_utils.getFilenameFromUrl; 1094 } 1095}); 1096Object.defineProperty(exports, "LinkTarget", { 1097 enumerable: true, 1098 get: function () { 1099 return _display_utils.LinkTarget; 1100 } 1101}); 1102Object.defineProperty(exports, "loadScript", { 1103 enumerable: true, 1104 get: function () { 1105 return _display_utils.loadScript; 1106 } 1107}); 1108Object.defineProperty(exports, "PDFDateString", { 1109 enumerable: true, 1110 get: function () { 1111 return _display_utils.PDFDateString; 1112 } 1113}); 1114Object.defineProperty(exports, "RenderingCancelledException", { 1115 enumerable: true, 1116 get: function () { 1117 return _display_utils.RenderingCancelledException; 1118 } 1119}); 1120Object.defineProperty(exports, "build", { 1121 enumerable: true, 1122 get: function () { 1123 return _api.build; 1124 } 1125}); 1126Object.defineProperty(exports, "getDocument", { 1127 enumerable: true, 1128 get: function () { 1129 return _api.getDocument; 1130 } 1131}); 1132Object.defineProperty(exports, "LoopbackPort", { 1133 enumerable: true, 1134 get: function () { 1135 return _api.LoopbackPort; 1136 } 1137}); 1138Object.defineProperty(exports, "PDFDataRangeTransport", { 1139 enumerable: true, 1140 get: function () { 1141 return _api.PDFDataRangeTransport; 1142 } 1143}); 1144Object.defineProperty(exports, "PDFWorker", { 1145 enumerable: true, 1146 get: function () { 1147 return _api.PDFWorker; 1148 } 1149}); 1150Object.defineProperty(exports, "version", { 1151 enumerable: true, 1152 get: function () { 1153 return _api.version; 1154 } 1155}); 1156Object.defineProperty(exports, "CMapCompressionType", { 1157 enumerable: true, 1158 get: function () { 1159 return _util.CMapCompressionType; 1160 } 1161}); 1162Object.defineProperty(exports, "createObjectURL", { 1163 enumerable: true, 1164 get: function () { 1165 return _util.createObjectURL; 1166 } 1167}); 1168Object.defineProperty(exports, "createPromiseCapability", { 1169 enumerable: true, 1170 get: function () { 1171 return _util.createPromiseCapability; 1172 } 1173}); 1174Object.defineProperty(exports, "createValidAbsoluteUrl", { 1175 enumerable: true, 1176 get: function () { 1177 return _util.createValidAbsoluteUrl; 1178 } 1179}); 1180Object.defineProperty(exports, "InvalidPDFException", { 1181 enumerable: true, 1182 get: function () { 1183 return _util.InvalidPDFException; 1184 } 1185}); 1186Object.defineProperty(exports, "MissingPDFException", { 1187 enumerable: true, 1188 get: function () { 1189 return _util.MissingPDFException; 1190 } 1191}); 1192Object.defineProperty(exports, "OPS", { 1193 enumerable: true, 1194 get: function () { 1195 return _util.OPS; 1196 } 1197}); 1198Object.defineProperty(exports, "PasswordResponses", { 1199 enumerable: true, 1200 get: function () { 1201 return _util.PasswordResponses; 1202 } 1203}); 1204Object.defineProperty(exports, "PermissionFlag", { 1205 enumerable: true, 1206 get: function () { 1207 return _util.PermissionFlag; 1208 } 1209}); 1210Object.defineProperty(exports, "removeNullCharacters", { 1211 enumerable: true, 1212 get: function () { 1213 return _util.removeNullCharacters; 1214 } 1215}); 1216Object.defineProperty(exports, "shadow", { 1217 enumerable: true, 1218 get: function () { 1219 return _util.shadow; 1220 } 1221}); 1222Object.defineProperty(exports, "UnexpectedResponseException", { 1223 enumerable: true, 1224 get: function () { 1225 return _util.UnexpectedResponseException; 1226 } 1227}); 1228Object.defineProperty(exports, "UNSUPPORTED_FEATURES", { 1229 enumerable: true, 1230 get: function () { 1231 return _util.UNSUPPORTED_FEATURES; 1232 } 1233}); 1234Object.defineProperty(exports, "Util", { 1235 enumerable: true, 1236 get: function () { 1237 return _util.Util; 1238 } 1239}); 1240Object.defineProperty(exports, "VerbosityLevel", { 1241 enumerable: true, 1242 get: function () { 1243 return _util.VerbosityLevel; 1244 } 1245}); 1246Object.defineProperty(exports, "AnnotationLayer", { 1247 enumerable: true, 1248 get: function () { 1249 return _annotation_layer.AnnotationLayer; 1250 } 1251}); 1252Object.defineProperty(exports, "apiCompatibilityParams", { 1253 enumerable: true, 1254 get: function () { 1255 return _api_compatibility.apiCompatibilityParams; 1256 } 1257}); 1258Object.defineProperty(exports, "GlobalWorkerOptions", { 1259 enumerable: true, 1260 get: function () { 1261 return _worker_options.GlobalWorkerOptions; 1262 } 1263}); 1264Object.defineProperty(exports, "renderTextLayer", { 1265 enumerable: true, 1266 get: function () { 1267 return _text_layer.renderTextLayer; 1268 } 1269}); 1270Object.defineProperty(exports, "SVGGraphics", { 1271 enumerable: true, 1272 get: function () { 1273 return _svg.SVGGraphics; 1274 } 1275}); 1276 1277var _display_utils = __w_pdfjs_require__(1); 1278 1279var _api = __w_pdfjs_require__(5); 1280 1281var _util = __w_pdfjs_require__(2); 1282 1283var _annotation_layer = __w_pdfjs_require__(16); 1284 1285var _api_compatibility = __w_pdfjs_require__(7); 1286 1287var _worker_options = __w_pdfjs_require__(10); 1288 1289var _text_layer = __w_pdfjs_require__(17); 1290 1291var _svg = __w_pdfjs_require__(18); 1292 1293const pdfjsVersion = '2.5.207'; 1294const pdfjsBuild = '0974d6052'; 1295{ 1296 const { 1297 isNodeJS 1298 } = __w_pdfjs_require__(4); 1299 1300 if (isNodeJS) { 1301 const PDFNodeStream = __w_pdfjs_require__(19).PDFNodeStream; 1302 1303 (0, _api.setPDFNetworkStreamFactory)(params => { 1304 return new PDFNodeStream(params); 1305 }); 1306 } else { 1307 const PDFNetworkStream = __w_pdfjs_require__(22).PDFNetworkStream; 1308 1309 let PDFFetchStream; 1310 1311 if ((0, _display_utils.isFetchSupported)()) { 1312 PDFFetchStream = __w_pdfjs_require__(23).PDFFetchStream; 1313 } 1314 1315 (0, _api.setPDFNetworkStreamFactory)(params => { 1316 if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) { 1317 return new PDFFetchStream(params); 1318 } 1319 1320 return new PDFNetworkStream(params); 1321 }); 1322 } 1323} 1324 1325/***/ }), 1326/* 1 */ 1327/***/ (function(module, exports, __w_pdfjs_require__) { 1328 1329"use strict"; 1330 1331 1332Object.defineProperty(exports, "__esModule", { 1333 value: true 1334}); 1335exports.addLinkAttributes = addLinkAttributes; 1336exports.getFilenameFromUrl = getFilenameFromUrl; 1337exports.isFetchSupported = isFetchSupported; 1338exports.isValidFetchUrl = isValidFetchUrl; 1339exports.loadScript = loadScript; 1340exports.deprecated = deprecated; 1341exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exp
1341orts.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; 1342 1343var _util = __w_pdfjs_require__(2); 1344 1345const DEFAULT_LINK_REL = "noopener noreferrer nofollow"; 1346exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; 1347const SVG_NS = "http://www.w3.org/2000/svg"; 1348 1349class DOMCanvasFactory { 1350 create(width, height) { 1351 if (width <= 0 || height <= 0) { 1352 throw new Error("Invalid canvas size"); 1353 } 1354 1355 const canvas = document.createElement("canvas"); 1356 const context = canvas.getContext("2d"); 1357 canvas.width = width; 1358 canvas.height = height; 1359 return { 1360 canvas, 1361 context 1362 }; 1363 } 1364 1365 reset(canvasAndContext, width, height) { 1366 if (!canvasAndContext.canvas) { 1367 throw new Error("Canvas is not specified"); 1368 } 1369 1370 if (width <= 0 || height <= 0) { 1371 throw new Error("Invalid canvas size"); 1372 } 1373 1374 canvasAndContext.canvas.width = width; 1375 canvasAndContext.canvas.height = height; 1376 } 1377 1378 destroy(canvasAndContext) { 1379 if (!canvasAndContext.canvas) { 1380 throw new Error("Canvas is not specified"); 1381 } 1382 1383 canvasAndContext.canvas.width = 0; 1384 canvasAndContext.canvas.height = 0; 1385 canvasAndContext.canvas = null; 1386 canvasAndContext.context = null; 1387 } 1388 1389} 1390 1391exports.DOMCanvasFactory = DOMCanvasFactory; 1392 1393class DOMCMapReaderFactory { 1394 constructor({ 1395 baseUrl = null, 1396 isCompressed = false 1397 }) { 1398 this.baseUrl = baseUrl; 1399 this.isCompressed = isCompressed; 1400 } 1401 1402 async fetch({ 1403 name 1404 }) { 1405 if (!this.baseUrl) { 1406 throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.'); 1407 } 1408 1409 if (!name) { 1410 throw new Error("CMap name must be specified."); 1411 } 1412 1413 const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : ""); 1414 const compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE; 1415 1416 if (isFetchSupported() && isValidFetchUrl(url, document.baseURI)) { 1417 return fetch(url).then(async response => { 1418 if (!response.ok) { 1419 throw new Error(response.statusText); 1420 } 1421 1422 let cMapData; 1423 1424 if (this.isCompressed) { 1425 cMapData = new Uint8Array(await response.arrayBuffer()); 1426 } else { 1427 cMapData = (0, _util.stringToBytes)(await response.text()); 1428 } 1429 1430 return { 1431 cMapData, 1432 compressionType 1433 }; 1434 }).catch(reason => { 1435 throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); 1436 }); 1437 } 1438 1439 return new Promise((resolve, reject) => { 1440 const request = new XMLHttpRequest(); 1441 request.open("GET", url, true); 1442 1443 if (this.isCompressed) { 1444 request.responseType = "arraybuffer"; 1445 } 1446 1447 request.onreadystatechange = () => { 1448 if (request.readyState !== XMLHttpRequest.DONE) { 1449 return; 1450 } 1451 1452 if (request.status === 200 || request.status === 0) { 1453 let cMapData; 1454 1455 if (this.isCompressed && request.response) { 1456 cMapData = new Uint8Array(request.response); 1457 } else if (!this.isCompressed && request.responseText) { 1458 cMapData = (0, _util.stringToBytes)(request.responseText); 1459 } 1460 1461 if (cMapData) { 1462 resolve({ 1463 cMapData, 1464 compressionType 1465 }); 1466 return; 1467 } 1468 } 1469 1470 reject(new Error(request.statusText)); 1471 }; 1472 1473 request.send(null); 1474 }).catch(reason => { 1475 throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); 1476 }); 1477 } 1478 1479} 1480 1481exports.DOMCMapReaderFactory = DOMCMapReaderFactory; 1482 1483class DOMSVGFactory { 1484 create(width, height) { 1485 (0, _util.assert)(width > 0 && height > 0, "Invalid SVG dimensions"); 1486 const svg = document.createElementNS(SVG_NS, "svg:svg"); 1487 svg.setAttribute("version", "1.1"); 1488 svg.setAttribute("width", width + "px"); 1489 svg.setAttribute("height", height + "px"); 1490 svg.setAttribute("preserveAspectRatio", "none"); 1491 svg.setAttribute("viewBox", "0 0 " + width + " " + height); 1492 return svg; 1493 } 1494 1495 createElement(type) { 1496 (0, _util.assert)(typeof type === "string", "Invalid SVG element type"); 1497 return document.createElementNS(SVG_NS, type); 1498 } 1499 1500} 1501 1502exports.DOMSVGFactory = DOMSVGFactory; 1503 1504class PageViewport { 1505 constructor({
1506 viewBox, 1507 scale, 1508 rotation, 1509 offsetX = 0, 1510 offsetY = 0, 1511 dontFlip = false 1512 }) { 1513 this.viewBox = viewBox; 1514 this.scale = scale; 1515 this.rotation = rotation; 1516 this.offsetX = offsetX; 1517 this.offsetY = offsetY; 1518 const centerX = (viewBox[2] + viewBox[0]) / 2; 1519 const centerY = (viewBox[3] + viewBox[1]) / 2; 1520 let rotateA, rotateB, rotateC, rotateD; 1521 rotation = rotation % 360; 1522 rotation = rotation < 0 ? rotation + 360 : rotation; 1523 1524 switch (rotation) { 1525 case 180: 1526 rotateA = -1; 1527 rotateB = 0; 1528 rotateC = 0; 1529 rotateD = 1; 1530 break; 1531 1532 case 90: 1533 rotateA = 0; 1534 rotateB = 1; 1535 rotateC = 1; 1536 rotateD = 0; 1537 break; 1538 1539 case 270: 1540 rotateA = 0; 1541 rotateB = -1; 1542 rotateC = -1; 1543 rotateD = 0; 1544 break; 1545 1546 case 0: 1547 rotateA = 1; 1548 rotateB = 0; 1549 rotateC = 0; 1550 rotateD = -1; 1551 break; 1552 1553 default: 1554 throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees."); 1555 } 1556 1557 if (dontFlip) { 1558 rotateC = -rotateC; 1559 rotateD = -rotateD; 1560 } 1561 1562 let offsetCanvasX, offsetCanvasY; 1563 let width, height; 1564 1565 if (rotateA === 0) { 1566 offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; 1567 offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; 1568 width = Math.abs(viewBox[3] - viewBox[1]) * scale; 1569 height = Math.abs(viewBox[2] - viewBox[0]) * scale; 1570 } else { 1571 offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; 1572 offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; 1573 width = Math.abs(viewBox[2] - viewBox[0]) * scale; 1574 height = Math.abs(viewBox[3] - viewBox[1]) * scale; 1575 } 1576 1577 this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; 1578 this.width = width; 1579 this.height = height; 1580 } 1581 1582 clone({ 1583 scale = this.scale, 1584 rotation = this.rotation, 1585 offsetX = this.offsetX, 1586 offsetY = this.offsetY, 1587 dontFlip = false 1588 } = {}) { 1589 return new PageViewport({ 1590 viewBox: this.viewBox.slice(), 1591 scale, 1592 rotation, 1593 offsetX, 1594 offsetY, 1595 dontFlip 1596 }); 1597 } 1598 1599 convertToViewportPoint(x, y) { 1600 return _util.Util.applyTransform([x, y], this.transform); 1601 } 1602 1603 convertToViewportRectangle(rect) { 1604 const topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform); 1605 1606 const bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform); 1607 1608 return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]]; 1609 } 1610 1611 convertToPdfPoint(x, y) { 1612 return _util.Util.applyInverseTransform([x, y], this.transform); 1613 } 1614 1615} 1616 1617exports.PageViewport = PageViewport; 1618 1619class RenderingCancelledException extends _util.BaseException { 1620 constructor(msg, type) { 1621 super(msg); 1622 this.type = type; 1623 } 1624 1625} 1626 1627exports.RenderingCancelledException = RenderingCancelledException; 1628const LinkTarget = { 1629 NONE: 0, 1630 SELF: 1, 1631 BLANK: 2, 1632 PARENT: 3, 1633 TOP: 4 1634}; 1635exports.LinkTarget = LinkTarget; 1636 1637function addLinkAttributes(link, { 1638 url, 1639 target, 1640 rel, 1641 enabled = true 1642} = {}) { 1643 (0, _util.assert)(url && typeof url === "string", 'addLinkAttributes: A valid "url" parameter must provided.'); 1644 const urlNullRemoved = (0, _util.removeNullCharacters)(url); 1645 1646 if (enabled) { 1647 link.href = link.title = urlNullRemoved; 1648 } else { 1649 link.href = ""; 1650 link.title = `Disabled: ${urlNullRemoved}`; 1651 1652 link.onclick = () => { 1653 return false; 1654 }; 1655 } 1656 1657 let targetStr = ""; 1658 1659 switch (target) { 1660 case LinkTarget.NONE: 1661 break; 1662 1663 case LinkTarget.SELF: 1664 targetStr = "_self"; 1665 break; 1666 1667 case LinkTarget.BLANK: 1668 targetStr = "_blank"; 1669 break; 1670 1671 case LinkTarget.PARENT: 1672 targetStr = "_parent"; 1673 break; 1674 1675 case LinkTarget.TOP: 1676 targetStr = "_top"; 1677 break; 1678 } 1679 1680 link.target = targetStr; 1681 link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL; 1682} 1683 1684function getFilenameFromUrl(url) { 1685 const anchor = url.indexOf("#"); 1686 const query = url.indexOf("?"); 1687 const end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); 1688 return url.substring(url.lastIndexOf("/", end) + 1, end); 1689} 1690 1691class StatTimer {
1692 constructor() { 1693 this.started = Object.create(null); 1694 this.times = []; 1695 } 1696 1697 time(name) { 1698 if (name in this.started) { 1699 (0, _util.warn)(`Timer is already running for ${name}`); 1700 } 1701 1702 this.started[name] = Date.now(); 1703 } 1704 1705 timeEnd(name) { 1706 if (!(name in this.started)) { 1707 (0, _util.warn)(`Timer has not been started for ${name}`); 1708 } 1709 1710 this.times.push({ 1711 name, 1712 start: this.started[name], 1713 end: Date.now() 1714 }); 1715 delete this.started[name]; 1716 } 1717 1718 toString() { 1719 const outBuf = []; 1720 let longest = 0; 1721 1722 for (const time of this.times) { 1723 const name = time.name; 1724 1725 if (name.length > longest) { 1726 longest = name.length; 1727 } 1728 } 1729 1730 for (const time of this.times) { 1731 const duration = time.end - time.start; 1732 outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\n`); 1733 } 1734 1735 return outBuf.join(""); 1736 } 1737 1738} 1739 1740exports.StatTimer = StatTimer; 1741 1742function isFetchSupported() { 1743 return typeof fetch !== "undefined" && typeof Response !== "undefined" && "body" in Response.prototype && typeof ReadableStream !== "undefined"; 1744} 1745 1746function isValidFetchUrl(url, baseUrl) { 1747 try { 1748 const { 1749 protocol 1750 } = baseUrl ? new URL(url, baseUrl) : new URL(url); 1751 return protocol === "http:" || protocol === "https:"; 1752 } catch (ex) { 1753 return false; 1754 } 1755} 1756 1757function loadScript(src) { 1758 return new Promise((resolve, reject) => { 1759 const script = document.createElement("script"); 1760 script.src = src; 1761 script.onload = resolve; 1762 1763 script.onerror = function () { 1764 reject(new Error(`Cannot load script at: ${script.src}`)); 1765 }; 1766 1767 (document.head || document.documentElement).appendChild(script); 1768 }); 1769} 1770 1771function deprecated(details) { 1772 console.log("Deprecated API usage: " + details); 1773} 1774 1775let pdfDateStringRegex; 1776 1777class PDFDateString { 1778 static toDateObject(input) { 1779 if (!input || !(0, _util.isString)(input)) { 1780 return null; 1781 } 1782 1783 if (!pdfDateStringRegex) { 1784 pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?"); 1785 } 1786 1787 const matches = pdfDateStringRegex.exec(input); 1788 1789 if (!matches) { 1790 return null; 1791 } 1792 1793 const year = parseInt(matches[1], 10); 1794 let month = parseInt(matches[2], 10);
1795 month = month >= 1 && month <= 12 ? month - 1 : 0; 1796 let day = parseInt(matches[3], 10); 1797 day = day >= 1 && day <= 31 ? day : 1; 1798 let hour = parseInt(matches[4], 10); 1799 hour = hour >= 0 && hour <= 23 ? hour : 0; 1800 let minute = parseInt(matches[5], 10); 1801 minute = minute >= 0 && minute <= 59 ? minute : 0; 1802 let second = parseInt(matches[6], 10); 1803 second = second >= 0 && second <= 59 ? second : 0; 1804 const universalTimeRelation = matches[7] || "Z"; 1805 let offsetHour = parseInt(matches[8], 10); 1806 offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0; 1807 let offsetMinute = parseInt(matches[9], 10) || 0; 1808 offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0; 1809 1810 if (universalTimeRelation === "-") { 1811 hour += offsetHour; 1812 minute += offsetMinute; 1813 } else if (universalTimeRelation === "+") { 1814 hour -= offsetHour; 1815 minute -= offsetMinute; 1816 } 1817 1818 return new Date(Date.UTC(year, month, day, hour, minute, second)); 1819 } 1820 1821} 1822 1823exports.PDFDateString = PDFDateString; 1824 1825/***/ }), 1826/* 2 */ 1827/***/ (function(module, exports, __w_pdfjs_require__) { 1828 1829"use strict"; 1830 1831 1832Object.defineProperty(exports, "__esModule", { 1833 value: true 1834}); 1835exports.arrayByteLength = arrayByteLength; 1836exports.arraysToBytes = arraysToBytes; 1837exports.assert = assert; 1838exports.bytesToString = bytesToString; 1839exports.createPromiseCapability = createPromiseCapability; 1840exports.getVerbosityLevel = getVerbosityLevel; 1841exports.info = info; 1842exports.isArrayBuffer = isArrayBuffer; 1843exports.isArrayEqual = isArrayEqual; 1844exports.isBool = isBool; 1845exports.isEmptyObj = isEmptyObj; 1846exports.isNum = isNum; 1847exports.isString = isString; 1848exports.isSameOrigin = isSameOrigin; 1849exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 1850exports.removeNullCharacters = removeNullCharacters; 1851exports.setVerbosityLevel = setVerbosityLevel; 1852exports.shadow = shadow; 1853exports.string32 = string32; 1854exports.stringToBytes = stringToBytes; 1855exports.stringToPDFString = stringToPDFString; 1856exports.stringToUTF8String = stringToUTF8String; 1857exports.utf8StringToString = utf8StringToString; 1858exports.warn = warn; 1859exports.unreachable = unreachable; 1860exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; 1861 1862__w_pdfjs_require__(3); 1863 1864const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 1865exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 1866const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 1867exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 1868const PermissionFlag = { 1869 PRINT: 0x04, 1870 MODIFY_CONTENTS: 0x08, 1871 COPY: 0x10, 1872 MODIFY_ANNOTATIONS: 0x20, 1873 FILL_INTERACTIVE_FORMS: 0x100, 1874 COPY_FOR_ACCESSIBILITY: 0x200, 1875 ASSEMBLE: 0x400, 1876 PRINT_HIGH_QUALITY: 0x800 1877}; 1878exports.PermissionFlag = PermissionFlag; 1879const TextRenderingMode = { 1880 FILL: 0, 1881 STROKE: 1, 1882 FILL_STROKE: 2, 1883 INVISIBLE: 3, 1884 FILL_ADD_TO_PATH: 4, 1885 STROKE_ADD_TO_PATH: 5, 1886 FILL_STROKE_ADD_TO_PATH: 6, 1887 ADD_TO_PATH: 7, 1888 FILL_STROKE_MASK: 3, 1889 ADD_TO_PATH_FLAG: 4 1890}; 1891exports.TextRenderingMode = TextRenderingMode; 1892const ImageKind = { 1893 GRAYSCALE_1BPP: 1, 1894 RGB_24BPP: 2, 1895 RGBA_32BPP: 3 1896}; 1897exports.ImageKind = ImageKind; 1898const AnnotationType = { 1899 TEXT: 1, 1900 LINK: 2, 1901 FREETEXT: 3, 1902 LINE: 4, 1903 SQUARE: 5, 1904 CIRCLE: 6, 1905 POLYGON: 7, 1906 POLYLINE: 8, 1907 HIGHLIGHT: 9, 1908 UNDERLINE: 10, 1909 SQUIGGLY: 11, 1910 STRIKEOUT: 12, 1911 STAMP: 13, 1912 CARET: 14, 1913 INK: 15, 1914 POPUP: 16, 1915 FILEATTACHMENT: 17, 1916 SOUND: 18, 1917 MOVIE: 19, 1918 WIDGET: 20, 1919 SCREEN: 21, 1920 PRINTERMARK: 22, 1921 TRAPNET: 23, 1922 WATERMARK: 24, 1923 THREED: 25, 1924 REDACT: 26 1925}; 1926exports.AnnotationType = AnnotationType; 1927const AnnotationStateModelType = { 1928 MARKED: "Marked", 1929 REVIEW: "Review" 1930}; 1931exports.AnnotationStateModelType = AnnotationStateModelType; 1932const AnnotationMarkedState = { 1933 MARKED: "Marked", 1934 UNMARKED: "Unmarked" 1935}; 1936exports.AnnotationMarkedState = AnnotationMarkedState; 1937const AnnotationReviewState = { 1938 ACCEPTED: "Accepted", 1939 REJECTED: "Rejected", 1940 CANCELLED: "Cancelled", 1941 COMPLETED: "Completed", 1942 NONE: "None" 1943}; 1944exports.AnnotationReviewState = AnnotationReviewState; 1945const AnnotationReplyType = { 1946 GROUP: "Group", 1947 REPLY: "R" 1948}; 1949exports.AnnotationReplyType = AnnotationReplyType; 1950const AnnotationFlag = { 1951 INVISIBLE: 0x01, 1952 HIDDEN: 0x02, 1953 PRINT: 0x04, 1954 NOZOOM: 0x08,
1955 NOROTATE: 0x10, 1956 NOVIEW: 0x20, 1957 READONLY: 0x40, 1958 LOCKED: 0x80, 1959 TOGGLENOVIEW: 0x100, 1960 LOCKEDCONTENTS: 0x200 1961}; 1962exports.AnnotationFlag = AnnotationFlag; 1963const AnnotationFieldFlag = { 1964 READONLY: 0x0000001, 1965 REQUIRED: 0x0000002, 1966 NOEXPORT: 0x0000004, 1967 MULTILINE: 0x0001000, 1968 PASSWORD: 0x0002000, 1969 NOTOGGLETOOFF: 0x0004000, 1970 RADIO: 0x0008000, 1971 PUSHBUTTON: 0x0010000, 1972 COMBO: 0x0020000, 1973 EDIT: 0x0040000, 1974 SORT: 0x0080000, 1975 FILESELECT: 0x0100000, 1976 MULTISELECT: 0x0200000, 1977 DONOTSPELLCHECK: 0x0400000, 1978 DONOTSCROLL: 0x0800000, 1979 COMB: 0x1000000, 1980 RICHTEXT: 0x2000000, 1981 RADIOSINUNISON: 0x2000000, 1982 COMMITONSELCHANGE: 0x4000000 1983}; 1984exports.AnnotationFieldFlag = AnnotationFieldFlag; 1985const AnnotationBorderStyleType = { 1986 SOLID: 1, 1987 DASHED: 2, 1988 BEVELED: 3, 1989 INSET: 4, 1990 UNDERLINE: 5 1991}; 1992exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 1993const StreamType = { 1994 UNKNOWN: "UNKNOWN", 1995 FLATE: "FLATE", 1996 LZW: "LZW", 1997 DCT: "DCT", 1998 JPX: "JPX", 1999 JBIG: "JBIG", 2000 A85: "A85", 2001 AHX: "AHX", 2002 CCF: "CCF", 2003 RLX: "RLX" 2004}; 2005exports.StreamType = StreamType; 2006const FontType = { 2007 UNKNOWN: "UNKNOWN", 2008 TYPE1: "TYPE1", 2009 TYPE1C: "TYPE1C", 2010 CIDFONTTYPE0: "CIDFONTTYPE0", 2011 CIDFONTTYPE0C: "CIDFONTTYPE0C", 2012 TRUETYPE: "TRUETYPE", 2013 CIDFONTTYPE2: "CIDFONTTYPE2", 2014 TYPE3: "TYPE3", 2015 OPENTYPE: "OPENTYPE", 2016 TYPE0: "TYPE0", 2017 MMTYPE1: "MMTYPE1" 2018}; 2019exports.FontType = FontType; 2020const VerbosityLevel = { 2021 ERRORS: 0, 2022 WARNINGS: 1, 2023 INFOS: 5 2024}; 2025exports.VerbosityLevel = VerbosityLevel; 2026const CMapCompressionType = { 2027 NONE: 0, 2028 BINARY: 1, 2029 STREAM: 2 2030}; 2031exports.CMapCompressionType = CMapCompressionType; 2032const OPS = { 2033 dependency: 1, 2034 setLineWidth: 2, 2035 setLineCap: 3, 2036 setLineJoin: 4, 2037 setMiterLimit: 5, 2038 setDash: 6, 2039 setRenderingIntent: 7, 2040 setFlatness: 8, 2041 setGState: 9, 2042 save: 10, 2043 restore: 11, 2044 transform: 12, 2045 moveTo: 13, 2046 lineTo: 14, 2047 curveTo: 15, 2048 curveTo2: 16,
2049 curveTo3: 17, 2050 closePath: 18, 2051 rectangle: 19, 2052 stroke: 20, 2053 closeStroke: 21, 2054 fill: 22, 2055 eoFill: 23, 2056 fillStroke: 24, 2057 eoFillStroke: 25, 2058 closeFillStroke: 26, 2059 closeEOFillStroke: 27, 2060 endPath: 28, 2061 clip: 29, 2062 eoClip: 30, 2063 beginText: 31, 2064 endText: 32, 2065 setCharSpacing: 33, 2066 setWordSpacing: 34, 2067 setHScale: 35, 2068 setLeading: 36, 2069 setFont: 37, 2070 setTextRenderingMode: 38, 2071 setTextRise: 39, 2072 moveText: 40, 2073 setLeadingMoveText: 41, 2074 setTextMatrix: 42, 2075 nextLine: 43, 2076 showText: 44, 2077 showSpacedText: 45, 2078 nextLineShowText: 46, 2079 nextLineSetSpacingShowText: 47, 2080 setCharWidth: 48, 2081 setCharWidthAndBounds: 49, 2082 setStrokeColorSpace: 50, 2083 setFillColorSpace: 51, 2084 setStrokeColor: 52, 2085 setStrokeColorN: 53, 2086 setFillColor: 54, 2087 setFillColorN: 55, 2088 setStrokeGray: 56, 2089 setFillGray: 57, 2090 setStrokeRGBColor: 58, 2091 setFillRGBColor: 59, 2092 setStrokeCMYKColor: 60, 2093 setFillCMYKColor: 61, 2094 shadingFill: 62, 2095 beginInlineImage: 63, 2096 beginImageData: 64, 2097 endInlineImage: 65, 2098 paintXObject: 66, 2099 markPoint: 67, 2100 markPointProps: 68, 2101 beginMarkedContent: 69, 2102 beginMarkedContentProps: 70, 2103 endMarkedContent: 71, 2104 beginCompat: 72, 2105 endCompat: 73, 2106 paintFormXObjectBegin: 74, 2107 paintFormXObjectEnd: 75, 2108 beginGroup: 76, 2109 endGroup: 77, 2110 beginAnnotations: 78, 2111 endAnnotations: 79, 2112 beginAnnotation: 80, 2113 endAnnotation: 81, 2114 paintJpegXObject: 82, 2115 paintImageMaskXObject: 83, 2116 paintImageMaskXObjectGroup: 84, 2117 paintImageXObject: 85, 2118 paintInlineImageXObject: 86, 2119 paintInlineImageXObjectGroup: 87, 2120 paintImageXObjectRepeat: 88, 2121 paintImageMaskXObjectRepeat: 89, 2122 paintSolidColorImageMask: 90, 2123 constructPath: 91 2124}; 2125exports.OPS = OPS; 2126const UNSUPPORTED_FEATURES = { 2127 unknown: "unknown", 2128 forms: "forms", 2129 javaScript: "javaScript", 2130 smask: "smask", 2131 shadingPattern: "shadingPattern", 2132 font: "font", 2133 errorTilingPattern: "errorTilingPattern", 2134 errorExtGState: "errorExtGState", 2135 errorXObject: "errorXObject", 2136 errorFontLoadType3: "errorFontLoadType3", 2137 errorFontState: "errorFontState", 2138 errorFontMissing: "errorFontMissing", 2139 errorFontTranslate: "errorFontTranslate", 2140 errorColorSpace: "errorColorSpace", 2141 errorOperatorList: "errorOperatorList", 2142 errorFontToUnicode: "errorFontToUnicode", 2143 errorFontLoadNative: "errorFontLoadNative", 2144 errorFontGetPath: "errorFontGetPath" 2145}; 2146exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 2147const PasswordResponses = { 2148 NEED_PASSWORD: 1, 2149 INCORRECT_PASSWORD: 2 2150}; 2151exports.PasswordResponses = PasswordResponses; 2152let verbosity = VerbosityLevel.WARNINGS; 2153 2154function setVerbosityLevel(level) { 2155 if (Number.isInteger(level)) { 2156 verbosity = level; 2157 } 2158} 2159 2160function getVerbosityLevel() { 2161 return verbosity; 2162} 2163 2164function info(msg) { 2165 if (verbosity >= VerbosityLevel.INFOS) { 2166 console.log(`Info: ${msg}`); 2167 } 2168} 2169 2170function warn(msg) { 2171 if (verbosity >= VerbosityLevel.WARNINGS) { 2172 console.log(`Warning: ${msg}`); 2173 } 2174} 2175 2176function unreachable(msg) { 2177 throw new Error(msg); 2178} 2179 2180function assert(cond, msg) { 2181 if (!cond) { 2182 unreachable(msg); 2183 } 2184} 2185 2186function isSameOrigin(baseUrl, otherUrl) { 2187 let base; 2188 2189 try { 2190 base = new URL(baseUrl); 2191 2192 if (!base.origin || base.origin === "null") { 2193 return false; 2194 } 2195 } catch (e) { 2196 return false; 2197 } 2198 2199 const other = new URL(otherUrl, base); 2200 return base.origin === other.origin; 2201} 2202 2203function _isValidProtocol(url) { 2204 if (!url) { 2205 return false; 2206 } 2207 2208 switch (url.protocol) { 2209 case "http:": 2210 case "https:": 2211 case "ftp:": 2212 case "mailto:": 2213 case "tel:": 2214 return true; 2215 2216 default: 2217 return false; 2218 } 2219} 2220 2221function createValidAbsoluteUrl(url, baseUrl) { 2222 if (!url) { 2223 return null; 2224 } 2225 2226 try { 2227 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 2228 2229 if (_isValidProtocol(absoluteUrl)) { 2230 return absoluteUrl; 2231 } 2232 } catch (ex) {} 2233 2234 return null; 2235} 2236 2237function shadow(obj, prop, value) { 2238 Object.defineProperty(obj, prop, { 2239 value, 2240 enumerable: true, 2241 configurable: true, 2242 writable: false 2243 }); 2244 return value; 2245} 2246 2247const BaseException = function BaseExceptionClosure() { 2248 function BaseException(message) { 2249 if (this.constructor === BaseException) { 2250 unreachable("Cannot initialize BaseException."); 2251 } 2252 2253 this.message = message; 2254 this.name = this.constructor.name; 2255 } 2256 2257 BaseException.prototype = new Error(); 2258 BaseException.constructor = BaseException; 2259 return BaseException; 2260}(); 2261 2262exports.BaseException = BaseException; 2263 2264class PasswordException extends BaseException { 2265 constructor(msg, code) { 2266 super(msg); 2267 this.code = code; 2268 } 2269 2270} 2271 2272exports.PasswordException = PasswordException; 2273 2274class UnknownErrorException extends BaseException { 2275 constructor(msg, details) { 2276 super(msg); 2277 this.details = details; 2278 } 2279 2280} 2281 2282exports.UnknownErrorException = UnknownErrorException; 2283 2284class InvalidPDFException extends BaseException {} 2285 2286exports.InvalidPDFException = InvalidPDFException; 2287 2288class MissingPDFException extends BaseException {} 2289 2290exports.MissingPDFException = MissingPDFException; 2291 2292class UnexpectedResponseException extends BaseException { 2293 constructor(msg, status) { 2294 super(msg); 2295 this.status = status; 2296 } 2297 2298} 2299 2300exports.UnexpectedResponseException = UnexpectedResponseException; 2301 2302class FormatError extends BaseException {} 2303 2304exports.FormatError = FormatError; 2305 2306class AbortException extends BaseException {} 2307 2308exports.AbortException = AbortException; 2309const NullCharactersRegExp = /\x00/g; 2310 2311function removeNullCharacters(str) { 2312 if (typeof str !== "string") { 2313 warn("The argument for removeNullCharacters must be a string."); 2314 return str; 2315 } 2316 2317 return str.replace(NullCharactersRegExp, ""); 2318} 2319 2320function bytesToString(bytes) { 2321 assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); 2322 const length = bytes.length; 2323 const MAX_ARGUMENT_COUNT = 8192; 2324 2325 if (length < MAX_ARGUMENT_COUNT) { 2326 return String.fromCharCode.apply(null, bytes); 2327 } 2328 2329 const strBuf = []; 2330 2331 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 2332 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 2333 const chunk = bytes.subarray(i, chunkEnd); 2334 strBuf.push(String.fromCharCode.apply(null, chunk)); 2335 } 2336 2337 return strBuf.join(""); 2338} 2339 2340function stringToBytes(str) { 2341 assert(typeof str === "string", "Invalid argument for stringToBytes"); 2342 const length = str.length; 2343 const bytes = new Uint8Array(length); 2344 2345 for (let i = 0; i < length; ++i) { 2346 bytes[i] = str.charCodeAt(i) & 0xff;
2347 } 2348 2349 return bytes; 2350} 2351 2352function arrayByteLength(arr) { 2353 if (arr.length !== undefined) { 2354 return arr.length; 2355 } 2356 2357 assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument."); 2358 return arr.byteLength; 2359} 2360 2361function arraysToBytes(arr) { 2362 const length = arr.length; 2363 2364 if (length === 1 && arr[0] instanceof Uint8Array) { 2365 return arr[0]; 2366 } 2367 2368 let resultLength = 0; 2369 2370 for (let i = 0; i < length; i++) { 2371 resultLength += arrayByteLength(arr[i]); 2372 } 2373 2374 let pos = 0; 2375 const data = new Uint8Array(resultLength); 2376 2377 for (let i = 0; i < length; i++) { 2378 let item = arr[i]; 2379 2380 if (!(item instanceof Uint8Array)) { 2381 if (typeof item === "string") { 2382 item = stringToBytes(item); 2383 } else { 2384 item = new Uint8Array(item); 2385 } 2386 } 2387 2388 const itemLength = item.byteLength; 2389 data.set(item, pos); 2390 pos += itemLength; 2391 } 2392 2393 return data; 2394} 2395 2396function string32(value) { 2397 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 2398} 2399 2400function isLittleEndian() { 2401 const buffer8 = new Uint8Array(4); 2402 buffer8[0] = 1; 2403 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 2404 return view32[0] === 1; 2405} 2406 2407const IsLittleEndianCached = { 2408 get value() { 2409 return shadow(this, "value", isLittleEndian()); 2410 } 2411 2412}; 2413exports.IsLittleEndianCached = IsLittleEndianCached; 2414 2415function isEvalSupported() { 2416 try { 2417 new Function(""); 2418 return true; 2419 } catch (e) { 2420 return false; 2421 } 2422} 2423 2424const IsEvalSupportedCached = { 2425 get value() { 2426 return shadow(this, "value", isEvalSupported()); 2427 } 2428 2429}; 2430exports.IsEvalSupportedCached = IsEvalSupportedCached; 2431const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; 2432 2433class Util { 2434 static makeCssRgb(r, g, b) { 2435 rgbBuf[1] = r; 2436 rgbBuf[3] = g; 2437 rgbBuf[5] = b; 2438 return rgbBuf.join(""); 2439 } 2440 2441 static transform(m1, m2) { 2442 return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; 2443 } 2444 2445 static applyTransform(p, m) { 2446 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 2447 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 2448 return [xt, yt]; 2449 } 2450 2451 static applyInverseTransform(p, m) { 2452 const d = m[0] * m[3] - m[1] * m[2]; 2453 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 2454 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 2455 return [xt, yt]; 2456 } 2457 2458 static getAxialAlignedBoundingBox(r, m) { 2459 const p1 = Util.applyTransform(r, m); 2460 const p2 = Util.applyTransform(r.slice(2, 4), m); 2461 const p3 = Util.applyTransform([r[0], r[3]], m); 2462 const p4 = Util.applyTransform([r[2], r[1]], m); 2463 return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; 2464 } 2465 2466 static inverseTransform(m) { 2467 const d = m[0] * m[3] - m[1] * m[2]; 2468 return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; 2469 } 2470 2471 static apply3dTransform(m, v) { 2472 return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; 2473 } 2474 2475 static singularValueDecompose2dScale(m) { 2476 const transpose = [m[0], m[2], m[1], m[3]]; 2477 const a = m[0] * transpose[0] + m[1] * transpose[2]; 2478 const b = m[0] * transpose[1] + m[1] * transpose[3]; 2479 const c = m[2] * transpose[0] + m[3] * transpose[2]; 2480 const d = m[2] * transpose[1] + m[3] * transpose[3]; 2481 const first = (a + d) / 2; 2482 const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; 2483 const sx = first + second || 1; 2484 const sy = first - second || 1; 2485 return [Math.sqrt(sx), Math.sqrt(sy)]; 2486 } 2487 2488 static normalizeRect(rect) { 2489 const r = rect.slice(0); 2490 2491 if (rect[0] > rect[2]) { 2492 r[0] = rect[2]; 2493 r[2] = rect[0]; 2494 } 2495 2496 if (rect[1] > rect[3]) { 2497 r[1] = rect[3]; 2498 r[3] = rect[1]; 2499 } 2500 2501 return r; 2502 } 2503 2504 static intersect(rect1, rect2) { 2505 function compare(a, b) { 2506 return a - b; 2507 } 2508 2509 const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
2510 const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); 2511 const result = []; 2512 rect1 = Util.normalizeRect(rect1); 2513 rect2 = Util.normalizeRect(rect2); 2514 2515 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 2516 result[0] = orderedX[1]; 2517 result[2] = orderedX[2]; 2518 } else { 2519 return null; 2520 } 2521 2522 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 2523 result[1] = orderedY[1]; 2524 result[3] = orderedY[2]; 2525 } else { 2526 return null; 2527 } 2528 2529 return result; 2530 } 2531 2532} 2533 2534exports.Util = Util; 2535const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; 2536 2537function stringToPDFString(str) { 2538 const length = str.length, 2539 strBuf = []; 2540 2541 if (str[0] === "\xFE" && str[1] === "\xFF") { 2542 for (let i = 2; i < length; i += 2) { 2543 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 2544 } 2545 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 2546 for (let i = 2; i < length; i += 2) { 2547 strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i))); 2548 } 2549 } else { 2550 for (let i = 0; i < length; ++i) { 2551 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 2552 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 2553 } 2554 } 2555 2556 return strBuf.join(""); 2557} 2558 2559function stringToUTF8String(str) { 2560 return decodeURIComponent(escape(str)); 2561} 2562 2563function utf8StringToString(str) { 2564 return unescape(encodeURIComponent(str)); 2565} 2566 2567function isEmptyObj(obj) { 2568 for (const key in obj) { 2569 return false; 2570 } 2571 2572 return true; 2573} 2574 2575function isBool(v) { 2576 return typeof v === "boolean"; 2577} 2578 2579function isNum(v) { 2580 return typeof v === "number"; 2581} 2582 2583function isString(v) { 2584 return typeof v === "string"; 2585} 2586 2587function isArrayBuffer(v) { 2588 return typeof v === "object" && v !== null && v.byteLength !== undefined; 2589} 2590 2591function isArrayEqual(arr1, arr2) { 2592 if (arr1.length !== arr2.length) { 2593 return false; 2594 } 2595 2596 return arr1.every(function (element, index) { 2597 return element === arr2[index]; 2598 }); 2599} 2600 2601function createPromiseCapability() { 2602 const capability = Object.create(null); 2603 let isSettled = false; 2604 Object.defineProperty(capability, "settled", { 2605 get() { 2606 return isSettled; 2607 } 2608 2609 }); 2610 capability.promise = new Promise(function (resolve, reject) { 2611 capability.resolve = function (data) { 2612 isSettled = true; 2613 resolve(data); 2614 }; 2615 2616 capability.reject = function (reason) { 2617 isSettled = true; 2618 reject(reason); 2619 }; 2620 }); 2621 return capability; 2622} 2623 2624const createObjectURL = function createObjectURLClosure() { 2625 const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 2626 return function createObjectURL(data, contentType, forceDataSchema = false) { 2627 if (!forceDataSchema && URL.createObjectURL) { 2628 const blob = new Blob([data], { 2629 type: contentType 2630 }); 2631 return URL.createObjectURL(blob); 2632 } 2633 2634 let buffer = `data:${contentType};base64,`; 2635 2636 for (let i = 0, ii = data.length; i < ii; i += 3) { 2637 const b1 = data[i] & 0xff; 2638 const b2 = data[i + 1] & 0xff; 2639 const b3 = data[i + 2] & 0xff;
2640 const d1 = b1 >> 2, 2641 d2 = (b1 & 3) << 4 | b2 >> 4; 2642 const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; 2643 const d4 = i + 2 < ii ? b3 & 0x3f : 64; 2644 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 2645 } 2646 2647 return buffer; 2648 }; 2649}(); 2650 2651exports.createObjectURL = createObjectURL; 2652 2653/***/ }), 2654/* 3 */ 2655/***/ (function(module, exports, __w_pdfjs_require__) { 2656 2657"use strict"; 2658 2659 2660var _is_node = __w_pdfjs_require__(4); 2661 2662; 2663 2664/***/ }), 2665/* 4 */ 2666/***/ (function(module, exports, __w_pdfjs_require__) { 2667 2668"use strict"; 2669 2670 2671Object.defineProperty(exports, "__esModule", { 2672 value: true 2673}); 2674exports.isNodeJS = void 0; 2675const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron; 2676exports.isNodeJS = isNodeJS; 2677 2678/***/ }), 2679/* 5 */ 2680/***/ (function(module, exports, __w_pdfjs_require__) { 2681 2682"use strict"; 2683 2684 2685Object.defineProperty(exports, "__esModule", { 2686 value: true 2687}); 2688exports.getDocument = getDocument; 2689exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; 2690exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0; 2691 2692var _util = __w_pdfjs_require__(2); 2693 2694var _display_utils = __w_pdfjs_require__(1); 2695 2696var _font_loader = __w_pdfjs_require__(6); 2697 2698var _api_compatibility = __w_pdfjs_require__(7); 2699 2700var _canvas = __w_pdfjs_require__(8); 2701 2702var _worker_options = __w_pdfjs_require__(10); 2703 2704var _is_node = __w_pdfjs_require__(4); 2705 2706var _message_handler = __w_pdfjs_require__(11); 2707 2708var _metadata = __w_pdfjs_require__(12); 2709 2710var _transport_stream = __w_pdfjs_require__(14); 2711 2712var _webgl = __w_pdfjs_require__(15); 2713 2714const DEFAULT_RANGE_CHUNK_SIZE = 65536; 2715const RENDERING_CANCELLED_TIMEOUT = 100; 2716let createPDFNetworkStream; 2717 2718function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) { 2719 createPDFNetworkStream = pdfNetworkStreamFactory; 2720} 2721 2722function getDocument(src) { 2723 const task = new PDFDocumentLoadingTask(); 2724 let source; 2725 2726 if (typeof src === "string") { 2727 source = { 2728 url: src 2729 }; 2730 } else if ((0, _util.isArrayBuffer)(src)) { 2731 source = { 2732 data: src 2733 }; 2734 } else if (src instanceof PDFDataRangeTransport) { 2735 source = { 2736 range: src 2737 }; 2738 } else { 2739 if (typeof src !== "object") { 2740 throw new Error("Invalid parameter in getDocument, " + "need either Uint8Array, string or a parameter object"); 2741 } 2742 2743 if (!src.url && !src.data && !src.range) { 2744 throw new Error("Invalid parameter object: need either .data, .range or .url"); 2745 } 2746 2747 source = src; 2748 } 2749 2750 const params = Object.create(null); 2751 let rangeTransport = null, 2752 worker = null; 2753 2754 for (const key in source) { 2755 if (key === "url" && typeof window !== "undefined") { 2756 params[key] = new URL(source[key], window.location).href; 2757 continue; 2758 } else if (key === "range") { 2759 rangeTransport = source[key]; 2760 continue; 2761 } else if (key === "worker") { 2762 worker = source[key]; 2763 continue; 2764 } else if (key === "data" && !(source[key] instanceof Uint8Array)) { 2765 const pdfBytes = source[key]; 2766 2767 if (typeof pdfBytes === "string") { 2768 params[key] = (0, _util.stringToBytes)(pdfBytes); 2769 } else if (typeof pdfBytes === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) { 2770 params[key] = new Uint8Array(pdfBytes); 2771 } else if ((0, _util.isArrayBuffer)(pdfBytes)) { 2772 params[key] = new Uint8Array(pdfBytes); 2773 } else { 2774 throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property."); 2775 } 2776 2777 continue; 2778 } 2779 2780 params[key] = source[key]; 2781 } 2782 2783 params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; 2784 params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory; 2785 params.ignoreErrors = params.stopAtErrors !== true; 2786 params.fontExtraProperties = params.fontExtraProperties === true; 2787 params.pdfBug = params.pdfBug === true; 2788 2789 if (!Number.isInteger(params.maxImageSize)) { 2790 params.maxImageSize = -1; 2791 } 2792 2793 if (typeof params.isEvalSupported !== "boolean") { 2794 params.isEvalSupported = true; 2795 } 2796 2797 if (typeof params.disableFontFace !== "boolean") { 2798 params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false; 2799 } 2800 2801 if (typeof params.disableRange !== "boolean") { 2802 params.disableRange = false;
2803 } 2804 2805 if (typeof params.disableStream !== "boolean") { 2806 params.disableStream = false; 2807 } 2808 2809 if (typeof params.disableAutoFetch !== "boolean") { 2810 params.disableAutoFetch = false; 2811 } 2812 2813 (0, _util.setVerbosityLevel)(params.verbosity); 2814 2815 if (!worker) { 2816 const workerParams = { 2817 verbosity: params.verbosity, 2818 port: _worker_options.GlobalWorkerOptions.workerPort 2819 }; 2820 worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams); 2821 task._worker = worker; 2822 } 2823 2824 const docId = task.docId; 2825 worker.promise.then(function () { 2826 if (task.destroyed) { 2827 throw new Error("Loading aborted"); 2828 } 2829 2830 const workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId); 2831 2832 const networkStreamPromise = new Promise(function (resolve) { 2833 let networkStream; 2834 2835 if (rangeTransport) { 2836 networkStream = new _transport_stream.PDFDataTransportStream({ 2837 length: params.length, 2838 initialData: params.initialData, 2839 progressiveDone: params.progressiveDone, 2840 disableRange: params.disableRange, 2841 disableStream: params.disableStream 2842 }, rangeTransport); 2843 } else if (!params.data) { 2844 networkStream = createPDFNetworkStream({ 2845 url: params.url, 2846 length: params.length, 2847 httpHeaders: params.httpHeaders, 2848 withCredentials: params.withCredentials, 2849 rangeChunkSize: params.rangeChunkSize, 2850 disableRange: params.disableRange, 2851 disableStream: params.disableStream 2852 }); 2853 } 2854 2855 resolve(networkStream); 2856 }); 2857 return Promise.all([workerIdPromise, networkStreamPromise]).then(function ([workerId, networkStream]) { 2858 if (task.destroyed) { 2859 throw new Error("Loading aborted"); 2860 } 2861 2862 const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port); 2863 messageHandler.postMessageTransfers = worker.postMessageTransfers; 2864 const transport = new WorkerTransport(messageHandler, task, networkStream, params); 2865 task._transport = transport; 2866 messageHandler.send("Ready", null); 2867 }); 2868 }).catch(task._capability.reject); 2869 return task; 2870} 2871 2872function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { 2873 if (worker.destroyed) { 2874 return Promise.reject(new Error("Worker was destroyed")); 2875 } 2876 2877 if (pdfDataRangeTransport) { 2878 source.length = pdfDataRangeTransport.length; 2879 source.initialData = pdfDataRangeTransport.initialData; 2880 source.progressiveDone = pdfDataRangeTransport.progressiveDone; 2881 } 2882 2883 return worker.messageHandler.sendWithPromise("GetDocRequest", { 2884 docId, 2885 apiVersion: '2.5.207', 2886 source: { 2887 data: source.data, 2888 url: source.url, 2889 password: source.password, 2890 disableAutoFetch: source.disableAutoFetch, 2891 rangeChunkSize: source.rangeChunkSize, 2892 length: source.length 2893 }, 2894 maxImageSize: source.maxImageSize, 2895 disableFontFace: source.disableFontFace, 2896 postMessageTransfers: worker.postMessageTransfers, 2897 docBaseUrl: source.docBaseUrl, 2898 ignoreErrors: source.ignoreErrors, 2899 isEvalSupported: source.isEvalSupported, 2900 fontExtraProperties: source.fontExtraProperties 2901 }).then(function (workerId) { 2902 if (worker.destroyed) { 2903 throw new Error("Worker was destroyed"); 2904 } 2905 2906 return workerId; 2907 }); 2908} 2909 2910const PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { 2911 let nextDocumentId = 0; 2912 2913 class PDFDocumentLoadingTask { 2914 constructor() { 2915 this._capability = (0, _util.createPromiseCapability)(); 2916 this._transport = null; 2917 this._worker = null; 2918 this.docId = "d" + nextDocumentId++; 2919 this.destroyed = false; 2920 this.onPassword = null; 2921 this.onProgress = null; 2922 this.onUnsupportedFeature = null; 2923 } 2924 2925 get promise() { 2926 return this._capability.promise; 2927 } 2928 2929 destroy() { 2930 this.destroyed = true; 2931 const transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy(); 2932 return transportDestroyed.then(() => { 2933 this._transport = null; 2934 2935 if (this._worker) { 2936 this._worker.destroy(); 2937 2938 this._worker = null; 2939 } 2940 }); 2941 } 2942 2943 } 2944 2945 return PDFDocumentLoadingTask; 2946}(); 2947 2948class PDFDataRangeTransport { 2949 constructor(length, initialData, progressiveDone = false) { 2950 this.length = length; 2951 this.initialData = initialData; 2952 this.progressiveDone = progressiveDone; 2953 this._rangeListeners = []; 2954 this._progressListeners = []; 2955 this._progressiveReadListeners = []; 2956 this._progressiveDoneListeners = []; 2957 this._readyCapability = (0, _util.createPromiseCapability)(); 2958 } 2959 2960 addRangeListener(listener) { 2961 this._rangeListeners.push(listener); 2962 } 2963 2964 addProgressListener(listener) { 2965 this._progressListeners.push(listener); 2966 } 2967 2968 addProgressiveReadListener(listener) { 2969 this._progressiveReadListeners.push(listener); 2970 } 2971 2972 addProgressiveDoneListener(listener) { 2973 this._progressiveDoneListeners.push(listener); 2974 } 2975 2976 onDataRange(begin, chunk) { 2977 for (const listener of this._rangeListeners) { 2978 listener(begin, chunk); 2979 } 2980 } 2981 2982 onDataProgress(loaded, total) { 2983 this._readyCapability.promise.then(() => { 2984 for (const listener of this._progressListeners) { 2985 listener(loaded, total); 2986 } 2987 }); 2988 } 2989 2990 onDataProgressiveRead(chunk) { 2991 this._readyCapability.promise.then(() => { 2992 for (const listener of this._progressiveReadListeners) { 2993 listener(chunk); 2994 } 2995 }); 2996 } 2997 2998 onDataProgressiveDone() { 2999 this._readyCapability.promise.then(() => { 3000 for (const listener of this._progressiveDoneListeners) { 3001 listener(); 3002 } 3003 }); 3004 } 3005 3006 transportReady() { 3007 this._readyCapability.resolve(); 3008 } 3009 3010 requestDataRange(begin, end) { 3011 (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange"); 3012 } 3013 3014 abort() {} 3015 3016} 3017 3018exports.PDFDataRangeTransport = PDFDataRangeTransport; 3019 3020class PDFDocumentProxy { 3021 constructor(pdfInfo, transport) { 3022 this._pdfInfo = pdfInfo; 3023 this._transport = transport; 3024 } 3025 3026 get numPages() { 3027 return this._pdfInfo.numPages; 3028 } 3029 3030 get fingerprint() { 3031 return this._pdfInfo.fingerprint; 3032 } 3033 3034 getPage(pageNumber) { 3035 return this._transport.getPage(pageNumber); 3036 } 3037 3038 getPageIndex(ref) { 3039 return this._transport.getPageIndex(ref); 3040 } 3041 3042 getDestinations() { 3043 return this._transport.getDestinations(); 3044 } 3045 3046 getDestination(id) { 3047 return this._transport.getDestination(id); 3048 } 3049 3050 getPageLabels() { 3051 return this._transport.getPageLabels(); 3052 } 3053 3054 getPageLayout() { 3055 return this._transport.getPageLayout(); 3056 } 3057 3058 getPageMode() { 3059 return this._transport.getPageMode(); 3060 } 3061 3062 getViewerPreferences() { 3063 return this._transport.getViewerPreferences(); 3064 } 3065 3066 getOpenAction() { 3067 return this._transport.getOpenAction(); 3068 } 3069 3070 getOpenActionDestination() { 3071 (0, _display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."); 3072 return this.getOpenAction().then(function (openAction) { 3073 return openAction && openAction.dest ? openAction.dest : null; 3074 }); 3075 } 3076 3077 getAttachments() { 3078 return this._transport.getAttachments(); 3079 } 3080 3081 getJavaScript() { 3082 return this._transport.getJavaScript(); 3083 } 3084 3085 getOutline() { 3086 return this._transport.getOutline(); 3087 } 3088 3089 getPermissions() { 3090 return this._transport.getPermissions(); 3091 } 3092 3093 getMetadata() { 3094 return this._transport.getMetadata(); 3095 } 3096 3097 getData() { 3098 return this._transport.getData(); 3099 } 3100 3101 getDownloadInfo() { 3102 return this._transport.downloadInfoCapability.promise; 3103 } 3104 3105 getStats() { 3106 return this._transport.getStats(); 3107 } 3108 3109 cleanup() { 3110 return this._transport.startCleanup(); 3111 } 3112 3113 destroy() { 3114 return this.loadingTask.destroy(); 3115 } 3116 3117 get loadingParams() { 3118 return this._transport.loadingParams; 3119 } 3120 3121 get loadingTask() { 3122 return this._transport.loadingTask; 3123 } 3124 3125} 3126 3127exports.PDFDocumentProxy = PDFDocumentProxy; 3128 3129class PDFPageProxy { 3130 constructor(pageIndex, pageInfo, transport, pdfBug = false) { 3131 this._pageIndex = pageIndex; 3132 this._pageInfo = pageInfo; 3133 this._transport = transport; 3134 this._stats = pdfBug ? new _display_utils.StatTimer() : null; 3135 this._pdfBug = pdfBug; 3136 this.commonObjs = transport.commonObjs; 3137 this.objs = new PDFObjects(); 3138 this.cleanupAfterRender = false;
3139 this.pendingCleanup = false; 3140 this.intentStates = Object.create(null); 3141 this.destroyed = false; 3142 } 3143 3144 get pageNumber() { 3145 return this._pageIndex + 1; 3146 } 3147 3148 get rotate() { 3149 return this._pageInfo.rotate; 3150 } 3151 3152 get ref() { 3153 return this._pageInfo.ref; 3154 } 3155 3156 get userUnit() { 3157 return this._pageInfo.userUnit; 3158 } 3159 3160 get view() { 3161 return this._pageInfo.view; 3162 } 3163 3164 getViewport({ 3165 scale, 3166 rotation = this.rotate, 3167 offsetX = 0, 3168 offsetY = 0, 3169 dontFlip = false 3170 } = {}) { 3171 return new _display_utils.PageViewport({ 3172 viewBox: this.view, 3173 scale, 3174 rotation, 3175 offsetX, 3176 offsetY, 3177 dontFlip 3178 }); 3179 } 3180 3181 getAnnotations({ 3182 intent = null 3183 } = {}) { 3184 if (!this.annotationsPromise || this.annotationsIntent !== intent) { 3185 this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent); 3186 this.annotationsIntent = intent; 3187 } 3188 3189 return this.annotationsPromise; 3190 } 3191 3192 render({ 3193 canvasContext, 3194 viewport, 3195 intent = "display", 3196 enableWebGL = false, 3197 renderInteractiveForms = false, 3198 transform = null, 3199 imageLayer = null, 3200 canvasFactory = null, 3201 background = null 3202 }) { 3203 if (this._stats) { 3204 this._stats.time("Overall"); 3205 } 3206 3207 const renderingIntent = intent === "print" ? "print" : "display"; 3208 this.pendingCleanup = false; 3209 3210 if (!this.intentStates[renderingIntent]) { 3211 this.intentStates[renderingIntent] = Object.create(null); 3212 } 3213 3214 const intentState = this.intentStates[renderingIntent]; 3215 3216 if (intentState.streamReaderCancelTimeout) { 3217 clearTimeout(intentState.streamReaderCancelTimeout); 3218 intentState.streamReaderCancelTimeout = null; 3219 } 3220 3221 const canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory(); 3222 const webGLContext = new _webgl.WebGLContext({ 3223 enable: enableWebGL 3224 }); 3225 3226 if (!intentState.displayReadyCapability) { 3227 intentState.displayReadyCapability = (0, _util.createPromiseCapability)(); 3228 intentState.operatorList = { 3229 fnArray: [], 3230 argsArray: [], 3231 lastChunk: false 3232 }; 3233 3234 if (this._stats) { 3235 this._stats.time("Page Request"); 3236 } 3237 3238 this._pumpOperatorList({ 3239 pageIndex: this._pageIndex, 3240 intent: renderingIntent, 3241 renderInteractiveForms: renderInteractiveForms === true 3242 }); 3243 } 3244 3245 const complete = error => { 3246 const i = intentState.renderTasks.indexOf(internalRenderTask); 3247 3248 if (i >= 0) { 3249 intentState.renderTasks.splice(i, 1); 3250 } 3251 3252 if (this.cleanupAfterRender || renderingIntent === "print") { 3253 this.pendingCleanup = true; 3254 } 3255 3256 this._tryCleanup(); 3257 3258 if (error) { 3259 internalRenderTask.capability.reject(error); 3260 3261 this._abortOperatorList({ 3262 intentState, 3263 reason: error 3264 }); 3265 } else { 3266 internalRenderTask.capability.resolve(); 3267 } 3268 3269 if (this._stats) { 3270 this._stats.timeEnd("Rendering"); 3271 3272 this._stats.timeEnd("Overall"); 3273 } 3274 }; 3275 3276 const internalRenderTask = new InternalRenderTask({ 3277 callback: complete, 3278 params: { 3279 canvasContext, 3280 viewport, 3281 transform, 3282 imageLayer, 3283 background 3284 }, 3285 objs: this.objs, 3286 commonObjs: this.commonObjs, 3287 operatorList: intentState.operatorList, 3288 pageIndex: this._pageIndex, 3289 canvasFactory: canvasFactoryInstance, 3290 webGLContext, 3291 useRequestAnimationFrame: renderingIntent !== "print", 3292 pdfBug: this._pdfBug 3293 }); 3294 3295 if (!intentState.renderTasks) { 3296 intentState.renderTasks = []; 3297 } 3298 3299 intentState.renderTasks.push(internalRenderTask); 3300 const renderTask = internalRenderTask.task; 3301 intentState.displayReadyCapability.promise.then(transparency => { 3302 if (this.pendingCleanup) { 3303 complete(); 3304 return; 3305 } 3306 3307 if (this._stats) { 3308 this._stats.time("Rendering"); 3309 } 3310
3311 internalRenderTask.initializeGraphics(transparency); 3312 internalRenderTask.operatorListChanged(); 3313 }).catch(complete); 3314 return renderTask; 3315 } 3316 3317 getOperatorList() { 3318 function operatorListChanged() { 3319 if (intentState.operatorList.lastChunk) { 3320 intentState.opListReadCapability.resolve(intentState.operatorList); 3321 const i = intentState.renderTasks.indexOf(opListTask); 3322 3323 if (i >= 0) { 3324 intentState.renderTasks.splice(i, 1); 3325 } 3326 } 3327 } 3328 3329 const renderingIntent = "oplist"; 3330 3331 if (!this.intentStates[renderingIntent]) { 3332 this.intentStates[renderingIntent] = Object.create(null); 3333 } 3334 3335 const intentState = this.intentStates[renderingIntent]; 3336 let opListTask; 3337 3338 if (!intentState.opListReadCapability) { 3339 opListTask = {}; 3340 opListTask.operatorListChanged = operatorListChanged; 3341 intentState.opListReadCapability = (0, _util.createPromiseCapability)(); 3342 intentState.renderTasks = []; 3343 intentState.renderTasks.push(opListTask); 3344 intentState.operatorList = { 3345 fnArray: [], 3346 argsArray: [], 3347 lastChunk: false 3348 }; 3349 3350 if (this._stats) { 3351 this._stats.time("Page Request"); 3352 } 3353 3354 this._pumpOperatorList({ 3355 pageIndex: this._pageIndex, 3356 intent: renderingIntent 3357 }); 3358 } 3359 3360 return intentState.opListReadCapability.promise; 3361 } 3362 3363 streamTextContent({ 3364 normalizeWhitespace = false, 3365 disableCombineTextItems = false 3366 } = {}) { 3367 const TEXT_CONTENT_CHUNK_SIZE = 100; 3368 return this._transport.messageHandler.sendWithStream("GetTextContent", { 3369 pageIndex: this._pageIndex, 3370 normalizeWhitespace: normalizeWhitespace === true, 3371 combineTextItems: disableCombineTextItems !== true 3372 }, { 3373 highWaterMark: TEXT_CONTENT_CHUNK_SIZE, 3374 3375 size(textContent) { 3376 return textContent.items.length; 3377 } 3378 3379 }); 3380 } 3381 3382 getTextContent(params = {}) { 3383 const readableStream = this.streamTextContent(params); 3384 return new Promise(function (resolve, reject) { 3385 function pump() { 3386 reader.read().then(function ({ 3387 value, 3388 done 3389 }) { 3390 if (done) { 3391 resolve(textContent); 3392 return; 3393 } 3394 3395 Object.assign(textContent.styles, value.styles); 3396 textContent.items.push(...value.items); 3397 pump(); 3398 }, reject); 3399 } 3400 3401 const reader = readableStream.getReader(); 3402 const textContent = { 3403 items: [], 3404 styles: Object.create(null) 3405 }; 3406 pump(); 3407 }); 3408 } 3409 3410 _destroy() { 3411 this.destroyed = true; 3412 this._transport.pageCache[this._pageIndex] = null; 3413 const waitOn = []; 3414 Object.keys(this.intentStates).forEach(intent => { 3415 const intentState = this.intentStates[intent]; 3416 3417 this._abortOperatorList({ 3418 intentState, 3419 reason: new Error("Page was destroyed."), 3420 force: true 3421 }); 3422 3423 if (intent === "oplist") { 3424 return; 3425 } 3426 3427 intentState.renderTasks.forEach(function (renderTask) { 3428 const renderCompleted = renderTask.capability.promise.catch(function () {}); 3429 waitOn.push(renderCompleted); 3430 renderTask.cancel(); 3431 }); 3432 }); 3433 this.objs.clear(); 3434 this.annotationsPromise = null; 3435 this.pendingCleanup = false; 3436 return Promise.all(waitOn); 3437 } 3438 3439 cleanup(resetStats = false) { 3440 this.pendingCleanup = true; 3441 return this._tryCleanup(resetStats); 3442 } 3443 3444 _tryCleanup(resetStats = false) { 3445 if (!this.pendingCleanup || Object.keys(this.intentStates).some(intent => { 3446 const intentState = this.intentStates[intent]; 3447 return intentState.renderTasks.length !== 0 || !intentState.operatorList.lastChunk; 3448 })) { 3449 return false; 3450 } 3451 3452 Object.keys(this.intentStates).forEach(intent => { 3453 delete this.intentStates[intent]; 3454 }); 3455 this.objs.clear(); 3456 this.annotationsPromise = null; 3457 3458 if (resetStats && this._stats) { 3459 this._stats = new _display_utils.StatTimer(); 3460 } 3461 3462 this.pendingCleanup = false; 3463 return true; 3464 } 3465 3466 _startRenderPage(transparency, intent) { 3467 const intentState = this.intentStates[intent]; 3468 3469 if (!intentState) { 3470 return; 3471 } 3472 3473 if (this._stats) { 3474 this._stats.timeEnd("Page Request"); 3475 } 3476 3477 if (intentState.displayReadyCapability) { 3478 intentState.displayReadyCapability.resolve(transparency); 3479 } 3480 } 3481 3482 _renderPageChunk(operatorListChunk, intentState) { 3483 for (let i = 0, ii = operatorListChunk.length; i < ii; i++) { 3484 intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]); 3485 intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]); 3486 } 3487 3488 intentState.operatorList.lastChunk = operatorListChunk.lastChunk; 3489 3490 for (let i = 0; i < intentState.renderTasks.length; i++) { 3491 intentState.renderTasks[i].operatorListChanged(); 3492 } 3493 3494 if (operatorListChunk.lastChunk) { 3495 this._tryCleanup(); 3496 } 3497 } 3498 3499 _pumpOperatorList(args) { 3500 (0, _util.assert)(args.intent, 'PDFPageProxy._pumpOperatorList: Expected "intent" argument.'); 3501 3502 const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", args); 3503 3504 const reader = readableStream.getReader(); 3505 const intentState = this.intentStates[args.intent]; 3506 intentState.streamReader = reader; 3507 3508 const pump = () => { 3509 reader.read().then(({ 3510 value, 3511 done 3512 }) => { 3513 if (done) { 3514 intentState.streamReader = null; 3515 return; 3516 } 3517 3518 if (this._transport.destroyed) { 3519 return; 3520 } 3521 3522 this._renderPageChunk(value, intentState); 3523 3524 pump(); 3525 }, reason => { 3526 intentState.streamReader = null; 3527 3528 if (this._transport.destroyed) { 3529 return; 3530 } 3531 3532 if (intentState.operatorList) { 3533 intentState.operatorList.lastChunk = true; 3534 3535 for (let i = 0; i < intentState.renderTasks.length; i++) { 3536 intentState.renderTasks[i].operatorListChanged(); 3537 } 3538 3539 this._tryCleanup(); 3540 } 3541 3542 if (intentState.displayReadyCapability) { 3543 intentState.displayReadyCapability.reject(reason); 3544 } else if (intentState.opListReadCapability) { 3545 intentState.opListReadCapability.reject(reason); 3546 } else { 3547 throw reason; 3548 } 3549 }); 3550 }; 3551 3552 pump(); 3553 } 3554 3555 _abortOperatorList({ 3556 intentState, 3557 reason, 3558 force = false 3559 }) { 3560 (0, _util.assert)(reason instanceof Error || typeof reason === "object" && reason !== null, 'PDFPageProxy._abortOperatorList: Expected "reason" argument.'); 3561 3562 if (!intentState.streamReader) { 3563 return; 3564 } 3565 3566 if (!force) { 3567 if (intentState.renderTasks.length !== 0) { 3568 return; 3569 } 3570 3571 if (reason instanceof _display_utils.RenderingCancelledException) { 3572 intentState.streamReaderCancelTimeout = setTimeout(() => { 3573 this._abortOperatorList({ 3574 intentState, 3575 reason, 3576 force: true 3577 }); 3578 3579 intentState.streamReaderCancelTimeout = null; 3580 }, RENDERING_CANCELLED_TIMEOUT); 3581 return; 3582 } 3583 } 3584 3585 intentState.streamReader.cancel(new _util.AbortException(reason && reason.message)); 3586 intentState.streamReader = null; 3587 3588 if (this._transport.destroyed) { 3589 return; 3590 } 3591 3592 Object.keys(this.intentStates).some(intent => { 3593 if (this.intentStates[intent] === intentState) { 3594 delete this.intentStates[intent]; 3595 return true; 3596 } 3597 3598 return false;
3599 }); 3600 this.cleanup(); 3601 } 3602 3603 get stats() { 3604 return this._stats; 3605 } 3606 3607} 3608 3609exports.PDFPageProxy = PDFPageProxy; 3610 3611class LoopbackPort { 3612 constructor(defer = true) { 3613 this._listeners = []; 3614 this._defer = defer; 3615 this._deferred = Promise.resolve(undefined); 3616 } 3617 3618 postMessage(obj, transfers) { 3619 function cloneValue(value) { 3620 if (typeof value !== "object" || value === null) { 3621 return value; 3622 } 3623 3624 if (cloned.has(value)) { 3625 return cloned.get(value); 3626 } 3627 3628 let buffer, result; 3629 3630 if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { 3631 const transferable = transfers && transfers.includes(buffer); 3632 3633 if (transferable) { 3634 result = new value.constructor(buffer, value.byteOffset, value.byteLength); 3635 } else { 3636 result = new value.constructor(value); 3637 } 3638 3639 cloned.set(value, result); 3640 return result; 3641 } 3642 3643 result = Array.isArray(value) ? [] : {}; 3644 cloned.set(value, result); 3645 3646 for (const i in value) { 3647 let desc, 3648 p = value; 3649 3650 while (!(desc = Object.getOwnPropertyDescriptor(p, i))) { 3651 p = Object.getPrototypeOf(p); 3652 } 3653 3654 if (typeof desc.value === "undefined") { 3655 continue; 3656 } 3657 3658 if (typeof desc.value === "function") { 3659 if (value.hasOwnProperty && value.hasOwnProperty(i)) { 3660 throw new Error(`LoopbackPort.postMessage - cannot clone: ${value[i]}`); 3661 } 3662 3663 continue; 3664 } 3665 3666 result[i] = cloneValue(desc.value); 3667 } 3668 3669 return result; 3670 } 3671 3672 if (!this._defer) { 3673 this._listeners.forEach(listener => { 3674 listener.call(this, { 3675 data: obj 3676 }); 3677 }); 3678 3679 return; 3680 } 3681 3682 const cloned = new WeakMap(); 3683 const e = { 3684 data: cloneValue(obj) 3685 }; 3686 3687 this._deferred.then(() => { 3688 this._listeners.forEach(listener => { 3689 listener.call(this, e); 3690 }); 3691 }); 3692 } 3693 3694 addEventListener(name, listener) { 3695 this._listeners.push(listener); 3696 } 3697 3698 removeEventListener(name, listener) { 3699 const i = this._listeners.indexOf(listener); 3700 3701 this._listeners.splice(i, 1); 3702 } 3703 3704 terminate() { 3705 this._listeners.length = 0; 3706 } 3707 3708} 3709 3710exports.LoopbackPort = LoopbackPort; 3711 3712const PDFWorker = function PDFWorkerClosure() { 3713 const pdfWorkerPorts = new WeakMap(); 3714 let isWorkerDisabled = false; 3715 let fallbackWorkerSrc; 3716 let nextFakeWorkerId = 0; 3717 let fakeWorkerCapability; 3718 3719 if (_is_node.isNodeJS && typeof require === "function") { 3720 isWorkerDisabled = true; 3721 fallbackWorkerSrc = "./pdf.worker.js"; 3722 } else if (typeof document === "object" && "currentScript" in document) { 3723 const pdfjsFilePath = document.currentScript && document.currentScript.src; 3724 3725 if (pdfjsFilePath) { 3726 fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2"); 3727 } 3728 } 3729 3730 function getWorkerSrc() { 3731 if (_worker_options.GlobalWorkerOptions.workerSrc) { 3732 return _worker_options.GlobalWorkerOptions.workerSrc; 3733 } 3734 3735 if (typeof fallbackWorkerSrc !== "undefined") { 3736 if (!_is_node.isNodeJS) { 3737 (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'); 3738 } 3739 3740 return fallbackWorkerSrc; 3741 } 3742 3743 throw new Error('No "GlobalWorkerOptions.workerSrc" specified.'); 3744 } 3745 3746 function getMainThreadWorkerMessageHandler() { 3747 let mainWorkerMessageHandler; 3748 3749 try { 3750 mainWorkerMessageHandler = globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler; 3751 } catch (ex) {} 3752 3753 return mainWorkerMessageHandler || null; 3754 } 3755 3756 function setupFakeWorkerGlobal() { 3757 if (fakeWorkerCapability) { 3758 return fakeWorkerCapability.promise; 3759 } 3760 3761 fakeWorkerCapability = (0, _util.createPromiseCapability)(); 3762 3763 const loader = async function () { 3764 const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler(); 3765 3766 if (mainWorkerMessageHandler) { 3767 return mainWorkerMessageHandler; 3768 } 3769 3770 if (_is_node.isNodeJS && typeof require === "function") { 3771 const worker = eval("require")(getWorkerSrc()); 3772 return worker.WorkerMessageHandler; 3773 } 3774 3775 await (0, _display_utils.loadScript)(getWorkerSrc()); 3776 return window.pdfjsWorker.WorkerMessageHandler; 3777 }; 3778 3779 loader().then(fakeWorkerCapability.resolve, fakeWorkerCapability.reject); 3780 return fakeWorkerCapability.promise; 3781 } 3782 3783 function createCDNWrapper(url) { 3784 const wrapper = "importScripts('" + url + "');"; 3785 return URL.createObjectURL(new Blob([wrapper])); 3786 } 3787 3788 class PDFWorker { 3789 constructor({ 3790 name = null, 3791 port = null, 3792 verbosity = (0, _util.getVerbosityLevel)() 3793 } = {}) { 3794 if (port && pdfWorkerPorts.has(port)) { 3795 throw new Error("Cannot use more than one PDFWorker per port"); 3796 } 3797 3798 this.name = name; 3799 this.destroyed = false;
3800 this.postMessageTransfers = true; 3801 this.verbosity = verbosity; 3802 this._readyCapability = (0, _util.createPromiseCapability)(); 3803 this._port = null; 3804 this._webWorker = null; 3805 this._messageHandler = null; 3806 3807 if (port) { 3808 pdfWorkerPorts.set(port, this); 3809 3810 this._initializeFromPort(port); 3811 3812 return; 3813 } 3814 3815 this._initialize(); 3816 } 3817 3818 get promise() { 3819 return this._readyCapability.promise; 3820 } 3821 3822 get port() { 3823 return this._port; 3824 } 3825 3826 get messageHandler() { 3827 return this._messageHandler; 3828 } 3829 3830 _initializeFromPort(port) { 3831 this._port = port; 3832 this._messageHandler = new _message_handler.MessageHandler("main", "worker", port); 3833 3834 this._messageHandler.on("ready", function () {}); 3835 3836 this._readyCapability.resolve(); 3837 } 3838 3839 _initialize() { 3840 if (typeof Worker !== "undefined" && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { 3841 let workerSrc = getWorkerSrc(); 3842 3843 try { 3844 if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { 3845 workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); 3846 } 3847 3848 const worker = new Worker(workerSrc); 3849 const messageHandler = new _message_handler.MessageHandler("main", "worker", worker); 3850 3851 const terminateEarly = () => { 3852 worker.removeEventListener("error", onWorkerError); 3853 messageHandler.destroy(); 3854 worker.terminate(); 3855 3856 if (this.destroyed) { 3857 this._readyCapability.reject(new Error("Worker was destroyed")); 3858 } else { 3859 this._setupFakeWorker(); 3860 } 3861 }; 3862 3863 const onWorkerError = () => { 3864 if (!this._webWorker) { 3865 terminateEarly(); 3866 } 3867 }; 3868 3869 worker.addEventListener("error", onWorkerError); 3870 messageHandler.on("test", data => { 3871 worker.removeEventListener("error", onWorkerError); 3872 3873 if (this.destroyed) { 3874 terminateEarly(); 3875 return; 3876 } 3877 3878 if (data) { 3879 this._messageHandler = messageHandler; 3880 this._port = worker; 3881 this._webWorker = worker; 3882 3883 if (!data.supportTransfers) { 3884 this.postMessageTransfers = false; 3885 } 3886 3887 this._readyCapability.resolve(); 3888 3889 messageHandler.send("configure", { 3890 verbosity: this.verbosity 3891 }); 3892 } else { 3893 this._setupFakeWorker(); 3894 3895 messageHandler.destroy(); 3896 worker.terminate(); 3897 } 3898 }); 3899 messageHandler.on("ready", data => { 3900 worker.removeEventListener("error", onWorkerError); 3901 3902 if (this.destroyed) { 3903 terminateEarly(); 3904 return; 3905 } 3906 3907 try { 3908 sendTest(); 3909 } catch (e) { 3910 this._setupFakeWorker(); 3911 } 3912 }); 3913 3914 const sendTest = () => { 3915 const testObj = new Uint8Array([this.postMessageTransfers ? 255 : 0]); 3916 3917 try { 3918 messageHandler.send("test", testObj, [testObj.buffer]); 3919 } catch (ex) { 3920 (0, _util.warn)("Cannot use postMessage transfers."); 3921 testObj[0] = 0; 3922 messageHandler.send("test", testObj); 3923 } 3924 }; 3925 3926 sendTest(); 3927 return; 3928 } catch (e) { 3929 (0, _util.info)("The worker has been disabled."); 3930 } 3931 } 3932 3933 this._setupFakeWorker(); 3934 } 3935 3936 _setupFakeWorker() { 3937 if (!isWorkerDisabled) { 3938 (0, _util.warn)("Setting up fake worker."); 3939 isWorkerDisabled = true; 3940 } 3941 3942 setupFakeWorkerGlobal().then(WorkerMessageHandler => { 3943 if (this.destroyed) { 3944 this._readyCapability.reject(new Error("Worker was destroyed")); 3945 3946 return; 3947 } 3948 3949 const port = new LoopbackPort(); 3950 this._port = port; 3951 const id = "fake" + nextFakeWorkerId++; 3952 const workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port); 3953 WorkerMessageHandler.setup(workerHandler, port); 3954 const messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port); 3955 this._messageHandler = messageHandler; 3956 3957 this._readyCapability.resolve(); 3958 3959 messageHandler.send("configure", { 3960 verbosity: this.verbosity 3961 }); 3962 }).catch(reason => { 3963 this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`)); 3964 }); 3965 } 3966 3967 destroy() { 3968 this.destroyed = true; 3969 3970 if (this._webWorker) { 3971 this._webWorker.terminate(); 3972 3973 this._webWorker = null; 3974 } 3975 3976 pdfWorkerPorts.delete(this._port); 3977 this._port = null; 3978 3979 if (this._messageHandler) { 3980 this._messageHandler.destroy(); 3981 3982 this._messageHandler = null; 3983 } 3984 } 3985 3986 static fromPort(params) { 3987 if (!params || !params.port) { 3988 throw new Error("PDFWorker.fromPort - invalid method signature."); 3989 } 3990 3991 if (pdfWorkerPorts.has(params.port)) { 3992 return pdfWorkerPorts.get(params.port); 3993 } 3994 3995 return new PDFWorker(params); 3996 } 3997 3998 static getWorkerSrc() { 3999 return getWorkerSrc(); 4000 } 4001 4002 } 4003 4004 return PDFWorker; 4005}(); 4006 4007exports.PDFWorker = PDFWorker; 4008 4009class WorkerTransport { 4010 constructor(messageHandler, loadingTask, networkStream, params) { 4011 this.messageHandler = messageHandler; 4012 this.loadingTask = loadingTask; 4013 this.commonObjs = new PDFObjects(); 4014 this.fontLoader = new _font_loader.FontLoader({ 4015 docId: loadingTask.docId, 4016 onUnsupportedFeature: this._onUnsupportedFeature.bind(this) 4017 }); 4018 this._params = params; 4019 this.CMapReaderFactory = new params.CMapReaderFactory({ 4020 baseUrl: params.cMapUrl, 4021 isCompressed: params.cMapPacked 4022 }); 4023 this.destroyed = false;
4024 this.destroyCapability = null; 4025 this._passwordCapability = null; 4026 this._networkStream = networkStream; 4027 this._fullReader = null; 4028 this._lastProgress = null; 4029 this.pageCache = []; 4030 this.pagePromises = []; 4031 this.downloadInfoCapability = (0, _util.createPromiseCapability)(); 4032 this.setupMessageHandler(); 4033 } 4034 4035 destroy() { 4036 if (this.destroyCapability) { 4037 return this.destroyCapability.promise; 4038 } 4039 4040 this.destroyed = true; 4041 this.destroyCapability = (0, _util.createPromiseCapability)(); 4042 4043 if (this._passwordCapability) { 4044 this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback")); 4045 } 4046 4047 const waitOn = []; 4048 this.pageCache.forEach(function (page) { 4049 if (page) { 4050 waitOn.push(page._destroy()); 4051 } 4052 }); 4053 this.pageCache.length = 0; 4054 this.pagePromises.length = 0; 4055 const terminated = this.messageHandler.sendWithPromise("Terminate", null); 4056 waitOn.push(terminated); 4057 Promise.all(waitOn).then(() => { 4058 this.fontLoader.clear(); 4059 4060 if (this._networkStream) { 4061 this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")); 4062 } 4063 4064 if (this.messageHandler) { 4065 this.messageHandler.destroy(); 4066 this.messageHandler = null; 4067 } 4068 4069 this.destroyCapability.resolve(); 4070 }, this.destroyCapability.reject); 4071 return this.destroyCapability.promise; 4072 } 4073 4074 setupMessageHandler() { 4075 const { 4076 messageHandler, 4077 loadingTask 4078 } = this; 4079 messageHandler.on("GetReader", (data, sink) => { 4080 (0, _util.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available."); 4081 this._fullReader = this._networkStream.getFullReader(); 4082 4083 this._fullReader.onProgress = evt => { 4084 this._lastProgress = { 4085 loaded: evt.loaded, 4086 total: evt.total 4087 }; 4088 }; 4089 4090 sink.onPull = () => { 4091 this._fullReader.read().then(function ({ 4092 value, 4093 done 4094 }) { 4095 if (done) { 4096 sink.close(); 4097 return; 4098 } 4099 4100 (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetReader - expected an ArrayBuffer."); 4101 sink.enqueue(new Uint8Array(value), 1, [value]); 4102 }).catch(reason => { 4103 sink.error(reason); 4104 }); 4105 }; 4106 4107 sink.onCancel = reason => { 4108 this._fullReader.cancel(reason); 4109 }; 4110 }); 4111 messageHandler.on("ReaderHeadersReady", data => { 4112 const headersCapability = (0, _util.createPromiseCapability)(); 4113 const fullReader = this._fullReader; 4114 fullReader.headersReady.then(() => { 4115 if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { 4116 if (this._lastProgress && loadingTask.onProgress) { 4117 loadingTask.onProgress(this._lastProgress); 4118 } 4119 4120 fullReader.onProgress = evt => { 4121 if (loadingTask.onProgress) { 4122 loadingTask.onProgress({ 4123 loaded: evt.loaded, 4124 total: evt.total 4125 }); 4126 } 4127 }; 4128 } 4129 4130 headersCapability.resolve({ 4131 isStreamingSupported: fullReader.isStreamingSupported, 4132 isRangeSupported: fullReader.isRangeSupported, 4133 contentLength: fullReader.contentLength 4134 }); 4135 }, headersCapability.reject); 4136 return headersCapability.promise; 4137 }); 4138 messageHandler.on("GetRangeReader", (data, sink) => { 4139 (0, _util.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available."); 4140 4141 const rangeReader = this._networkStream.getRangeReader(data.begin, data.end); 4142 4143 if (!rangeReader) { 4144 sink.close(); 4145 return; 4146 } 4147 4148 sink.onPull = () => { 4149 rangeReader.read().then(function ({ 4150 value, 4151 done 4152 }) { 4153 if (done) { 4154 sink.close(); 4155 return; 4156 } 4157 4158 (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetRangeReader - expected an ArrayBuffer."); 4159 sink.enqueue(new Uint8Array(value), 1, [value]); 4160 }).catch(reason => { 4161 sink.error(reason); 4162 }); 4163 }; 4164 4165 sink.onCancel = reason => { 4166 rangeReader.cancel(reason); 4167 }; 4168 }); 4169 messageHandler.on("GetDoc", ({ 4170 pdfInfo 4171 }) => { 4172 this._numPages = pdfInfo.numPages; 4173 4174 loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this)); 4175 }); 4176 messageHandler.on("DocException", function (ex) { 4177 let reason; 4178 4179 switch (ex.name) { 4180 case "PasswordException": 4181 reason = new _util.PasswordException(ex.message, ex.code); 4182 break; 4183 4184 case "InvalidPDFException": 4185 reason = new _util.InvalidPDFException(ex.message); 4186 break; 4187 4188 case "MissingPDFException": 4189 reason = new _util.MissingPDFException(ex.message); 4190 break; 4191 4192 case "UnexpectedResponseException": 4193 reason = new _util.UnexpectedResponseException(ex.message, ex.status); 4194 break; 4195 4196 case "UnknownErrorException": 4197 reason = new _util.UnknownErrorException(ex.message, ex.details); 4198 break; 4199 } 4200 4201 loadingTask._capability.reject(reason); 4202 }); 4203 messageHandler.on("PasswordRequest", exception => { 4204 this._passwordCapability = (0, _util.createPromiseCapability)(); 4205 4206 if (loadingTask.onPassword) { 4207 const updatePassword = password => { 4208 this._passwordCapability.resolve({ 4209 password 4210 }); 4211 }; 4212 4213 try { 4214 loadingTask.onPassword(updatePassword, exception.code); 4215 } catch (ex) { 4216 this._passwordCapability.reject(ex); 4217 } 4218 } else { 4219 this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code)); 4220 } 4221 4222 return this._passwordCapability.promise; 4223 }); 4224 messageHandler.on("DataLoaded", data => { 4225 if (loadingTask.onProgress) { 4226 loadingTask.onProgress({ 4227 loaded: data.length, 4228 total: data.length 4229 }); 4230 } 4231 4232 this.downloadInfoCapability.resolve(data); 4233 }); 4234 messageHandler.on("StartRenderPage", data => { 4235 if (this.destroyed) { 4236 return; 4237 } 4238 4239 const page = this.pageCache[data.pageIndex]; 4240 4241 page._startRenderPage(data.transparency, data.intent); 4242 }); 4243 messageHandler.on("commonobj", data => { 4244 if (this.destroyed) { 4245 return; 4246 } 4247 4248 const [id, type, exportedData] = data; 4249 4250 if (this.commonObjs.has(id)) { 4251 return; 4252 } 4253 4254 switch (type) { 4255 case "Font": 4256 const params = this._params; 4257 4258 if ("error" in exportedData) { 4259 const exportedError = exportedData.error; 4260 (0, _util.warn)(`Error during font loading: ${exportedError}`); 4261 this.commonObjs.resolve(id, exportedError); 4262 break; 4263 } 4264 4265 let fontRegistry = null; 4266 4267 if (params.pdfBug && globalThis.FontInspector && globalThis.FontInspector.enabled) { 4268 fontRegistry = { 4269 registerFont(font, url) { 4270 globalThis.FontInspector.fontAdded(font, url); 4271 } 4272 4273 }; 4274 } 4275 4276 const font = new _font_loader.FontFaceObject(exportedData, { 4277 isEvalSupported: params.isEvalSupported, 4278 disableFontFace: params.disableFontFace, 4279 ignoreErrors: params.ignoreErrors, 4280 onUnsupportedFeature: this._onUnsupportedFeature.bind(this), 4281 fontRegistry 4282 });
4283 this.fontLoader.bind(font).catch(reason => { 4284 return messageHandler.sendWithPromise("FontFallback", { 4285 id 4286 }); 4287 }).finally(() => { 4288 if (!params.fontExtraProperties && font.data) { 4289 font.data = null; 4290 } 4291 4292 this.commonObjs.resolve(id, font); 4293 }); 4294 break; 4295 4296 case "FontPath": 4297 case "FontType3Res": 4298 case "Image": 4299 this.commonObjs.resolve(id, exportedData); 4300 break; 4301 4302 default: 4303 throw new Error(`Got unknown common object type ${type}`); 4304 } 4305 }); 4306 messageHandler.on("obj", data => { 4307 if (this.destroyed) { 4308 return undefined; 4309 } 4310 4311 const [id, pageIndex, type, imageData] = data; 4312 const pageProxy = this.pageCache[pageIndex]; 4313 4314 if (pageProxy.objs.has(id)) { 4315 return undefined; 4316 } 4317 4318 switch (type) { 4319 case "Image": 4320 pageProxy.objs.resolve(id, imageData); 4321 const MAX_IMAGE_SIZE_TO_STORE = 8000000; 4322 4323 if (imageData && "data" in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { 4324 pageProxy.cleanupAfterRender = true; 4325 } 4326 4327 break; 4328 4329 default: 4330 throw new Error(`Got unknown object type ${type}`); 4331 } 4332 4333 return undefined; 4334 }); 4335 messageHandler.on("DocProgress", data => { 4336 if (this.destroyed) { 4337 return; 4338 } 4339 4340 if (loadingTask.onProgress) { 4341 loadingTask.onProgress({ 4342 loaded: data.loaded, 4343 total: data.total 4344 }); 4345 } 4346 }); 4347 messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this)); 4348 messageHandler.on("FetchBuiltInCMap", (data, sink) => { 4349 if (this.destroyed) { 4350 sink.error(new Error("Worker was destroyed")); 4351 return; 4352 } 4353 4354 let fetched = false; 4355 4356 sink.onPull = () => { 4357 if (fetched) { 4358 sink.close(); 4359 return; 4360 } 4361 4362 fetched = true; 4363 this.CMapReaderFactory.fetch(data).then(function (builtInCMap) { 4364 sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]); 4365 }).catch(function (reason) { 4366 sink.error(reason); 4367 }); 4368 }; 4369 }); 4370 } 4371 4372 _onUnsupportedFeature({ 4373 featureId 4374 }) { 4375 if (this.destroyed) { 4376 return; 4377 } 4378 4379 if (this.loadingTask.onUnsupportedFeature) { 4380 this.loadingTask.onUnsupportedFeature(featureId); 4381 } 4382 } 4383 4384 getData() { 4385 return this.messageHandler.sendWithPromise("GetData", null); 4386 } 4387 4388 getPage(pageNumber) { 4389 if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) { 4390 return Promise.reject(new Error("Invalid page request")); 4391 } 4392 4393 const pageIndex = pageNumber - 1; 4394 4395 if (pageIndex in this.pagePromises) { 4396 return this.pagePromises[pageIndex]; 4397 } 4398 4399 const promise = this.messageHandler.sendWithPromise("GetPage", { 4400 pageIndex 4401 }).then(pageInfo => { 4402 if (this.destroyed) { 4403 throw new Error("Transport destroyed"); 4404 } 4405 4406 const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug); 4407 this.pageCache[pageIndex] = page; 4408 return page; 4409 }); 4410 this.pagePromises[pageIndex] = promise; 4411 return promise; 4412 } 4413 4414 getPageIndex(ref) { 4415 return this.messageHandler.sendWithPromise("GetPageIndex", { 4416 ref 4417 }).catch(function (reason) { 4418 return Promise.reject(new Error(reason)); 4419 }); 4420 } 4421 4422 getAnnotations(pageIndex, intent) { 4423 return this.messageHandler.sendWithPromise("GetAnnotations", { 4424 pageIndex, 4425 intent 4426 }); 4427 } 4428 4429 getDestinations() { 4430 return this.messageHandler.sendWithPromise("GetDestinations", null); 4431 } 4432 4433 getDestination(id) { 4434 if (typeof id !== "string") { 4435 return Promise.reject(new Error("Invalid destination request.")); 4436 } 4437 4438 return this.messageHandler.sendWithPromise("GetDestination", { 4439 id 4440 }); 4441 } 4442 4443 getPageLabels() { 4444 return this.messageHandler.sendWithPromise("GetPageLabels", null); 4445 } 4446 4447 getPageLayout() {
4448 return this.messageHandler.sendWithPromise("GetPageLayout", null); 4449 } 4450 4451 getPageMode() { 4452 return this.messageHandler.sendWithPromise("GetPageMode", null); 4453 } 4454 4455 getViewerPreferences() { 4456 return this.messageHandler.sendWithPromise("GetViewerPreferences", null); 4457 } 4458 4459 getOpenAction() { 4460 return this.messageHandler.sendWithPromise("GetOpenAction", null); 4461 } 4462 4463 getAttachments() { 4464 return this.messageHandler.sendWithPromise("GetAttachments", null); 4465 } 4466 4467 getJavaScript() { 4468 return this.messageHandler.sendWithPromise("GetJavaScript", null); 4469 } 4470 4471 getOutline() { 4472 return this.messageHandler.sendWithPromise("GetOutline", null); 4473 } 4474 4475 getPermissions() { 4476 return this.messageHandler.sendWithPromise("GetPermissions", null); 4477 } 4478 4479 getMetadata() { 4480 return this.messageHandler.sendWithPromise("GetMetadata", null).then(results => { 4481 return { 4482 info: results[0], 4483 metadata: results[1] ? new _metadata.Metadata(results[1]) : null, 4484 contentDispositionFilename: this._fullReader ? this._fullReader.filename : null 4485 }; 4486 }); 4487 } 4488 4489 getStats() { 4490 return this.messageHandler.sendWithPromise("GetStats", null); 4491 } 4492 4493 startCleanup() { 4494 return this.messageHandler.sendWithPromise("Cleanup", null).then(() => { 4495 for (let i = 0, ii = this.pageCache.length; i < ii; i++) { 4496 const page = this.pageCache[i]; 4497 4498 if (page) { 4499 const cleanupSuccessful = page.cleanup(); 4500 4501 if (!cleanupSuccessful) { 4502 throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`); 4503 } 4504 } 4505 } 4506 4507 this.commonObjs.clear(); 4508 this.fontLoader.clear(); 4509 }); 4510 } 4511 4512 get loadingParams() { 4513 const params = this._params; 4514 return (0, _util.shadow)(this, "loadingParams", { 4515 disableAutoFetch: params.disableAutoFetch, 4516 disableFontFace: params.disableFontFace 4517 }); 4518 } 4519 4520} 4521 4522class PDFObjects { 4523 constructor() { 4524 this._objs = Object.create(null); 4525 } 4526 4527 _ensureObj(objId) { 4528 if (this._objs[objId]) { 4529 return this._objs[objId]; 4530 } 4531 4532 return this._objs[objId] = { 4533 capability: (0, _util.createPromiseCapability)(), 4534 data: null, 4535 resolved: false 4536 }; 4537 } 4538 4539 get(objId, callback = null) { 4540 if (callback) { 4541 this._ensureObj(objId).capability.promise.then(callback); 4542 4543 return null; 4544 } 4545 4546 const obj = this._objs[objId]; 4547 4548 if (!obj || !obj.resolved) { 4549 throw new Error(`Requesting object that isn't resolved yet ${objId}.`); 4550 } 4551 4552 return obj.data; 4553 } 4554 4555 has(objId) { 4556 const obj = this._objs[objId]; 4557 return obj ? obj.resolved : false; 4558 } 4559 4560 resolve(objId, data) { 4561 const obj = this._ensureObj(objId); 4562 4563 obj.resolved = true; 4564 obj.data = data; 4565 obj.capability.resolve(data); 4566 } 4567 4568 clear() { 4569 this._objs = Object.create(null); 4570 } 4571 4572} 4573 4574class RenderTask { 4575 constructor(internalRenderTask) { 4576 this._internalRenderTask = internalRenderTask; 4577 this.onContinue = null; 4578 } 4579 4580 get promise() { 4581 return this._internalRenderTask.capability.promise; 4582 } 4583 4584 cancel() { 4585 this._internalRenderTask.cancel(); 4586 } 4587 4588} 4589 4590const InternalRenderTask = function InternalRenderTaskClosure() { 4591 const canvasInRendering = new WeakSet(); 4592 4593 class InternalRenderTask { 4594 constructor({ 4595 callback, 4596 params, 4597 objs, 4598 commonObjs, 4599 operatorList, 4600 pageIndex, 4601 canvasFactory, 4602 webGLContext, 4603 useRequestAnimationFrame = false, 4604 pdfBug = false 4605 }) { 4606 this.callback = callback; 4607 this.params = params; 4608 this.objs = objs; 4609 this.commonObjs = commonObjs; 4610 this.operatorListIdx = null; 4611 this.operatorList = operatorList; 4612 this._pageIndex = pageIndex; 4613 this.canvasFactory = canvasFactory; 4614 this.webGLContext = webGLContext; 4615 this._pdfBug = pdfBug; 4616 this.running = false; 4617 this.graphicsReadyCallback = null; 4618 this.graphicsReady = false; 4619 this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined"; 4620 this.cancelled = false; 4621 this.capability = (0, _util.createPromiseCapability)(); 4622 this.task = new RenderTask(this); 4623 this._continueBound = this._continue.bind(this); 4624 this._scheduleNextBound = this._scheduleNext.bind(this); 4625 this._nextBound = this._next.bind(this); 4626 this._canvas = params.canvasContext.canvas; 4627 } 4628
4629 initializeGraphics(transparency = false) { 4630 if (this.cancelled) { 4631 return; 4632 } 4633 4634 if (this._canvas) { 4635 if (canvasInRendering.has(this._canvas)) { 4636 throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed."); 4637 } 4638 4639 canvasInRendering.add(this._canvas); 4640 } 4641 4642 if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) { 4643 this.stepper = globalThis.StepperManager.create(this._pageIndex); 4644 this.stepper.init(this.operatorList); 4645 this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); 4646 } 4647 4648 const { 4649 canvasContext, 4650 viewport, 4651 transform, 4652 imageLayer, 4653 background 4654 } = this.params; 4655 this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, imageLayer); 4656 this.gfx.beginDrawing({ 4657 transform, 4658 viewport, 4659 transparency, 4660 background 4661 }); 4662 this.operatorListIdx = 0; 4663 this.graphicsReady = true; 4664 4665 if (this.graphicsReadyCallback) { 4666 this.graphicsReadyCallback(); 4667 } 4668 } 4669 4670 cancel(error = null) { 4671 this.running = false; 4672 this.cancelled = true; 4673 4674 if (this.gfx) { 4675 this.gfx.endDrawing(); 4676 } 4677 4678 if (this._canvas) { 4679 canvasInRendering.delete(this._canvas); 4680 } 4681 4682 this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, "canvas")); 4683 } 4684 4685 operatorListChanged() { 4686 if (!this.graphicsReady) { 4687 if (!this.graphicsReadyCallback) { 4688 this.graphicsReadyCallback = this._continueBound; 4689 } 4690 4691 return; 4692 } 4693 4694 if (this.stepper) { 4695 this.stepper.updateOperatorList(this.operatorList); 4696 } 4697 4698 if (this.running) { 4699 return; 4700 } 4701 4702 this._continue(); 4703 } 4704 4705 _continue() { 4706 this.running = true; 4707 4708 if (this.cancelled) { 4709 return; 4710 } 4711 4712 if (this.task.onContinue) { 4713 this.task.onContinue(this._scheduleNextBound); 4714 } else { 4715 this._scheduleNext(); 4716 } 4717 } 4718 4719 _scheduleNext() { 4720 if (this._useRequestAnimationFrame) { 4721 window.requestAnimationFrame(() => { 4722 this._nextBound().catch(this.cancel.bind(this)); 4723 }); 4724 } else { 4725 Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this)); 4726 } 4727 } 4728 4729 async _next() { 4730 if (this.cancelled) { 4731 return; 4732 } 4733 4734 this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper); 4735 4736 if (this.operatorListIdx === this.operatorList.argsArray.length) { 4737 this.running = false; 4738 4739 if (this.operatorList.lastChunk) { 4740 this.gfx.endDrawing(); 4741 4742 if (this._canvas) { 4743 canvasInRendering.delete(this._canvas); 4744 } 4745 4746 this.callback(); 4747 } 4748 } 4749 } 4750 4751 } 4752 4753 return InternalRenderTask; 4754}(); 4755 4756const version = '2.5.207'; 4757exports.version = version; 4758const build = '0974d6052'; 4759exports.build = build; 4760 4761/***/ }), 4762/* 6 */ 4763/***/ (function(module, exports, __w_pdfjs_require__) { 4764 4765"use strict"; 4766 4767 4768Object.defineProperty(exports, "__esModule", { 4769 value: true 4770}); 4771exports.FontLoader = exports.FontFaceObject = void 0; 4772 4773var _util = __w_pdfjs_require__(2); 4774 4775class BaseFontLoader { 4776 constructor({ 4777 docId, 4778 onUnsupportedFeature 4779 }) { 4780 if (this.constructor === BaseFontLoader) { 4781 (0, _util.unreachable)("Cannot initialize BaseFontLoader."); 4782 } 4783 4784 this.docId = docId; 4785 this._onUnsupportedFeature = onUnsupportedFeature; 4786 this.nativeFontFaces = []; 4787 this.styleElement = null; 4788 } 4789 4790 addNativeFontFace(nativeFontFace) { 4791 this.nativeFontFaces.push(nativeFontFace); 4792 document.fonts.add(nativeFontFace); 4793 } 4794 4795 insertRule(rule) { 4796 let styleElement = this.styleElement; 4797 4798 if (!styleElement) { 4799 styleElement = this.styleElement = document.createElement("style"); 4800 styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`; 4801 document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement); 4802 } 4803 4804 const styleSheet = styleElement.sheet; 4805 styleSheet.insertRule(rule, styleSheet.cssRules.length); 4806 } 4807 4808 clear() {
4809 this.nativeFontFaces.forEach(function (nativeFontFace) { 4810 document.fonts.delete(nativeFontFace); 4811 }); 4812 this.nativeFontFaces.length = 0; 4813 4814 if (this.styleElement) { 4815 this.styleElement.remove(); 4816 this.styleElement = null; 4817 } 4818 } 4819 4820 async bind(font) { 4821 if (font.attached || font.missingFile) { 4822 return; 4823 } 4824 4825 font.attached = true; 4826 4827 if (this.isFontLoadingAPISupported) { 4828 const nativeFontFace = font.createNativeFontFace(); 4829 4830 if (nativeFontFace) { 4831 this.addNativeFontFace(nativeFontFace); 4832 4833 try { 4834 await nativeFontFace.loaded; 4835 } catch (ex) { 4836 this._onUnsupportedFeature({ 4837 featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative 4838 }); 4839 4840 (0, _util.warn)(`Failed to load font '${nativeFontFace.family}': '${ex}'.`); 4841 font.disableFontFace = true; 4842 throw ex; 4843 } 4844 } 4845 4846 return; 4847 } 4848 4849 const rule = font.createFontFaceRule(); 4850 4851 if (rule) { 4852 this.insertRule(rule); 4853 4854 if (this.isSyncFontLoadingSupported) { 4855 return; 4856 } 4857 4858 await new Promise(resolve => { 4859 const request = this._queueLoadingCallback(resolve); 4860 4861 this._prepareFontLoadEvent([rule], [font], request); 4862 }); 4863 } 4864 } 4865 4866 _queueLoadingCallback(callback) { 4867 (0, _util.unreachable)("Abstract method `_queueLoadingCallback`."); 4868 } 4869 4870 get isFontLoadingAPISupported() { 4871 const supported = typeof document !== "undefined" && !!document.fonts; 4872 return (0, _util.shadow)(this, "isFontLoadingAPISupported", supported); 4873 } 4874 4875 get isSyncFontLoadingSupported() { 4876 (0, _util.unreachable)("Abstract method `isSyncFontLoadingSupported`."); 4877 } 4878 4879 get _loadTestFont() { 4880 (0, _util.unreachable)("Abstract method `_loadTestFont`."); 4881 } 4882 4883 _prepareFontLoadEvent(rules, fontsToLoad, request) { 4884 (0, _util.unreachable)("Abstract method `_prepareFontLoadEvent`."); 4885 } 4886 4887} 4888 4889let FontLoader; 4890exports.FontLoader = FontLoader; 4891{ 4892 exports.FontLoader = FontLoader = class GenericFontLoader extends BaseFontLoader { 4893 constructor(docId) { 4894 super(docId); 4895 this.loadingContext = { 4896 requests: [], 4897 nextRequestId: 0 4898 }; 4899 this.loadTestFontId = 0; 4900 } 4901 4902 get isSyncFontLoadingSupported() { 4903 let supported = false; 4904 4905 if (typeof navigator === "undefined") { 4906 supported = true; 4907 } else { 4908 const m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); 4909 4910 if (m && m[1] >= 14) { 4911 supported = true; 4912 } 4913 } 4914 4915 return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported); 4916 } 4917 4918 _queueLoadingCallback(callback) { 4919 function completeRequest() { 4920 (0, _util.assert)(!request.done, "completeRequest() cannot be called twice."); 4921 request.done = true; 4922 4923 while (context.requests.length > 0 && context.requests[0].done) { 4924 const otherRequest = context.requests.shift(); 4925 setTimeout(otherRequest.callback, 0); 4926 } 4927 } 4928 4929 const context = this.loadingContext; 4930 const request = { 4931 id: `pdfjs-font-loading-${context.nextRequestId++}`, 4932 done: false, 4933 complete: completeRequest, 4934 callback 4935 }; 4936 context.requests.push(request); 4937 return request; 4938 } 4939 4940 get _loadTestFont() { 4941 const getLoadTestFont = function () { 4942 return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + "ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA" + "AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1" + "AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD" + "6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM" + "AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D" + "IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA" + "AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA" + "AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB" + "AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY" + "AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA" + "AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA" + "AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC" + "AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="); 4943 }; 4944 4945 return (0, _util.shadow)(this, "_loadTestFont", getLoadTestFont()); 4946 } 4947 4948 _prepareFontLoadEvent(rules, fonts, request) { 4949 function int32(data, offset) { 4950 return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
4951 } 4952 4953 function spliceString(s, offset, remove, insert) { 4954 const chunk1 = s.substring(0, offset); 4955 const chunk2 = s.substring(offset + remove); 4956 return chunk1 + insert + chunk2; 4957 } 4958 4959 let i, ii; 4960 const canvas = document.createElement("canvas"); 4961 canvas.width = 1; 4962 canvas.height = 1; 4963 const ctx = canvas.getContext("2d"); 4964 let called = 0; 4965 4966 function isFontReady(name, callback) { 4967 called++; 4968 4969 if (called > 30) { 4970 (0, _util.warn)("Load test font never loaded."); 4971 callback(); 4972 return; 4973 } 4974 4975 ctx.font = "30px " + name; 4976 ctx.fillText(".", 0, 20); 4977 const imageData = ctx.getImageData(0, 0, 1, 1); 4978 4979 if (imageData.data[3] > 0) { 4980 callback(); 4981 return; 4982 } 4983 4984 setTimeout(isFontReady.bind(null, name, callback)); 4985 } 4986 4987 const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`; 4988 let data = this._loadTestFont; 4989 const COMMENT_OFFSET = 976; 4990 data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId); 4991 const CFF_CHECKSUM_OFFSET = 16; 4992 const XXXX_VALUE = 0x58585858; 4993 let checksum = int32(data, CFF_CHECKSUM_OFFSET); 4994 4995 for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) { 4996 checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0; 4997 } 4998 4999 if (i < loadTestFontId.length) { 5000 checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0; 5001 } 5002 5003 data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum)); 5004 const url = `url(data:font/opentype;base64,${btoa(data)});`; 5005 const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`; 5006 this.insertRule(rule); 5007 const names = []; 5008 5009 for (i = 0, ii = fonts.length; i < ii; i++) { 5010 names.push(fonts[i].loadedName); 5011 } 5012 5013 names.push(loadTestFontId); 5014 const div = document.createElement("div"); 5015 div.style.visibility = "hidden"; 5016 div.style.width = div.style.height = "10px"; 5017 div.style.position = "absolute"; 5018 div.style.top = div.style.left = "0px"; 5019 5020 for (i = 0, ii = names.length; i < ii; ++i) { 5021 const span = document.createElement("span"); 5022 span.textContent = "Hi"; 5023 span.style.fontFamily = names[i]; 5024 div.appendChild(span); 5025 } 5026 5027 document.body.appendChild(div); 5028 isFontReady(loadTestFontId, function () { 5029 document.body.removeChild(div); 5030 request.complete(); 5031 }); 5032 } 5033 5034 }; 5035} 5036 5037class FontFaceObject { 5038 constructor(translatedData, { 5039 isEvalSupported = true, 5040 disableFontFace = false, 5041 ignoreErrors = false, 5042 onUnsupportedFeature = null, 5043 fontRegistry = null 5044 }) { 5045 this.compiledGlyphs = Object.create(null); 5046 5047 for (const i in translatedData) { 5048 this[i] = translatedData[i]; 5049 } 5050 5051 this.isEvalSupported = isEvalSupported !== false; 5052 this.disableFontFace = disableFontFace === true; 5053 this.ignoreErrors = ignoreErrors === true; 5054 this._onUnsupportedFeature = onUnsupportedFeature; 5055 this.fontRegistry = fontRegistry; 5056 } 5057 5058 createNativeFontFace() { 5059 if (!this.data || this.disableFontFace) { 5060 return null; 5061 } 5062 5063 const nativeFontFace = new FontFace(this.loadedName, this.data, {}); 5064 5065 if (this.fontRegistry) { 5066 this.fontRegistry.registerFont(this); 5067 } 5068 5069 return nativeFontFace; 5070 } 5071 5072 createFontFaceRule() { 5073 if (!this.data || this.disableFontFace) { 5074 return null; 5075 } 5076 5077 const data = (0, _util.bytesToString)(new Uint8Array(this.data)); 5078 const url = `url(data:${this.mimetype};base64,${btoa(data)});`; 5079 const rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`; 5080 5081 if (this.fontRegistry) { 5082 this.fontRegistry.registerFont(this, url); 5083 } 5084 5085 return rule; 5086 } 5087 5088 getPathGenerator(objs, character) { 5089 if (this.compiledGlyphs[character] !== undefined) { 5090 return this.compiledGlyphs[character]; 5091 } 5092 5093 let cmds, current; 5094 5095 try { 5096 cmds = objs.get(this.loadedName + "_path_" + character); 5097 } catch (ex) { 5098 if (!this.ignoreErrors) { 5099 throw ex; 5100 } 5101 5102 if (this._onUnsupportedFeature) { 5103 this._onUnsupportedFeature({ 5104 featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath 5105 }); 5106 } 5107 5108 (0, _util.warn)(`getPathGenerator - ignoring character: "${ex}".`); 5109 return this.compiledGlyphs[character] = function (c, size) {}; 5110 } 5111 5112 if (this.isEvalSupported && _util.IsEvalSupportedCached.value) { 5113 let args, 5114 js = ""; 5115 5116 for (let i = 0, ii = cmds.length; i < ii; i++) { 5117 current = cmds[i]; 5118 5119 if (current.args !== undefined) { 5120 args = current.args.join(","); 5121 } else { 5122 args = ""; 5123 } 5124 5125 js += "c." + current.cmd + "(" + args + ");\n"; 5126 } 5127 5128 return this.compiledGlyphs[character] = new Function("c", "size", js); 5129 } 5130 5131 return this.compiledGlyphs[character] = function (c, size) { 5132 for (let i = 0, ii = cmds.length; i < ii; i++) { 5133 current = cmds[i]; 5134 5135 if (current.cmd === "scale") { 5136 current.args = [size, -size]; 5137 } 5138 5139 c[current.cmd].apply(c, current.args); 5140 } 5141 }; 5142 } 5143 5144} 5145 5146exports.FontFaceObject = FontFaceObject; 5147 5148/***/ }), 5149/* 7 */ 5150/***/ (function(module, exports, __w_pdfjs_require__) { 5151 5152"use strict"; 5153 5154 5155Object.defineProperty(exports, "__esModule", { 5156 value: true 5157}); 5158exports.apiCompatibilityParams = void 0; 5159 5160var _is_node = __w_pdfjs_require__(4); 5161 5162const compatibilityParams = Object.create(null); 5163{ 5164 (function checkFontFace() { 5165 if (_is_node.isNodeJS) { 5166 compatibilityParams.disableFontFace = true; 5167 } 5168 })(); 5169} 5170const apiCompatibilityParams = Object.freeze(compatibilityParams); 5171exports.apiCompatibilityParams = apiCompatibilityParams; 5172 5173/***/ }), 5174/* 8 */ 5175/***/ (function(module, exports, __w_pdfjs_require__) { 5176 5177"use strict"; 5178 5179 5180Object.defineProperty(exports, "__esModule", { 5181 value: true 5182}); 5183exports.CanvasGraphics = void 0; 5184 5185var _util = __w_pdfjs_require__(2); 5186 5187var _pattern_helper = __w_pdfjs_require__(9); 5188 5189var MIN_FONT_SIZE = 16; 5190var MAX_FONT_SIZE = 100; 5191var MAX_GROUP_SIZE = 4096; 5192var MIN_WIDTH_FACTOR = 0.65; 5193var COMPILE_TYPE3_GLYPHS = true; 5194var MAX_SIZE_TO_COMPILE = 1000; 5195var FULL_CHUNK_HEIGHT = 16; 5196 5197function addContextCurrentTransform(ctx) { 5198 if (!ctx.mozCurrentTransform) { 5199 ctx._originalSave = ctx.save; 5200 ctx._originalRestore = ctx.restore; 5201 ctx._originalRotate = ctx.rotate; 5202 ctx._originalScale = ctx.scale; 5203 ctx._originalTranslate = ctx.translate; 5204 ctx._originalTransform = ctx.transform; 5205 ctx._originalSetTransform = ctx.setTransform; 5206 ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; 5207 ctx._transformStack = [];
5208 Object.defineProperty(ctx, "mozCurrentTransform", { 5209 get: function getCurrentTransform() { 5210 return this._transformMatrix; 5211 } 5212 }); 5213 Object.defineProperty(ctx, "mozCurrentTransformInverse", { 5214 get: function getCurrentTransformInverse() { 5215 var m = this._transformMatrix; 5216 var a = m[0], 5217 b = m[1], 5218 c = m[2], 5219 d = m[3], 5220 e = m[4], 5221 f = m[5]; 5222 var ad_bc = a * d - b * c; 5223 var bc_ad = b * c - a * d; 5224 return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; 5225 } 5226 }); 5227 5228 ctx.save = function ctxSave() { 5229 var old = this._transformMatrix; 5230 5231 this._transformStack.push(old); 5232 5233 this._transformMatrix = old.slice(0, 6); 5234 5235 this._originalSave(); 5236 }; 5237 5238 ctx.restore = function ctxRestore() { 5239 var prev = this._transformStack.pop(); 5240 5241 if (prev) { 5242 this._transformMatrix = prev; 5243 5244 this._originalRestore(); 5245 } 5246 }; 5247 5248 ctx.translate = function ctxTranslate(x, y) { 5249 var m = this._transformMatrix; 5250 m[4] = m[0] * x + m[2] * y + m[4]; 5251 m[5] = m[1] * x + m[3] * y + m[5]; 5252 5253 this._originalTranslate(x, y); 5254 }; 5255 5256 ctx.scale = function ctxScale(x, y) { 5257 var m = this._transformMatrix; 5258 m[0] = m[0] * x; 5259 m[1] = m[1] * x; 5260 m[2] = m[2] * y; 5261 m[3] = m[3] * y; 5262 5263 this._originalScale(x, y); 5264 }; 5265 5266 ctx.transform = function ctxTransform(a, b, c, d, e, f) { 5267 var m = this._transformMatrix; 5268 this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; 5269 5270 ctx._originalTransform(a, b, c, d, e, f); 5271 }; 5272 5273 ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { 5274 this._transformMatrix = [a, b, c, d, e, f]; 5275 5276 ctx._originalSetTransform(a, b, c, d, e, f); 5277 }; 5278 5279 ctx.rotate = function ctxRotate(angle) { 5280 var cosValue = Math.cos(angle); 5281 var sinValue = Math.sin(angle); 5282 var m = this._transformMatrix; 5283 this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; 5284 5285 this._originalRotate(angle); 5286 }; 5287 } 5288} 5289 5290var CachedCanvases = function CachedCanvasesClosure() { 5291 function CachedCanvases(canvasFactory) { 5292 this.canvasFactory = canvasFactory; 5293 this.cache = Object.create(null); 5294 } 5295 5296 CachedCanvases.prototype = { 5297 getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) { 5298 var canvasEntry; 5299 5300 if (this.cache[id] !== undefined) { 5301 canvasEntry = this.cache[id]; 5302 this.canvasFactory.reset(canvasEntry, width, height); 5303 canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); 5304 } else { 5305 canvasEntry = this.canvasFactory.create(width, height); 5306 this.cache[id] = canvasEntry; 5307 } 5308 5309 if (trackTransform) { 5310 addContextCurrentTransform(canvasEntry.context); 5311 } 5312 5313 return canvasEntry; 5314 }, 5315 5316 clear() { 5317 for (var id in this.cache) { 5318 var canvasEntry = this.cache[id]; 5319 this.canvasFactory.destroy(canvasEntry); 5320 delete this.cache[id]; 5321 } 5322 } 5323 5324 }; 5325 return CachedCanvases; 5326}(); 5327 5328function compileType3Glyph(imgData) { 5329 var POINT_TO_PROCESS_LIMIT = 1000; 5330 var width = imgData.width, 5331 height = imgData.height; 5332 var i, 5333 j, 5334 j0, 5335 width1 = width + 1; 5336 var points = new Uint8Array(width1 * (height + 1)); 5337 var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); 5338 var lineSize = width + 7 & ~7, 5339 data0 = imgData.data; 5340 var data = new Uint8Array(lineSize * height), 5341 pos = 0, 5342 ii; 5343 5344 for (i = 0, ii = data0.length; i < ii; i++) { 5345 var mask = 128, 5346 elem = data0[i]; 5347 5348 while (mask > 0) { 5349 data[pos++] = elem & mask ? 0 : 255; 5350 mask >>= 1; 5351 } 5352 } 5353 5354 var count = 0; 5355 pos = 0; 5356 5357 if (data[pos] !== 0) { 5358 points[0] = 1; 5359 ++count; 5360 } 5361 5362 for (j = 1; j < width; j++) { 5363 if (data[pos] !== data[pos + 1]) { 5364 points[j] = data[pos] ? 2 : 1; 5365 ++count; 5366 } 5367 5368 pos++; 5369 } 5370 5371 if (data[pos] !== 0) { 5372 points[j] = 2; 5373 ++count; 5374 } 5375 5376 for (i = 1; i < height; i++) { 5377 pos = i * lineSize; 5378 j0 = i * width1; 5379 5380 if (data[pos - lineSize] !== data[pos]) { 5381 points[j0] = data[pos] ? 1 : 8; 5382 ++count; 5383 } 5384 5385 var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); 5386 5387 for (j = 1; j < width; j++) { 5388 sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); 5389 5390 if (POINT_TYPES[sum]) { 5391 points[j0 + j] = POINT_TYPES[sum]; 5392 ++count; 5393 } 5394 5395 pos++; 5396 } 5397 5398 if (data[pos - lineSize] !== data[pos]) { 5399 points[j0 + j] = data[pos] ? 2 : 4; 5400 ++count; 5401 } 5402 5403 if (count > POINT_TO_PROCESS_LIMIT) { 5404 return null; 5405 } 5406 } 5407 5408 pos = lineSize * (height - 1); 5409 j0 = i * width1; 5410 5411 if (data[pos] !== 0) { 5412 points[j0] = 8; 5413 ++count; 5414 } 5415 5416 for (j = 1; j < width; j++) { 5417 if (data[pos] !== data[pos + 1]) { 5418 points[j0 + j] = data[pos] ? 4 : 8; 5419 ++count; 5420 } 5421 5422 pos++; 5423 } 5424 5425 if (data[pos] !== 0) { 5426 points[j0 + j] = 4; 5427 ++count; 5428 } 5429 5430 if (count > POINT_TO_PROCESS_LIMIT) { 5431 return null; 5432 } 5433 5434 var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); 5435 var outlines = []; 5436 5437 for (i = 0; count && i <= height; i++) { 5438 var p = i * width1; 5439 var end = p + width; 5440 5441 while (p < end && !points[p]) { 5442 p++; 5443 } 5444 5445 if (p === end) { 5446 continue; 5447 } 5448 5449 var coords = [p % width1, i]; 5450 var type = points[p], 5451 p0 = p, 5452 pp; 5453 5454 do { 5455 var step = steps[type]; 5456 5457 do { 5458 p += step; 5459 } while (!points[p]); 5460 5461 pp = points[p]; 5462 5463 if (pp !== 5 && pp !== 10) { 5464 type = pp; 5465 points[p] = 0; 5466 } else { 5467 type = pp & 0x33 * type >> 4; 5468 points[p] &= type >> 2 | type << 2; 5469 } 5470 5471 coords.push(p % width1); 5472 coords.push(p / width1 | 0); 5473 5474 if (!points[p]) { 5475 --count; 5476 } 5477 } while (p0 !== p); 5478 5479 outlines.push(coords); 5480 --i; 5481 } 5482 5483 var drawOutline = function (c) { 5484 c.save(); 5485 c.scale(1 / width, -1 / height); 5486 c.translate(0, -height); 5487 c.beginPath(); 5488 5489 for (let k = 0, kk = outlines.length; k < kk; k++) { 5490 var o = outlines[k]; 5491 c.moveTo(o[0], o[1]); 5492 5493 for (let l = 2, ll = o.length; l < ll;
5493 l += 2) { 5494 c.lineTo(o[l], o[l + 1]); 5495 } 5496 } 5497 5498 c.fill(); 5499 c.beginPath(); 5500 c.restore(); 5501 }; 5502 5503 return drawOutline; 5504} 5505 5506var CanvasExtraState = function CanvasExtraStateClosure() { 5507 function CanvasExtraState() { 5508 this.alphaIsShape = false; 5509 this.fontSize = 0; 5510 this.fontSizeScale = 1; 5511 this.textMatrix = _util.IDENTITY_MATRIX; 5512 this.textMatrixScale = 1; 5513 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 5514 this.leading = 0; 5515 this.x = 0; 5516 this.y = 0; 5517 this.lineX = 0; 5518 this.lineY = 0; 5519 this.charSpacing = 0; 5520 this.wordSpacing = 0; 5521 this.textHScale = 1; 5522 this.textRenderingMode = _util.TextRenderingMode.FILL; 5523 this.textRise = 0; 5524 this.fillColor = "#000000"; 5525 this.strokeColor = "#000000"; 5526 this.patternFill = false; 5527 this.fillAlpha = 1; 5528 this.strokeAlpha = 1; 5529 this.lineWidth = 1; 5530 this.activeSMask = null; 5531 this.resumeSMaskCtx = null; 5532 } 5533 5534 CanvasExtraState.prototype = { 5535 clone: function CanvasExtraState_clone() { 5536 return Object.create(this); 5537 }, 5538 setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { 5539 this.x = x; 5540 this.y = y; 5541 } 5542 }; 5543 return CanvasExtraState; 5544}(); 5545 5546var CanvasGraphics = function CanvasGraphicsClosure() { 5547 var EXECUTION_TIME = 15; 5548 var EXECUTION_STEPS = 10; 5549 5550 function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) { 5551 this.ctx = canvasCtx; 5552 this.current = new CanvasExtraState(); 5553 this.stateStack = []; 5554 this.pendingClip = null; 5555 this.pendingEOFill = false; 5556 this.res = null; 5557 this.xobjs = null; 5558 this.commonObjs = commonObjs; 5559 this.objs = objs; 5560 this.canvasFactory = canvasFactory; 5561 this.webGLContext = webGLContext; 5562 this.imageLayer = imageLayer; 5563 this.groupStack = []; 5564 this.processingType3 = null; 5565 this.baseTransform = null; 5566 this.baseTransformStack = []; 5567 this.groupLevel = 0; 5568 this.smaskStack = []; 5569 this.smaskCounter = 0; 5570 this.tempSMask = null; 5571 this.cachedCanvases = new CachedCanvases(this.canvasFactory); 5572 5573 if (canvasCtx) { 5574 addContextCurrentTransform(canvasCtx); 5575 } 5576 5577 this._cachedGetSinglePixelWidth = null; 5578 } 5579 5580 function putBinaryImageData(ctx, imgData) { 5581 if (typeof ImageData !== "undefined" && imgData instanceof ImageData) { 5582 ctx.putImageData(imgData, 0, 0); 5583 return; 5584 } 5585 5586 var height = imgData.height, 5587 width = imgData.width; 5588 var partialChunkHeight = height % FULL_CHUNK_HEIGHT; 5589 var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; 5590 var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; 5591 var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); 5592 var srcPos = 0, 5593 destPos; 5594 var src = imgData.data; 5595 var dest = chunkImgData.data; 5596 var i, j, thisChunkHeight, elemsInThisChunk; 5597 5598 if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) { 5599 var srcLength = src.byteLength; 5600 var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); 5601 var dest32DataLength = dest32.length; 5602 var fullSrcDiff = width + 7 >> 3; 5603 var white = 0xffffffff; 5604 var black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff; 5605 5606 for (i = 0; i < totalChunks; i++) { 5607 thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; 5608 destPos = 0; 5609 5610 for (j = 0; j < thisChunkHeight; j++) { 5611 var srcDiff = srcLength - srcPos; 5612 var k = 0; 5613 var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; 5614 var kEndUnrolled = kEnd & ~7; 5615 var mask = 0; 5616 var srcByte = 0; 5617 5618 for (; k < kEndUnrolled; k += 8) { 5619 srcByte = src[srcPos++]; 5620 dest32[destPos++] = srcByte & 128 ? white : black; 5621 dest32[destPos++] = srcByte & 64 ? white : black; 5622 dest32[destPos++] = srcByte & 32 ? white : black; 5623 dest32[destPos++] = srcByte & 16 ? white : black; 5624 dest32[destPos++] = srcByte & 8 ? white : black; 5625 dest32[destPos++] = srcByte & 4 ? white : black; 5626 dest32[destPos++] = srcByte & 2 ? white : black; 5627 dest32[destPos++] = srcByte & 1 ? white : black; 5628 } 5629 5630 for (; k < kEnd; k++) { 5631 if (mask === 0) { 5632 srcByte = src[srcPos++]; 5633 mask = 128; 5634 } 5635 5636 dest32[destPos++] = srcByte & mask ? white : black; 5637 mask >>= 1; 5638 } 5639 } 5640 5641 while (destPos < dest32DataLength) { 5642 dest32[destPos++] = 0; 5643 } 5644 5645 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 5646 } 5647 } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) { 5648 j = 0; 5649 elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; 5650 5651 for (i = 0; i < fullChunks; i++) { 5652 dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); 5653 srcPos += elemsInThisChunk; 5654 ctx.putImageData(chunkImgData, 0, j); 5655 j += FULL_CHUNK_HEIGHT; 5656 } 5657 5658 if (i < totalChunks) { 5659 elemsInThisChunk = width * partialChunkHeight * 4; 5660 dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); 5661 ctx.putImageData(chunkImgData, 0, j); 5662 } 5663 } else if (imgData.kind === _util.ImageKind.RGB_24BPP) { 5664 thisChunkHeight = FULL_CHUNK_HEIGHT; 5665 elemsInThisChunk = width * thisChunkHeight; 5666 5667 for (i = 0; i < totalChunks; i++) { 5668 if (i >= fullChunks) { 5669 thisChunkHeight = partialChunkHeight; 5670 elemsInThisChunk = width * thisChunkHeight; 5671 } 5672 5673 destPos = 0; 5674
5675 for (j = elemsInThisChunk; j--;) { 5676 dest[destPos++] = src[srcPos++]; 5677 dest[destPos++] = src[srcPos++]; 5678 dest[destPos++] = src[srcPos++]; 5679 dest[destPos++] = 255; 5680 } 5681 5682 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 5683 } 5684 } else { 5685 throw new Error(`bad image kind: ${imgData.kind}`); 5686 } 5687 } 5688 5689 function putBinaryImageMask(ctx, imgData) { 5690 var height = imgData.height, 5691 width = imgData.width; 5692 var partialChunkHeight = height % FULL_CHUNK_HEIGHT; 5693 var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; 5694 var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; 5695 var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); 5696 var srcPos = 0; 5697 var src = imgData.data; 5698 var dest = chunkImgData.data; 5699 5700 for (var i = 0; i < totalChunks; i++) { 5701 var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; 5702 var destPos = 3; 5703 5704 for (var j = 0; j < thisChunkHeight; j++) { 5705 var mask = 0; 5706 5707 for (var k = 0; k < width; k++) { 5708 if (!mask) { 5709 var elem = src[srcPos++]; 5710 mask = 128; 5711 } 5712 5713 dest[destPos] = elem & mask ? 0 : 255; 5714 destPos += 4; 5715 mask >>= 1; 5716 } 5717 } 5718 5719 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 5720 } 5721 } 5722 5723 function copyCtxState(sourceCtx, destCtx) { 5724 var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"]; 5725 5726 for (var i = 0, ii = properties.length; i < ii; i++) { 5727 var property = properties[i]; 5728 5729 if (sourceCtx[property] !== undefined) { 5730 destCtx[property] = sourceCtx[property]; 5731 } 5732 } 5733 5734 if (sourceCtx.setLineDash !== undefined) { 5735 destCtx.setLineDash(sourceCtx.getLineDash()); 5736 destCtx.lineDashOffset = sourceCtx.lineDashOffset; 5737 } 5738 } 5739 5740 function resetCtxToDefault(ctx) { 5741 ctx.strokeStyle = "#000000"; 5742 ctx.fillStyle = "#000000"; 5743 ctx.fillRule = "nonzero"; 5744 ctx.globalAlpha = 1; 5745 ctx.lineWidth = 1; 5746 ctx.lineCap = "butt"; 5747 ctx.lineJoin = "miter"; 5748 ctx.miterLimit = 10; 5749 ctx.globalCompositeOperation = "source-over"; 5750 ctx.font = "10px sans-serif"; 5751 5752 if (ctx.setLineDash !== undefined) { 5753 ctx.setLineDash([]); 5754 ctx.lineDashOffset = 0; 5755 } 5756 } 5757 5758 function composeSMaskBackdrop(bytes, r0, g0, b0) { 5759 var length = bytes.length; 5760 5761 for (var i = 3; i < length; i += 4) { 5762 var alpha = bytes[i]; 5763 5764 if (alpha === 0) { 5765 bytes[i - 3] = r0; 5766 bytes[i - 2] = g0; 5767 bytes[i - 1] = b0; 5768 } else if (alpha < 255) { 5769 var alpha_ = 255 - alpha; 5770 bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8; 5771 bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8; 5772 bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8; 5773 } 5774 } 5775 } 5776 5777 function composeSMaskAlpha(maskData, layerData, transferMap) { 5778 var length = maskData.length; 5779 var scale = 1 / 255; 5780 5781 for (var i = 3; i < length; i += 4) { 5782 var alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; 5783 layerData[i] = layerData[i] * alpha * scale | 0; 5784 } 5785 } 5786 5787 function composeSMaskLuminosity(maskData, layerData, transferMap) { 5788 var length = maskData.length; 5789 5790 for (var i = 3; i < length; i += 4) { 5791 var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; 5792 layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16; 5793 } 5794 } 5795 5796 function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) { 5797 var hasBackdrop = !!backdrop; 5798 var r0 = hasBackdrop ? backdrop[0] : 0; 5799 var g0 = hasBackdrop ? backdrop[1] : 0; 5800 var b0 = hasBackdrop ? backdrop[2] : 0; 5801 var composeFn; 5802 5803 if (subtype === "Luminosity") { 5804 composeFn = composeSMaskLuminosity; 5805 } else { 5806 composeFn = composeSMaskAlpha; 5807 } 5808 5809 var PIXELS_TO_PROCESS = 1048576; 5810 var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); 5811 5812 for (var row = 0; row < height; row += chunkSize) { 5813 var chunkHeight = Math.min(chunkSize, height - row); 5814 var maskData = maskCtx.getImageData(0, row, width, chunkHeight); 5815 var layerData = layerCtx.getImageData(0, row, width, chunkHeight); 5816 5817 if (hasBackdrop) { 5818 composeSMaskBackdrop(maskData.data, r0, g0, b0); 5819 } 5820 5821 composeFn(maskData.data, layerData.data, transferMap); 5822 maskCtx.putImageData(layerData, 0, row); 5823 } 5824 } 5825 5826 function composeSMask(ctx, smask, layerCtx, webGLContext) { 5827 var mask = smask.canvas; 5828 var maskCtx = smask.context; 5829 ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY); 5830 var backdrop = smask.backdrop || null; 5831 5832 if (!smask.transferMap && webGLContext.isEnabled) { 5833 const composed = webGLContext.composeSMask({ 5834 layer: layerCtx.canvas, 5835 mask, 5836 properties: { 5837 subtype: smask.subtype, 5838 backdrop 5839 } 5840 }); 5841 ctx.setTransform(1, 0, 0, 1, 0, 0); 5842 ctx.drawImage(composed, smask.offsetX, smask.offsetY); 5843 return; 5844 } 5845 5846 genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap); 5847 ctx.drawImage(mask, 0, 0); 5848 } 5849
5850 var LINE_CAP_STYLES = ["butt", "round", "square"]; 5851 var LINE_JOIN_STYLES = ["miter", "round", "bevel"]; 5852 var NORMAL_CLIP = {}; 5853 var EO_CLIP = {}; 5854 CanvasGraphics.prototype = { 5855 beginDrawing({ 5856 transform, 5857 viewport, 5858 transparency = false, 5859 background = null 5860 }) { 5861 var width = this.ctx.canvas.width; 5862 var height = this.ctx.canvas.height; 5863 this.ctx.save(); 5864 this.ctx.fillStyle = background || "rgb(255, 255, 255)"; 5865 this.ctx.fillRect(0, 0, width, height); 5866 this.ctx.restore(); 5867 5868 if (transparency) { 5869 var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true); 5870 this.compositeCtx = this.ctx; 5871 this.transparentCanvas = transparentCanvas.canvas; 5872 this.ctx = transparentCanvas.context; 5873 this.ctx.save(); 5874 this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform); 5875 } 5876 5877 this.ctx.save(); 5878 resetCtxToDefault(this.ctx); 5879 5880 if (transform) { 5881 this.ctx.transform.apply(this.ctx, transform); 5882 } 5883 5884 this.ctx.transform.apply(this.ctx, viewport.transform); 5885 this.baseTransform = this.ctx.mozCurrentTransform.slice(); 5886 5887 if (this.imageLayer) { 5888 this.imageLayer.beginLayout(); 5889 } 5890 }, 5891 5892 executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { 5893 var argsArray = operatorList.argsArray; 5894 var fnArray = operatorList.fnArray; 5895 var i = executionStartIdx || 0; 5896 var argsArrayLen = argsArray.length; 5897 5898 if (argsArrayLen === i) { 5899 return i; 5900 } 5901 5902 var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function"; 5903 var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; 5904 var steps = 0; 5905 var commonObjs = this.commonObjs; 5906 var objs = this.objs; 5907 var fnId; 5908 5909 while (true) { 5910 if (stepper !== undefined && i === stepper.nextBreakPoint) { 5911 stepper.breakIt(i, continueCallback); 5912 return i; 5913 } 5914 5915 fnId = fnArray[i]; 5916 5917 if (fnId !== _util.OPS.dependency) { 5918 this[fnId].apply(this, argsArray[i]); 5919 } else { 5920 for (const depObjId of argsArray[i]) { 5921 const objsPool = depObjId.startsWith("g_") ? commonObjs : objs; 5922 5923 if (!objsPool.has(depObjId)) { 5924 objsPool.get(depObjId, continueCallback); 5925 return i; 5926 } 5927 } 5928 } 5929 5930 i++; 5931 5932 if (i === argsArrayLen) { 5933 return i; 5934 } 5935 5936 if (chunkOperations && ++steps > EXECUTION_STEPS) { 5937 if (Date.now() > endTime) { 5938 continueCallback(); 5939 return i; 5940 } 5941 5942 steps = 0; 5943 } 5944 } 5945 }, 5946 endDrawing: function CanvasGraphics_endDrawing() { 5947 if (this.current.activeSMask !== null) { 5948 this.endSMaskGroup(); 5949 } 5950 5951 this.ctx.restore(); 5952 5953 if (this.transparentCanvas) { 5954 this.ctx = this.compositeCtx; 5955 this.ctx.save(); 5956 this.ctx.setTransform(1, 0, 0, 1, 0, 0); 5957 this.ctx.drawImage(this.transparentCanvas, 0, 0); 5958 this.ctx.restore(); 5959 this.transparentCanvas = null; 5960 } 5961 5962 this.cachedCanvases.clear(); 5963 this.webGLContext.clear(); 5964 5965 if (this.imageLayer) { 5966 this.imageLayer.endLayout(); 5967 } 5968 }, 5969 setLineWidth: function CanvasGraphics_setLineWidth(width) { 5970 this.current.lineWidth = width; 5971 this.ctx.lineWidth = width; 5972 }, 5973 setLineCap: function CanvasGraphics_setLineCap(style) { 5974 this.ctx.lineCap = LINE_CAP_STYLES[style]; 5975 }, 5976 setLineJoin: function CanvasGraphics_setLineJoin(style) { 5977 this.ctx.lineJoin = LINE_JOIN_STYLES[style]; 5978 }, 5979 setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { 5980 this.ctx.miterLimit = limit; 5981 }, 5982 setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { 5983 var ctx = this.ctx; 5984 5985 if (ctx.setLineDash !== undefined) { 5986 ctx.setLineDash(dashArray); 5987 ctx.lineDashOffset = dashPhase; 5988 } 5989 }, 5990
vendor: 4,106 bytes, lines 5991-6116
5991 setRenderingIntent(intent) {}, 5992 5993 setFlatness(flatness) {}, 5994 5995 setGState: function CanvasGraphics_setGState(states) { 5996 for (var i = 0, ii = states.length; i < ii; i++) { 5997 var state = states[i]; 5998 var key = state[0]; 5999 var value = state[1]; 6000 6001 switch (key) { 6002 case "LW": 6003 this.setLineWidth(value); 6004 break; 6005 6006 case "LC": 6007 this.setLineCap(value); 6008 break; 6009 6010 case "LJ": 6011 this.setLineJoin(value); 6012 break; 6013 6014 case "ML": 6015 this.setMiterLimit(value); 6016 break; 6017 6018 case "D": 6019 this.setDash(value[0], value[1]); 6020 break; 6021 6022 case "RI": 6023 this.setRenderingIntent(value); 6024 break; 6025 6026 case "FL": 6027 this.setFlatness(value); 6028 break; 6029 6030 case "Font": 6031 this.setFont(value[0], value[1]); 6032 break; 6033 6034 case "CA": 6035 this.current.strokeAlpha = state[1]; 6036 break; 6037 6038 case "ca": 6039 this.current.fillAlpha = state[1]; 6040 this.ctx.globalAlpha = state[1]; 6041 break; 6042 6043 case "BM": 6044 this.ctx.globalCompositeOperation = value; 6045 break; 6046 6047 case "SMask": 6048 if (this.current.activeSMask) { 6049 if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) { 6050 this.suspendSMaskGroup(); 6051 } else { 6052 this.endSMaskGroup(); 6053 } 6054 } 6055 6056 this.current.activeSMask = value ? this.tempSMask : null; 6057 6058 if (this.current.activeSMask) { 6059 this.beginSMaskGroup(); 6060 } 6061 6062 this.tempSMask = null; 6063 break; 6064 } 6065 } 6066 }, 6067 beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { 6068 var activeSMask = this.current.activeSMask; 6069 var drawnWidth = activeSMask.canvas.width; 6070 var drawnHeight = activeSMask.canvas.height; 6071 var cacheId = "smaskGroupAt" + this.groupLevel; 6072 var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); 6073 var currentCtx = this.ctx; 6074 var currentTransform = currentCtx.mozCurrentTransform; 6075 this.ctx.save(); 6076 var groupCtx = scratchCanvas.context; 6077 groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); 6078 groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); 6079 groupCtx.transform.apply(groupCtx, currentTransform); 6080 activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse; 6081 copyCtxState(currentCtx, groupCtx); 6082 this.ctx = groupCtx; 6083 this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); 6084 this.groupStack.push(currentCtx); 6085 this.groupLevel++; 6086 }, 6087 suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() { 6088 var groupCtx = this.ctx; 6089 this.groupLevel--; 6090 this.ctx = this.groupStack.pop(); 6091 composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); 6092 this.ctx.restore(); 6093 this.ctx.save(); 6094 copyCtxState(groupCtx, this.ctx); 6095 this.current.resumeSMaskCtx = groupCtx; 6096 6097 var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); 6098 6099 this.ctx.transform.apply(this.ctx, deltaTransform); 6100 groupCtx.save(); 6101 groupCtx.setTransform(1, 0, 0, 1, 0, 0); 6102 groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); 6103 groupCtx.restore(); 6104 }, 6105 resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { 6106 var groupCtx = this.current.resumeSMaskCtx; 6107 var currentCtx = this.ctx; 6108 this.ctx = groupCtx; 6109 this.groupStack.push(currentCtx); 6110 this.groupLevel++; 6111 }, 6112 endSMaskGroup: function CanvasGraphics_endSMaskGroup() { 6113 var groupCtx = this.ctx; 6114 this.groupLevel--; 6115 this.ctx = this.groupStack.pop(); 6116 composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
6117 this.ctx.restore(); 6118 copyCtxState(groupCtx, this.ctx); 6119 6120 var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); 6121 6122 this.ctx.transform.apply(this.ctx, deltaTransform); 6123 }, 6124 save: function CanvasGraphics_save() { 6125 this.ctx.save(); 6126 var old = this.current; 6127 this.stateStack.push(old); 6128 this.current = old.clone(); 6129 this.current.resumeSMaskCtx = null; 6130 }, 6131 restore: function CanvasGraphics_restore() { 6132 if (this.current.resumeSMaskCtx) { 6133 this.resumeSMaskGroup(); 6134 } 6135 6136 if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) { 6137 this.endSMaskGroup(); 6138 } 6139 6140 if (this.stateStack.length !== 0) { 6141 this.current = this.stateStack.pop(); 6142 this.ctx.restore(); 6143 this.pendingClip = null; 6144 this._cachedGetSinglePixelWidth = null; 6145 } 6146 }, 6147 transform: function CanvasGraphics_transform(a, b, c, d, e, f) { 6148 this.ctx.transform(a, b, c, d, e, f); 6149 this._cachedGetSinglePixelWidth = null; 6150 }, 6151 constructPath: function CanvasGraphics_constructPath(ops, args) { 6152 var ctx = this.ctx; 6153 var current = this.current; 6154 var x = current.x, 6155 y = current.y; 6156 6157 for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { 6158 switch (ops[i] | 0) { 6159 case _util.OPS.rectangle: 6160 x = args[j++]; 6161 y = args[j++]; 6162 var width = args[j++]; 6163 var height = args[j++]; 6164 6165 if (width === 0) { 6166 width = this.getSinglePixelWidth(); 6167 } 6168 6169 if (height === 0) { 6170 height = this.getSinglePixelWidth(); 6171 } 6172 6173 var xw = x + width; 6174 var yh = y + height; 6175 this.ctx.moveTo(x, y); 6176 this.ctx.lineTo(xw, y); 6177 this.ctx.lineTo(xw, yh); 6178 this.ctx.lineTo(x, yh); 6179 this.ctx.lineTo(x, y); 6180 this.ctx.closePath(); 6181 break; 6182 6183 case _util.OPS.moveTo: 6184 x = args[j++]; 6185 y = args[j++]; 6186 ctx.moveTo(x, y); 6187 break; 6188 6189 case _util.OPS.lineTo: 6190 x = args[j++]; 6191 y = args[j++]; 6192 ctx.lineTo(x, y); 6193 break; 6194 6195 case _util.OPS.curveTo: 6196 x = args[j + 4]; 6197 y = args[j + 5]; 6198 ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y); 6199 j += 6; 6200 break; 6201 6202 case _util.OPS.curveTo2: 6203 ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]); 6204 x = args[j + 2]; 6205 y = args[j + 3]; 6206 j += 4; 6207 break; 6208 6209 case _util.OPS.curveTo3: 6210 x = args[j + 2]; 6211 y = args[j + 3]; 6212 ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y); 6213 j += 4; 6214 break; 6215 6216 case _util.OPS.closePath: 6217 ctx.closePath(); 6218 break; 6219 } 6220 } 6221 6222 current.setCurrentPoint(x, y); 6223 }, 6224 closePath: function CanvasGraphics_closePath() { 6225 this.ctx.closePath(); 6226 }, 6227 stroke: function CanvasGraphics_stroke(consumePath) { 6228 consumePath = typeof consumePath !== "undefined" ? consumePath : true; 6229 var ctx = this.ctx; 6230 var strokeColor = this.current.strokeColor; 6231 ctx.globalAlpha = this.current.strokeAlpha; 6232 6233 if (strokeColor && strokeColor.hasOwnProperty("type") && strokeColor.type === "Pattern") { 6234 ctx.save(); 6235 const transform = ctx.mozCurrentTransform; 6236 6237 const scale = _util.Util.singularValueDecompose2dScale(transform)[0]; 6238 6239 ctx.strokeStyle = strokeColor.getPattern(ctx, this); 6240 ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale); 6241 ctx.stroke(); 6242 ctx.restore(); 6243 } else { 6244 ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); 6245 ctx.stroke(); 6246 } 6247 6248 if (consumePath) { 6249 this.consumePath(); 6250 } 6251 6252 ctx.globalAlpha = this.current.fillAlpha; 6253 }, 6254 closeStroke: function CanvasGraphics_closeStroke() { 6255 this.closePath(); 6256 this.stroke(); 6257 }, 6258 fill: function CanvasGraphics_fill(consumePath) {
6259 consumePath = typeof consumePath !== "undefined" ? consumePath : true; 6260 var ctx = this.ctx; 6261 var fillColor = this.current.fillColor; 6262 var isPatternFill = this.current.patternFill; 6263 var needRestore = false; 6264 6265 if (isPatternFill) { 6266 ctx.save(); 6267 6268 if (this.baseTransform) { 6269 ctx.setTransform.apply(ctx, this.baseTransform); 6270 } 6271 6272 ctx.fillStyle = fillColor.getPattern(ctx, this); 6273 needRestore = true; 6274 } 6275 6276 if (this.pendingEOFill) { 6277 ctx.fill("evenodd"); 6278 this.pendingEOFill = false; 6279 } else { 6280 ctx.fill(); 6281 } 6282 6283 if (needRestore) { 6284 ctx.restore(); 6285 } 6286 6287 if (consumePath) { 6288 this.consumePath(); 6289 } 6290 }, 6291 eoFill: function CanvasGraphics_eoFill() { 6292 this.pendingEOFill = true; 6293 this.fill(); 6294 }, 6295 fillStroke: function CanvasGraphics_fillStroke() { 6296 this.fill(false); 6297 this.stroke(false); 6298 this.consumePath(); 6299 }, 6300 eoFillStroke: function CanvasGraphics_eoFillStroke() { 6301 this.pendingEOFill = true; 6302 this.fillStroke(); 6303 }, 6304 closeFillStroke: function CanvasGraphics_closeFillStroke() { 6305 this.closePath(); 6306 this.fillStroke(); 6307 }, 6308 closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { 6309 this.pendingEOFill = true; 6310 this.closePath(); 6311 this.fillStroke(); 6312 }, 6313 endPath: function CanvasGraphics_endPath() { 6314 this.consumePath(); 6315 }, 6316 clip: function CanvasGraphics_clip() { 6317 this.pendingClip = NORMAL_CLIP; 6318 }, 6319 eoClip: function CanvasGraphics_eoClip() { 6320 this.pendingClip = EO_CLIP; 6321 }, 6322 beginText: function CanvasGraphics_beginText() { 6323 this.current.textMatrix = _util.IDENTITY_MATRIX; 6324 this.current.textMatrixScale = 1; 6325 this.current.x = this.current.lineX = 0; 6326 this.current.y = this.current.lineY = 0; 6327 }, 6328 endText: function CanvasGraphics_endText() { 6329 var paths = this.pendingTextPaths; 6330 var ctx = this.ctx; 6331 6332 if (paths === undefined) { 6333 ctx.beginPath(); 6334 return; 6335 } 6336 6337 ctx.save(); 6338 ctx.beginPath(); 6339 6340 for (var i = 0; i < paths.length; i++) { 6341 var path = paths[i]; 6342 ctx.setTransform.apply(ctx, path.transform); 6343 ctx.translate(path.x, path.y); 6344 path.addToPath(ctx, path.fontSize); 6345 } 6346 6347 ctx.restore(); 6348 ctx.clip(); 6349 ctx.beginPath(); 6350 delete this.pendingTextPaths; 6351 }, 6352 setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { 6353 this.current.charSpacing = spacing; 6354 }, 6355 setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { 6356 this.current.wordSpacing = spacing; 6357 }, 6358 setHScale: function CanvasGraphics_setHScale(scale) { 6359 this.current.textHScale = scale / 100; 6360 }, 6361 setLeading: function CanvasGraphics_setLeading(leading) { 6362 this.current.leading = -leading; 6363 }, 6364 setFont: function CanvasGraphics_setFont(fontRefName, size) { 6365 var fontObj = this.commonObjs.get(fontRefName); 6366 var current = this.current; 6367 6368 if (!fontObj) { 6369 throw new Error(`Can't find font for ${fontRefName}`); 6370 } 6371 6372 current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; 6373 6374 if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) { 6375 (0, _util.warn)("Invalid font matrix for font " + fontRefName); 6376 } 6377 6378 if (size < 0) { 6379 size = -size; 6380 current.fontDirection = -1; 6381 } else { 6382 current.fontDirection = 1; 6383 } 6384 6385 this.current.font = fontObj; 6386 this.current.fontSize = size; 6387 6388 if (fontObj.isType3Font) { 6389 return; 6390 } 6391 6392 var name = fontObj.loadedName || "sans-serif"; 6393 let bold = "normal"; 6394 6395 if (fontObj.black) { 6396 bold = "900"; 6397 } else if (fontObj.bold) { 6398 bold = "bold"; 6399 } 6400 6401 var italic = fontObj.italic ? "italic" : "normal"; 6402 var typeface = `"${name}", ${fontObj.fallbackName}`; 6403 let browserFontSize = size; 6404 6405 if (size < MIN_FONT_SIZE) { 6406 browserFontSize = MIN_FONT_SIZE; 6407 } else if (size > MAX_FONT_SIZE) { 6408 browserFontSize = MAX_FONT_SIZE; 6409 } 6410 6411 this.current.fontSizeScale = size / browserFontSize; 6412 this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`; 6413 }, 6414 setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { 6415 this.current.textRenderingMode = mode; 6416 }, 6417 setTextRise: function CanvasGraphics_setTextRise(rise) { 6418 this.current.textRise = rise; 6419 }, 6420 moveText: function CanvasGraphics_moveText(x, y) { 6421 this.current.x = this.current.lineX += x; 6422 this.current.y = this.current.lineY += y; 6423 },
6424 setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { 6425 this.setLeading(-y); 6426 this.moveText(x, y); 6427 }, 6428 setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { 6429 this.current.textMatrix = [a, b, c, d, e, f]; 6430 this.current.textMatrixScale = Math.sqrt(a * a + b * b); 6431 this.current.x = this.current.lineX = 0; 6432 this.current.y = this.current.lineY = 0; 6433 }, 6434 nextLine: function CanvasGraphics_nextLine() { 6435 this.moveText(0, this.current.leading); 6436 }, 6437 6438 paintChar(character, x, y, patternTransform) { 6439 var ctx = this.ctx; 6440 var current = this.current; 6441 var font = current.font; 6442 var textRenderingMode = current.textRenderingMode; 6443 var fontSize = current.fontSize / current.fontSizeScale; 6444 var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 6445 var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 6446 const patternFill = current.patternFill && !font.missingFile; 6447 var addToPath; 6448 6449 if (font.disableFontFace || isAddToPathSet || patternFill) { 6450 addToPath = font.getPathGenerator(this.commonObjs, character); 6451 } 6452 6453 if (font.disableFontFace || patternFill) { 6454 ctx.save(); 6455 ctx.translate(x, y); 6456 ctx.beginPath(); 6457 addToPath(ctx, fontSize); 6458 6459 if (patternTransform) { 6460 ctx.setTransform.apply(ctx, patternTransform); 6461 } 6462 6463 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 6464 ctx.fill(); 6465 } 6466 6467 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 6468 ctx.stroke(); 6469 } 6470 6471 ctx.restore(); 6472 } else { 6473 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 6474 ctx.fillText(character, x, y); 6475 } 6476 6477 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 6478 ctx.strokeText(character, x, y); 6479 } 6480 } 6481 6482 if (isAddToPathSet) { 6483 var paths = this.pendingTextPaths || (this.pendingTextPaths = []); 6484 paths.push({ 6485 transform: ctx.mozCurrentTransform, 6486 x, 6487 y, 6488 fontSize, 6489 addToPath 6490 }); 6491 } 6492 }, 6493 6494 get isFontSubpixelAAEnabled() { 6495 const { 6496 context: ctx 6497 } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10); 6498 ctx.scale(1.5, 1); 6499 ctx.fillText("I", 0, 10); 6500 var data = ctx.getImageData(0, 0, 10, 10).data; 6501 var enabled = false; 6502 6503 for (var i = 3; i < data.length; i += 4) { 6504 if (data[i] > 0 && data[i] < 255) { 6505 enabled = true; 6506 break; 6507 } 6508 } 6509 6510 return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled); 6511 }, 6512 6513 showText: function CanvasGraphics_showText(glyphs) { 6514 var current = this.current; 6515 var font = current.font; 6516 6517 if (font.isType3Font) { 6518 return this.showType3Text(glyphs); 6519 } 6520 6521 var fontSize = current.fontSize; 6522 6523 if (fontSize === 0) { 6524 return undefined; 6525 } 6526 6527 var ctx = this.ctx; 6528 var fontSizeScale = current.fontSizeScale; 6529 var charSpacing = current.charSpacing; 6530 var wordSpacing = current.wordSpacing; 6531 var fontDirection = current.fontDirection; 6532 var textHScale = current.textHScale * fontDirection; 6533 var glyphsLength = glyphs.length; 6534 var vertical = font.vertical; 6535 var spacingDir = vertical ? 1 : -1; 6536 var defaultVMetrics = font.defaultVMetrics; 6537 var widthAdvanceScale = fontSize * current.fontMatrix[0]; 6538 var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; 6539 ctx.save(); 6540 let patternTransform; 6541 6542 if (current.patternFill) { 6543 ctx.save(); 6544 const pattern = current.fillColor.getPattern(ctx, this); 6545 patternTransform = ctx.mozCurrentTransform;
6546 ctx.restore(); 6547 ctx.fillStyle = pattern; 6548 } 6549 6550 ctx.transform.apply(ctx, current.textMatrix); 6551 ctx.translate(current.x, current.y + current.textRise); 6552 6553 if (fontDirection > 0) { 6554 ctx.scale(textHScale, -1); 6555 } else { 6556 ctx.scale(textHScale, 1); 6557 } 6558 6559 var lineWidth = current.lineWidth; 6560 var scale = current.textMatrixScale; 6561 6562 if (scale === 0 || lineWidth === 0) { 6563 var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 6564 6565 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 6566 this._cachedGetSinglePixelWidth = null; 6567 lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; 6568 } 6569 } else { 6570 lineWidth /= scale; 6571 } 6572 6573 if (fontSizeScale !== 1.0) { 6574 ctx.scale(fontSizeScale, fontSizeScale); 6575 lineWidth /= fontSizeScale; 6576 } 6577 6578 ctx.lineWidth = lineWidth; 6579 var x = 0, 6580 i; 6581 6582 for (i = 0; i < glyphsLength; ++i) { 6583 var glyph = glyphs[i]; 6584 6585 if ((0, _util.isNum)(glyph)) { 6586 x += spacingDir * glyph * fontSize / 1000; 6587 continue; 6588 } 6589 6590 var restoreNeeded = false; 6591 var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 6592 var character = glyph.fontChar; 6593 var accent = glyph.accent; 6594 var scaledX, scaledY, scaledAccentX, scaledAccentY; 6595 var width = glyph.width; 6596 6597 if (vertical) { 6598 var vmetric, vx, vy; 6599 vmetric = glyph.vmetric || defaultVMetrics; 6600 vx = glyph.vmetric ? vmetric[1] : width * 0.5; 6601 vx = -vx * widthAdvanceScale; 6602 vy = vmetric[2] * widthAdvanceScale; 6603 width = vmetric ? -vmetric[0] : width; 6604 scaledX = vx / fontSizeScale; 6605 scaledY = (x + vy) / fontSizeScale; 6606 } else { 6607 scaledX = x / fontSizeScale; 6608 scaledY = 0; 6609 } 6610 6611 if (font.remeasure && width > 0) { 6612 var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; 6613 6614 if (width < measuredWidth && this.isFontSubpixelAAEnabled) { 6615 var characterScaleX = width / measuredWidth; 6616 restoreNeeded = true; 6617 ctx.save(); 6618 ctx.scale(characterScaleX, 1); 6619 scaledX /= characterScaleX; 6620 } else if (width !== measuredWidth) { 6621 scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale; 6622 } 6623 } 6624 6625 if (glyph.isInFont || font.missingFile) { 6626 if (simpleFillText && !accent) { 6627 ctx.fillText(character, scaledX, scaledY); 6628 } else { 6629 this.paintChar(character, scaledX, scaledY, patternTransform); 6630 6631 if (accent) { 6632 scaledAccentX = scaledX + accent.offset.x / fontSizeScale; 6633 scaledAccentY = scaledY - accent.offset.y / fontSizeScale; 6634 this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform); 6635 } 6636 } 6637 } 6638 6639 var charWidth; 6640 6641 if (vertical) { 6642 charWidth = width * widthAdvanceScale - spacing * fontDirection; 6643 } else { 6644 charWidth = width * widthAdvanceScale + spacing * fontDirection; 6645 } 6646 6647 x += charWidth; 6648 6649 if (restoreNeeded) { 6650 ctx.restore(); 6651 } 6652 } 6653 6654 if (vertical) { 6655 current.y -= x; 6656 } else { 6657 current.x += x * textHScale; 6658 } 6659 6660 ctx.restore(); 6661 }, 6662 showType3Text: function CanvasGraphics_showType3Text(glyphs) { 6663 var ctx = this.ctx; 6664 var current = this.current; 6665 var font = current.font; 6666 var fontSize = current.fontSize; 6667 var fontDirection = current.fontDirection; 6668 var spacingDir = font.vertical ? 1 : -1; 6669 var charSpacing = current.charSpacing; 6670 var wordSpacing = current.wordSpacing; 6671 var textHScale = current.textHScale * fontDirection; 6672 var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; 6673 var glyphsLength = glyphs.length; 6674 var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; 6675 var i, glyph, width, spacingLength; 6676 6677 if (isTextInvisible || fontSize === 0) { 6678 return; 6679 } 6680 6681 this._cachedGetSinglePixelWidth = null; 6682 ctx.save(); 6683 ctx.transform.apply(ctx, current.textMatrix); 6684 ctx.translate(current.x, current.y); 6685 ctx.scale(textHScale, fontDirection); 6686 6687 for (i = 0; i < glyphsLength; ++i) { 6688 glyph = glyphs[i]; 6689
6690 if ((0, _util.isNum)(glyph)) { 6691 spacingLength = spacingDir * glyph * fontSize / 1000; 6692 this.ctx.translate(spacingLength, 0); 6693 current.x += spacingLength * textHScale; 6694 continue; 6695 } 6696 6697 var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 6698 var operatorList = font.charProcOperatorList[glyph.operatorListId]; 6699 6700 if (!operatorList) { 6701 (0, _util.warn)(`Type3 character "${glyph.operatorListId}" is not available.`); 6702 continue; 6703 } 6704 6705 this.processingType3 = glyph; 6706 this.save(); 6707 ctx.scale(fontSize, fontSize); 6708 ctx.transform.apply(ctx, fontMatrix); 6709 this.executeOperatorList(operatorList); 6710 this.restore(); 6711 6712 var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); 6713 6714 width = transformed[0] * fontSize + spacing; 6715 ctx.translate(width, 0); 6716 current.x += width * textHScale; 6717 } 6718 6719 ctx.restore(); 6720 this.processingType3 = null; 6721 }, 6722 setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {}, 6723 setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { 6724 this.ctx.rect(llx, lly, urx - llx, ury - lly); 6725 this.clip(); 6726 this.endPath(); 6727 }, 6728 getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { 6729 var pattern; 6730 6731 if (IR[0] === "TilingPattern") { 6732 var color = IR[1]; 6733 var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); 6734 var canvasGraphicsFactory = { 6735 createCanvasGraphics: ctx => { 6736 return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext); 6737 } 6738 }; 6739 pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); 6740 } else { 6741 pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); 6742 } 6743 6744 return pattern; 6745 }, 6746 setStrokeColorN: function CanvasGraphics_setStrokeColorN() { 6747 this.current.strokeColor = this.getColorN_Pattern(arguments); 6748 }, 6749 setFillColorN: function CanvasGraphics_setFillColorN() { 6750 this.current.fillColor = this.getColorN_Pattern(arguments); 6751 this.current.patternFill = true; 6752 }, 6753 setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { 6754 var color = _util.Util.makeCssRgb(r, g, b); 6755 6756 this.ctx.strokeStyle = color; 6757 this.current.strokeColor = color; 6758 }, 6759 setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { 6760 var color = _util.Util.makeCssRgb(r, g, b); 6761 6762 this.ctx.fillStyle = color; 6763 this.current.fillColor = color; 6764 this.current.patternFill = false; 6765 }, 6766 shadingFill: function CanvasGraphics_shadingFill(patternIR) { 6767 var ctx = this.ctx; 6768 this.save(); 6769 var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); 6770 ctx.fillStyle = pattern.getPattern(ctx, this, true); 6771 var inv = ctx.mozCurrentTransformInverse; 6772 6773 if (inv) { 6774 var canvas = ctx.canvas; 6775 var width = canvas.width; 6776 var height = canvas.height; 6777 6778 var bl = _util.Util.applyTransform([0, 0], inv); 6779 6780 var br = _util.Util.applyTransform([0, height], inv); 6781 6782 var ul = _util.Util.applyTransform([width, 0], inv); 6783 6784 var ur = _util.Util.applyTransform([width, height], inv); 6785 6786 var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); 6787 var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); 6788 var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); 6789 var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); 6790 this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); 6791 } else { 6792 this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); 6793 } 6794 6795 this.restore(); 6796 }, 6797 beginInlineImage: function CanvasGraphics_beginInlineImage() { 6798 (0, _util.unreachable)("Should not call beginInlineImage"); 6799 }, 6800 beginImageData: function CanvasGraphics_beginImageData() { 6801 (0, _util.unreachable)("Should not call beginImageData"); 6802 }, 6803 paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) { 6804 this.save(); 6805 this.baseTransformStack.push(this.baseTransform); 6806 6807 if (Array.isArray(matrix) && matrix.length === 6) { 6808 this.transform.apply(this, matrix); 6809 } 6810 6811 this.baseTransform = this.ctx.mozCurrentTransform; 6812 6813 if (bbox) { 6814 var width = bbox[2] - bbox[0]; 6815 var height = bbox[3] - bbox[1]; 6816 this.ctx.rect(bbox[0], bbox[1], width, height); 6817 this.clip(); 6818 this.endPath(); 6819 } 6820 }, 6821 paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
6822 this.restore(); 6823 this.baseTransform = this.baseTransformStack.pop(); 6824 }, 6825 beginGroup: function CanvasGraphics_beginGroup(group) { 6826 this.save(); 6827 var currentCtx = this.ctx; 6828 6829 if (!group.isolated) { 6830 (0, _util.info)("TODO: Support non-isolated groups."); 6831 } 6832 6833 if (group.knockout) { 6834 (0, _util.warn)("Knockout groups not supported."); 6835 } 6836 6837 var currentTransform = currentCtx.mozCurrentTransform; 6838 6839 if (group.matrix) { 6840 currentCtx.transform.apply(currentCtx, group.matrix); 6841 } 6842 6843 if (!group.bbox) { 6844 throw new Error("Bounding box is required."); 6845 } 6846 6847 var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); 6848 6849 var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; 6850 bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; 6851 var offsetX = Math.floor(bounds[0]); 6852 var offsetY = Math.floor(bounds[1]); 6853 var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); 6854 var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); 6855 var scaleX = 1, 6856 scaleY = 1; 6857 6858 if (drawnWidth > MAX_GROUP_SIZE) { 6859 scaleX = drawnWidth / MAX_GROUP_SIZE; 6860 drawnWidth = MAX_GROUP_SIZE; 6861 } 6862 6863 if (drawnHeight > MAX_GROUP_SIZE) { 6864 scaleY = drawnHeight / MAX_GROUP_SIZE; 6865 drawnHeight = MAX_GROUP_SIZE; 6866 } 6867 6868 var cacheId = "groupAt" + this.groupLevel; 6869 6870 if (group.smask) { 6871 cacheId += "_smask_" + this.smaskCounter++ % 2; 6872 } 6873 6874 var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); 6875 var groupCtx = scratchCanvas.context; 6876 groupCtx.scale(1 / scaleX, 1 / scaleY); 6877 groupCtx.translate(-offsetX, -offsetY); 6878 groupCtx.transform.apply(groupCtx, currentTransform); 6879 6880 if (group.smask) { 6881 this.smaskStack.push({ 6882 canvas: scratchCanvas.canvas, 6883 context: groupCtx, 6884 offsetX, 6885 offsetY, 6886 scaleX, 6887 scaleY, 6888 subtype: group.smask.subtype, 6889 backdrop: group.smask.backdrop, 6890 transferMap: group.smask.transferMap || null, 6891 startTransformInverse: null 6892 }); 6893 } else { 6894 currentCtx.setTransform(1, 0, 0, 1, 0, 0); 6895 currentCtx.translate(offsetX, offsetY); 6896 currentCtx.scale(scaleX, scaleY); 6897 } 6898 6899 copyCtxState(currentCtx, groupCtx); 6900 this.ctx = groupCtx; 6901 this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); 6902 this.groupStack.push(currentCtx); 6903 this.groupLevel++; 6904 this.current.activeSMask = null; 6905 }, 6906 endGroup: function CanvasGraphics_endGroup(group) { 6907 this.groupLevel--; 6908 var groupCtx = this.ctx; 6909 this.ctx = this.groupStack.pop(); 6910 6911 if (this.ctx.imageSmoothingEnabled !== undefined) { 6912 this.ctx.imageSmoothingEnabled = false; 6913 } else { 6914 this.ctx.mozImageSmoothingEnabled = false; 6915 } 6916 6917 if (group.smask) { 6918 this.tempSMask = this.smaskStack.pop(); 6919 } else { 6920 this.ctx.drawImage(groupCtx.canvas, 0, 0); 6921 } 6922 6923 this.restore(); 6924 }, 6925 beginAnnotations: function CanvasGraphics_beginAnnotations() { 6926 this.save(); 6927 6928 if (this.baseTransform) { 6929 this.ctx.setTransform.apply(this.ctx, this.baseTransform); 6930 } 6931 }, 6932 endAnnotations: function CanvasGraphics_endAnnotations() { 6933 this.restore(); 6934 }, 6935 beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) { 6936 this.save(); 6937 resetCtxToDefault(this.ctx); 6938 this.current = new CanvasExtraState(); 6939 6940 if (Array.isArray(rect) && rect.length === 4) { 6941 var width = rect[2] - rect[0]; 6942 var height = rect[3] - rect[1]; 6943 this.ctx.rect(rect[0], rect[1], width, height); 6944 this.clip(); 6945 this.endPath(); 6946 } 6947 6948 this.transform.apply(this, transform); 6949 this.transform.apply(this, matrix); 6950 }, 6951 endAnnotation: function CanvasGraphics_endAnnotation() { 6952 this.restore(); 6953 }, 6954 paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { 6955 var ctx = this.ctx; 6956 var width = img.width,
6957 height = img.height; 6958 var fillColor = this.current.fillColor; 6959 var isPatternFill = this.current.patternFill; 6960 var glyph = this.processingType3; 6961 6962 if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { 6963 if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { 6964 glyph.compiled = compileType3Glyph({ 6965 data: img.data, 6966 width, 6967 height 6968 }); 6969 } else { 6970 glyph.compiled = null; 6971 } 6972 } 6973 6974 if (glyph && glyph.compiled) { 6975 glyph.compiled(ctx); 6976 return; 6977 } 6978 6979 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 6980 var maskCtx = maskCanvas.context; 6981 maskCtx.save(); 6982 putBinaryImageMask(maskCtx, img); 6983 maskCtx.globalCompositeOperation = "source-in"; 6984 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 6985 maskCtx.fillRect(0, 0, width, height); 6986 maskCtx.restore(); 6987 this.paintInlineImageXObject(maskCanvas.canvas); 6988 }, 6989 paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) { 6990 var width = imgData.width; 6991 var height = imgData.height; 6992 var fillColor = this.current.fillColor; 6993 var isPatternFill = this.current.patternFill; 6994 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 6995 var maskCtx = maskCanvas.context; 6996 maskCtx.save(); 6997 putBinaryImageMask(maskCtx, imgData); 6998 maskCtx.globalCompositeOperation = "source-in"; 6999 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 7000 maskCtx.fillRect(0, 0, width, height); 7001 maskCtx.restore(); 7002 var ctx = this.ctx; 7003 7004 for (var i = 0, ii = positions.length; i < ii; i += 2) { 7005 ctx.save(); 7006 ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); 7007 ctx.scale(1, -1); 7008 ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); 7009 ctx.restore(); 7010 } 7011 }, 7012 paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) { 7013 var ctx = this.ctx; 7014 var fillColor = this.current.fillColor; 7015 var isPatternFill = this.current.patternFill; 7016 7017 for (var i = 0, ii = images.length; i < ii; i++) { 7018 var image = images[i]; 7019 var width = image.width, 7020 height = image.height; 7021 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 7022 var maskCtx = maskCanvas.context; 7023 maskCtx.save(); 7024 putBinaryImageMask(maskCtx, image); 7025 maskCtx.globalCompositeOperation = "source-in"; 7026 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 7027 maskCtx.fillRect(0, 0, width, height); 7028 maskCtx.restore(); 7029 ctx.save(); 7030 ctx.transform.apply(ctx, image.transform); 7031 ctx.scale(1, -1); 7032 ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); 7033 ctx.restore(); 7034 } 7035 }, 7036 paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { 7037 const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); 7038 7039 if (!imgData) { 7040 (0, _util.warn)("Dependent image isn't ready yet"); 7041 return; 7042 } 7043 7044 this.paintInlineImageXObject(imgData); 7045 }, 7046 paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { 7047 const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); 7048 7049 if (!imgData) { 7050 (0, _util.warn)("Dependent image isn't ready yet"); 7051 return; 7052 } 7053 7054 var width = imgData.width; 7055 var height = imgData.height; 7056 var map = []; 7057 7058 for (var i = 0, ii = positions.length; i < ii; i += 2) { 7059 map.push({ 7060 transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]], 7061 x: 0, 7062 y: 0, 7063 w: width, 7064 h: height 7065 }); 7066 } 7067 7068 this.paintInlineImageXObjectGroup(imgData, map); 7069 }, 7070 paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { 7071 var width = imgData.width; 7072 var height = imgData.height; 7073 var ctx = this.ctx; 7074 this.save(); 7075 ctx.scale(1 / width, -1 / height); 7076 var currentTransform = ctx.mozCurrentTransformInverse; 7077 var a = currentTransform[0], 7078 b = currentTransform[1]; 7079 var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); 7080 var c = currentTransform[2], 7081 d = currentTransform[3]; 7082 var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); 7083 var imgToPaint, tmpCanvas; 7084 7085 if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) { 7086 imgToPaint = imgData; 7087 } else { 7088 tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height); 7089 var tmpCtx = tmpCanvas.context; 7090 putBinaryImageData(tmpCtx, imgData); 7091 imgToPaint = tmpCanvas.canvas; 7092 } 7093 7094 var paintWidth = width, 7095 paintHeight = height; 7096 var tmpCanvasId = "prescale1"; 7097 7098 while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) { 7099 var newWidth = paintWidth, 7100 newHeight = paintHeight; 7101 7102 if (widthScale > 2 && paintWidth > 1) { 7103 newWidth = Math.ceil(paintWidth / 2);
7104 widthScale /= paintWidth / newWidth; 7105 } 7106 7107 if (heightScale > 2 && paintHeight > 1) { 7108 newHeight = Math.ceil(paintHeight / 2); 7109 heightScale /= paintHeight / newHeight; 7110 } 7111 7112 tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight); 7113 tmpCtx = tmpCanvas.context; 7114 tmpCtx.clearRect(0, 0, newWidth, newHeight); 7115 tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight); 7116 imgToPaint = tmpCanvas.canvas; 7117 paintWidth = newWidth; 7118 paintHeight = newHeight; 7119 tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1"; 7120 } 7121 7122 ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height); 7123 7124 if (this.imageLayer) { 7125 var position = this.getCanvasPosition(0, -height); 7126 this.imageLayer.appendImage({ 7127 imgData, 7128 left: position[0], 7129 top: position[1], 7130 width: width / currentTransform[0], 7131 height: height / currentTransform[3] 7132 }); 7133 } 7134 7135 this.restore(); 7136 }, 7137 paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { 7138 var ctx = this.ctx; 7139 var w = imgData.width; 7140 var h = imgData.height; 7141 var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h); 7142 var tmpCtx = tmpCanvas.context; 7143 putBinaryImageData(tmpCtx, imgData); 7144 7145 for (var i = 0, ii = map.length; i < ii; i++) { 7146 var entry = map[i]; 7147 ctx.save(); 7148 ctx.transform.apply(ctx, entry.transform); 7149 ctx.scale(1, -1); 7150 ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); 7151 7152 if (this.imageLayer) { 7153 var position = this.getCanvasPosition(entry.x, entry.y); 7154 this.imageLayer.appendImage({ 7155 imgData, 7156 left: position[0], 7157 top: position[1], 7158 width: w, 7159 height: h 7160 }); 7161 } 7162 7163 ctx.restore(); 7164 } 7165 }, 7166 paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { 7167 this.ctx.fillRect(0, 0, 1, 1); 7168 }, 7169 paintXObject: function CanvasGraphics_paintXObject() { 7170 (0, _util.warn)("Unsupported 'paintXObject' command."); 7171 }, 7172 markPoint: function CanvasGraphics_markPoint(tag) {}, 7173 markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, 7174 beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, 7175 beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, 7176 endMarkedContent: function CanvasGraphics_endMarkedContent() {}, 7177 beginCompat: function CanvasGraphics_beginCompat() {}, 7178 endCompat: function CanvasGraphics_endCompat() {}, 7179 consumePath: function CanvasGraphics_consumePath() { 7180 var ctx = this.ctx; 7181 7182 if (this.pendingClip) { 7183 if (this.pendingClip === EO_CLIP) { 7184 ctx.clip("evenodd"); 7185 } else { 7186 ctx.clip(); 7187 } 7188 7189 this.pendingClip = null; 7190 } 7191 7192 ctx.beginPath(); 7193 }, 7194 7195 getSinglePixelWidth(scale) { 7196 if (this._cachedGetSinglePixelWidth === null) { 7197 const inverse = this.ctx.mozCurrentTransformInverse; 7198 this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); 7199 } 7200 7201 return this._cachedGetSinglePixelWidth; 7202 }, 7203 7204 getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { 7205 var transform = this.ctx.mozCurrentTransform; 7206 return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; 7207 } 7208 }; 7209 7210 for (var op in _util.OPS) { 7211 CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; 7212 } 7213 7214 return CanvasGraphics; 7215}(); 7216 7217exports.CanvasGraphics = CanvasGraphics; 7218 7219/***/ }), 7220/* 9 */ 7221/***/ (function(module, exports, __w_pdfjs_require__) { 7222 7223"use strict"; 7224 7225 7226Object.defineProperty(exports, "__esModule", { 7227 value: true 7228}); 7229exports.getShadingPatternFromIR = getShadingPatternFromIR; 7230exports.TilingPattern = void 0; 7231 7232var _util = __w_pdfjs_require__(2); 7233 7234var ShadingIRs = {}; 7235 7236function applyBoundingBox(ctx, bbox) { 7237 if (!bbox || typeof Path2D === "undefined") { 7238 return; 7239 } 7240 7241 const width = bbox[2] - bbox[0]; 7242 const height = bbox[3] - bbox[1]; 7243 const region = new Path2D(); 7244 region.rect(bbox[0], bbox[1], width, height); 7245 ctx.clip(region); 7246} 7247 7248ShadingIRs.RadialAxial = { 7249 fromIR: function RadialAxial_fromIR(raw) { 7250 var type = raw[1]; 7251 var bbox = raw[2]; 7252 var colorStops = raw[3]; 7253 var p0 = raw[4]; 7254 var p1 = raw[5]; 7255 var r0 = raw[6]; 7256 var r1 = raw[7]; 7257 return { 7258 type: "Pattern", 7259 getPattern: function RadialAxial_getPattern(ctx) { 7260 applyBoundingBox(ctx, bbox); 7261 var grad; 7262 7263 if (type === "axial") { 7264 grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); 7265 } else if (type === "radial") { 7266 grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); 7267 } 7268 7269 for (var i = 0, ii = colorStops.length; i < ii; ++i) { 7270 var c = colorStops[i];
7271 grad.addColorStop(c[0], c[1]); 7272 } 7273 7274 return grad; 7275 } 7276 }; 7277 } 7278}; 7279 7280var createMeshCanvas = function createMeshCanvasClosure() { 7281 function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { 7282 var coords = context.coords, 7283 colors = context.colors; 7284 var bytes = data.data, 7285 rowSize = data.width * 4; 7286 var tmp; 7287 7288 if (coords[p1 + 1] > coords[p2 + 1]) { 7289 tmp = p1; 7290 p1 = p2; 7291 p2 = tmp; 7292 tmp = c1; 7293 c1 = c2; 7294 c2 = tmp; 7295 } 7296 7297 if (coords[p2 + 1] > coords[p3 + 1]) { 7298 tmp = p2; 7299 p2 = p3; 7300 p3 = tmp; 7301 tmp = c2; 7302 c2 = c3; 7303 c3 = tmp; 7304 } 7305 7306 if (coords[p1 + 1] > coords[p2 + 1]) { 7307 tmp = p1; 7308 p1 = p2; 7309 p2 = tmp; 7310 tmp = c1; 7311 c1 = c2; 7312 c2 = tmp; 7313 } 7314 7315 var x1 = (coords[p1] + context.offsetX) * context.scaleX; 7316 var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; 7317 var x2 = (coords[p2] + context.offsetX) * context.scaleX; 7318 var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; 7319 var x3 = (coords[p3] + context.offsetX) * context.scaleX; 7320 var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; 7321 7322 if (y1 >= y3) { 7323 return; 7324 } 7325 7326 var c1r = colors[c1], 7327 c1g = colors[c1 + 1], 7328 c1b = colors[c1 + 2]; 7329 var c2r = colors[c2], 7330 c2g = colors[c2 + 1], 7331 c2b = colors[c2 + 2]; 7332 var c3r = colors[c3], 7333 c3g = colors[c3 + 1], 7334 c3b = colors[c3 + 2]; 7335 var minY = Math.round(y1), 7336 maxY = Math.round(y3); 7337 var xa, car, cag, cab; 7338 var xb, cbr, cbg, cbb; 7339 7340 for (var y = minY; y <= maxY; y++) { 7341 if (y < y2) { 7342 let k; 7343 7344 if (y < y1) { 7345 k = 0; 7346 } else if (y1 === y2) { 7347 k = 1; 7348 } else { 7349 k = (y1 - y) / (y1 - y2); 7350 } 7351 7352 xa = x1 - (x1 - x2) * k; 7353 car = c1r - (c1r - c2r) * k; 7354 cag = c1g - (c1g - c2g) * k; 7355 cab = c1b - (c1b - c2b) * k; 7356 } else { 7357 let k; 7358 7359 if (y > y3) { 7360 k = 1; 7361 } else if (y2 === y3) { 7362 k = 0; 7363 } else { 7364 k = (y2 - y) / (y2 - y3); 7365 } 7366 7367 xa = x2 - (x2 - x3) * k; 7368 car = c2r - (c2r - c3r) * k; 7369 cag = c2g - (c2g - c3g) * k; 7370 cab = c2b - (c2b - c3b) * k; 7371 } 7372 7373 let k; 7374 7375 if (y < y1) { 7376 k = 0; 7377 } else if (y > y3) { 7378 k = 1; 7379 } else { 7380 k = (y1 - y) / (y1 - y3); 7381 } 7382 7383 xb = x1 - (x1 - x3) * k; 7384 cbr = c1r - (c1r - c3r) * k; 7385 cbg = c1g - (c1g - c3g) * k; 7386 cbb = c1b - (c1b - c3b) * k; 7387 var x1_ = Math.round(Math.min(xa, xb)); 7388 var x2_ = Math.round(Math.max(xa, xb)); 7389 var j = rowSize * y + x1_ * 4; 7390 7391 for (var x = x1_; x <= x2_; x++) { 7392 k = (xa - x) / (xa - xb); 7393 7394 if (k < 0) { 7395 k = 0; 7396 } else if (k > 1) { 7397 k = 1; 7398 } 7399 7400 bytes[j++] = car - (car - cbr) * k | 0; 7401 bytes[j++] = cag - (cag - cbg) * k | 0; 7402 bytes[j++] = cab - (cab - cbb) * k | 0; 7403 bytes[j++] = 255; 7404 } 7405 } 7406 } 7407 7408 function drawFigure(data, figure, context) { 7409 var ps = figure.coords; 7410 var cs = figure.colors; 7411 var i, ii; 7412 7413 switch (figure.type) { 7414 case "lattice": 7415 var verticesPerRow = figure.verticesPerRow; 7416 var rows = Math.floor(ps.length / verticesPerRow) - 1; 7417 var cols = verticesPerRow - 1; 7418 7419 for (i = 0; i < rows; i++) { 7420 var q = i * verticesPerRow; 7421 7422 for (var j = 0; j < cols; j++, q++) { 7423 drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); 7424 drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); 7425 } 7426 } 7427 7428 break; 7429 7430 case "triangles": 7431 for (i = 0, ii = ps.length; i < ii; i += 3) { 7432 drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); 7433 } 7434 7435 break; 7436 7437 default: 7438 throw new Error("illegal figure"); 7439 } 7440 } 7441 7442 function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) { 7443 var EXPECTED_SCALE = 1.1; 7444 var MAX_PATTERN_SIZE = 3000; 7445 var BORDER_SIZE = 2; 7446 var offsetX = Math.floor(bounds[0]); 7447 var offsetY = Math.floor(bounds[1]); 7448 var boundsWidth = Math.ceil(bounds[2]) - offsetX;
7449 var boundsHeight = Math.ceil(bounds[3]) - offsetY; 7450 var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); 7451 var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); 7452 var scaleX = boundsWidth / width; 7453 var scaleY = boundsHeight / height; 7454 var context = { 7455 coords, 7456 colors, 7457 offsetX: -offsetX, 7458 offsetY: -offsetY, 7459 scaleX: 1 / scaleX, 7460 scaleY: 1 / scaleY 7461 }; 7462 var paddedWidth = width + BORDER_SIZE * 2; 7463 var paddedHeight = height + BORDER_SIZE * 2; 7464 var canvas, tmpCanvas, i, ii; 7465 7466 if (webGLContext.isEnabled) { 7467 canvas = webGLContext.drawFigures({ 7468 width, 7469 height, 7470 backgroundColor, 7471 figures, 7472 context 7473 }); 7474 tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); 7475 tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); 7476 canvas = tmpCanvas.canvas; 7477 } else { 7478 tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); 7479 var tmpCtx = tmpCanvas.context; 7480 var data = tmpCtx.createImageData(width, height); 7481 7482 if (backgroundColor) { 7483 var bytes = data.data; 7484 7485 for (i = 0, ii = bytes.length; i < ii; i += 4) { 7486 bytes[i] = backgroundColor[0]; 7487 bytes[i + 1] = backgroundColor[1]; 7488 bytes[i + 2] = backgroundColor[2]; 7489 bytes[i + 3] = 255; 7490 } 7491 } 7492 7493 for (i = 0; i < figures.length; i++) { 7494 drawFigure(data, figures[i], context); 7495 } 7496 7497 tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); 7498 canvas = tmpCanvas.canvas; 7499 } 7500 7501 return { 7502 canvas, 7503 offsetX: offsetX - BORDER_SIZE * scaleX, 7504 offsetY: offsetY - BORDER_SIZE * scaleY, 7505 scaleX, 7506 scaleY 7507 }; 7508 } 7509 7510 return createMeshCanvas; 7511}(); 7512 7513ShadingIRs.Mesh = { 7514 fromIR: function Mesh_fromIR(raw) { 7515 var coords = raw[2]; 7516 var colors = raw[3]; 7517 var figures = raw[4]; 7518 var bounds = raw[5]; 7519 var matrix = raw[6]; 7520 var bbox = raw[7]; 7521 var background = raw[8]; 7522 return { 7523 type: "Pattern", 7524 getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { 7525 applyBoundingBox(ctx, bbox); 7526 var scale; 7527 7528 if (shadingFill) { 7529 scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); 7530 } else { 7531 scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); 7532 7533 if (matrix) { 7534 var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); 7535 7536 scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; 7537 } 7538 } 7539 7540 var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext); 7541 7542 if (!shadingFill) { 7543 ctx.setTransform.apply(ctx, owner.baseTransform); 7544 7545 if (matrix) { 7546 ctx.transform.apply(ctx, matrix); 7547 } 7548 } 7549 7550 ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); 7551 ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); 7552 return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat"); 7553 } 7554 }; 7555 } 7556}; 7557ShadingIRs.Dummy = { 7558 fromIR: function Dummy_fromIR() { 7559 return { 7560 type: "Pattern", 7561 getPattern: function Dummy_fromIR_getPattern() { 7562 return "hotpink"; 7563 } 7564 }; 7565 } 7566}; 7567 7568function getShadingPatternFromIR(raw) { 7569 var shadingIR = ShadingIRs[raw[0]]; 7570 7571 if (!shadingIR) { 7572 throw new Error(`Unknown IR type: ${raw[0]}`); 7573 } 7574 7575 return shadingIR.fromIR(raw); 7576} 7577 7578var TilingPattern = function TilingPatternClosure() { 7579 var PaintType = { 7580 COLORED: 1, 7581 UNCOLORED: 2 7582 }; 7583 var MAX_PATTERN_SIZE = 3000; 7584 7585 function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { 7586 this.operatorList = IR[2]; 7587 this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; 7588 this.bbox = IR[4]; 7589 this.xstep = IR[5]; 7590 this.ystep = IR[6]; 7591 this.paintType = IR[7]; 7592 this.tilingType = IR[8]; 7593 this.color = color; 7594 this.canvasGraphicsFactory = canvasGraphicsFactory; 7595 this.baseTransform = baseTransform; 7596 this.type = "Pattern"; 7597 this.ctx = ctx; 7598 } 7599 7600 TilingPattern.prototype = { 7601 createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { 7602 var operatorList = this.operatorList; 7603 var bbox = this.bbox; 7604 var xstep = this.xstep; 7605 var ystep = this.ystep; 7606 var paintType = this.paintType; 7607 var tilingType = this.tilingType; 7608 var color = this.color; 7609 var canvasGraphicsFactory = this.canvasGraphicsFactory; 7610 (0, _util.info)("TilingType: " + tilingType); 7611 var x0 = bbox[0], 7612 y0 = bbox[1], 7613 x1 = bbox[2], 7614 y1 = bbox[3]; 7615 7616 var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix
7616); 7617 7618 var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); 7619 7620 var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; 7621 var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); 7622 var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); 7623 var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true); 7624 var tmpCtx = tmpCanvas.context; 7625 var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); 7626 graphics.groupLevel = owner.groupLevel; 7627 this.setFillAndStrokeStyleToContext(graphics, paintType, color); 7628 graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); 7629 graphics.transform(1, 0, 0, 1, -x0, -y0); 7630 this.clipBbox(graphics, bbox, x0, y0, x1, y1); 7631 graphics.executeOperatorList(operatorList); 7632 this.ctx.transform(1, 0, 0, 1, x0, y0); 7633 this.ctx.scale(1 / dimx.scale, 1 / dimy.scale); 7634 return tmpCanvas.canvas; 7635 }, 7636 getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) { 7637 step = Math.abs(step); 7638 var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize); 7639 var size = Math.ceil(step * scale); 7640 7641 if (size >= maxSize) { 7642 size = maxSize; 7643 } else { 7644 scale = size / step; 7645 } 7646 7647 return { 7648 scale, 7649 size 7650 }; 7651 }, 7652 clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { 7653 if (Array.isArray(bbox) && bbox.length === 4) { 7654 var bboxWidth = x1 - x0; 7655 var bboxHeight = y1 - y0; 7656 graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); 7657 graphics.clip(); 7658 graphics.endPath(); 7659 } 7660 }, 7661 setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { 7662 const context = graphics.ctx, 7663 current = graphics.current; 7664 7665 switch (paintType) { 7666 case PaintType.COLORED: 7667 var ctx = this.ctx; 7668 context.fillStyle = ctx.fillStyle; 7669 context.strokeStyle = ctx.strokeStyle; 7670 current.fillColor = ctx.fillStyle; 7671 current.strokeColor = ctx.strokeStyle; 7672 break; 7673 7674 case PaintType.UNCOLORED: 7675 var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); 7676 7677 context.fillStyle = cssColor; 7678 context.strokeStyle = cssColor; 7679 current.fillColor = cssColor; 7680 current.strokeColor = cssColor; 7681 break; 7682 7683 default: 7684 throw new _util.FormatError(`Unsupported paint type: ${paintType}`); 7685 } 7686 }, 7687 getPattern: function TilingPattern_getPattern(ctx, owner) { 7688 ctx = this.ctx; 7689 ctx.setTransform.apply(ctx, this.baseTransform); 7690 ctx.transform.apply(ctx, this.matrix); 7691 var temporaryPatternCanvas = this.createPatternCanvas(owner); 7692 return ctx.createPattern(temporaryPatternCanvas, "repeat"); 7693 } 7694 }; 7695 return TilingPattern; 7696}(); 7697 7698exports.TilingPattern = TilingPattern; 7699 7700/***/ }), 7701/* 10 */ 7702/***/ (function(module, exports, __w_pdfjs_require__) { 7703 7704"use strict"; 7705 7706 7707Object.defineProperty(exports, "__esModule", { 7708 value: true 7709}); 7710exports.GlobalWorkerOptions = void 0; 7711const GlobalWorkerOptions = Object.create(null); 7712exports.GlobalWorkerOptions = GlobalWorkerOptions; 7713GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort; 7714GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc; 7715 7716/***/ }), 7717/* 11 */ 7718/***/ (function(module, exports, __w_pdfjs_require__) { 7719 7720"use strict"; 7721 7722 7723Object.defineProperty(exports, "__esModule", { 7724 value: true 7725}); 7726exports.MessageHandler = void 0; 7727 7728var _util = __w_pdfjs_require__(2); 7729 7730const CallbackKind = { 7731 UNKNOWN: 0, 7732 DATA: 1, 7733 ERROR: 2 7734}; 7735const StreamKind = { 7736 UNKNOWN: 0, 7737 CANCEL: 1, 7738 CANCEL_COMPLETE: 2, 7739 CLOSE: 3, 7740 ENQUEUE: 4, 7741 ERROR: 5, 7742 PULL: 6, 7743 PULL_COMPLETE: 7, 7744 START_COMPLETE: 8 7745}; 7746 7747function wrapReason(reason) { 7748 if (typeof reason !== "object" || reason === null) { 7749 return reason; 7750 } 7751 7752 switch (reason.name) { 7753 case "AbortException": 7754 return new _util.AbortException(reason.message); 7755 7756 case "MissingPDFException": 7757 return new _util.MissingPDFException(reason.message); 7758 7759 case "UnexpectedResponseException": 7760 return new _util.UnexpectedResponseException(reason.message, reason.status); 7761 7762 case "UnknownErrorException": 7763 return new _util.UnknownErrorException(reason.message, reason.details); 7764 7765 default: 7766 return new _util.UnknownErrorException(reason.message, reason.toString()); 7767 } 7768} 7769 7770class MessageHandler {
7771 constructor(sourceName, targetName, comObj) { 7772 this.sourceName = sourceName; 7773 this.targetName = targetName; 7774 this.comObj = comObj; 7775 this.callbackId = 1; 7776 this.streamId = 1; 7777 this.postMessageTransfers = true; 7778 this.streamSinks = Object.create(null); 7779 this.streamControllers = Object.create(null); 7780 this.callbackCapabilities = Object.create(null); 7781 this.actionHandler = Object.create(null); 7782 7783 this._onComObjOnMessage = event => { 7784 const data = event.data; 7785 7786 if (data.targetName !== this.sourceName) { 7787 return; 7788 } 7789 7790 if (data.stream) { 7791 this._processStreamMessage(data); 7792 7793 return; 7794 } 7795 7796 if (data.callback) { 7797 const callbackId = data.callbackId; 7798 const capability = this.callbackCapabilities[callbackId]; 7799 7800 if (!capability) { 7801 throw new Error(`Cannot resolve callback ${callbackId}`); 7802 } 7803 7804 delete this.callbackCapabilities[callbackId]; 7805 7806 if (data.callback === CallbackKind.DATA) { 7807 capability.resolve(data.data); 7808 } else if (data.callback === CallbackKind.ERROR) { 7809 capability.reject(wrapReason(data.reason)); 7810 } else { 7811 throw new Error("Unexpected callback case"); 7812 } 7813 7814 return; 7815 } 7816 7817 const action = this.actionHandler[data.action]; 7818 7819 if (!action) { 7820 throw new Error(`Unknown action from worker: ${data.action}`); 7821 } 7822 7823 if (data.callbackId) { 7824 const cbSourceName = this.sourceName; 7825 const cbTargetName = data.sourceName; 7826 new Promise(function (resolve) { 7827 resolve(action(data.data)); 7828 }).then(function (result) { 7829 comObj.postMessage({ 7830 sourceName: cbSourceName, 7831 targetName: cbTargetName, 7832 callback: CallbackKind.DATA, 7833 callbackId: data.callbackId, 7834 data: result 7835 }); 7836 }, function (reason) { 7837 comObj.postMessage({ 7838 sourceName: cbSourceName, 7839 targetName: cbTargetName, 7840 callback: CallbackKind.ERROR, 7841 callbackId: data.callbackId, 7842 reason: wrapReason(reason) 7843 }); 7844 }); 7845 return; 7846 } 7847 7848 if (data.streamId) { 7849 this._createStreamSink(data); 7850 7851 return; 7852 } 7853 7854 action(data.data); 7855 }; 7856 7857 comObj.addEventListener("message", this._onComObjOnMessage); 7858 } 7859 7860 on(actionName, handler) { 7861 const ah = this.actionHandler; 7862 7863 if (ah[actionName]) { 7864 throw new Error(`There is already an actionName called "${actionName}"`); 7865 } 7866 7867 ah[actionName] = handler; 7868 } 7869 7870 send(actionName, data, transfers) { 7871 this._postMessage({ 7872 sourceName: this.sourceName, 7873 targetName: this.targetName, 7874 action: actionName, 7875 data 7876 }, transfers); 7877 } 7878 7879 sendWithPromise(actionName, data, transfers) { 7880 const callbackId = this.callbackId++; 7881 const capability = (0, _util.createPromiseCapability)(); 7882 this.callbackCapabilities[callbackId] = capability; 7883 7884 try { 7885 this._postMessage({ 7886 sourceName: this.sourceName, 7887 targetName: this.targetName, 7888 action: actionName, 7889 callbackId, 7890 data 7891 }, transfers); 7892 } catch (ex) { 7893 capability.reject(ex); 7894 } 7895 7896 return capability.promise; 7897 } 7898 7899 sendWithStream(actionName, data, queueingStrategy, transfers) { 7900 const streamId = this.streamId++; 7901 const sourceName = this.sourceName; 7902 const targetName = this.targetName; 7903 const comObj = this.comObj; 7904 return new ReadableStream({ 7905 start: controller => { 7906 const startCapability = (0, _util.createPromiseCapability)(); 7907 this.streamControllers[streamId] = { 7908 controller, 7909 startCall: startCapability, 7910 pullCall: null, 7911 cancelCall: null, 7912 isClosed: false 7913 }; 7914 7915 this._postMessage({ 7916 sourceName, 7917 targetName, 7918 action: actionName, 7919 streamId, 7920 data, 7921 desiredSize: controller.desiredSize 7922 }, transfers); 7923 7924 return startCapability.promise; 7925 }, 7926 pull: controller => { 7927 const pullCapability = (0, _util.createPromiseCapability)(); 7928 this.streamControllers[streamId].pullCall = pullCapability; 7929 comObj.postMessage({ 7930 sourceName, 7931 targetName, 7932 stream: StreamKind.PULL, 7933 streamId, 7934 desiredSize: controller.desiredSize 7935 }); 7936 return pullCapability.promise; 7937 }, 7938 cancel: reason => { 7939 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 7940 const cancelCapability = (0, _util.createPromiseCapability)(); 7941 this.streamControllers[streamId].cancelCall = cancelCapability; 7942 this.streamControllers[streamId].isClosed = true; 7943 comObj.postMessage({ 7944 sourceName, 7945 targetName, 7946 stream: StreamKind.CANCEL, 7947 streamId, 7948 reason: wrapReason(reason) 7949 }); 7950 return cancelCapability.promise; 7951 } 7952 }, queueingStrategy); 7953 } 7954 7955 _createStreamSink(data) { 7956 const self = this; 7957 const action = this.actionHandler[data.action]; 7958 const streamId = data.streamId; 7959 const sourceName = this.sourceName; 7960 const targetName = data.sourceName; 7961 const comObj = this.comObj; 7962 const streamSink = { 7963 enqueue(chunk, size = 1, transfers) { 7964 if (this.isCancelled) { 7965 return; 7966 } 7967 7968 const lastDesiredSize = this.desiredSize; 7969 this.desiredSize -= size; 7970 7971 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 7972 this.sinkCapability = (0, _util.createPromiseCapability)(); 7973 this.ready = this.sinkCapability.promise; 7974 } 7975 7976 self._postMessage({ 7977 sourceName, 7978 targetName, 7979 stream: StreamKind.ENQUEUE, 7980 streamId, 7981 chunk 7982 }, transfers); 7983 }, 7984 7985 close() { 7986 if (this.isCancelled) { 7987 return; 7988 } 7989 7990 this.isCancelled = true; 7991 comObj.postMessage({ 7992 sourceName, 7993 targetName, 7994 stream: StreamKind.CLOSE, 7995 streamId 7996 }); 7997 delete self.streamSinks[streamId]; 7998 }, 7999 8000 error(reason) { 8001 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 8002 8003 if (this.isCancelled) { 8004 return; 8005 } 8006 8007 this.isCancelled = true; 8008 comObj.postMessage({ 8009 sourceName, 8010 targetName, 8011 stream: StreamKind.ERROR, 8012 streamId, 8013 reason: wrapReason(reason) 8014 }); 8015 }, 8016 8017 sinkCapability: (0, _util.createPromiseCapability)(), 8018 onPull: null, 8019 onCancel: null, 8020 isCancelled: false, 8021 desiredSize: data.desiredSize, 8022 ready: null 8023 }; 8024 streamSink.sinkCapability.resolve(); 8025 streamSink.ready = streamSink.sinkCapability.promise; 8026 this.streamSinks[streamId] = streamSink; 8027 new Promise(function (resolve) { 8028 resolve(action(data.data, streamSink)); 8029 }).then(function () { 8030 comObj.postMessage({ 8031 sourceName, 8032 targetName, 8033 stream: StreamKind.START_COMPLETE, 8034 streamId, 8035 success: true 8036 }); 8037 }, function (reason) { 8038 comObj.postMessage({ 8039 sourceName, 8040 targetName, 8041 stream: StreamKind.START_COMPLETE, 8042 streamId, 8043 reason: wrapReason(reason) 8044 }); 8045 }); 8046 } 8047 8048 _processStreamMessage(data) { 8049 const streamId = data.streamId; 8050 const sourceName = this.sourceName; 8051 const targetName = data.sourceName; 8052 const comObj = this.comObj; 8053 8054 switch (data.stream) { 8055 case StreamKind.START_COMPLETE: 8056 if (data.success) { 8057 this.streamControllers[streamId].startCall.resolve(); 8058 } else { 8059 this.streamControllers[streamId].startCall.reject(wrapReason(data.reason)); 8060 } 8061 8062 break; 8063 8064 case StreamKind.PULL_COMPLETE: 8065 if (data.success) { 8066 this.streamControllers[streamId].pullCall.resolve(); 8067 } else { 8068 this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason)); 8069 } 8070 8071 break; 8072 8073 case StreamKind.PULL: 8074 if (!this.streamSinks[streamId]) { 8075 comObj.postMessage({ 8076 sourceName, 8077 targetName, 8078 stream: StreamKind.PULL_COMPLETE, 8079 streamId, 8080 success: true 8081 }); 8082 break; 8083 } 8084 8085 if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) { 8086 this.streamSinks[streamId].sinkCapability.resolve(); 8087 } 8088 8089 this.streamSinks[streamId].desiredSize = data.desiredSize; 8090 const { 8091 onPull 8092 } = this.streamSinks[data.streamId]; 8093 new Promise(function (resolve) { 8094 resolve(onPull && onPull()); 8095 }).then(function () { 8096 comObj.postMessage({ 8097 sourceName, 8098 targetName, 8099 stream: StreamKind.PULL_COMPLETE, 8100 streamId, 8101 success: true 8102 }); 8103 }, function (reason) { 8104 comObj.postMessage({ 8105 sourceName, 8106 targetName, 8107 stream: StreamKind.PULL_COMPLETE, 8108 streamId, 8109 reason: wrapReason(reason) 8110 }); 8111 }); 8112 break; 8113 8114 case StreamKind.ENQUEUE: 8115 (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller"); 8116 8117 if (this.streamControllers[streamId].isClosed) { 8118 break; 8119 } 8120 8121 this.streamControllers[streamId].controller.enqueue(data.chunk); 8122 break; 8123 8124 case StreamKind.CLOSE: 8125 (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller"); 8126 8127 if (this.streamControllers[streamId].isClosed) { 8128 break; 8129 } 8130 8131 this.streamControllers[streamId].isClosed = true; 8132 this.streamControllers[streamId].controller.close(); 8133 8134 this._deleteStreamController(streamId); 8135 8136 break; 8137 8138 case StreamKind.ERROR: 8139 (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller"); 8140 this.streamControllers[streamId].controller.error(wrapReason(data.reason)); 8141 8142 this._deleteStreamController(streamId); 8143 8144 break; 8145 8146 case StreamKind.CANCEL_COMPLETE: 8147 if (data.success) { 8148 this.streamControllers[streamId].cancelCall.resolve(); 8149 } else { 8150 this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason)); 8151 } 8152 8153 this._deleteStreamController(streamId); 8154 8155 break; 8156 8157 case StreamKind.CANCEL: 8158 if (!this.streamSinks[streamId]) { 8159 break; 8160 } 8161 8162 const { 8163 onCancel 8164 } = this.streamSinks[data.streamId]; 8165 new Promise(function (resolve) { 8166 resolve(onCancel && onCancel(wrapReason(data.reason))); 8167 }).then(function () { 8168 comObj.postMessage({ 8169 sourceName, 8170 targetName, 8171 stream: StreamKind.CANCEL_COMPLETE, 8172 streamId, 8173 success: true 8174 }); 8175 }, function (reason) { 8176 comObj.postMessage({ 8177 sourceName, 8178 targetName, 8179 stream: StreamKind.CANCEL_COMPLETE, 8180 streamId, 8181 reason: wrapReason(reason) 8182 }); 8183 }); 8184 this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason)); 8185 this.streamSinks[streamId].isCancelled = true; 8186 delete this.streamSinks[streamId]; 8187 break; 8188 8189 default: 8190 throw new Error("Unexpected stream case"); 8191 } 8192 } 8193 8194 async _deleteStreamController(streamId) { 8195 await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) { 8196 return capability && capability.promise; 8197 })); 8198 delete this.streamControllers[streamId]; 8199 } 8200 8201 _postMessage(message, transfers) { 8202 if (transfers && this.postMessageTransfers) { 8203 this.comObj.postMessage(message, transfers); 8204 } else { 8205 this.comObj.postMessage(message); 8206 } 8207 } 8208 8209 destroy() { 8210 this.comObj.removeEventListener("message", this._onComObjOnMessage); 8211 } 8212 8213} 8214 8215exports.MessageHandler = MessageHandler; 8216 8217/***/ }), 8218/* 12 */ 8219/***/ (function(module, exports, __w_pdfjs_require__) { 8220 8221"use strict"; 8222 8223 8224Object.defineProperty(exports, "__esModule", { 8225 value: true 8226}); 8227exports.Metadata = void 0; 8228 8229var _util = __w_pdfjs_require__(2); 8230 8231var _xml_parser = __w_pdfjs_require__(13); 8232 8233class Metadata { 8234 constructor(data) { 8235 (0, _util.assert)(typeof data === "string", "Metadata: input is not a string"); 8236 data = this._repair(data); 8237 const parser = new _xml_parser.SimpleXMLParser(); 8238 const xmlDocument = parser.parseFromString(data); 8239 this._metadataMap = new Map(); 8240 8241 if (xmlDocument) { 8242 this._parse(xmlDocument); 8243 } 8244 } 8245 8246 _repair(data) { 8247 return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { 8248 const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 8249 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 8250 }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 8251 switch (name) { 8252 case "amp": 8253 return "&"; 8254 8255 case "apos": 8256 return "'"; 8257 8258 case "gt": 8259 return ">"; 8260 8261 case "lt": 8262 return "<"; 8263 8264 case "quot": 8265 return '"'; 8266 } 8267 8268 throw new Error(`_repair: ${name} isn't defined.`); 8269 }); 8270 let chars = ""; 8271 8272 for (let i = 0, ii = bytes.length; i < ii; i += 2) {
vendor: 6,595 bytes, lines 8273-8567
8273 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 8274 8275 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 8276 chars += String.fromCharCode(code); 8277 } else { 8278 chars += "&#x" + (0x10000 + code).toString(16).substring(1) + ";"; 8279 } 8280 } 8281 8282 return ">" + chars; 8283 }); 8284 } 8285 8286 _parse(xmlDocument) { 8287 let rdf = xmlDocument.documentElement; 8288 8289 if (rdf.nodeName.toLowerCase() !== "rdf:rdf") { 8290 rdf = rdf.firstChild; 8291 8292 while (rdf && rdf.nodeName.toLowerCase() !== "rdf:rdf") { 8293 rdf = rdf.nextSibling; 8294 } 8295 } 8296 8297 const nodeName = rdf ? rdf.nodeName.toLowerCase() : null; 8298 8299 if (!rdf || nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 8300 return; 8301 } 8302 8303 const children = rdf.childNodes; 8304 8305 for (let i = 0, ii = children.length; i < ii; i++) { 8306 const desc = children[i]; 8307 8308 if (desc.nodeName.toLowerCase() !== "rdf:description") { 8309 continue; 8310 } 8311 8312 for (let j = 0, jj = desc.childNodes.length; j < jj; j++) { 8313 if (desc.childNodes[j].nodeName.toLowerCase() !== "#text") { 8314 const entry = desc.childNodes[j]; 8315 const name = entry.nodeName.toLowerCase(); 8316 8317 this._metadataMap.set(name, entry.textContent.trim()); 8318 } 8319 } 8320 } 8321 } 8322 8323 get(name) { 8324 return this._metadataMap.has(name) ? this._metadataMap.get(name) : null; 8325 } 8326 8327 getAll() { 8328 const obj = Object.create(null); 8329 8330 for (const [key, value] of this._metadataMap) { 8331 obj[key] = value; 8332 } 8333 8334 return obj; 8335 } 8336 8337 has(name) { 8338 return this._metadataMap.has(name); 8339 } 8340 8341} 8342 8343exports.Metadata = Metadata; 8344 8345/***/ }), 8346/* 13 */ 8347/***/ (function(module, exports, __w_pdfjs_require__) { 8348 8349"use strict"; 8350 8351 8352Object.defineProperty(exports, "__esModule", { 8353 value: true 8354}); 8355exports.SimpleXMLParser = void 0; 8356const XMLParserErrorCode = { 8357 NoError: 0, 8358 EndOfDocument: -1, 8359 UnterminatedCdat: -2, 8360 UnterminatedXmlDeclaration: -3, 8361 UnterminatedDoctypeDeclaration: -4, 8362 UnterminatedComment: -5, 8363 MalformedElement: -6, 8364 OutOfMemory: -7, 8365 UnterminatedAttributeValue: -8, 8366 UnterminatedElement: -9, 8367 ElementNeverBegun: -10 8368}; 8369 8370function isWhitespace(s, index) { 8371 const ch = s[index]; 8372 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 8373} 8374 8375function isWhitespaceString(s) { 8376 for (let i = 0, ii = s.length; i < ii; i++) { 8377 if (!isWhitespace(s, i)) { 8378 return false; 8379 } 8380 } 8381 8382 return true; 8383} 8384 8385class XMLParserBase { 8386 _resolveEntities(s) { 8387 return s.replace(/&([^;]+);/g, (all, entity) => { 8388 if (entity.substring(0, 2) === "#x") { 8389 return String.fromCharCode(parseInt(entity.substring(2), 16)); 8390 } else if (entity.substring(0, 1) === "#") { 8391 return String.fromCharCode(parseInt(entity.substring(1), 10)); 8392 } 8393 8394 switch (entity) { 8395 case "lt": 8396 return "<"; 8397 8398 case "gt": 8399 return ">"; 8400 8401 case "amp": 8402 return "&"; 8403 8404 case "quot": 8405 return '"'; 8406 } 8407 8408 return this.onResolveEntity(entity); 8409 }); 8410 } 8411 8412 _parseContent(s, start) { 8413 const attributes = []; 8414 let pos = start; 8415 8416 function skipWs() { 8417 while (pos < s.length && isWhitespace(s, pos)) { 8418 ++pos; 8419 } 8420 } 8421 8422 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 8423 ++pos; 8424 } 8425 8426 const name = s.substring(start, pos); 8427 skipWs(); 8428 8429 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 8430 skipWs(); 8431 let attrName = "", 8432 attrValue = ""; 8433 8434 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 8435 attrName += s[pos]; 8436 ++pos; 8437 } 8438 8439 skipWs(); 8440 8441 if (s[pos] !== "=") { 8442 return null; 8443 } 8444 8445 ++pos; 8446 skipWs(); 8447 const attrEndChar = s[pos]; 8448 8449 if (attrEndChar !== '"' && attrEndChar !== "'") { 8450 return null; 8451 } 8452 8453 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 8454 8455 if (attrEndIndex < 0) { 8456 return null; 8457 } 8458 8459 attrValue = s.substring(pos, attrEndIndex); 8460 attributes.push({ 8461 name: attrName, 8462 value: this._resolveEntities(attrValue) 8463 }); 8464 pos = attrEndIndex + 1; 8465 skipWs(); 8466 } 8467 8468 return { 8469 name, 8470 attributes, 8471 parsed: pos - start 8472 }; 8473 } 8474 8475 _parseProcessingInstruction(s, start) { 8476 let pos = start; 8477 8478 function skipWs() { 8479 while (pos < s.length && isWhitespace(s, pos)) { 8480 ++pos; 8481 } 8482 } 8483 8484 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 8485 ++pos; 8486 } 8487 8488 const name = s.substring(start, pos); 8489 skipWs(); 8490 const attrStart = pos; 8491 8492 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 8493 ++pos; 8494 } 8495 8496 const value = s.substring(attrStart, pos); 8497 return { 8498 name, 8499 value, 8500 parsed: pos - start 8501 }; 8502 } 8503 8504 parseXml(s) { 8505 let i = 0; 8506 8507 while (i < s.length) { 8508 const ch = s[i]; 8509 let j = i; 8510 8511 if (ch === "<") { 8512 ++j; 8513 const ch2 = s[j]; 8514 let q; 8515 8516 switch (ch2) { 8517 case "/": 8518 ++j; 8519 q = s.indexOf(">", j); 8520 8521 if (q < 0) { 8522 this.onError(XMLParserErrorCode.UnterminatedElement); 8523 return; 8524 } 8525 8526 this.onEndElement(s.substring(j, q)); 8527 j = q + 1; 8528 break; 8529 8530 case "?": 8531 ++j; 8532 8533 const pi = this._parseProcessingInstruction(s, j); 8534 8535 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 8536 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 8537 return; 8538 } 8539 8540 this.onPi(pi.name, pi.value); 8541 j += pi.parsed + 2; 8542 break; 8543 8544 case "!": 8545 if (s.substring(j + 1, j + 3) === "--") { 8546 q = s.indexOf("-->", j + 3); 8547 8548 if (q < 0) { 8549 this.onError(XMLParserErrorCode.UnterminatedComment); 8550 return; 8551 } 8552 8553 this.onComment(s.substring(j + 3, q)); 8554 j = q + 3; 8555 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 8556 q = s.indexOf("]]>", j + 8); 8557 8558 if (q < 0) { 8559 this.onError(XMLParserErrorCode.UnterminatedCdat); 8560 return; 8561 } 8562 8563 this.onCdata(s.substring(j + 8, q)); 8564 j = q + 3; 8565 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 8566 const q2 = s.indexOf("[", j + 8); 8567 let complexDoctype = false;
8568 q = s.indexOf(">", j + 8); 8569 8570 if (q < 0) { 8571 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 8572 return; 8573 } 8574 8575 if (q2 > 0 && q > q2) { 8576 q = s.indexOf("]>", j + 8); 8577 8578 if (q < 0) { 8579 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 8580 return; 8581 } 8582 8583 complexDoctype = true; 8584 } 8585 8586 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 8587 this.onDoctype(doctypeContent); 8588 j = q + (complexDoctype ? 2 : 1); 8589 } else { 8590 this.onError(XMLParserErrorCode.MalformedElement); 8591 return; 8592 } 8593 8594 break; 8595 8596 default: 8597 const content = this._parseContent(s, j); 8598 8599 if (content === null) { 8600 this.onError(XMLParserErrorCode.MalformedElement); 8601 return; 8602 } 8603 8604 let isClosed = false; 8605 8606 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 8607 isClosed = true; 8608 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 8609 this.onError(XMLParserErrorCode.UnterminatedElement); 8610 return; 8611 } 8612 8613 this.onBeginElement(content.name, content.attributes, isClosed); 8614 j += content.parsed + (isClosed ? 2 : 1); 8615 break; 8616 } 8617 } else { 8618 while (j < s.length && s[j] !== "<") { 8619 j++; 8620 } 8621 8622 const text = s.substring(i, j); 8623 this.onText(this._resolveEntities(text)); 8624 } 8625 8626 i = j; 8627 } 8628 } 8629 8630 onResolveEntity(name) { 8631 return `&${name};`; 8632 } 8633 8634 onPi(name, value) {} 8635 8636 onComment(text) {} 8637 8638 onCdata(text) {} 8639 8640 onDoctype(doctypeContent) {} 8641 8642 onText(text) {} 8643 8644 onBeginElement(name, attributes, isEmpty) {} 8645 8646 onEndElement(name) {} 8647 8648 onError(code) {} 8649 8650} 8651 8652class SimpleDOMNode { 8653 constructor(nodeName, nodeValue) { 8654 this.nodeName = nodeName; 8655 this.nodeValue = nodeValue; 8656 Object.defineProperty(this, "parentNode", { 8657 value: null, 8658 writable: true 8659 }); 8660 } 8661 8662 get firstChild() { 8663 return this.childNodes && this.childNodes[0]; 8664 } 8665 8666 get nextSibling() { 8667 const childNodes = this.parentNode.childNodes; 8668 8669 if (!childNodes) { 8670 return undefined; 8671 } 8672 8673 const index = childNodes.indexOf(this); 8674 8675 if (index === -1) { 8676 return undefined; 8677 } 8678 8679 return childNodes[index + 1]; 8680 } 8681 8682 get textContent() { 8683 if (!this.childNodes) { 8684 return this.nodeValue || ""; 8685 } 8686 8687 return this.childNodes.map(function (child) { 8688 return child.textContent; 8689 }).join(""); 8690 } 8691 8692 hasChildNodes() { 8693 return this.childNodes && this.childNodes.length > 0; 8694 } 8695 8696} 8697 8698class SimpleXMLParser extends XMLParserBase { 8699 constructor() { 8700 super(); 8701 this._currentFragment = null; 8702 this._stack = null; 8703 this._errorCode = XMLParserErrorCode.NoError; 8704 } 8705 8706 parseFromString(data) { 8707 this._currentFragment = []; 8708 this._stack = []; 8709 this._errorCode = XMLParserErrorCode.NoError; 8710 this.parseXml(data); 8711 8712 if (this._errorCode !== XMLParserErrorCode.NoError) { 8713 return undefined; 8714 } 8715 8716 const [documentElement] = this._currentFragment; 8717 8718 if (!documentElement) { 8719 return undefined; 8720 } 8721 8722 return { 8723 documentElement 8724 }; 8725 } 8726 8727 onResolveEntity(name) { 8728 switch (name) { 8729 case "apos": 8730 return "'"; 8731 } 8732 8733 return super.onResolveEntity(name); 8734 } 8735 8736 onText(text) { 8737 if (isWhitespaceString(text)) { 8738 return; 8739 } 8740 8741 const node = new SimpleDOMNode("#text", text); 8742 8743 this._currentFragment.push(node); 8744 } 8745 8746 onCdata(text) { 8747 const node = new SimpleDOMNode("#text", text); 8748 8749 this._currentFragment.push(node); 8750 } 8751 8752 onBeginElement(name, attributes, isEmpty) { 8753 const node = new SimpleDOMNode(name); 8754 node.childNodes = []; 8755 8756 this._currentFragment.push(node); 8757 8758 if (isEmpty) { 8759 return; 8760 } 8761 8762 this._stack.push(this._currentFragment); 8763 8764 this._currentFragment = node.childNodes; 8765 } 8766 8767 onEndElement(name) { 8768 this._currentFragment = this._stack.pop() || []; 8769 const lastElement = this._currentFragment[this._currentFragment.length - 1]; 8770 8771 if (!lastElement) { 8772 return; 8773 } 8774 8775 for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) { 8776 lastElement.childNodes[i].parentNode = lastElement; 8777 } 8778 } 8779 8780 onError(code) { 8781 this._errorCode = code; 8782 } 8783 8784} 8785 8786exports.SimpleXMLParser = SimpleXMLParser; 8787 8788/***/ }), 8789/* 14 */ 8790/***/ (function(module, exports, __w_pdfjs_require__) { 8791 8792"use strict"; 8793 8794 8795Object.defineProperty(exports, "__esModule", { 8796 value: true 8797}); 8798exports.PDFDataTransportStream = void 0; 8799 8800var _util = __w_pdfjs_require__(2); 8801 8802class PDFDataTransportStream { 8803 constructor(params, pdfDataRangeTransport) { 8804 (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'); 8805 this._queuedChunks = []; 8806 this._progressiveDone = params.progressiveDone || false; 8807 const initialData = params.initialData; 8808 8809 if (initialData && initialData.length > 0) { 8810 const buffer = new Uint8Array(initialData).buffer; 8811 8812 this._queuedChunks.push(buffer); 8813 } 8814 8815 this._pdfDataRangeTransport = pdfDataRangeTransport; 8816 this._isStreamingSupported = !params.disableStream; 8817 this._isRangeSupported = !params.disableRange; 8818 this._contentLength = params.length; 8819 this._fullRequestReader = null; 8820 this._rangeReaders = []; 8821 8822 this._pdfDataRangeTransport.addRangeListener((begin, chunk) => { 8823 this._onReceiveData({ 8824 begin, 8825 chunk 8826 }); 8827 }); 8828 8829 this._pdfDataRangeTransport.addProgressListener((loaded, total) => { 8830 this._onProgress({ 8831 loaded, 8832 total 8833 }); 8834 }); 8835 8836 this._pdfDataRangeTransport.addProgressiveReadListener(chunk => { 8837 this._onReceiveData({ 8838 chunk 8839 }); 8840 }); 8841 8842 this._pdfDataRangeTransport.addProgressiveDoneListener(() => { 8843 this._onProgressiveDone(); 8844 }); 8845 8846 this._pdfDataRangeTransport.transportReady(); 8847 } 8848 8849 _onReceiveData(args) { 8850 const buffer = new Uint8Array(args.chunk).buffer; 8851 8852 if (args.begin === undefined) { 8853 if (this._fullRequestReader) { 8854 this._fullRequestReader._enqueue(buffer); 8855 } else { 8856 this._queuedChunks.push(buffer); 8857 } 8858 } else { 8859 const found = this._rangeReaders.some(function (rangeReader) { 8860 if (rangeReader._begin !== args.begin) { 8861 return false;
8862 } 8863 8864 rangeReader._enqueue(buffer); 8865 8866 return true; 8867 }); 8868 8869 (0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."); 8870 } 8871 } 8872 8873 get _progressiveDataLength() { 8874 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 8875 } 8876 8877 _onProgress(evt) { 8878 if (evt.total === undefined) { 8879 const firstReader = this._rangeReaders[0]; 8880 8881 if (firstReader && firstReader.onProgress) { 8882 firstReader.onProgress({ 8883 loaded: evt.loaded 8884 }); 8885 } 8886 } else { 8887 const fullReader = this._fullRequestReader; 8888 8889 if (fullReader && fullReader.onProgress) { 8890 fullReader.onProgress({ 8891 loaded: evt.loaded, 8892 total: evt.total 8893 }); 8894 } 8895 } 8896 } 8897 8898 _onProgressiveDone() { 8899 if (this._fullRequestReader) { 8900 this._fullRequestReader.progressiveDone(); 8901 } 8902 8903 this._progressiveDone = true; 8904 } 8905 8906 _removeRangeReader(reader) { 8907 const i = this._rangeReaders.indexOf(reader); 8908 8909 if (i >= 0) { 8910 this._rangeReaders.splice(i, 1); 8911 } 8912 } 8913 8914 getFullReader() { 8915 (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once."); 8916 const queuedChunks = this._queuedChunks; 8917 this._queuedChunks = null; 8918 return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone); 8919 } 8920 8921 getRangeReader(begin, end) { 8922 if (end <= this._progressiveDataLength) { 8923 return null; 8924 } 8925 8926 const reader = new PDFDataTransportStreamRangeReader(this, begin, end); 8927 8928 this._pdfDataRangeTransport.requestDataRange(begin, end); 8929 8930 this._rangeReaders.push(reader); 8931 8932 return reader; 8933 } 8934 8935 cancelAllRequests(reason) { 8936 if (this._fullRequestReader) { 8937 this._fullRequestReader.cancel(reason); 8938 } 8939 8940 const readers = this._rangeReaders.slice(0); 8941 8942 readers.forEach(function (rangeReader) { 8943 rangeReader.cancel(reason); 8944 }); 8945 8946 this._pdfDataRangeTransport.abort(); 8947 } 8948 8949} 8950 8951exports.PDFDataTransportStream = PDFDataTransportStream; 8952 8953class PDFDataTransportStreamReader { 8954 constructor(stream, queuedChunks, progressiveDone = false) { 8955 this._stream = stream; 8956 this._done = progressiveDone || false; 8957 this._filename = null; 8958 this._queuedChunks = queuedChunks || []; 8959 this._loaded = 0; 8960 8961 for (const chunk of this._queuedChunks) { 8962 this._loaded += chunk.byteLength; 8963 } 8964 8965 this._requests = []; 8966 this._headersReady = Promise.resolve(); 8967 stream._fullRequestReader = this; 8968 this.onProgress = null; 8969 } 8970 8971 _enqueue(chunk) { 8972 if (this._done) { 8973 return; 8974 } 8975 8976 if (this._requests.length > 0) { 8977 const requestCapability = this._requests.shift(); 8978 8979 requestCapability.resolve({ 8980 value: chunk, 8981 done: false 8982 }); 8983 } else { 8984 this._queuedChunks.push(chunk); 8985 } 8986 8987 this._loaded += chunk.byteLength; 8988 } 8989 8990 get headersReady() { 8991 return this._headersReady; 8992 } 8993 8994 get filename() { 8995 return this._filename; 8996 } 8997 8998 get isRangeSupported() { 8999 return this._stream._isRangeSupported; 9000 } 9001 9002 get isStreamingSupported() { 9003 return this._stream._isStreamingSupported; 9004 } 9005 9006 get contentLength() { 9007 return this._stream._contentLength; 9008 } 9009 9010 async read() { 9011 if (this._queuedChunks.length > 0) { 9012 const chunk = this._queuedChunks.shift(); 9013 9014 return { 9015 value: chunk, 9016 done: false 9017 }; 9018 } 9019 9020 if (this._done) { 9021 return { 9022 value: undefined, 9023 done: true 9024 }; 9025 } 9026 9027 const requestCapability = (0, _util.createPromiseCapability)(); 9028 9029 this._requests.push(requestCapability); 9030 9031 return requestCapability.promise; 9032 } 9033 9034 cancel(reason) { 9035 this._done = true; 9036 9037 this._requests.forEach(function (requestCapability) { 9038 requestCapability.resolve({ 9039 value: undefined, 9040 done: true 9041 }); 9042 }); 9043 9044 this._requests = []; 9045 } 9046 9047 progressiveDone() { 9048 if (this._done) { 9049 return; 9050 } 9051 9052 this._done = true; 9053 } 9054 9055} 9056 9057class PDFDataTransportStreamRangeReader { 9058 constructor(stream, begin, end) { 9059 this._stream = stream; 9060 this._begin = begin; 9061 this._end = end; 9062 this._queuedChunk = null; 9063 this._requests = []; 9064 this._done = false;
9065 this.onProgress = null; 9066 } 9067 9068 _enqueue(chunk) { 9069 if (this._done) { 9070 return; 9071 } 9072 9073 if (this._requests.length === 0) { 9074 this._queuedChunk = chunk; 9075 } else { 9076 const requestsCapability = this._requests.shift(); 9077 9078 requestsCapability.resolve({ 9079 value: chunk, 9080 done: false 9081 }); 9082 9083 this._requests.forEach(function (requestCapability) { 9084 requestCapability.resolve({ 9085 value: undefined, 9086 done: true 9087 }); 9088 }); 9089 9090 this._requests = []; 9091 } 9092 9093 this._done = true; 9094 9095 this._stream._removeRangeReader(this); 9096 } 9097 9098 get isStreamingSupported() { 9099 return false; 9100 } 9101 9102 async read() { 9103 if (this._queuedChunk) { 9104 const chunk = this._queuedChunk; 9105 this._queuedChunk = null; 9106 return { 9107 value: chunk, 9108 done: false 9109 }; 9110 } 9111 9112 if (this._done) { 9113 return { 9114 value: undefined, 9115 done: true 9116 }; 9117 } 9118 9119 const requestCapability = (0, _util.createPromiseCapability)(); 9120 9121 this._requests.push(requestCapability); 9122 9123 return requestCapability.promise; 9124 } 9125 9126 cancel(reason) { 9127 this._done = true; 9128 9129 this._requests.forEach(function (requestCapability) { 9130 requestCapability.resolve({ 9131 value: undefined, 9132 done: true 9133 }); 9134 }); 9135 9136 this._requests = []; 9137 9138 this._stream._removeRangeReader(this); 9139 } 9140 9141} 9142 9143/***/ }), 9144/* 15 */ 9145/***/ (function(module, exports, __w_pdfjs_require__) { 9146 9147"use strict"; 9148 9149 9150Object.defineProperty(exports, "__esModule", { 9151 value: true 9152}); 9153exports.WebGLContext = void 0; 9154 9155var _util = __w_pdfjs_require__(2); 9156 9157class WebGLContext { 9158 constructor({ 9159 enable = false 9160 }) { 9161 this._enabled = enable === true; 9162 } 9163 9164 get isEnabled() { 9165 let enabled = this._enabled; 9166 9167 if (enabled) { 9168 enabled = WebGLUtils.tryInitGL(); 9169 } 9170 9171 return (0, _util.shadow)(this, "isEnabled", enabled); 9172 } 9173 9174 composeSMask({ 9175 layer, 9176 mask, 9177 properties 9178 }) { 9179 return WebGLUtils.composeSMask(layer, mask, properties); 9180 } 9181 9182 drawFigures({ 9183 width, 9184 height, 9185 backgroundColor, 9186 figures, 9187 context 9188 }) { 9189 return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); 9190 } 9191 9192 clear() { 9193 WebGLUtils.cleanup(); 9194 } 9195 9196} 9197 9198exports.WebGLContext = WebGLContext; 9199 9200var WebGLUtils = function WebGLUtilsClosure() { 9201 function loadShader(gl, code, shaderType) { 9202 var shader = gl.createShader(shaderType); 9203 gl.shaderSource(shader, code); 9204 gl.compileShader(shader); 9205 var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); 9206 9207 if (!compiled) { 9208 var errorMsg = gl.getShaderInfoLog(shader); 9209 throw new Error("Error during shader compilation: " + errorMsg); 9210 } 9211 9212 return shader; 9213 } 9214 9215 function createVertexShader(gl, code) { 9216 return loadShader(gl, code, gl.VERTEX_SHADER); 9217 } 9218 9219 function createFragmentShader(gl, code) { 9220 return loadShader(gl, code, gl.FRAGMENT_SHADER); 9221 } 9222 9223 function createProgram(gl, shaders) { 9224 var program = gl.createProgram(); 9225 9226 for (var i = 0, ii = shaders.length; i < ii; ++i) { 9227 gl.attachShader(program, shaders[i]); 9228 } 9229 9230 gl.linkProgram(program); 9231 var linked = gl.getProgramParameter(program, gl.LINK_STATUS); 9232 9233 if (!linked) { 9234 var errorMsg = gl.getProgramInfoLog(program); 9235 throw new Error("Error during program linking: " + errorMsg); 9236 } 9237 9238 return program; 9239 } 9240 9241 function createTexture(gl, image, textureId) { 9242 gl.activeTexture(textureId); 9243 var texture = gl.createTexture(); 9244 gl.bindTexture(gl.TEXTURE_2D, texture); 9245 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); 9246 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); 9247 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); 9248 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); 9249 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); 9250 return texture; 9251 } 9252 9253 var currentGL, currentCanvas; 9254 9255 function generateGL() { 9256 if (currentGL) { 9257 return; 9258 } 9259 9260 currentCanvas = document.createElement("canvas"); 9261 currentGL = currentCanvas.getContext("webgl", { 9262 premultipliedalpha: false 9263 }); 9264 } 9265 9266 var smaskVertexShaderCode = "\ 9267 attribute vec2 a_position; \ 9268 attribute vec2 a_texCoord; \ 9269 \ 9270 uniform vec2 u_resolution; \ 9271 \ 9272 varying vec2 v_texCoord; \ 9273 \ 9274 void main() { \ 9275 vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ 9276 gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ 9277 \ 9278 v_texCoord = a_texCoord; \ 9279 } "; 9280 var smaskFragmentShaderCode = "\ 9281 precision mediump float; \ 9282 \ 9283 uniform vec4 u_backdrop; \ 9284 uniform int u_subtype; \ 9285 uniform sampler2D u_image; \ 9286 uniform sampler2D u_mask; \ 9287 \ 9288 varying vec2 v_texCoord; \ 9289 \ 9290 void main() { \ 9291 vec4 imageColor = texture2D(u_image, v_texCoord); \ 9292 vec4 maskColor = texture2D(u_mask, v_texCoord); \ 9293 if (u_backdrop.a > 0.0) { \ 9294 maskColor.rgb = maskColor.rgb * maskColor.a + \ 9295 u_backdrop.rgb * (1.0 - maskColor.a); \ 9296 } \ 9297 float lum; \ 9298 if (u_subtype == 0) { \ 9299 lum = maskColor.a; \ 9300 } else { \ 9301 lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ 9302 maskColor.b * 0.11; \ 9303 } \ 9304 imageColor.a *= lum; \ 9305 imageColor.rgb *= imageColor.a; \ 9306 gl_FragColor = imageColor; \ 9307 } "; 9308 var smaskCache = null; 9309 9310 function initSmaskGL() { 9311 var canvas, gl; 9312 generateGL(); 9313 canvas = currentCanvas; 9314 currentCanvas = null; 9315 gl = currentGL; 9316 currentGL = null; 9317 var vertexShader = createVertexShader(gl, smaskVertexShaderCode); 9318 var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); 9319 var program = createProgram(gl, [vertexShader, fragmentShader]); 9320 gl.useProgram(program); 9321 var cache = {}; 9322 cache.gl = gl; 9323 cache.canvas = canvas; 9324 cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); 9325 cache.positionLocation = gl.getAttribLocation(program, "a_position"); 9326 cache.backdropLocation = gl.getUniformLocation(program, "u_backdrop"); 9327 cache.subtypeLocation = gl.getUniformLocation(program, "u_subtype"); 9328 var texCoordLocation = gl.getAttribLocation(program, "a_texCoord"); 9329 var texLayerLocation = gl.getUniformLocation(program, "u_image"); 9330 var texMaskLocation = gl.getUniformLocation(program, "u_mask"); 9331 var texCoordBuffer = gl.createBuffer(); 9332 gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); 9333 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); 9334 gl.enableVertexAttribArray(texCoordLocation); 9335 gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); 9336 gl.uniform1i(texLayerLocation, 0); 9337 gl.uniform1i(texMaskLocation, 1); 9338 smaskCache = cache; 9339 } 9340 9341 function composeSMask(layer, mask, properties) { 9342 var width = layer.width, 9343 height = layer.height; 9344 9345 if (!smaskCache) { 9346 initSmaskGL(); 9347 } 9348 9349 var cache = smaskCache,
vendor: 5,336 bytes, lines 9350-9481
9350 canvas = cache.canvas, 9351 gl = cache.gl; 9352 canvas.width = width; 9353 canvas.height = height; 9354 gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); 9355 gl.uniform2f(cache.resolutionLocation, width, height); 9356 9357 if (properties.backdrop) { 9358 gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); 9359 } else { 9360 gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); 9361 } 9362 9363 gl.uniform1i(cache.subtypeLocation, properties.subtype === "Luminosity" ? 1 : 0); 9364 var texture = createTexture(gl, layer, gl.TEXTURE0); 9365 var maskTexture = createTexture(gl, mask, gl.TEXTURE1); 9366 var buffer = gl.createBuffer(); 9367 gl.bindBuffer(gl.ARRAY_BUFFER, buffer); 9368 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); 9369 gl.enableVertexAttribArray(cache.positionLocation); 9370 gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); 9371 gl.clearColor(0, 0, 0, 0); 9372 gl.enable(gl.BLEND); 9373 gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); 9374 gl.clear(gl.COLOR_BUFFER_BIT); 9375 gl.drawArrays(gl.TRIANGLES, 0, 6); 9376 gl.flush(); 9377 gl.deleteTexture(texture); 9378 gl.deleteTexture(maskTexture); 9379 gl.deleteBuffer(buffer); 9380 return canvas; 9381 } 9382 9383 var figuresVertexShaderCode = "\ 9384 attribute vec2 a_position; \ 9385 attribute vec3 a_color; \ 9386 \ 9387 uniform vec2 u_resolution; \ 9388 uniform vec2 u_scale; \ 9389 uniform vec2 u_offset; \ 9390 \ 9391 varying vec4 v_color; \ 9392 \ 9393 void main() { \ 9394 vec2 position = (a_position + u_offset) * u_scale; \ 9395 vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ 9396 gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ 9397 \ 9398 v_color = vec4(a_color / 255.0, 1.0); \ 9399 } "; 9400 var figuresFragmentShaderCode = "\ 9401 precision mediump float; \ 9402 \ 9403 varying vec4 v_color; \ 9404 \ 9405 void main() { \ 9406 gl_FragColor = v_color; \ 9407 } "; 9408 var figuresCache = null; 9409 9410 function initFiguresGL() { 9411 var canvas, gl; 9412 generateGL(); 9413 canvas = currentCanvas; 9414 currentCanvas = null; 9415 gl = currentGL; 9416 currentGL = null; 9417 var vertexShader = createVertexShader(gl, figuresVertexShaderCode); 9418 var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); 9419 var program = createProgram(gl, [vertexShader, fragmentShader]); 9420 gl.useProgram(program); 9421 var cache = {}; 9422 cache.gl = gl; 9423 cache.canvas = canvas; 9424 cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); 9425 cache.scaleLocation = gl.getUniformLocation(program, "u_scale"); 9426 cache.offsetLocation = gl.getUniformLocation(program, "u_offset"); 9427 cache.positionLocation = gl.getAttribLocation(program, "a_position"); 9428 cache.colorLocation = gl.getAttribLocation(program, "a_color"); 9429 figuresCache = cache; 9430 } 9431 9432 function drawFigures(width, height, backgroundColor, figures, context) { 9433 if (!figuresCache) { 9434 initFiguresGL(); 9435 } 9436 9437 var cache = figuresCache, 9438 canvas = cache.canvas, 9439 gl = cache.gl; 9440 canvas.width = width; 9441 canvas.height = height; 9442 gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); 9443 gl.uniform2f(cache.resolutionLocation, width, height); 9444 var count = 0; 9445 var i, ii, rows; 9446 9447 for (i = 0, ii = figures.length; i < ii; i++) { 9448 switch (figures[i].type) { 9449 case "lattice": 9450 rows = figures[i].coords.length / figures[i].verticesPerRow | 0; 9451 count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; 9452 break; 9453 9454 case "triangles": 9455 count += figures[i].coords.length; 9456 break; 9457 } 9458 } 9459 9460 var coords = new Float32Array(count * 2); 9461 var colors = new Uint8Array(count * 3); 9462 var coordsMap = context.coords, 9463 colorsMap = context.colors; 9464 var pIndex = 0, 9465 cIndex = 0; 9466 9467 for (i = 0, ii = figures.length; i < ii; i++) { 9468 var figure = figures[i], 9469 ps = figure.coords, 9470 cs = figure.colors; 9471 9472 switch (figure.type) { 9473 case "lattice": 9474 var cols = figure.verticesPerRow; 9475 rows = ps.length / cols | 0; 9476 9477 for (var row = 1; row < rows; row++) { 9478 var offset = row * cols + 1; 9479 9480 for (var col = 1; col < cols; col++, offset++) { 9481 coords[pIndex] = coordsMap[ps[offset - cols - 1]];
9482 coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; 9483 coords[pIndex + 2] = coordsMap[ps[offset - cols]]; 9484 coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; 9485 coords[pIndex + 4] = coordsMap[ps[offset - 1]]; 9486 coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; 9487 colors[cIndex] = colorsMap[cs[offset - cols - 1]]; 9488 colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; 9489 colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; 9490 colors[cIndex + 3] = colorsMap[cs[offset - cols]]; 9491 colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; 9492 colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; 9493 colors[cIndex + 6] = colorsMap[cs[offset - 1]]; 9494 colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; 9495 colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; 9496 coords[pIndex + 6] = coords[pIndex + 2]; 9497 coords[pIndex + 7] = coords[pIndex + 3]; 9498 coords[pIndex + 8] = coords[pIndex + 4]; 9499 coords[pIndex + 9] = coords[pIndex + 5]; 9500 coords[pIndex + 10] = coordsMap[ps[offset]]; 9501 coords[pIndex + 11] = coordsMap[ps[offset] + 1]; 9502 colors[cIndex + 9] = colors[cIndex + 3]; 9503 colors[cIndex + 10] = colors[cIndex + 4]; 9504 colors[cIndex + 11] = colors[cIndex + 5]; 9505 colors[cIndex + 12] = colors[cIndex + 6]; 9506 colors[cIndex + 13] = colors[cIndex + 7]; 9507 colors[cIndex + 14] = colors[cIndex + 8]; 9508 colors[cIndex + 15] = colorsMap[cs[offset]]; 9509 colors[cIndex + 16] = colorsMap[cs[offset] + 1]; 9510 colors[cIndex + 17] = colorsMap[cs[offset] + 2]; 9511 pIndex += 12; 9512 cIndex += 18; 9513 } 9514 } 9515 9516 break; 9517 9518 case "triangles": 9519 for (var j = 0, jj = ps.length; j < jj; j++) { 9520 coords[pIndex] = coordsMap[ps[j]]; 9521 coords[pIndex + 1] = coordsMap[ps[j] + 1]; 9522 colors[cIndex] = colorsMap[cs[j]]; 9523 colors[cIndex + 1] = colorsMap[cs[j] + 1]; 9524 colors[cIndex + 2] = colorsMap[cs[j] + 2]; 9525 pIndex += 2; 9526 cIndex += 3; 9527 } 9528 9529 break; 9530 } 9531 } 9532 9533 if (backgroundColor) { 9534 gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); 9535 } else { 9536 gl.clearColor(0, 0, 0, 0); 9537 } 9538 9539 gl.clear(gl.COLOR_BUFFER_BIT); 9540 var coordsBuffer = gl.createBuffer(); 9541 gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); 9542 gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); 9543 gl.enableVertexAttribArray(cache.positionLocation); 9544 gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); 9545 var colorsBuffer = gl.createBuffer(); 9546 gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); 9547 gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); 9548 gl.enableVertexAttribArray(cache.colorLocation); 9549 gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); 9550 gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); 9551 gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); 9552 gl.drawArrays(gl.TRIANGLES, 0, count); 9553 gl.flush(); 9554 gl.deleteBuffer(coordsBuffer); 9555 gl.deleteBuffer(colorsBuffer); 9556 return canvas; 9557 } 9558 9559 return { 9560 tryInitGL() { 9561 try { 9562 generateGL(); 9563 return !!currentGL; 9564 } catch (ex) {} 9565 9566 return false; 9567 }, 9568 9569 composeSMask, 9570 drawFigures, 9571 9572 cleanup() { 9573 if (smaskCache && smaskCache.canvas) { 9574 smaskCache.canvas.width = 0; 9575 smaskCache.canvas.height = 0; 9576 } 9577 9578 if (figuresCache && figuresCache.canvas) { 9579 figuresCache.canvas.width = 0; 9580 figuresCache.canvas.height = 0; 9581 } 9582 9583 smaskCache = null; 9584 figuresCache = null; 9585 } 9586 9587 }; 9588}(); 9589 9590/***/ }), 9591/* 16 */ 9592/***/ (function(module, exports, __w_pdfjs_require__) { 9593 9594"use strict"; 9595 9596 9597Object.defineProperty(exports, "__esModule", { 9598 value: true 9599}); 9600exports.AnnotationLayer = void 0; 9601 9602var _display_utils = __w_pdfjs_require__(1); 9603 9604var _util = __w_pdfjs_require__(2); 9605 9606class AnnotationElementFactory { 9607 static create(parameters) { 9608 const subtype = parameters.data.annotationType; 9609 9610 switch (subtype) { 9611 case _util.AnnotationType.LINK: 9612 return new LinkAnnotationElement(parameters); 9613 9614 case _util.AnnotationType.TEXT: 9615 return new TextAnnotationElement(parameters); 9616 9617 case _util.AnnotationType.WIDGET: 9618 const fieldType = parameters.data.fieldType; 9619 9620 switch (fieldType) { 9621 case "Tx": 9622 return new TextWidgetAnnotationElement(parameters); 9623 9624 case "Btn": 9625 if (parameters.data.radioButton) { 9626 return new RadioButtonWidgetAnnotationElement(parameters); 9627 } else if (parameters.data.checkBox) { 9628 return new CheckboxWidgetAnnotationElement(parameters); 9629 } 9630 9631 return new PushButtonWidgetAnnotationElement(parameters); 9632 9633 case "Ch": 9634 return new ChoiceWidgetAnnotationElement(parameters); 9635 } 9636 9637 return new WidgetAnnotationElement(parameters); 9638 9639 case _util.AnnotationType.POPUP: 9640 return new PopupAnnotationElement(parameters); 9641 9642 case _util.AnnotationType.FREETEXT: 9643 return new FreeTextAnnotationElement(parameters); 9644 9645 case _util.AnnotationType.LINE: 9646 return new LineAnnotationElement(parameters); 9647 9648 case _util.AnnotationType.SQUARE: 9649 return new SquareAnnotationElement(parameters); 9650 9651 case _util.AnnotationType.CIRCLE: 9652 return new CircleAnnotationElement(parameters); 9653 9654 case _util.AnnotationType.POLYLINE: 9655 return new PolylineAnnotationElement(parameters); 9656 9657 case _util.AnnotationType.CARET: 9658 return new CaretAnnotationElement(parameters); 9659 9660 case _util.AnnotationType.INK: 9661 return new InkAnnotationElement(parameters); 9662 9663 case _util.AnnotationType.POLYGON: 9664 return new PolygonAnnotationElement(parameters); 9665 9666 case _util.AnnotationType.HIGHLIGHT: 9667 return new HighlightAnnotationElement(parameters); 9668 9669 case _util.AnnotationType.UNDERLINE: 9670 return new UnderlineAnnotationElement(parameters); 9671 9672 case _util.AnnotationType.SQUIGGLY: 9673 return new SquigglyAnnotationElement(parameters); 9674 9675 case _util.AnnotationType.STRIKEOUT: 9676 return new StrikeOutAnnotationElement(parameters); 9677 9678 case _util.AnnotationType.STAMP: 9679 return new StampAnnotationElement(parameters); 9680 9681 case _util.AnnotationType.FILEATTACHMENT: 9682 return new FileAttachmentAnnotationElement(parameters); 9683 9684 default: 9685 return new AnnotationElement(parameters); 9686 } 9687 } 9688 9689} 9690 9691class AnnotationElement { 9692 constructor(parameters, isRenderable = false, ignoreBorder = false) { 9693 this.isRenderable = isRenderable; 9694 this.data = parameters.data; 9695 this.layer = parameters.layer; 9696 this.page = parameters.page; 9697 this.viewport = parameters.viewport; 9698 this.linkService = parameters.linkService; 9699 this.downloadManager = parameters.downloadManager; 9700 this.imageResourcesPath = parameters.imageResourcesPath; 9701 this.renderInteractiveForms = parameters.renderInteractiveForms; 9702 this.svgFactory = parameters.svgFactory; 9703 9704 if (isRenderable) { 9705 this.container = this._createContainer(ignoreBorder); 9706 } 9707 } 9708 9709 _createContainer(ignoreBorder = false) { 9710 const data = this.data, 9711 page = this.page, 9712 viewport = this.viewport; 9713 const container = document.createElement("section"); 9714 let width = data.rect[2] - data.rect[0]; 9715 let height = data.rect[3] - data.rect[1]; 9716 container.setAttribute("data-annotation-id", data.id); 9717 9718 const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]); 9719 9720 container.style.transform = `matrix(${viewport.transform.join(",")})`; 9721 container.style.transformOrigin = `-${rect[0]}px -${rect[1]}px`; 9722 9723 if (!ignoreBorder && data.borderStyle.width > 0) { 9724 container.style.borderWidth = `${data.borderStyle.width}px`; 9725 9726 if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) { 9727 width = width - 2 * data.borderStyle.width; 9728 height = height - 2 * data.borderStyle.width; 9729 } 9730 9731 const horizontalRadius = data.borderStyle.horizontalCornerRadius; 9732 const verticalRadius = data.borderStyle.verticalCornerRadius; 9733 9734 if (horizontalRadius > 0 || verticalRadius > 0) { 9735 const radius = `${horizontalRadius}px / ${verticalRadius}px`;
9736 container.style.borderRadius = radius; 9737 } 9738 9739 switch (data.borderStyle.style) { 9740 case _util.AnnotationBorderStyleType.SOLID: 9741 container.style.borderStyle = "solid"; 9742 break; 9743 9744 case _util.AnnotationBorderStyleType.DASHED: 9745 container.style.borderStyle = "dashed"; 9746 break; 9747 9748 case _util.AnnotationBorderStyleType.BEVELED: 9749 (0, _util.warn)("Unimplemented border style: beveled"); 9750 break; 9751 9752 case _util.AnnotationBorderStyleType.INSET: 9753 (0, _util.warn)("Unimplemented border style: inset"); 9754 break; 9755 9756 case _util.AnnotationBorderStyleType.UNDERLINE: 9757 container.style.borderBottomStyle = "solid"; 9758 break; 9759 9760 default: 9761 break; 9762 } 9763 9764 if (data.color) { 9765 container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); 9766 } else { 9767 container.style.borderWidth = 0; 9768 } 9769 } 9770 9771 container.style.left = `${rect[0]}px`; 9772 container.style.top = `${rect[1]}px`; 9773 container.style.width = `${width}px`; 9774 container.style.height = `${height}px`; 9775 return container; 9776 } 9777 9778 _createPopup(container, trigger, data) { 9779 if (!trigger) { 9780 trigger = document.createElement("div"); 9781 trigger.style.height = container.style.height; 9782 trigger.style.width = container.style.width; 9783 container.appendChild(trigger); 9784 } 9785 9786 const popupElement = new PopupElement({ 9787 container, 9788 trigger, 9789 color: data.color, 9790 title: data.title, 9791 modificationDate: data.modificationDate, 9792 contents: data.contents, 9793 hideWrapper: true 9794 }); 9795 const popup = popupElement.render(); 9796 popup.style.left = container.style.width; 9797 container.appendChild(popup); 9798 } 9799 9800 render() { 9801 (0, _util.unreachable)("Abstract method `AnnotationElement.render` called"); 9802 } 9803 9804} 9805 9806class LinkAnnotationElement extends AnnotationElement { 9807 constructor(parameters) { 9808 const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); 9809 super(parameters, isRenderable); 9810 } 9811 9812 render() { 9813 this.container.className = "linkAnnotation"; 9814 const { 9815 data, 9816 linkService 9817 } = this; 9818 const link = document.createElement("a"); 9819 9820 if (data.url) { 9821 (0, _display_utils.addLinkAttributes)(link, { 9822 url: data.url, 9823 target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget, 9824 rel: linkService.externalLinkRel, 9825 enabled: linkService.externalLinkEnabled 9826 }); 9827 } else if (data.action) { 9828 this._bindNamedAction(link, data.action); 9829 } else { 9830 this._bindLink(link, data.dest); 9831 } 9832 9833 this.container.appendChild(link); 9834 return this.container; 9835 } 9836 9837 _bindLink(link, destination) { 9838 link.href = this.linkService.getDestinationHash(destination); 9839 9840 link.onclick = () => { 9841 if (destination) { 9842 this.linkService.navigateTo(destination); 9843 } 9844 9845 return false; 9846 }; 9847 9848 if (destination) { 9849 link.className = "internalLink"; 9850 } 9851 } 9852 9853 _bindNamedAction(link, action) { 9854 link.href = this.linkService.getAnchorUrl(""); 9855 9856 link.onclick = () => { 9857 this.linkService.executeNamedAction(action); 9858 return false; 9859 }; 9860 9861 link.className = "internalLink"; 9862 } 9863 9864} 9865 9866class TextAnnotationElement extends AnnotationElement { 9867 constructor(parameters) { 9868 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 9869 super(parameters, isRenderable); 9870 } 9871 9872 render() { 9873 this.container.className = "textAnnotation"; 9874 const image = document.createElement("img"); 9875 image.style.height = this.container.style.height; 9876 image.style.width = this.container.style.width; 9877 image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg"; 9878 image.alt = "[{{type}} Annotation]"; 9879 image.dataset.l10nId = "text_annotation_type"; 9880 image.dataset.l10nArgs = JSON.stringify({ 9881 type: this.data.name 9882 }); 9883 9884 if (!this.data.hasPopup) { 9885 this._createPopup(this.container, image, this.data); 9886 } 9887 9888 this.container.appendChild(image); 9889 return this.container; 9890 } 9891 9892} 9893 9894class WidgetAnnotationElement extends AnnotationElement { 9895 render() { 9896 return this.container; 9897 } 9898 9899} 9900 9901class TextWidgetAnnotationElement extends WidgetAnnotationElement { 9902 constructor(parameters) { 9903 const isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; 9904 super(parameters, isRenderable); 9905 } 9906 9907 render() { 9908 const TEXT_ALIGNMENT = ["left", "center", "right"]; 9909 this.container.className = "textWidgetAnnotation"; 9910 let element = null; 9911 9912 if (this.renderInteractiveForms) { 9913 if (this.data.multiLine) { 9914 element = document.createElement("textarea"); 9915 element.textContent = this.data.fieldValue; 9916 } else { 9917 element = document.createElement("input"); 9918 element.type = "text"; 9919 element.setAttribute("value", this.data.fieldValue); 9920 } 9921 9922 element.disabled = this.data.readOnly; 9923 element.name = this.data.fieldName; 9924 9925 if (this.data.maxLen !== null) { 9926 element.maxLength = this.data.maxLen; 9927 } 9928 9929 if (this.data.comb) { 9930 const fieldWidth = this.data.rect[2] - this.data.rect[0]; 9931 const combWidth = fieldWidth / this.data.maxLen; 9932 element.classList.add("comb"); 9933 element.style.letterSpacing = `calc(${combWidth}px - 1ch)`; 9934 } 9935 } else { 9936 element = document.createElement("div"); 9937 element.textContent = this.data.fieldValue; 9938 element.style.verticalAlign = "middle"; 9939 element.style.display = "table-cell"; 9940 let font = null; 9941 9942 if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) { 9943 font = this.page.commonObjs.get(this.data.fontRefName); 9944 } 9945 9946 this._setTextStyle(element, font); 9947 } 9948 9949 if (this.data.textAlignment !== null) { 9950 element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; 9951 } 9952 9953 this.container.appendChild(element); 9954 return this.container; 9955 } 9956 9957 _setTextStyle(element, font) { 9958 const style = element.style; 9959 style.fontSize = `${this.data.fontSize}px`; 9960 style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr"; 9961 9962 if (!font) { 9963 return; 9964 } 9965 9966 let bold = "normal"; 9967 9968 if (font.black) { 9969 bold = "900"; 9970 } else if (font.bold) { 9971 bold = "bold"; 9972 } 9973 9974 style.fontWeight = bold; 9975 style.fontStyle = font.italic ? "italic" : "normal"; 9976 const fontFamily = font.loadedName ? `"${font.loadedName}", ` : ""; 9977 const fallbackName = font.fallbackName || "Helvetica, sans-serif"; 9978 style.fontFamily = fontFamily + fallbackName; 9979 } 9980 9981} 9982 9983class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement { 9984 constructor(parameters) { 9985 super(parameters, parameters.renderInteractiveForms); 9986 } 9987 9988 render() { 9989 this.container.className = "buttonWidgetAnnotation checkBox"; 9990 const element = document.createElement("input"); 9991 element.disabled = this.data.readOnly; 9992 element.type = "checkbox"; 9993 element.name = this.data.fieldName; 9994 9995 if (this.data.fieldValue && this.data.fieldValue !== "Off") { 9996 element.setAttribute("checked", true); 9997 } 9998 9999 this.container.appendChild(element); 10000 return this.container; 10001 } 10002 10003} 10004 10005class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement { 10006 constructor(parameters) { 10007 super(parameters, parameters.renderInteractiveForms); 10008 } 10009 10010 render() { 10011 this.container.className = "buttonWidgetAnnotation radioButton"; 10012 const element = document.createElement("input"); 10013 element.disabled = this.data.readOnly; 10014 element.type = "radio"; 10015 element.name = this.data.fieldName; 10016 10017 if (this.data.fieldValue === this.data.buttonValue) { 10018 element.setAttribute("checked", true); 10019 } 10020 10021 this.container.appendChild(element); 10022 return this.container; 10023 } 10024 10025} 10026 10027class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { 10028 render() { 10029 const container = super.render(); 10030 container.className = "buttonWidgetAnnotation pushButton"; 10031 return container; 10032 } 10033 10034} 10035 10036class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { 10037 constructor(parameters) { 10038 super(parameters, parameters.renderInteractiveForms); 10039 } 10040 10041 render() { 10042 this.container.className = "choiceWidgetAnnotation"; 10043 const selectElement = document.createElement("select"); 10044 selectElement.disabled = this.data.readOnly; 10045 selectElement.name = this.data.fieldName; 10046 10047 if (!this.data.combo) { 10048 selectElement.size = this.data.options.length; 10049 10050 if (this.data.multiSelect) { 10051 selectElement.multiple = true; 10052 } 10053 } 10054 10055 for (const option of this.data.options) { 10056 const optionElement = document.createElement("option"); 10057 optionElement.textContent = option.displayValue; 10058 optionElement.value = option.exportValue; 10059 10060 if (this.data.fieldValue.includes(option.displayValue)) { 10061 optionElement.setAttribute("selected", true); 10062 } 10063 10064 selectElement.appendChild(optionElement); 10065 } 10066 10067 this.container.appendChild(selectElement); 10068 return this.container; 10069 } 10070 10071} 10072 10073class PopupAnnotationElement extends AnnotationElement { 10074 constructor(parameters) { 10075 const isRenderable = !!(parameters.data.title || parameters.data.contents); 10076 super(parameters, isRenderable); 10077 } 10078 10079 render() { 10080 const IGNORE_TYPES = ["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"]; 10081 this.container.className = "popupAnnotation"; 10082 10083 if (IGNORE_TYPES.includes(this.data.parentType)) { 10084 return this.container; 10085 } 10086 10087 const selector = `[data-annotation-id="${this.data.parentId}"]`; 10088 const parentElement = this.layer.querySelector(selector); 10089 10090 if (!parentElement) { 10091 return this.container; 10092 } 10093 10094 const popup = new PopupElement({ 10095 container: this.container, 10096 trigger: parentElement, 10097 color: this.data.color, 10098 title: this.data.title, 10099 modificationDate: this.data.modificationDate, 10100 contents: this.data.contents 10101 }); 10102 const parentLeft = parseFloat(parentElement.style.left); 10103 const parentWidth = parseFloat(parentElement.style.width); 10104 this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${parentElement.style.top}`; 10105 this.container.style.left = `${parentLeft + parentWidth}px`;
10106 this.container.appendChild(popup.render()); 10107 return this.container; 10108 } 10109 10110} 10111 10112class PopupElement { 10113 constructor(parameters) { 10114 this.container = parameters.container; 10115 this.trigger = parameters.trigger; 10116 this.color = parameters.color; 10117 this.title = parameters.title; 10118 this.modificationDate = parameters.modificationDate; 10119 this.contents = parameters.contents; 10120 this.hideWrapper = parameters.hideWrapper || false; 10121 this.pinned = false; 10122 } 10123 10124 render() { 10125 const BACKGROUND_ENLIGHT = 0.7; 10126 const wrapper = document.createElement("div"); 10127 wrapper.className = "popupWrapper"; 10128 this.hideElement = this.hideWrapper ? wrapper : this.container; 10129 this.hideElement.setAttribute("hidden", true); 10130 const popup = document.createElement("div"); 10131 popup.className = "popup"; 10132 const color = this.color; 10133 10134 if (color) { 10135 const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; 10136 const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; 10137 const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; 10138 popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); 10139 } 10140 10141 const title = document.createElement("h1"); 10142 title.textContent = this.title; 10143 popup.appendChild(title); 10144 10145 const dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate); 10146 10147 if (dateObject) { 10148 const modificationDate = document.createElement("span"); 10149 modificationDate.textContent = "{{date}}, {{time}}"; 10150 modificationDate.dataset.l10nId = "annotation_date_string"; 10151 modificationDate.dataset.l10nArgs = JSON.stringify({ 10152 date: dateObject.toLocaleDateString(), 10153 time: dateObject.toLocaleTimeString() 10154 }); 10155 popup.appendChild(modificationDate); 10156 } 10157 10158 const contents = this._formatContents(this.contents); 10159 10160 popup.appendChild(contents); 10161 this.trigger.addEventListener("click", this._toggle.bind(this)); 10162 this.trigger.addEventListener("mouseover", this._show.bind(this, false)); 10163 this.trigger.addEventListener("mouseout", this._hide.bind(this, false)); 10164 popup.addEventListener("click", this._hide.bind(this, true)); 10165 wrapper.appendChild(popup); 10166 return wrapper; 10167 } 10168 10169 _formatContents(contents) { 10170 const p = document.createElement("p"); 10171 const lines = contents.split(/(?:\r\n?|\n)/); 10172 10173 for (let i = 0, ii = lines.length; i < ii; ++i) { 10174 const line = lines[i]; 10175 p.appendChild(document.createTextNode(line)); 10176 10177 if (i < ii - 1) { 10178 p.appendChild(document.createElement("br")); 10179 } 10180 } 10181 10182 return p; 10183 } 10184 10185 _toggle() { 10186 if (this.pinned) { 10187 this._hide(true); 10188 } else { 10189 this._show(true); 10190 } 10191 } 10192 10193 _show(pin = false) { 10194 if (pin) { 10195 this.pinned = true; 10196 } 10197 10198 if (this.hideElement.hasAttribute("hidden")) { 10199 this.hideElement.removeAttribute("hidden"); 10200 this.container.style.zIndex += 1; 10201 } 10202 } 10203 10204 _hide(unpin = true) { 10205 if (unpin) { 10206 this.pinned = false; 10207 } 10208 10209 if (!this.hideElement.hasAttribute("hidden") && !this.pinned) { 10210 this.hideElement.setAttribute("hidden", true); 10211 this.container.style.zIndex -= 1; 10212 } 10213 } 10214 10215} 10216 10217class FreeTextAnnotationElement extends AnnotationElement { 10218 constructor(parameters) { 10219 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10220 super(parameters, isRenderable, true); 10221 } 10222 10223 render() { 10224 this.container.className = "freeTextAnnotation"; 10225 10226 if (!this.data.hasPopup) { 10227 this._createPopup(this.container, null, this.data); 10228 } 10229 10230 return this.container; 10231 } 10232 10233} 10234 10235class LineAnnotationElement extends AnnotationElement { 10236 constructor(parameters) { 10237 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10238 super(parameters, isRenderable, true); 10239 } 10240 10241 render() { 10242 this.container.className = "lineAnnotation"; 10243 const data = this.data; 10244 const width = data.rect[2] - data.rect[0]; 10245 const height = data.rect[3] - data.rect[1]; 10246 const svg = this.svgFactory.create(width, height); 10247 const line = this.svgFactory.createElement("svg:line"); 10248 line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]); 10249 line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]); 10250 line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]); 10251 line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]); 10252 line.setAttribute("stroke-width", data.borderStyle.width || 1); 10253 line.setAttribute("stroke", "transparent"); 10254 svg.appendChild(line); 10255 this.container.append(svg); 10256 10257 this._createPopup(this.container, line, data); 10258 10259 return this.container; 10260 } 10261 10262} 10263 10264class SquareAnnotationElement extends AnnotationElement { 10265 constructor(parameters) { 10266 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10267 super(parameters, isRenderable, true); 10268 } 10269 10270 render() { 10271 this.container.className = "squareAnnotation"; 10272 const data = this.data; 10273 const width = data.rect[2] - data.rect[0]; 10274 const height = data.rect[3] - data.rect[1]; 10275 const svg = this.svgFactory.create(width, height); 10276 const borderWidth = data.borderStyle.width; 10277 const square = this.svgFactory.createElement("svg:rect"); 10278 square.setAttribute("x", borderWidth / 2); 10279 square.setAttribute("y", borderWidth / 2); 10280 square.setAttribute("width", width - borderWidth); 10281 square.setAttribute("height", height - borderWidth); 10282 square.setAttribute("stroke-width", borderWidth || 1); 10283 square.setAttribute("stroke", "transparent"); 10284 square.setAttribute("fill", "none"); 10285 svg.appendChild(square); 10286 this.container.append(svg); 10287 10288 this._createPopup(this.container, square, data); 10289 10290 return this.container; 10291 } 10292 10293} 10294 10295class CircleAnnotationElement extends AnnotationElement { 10296 constructor(parameters) { 10297 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10298 super(parameters, isRenderable, true); 10299 } 10300 10301 render() { 10302 this.container.className = "circleAnnotation"; 10303 const data = this.data; 10304 const width = data.rect[2] - data.rect[0]; 10305 const height = data.rect[3] - data.rect[1]; 10306 const svg = this.svgFactory.create(width, height); 10307 const borderWidth = data.borderStyle.width; 10308 const circle = this.svgFactory.createElement("svg:ellipse"); 10309 circle.setAttribute("cx", width / 2); 10310 circle.setAttribute("cy", height / 2); 10311 circle.setAttribute("rx", width / 2 - borderWidth / 2); 10312 circle.setAttribute("ry", height / 2 - borderWidth / 2); 10313 circle.setAttribute("stroke-width", borderWidth || 1); 10314 circle.setAttribute("stroke", "transparent"); 10315 circle.setAttribute("fill", "none"); 10316 svg.appendChild(circle); 10317 this.container.append(svg); 10318 10319 this._createPopup(this.container, circle, data); 10320 10321 return this.container; 10322 } 10323 10324} 10325 10326class PolylineAnnotationElement extends AnnotationElement { 10327 constructor(parameters) { 10328 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10329 super(parameters, isRenderable, true); 10330 this.containerClassName = "polylineAnnotation"; 10331 this.svgElementName = "svg:polyline"; 10332 } 10333 10334 render() { 10335 this.container.className = this.containerClassName; 10336 const data = this.data; 10337 const width = data.rect[2] - data.rect[0]; 10338 const height = data.rect[3] - data.rect[1]; 10339 const svg = this.svgFactory.create(width, height); 10340 let points = []; 10341 10342 for (const coordinate of data.vertices) { 10343 const x = coordinate.x - data.rect[0];
10344 const y = data.rect[3] - coordinate.y; 10345 points.push(x + "," + y); 10346 } 10347 10348 points = points.join(" "); 10349 const polyline = this.svgFactory.createElement(this.svgElementName); 10350 polyline.setAttribute("points", points); 10351 polyline.setAttribute("stroke-width", data.borderStyle.width || 1); 10352 polyline.setAttribute("stroke", "transparent"); 10353 polyline.setAttribute("fill", "none"); 10354 svg.appendChild(polyline); 10355 this.container.append(svg); 10356 10357 this._createPopup(this.container, polyline, data); 10358 10359 return this.container; 10360 } 10361 10362} 10363 10364class PolygonAnnotationElement extends PolylineAnnotationElement { 10365 constructor(parameters) { 10366 super(parameters); 10367 this.containerClassName = "polygonAnnotation"; 10368 this.svgElementName = "svg:polygon"; 10369 } 10370 10371} 10372 10373class CaretAnnotationElement extends AnnotationElement { 10374 constructor(parameters) { 10375 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10376 super(parameters, isRenderable, true); 10377 } 10378 10379 render() { 10380 this.container.className = "caretAnnotation"; 10381 10382 if (!this.data.hasPopup) { 10383 this._createPopup(this.container, null, this.data); 10384 } 10385 10386 return this.container; 10387 } 10388 10389} 10390 10391class InkAnnotationElement extends AnnotationElement { 10392 constructor(parameters) { 10393 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10394 super(parameters, isRenderable, true); 10395 this.containerClassName = "inkAnnotation"; 10396 this.svgElementName = "svg:polyline"; 10397 } 10398 10399 render() { 10400 this.container.className = this.containerClassName; 10401 const data = this.data; 10402 const width = data.rect[2] - data.rect[0]; 10403 const height = data.rect[3] - data.rect[1]; 10404 const svg = this.svgFactory.create(width, height); 10405 10406 for (const inkList of data.inkLists) { 10407 let points = []; 10408 10409 for (const coordinate of inkList) { 10410 const x = coordinate.x - data.rect[0]; 10411 const y = data.rect[3] - coordinate.y; 10412 points.push(`${x},${y}`); 10413 } 10414 10415 points = points.join(" "); 10416 const polyline = this.svgFactory.createElement(this.svgElementName); 10417 polyline.setAttribute("points", points); 10418 polyline.setAttribute("stroke-width", data.borderStyle.width || 1); 10419 polyline.setAttribute("stroke", "transparent"); 10420 polyline.setAttribute("fill", "none"); 10421 10422 this._createPopup(this.container, polyline, data); 10423 10424 svg.appendChild(polyline); 10425 } 10426 10427 this.container.append(svg); 10428 return this.container; 10429 } 10430 10431} 10432 10433class HighlightAnnotationElement extends AnnotationElement { 10434 constructor(parameters) { 10435 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10436 super(parameters, isRenderable, true); 10437 } 10438 10439 render() { 10440 this.container.className = "highlightAnnotation"; 10441 10442 if (!this.data.hasPopup) { 10443 this._createPopup(this.container, null, this.data); 10444 } 10445 10446 return this.container; 10447 } 10448 10449} 10450 10451class UnderlineAnnotationElement extends AnnotationElement { 10452 constructor(parameters) { 10453 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10454 super(parameters, isRenderable, true); 10455 } 10456 10457 render() { 10458 this.container.className = "underlineAnnotation"; 10459 10460 if (!this.data.hasPopup) { 10461 this._createPopup(this.container, null, this.data); 10462 } 10463 10464 return this.container; 10465 } 10466 10467} 10468 10469class SquigglyAnnotationElement extends AnnotationElement { 10470 constructor(parameters) { 10471 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10472 super(parameters, isRenderable, true); 10473 } 10474 10475 render() { 10476 this.container.className = "squigglyAnnotation"; 10477 10478 if (!this.data.hasPopup) { 10479 this._createPopup(this.container, null, this.data); 10480 } 10481 10482 return this.container; 10483 } 10484 10485} 10486 10487class StrikeOutAnnotationElement extends AnnotationElement { 10488 constructor(parameters) { 10489 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10490 super(parameters, isRenderable, true); 10491 } 10492 10493 render() { 10494 this.container.className = "strikeoutAnnotation"; 10495 10496 if (!this.data.hasPopup) { 10497 this._createPopup(this.container, null, this.data); 10498 } 10499 10500 return this.container; 10501 } 10502 10503} 10504 10505class StampAnnotationElement extends AnnotationElement { 10506 constructor(parameters) { 10507 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 10508 super(parameters, isRenderable, true); 10509 } 10510 10511 render() { 10512 this.container.className = "stampAnnotation"; 10513 10514 if (!this.data.hasPopup) { 10515 this._createPopup(this.container, null, this.data); 10516 } 10517 10518 return this.container; 10519 } 10520 10521} 10522 10523class FileAttachmentAnnotationElement extends AnnotationElement { 10524 constructor(parameters) { 10525 super(parameters, true); 10526 const { 10527 filename, 10528 content 10529 } = this.data.file; 10530 this.filename = (0, _display_utils.getFilenameFromUrl)(filename); 10531 this.content = content; 10532 10533 if (this.linkService.eventBus) { 10534 this.linkService.eventBus.dispatch("fileattachmentannotation", { 10535 source: this, 10536 id: (0, _util.stringToPDFString)(filename), 10537 filename, 10538 content 10539 }); 10540 } 10541 } 10542 10543 render() { 10544 this.container.className = "fileAttachmentAnnotation"; 10545 const trigger = document.createElement("div"); 10546 trigger.style.height = this.container.style.height; 10547 trigger.style.width = this.container.style.width; 10548 trigger.addEventListener("dblclick", this._download.bind(this)); 10549 10550 if (!this.data.hasPopup && (this.data.title || this.data.contents)) { 10551 this._createPopup(this.container, trigger, this.data); 10552 } 10553 10554 this.container.appendChild(trigger); 10555 return this.container; 10556 } 10557 10558 _download() { 10559 if (!this.downloadManager) { 10560 (0, _util.warn)("Download cannot be started due to unavailable download manager"); 10561 return; 10562 } 10563 10564 this.downloadManager.downloadData(this.content, this.filename, ""); 10565 } 10566 10567} 10568 10569class AnnotationLayer { 10570 static render(parameters) { 10571 const sortedAnnotations = [], 10572 popupAnnotations = []; 10573 10574 for (const data of parameters.annotations) { 10575 if (!data) { 10576 continue; 10577 } 10578 10579 if (data.annotationType === _util.AnnotationType.POPUP) { 10580 popupAnnotations.push(data); 10581 continue; 10582 } 10583 10584 sortedAnnotations.push(data); 10585 } 10586 10587 if (popupAnnotations.length) { 10588 sortedAnnotations.push(...popupAnnotations); 10589 } 10590 10591 for (const data of sortedAnnotations) { 10592 const element = AnnotationElementFactory.create({ 10593 data, 10594 layer: parameters.div, 10595 page: parameters.page, 10596 viewport: parameters.viewport, 10597 linkService: parameters.linkService, 10598 downloadManager: parameters.downloadManager, 10599 imageResourcesPath: parameters.imageResourcesPath || "", 10600 renderInteractiveForms: parameters.renderInteractiveForms || false, 10601 svgFactory: new _display_utils.DOMSVGFactory() 10602 }); 10603 10604 if (element.isRenderable) { 10605 parameters.div.appendChild(element.render()); 10606 } 10607 } 10608 } 10609 10610 static update(parameters) { 10611 for (const data of parameters.annotations) { 10612 const element = parameters.div.querySelector(`[data-annotation-id="${data.id}"]`); 10613 10614 if (element) { 10615 element.style.transform = `matrix(${parameters.viewport.transform.join(",")})`; 10616 } 10617 } 10618 10619 parameters.div.removeAttribute("hidden"); 10620 } 10621 10622} 10623 10624exports.AnnotationLayer = AnnotationLayer; 10625 10626/***/ }), 10627/* 17 */ 10628/***/ (function(module, exports, __w_pdfjs_require__) { 10629 10630"use strict"; 10631 10632 10633Object.defineProperty(exports, "__esModule", { 10634 value: true 10635}); 10636exports.renderTextLayer = void 0; 10637 10638var _util = __w_pdfjs_require__(2); 10639 10640var renderTextLayer = function renderTextLayerClosure() { 10641 var MAX_TEXT_DIVS_TO_RENDER = 100000; 10642 var NonWhitespaceRegexp = /\S/; 10643 10644 function isAllWhitespace(str) { 10645 return !NonWhitespaceRegexp.test(str); 10646 } 10647 10648 function appendText(task, geom, styles) { 10649 var textDiv = document.createElement("span"); 10650 var textDivProperties = { 10651 angle: 0, 10652 canvasWidth: 0, 10653 isWhitespace: false, 10654 originalTransform: null, 10655 paddingBottom: 0, 10656 paddingLeft: 0, 10657 paddingRight: 0, 10658 paddingTop: 0, 10659 scale: 1 10660 }; 10661 10662 task._textDivs.push(textDiv); 10663 10664 if (isAllWhitespace(geom.str)) { 10665 textDivProperties.isWhitespace = true; 10666 10667 task._textDivProperties.set(textDiv, textDivProperties); 10668 10669 return; 10670 } 10671 10672 var tx = _util.Util.transform(task._viewport.transform, geom.transform); 10673 10674 var angle = Math.atan2(tx[1], tx[0]); 10675 var style = styles[geom.fontName]; 10676 10677 if (style.vertical) { 10678 angle += Math.PI / 2; 10679 } 10680 10681 var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); 10682 var fontAscent = fontHeight; 10683 10684 if (style.ascent) { 10685 fontAscent = style.ascent * fontAscent; 10686 }
10686 else if (style.descent) { 10687 fontAscent = (1 + style.descent) * fontAscent; 10688 } 10689 10690 let left, top; 10691 10692 if (angle === 0) { 10693 left = tx[4]; 10694 top = tx[5] - fontAscent; 10695 } else { 10696 left = tx[4] + fontAscent * Math.sin(angle); 10697 top = tx[5] - fontAscent * Math.cos(angle); 10698 } 10699 10700 textDiv.style.left = `${left}px`; 10701 textDiv.style.top = `${top}px`; 10702 textDiv.style.fontSize = `${fontHeight}px`; 10703 textDiv.style.fontFamily = style.fontFamily; 10704 textDiv.textContent = geom.str; 10705 10706 if (task._fontInspectorEnabled) { 10707 textDiv.dataset.fontName = geom.fontName; 10708 } 10709 10710 if (angle !== 0) { 10711 textDivProperties.angle = angle * (180 / Math.PI); 10712 } 10713 10714 let shouldScaleText = false; 10715 10716 if (geom.str.length > 1) { 10717 shouldScaleText = true; 10718 } else if (geom.transform[0] !== geom.transform[3]) { 10719 const absScaleX = Math.abs(geom.transform[0]), 10720 absScaleY = Math.abs(geom.transform[3]); 10721 10722 if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) { 10723 shouldScaleText = true; 10724 } 10725 } 10726 10727 if (shouldScaleText) { 10728 if (style.vertical) { 10729 textDivProperties.canvasWidth = geom.height * task._viewport.scale; 10730 } else { 10731 textDivProperties.canvasWidth = geom.width * task._viewport.scale; 10732 } 10733 } 10734 10735 task._textDivProperties.set(textDiv, textDivProperties); 10736 10737 if (task._textContentStream) { 10738 task._layoutText(textDiv); 10739 } 10740 10741 if (task._enhanceTextSelection) { 10742 var angleCos = 1, 10743 angleSin = 0; 10744 10745 if (angle !== 0) { 10746 angleCos = Math.cos(angle); 10747 angleSin = Math.sin(angle); 10748 } 10749 10750 var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; 10751 var divHeight = fontHeight; 10752 var m, b; 10753 10754 if (angle !== 0) { 10755 m = [angleCos, angleSin, -angleSin, angleCos, left, top]; 10756 b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); 10757 } else { 10758 b = [left, top, left + divWidth, top + divHeight]; 10759 } 10760 10761 task._bounds.push({ 10762 left: b[0], 10763 top: b[1], 10764 right: b[2], 10765 bottom: b[3], 10766 div: textDiv, 10767 size: [divWidth, divHeight], 10768 m 10769 }); 10770 } 10771 } 10772 10773 function render(task) { 10774 if (task._canceled) { 10775 return; 10776 } 10777 10778 var textDivs = task._textDivs; 10779 var capability = task._capability; 10780 var textDivsLength = textDivs.length; 10781 10782 if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { 10783 task._renderingDone = true; 10784 capability.resolve(); 10785 return; 10786 } 10787 10788 if (!task._textContentStream) { 10789 for (var i = 0; i < textDivsLength; i++) { 10790 task._layoutText(textDivs[i]); 10791 } 10792 } 10793 10794 task._renderingDone = true; 10795 capability.resolve(); 10796 } 10797 10798 function findPositiveMin(ts, offset, count) { 10799 let result = 0; 10800 10801 for (let i = 0; i < count; i++) { 10802 const t = ts[offset++]; 10803 10804 if (t > 0) { 10805 result = result ? Math.min(t, result) : t; 10806 } 10807 } 10808 10809 return result; 10810 } 10811 10812 function expand(task) { 10813 var bounds = task._bounds; 10814 var viewport = task._viewport; 10815 var expanded = expandBounds(viewport.width, viewport.height, bounds); 10816 10817 for (var i = 0; i < expanded.length; i++) { 10818 var div = bounds[i].div; 10819 10820 var divProperties = task._textDivProperties.get(div); 10821 10822 if (divProperties.angle === 0) { 10823 divProperties.paddingLeft = bounds[i].left - expanded[i].left; 10824 divProperties.paddingTop = bounds[i].top - expanded[i].top; 10825 divProperties.paddingRight = expanded[i].right - bounds[i].right; 10826 divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; 10827 10828 task._textDivProperties.set(div, divProperties); 10829 10830 continue; 10831 } 10832 10833 var e = expanded[i], 10834 b = bounds[i]; 10835 var m = b.m, 10836 c = m[0], 10837 s = m[1]; 10838 var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; 10839 var ts = new Float64Array(64); 10840 points.forEach(function (p, j) { 10841 var t = _util.Util.applyTransform(p, m); 10842 10843 ts[j + 0] = c && (e.left - t[0]) / c; 10844 ts[j + 4] = s && (e.top - t[1]) / s; 10845 ts[j + 8] = c && (e.right - t[0]) / c; 10846 ts[j + 12] = s && (e.bottom - t[1]) / s; 10847 ts[j + 16] = s && (e.left - t[0]) / -s; 10848 ts[j + 20] = c && (e.top - t[1]) / c; 10849 ts[j + 24] = s && (e.right - t[0]) / -s; 10850 ts[j + 28] = c && (e.bottom - t[1]) / c; 10851 ts[j + 32] = c && (e.left - t[0]) / -c; 10852 ts[j + 36] = s && (e.top - t[1]) / -s; 10853 ts[j + 40] = c && (e.right - t[0]) / -c; 10854 ts[j + 44] = s && (e.bottom - t[1]) / -s; 10855 ts[j + 48] = s && (e.left - t[0]) / s; 10856 ts[j + 52] = c && (e.top - t[1]) / -c; 10857 ts[j + 56] = s && (e.right - t[0]) / s; 10858 ts[j + 60] = c && (e.bottom - t[1]) / -c; 10859 }); 10860 var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
10861 divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; 10862 divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; 10863 divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; 10864 divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; 10865 10866 task._textDivProperties.set(div, divProperties); 10867 } 10868 } 10869 10870 function expandBounds(width, height, boxes) { 10871 var bounds = boxes.map(function (box, i) { 10872 return { 10873 x1: box.left, 10874 y1: box.top, 10875 x2: box.right, 10876 y2: box.bottom, 10877 index: i, 10878 x1New: undefined, 10879 x2New: undefined 10880 }; 10881 }); 10882 expandBoundsLTR(width, bounds); 10883 var expanded = new Array(boxes.length); 10884 bounds.forEach(function (b) { 10885 var i = b.index; 10886 expanded[i] = { 10887 left: b.x1New, 10888 top: 0, 10889 right: b.x2New, 10890 bottom: 0 10891 }; 10892 }); 10893 boxes.map(function (box, i) { 10894 var e = expanded[i], 10895 b = bounds[i]; 10896 b.x1 = box.top; 10897 b.y1 = width - e.right; 10898 b.x2 = box.bottom; 10899 b.y2 = width - e.left; 10900 b.index = i; 10901 b.x1New = undefined; 10902 b.x2New = undefined; 10903 }); 10904 expandBoundsLTR(height, bounds); 10905 bounds.forEach(function (b) { 10906 var i = b.index; 10907 expanded[i].top = b.x1New; 10908 expanded[i].bottom = b.x2New; 10909 }); 10910 return expanded; 10911 } 10912 10913 function expandBoundsLTR(width, bounds) { 10914 bounds.sort(function (a, b) { 10915 return a.x1 - b.x1 || a.index - b.index; 10916 }); 10917 var fakeBoundary = { 10918 x1: -Infinity, 10919 y1: -Infinity, 10920 x2: 0, 10921 y2: Infinity, 10922 index: -1, 10923 x1New: 0, 10924 x2New: 0 10925 }; 10926 var horizon = [{ 10927 start: -Infinity, 10928 end: Infinity, 10929 boundary: fakeBoundary 10930 }]; 10931 bounds.forEach(function (boundary) { 10932 var i = 0; 10933 10934 while (i < horizon.length && horizon[i].end <= boundary.y1) { 10935 i++; 10936 } 10937 10938 var j = horizon.length - 1; 10939 10940 while (j >= 0 && horizon[j].start >= boundary.y2) { 10941 j--; 10942 } 10943 10944 var horizonPart, affectedBoundary; 10945 var q, 10946 k, 10947 maxXNew = -Infinity; 10948 10949 for (q = i; q <= j; q++) { 10950 horizonPart = horizon[q]; 10951 affectedBoundary = horizonPart.boundary; 10952 var xNew; 10953 10954 if (affectedBoundary.x2 > boundary.x1) { 10955 xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; 10956 } else if (affectedBoundary.x2New === undefined) { 10957 xNew = (affectedBoundary.x2 + boundary.x1) / 2; 10958 } else { 10959 xNew = affectedBoundary.x2New; 10960 } 10961 10962 if (xNew > maxXNew) { 10963 maxXNew = xNew; 10964 } 10965 } 10966 10967 boundary.x1New = maxXNew; 10968 10969 for (q = i; q <= j; q++) { 10970 horizonPart = horizon[q]; 10971 affectedBoundary = horizonPart.boundary; 10972 10973 if (affectedBoundary.x2New === undefined) { 10974 if (affectedBoundary.x2 > boundary.x1) { 10975 if (affectedBoundary.index > boundary.index) { 10976 affectedBoundary.x2New = affectedBoundary.x2; 10977 } 10978 } else { 10979 affectedBoundary.x2New = maxXNew; 10980 } 10981 } else if (affectedBoundary.x2New > maxXNew) { 10982 affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); 10983 } 10984 } 10985 10986 var changedHorizon = [], 10987 lastBoundary = null; 10988 10989 for (q = i; q <= j; q++) { 10990 horizonPart = horizon[q]; 10991 affectedBoundary = horizonPart.boundary; 10992 var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; 10993 10994 if (lastBoundary === useBoundary) { 10995 changedHorizon[changedHorizon.length - 1].end = horizonPart.end; 10996 } else { 10997 changedHorizon.push({ 10998 start: horizonPart.start, 10999 end: horizonPart.end, 11000 boundary: useBoundary 11001 }); 11002 lastBoundary = useBoundary; 11003 } 11004 } 11005 11006 if (horizon[i].start < boundary.y1) { 11007 changedHorizon[0].start = boundary.y1; 11008 changedHorizon.unshift({ 11009 start: horizon[i].start, 11010 end: boundary.y1, 11011 boundary: horizon[i].boundary 11012 }); 11013 } 11014 11015 if (boundary.y2 < horizon[j].end) { 11016 changedHorizon[changedHorizon.length - 1].end = boundary.y2; 11017 changedHorizon.push({ 11018 start: boundary.y2, 11019 end: horizon[j].end, 11020 boundary: horizon[j].boundary 11021 }); 11022 } 11023 11024 for (q = i; q <= j; q++) { 11025 horizonPart = horizon[q]; 11026 affectedBoundary = horizonPart.boundary; 11027 11028 if (affectedBoundary.x2New !== undefined) { 11029 continue; 11030 } 11031 11032 var used = false;
11033 11034 for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { 11035 used = horizon[k].boundary === affectedBoundary; 11036 } 11037 11038 for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { 11039 used = horizon[k].boundary === affectedBoundary; 11040 } 11041 11042 for (k = 0; !used && k < changedHorizon.length; k++) { 11043 used = changedHorizon[k].boundary === affectedBoundary; 11044 } 11045 11046 if (!used) { 11047 affectedBoundary.x2New = maxXNew; 11048 } 11049 } 11050 11051 Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); 11052 }); 11053 horizon.forEach(function (horizonPart) { 11054 var affectedBoundary = horizonPart.boundary; 11055 11056 if (affectedBoundary.x2New === undefined) { 11057 affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); 11058 } 11059 }); 11060 } 11061 11062 function TextLayerRenderTask({ 11063 textContent, 11064 textContentStream, 11065 container, 11066 viewport, 11067 textDivs, 11068 textContentItemsStr, 11069 enhanceTextSelection 11070 }) { 11071 this._textContent = textContent; 11072 this._textContentStream = textContentStream; 11073 this._container = container; 11074 this._viewport = viewport; 11075 this._textDivs = textDivs || []; 11076 this._textContentItemsStr = textContentItemsStr || []; 11077 this._enhanceTextSelection = !!enhanceTextSelection; 11078 this._fontInspectorEnabled = !!(globalThis.FontInspector && globalThis.FontInspector.enabled); 11079 this._reader = null; 11080 this._layoutTextLastFontSize = null; 11081 this._layoutTextLastFontFamily = null; 11082 this._layoutTextCtx = null; 11083 this._textDivProperties = new WeakMap(); 11084 this._renderingDone = false; 11085 this._canceled = false; 11086 this._capability = (0, _util.createPromiseCapability)(); 11087 this._renderTimer = null; 11088 this._bounds = []; 11089 11090 this._capability.promise.finally(() => { 11091 if (this._layoutTextCtx) { 11092 this._layoutTextCtx.canvas.width = 0; 11093 this._layoutTextCtx.canvas.height = 0; 11094 this._layoutTextCtx = null; 11095 } 11096 }).catch(() => {}); 11097 } 11098 11099 TextLayerRenderTask.prototype = { 11100 get promise() { 11101 return this._capability.promise; 11102 }, 11103 11104 cancel: function TextLayer_cancel() { 11105 this._canceled = true; 11106 11107 if (this._reader) { 11108 this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")); 11109 11110 this._reader = null; 11111 } 11112 11113 if (this._renderTimer !== null) { 11114 clearTimeout(this._renderTimer); 11115 this._renderTimer = null; 11116 } 11117 11118 this._capability.reject(new Error("TextLayer task cancelled.")); 11119 }, 11120 11121 _processItems(items, styleCache) { 11122 for (let i = 0, len = items.length; i < len; i++) { 11123 this._textContentItemsStr.push(items[i].str); 11124 11125 appendText(this, items[i], styleCache); 11126 } 11127 }, 11128 11129 _layoutText(textDiv) { 11130 const textDivProperties = this._textDivProperties.get(textDiv); 11131 11132 if (textDivProperties.isWhitespace) { 11133 return; 11134 } 11135 11136 let transform = ""; 11137 11138 if (textDivProperties.canvasWidth !== 0) { 11139 const { 11140 fontSize, 11141 fontFamily 11142 } = textDiv.style; 11143 11144 if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { 11145 this._layoutTextCtx.font = `${fontSize} ${fontFamily}`; 11146 this._layoutTextLastFontSize = fontSize; 11147 this._layoutTextLastFontFamily = fontFamily; 11148 } 11149 11150 const { 11151 width 11152 } = this._layoutTextCtx.measureText(textDiv.textContent); 11153 11154 if (width > 0) { 11155 textDivProperties.scale = textDivProperties.canvasWidth / width; 11156 transform = `scaleX(${textDivProperties.scale})`; 11157 } 11158 } 11159 11160 if (textDivProperties.angle !== 0) { 11161 transform = `rotate(${textDivProperties.angle}deg) ${transform}`; 11162 } 11163 11164 if (transform.length > 0) { 11165 if (this._enhanceTextSelection) { 11166 textDivProperties.originalTransform = transform; 11167 } 11168 11169 textDiv.style.transform = transform; 11170 } 11171 11172 this._textDivProperties.set(textDiv, textDivProperties); 11173 11174 this._container.appendChild(textDiv); 11175 }, 11176 11177 _render: function TextLayer_render(timeout) { 11178 const capability = (0, _util.createPromiseCapability)(); 11179 let styleCache = Object.create(null); 11180 const canvas = document.createElement("canvas"); 11181 canvas.mozOpaque = true; 11182 this._layoutTextCtx = canvas.getContext("2d", { 11183 alpha: false 11184 }); 11185 11186 if (this._textContent) { 11187 const textItems = this._textContent.items; 11188 const textStyles = this._textContent.styles; 11189 11190 this._processItems(textItems, textStyles); 11191 11192 capability.resolve(); 11193 } else if (this._textContentStream) { 11194 const pump = () => { 11195 this._reader.read().then(({ 11196 value, 11197 done 11198 }) => { 11199 if (done) { 11200 capability.resolve(); 11201 return; 11202 } 11203 11204 Object.assign(styleCache, value.styles); 11205 11206 this._processItems(value.items, styleCache); 11207 11208 pump(); 11209 }, capability.reject); 11210 }; 11211 11212 this._reader = this._textContentStream.getReader(); 11213 pump(); 11214 } else { 11215 throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified."); 11216 } 11217 11218 capability.promise.then(() => { 11219 styleCache = null; 11220 11221 if (!timeout) { 11222 render(this); 11223 } else { 11224 this._renderTimer = setTimeout(() => { 11225 render(this); 11226 this._renderTimer = null; 11227 }, timeout); 11228 } 11229 }, this._capability.reject); 11230 }, 11231 expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { 11232 if (!this._enhanceTextSelection || !this._renderingDone) { 11233 return; 11234 } 11235 11236 if (this._bounds !== null) { 11237 expand(this); 11238 this._bounds = null; 11239 } 11240 11241 const transformBuf = [], 11242 paddingBuf = []; 11243 11244 for (var i = 0, ii = this._textDivs.length; i < ii; i++) { 11245 const div = this._textDivs[i]; 11246 11247 const divProps = this._textDivProperties.get(div); 11248 11249 if (divProps.isWhitespace) { 11250 continue; 11251 } 11252 11253 if (expandDivs) { 11254 transformBuf.length = 0; 11255 paddingBuf.length = 0; 11256 11257 if (divProps.originalTransform) { 11258 transformBuf.push(divProps.originalTransform); 11259 } 11260 11261 if (divProps.paddingTop > 0) { 11262 paddingBuf.push(`${divProps.paddingTop}px`); 11263 transformBuf.push(`translateY(${-divProps.paddingTop}px)`); 11264 } else { 11265 paddingBuf.push(0); 11266 } 11267 11268 if (divProps.paddingRight > 0) { 11269 paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`); 11270 } else { 11271 paddingBuf.push(0); 11272 } 11273 11274 if (divProps.paddingBottom > 0) { 11275 paddingBuf.push(`${divProps.paddingBottom}px`); 11276 } else { 11277 paddingBuf.push(0); 11278 } 11279 11280 if (divProps.paddingLeft > 0) { 11281 paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`); 11282 transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`); 11283 } else { 11284 paddingBuf.push(0); 11285 } 11286 11287 div.style.padding = paddingBuf.join(" "); 11288 11289 if (transformBuf.length) { 11290 div.style.transform = transformBuf.join(" "); 11291 } 11292 } else { 11293 div.style.padding = null; 11294 div.style.transform = divProps.originalTransform; 11295 } 11296 } 11297 } 11298 }; 11299 11300 function renderTextLayer(renderParameters) { 11301 var task = new TextLayerRenderTask({ 11302 textContent: renderParameters.textContent, 11303 textContentStream: renderParameters.textContentStream, 11304 container: renderParameters.container, 11305 viewport: renderParameters.viewport, 11306 textDivs: renderParameters.textDivs, 11307 textContentItemsStr: renderParameters.textContentItemsStr, 11308 enhanceTextSelection: renderParameters.enhanceTextSelection 11309 }); 11310 11311 task._render(renderParameters.timeout); 11312 11313 return task; 11314 } 11315 11316 return renderTextLayer; 11317}(); 11318 11319exports.renderTextLayer = renderTextLayer; 11320 11321/***/ }), 11322/* 18 */ 11323/***/ (function(module, exports, __w_pdfjs_require__) { 11324 11325"use strict"; 11326 11327 11328Object.defineProperty(exports, "__esModule", { 11329 value: true 11330}); 11331exports.SVGGraphics = void 0; 11332 11333var _util = __w_pdfjs_require__(2); 11334 11335var _display_utils = __w_pdfjs_require__(1); 11336 11337var _is_node = __w_pdfjs_require__(4); 11338 11339let SVGGraphics = function () { 11340 throw new Error("Not implemented: SVGGraphics"); 11341}; 11342 11343exports.SVGGraphics = SVGGraphics; 11344{ 11345 const SVG_DEFAULTS = { 11346 fontStyle: "normal", 11347 fontWeight: "normal", 11348 fillColor: "#000000" 11349 }; 11350 const XML_NS = "http://www.w3.org/XML/1998/namespace"; 11351 const XLINK_NS = "http://www.w3.org/1999/xlink"; 11352 const LINE_CAP_STYLES = ["butt", "round", "square"]; 11353 const LINE_JOIN_STYLES = ["miter", "round", "bevel"]; 11354 11355 const convertImgDataToPng = function () { 11356 const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); 11357 const CHUNK_WRAPPER_SIZE = 12; 11358 const crcTable = new Int32Array(256); 11359 11360 for (let i = 0; i < 256; i++) { 11361 let c = i; 11362 11363 for (let h = 0; h < 8; h++) { 11364 if (c & 1) { 11365 c = 0xedb88320 ^ c >> 1 & 0x7fffffff; 11366 } else { 11367 c = c >> 1 & 0x7fffffff; 11368 } 11369 } 11370 11371 crcTable[i] = c; 11372 } 11373 11374 function crc32(data, start, end) { 11375 let crc = -1; 11376 11377 for (let i = start; i < end; i++) { 11378 const a = (crc ^ data[i]) & 0xff;
11379 const b = crcTable[a]; 11380 crc = crc >>> 8 ^ b; 11381 } 11382 11383 return crc ^ -1; 11384 } 11385 11386 function writePngChunk(type, body, data, offset) { 11387 let p = offset; 11388 const len = body.length; 11389 data[p] = len >> 24 & 0xff; 11390 data[p + 1] = len >> 16 & 0xff; 11391 data[p + 2] = len >> 8 & 0xff; 11392 data[p + 3] = len & 0xff; 11393 p += 4; 11394 data[p] = type.charCodeAt(0) & 0xff; 11395 data[p + 1] = type.charCodeAt(1) & 0xff; 11396 data[p + 2] = type.charCodeAt(2) & 0xff; 11397 data[p + 3] = type.charCodeAt(3) & 0xff; 11398 p += 4; 11399 data.set(body, p); 11400 p += body.length; 11401 const crc = crc32(data, offset + 4, p); 11402 data[p] = crc >> 24 & 0xff; 11403 data[p + 1] = crc >> 16 & 0xff; 11404 data[p + 2] = crc >> 8 & 0xff; 11405 data[p + 3] = crc & 0xff; 11406 } 11407 11408 function adler32(data, start, end) { 11409 let a = 1; 11410 let b = 0; 11411 11412 for (let i = start; i < end; ++i) { 11413 a = (a + (data[i] & 0xff)) % 65521; 11414 b = (b + a) % 65521; 11415 } 11416 11417 return b << 16 | a; 11418 } 11419 11420 function deflateSync(literals) { 11421 if (!_is_node.isNodeJS) { 11422 return deflateSyncUncompressed(literals); 11423 } 11424 11425 try { 11426 let input; 11427 11428 if (parseInt(process.versions.node) >= 8) { 11429 input = literals; 11430 } else { 11431 input = Buffer.from(literals); 11432 } 11433 11434 const output = require("zlib").deflateSync(input, { 11435 level: 9 11436 }); 11437 11438 return output instanceof Uint8Array ? output : new Uint8Array(output); 11439 } catch (e) { 11440 (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e); 11441 } 11442 11443 return deflateSyncUncompressed(literals); 11444 } 11445 11446 function deflateSyncUncompressed(literals) { 11447 let len = literals.length; 11448 const maxBlockLength = 0xffff; 11449 const deflateBlocks = Math.ceil(len / maxBlockLength); 11450 const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); 11451 let pi = 0; 11452 idat[pi++] = 0x78; 11453 idat[pi++] = 0x9c; 11454 let pos = 0; 11455 11456 while (len > maxBlockLength) { 11457 idat[pi++] = 0x00; 11458 idat[pi++] = 0xff; 11459 idat[pi++] = 0xff; 11460 idat[pi++] = 0x00; 11461 idat[pi++] = 0x00; 11462 idat.set(literals.subarray(pos, pos + maxBlockLength), pi); 11463 pi += maxBlockLength; 11464 pos += maxBlockLength; 11465 len -= maxBlockLength; 11466 } 11467 11468 idat[pi++] = 0x01; 11469 idat[pi++] = len & 0xff; 11470 idat[pi++] = len >> 8 & 0xff; 11471 idat[pi++] = ~len & 0xffff & 0xff; 11472 idat[pi++] = (~len & 0xffff) >> 8 & 0xff; 11473 idat.set(literals.subarray(pos), pi); 11474 pi += literals.length - pos; 11475 const adler = adler32(literals, 0, literals.length); 11476 idat[pi++] = adler >> 24 & 0xff; 11477 idat[pi++] = adler >> 16 & 0xff; 11478 idat[pi++] = adler >> 8 & 0xff; 11479 idat[pi++] = adler & 0xff; 11480 return idat; 11481 } 11482 11483 function encode(imgData, kind, forceDataSchema, isMask) { 11484 const width = imgData.width; 11485 const height = imgData.height; 11486 let bitDepth, colorType, lineSize; 11487 const bytes = imgData.data; 11488 11489 switch (kind) { 11490 case _util.ImageKind.GRAYSCALE_1BPP: 11491 colorType = 0; 11492 bitDepth = 1; 11493 lineSize = width + 7 >> 3; 11494 break; 11495 11496 case _util.ImageKind.RGB_24BPP: 11497 colorType = 2; 11498 bitDepth = 8; 11499 lineSize = width * 3; 11500 break; 11501 11502 case _util.ImageKind.RGBA_32BPP: 11503 colorType = 6; 11504 bitDepth = 8; 11505 lineSize = width * 4; 11506 break; 11507 11508 default: 11509 throw new Error("invalid format"); 11510 } 11511 11512 const literals = new Uint8Array((1 + lineSize) * height); 11513 let offsetLiterals = 0, 11514 offsetBytes = 0; 11515 11516 for (let y = 0; y < height; ++y) { 11517 literals[offsetLiterals++] = 0; 11518 literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); 11519 offsetBytes += lineSize; 11520 offsetLiterals += lineSize; 11521 } 11522 11523 if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) { 11524 offsetLiterals = 0; 11525 11526 for (let y = 0; y < height; y++) { 11527 offsetLiterals++; 11528 11529 for (let i = 0; i < lineSize; i++) { 11530 literals[offsetLiterals++] ^= 0xff; 11531 } 11532 } 11533 } 11534 11535 const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]); 11536 const idat = deflateSync(literals); 11537 const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length; 11538 const data = new Uint8Array(pngLength); 11539 let offset = 0; 11540 data.set(PNG_HEADER, offset); 11541 offset += PNG_HEADER.length; 11542 writePngChunk("IHDR", ihdr, data, offset); 11543 offset += CHUNK_WRAPPER_SIZE + ihdr.length; 11544 writePngChunk("IDATA", idat, data, offset); 11545 offset += CHUNK_WRAPPER_SIZE + idat.length; 11546 writePngChunk("IEND", new Uint8Array(0), data, offset); 11547 return (0, _util.createObjectURL)(data, "image/png", forceDataSchema); 11548 } 11549 11550 return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
11551 const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind; 11552 return encode(imgData, kind, forceDataSchema, isMask); 11553 }; 11554 }(); 11555 11556 class SVGExtraState { 11557 constructor() { 11558 this.fontSizeScale = 1; 11559 this.fontWeight = SVG_DEFAULTS.fontWeight; 11560 this.fontSize = 0; 11561 this.textMatrix = _util.IDENTITY_MATRIX; 11562 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 11563 this.leading = 0; 11564 this.textRenderingMode = _util.TextRenderingMode.FILL; 11565 this.textMatrixScale = 1; 11566 this.x = 0; 11567 this.y = 0; 11568 this.lineX = 0; 11569 this.lineY = 0; 11570 this.charSpacing = 0; 11571 this.wordSpacing = 0; 11572 this.textHScale = 1; 11573 this.textRise = 0; 11574 this.fillColor = SVG_DEFAULTS.fillColor; 11575 this.strokeColor = "#000000"; 11576 this.fillAlpha = 1; 11577 this.strokeAlpha = 1; 11578 this.lineWidth = 1; 11579 this.lineJoin = ""; 11580 this.lineCap = ""; 11581 this.miterLimit = 0; 11582 this.dashArray = []; 11583 this.dashPhase = 0; 11584 this.dependencies = []; 11585 this.activeClipUrl = null; 11586 this.clipGroup = null; 11587 this.maskId = ""; 11588 } 11589 11590 clone() { 11591 return Object.create(this); 11592 } 11593 11594 setCurrentPoint(x, y) { 11595 this.x = x; 11596 this.y = y; 11597 } 11598 11599 } 11600 11601 function opListToTree(opList) { 11602 let opTree = []; 11603 const tmp = []; 11604 11605 for (const opListElement of opList) { 11606 if (opListElement.fn === "save") { 11607 opTree.push({ 11608 fnId: 92, 11609 fn: "group", 11610 items: [] 11611 }); 11612 tmp.push(opTree); 11613 opTree = opTree[opTree.length - 1].items; 11614 continue; 11615 } 11616 11617 if (opListElement.fn === "restore") { 11618 opTree = tmp.pop(); 11619 } else { 11620 opTree.push(opListElement); 11621 } 11622 } 11623 11624 return opTree; 11625 } 11626 11627 function pf(value) { 11628 if (Number.isInteger(value)) { 11629 return value.toString(); 11630 } 11631 11632 const s = value.toFixed(10); 11633 let i = s.length - 1; 11634 11635 if (s[i] !== "0") { 11636 return s; 11637 } 11638 11639 do { 11640 i--; 11641 } while (s[i] === "0"); 11642 11643 return s.substring(0, s[i] === "." ? i : i + 1); 11644 } 11645 11646 function pm(m) { 11647 if (m[4] === 0 && m[5] === 0) { 11648 if (m[1] === 0 && m[2] === 0) { 11649 if (m[0] === 1 && m[3] === 1) { 11650 return ""; 11651 } 11652 11653 return `scale(${pf(m[0])} ${pf(m[3])})`; 11654 } 11655 11656 if (m[0] === m[3] && m[1] === -m[2]) { 11657 const a = Math.acos(m[0]) * 180 / Math.PI; 11658 return `rotate(${pf(a)})`; 11659 } 11660 } else { 11661 if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { 11662 return `translate(${pf(m[4])} ${pf(m[5])})`; 11663 } 11664 } 11665 11666 return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`; 11667 } 11668 11669 let clipCount = 0; 11670 let maskCount = 0; 11671 let shadingCount = 0; 11672 exports.SVGGraphics = SVGGraphics = class SVGGraphics { 11673 constructor(commonObjs, objs, forceDataSchema = false) { 11674 this.svgFactory = new _display_utils.DOMSVGFactory(); 11675 this.current = new SVGExtraState(); 11676 this.transformMatrix = _util.IDENTITY_MATRIX; 11677 this.transformStack = []; 11678 this.extraStack = []; 11679 this.commonObjs = commonObjs; 11680 this.objs = objs; 11681 this.pendingClip = null; 11682 this.pendingEOFill = false; 11683 this.embedFonts = false; 11684 this.embeddedFonts = Object.create(null); 11685 this.cssStyle = null; 11686 this.forceDataSchema = !!forceDataSchema; 11687 this._operatorIdMapping = []; 11688 11689 for (const op in _util.OPS) { 11690 this._operatorIdMapping[_util.OPS[op]] = op; 11691 } 11692 } 11693 11694 save() { 11695 this.transformStack.push(this.transformMatrix); 11696 const old = this.current; 11697 this.extraStack.push(old); 11698 this.current = old.clone(); 11699 } 11700 11701 restore() { 11702 this.transformMatrix = this.transformStack.pop(); 11703 this.current = this.extraStack.pop(); 11704 this.pendingClip = null; 11705 this.tgrp = null; 11706 } 11707 11708 group(items) { 11709 this.save(); 11710 this.executeOpTree(items); 11711 this.restore(); 11712 } 11713 11714 loadDependencies(operatorList) { 11715 const fnArray = operatorList.fnArray; 11716 const argsArray = operatorList.argsArray; 11717 11718 for (let i = 0, ii = fnArray.length; i < ii; i++) { 11719 if (fnArray[i] !== _util.OPS.dependency) { 11720 continue; 11721 } 11722 11723 for (const obj of argsArray[i]) { 11724 const objsPool = obj.startsWith("g_") ? this.commonObjs : this.objs; 11725 const promise = new Promise(resolve => { 11726 objsPool.get(obj, resolve); 11727 }); 11728 this.current.dependencies.push(promise); 11729 } 11730 } 11731 11732 return Promise.all(this.current.dependencies); 11733 } 11734 11735 transform(a, b, c, d, e, f) { 11736 const transformMatrix = [a, b, c, d, e, f]; 11737 this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); 11738 this.tgrp = null; 11739 } 11740 11741 getSVG(operatorList, viewport) { 11742 this.viewport = viewport; 11743 11744 const svgElement = this._initialize(viewport); 11745 11746 return this.loadDependencies(operatorList).then(() => { 11747 this.transformMatrix = _util.IDENTITY_MATRIX; 11748 this.executeOpTree(this.convertOpList(operatorList)); 11749 return svgElement; 11750 }); 11751 } 11752 11753 convertOpList(operatorList) { 11754 const operatorIdMapping = this._operatorIdMapping; 11755 const argsArray = operatorList.argsArray; 11756 const fnArray = operatorList.fnArray; 11757 const opList = []; 11758 11759 for (let i = 0, ii = fnArray.length; i < ii; i++) { 11760 const fnId = fnArray[i]; 11761 opList.push({ 11762 fnId, 11763 fn: operatorIdMapping[fnId], 11764 args: argsArray[i] 11765 }); 11766 } 11767 11768 return opListToTree(opList); 11769 } 11770 11771 executeOpTree(opTree) { 11772 for (const opTreeElement of opTree) { 11773 const fn = opTreeElement.fn; 11774 const fnId = opTreeElement.fnId; 11775 const args = opTreeElement.args; 11776
11777 switch (fnId | 0) { 11778 case _util.OPS.beginText: 11779 this.beginText(); 11780 break; 11781 11782 case _util.OPS.dependency: 11783 break; 11784 11785 case _util.OPS.setLeading: 11786 this.setLeading(args); 11787 break; 11788 11789 case _util.OPS.setLeadingMoveText: 11790 this.setLeadingMoveText(args[0], args[1]); 11791 break; 11792 11793 case _util.OPS.setFont: 11794 this.setFont(args); 11795 break; 11796 11797 case _util.OPS.showText: 11798 this.showText(args[0]); 11799 break; 11800 11801 case _util.OPS.showSpacedText: 11802 this.showText(args[0]); 11803 break; 11804 11805 case _util.OPS.endText: 11806 this.endText(); 11807 break; 11808 11809 case _util.OPS.moveText: 11810 this.moveText(args[0], args[1]); 11811 break; 11812 11813 case _util.OPS.setCharSpacing: 11814 this.setCharSpacing(args[0]); 11815 break; 11816 11817 case _util.OPS.setWordSpacing: 11818 this.setWordSpacing(args[0]); 11819 break; 11820 11821 case _util.OPS.setHScale: 11822 this.setHScale(args[0]); 11823 break; 11824 11825 case _util.OPS.setTextMatrix: 11826 this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 11827 break; 11828 11829 case _util.OPS.setTextRise: 11830 this.setTextRise(args[0]); 11831 break; 11832 11833 case _util.OPS.setTextRenderingMode: 11834 this.setTextRenderingMode(args[0]); 11835 break; 11836 11837 case _util.OPS.setLineWidth: 11838 this.setLineWidth(args[0]); 11839 break; 11840 11841 case _util.OPS.setLineJoin: 11842 this.setLineJoin(args[0]); 11843 break; 11844 11845 case _util.OPS.setLineCap: 11846 this.setLineCap(args[0]); 11847 break; 11848 11849 case _util.OPS.setMiterLimit: 11850 this.setMiterLimit(args[0]); 11851 break; 11852 11853 case _util.OPS.setFillRGBColor: 11854 this.setFillRGBColor(args[0], args[1], args[2]); 11855 break; 11856 11857 case _util.OPS.setStrokeRGBColor: 11858 this.setStrokeRGBColor(args[0], args[1], args[2]); 11859 break; 11860 11861 case _util.OPS.setStrokeColorN: 11862 this.setStrokeColorN(args); 11863 break; 11864 11865 case _util.OPS.setFillColorN: 11866 this.setFillColorN(args); 11867 break; 11868 11869 case _util.OPS.shadingFill: 11870 this.shadingFill(args[0]); 11871 break; 11872 11873 case _util.OPS.setDash: 11874 this.setDash(args[0], args[1]); 11875 break; 11876 11877 case _util.OPS.setRenderingIntent: 11878 this.setRenderingIntent(args[0]); 11879 break; 11880 11881 case _util.OPS.setFlatness: 11882 this.setFlatness(args[0]); 11883 break; 11884 11885 case _util.OPS.setGState: 11886 this.setGState(args[0]); 11887 break; 11888 11889 case _util.OPS.fill: 11890 this.fill(); 11891 break; 11892 11893 case _util.OPS.eoFill: 11894 this.eoFill(); 11895 break; 11896 11897 case _util.OPS.stroke: 11898 this.stroke(); 11899 break; 11900 11901 case _util.OPS.fillStroke: 11902 this.fillStroke(); 11903 break; 11904 11905 case _util.OPS.eoFillStroke: 11906 this.eoFillStroke(); 11907 break; 11908 11909 case _util.OPS.clip: 11910 this.clip("nonzero"); 11911 break; 11912 11913 case _util.OPS.eoClip: 11914 this.clip("evenodd"); 11915 break; 11916 11917 case _util.OPS.paintSolidColorImageMask: 11918 this.paintSolidColorImageMask(); 11919 break; 11920 11921 case _util.OPS.paintImageXObject: 11922 this.paintImageXObject(args[0]); 11923 break; 11924 11925 case _util.OPS.paintInlineImageXObject: 11926 this.paintInlineImageXObject(args[0]); 11927 break; 11928 11929 case _util.OPS.paintImageMaskXObject: 11930 this.paintImageMaskXObject(args[0]); 11931 break; 11932 11933 case _util.OPS.paintFormXObjectBegin: 11934 this.paintFormXObjectBegin(args[0], args[1]); 11935 break; 11936 11937 case _util.OPS.paintFormXObjectEnd: 11938 this.paintFormXObjectEnd(); 11939 break; 11940 11941 case _util.OPS.closePath: 11942 this.closePath(); 11943 break; 11944 11945 case _util.OPS.closeStroke: 11946 this.closeStroke(); 11947 break; 11948 11949 case _util.OPS.closeFillStroke: 11950 this.closeFillStroke(); 11951 break; 11952 11953 case _util.OPS.closeEOFillStroke: 11954 this.closeEOFillStroke(); 11955 break; 11956 11957 case _util.OPS.nextLine: 11958 this.nextLine(); 11959 break; 11960 11961 case _util.OPS.transform: 11962 this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); 11963 break; 11964 11965 case _util.OPS.constructPath: 11966 this.constructPath(args[0], args[1]); 11967 break; 11968 11969 case _util.OPS.endPath: 11970 this.endPath(); 11971 break; 11972 11973 case 92: 11974 this.group(opTreeElement.items); 11975 break; 11976 11977 default: 11978 (0, _util.warn)(`Unimplemented operator ${fn}`); 11979 break; 11980 } 11981 } 11982 } 11983 11984 setWordSpacing(wordSpacing) { 11985 this.current.wordSpacing = wordSpacing; 11986 } 11987 11988 setCharSpacing(charSpacing) { 11989 this.current.charSpacing = charSpacing; 11990 } 11991 11992 nextLine() { 11993 this.moveText(0, this.current.leading); 11994 } 11995 11996 setTextMatrix(a, b, c, d, e, f) { 11997 const current = this.current; 11998 current.textMatrix = current.lineMatrix = [a, b, c, d, e, f]; 11999 current.textMatrixScale = Math.sqrt(a * a + b * b); 12000 current.x = current.lineX = 0; 12001 current.y = current.lineY = 0; 12002 current.xcoords = []; 12003 current.ycoords = []; 12004 current.tspan = this.svgFactory.createElement("svg:tspan"); 12005 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 12006 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 12007 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 12008 current.txtElement = this.svgFactory.createElement("svg:text"); 12009 current.txtElement.appendChild(current.tspan); 12010 } 12011 12012 beginText() { 12013 const current = this.current; 12014 current.x = current.lineX = 0; 12015 current.y = current.lineY = 0; 12016 current.textMatrix = _util.IDENTITY_MATRIX; 12017 current.lineMatrix = _util.IDENTITY_MATRIX; 12018 current.textMatrixScale = 1; 12019 current.tspan = this.svgFactory.createElement("svg:tspan"); 12020 current.txtElement = this.svgFactory.createElement("svg:text"); 12021 current.txtgrp = this.svgFactory.createElement("svg:g"); 12022 current.xcoords = []; 12023 current.ycoords = []; 12024 } 12025 12026 moveText(x, y) { 12027 const current = this.current; 12028 current.x = current.lineX += x; 12029 current.y = current.lineY += y; 12030 current.xcoords = []; 12031 current.ycoords = []; 12032 current.tspan = this.svgFactory.createElement("svg:tspan"); 12033 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 12034 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 12035 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 12036 } 12037 12038 showText(glyphs) { 12039 const current = this.current; 12040 const font = current.font; 12041 const fontSize = current.fontSize; 12042 12043 if (fontSize === 0) { 12044 return; 12045 } 12046 12047 const fontSizeScale = current.fontSizeScale; 12048 const charSpacing = current.charSpacing; 12049 const wordSpacing = current.wordSpacing; 12050 const fontDirection = current.fontDirection; 12051 const textHScale = current.textHScale * fontDirection; 12052 const vertical = font.vertical; 12053 const spacingDir = vertical ? 1 : -1; 12054 const defaultVMetrics = font.defaultVMetrics; 12055 const widthAdvanceScale = fontSize * current.fontMatrix[0]; 12056 let x = 0; 12057 12058 for (const glyph of glyphs) { 12059 if (glyph === null) { 12060 x += fontDirection * wordSpacing; 12061 continue; 12062 }
12062 else if ((0, _util.isNum)(glyph)) { 12063 x += spacingDir * glyph * fontSize / 1000; 12064 continue; 12065 } 12066 12067 const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 12068 const character = glyph.fontChar; 12069 let scaledX, scaledY; 12070 let width = glyph.width; 12071 12072 if (vertical) { 12073 let vx; 12074 const vmetric = glyph.vmetric || defaultVMetrics; 12075 vx = glyph.vmetric ? vmetric[1] : width * 0.5; 12076 vx = -vx * widthAdvanceScale; 12077 const vy = vmetric[2] * widthAdvanceScale; 12078 width = vmetric ? -vmetric[0] : width; 12079 scaledX = vx / fontSizeScale; 12080 scaledY = (x + vy) / fontSizeScale; 12081 } else { 12082 scaledX = x / fontSizeScale; 12083 scaledY = 0; 12084 } 12085 12086 if (glyph.isInFont || font.missingFile) { 12087 current.xcoords.push(current.x + scaledX); 12088 12089 if (vertical) { 12090 current.ycoords.push(-current.y + scaledY); 12091 } 12092 12093 current.tspan.textContent += character; 12094 } else {} 12095 12096 let charWidth; 12097 12098 if (vertical) { 12099 charWidth = width * widthAdvanceScale - spacing * fontDirection; 12100 } else { 12101 charWidth = width * widthAdvanceScale + spacing * fontDirection; 12102 } 12103 12104 x += charWidth; 12105 } 12106 12107 current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" ")); 12108 12109 if (vertical) { 12110 current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" ")); 12111 } else { 12112 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 12113 } 12114 12115 if (vertical) { 12116 current.y -= x; 12117 } else { 12118 current.x += x * textHScale; 12119 } 12120 12121 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 12122 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 12123 12124 if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { 12125 current.tspan.setAttributeNS(null, "font-style", current.fontStyle); 12126 } 12127 12128 if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { 12129 current.tspan.setAttributeNS(null, "font-weight", current.fontWeight); 12130 } 12131 12132 const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 12133 12134 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 12135 if (current.fillColor !== SVG_DEFAULTS.fillColor) { 12136 current.tspan.setAttributeNS(null, "fill", current.fillColor); 12137 } 12138 12139 if (current.fillAlpha < 1) { 12140 current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha); 12141 } 12142 } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) { 12143 current.tspan.setAttributeNS(null, "fill", "transparent"); 12144 } else { 12145 current.tspan.setAttributeNS(null, "fill", "none"); 12146 } 12147 12148 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 12149 const lineWidthScale = 1 / (current.textMatrixScale || 1); 12150 12151 this._setStrokeAttributes(current.tspan, lineWidthScale); 12152 } 12153 12154 let textMatrix = current.textMatrix; 12155 12156 if (current.textRise !== 0) { 12157 textMatrix = textMatrix.slice(); 12158 textMatrix[5] += current.textRise; 12159 } 12160 12161 current.txtElement.setAttributeNS(null, "transform", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`); 12162 current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve"); 12163 current.txtElement.appendChild(current.tspan); 12164 current.txtgrp.appendChild(current.txtElement); 12165 12166 this._ensureTransformGroup().appendChild(current.txtElement); 12167 } 12168 12169 setLeadingMoveText(x, y) { 12170 this.setLeading(-y); 12171 this.moveText(x, y); 12172 } 12173 12174 addFontStyle(fontObj) { 12175 if (!fontObj.data) { 12176 throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.'); 12177 } 12178 12179 if (!this.cssStyle) { 12180 this.cssStyle = this.svgFactory.createElement("svg:style"); 12181 this.cssStyle.setAttributeNS(null, "type", "text/css"); 12182 this.defs.appendChild(this.cssStyle); 12183 } 12184 12185 const url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); 12186 this.cssStyle.textContent += `@font-face { font-family: "${fontObj.loadedName}";` + ` src: url(${url}); }\n`; 12187 } 12188 12189 setFont(details) { 12190 const current = this.current; 12191 const fontObj = this.commonObjs.get(details[0]); 12192 let size = details[1]; 12193 current.font = fontObj; 12194 12195 if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) { 12196 this.addFontStyle(fontObj); 12197 this.embeddedFonts[fontObj.loadedName] = fontObj; 12198 } 12199 12200 current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; 12201 let bold = "normal"; 12202 12203 if (fontObj.black) { 12204 bold = "900"; 12205 } else if (fontObj.bold) { 12206 bold = "bold"; 12207 } 12208 12209 const italic = fontObj.italic ? "italic" : "normal"; 12210 12211 if (size < 0) { 12212 size = -size; 12213 current.fontDirection = -1; 12214 } else { 12215 current.fontDirection = 1; 12216 } 12217 12218 current.fontSize = size; 12219 current.fontFamily = fontObj.loadedName; 12220 current.fontWeight = bold; 12221 current.fontStyle = italic; 12222 current.tspan = this.svgFactory.createElement("svg:tspan"); 12223 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 12224 current.xcoords = []; 12225 current.ycoords = []; 12226 } 12227 12228 endText() { 12229 const current = this.current; 12230 12231 if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { 12232 current.element = current.txtElement; 12233 this.clip("nonzero"); 12234 this.endPath(); 12235 } 12236 } 12237 12238 setLineWidth(width) { 12239 if (width > 0) { 12240 this.current.lineWidth = width; 12241 } 12242 } 12243 12244 setLineCap(style) { 12245 this.current.lineCap = LINE_CAP_STYLES[style]; 12246 } 12247 12248 setLineJoin(style) { 12249 this.current.lineJoin = LINE_JOIN_STYLES[style]; 12250 } 12251 12252 setMiterLimit(limit) { 12253 this.current.miterLimit = limit; 12254 } 12255 12256 setStrokeAlpha(strokeAlpha) { 12257 this.current.strokeAlpha = strokeAlpha; 12258 } 12259 12260 setStrokeRGBColor(r, g, b) { 12261 this.current.strokeColor = _util.Util.makeCssRgb(r, g, b); 12262 } 12263 12264 setFillAlpha(fillAlpha) { 12265 this.current.fillAlpha = fillAlpha; 12266 } 12267 12268 setFillRGBColor(r, g, b) { 12269 this.current.fillColor = _util.Util.makeCssRgb(r, g, b); 12270 this.current.tspan = this.svgFactory.createElement("svg:tspan"); 12271 this.current.xcoords = []; 12272 this.current.ycoords = []; 12273 } 12274 12275 setStrokeColorN(args) { 12276 this.current.strokeColor = this._makeColorN_Pattern(args); 12277 } 12278 12279 setFillColorN(args) { 12280 this.current.fillColor = this._makeColorN_Pattern(args); 12281 } 12282 12283 shadingFill(args) { 12284 const width = this.viewport.width; 12285 const height = this.viewport.height; 12286 12287 const inv = _util.Util.inverseTransform(this.transformMatrix); 12288 12289 const bl = _util.Util.applyTransform([0, 0], inv); 12290 12291 const br = _util.Util.applyTransform([0, height], inv); 12292 12293 const ul = _util.Util.applyTransform([width, 0], inv); 12294 12295 const ur = _util.Util.applyTransform([width, height], inv); 12296 12297 const x0 = Math.min(bl[0], br[0], ul[0], ur[0]); 12298 const y0 = Math.min(bl[1], br[1], ul[1], ur[1]); 12299 const x1 = Math.max(bl[0], br[0], ul[0], ur[0]); 12300 const y1 = Math.max(bl[1], br[1], ul[1], ur[1]); 12301 const rect = this.svgFactory.createElement("svg:rect"); 12302 rect.setAttributeNS(null, "x", x0); 12303 rect.setAttributeNS(null, "y", y0); 12304 rect.setAttributeNS(null, "width", x1 - x0); 12305 rect.setAttributeNS(null, "height", y1 - y0); 12306 rect.setAttributeNS(null, "fill", this._makeShadingPattern(args)); 12307 12308 if (this.current.fillAlpha < 1) { 12309 rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha); 12310 } 12311 12312 this._ensureTransformGroup().appendChild(rect); 12313 } 12314 12315 _makeColorN_Pattern(args) { 12316 if (args[0] === "TilingPattern") { 12317 return this._makeTilingPattern(args); 12318 } 12319 12320 return this._makeShadingPattern(args); 12321 } 12322 12323 _makeTilingPattern(args) { 12324 const color = args[1]; 12325 const operatorList = args[2]; 12326 const matrix = args[3] || _util.IDENTITY_MATRIX; 12327 const [x0, y0, x1, y1] = args[4]; 12328 const xstep = args[5]; 12329 const ystep = args[6]; 12330 const paintType = args[7]; 12331 const tilingId = `shading${shadingCount++}`; 12332
12333 const [tx0, ty0] = _util.Util.applyTransform([x0, y0], matrix); 12334 12335 const [tx1, ty1] = _util.Util.applyTransform([x1, y1], matrix); 12336 12337 const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix); 12338 12339 const txstep = xstep * xscale; 12340 const tystep = ystep * yscale; 12341 const tiling = this.svgFactory.createElement("svg:pattern"); 12342 tiling.setAttributeNS(null, "id", tilingId); 12343 tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse"); 12344 tiling.setAttributeNS(null, "width", txstep); 12345 tiling.setAttributeNS(null, "height", tystep); 12346 tiling.setAttributeNS(null, "x", `${tx0}`); 12347 tiling.setAttributeNS(null, "y", `${ty0}`); 12348 const svg = this.svg; 12349 const transformMatrix = this.transformMatrix; 12350 const fillColor = this.current.fillColor; 12351 const strokeColor = this.current.strokeColor; 12352 const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0); 12353 this.svg = bbox; 12354 this.transformMatrix = matrix; 12355 12356 if (paintType === 2) { 12357 const cssColor = _util.Util.makeCssRgb(...color); 12358 12359 this.current.fillColor = cssColor; 12360 this.current.strokeColor = cssColor; 12361 } 12362 12363 this.executeOpTree(this.convertOpList(operatorList)); 12364 this.svg = svg; 12365 this.transformMatrix = transformMatrix; 12366 this.current.fillColor = fillColor; 12367 this.current.strokeColor = strokeColor; 12368 tiling.appendChild(bbox.childNodes[0]); 12369 this.defs.appendChild(tiling); 12370 return `url(#${tilingId})`; 12371 } 12372 12373 _makeShadingPattern(args) { 12374 switch (args[0]) { 12375 case "RadialAxial": 12376 const shadingId = `shading${shadingCount++}`; 12377 const colorStops = args[3]; 12378 let gradient; 12379 12380 switch (args[1]) { 12381 case "axial": 12382 const point0 = args[4]; 12383 const point1 = args[5]; 12384 gradient = this.svgFactory.createElement("svg:linearGradient"); 12385 gradient.setAttributeNS(null, "id", shadingId); 12386 gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); 12387 gradient.setAttributeNS(null, "x1", point0[0]); 12388 gradient.setAttributeNS(null, "y1", point0[1]); 12389 gradient.setAttributeNS(null, "x2", point1[0]); 12390 gradient.setAttributeNS(null, "y2", point1[1]); 12391 break; 12392 12393 case "radial": 12394 const focalPoint = args[4]; 12395 const circlePoint = args[5]; 12396 const focalRadius = args[6]; 12397 const circleRadius = args[7]; 12398 gradient = this.svgFactory.createElement("svg:radialGradient"); 12399 gradient.setAttributeNS(null, "id", shadingId); 12400 gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); 12401 gradient.setAttributeNS(null, "cx", circlePoint[0]); 12402 gradient.setAttributeNS(null, "cy", circlePoint[1]); 12403 gradient.setAttributeNS(null, "r", circleRadius); 12404 gradient.setAttributeNS(null, "fx", focalPoint[0]); 12405 gradient.setAttributeNS(null, "fy", focalPoint[1]); 12406 gradient.setAttributeNS(null, "fr", focalRadius); 12407 break; 12408 12409 default: 12410 throw new Error(`Unknown RadialAxial type: ${args[1]}`); 12411 } 12412 12413 for (const colorStop of colorStops) { 12414 const stop = this.svgFactory.createElement("svg:stop"); 12415 stop.setAttributeNS(null, "offset", colorStop[0]); 12416 stop.setAttributeNS(null, "stop-color", colorStop[1]); 12417 gradient.appendChild(stop); 12418 } 12419 12420 this.defs.appendChild(gradient); 12421 return `url(#${shadingId})`; 12422 12423 case "Mesh": 12424 (0, _util.warn)("Unimplemented pattern Mesh"); 12425 return null; 12426 12427 case "Dummy": 12428 return "hotpink"; 12429 12430 default: 12431 throw new Error(`Unknown IR type: ${args[0]}`); 12432 } 12433 } 12434 12435 setDash(dashArray, dashPhase) { 12436 this.current.dashArray = dashArray; 12437 this.current.dashPhase = dashPhase; 12438 } 12439 12440 constructPath(ops, args) { 12441 const current = this.current; 12442 let x = current.x, 12443 y = current.y; 12444 let d = []; 12445 let j = 0; 12446 12447 for (const op of ops) { 12448 switch (op | 0) { 12449 case _util.OPS.rectangle: 12450 x = args[j++]; 12451 y = args[j++]; 12452 const width = args[j++]; 12453 const height = args[j++]; 12454 const xw = x + width; 12455 const yh = y + height; 12456 d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z"); 12457 break; 12458 12459 case _util.OPS.moveTo: 12460 x = args[j++]; 12461 y = args[j++]; 12462 d.push("M", pf(x), pf(y)); 12463 break; 12464 12465 case _util.OPS.lineTo: 12466 x = args[j++]; 12467 y = args[j++]; 12468 d.push("L", pf(x), pf(y)); 12469 break; 12470 12471 case _util.OPS.curveTo: 12472 x = args[j + 4]; 12473 y = args[j + 5]; 12474 d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); 12475 j += 6; 12476 break; 12477 12478 case _util.OPS.curveTo2: 12479 d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); 12480 x = args[j + 2]; 12481 y = args[j + 3]; 12482 j += 4; 12483 break; 12484 12485 case _util.OPS.curveTo3: 12486 x = args[j + 2]; 12487 y = args[j + 3]; 12488 d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); 12489 j += 4; 12490 break; 12491 12492 case _util.OPS.closePath: 12493 d.push("Z"); 12494 break; 12495 } 12496 } 12497 12498 d = d.join(" "); 12499 12500 if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) { 12501 d = current.path.getAttributeNS(null, "d") + d; 12502 } else { 12503 current.path = this.svgFactory.createElement("svg:path"); 12504 12505 this._ensureTransformGroup().appendChild(current.path); 12506 } 12507 12508 current.path.setAttributeNS(null, "d", d); 12509 current.path.setAttributeNS(null, "fill", "none"); 12510 current.element = current.path; 12511 current.setCurrentPoint(x, y); 12512 } 12513 12514 endPath() { 12515 const current = this.current; 12516 current.path = null; 12517 12518 if (!this.pendingClip) { 12519 return; 12520 } 12521 12522 if (!current.element) { 12523 this.pendingClip = null; 12524 return; 12525 } 12526 12527 const clipId = `clippath${clipCount++}`; 12528 const clipPath = this.svgFactory.createElement("svg:clipPath"); 12529 clipPath.setAttributeNS(null, "id", clipId); 12530 clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix)); 12531 const clipElement = current.element.cloneNode(true); 12532 12533 if (this.pendingClip === "evenodd") { 12534 clipElement.setAttributeNS(null, "clip-rule", "evenodd"); 12535 } else { 12536 clipElement.setAttributeNS(null, "clip-rule", "nonzero"); 12537 } 12538 12539 this.pendingClip = null; 12540 clipPath.appendChild(clipElement); 12541 this.defs.appendChild(clipPath); 12542 12543 if (current.activeClipUrl) { 12544 current.clipGroup = null; 12545 this.extraStack.forEach(function (prev) { 12546 prev.clipGroup = null; 12547 }); 12548 clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl); 12549 } 12550 12551 current.activeClipUrl = `url(#${clipId})`; 12552 this.tgrp = null; 12553 } 12554 12555 clip(type) { 12556 this.pendingClip = type; 12557 } 12558 12559 closePath() { 12560 const current = this.current; 12561 12562 if (current.path) { 12563 const d = `${current.path.getAttributeNS(null, "d")}Z`; 12564 current.path.setAttributeNS(null, "d", d); 12565 } 12566 } 12567 12568 setLeading(leading) { 12569 this.current.leading = -leading; 12570 } 12571 12572 setTextRise(textRise) { 12573 this.current.textRise = textRise; 12574 } 12575 12576 setTextRenderingMode(textRenderingMode) { 12577 this.current.textRenderingMode = textRenderingMode; 12578 } 12579 12580 setHScale(scale) { 12581 this.current.textHScale = scale / 100; 12582 } 12583
12584 setRenderingIntent(intent) {} 12585 12586 setFlatness(flatness) {} 12587 12588 setGState(states) { 12589 for (const [key, value] of states) { 12590 switch (key) { 12591 case "LW": 12592 this.setLineWidth(value); 12593 break; 12594 12595 case "LC": 12596 this.setLineCap(value); 12597 break; 12598 12599 case "LJ": 12600 this.setLineJoin(value); 12601 break; 12602 12603 case "ML": 12604 this.setMiterLimit(value); 12605 break; 12606 12607 case "D": 12608 this.setDash(value[0], value[1]); 12609 break; 12610 12611 case "RI": 12612 this.setRenderingIntent(value); 12613 break; 12614 12615 case "FL": 12616 this.setFlatness(value); 12617 break; 12618 12619 case "Font": 12620 this.setFont(value); 12621 break; 12622 12623 case "CA": 12624 this.setStrokeAlpha(value); 12625 break; 12626 12627 case "ca": 12628 this.setFillAlpha(value); 12629 break; 12630 12631 default: 12632 (0, _util.warn)(`Unimplemented graphic state operator ${key}`); 12633 break; 12634 } 12635 } 12636 } 12637 12638 fill() { 12639 const current = this.current; 12640 12641 if (current.element) { 12642 current.element.setAttributeNS(null, "fill", current.fillColor); 12643 current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha); 12644 this.endPath(); 12645 } 12646 } 12647 12648 stroke() { 12649 const current = this.current; 12650 12651 if (current.element) { 12652 this._setStrokeAttributes(current.element); 12653 12654 current.element.setAttributeNS(null, "fill", "none"); 12655 this.endPath(); 12656 } 12657 } 12658 12659 _setStrokeAttributes(element, lineWidthScale = 1) { 12660 const current = this.current; 12661 let dashArray = current.dashArray; 12662 12663 if (lineWidthScale !== 1 && dashArray.length > 0) { 12664 dashArray = dashArray.map(function (value) { 12665 return lineWidthScale * value; 12666 }); 12667 } 12668 12669 element.setAttributeNS(null, "stroke", current.strokeColor); 12670 element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha); 12671 element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit)); 12672 element.setAttributeNS(null, "stroke-linecap", current.lineCap); 12673 element.setAttributeNS(null, "stroke-linejoin", current.lineJoin); 12674 element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px"); 12675 element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" ")); 12676 element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px"); 12677 } 12678 12679 eoFill() { 12680 if (this.current.element) { 12681 this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); 12682 } 12683 12684 this.fill(); 12685 } 12686 12687 fillStroke() { 12688 this.stroke(); 12689 this.fill(); 12690 } 12691 12692 eoFillStroke() { 12693 if (this.current.element) { 12694 this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); 12695 } 12696 12697 this.fillStroke(); 12698 } 12699 12700 closeStroke() { 12701 this.closePath(); 12702 this.stroke(); 12703 } 12704 12705 closeFillStroke() { 12706 this.closePath(); 12707 this.fillStroke(); 12708 } 12709 12710 closeEOFillStroke() { 12711 this.closePath(); 12712 this.eoFillStroke(); 12713 } 12714 12715 paintSolidColorImageMask() { 12716 const rect = this.svgFactory.createElement("svg:rect"); 12717 rect.setAttributeNS(null, "x", "0"); 12718 rect.setAttributeNS(null, "y", "0"); 12719 rect.setAttributeNS(null, "width", "1px"); 12720 rect.setAttributeNS(null, "height", "1px"); 12721 rect.setAttributeNS(null, "fill", this.current.fillColor); 12722 12723 this._ensureTransformGroup().appendChild(rect); 12724 } 12725 12726 paintImageXObject(objId) { 12727 const imgData = this.objs.get(objId); 12728 12729 if (!imgData) { 12730 (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`); 12731 return; 12732 } 12733 12734 this.paintInlineImageXObject(imgData); 12735 } 12736 12737 paintInlineImageXObject(imgData, mask) { 12738 const width = imgData.width; 12739 const height = imgData.height; 12740 const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask); 12741 const cliprect = this.svgFactory.createElement("svg:rect"); 12742 cliprect.setAttributeNS(null, "x", "0"); 12743 cliprect.setAttributeNS(null, "y", "0"); 12744 cliprect.setAttributeNS(null, "width", pf(width)); 12745 cliprect.setAttributeNS(null, "height", pf(height)); 12746 this.current.element = cliprect; 12747 this.clip("nonzero"); 12748 const imgEl = this.svgFactory.createElement("svg:image"); 12749 imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc); 12750 imgEl.setAttributeNS(null, "x", "0"); 12751 imgEl.setAttributeNS(null, "y", pf(-height)); 12752 imgEl.setAttributeNS(null, "width", pf(width) + "px"); 12753 imgEl.setAttributeNS(null, "height", pf(height) + "px"); 12754 imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / width)} ${pf(-1 / height)})`); 12755 12756 if (mask) { 12757 mask.appendChild(imgEl); 12758 } else { 12759 this._ensureTransformGroup().appendChild(imgEl); 12760 } 12761 } 12762 12763 paintImageMaskXObject(imgData) { 12764 const current = this.current; 12765 const width = imgData.width; 12766 const height = imgData.height; 12767 const fillColor = current.fillColor; 12768 current.maskId = `mask${maskCount++}`; 12769 const mask = this.svgFactory.createElement("svg:mask"); 12770 mask.setAttributeNS(null, "id", current.maskId); 12771 const rect = this.svgFactory.createElement("svg:rect"); 12772 rect.setAttributeNS(null, "x", "0"); 12773 rect.setAttributeNS(null, "y", "0"); 12774 rect.setAttributeNS(null, "width", pf(width)); 12775 rect.setAttributeNS(null, "height", pf(height)); 12776 rect.setAttributeNS(null, "fill", fillColor); 12777 rect.setAttributeNS(null, "mask", `url(#${current.maskId})`); 12778 this.defs.appendChild(mask); 12779 12780 this._ensureTransformGroup().appendChild(rect); 12781 12782 this.paintInlineImageXObject(imgData, mask); 12783 } 12784 12785 paintFormXObjectBegin(matrix, bbox) { 12786 if (Array.isArray(matrix) && matrix.length === 6) {
12787 this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); 12788 } 12789 12790 if (bbox) { 12791 const width = bbox[2] - bbox[0]; 12792 const height = bbox[3] - bbox[1]; 12793 const cliprect = this.svgFactory.createElement("svg:rect"); 12794 cliprect.setAttributeNS(null, "x", bbox[0]); 12795 cliprect.setAttributeNS(null, "y", bbox[1]); 12796 cliprect.setAttributeNS(null, "width", pf(width)); 12797 cliprect.setAttributeNS(null, "height", pf(height)); 12798 this.current.element = cliprect; 12799 this.clip("nonzero"); 12800 this.endPath(); 12801 } 12802 } 12803 12804 paintFormXObjectEnd() {} 12805 12806 _initialize(viewport) { 12807 const svg = this.svgFactory.create(viewport.width, viewport.height); 12808 const definitions = this.svgFactory.createElement("svg:defs"); 12809 svg.appendChild(definitions); 12810 this.defs = definitions; 12811 const rootGroup = this.svgFactory.createElement("svg:g"); 12812 rootGroup.setAttributeNS(null, "transform", pm(viewport.transform)); 12813 svg.appendChild(rootGroup); 12814 this.svg = rootGroup; 12815 return svg; 12816 } 12817 12818 _ensureClipGroup() { 12819 if (!this.current.clipGroup) { 12820 const clipGroup = this.svgFactory.createElement("svg:g"); 12821 clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl); 12822 this.svg.appendChild(clipGroup); 12823 this.current.clipGroup = clipGroup; 12824 } 12825 12826 return this.current.clipGroup; 12827 } 12828 12829 _ensureTransformGroup() { 12830 if (!this.tgrp) { 12831 this.tgrp = this.svgFactory.createElement("svg:g"); 12832 this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix)); 12833 12834 if (this.current.activeClipUrl) { 12835 this._ensureClipGroup().appendChild(this.tgrp); 12836 } else { 12837 this.svg.appendChild(this.tgrp); 12838 } 12839 } 12840 12841 return this.tgrp; 12842 } 12843 12844 }; 12845} 12846 12847/***/ }), 12848/* 19 */ 12849/***/ (function(module, exports, __w_pdfjs_require__) { 12850 12851"use strict"; 12852 12853 12854Object.defineProperty(exports, "__esModule", { 12855 value: true 12856}); 12857exports.PDFNodeStream = void 0; 12858 12859var _util = __w_pdfjs_require__(2); 12860 12861var _network_utils = __w_pdfjs_require__(20); 12862 12863; 12864 12865const fs = require("fs"); 12866 12867const http = require("http"); 12868 12869const https = require("https"); 12870 12871const url = require("url"); 12872
12873const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//; 12874 12875function parseUrl(sourceUrl) { 12876 const parsedUrl = url.parse(sourceUrl); 12877 12878 if (parsedUrl.protocol === "file:" || parsedUrl.host) { 12879 return parsedUrl; 12880 } 12881 12882 if (/^[a-z]:[/\\]/i.test(sourceUrl)) { 12883 return url.parse(`file:///${sourceUrl}`); 12884 } 12885 12886 if (!parsedUrl.host) { 12887 parsedUrl.protocol = "file:"; 12888 } 12889 12890 return parsedUrl; 12891} 12892 12893class PDFNodeStream { 12894 constructor(source) { 12895 this.source = source; 12896 this.url = parseUrl(source.url); 12897 this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:"; 12898 this.isFsUrl = this.url.protocol === "file:"; 12899 this.httpHeaders = this.isHttp && source.httpHeaders || {}; 12900 this._fullRequestReader = null; 12901 this._rangeRequestReaders = []; 12902 } 12903 12904 get _progressiveDataLength() { 12905 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 12906 } 12907 12908 getFullReader() { 12909 (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."); 12910 this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); 12911 return this._fullRequestReader; 12912 } 12913 12914 getRangeReader(start, end) { 12915 if (end <= this._progressiveDataLength) { 12916 return null; 12917 } 12918 12919 const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); 12920 12921 this._rangeRequestReaders.push(rangeReader); 12922 12923 return rangeReader; 12924 } 12925 12926 cancelAllRequests(reason) { 12927 if (this._fullRequestReader) { 12928 this._fullRequestReader.cancel(reason); 12929 } 12930 12931 const readers = this._rangeRequestReaders.slice(0); 12932 12933 readers.forEach(function (reader) { 12934 reader.cancel(reason); 12935 }); 12936 } 12937 12938} 12939 12940exports.PDFNodeStream = PDFNodeStream; 12941 12942class BaseFullReader { 12943 constructor(stream) { 12944 this._url = stream.url; 12945 this._done = false; 12946 this._storedError = null; 12947 this.onProgress = null; 12948 const source = stream.source; 12949 this._contentLength = source.length; 12950 this._loaded = 0; 12951 this._filename = null; 12952 this._disableRange = source.disableRange || false; 12953 this._rangeChunkSize = source.rangeChunkSize; 12954 12955 if (!this._rangeChunkSize && !this._disableRange) { 12956 this._disableRange = true; 12957 } 12958 12959 this._isStreamingSupported = !source.disableStream; 12960 this._isRangeSupported = !source.disableRange; 12961 this._readableStream = null; 12962 this._readCapability = (0, _util.createPromiseCapability)(); 12963 this._headersCapability = (0, _util.createPromiseCapability)(); 12964 } 12965 12966 get headersReady() { 12967 return this._headersCapability.promise; 12968 } 12969 12970 get filename() { 12971 return this._filename; 12972 } 12973 12974 get contentLength() { 12975 return this._contentLength; 12976 } 12977 12978 get isRangeSupported() { 12979 return this._isRangeSupported; 12980 } 12981 12982 get isStreamingSupported() { 12983 return this._isStreamingSupported; 12984 } 12985 12986 async read() { 12987 await this._readCapability.promise; 12988 12989 if (this._done) { 12990 return { 12991 value: undefined, 12992 done: true 12993 }; 12994 } 12995 12996 if (this._storedError) { 12997 throw this._storedError; 12998 } 12999 13000 const chunk = this._readableStream.read(); 13001 13002 if (chunk === null) { 13003 this._readCapability = (0, _util.createPromiseCapability)(); 13004 return this.read(); 13005 } 13006 13007 this._loaded += chunk.length; 13008 13009 if (this.onProgress) { 13010 this.onProgress({ 13011 loaded: this._loaded, 13012 total: this._contentLength 13013 }); 13014 } 13015 13016 const buffer = new Uint8Array(chunk).buffer; 13017 return { 13018 value: buffer, 13019 done: false 13020 }; 13021 } 13022 13023 cancel(reason) { 13024 if (!this._readableStream) { 13025 this._error(reason); 13026 13027 return; 13028 } 13029 13030 this._readableStream.destroy(reason); 13031 } 13032 13033 _error(reason) { 13034 this._storedError = reason; 13035 13036 this._readCapability.resolve(); 13037 } 13038 13039 _setReadableStream(readableStream) { 13040 this._readableStream = readableStream; 13041 readableStream.on("readable", () => { 13042 this._readCapability.resolve(); 13043 }); 13044 readableStream.on("end", () => { 13045 readableStream.destroy(); 13046 this._done = true; 13047 13048 this._readCapability.resolve(); 13049 }); 13050 readableStream.on("error", reason => { 13051 this._error(reason); 13052 }); 13053 13054 if (!this._isStreamingSupported && this._isRangeSupported) { 13055 this._error(new _util.AbortException("streaming is disabled")); 13056 } 13057 13058 if (this._storedError) { 13059 this._readableStream.destroy(this._storedError); 13060 } 13061 } 13062 13063} 13064 13065class BaseRangeReader { 13066 constructor(stream) { 13067 this._url = stream.url; 13068 this._done = false;
13069 this._storedError = null; 13070 this.onProgress = null; 13071 this._loaded = 0; 13072 this._readableStream = null; 13073 this._readCapability = (0, _util.createPromiseCapability)(); 13074 const source = stream.source; 13075 this._isStreamingSupported = !source.disableStream; 13076 } 13077 13078 get isStreamingSupported() { 13079 return this._isStreamingSupported; 13080 } 13081 13082 async read() { 13083 await this._readCapability.promise; 13084 13085 if (this._done) { 13086 return { 13087 value: undefined, 13088 done: true 13089 }; 13090 } 13091 13092 if (this._storedError) { 13093 throw this._storedError; 13094 } 13095 13096 const chunk = this._readableStream.read(); 13097 13098 if (chunk === null) { 13099 this._readCapability = (0, _util.createPromiseCapability)(); 13100 return this.read(); 13101 } 13102 13103 this._loaded += chunk.length; 13104 13105 if (this.onProgress) { 13106 this.onProgress({ 13107 loaded: this._loaded 13108 }); 13109 } 13110 13111 const buffer = new Uint8Array(chunk).buffer; 13112 return { 13113 value: buffer, 13114 done: false 13115 }; 13116 } 13117 13118 cancel(reason) { 13119 if (!this._readableStream) { 13120 this._error(reason); 13121 13122 return; 13123 } 13124 13125 this._readableStream.destroy(reason); 13126 } 13127 13128 _error(reason) { 13129 this._storedError = reason; 13130 13131 this._readCapability.resolve(); 13132 } 13133 13134 _setReadableStream(readableStream) { 13135 this._readableStream = readableStream; 13136 readableStream.on("readable", () => { 13137 this._readCapability.resolve(); 13138 }); 13139 readableStream.on("end", () => { 13140 readableStream.destroy(); 13141 this._done = true; 13142 13143 this._readCapability.resolve(); 13144 }); 13145 readableStream.on("error", reason => { 13146 this._error(reason); 13147 }); 13148 13149 if (this._storedError) { 13150 this._readableStream.destroy(this._storedError); 13151 } 13152 } 13153 13154} 13155 13156function createRequestOptions(parsedUrl, headers) { 13157 return { 13158 protocol: parsedUrl.protocol, 13159 auth: parsedUrl.auth, 13160 host: parsedUrl.hostname, 13161 port: parsedUrl.port, 13162 path: parsedUrl.path, 13163 method: "GET", 13164 headers 13165 }; 13166} 13167 13168class PDFNodeStreamFullReader extends BaseFullReader { 13169 constructor(stream) { 13170 super(stream); 13171 13172 const handleResponse = response => { 13173 if (response.statusCode === 404) { 13174 const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`); 13175 this._storedError = error; 13176 13177 this._headersCapability.reject(error); 13178 13179 return; 13180 } 13181 13182 this._headersCapability.resolve(); 13183 13184 this._setReadableStream(response); 13185 13186 const getResponseHeader = name => { 13187 return this._readableStream.headers[name.toLowerCase()]; 13188 }; 13189 13190 const { 13191 allowRangeRequests, 13192 suggestedLength 13193 } = (0, _network_utils.validateRangeRequestCapabilities)({ 13194 getResponseHeader, 13195 isHttp: stream.isHttp, 13196 rangeChunkSize: this._rangeChunkSize, 13197 disableRange: this._disableRange 13198 }); 13199 this._isRangeSupported = allowRangeRequests; 13200 this._contentLength = suggestedLength || this._contentLength; 13201 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 13202 }; 13203 13204 this._request = null; 13205 13206 if (this._url.protocol === "http:") { 13207 this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse); 13208 } else { 13209 this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse); 13210 } 13211 13212 this._request.on("error", reason => { 13213 this._storedError = reason; 13214 13215 this._headersCapability.reject(reason); 13216 }); 13217 13218 this._request.end(); 13219 } 13220 13221} 13222 13223class PDFNodeStreamRangeReader extends BaseRangeReader { 13224 constructor(stream, start, end) { 13225 super(stream); 13226 this._httpHeaders = {}; 13227 13228 for (const property in stream.httpHeaders) { 13229 const value = stream.httpHeaders[property]; 13230 13231 if (typeof value === "undefined") { 13232 continue; 13233 } 13234 13235 this._httpHeaders[property] = value; 13236 } 13237 13238 this._httpHeaders.Range = `bytes=${start}-${end - 1}`; 13239 13240 const handleResponse = response => { 13241 if (response.statusCode === 404) { 13242 const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`); 13243 this._storedError = error; 13244 return; 13245 } 13246 13247 this._setReadableStream(response); 13248 }; 13249 13250 this._request = null; 13251 13252 if (this._url.protocol === "http:") { 13253 this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse); 13254 } else { 13255 this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse); 13256 } 13257 13258 this._request.on("error", reason => { 13259 this._storedError = reason; 13260 }); 13261 13262 this._request.end(); 13263 } 13264 13265} 13266 13267class PDFNodeStreamFsFullReader extends BaseFullReader { 13268 constructor(stream) { 13269 super(stream); 13270 let path = decodeURIComponent(this._url.path); 13271 13272 if (fileUriRegex.test(this._url.href)) { 13273 path = path.replace(/^\//, ""); 13274 } 13275 13276 fs.lstat(path, (error, stat) => { 13277 if (error) { 13278 if (error.code === "ENOENT") { 13279 error = new _util.MissingPDFException(`Missing PDF "${path}".`); 13280 } 13281 13282 this._storedError = error; 13283 13284 this._headersCapability.reject(error); 13285 13286 return; 13287 } 13288 13289 this._contentLength = stat.size; 13290 13291 this._setReadableStream(fs.createReadStream(path)); 13292 13293 this._headersCapability.resolve(); 13294 }); 13295 } 13296 13297} 13298 13299class PDFNodeStreamFsRangeReader extends BaseRangeReader { 13300 constructor(stream, start, end) { 13301 super(stream); 13302 let path = decodeURIComponent(this._url.path); 13303 13304 if (fileUriRegex.test(this._url.href)) { 13305 path = path.replace(/^\//, ""); 13306 } 13307 13308 this._setReadableStream(fs.createReadStream(path, { 13309 start, 13310 end: end - 1 13311 })); 13312 } 13313 13314} 13315 13316/***/ }), 13317/* 20 */ 13318/***/ (function(module, exports, __w_pdfjs_require__) { 13319 13320"use strict"; 13321 13322 13323Object.defineProperty(exports, "__esModule", { 13324 value: true 13325}); 13326exports.createResponseStatusError = createResponseStatusError; 13327exports.extractFilenameFromHeader = extractFilenameFromHeader; 13328exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; 13329exports.validateResponseStatus = validateResponseStatus; 13330 13331var _util = __w_pdfjs_require__(2); 13332 13333var _content_disposition = __w_pdfjs_require__(21); 13334 13335function validateRangeRequestCapabilities({ 13336 getResponseHeader, 13337 isHttp, 13338 rangeChunkSize, 13339 disableRange 13340}) { 13341 (0, _util.assert)(rangeChunkSize > 0, "Range chunk size must be larger than zero"); 13342 const returnValues = { 13343 allowRangeRequests: false, 13344 suggestedLength: undefined 13345 }; 13346 const length = parseInt(getResponseHeader("Content-Length"), 10); 13347 13348 if (!Number.isInteger(length)) { 13349 return returnValues; 13350 } 13351 13352 returnValues.suggestedLength = length; 13353 13354 if (length <= 2 * rangeChunkSize) { 13355 return returnValues; 13356 } 13357 13358 if (disableRange || !isHttp) { 13359 return returnValues; 13360 } 13361 13362 if (getResponseHeader("Accept-Ranges") !== "bytes") { 13363 return returnValues; 13364 } 13365 13366 const contentEncoding = getResponseHeader("Content-Encoding") || "identity"; 13367 13368 if (contentEncoding !== "identity") { 13369 return returnValues; 13370 } 13371 13372 returnValues.allowRangeRequests = true; 13373 return returnValues; 13374} 13375 13376function extractFilenameFromHeader(getResponseHeader) { 13377 const contentDisposition = getResponseHeader("Content-Disposition"); 13378 13379 if (contentDisposition) { 13380 let filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition); 13381 13382 if (filename.includes("%")) {
13383 try { 13384 filename = decodeURIComponent(filename); 13385 } catch (ex) {} 13386 } 13387 13388 if (/\.pdf$/i.test(filename)) { 13389 return filename; 13390 } 13391 } 13392 13393 return null; 13394} 13395 13396function createResponseStatusError(status, url) { 13397 if (status === 404 || status === 0 && url.startsWith("file:")) { 13398 return new _util.MissingPDFException('Missing PDF "' + url + '".'); 13399 } 13400 13401 return new _util.UnexpectedResponseException("Unexpected server response (" + status + ') while retrieving PDF "' + url + '".', status); 13402} 13403 13404function validateResponseStatus(status) { 13405 return status === 200 || status === 206; 13406} 13407 13408/***/ }), 13409/* 21 */ 13410/***/ (function(module, exports, __w_pdfjs_require__) { 13411 13412"use strict"; 13413 13414 13415Object.defineProperty(exports, "__esModule", { 13416 value: true 13417}); 13418exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader; 13419 13420function getFilenameFromContentDispositionHeader(contentDisposition) { 13421 let needsEncodingFixup = true; 13422 let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition); 13423 13424 if (tmp) { 13425 tmp = tmp[1]; 13426 let filename = rfc2616unquote(tmp); 13427 filename = unescape(filename); 13428 filename = rfc5987decode(filename); 13429 filename = rfc2047decode(filename); 13430 return fixupEncoding(filename); 13431 } 13432 13433 tmp = rfc2231getparam(contentDisposition); 13434 13435 if (tmp) { 13436 const filename = rfc2047decode(tmp); 13437 return fixupEncoding(filename); 13438 } 13439 13440 tmp = toParamRegExp("filename", "i").exec(contentDisposition); 13441 13442 if (tmp) { 13443 tmp = tmp[1]; 13444 let filename = rfc2616unquote(tmp); 13445 filename = rfc2047decode(filename); 13446 return fixupEncoding(filename); 13447 } 13448 13449 function toParamRegExp(attributePattern, flags) { 13450 return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags); 13451 } 13452 13453 function textdecode(encoding, value) { 13454 if (encoding) { 13455 if (!/^[\x00-\xFF]+$/.test(value)) { 13456 return value; 13457 } 13458 13459 try { 13460 const decoder = new TextDecoder(encoding, { 13461 fatal: true 13462 }); 13463 const bytes = Array.from(value, function (ch) { 13464 return ch.charCodeAt(0) & 0xff; 13465 }); 13466 value = decoder.decode(new Uint8Array(bytes)); 13467 needsEncodingFixup = false; 13468 } catch (e) { 13469 if (/^utf-?8$/i.test(encoding)) { 13470 try { 13471 value = decodeURIComponent(escape(value)); 13472 needsEncodingFixup = false; 13473 } catch (err) {} 13474 } 13475 } 13476 } 13477 13478 return value; 13479 } 13480 13481 function fixupEncoding(value) { 13482 if (needsEncodingFixup && /[\x80-\xff]/.test(value)) { 13483 value = textdecode("utf-8", value); 13484 13485 if (needsEncodingFixup) { 13486 value = textdecode("iso-8859-1", value); 13487 } 13488 } 13489 13490 return value; 13491 } 13492 13493 function rfc2231getparam(contentDispositionStr) { 13494 const matches = []; 13495 let match; 13496 const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig"); 13497 13498 while ((match = iter.exec(contentDispositionStr)) !== null) { 13499 let [, n, quot, part] = match; 13500 n = parseInt(n, 10); 13501 13502 if (n in matches) { 13503 if (n === 0) { 13504 break; 13505 } 13506 13507 continue; 13508 } 13509 13510 matches[n] = [quot, part]; 13511 } 13512 13513 const parts = []; 13514 13515 for (let n = 0; n < matches.length; ++n) { 13516 if (!(n in matches)) { 13517 break; 13518 } 13519 13520 let [quot, part] = matches[n]; 13521 part = rfc2616unquote(part); 13522 13523 if (quot) { 13524 part = unescape(part); 13525 13526 if (n === 0) { 13527 part = rfc5987decode(part); 13528 } 13529 } 13530 13531 parts.push(part); 13532 } 13533 13534 return parts.join(""); 13535 } 13536 13537 function rfc2616unquote(value) { 13538 if (value.startsWith('"')) { 13539 const parts = value.slice(1).split('\\"'); 13540 13541 for (let i = 0; i < parts.length; ++i) { 13542 const quotindex = parts[i].indexOf('"'); 13543 13544 if (quotindex !== -1) { 13545 parts[i] = parts[i].slice(0, quotindex); 13546 parts.length = i + 1; 13547 } 13548 13549 parts[i] = parts[i].replace(/\\(.)/g, "$1"); 13550 } 13551 13552 value = parts.join('"'); 13553 } 13554 13555 return value; 13556 } 13557 13558 function rfc5987decode(extvalue) { 13559 const encodingend = extvalue.indexOf("'"); 13560 13561 if (encodingend === -1) { 13562 return extvalue; 13563 } 13564 13565 const encoding = extvalue.slice(0, encodingend); 13566 const langvalue = extvalue.slice(encodingend + 1); 13567 const value = langvalue.replace(/^[^']*'/, ""); 13568 return textdecode(encoding, value); 13569 } 13570 13571 function rfc2047decode(value) { 13572 if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) { 13573 return value; 13574 } 13575 13576 return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) { 13577 if (encoding === "q" || encoding === "Q") { 13578 text = text.replace(/_/g, " "); 13579 text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) { 13580 return String.fromCharCode(parseInt(hex, 16)); 13581 }); 13582 return textdecode(charset, text); 13583 } 13584
13585 try { 13586 text = atob(text); 13587 } catch (e) {} 13588 13589 return textdecode(charset, text); 13590 }); 13591 } 13592 13593 return ""; 13594} 13595 13596/***/ }), 13597/* 22 */ 13598/***/ (function(module, exports, __w_pdfjs_require__) { 13599 13600"use strict"; 13601 13602 13603Object.defineProperty(exports, "__esModule", { 13604 value: true 13605}); 13606exports.PDFNetworkStream = void 0; 13607 13608var _util = __w_pdfjs_require__(2); 13609 13610var _network_utils = __w_pdfjs_require__(20); 13611 13612; 13613const OK_RESPONSE = 200; 13614const PARTIAL_CONTENT_RESPONSE = 206; 13615 13616function getArrayBuffer(xhr) { 13617 const data = xhr.response; 13618 13619 if (typeof data !== "string") { 13620 return data; 13621 } 13622 13623 const array = (0, _util.stringToBytes)(data); 13624 return array.buffer; 13625} 13626 13627class NetworkManager { 13628 constructor(url, args) { 13629 this.url = url; 13630 args = args || {}; 13631 this.isHttp = /^https?:/i.test(url); 13632 this.httpHeaders = this.isHttp && args.httpHeaders || {}; 13633 this.withCredentials = args.withCredentials || false; 13634 13635 this.getXhr = args.getXhr || function NetworkManager_getXhr() { 13636 return new XMLHttpRequest(); 13637 }; 13638 13639 this.currXhrId = 0; 13640 this.pendingRequests = Object.create(null); 13641 } 13642 13643 requestRange(begin, end, listeners) { 13644 const args = { 13645 begin, 13646 end 13647 }; 13648 13649 for (const prop in listeners) { 13650 args[prop] = listeners[prop]; 13651 } 13652 13653 return this.request(args); 13654 } 13655 13656 requestFull(listeners) { 13657 return this.request(listeners); 13658 } 13659 13660 request(args) { 13661 const xhr = this.getXhr(); 13662 const xhrId = this.currXhrId++; 13663 const pendingRequest = this.pendingRequests[xhrId] = { 13664 xhr 13665 }; 13666 xhr.open("GET", this.url); 13667 xhr.withCredentials = this.withCredentials; 13668 13669 for (const property in this.httpHeaders) { 13670 const value = this.httpHeaders[property]; 13671 13672 if (typeof value === "undefined") { 13673 continue; 13674 } 13675 13676 xhr.setRequestHeader(property, value); 13677 } 13678 13679 if (this.isHttp && "begin" in args && "end" in args) { 13680 xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`); 13681 pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE; 13682 } else { 13683 pendingRequest.expectedStatus = OK_RESPONSE; 13684 } 13685 13686 xhr.responseType = "arraybuffer"; 13687 13688 if (args.onError) { 13689 xhr.onerror = function (evt) { 13690 args.onError(xhr.status); 13691 }; 13692 } 13693 13694 xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); 13695 xhr.onprogress = this.onProgress.bind(this, xhrId); 13696 pendingRequest.onHeadersReceived = args.onHeadersReceived; 13697 pendingRequest.onDone = args.onDone; 13698 pendingRequest.onError = args.onError; 13699 pendingRequest.onProgress = args.onProgress; 13700 xhr.send(null); 13701 return xhrId; 13702 } 13703 13704 onProgress(xhrId, evt) { 13705 const pendingRequest = this.pendingRequests[xhrId]; 13706 13707 if (!pendingRequest) { 13708 return; 13709 } 13710 13711 if (pendingRequest.onProgress) { 13712 pendingRequest.onProgress(evt); 13713 } 13714 } 13715 13716 onStateChange(xhrId, evt) { 13717 const pendingRequest = this.pendingRequests[xhrId]; 13718 13719 if (!pendingRequest) { 13720 return; 13721 } 13722 13723 const xhr = pendingRequest.xhr; 13724 13725 if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { 13726 pendingRequest.onHeadersReceived(); 13727 delete pendingRequest.onHeadersReceived; 13728 } 13729 13730 if (xhr.readyState !== 4) { 13731 return; 13732 } 13733 13734 if (!(xhrId in this.pendingRequests)) { 13735 return; 13736 } 13737 13738 delete this.pendingRequests[xhrId]; 13739 13740 if (xhr.status === 0 && this.isHttp) { 13741 if (pendingRequest.onError) { 13742 pendingRequest.onError(xhr.status); 13743 } 13744 13745 return; 13746 } 13747 13748 const xhrStatus = xhr.status || OK_RESPONSE; 13749 const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; 13750 13751 if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { 13752 if (pendingRequest.onError) { 13753 pendingRequest.onError(xhr.status); 13754 } 13755 13756 return; 13757 } 13758 13759 const chunk = getArrayBuffer(xhr); 13760 13761 if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { 13762 const rangeHeader = xhr.getResponseHeader("Content-Range"); 13763 const matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); 13764 pendingRequest.onDone({ 13765 begin: parseInt(matches[1], 10), 13766 chunk 13767 }); 13768 } else if (chunk) { 13769 pendingRequest.onDone({ 13770 begin: 0, 13771 chunk 13772 }); 13773 } else if (pendingRequest.onError) { 13774 pendingRequest.onError(xhr.status); 13775 } 13776 } 13777 13778 hasPendingRequests() { 13779 for (const xhrId in this.pendingRequests) { 13780 return true; 13781 } 13782 13783 return false;
13784 } 13785 13786 getRequestXhr(xhrId) { 13787 return this.pendingRequests[xhrId].xhr; 13788 } 13789 13790 isPendingRequest(xhrId) { 13791 return xhrId in this.pendingRequests; 13792 } 13793 13794 abortAllRequests() { 13795 for (const xhrId in this.pendingRequests) { 13796 this.abortRequest(xhrId | 0); 13797 } 13798 } 13799 13800 abortRequest(xhrId) { 13801 const xhr = this.pendingRequests[xhrId].xhr; 13802 delete this.pendingRequests[xhrId]; 13803 xhr.abort(); 13804 } 13805 13806} 13807 13808class PDFNetworkStream { 13809 constructor(source) { 13810 this._source = source; 13811 this._manager = new NetworkManager(source.url, { 13812 httpHeaders: source.httpHeaders, 13813 withCredentials: source.withCredentials 13814 }); 13815 this._rangeChunkSize = source.rangeChunkSize; 13816 this._fullRequestReader = null; 13817 this._rangeRequestReaders = []; 13818 } 13819 13820 _onRangeRequestReaderClosed(reader) { 13821 const i = this._rangeRequestReaders.indexOf(reader); 13822 13823 if (i >= 0) { 13824 this._rangeRequestReaders.splice(i, 1); 13825 } 13826 } 13827 13828 getFullReader() { 13829 (0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."); 13830 this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); 13831 return this._fullRequestReader; 13832 } 13833 13834 getRangeReader(begin, end) { 13835 const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); 13836 reader.onClosed = this._onRangeRequestReaderClosed.bind(this); 13837 13838 this._rangeRequestReaders.push(reader); 13839 13840 return reader; 13841 } 13842 13843 cancelAllRequests(reason) { 13844 if (this._fullRequestReader) { 13845 this._fullRequestReader.cancel(reason); 13846 } 13847 13848 const readers = this._rangeRequestReaders.slice(0); 13849 13850 readers.forEach(function (reader) { 13851 reader.cancel(reason); 13852 }); 13853 } 13854 13855} 13856 13857exports.PDFNetworkStream = PDFNetworkStream; 13858 13859class PDFNetworkStreamFullRequestReader { 13860 constructor(manager, source) { 13861 this._manager = manager; 13862 const args = { 13863 onHeadersReceived: this._onHeadersReceived.bind(this), 13864 onDone: this._onDone.bind(this), 13865 onError: this._onError.bind(this), 13866 onProgress: this._onProgress.bind(this) 13867 }; 13868 this._url = source.url; 13869 this._fullRequestId = manager.requestFull(args); 13870 this._headersReceivedCapability = (0, _util.createPromiseCapability)(); 13871 this._disableRange = source.disableRange || false; 13872 this._contentLength = source.length; 13873 this._rangeChunkSize = source.rangeChunkSize; 13874 13875 if (!this._rangeChunkSize && !this._disableRange) { 13876 this._disableRange = true; 13877 } 13878 13879 this._isStreamingSupported = false; 13880 this._isRangeSupported = false; 13881 this._cachedChunks = []; 13882 this._requests = []; 13883 this._done = false; 13884 this._storedError = undefined; 13885 this._filename = null; 13886 this.onProgress = null; 13887 } 13888 13889 _onHeadersReceived() { 13890 const fullRequestXhrId = this._fullRequestId; 13891 13892 const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); 13893 13894 const getResponseHeader = name => { 13895 return fullRequestXhr.getResponseHeader(name); 13896 }; 13897 13898 const { 13899 allowRangeRequests, 13900 suggestedLength 13901 } = (0, _network_utils.validateRangeRequestCapabilities)({ 13902 getResponseHeader, 13903 isHttp: this._manager.isHttp, 13904 rangeChunkSize: this._rangeChunkSize, 13905 disableRange: this._disableRange 13906 }); 13907 13908 if (allowRangeRequests) { 13909 this._isRangeSupported = true; 13910 } 13911 13912 this._contentLength = suggestedLength || this._contentLength; 13913 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 13914 13915 if (this._isRangeSupported) { 13916 this._manager.abortRequest(fullRequestXhrId); 13917 } 13918 13919 this._headersReceivedCapability.resolve(); 13920 } 13921 13922 _onDone(args) { 13923 if (args) { 13924 if (this._requests.length > 0) { 13925 const requestCapability = this._requests.shift(); 13926 13927 requestCapability.resolve({ 13928 value: args.chunk, 13929 done: false 13930 }); 13931 } else { 13932 this._cachedChunks.push(args.chunk); 13933 } 13934 } 13935 13936 this._done = true; 13937 13938 if (this._cachedChunks.length > 0) { 13939 return; 13940 } 13941 13942 this._requests.forEach(function (requestCapability) { 13943 requestCapability.resolve({ 13944 value: undefined, 13945 done: true 13946 }); 13947 }); 13948 13949 this._requests = []; 13950 } 13951 13952 _onError(status) { 13953 const url = this._url; 13954 const exception = (0, _network_utils.createResponseStatusError)(status, url); 13955 this._storedError = exception; 13956 13957 this._headersReceivedCapability.reject(exception); 13958
13959 this._requests.forEach(function (requestCapability) { 13960 requestCapability.reject(exception); 13961 }); 13962 13963 this._requests = []; 13964 this._cachedChunks = []; 13965 } 13966 13967 _onProgress(data) { 13968 if (this.onProgress) { 13969 this.onProgress({ 13970 loaded: data.loaded, 13971 total: data.lengthComputable ? data.total : this._contentLength 13972 }); 13973 } 13974 } 13975 13976 get filename() { 13977 return this._filename; 13978 } 13979 13980 get isRangeSupported() { 13981 return this._isRangeSupported; 13982 } 13983 13984 get isStreamingSupported() { 13985 return this._isStreamingSupported; 13986 } 13987 13988 get contentLength() { 13989 return this._contentLength; 13990 } 13991 13992 get headersReady() { 13993 return this._headersReceivedCapability.promise; 13994 } 13995 13996 async read() { 13997 if (this._storedError) { 13998 throw this._storedError; 13999 } 14000 14001 if (this._cachedChunks.length > 0) { 14002 const chunk = this._cachedChunks.shift(); 14003 14004 return { 14005 value: chunk, 14006 done: false 14007 }; 14008 } 14009 14010 if (this._done) { 14011 return { 14012 value: undefined, 14013 done: true 14014 }; 14015 } 14016 14017 const requestCapability = (0, _util.createPromiseCapability)(); 14018 14019 this._requests.push(requestCapability); 14020 14021 return requestCapability.promise; 14022 } 14023 14024 cancel(reason) { 14025 this._done = true; 14026 14027 this._headersReceivedCapability.reject(reason); 14028 14029 this._requests.forEach(function (requestCapability) { 14030 requestCapability.resolve({ 14031 value: undefined, 14032 done: true 14033 }); 14034 }); 14035 14036 this._requests = []; 14037 14038 if (this._manager.isPendingRequest(this._fullRequestId)) { 14039 this._manager.abortRequest(this._fullRequestId); 14040 } 14041 14042 this._fullRequestReader = null; 14043 } 14044 14045} 14046 14047class PDFNetworkStreamRangeRequestReader { 14048 constructor(manager, begin, end) { 14049 this._manager = manager; 14050 const args = { 14051 onDone: this._onDone.bind(this), 14052 onProgress: this._onProgress.bind(this) 14053 }; 14054 this._requestId = manager.requestRange(begin, end, args); 14055 this._requests = []; 14056 this._queuedChunk = null; 14057 this._done = false; 14058 this.onProgress = null; 14059 this.onClosed = null; 14060 } 14061 14062 _close() { 14063 if (this.onClosed) { 14064 this.onClosed(this); 14065 } 14066 } 14067 14068 _onDone(data) { 14069 const chunk = data.chunk; 14070 14071 if (this._requests.length > 0) { 14072 const requestCapability = this._requests.shift(); 14073 14074 requestCapability.resolve({ 14075 value: chunk, 14076 done: false 14077 }); 14078 } else { 14079 this._queuedChunk = chunk; 14080 } 14081 14082 this._done = true; 14083 14084 this._requests.forEach(function (requestCapability) { 14085 requestCapability.resolve({ 14086 value: undefined, 14087 done: true 14088 }); 14089 }); 14090 14091 this._requests = []; 14092 14093 this._close(); 14094 } 14095 14096 _onProgress(evt) { 14097 if (!this.isStreamingSupported && this.onProgress) { 14098 this.onProgress({ 14099 loaded: evt.loaded 14100 }); 14101 } 14102 } 14103 14104 get isStreamingSupported() { 14105 return false; 14106 } 14107 14108 async read() { 14109 if (this._queuedChunk !== null) { 14110 const chunk = this._queuedChunk; 14111 this._queuedChunk = null; 14112 return { 14113 value: chunk, 14114 done: false 14115 }; 14116 } 14117 14118 if (this._done) { 14119 return { 14120 value: undefined, 14121 done: true 14122 }; 14123 } 14124 14125 const requestCapability = (0, _util.createPromiseCapability)(); 14126 14127 this._requests.push(requestCapability); 14128 14129 return requestCapability.promise; 14130 } 14131 14132 cancel(reason) { 14133 this._done = true; 14134 14135 this._requests.forEach(function (requestCapability) { 14136 requestCapability.resolve({ 14137 value: undefined, 14138 done: true 14139 }); 14140 }); 14141 14142 this._requests = []; 14143 14144 if (this._manager.isPendingRequest(this._requestId)) { 14145 this._manager.abortRequest(this._requestId); 14146 } 14147 14148 this._close(); 14149 } 14150 14151} 14152 14153/***/ }), 14154/* 23 */ 14155/***/ (function(module, exports, __w_pdfjs_require__) { 14156 14157"use strict"; 14158 14159 14160Object.defineProperty(exports, "__esModule", { 14161 value: true 14162}); 14163exports.PDFFetchStream = void 0; 14164 14165var _util = __w_pdfjs_require__(2); 14166 14167var _network_utils = __w_pdfjs_require__(20); 14168 14169; 14170 14171function createFetchOptions(headers, withCredentials, abortController) { 14172 return { 14173 method: "GET", 14174 headers, 14175 signal: abortController && abortController.signal, 14176 mode: "cors", 14177 credentials: withCredentials ? "include" : "same-origin", 14178 redirect: "follow" 14179 }; 14180} 14181 14182function createHeaders(httpHeaders) { 14183 const headers = new Headers(); 14184 14185 for (const property in httpHeaders) { 14186 const value = httpHeaders[property]; 14187 14188 if (typeof value === "undefined") { 14189 continue; 14190 } 14191 14192 headers.append(property, value); 14193 } 14194 14195 return headers; 14196} 14197 14198class PDFFetchStream { 14199 constructor(source) { 14200 this.source = source; 14201 this.isHttp = /^https?:/i.test(source.url); 14202 this.httpHeaders = this.isHttp && source.httpHeaders || {}; 14203 this._fullRequestReader = null; 14204 this._rangeRequestReaders = []; 14205 } 14206 14207 get _progressiveDataLength() { 14208 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 14209 } 14210 14211 getFullReader() { 14212 (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."); 14213 this._fullRequestReader = new PDFFetchStreamReader(this); 14214 return this._fullRequestReader; 14215 } 14216 14217 getRangeReader(begin, end) { 14218 if (end <= this._progressiveDataLength) { 14219 return null; 14220 } 14221 14222 const reader = new PDFFetchStreamRangeReader(this, begin, end); 14223 14224 this._rangeRequestReaders.push(reader); 14225 14226 return reader; 14227 } 14228 14229 cancelAllRequests(reason) { 14230 if (this._fullRequestReader) { 14231 this._fullRequestReader.cancel(reason); 14232 } 14233 14234 const readers = this._rangeRequestReaders.slice(0); 14235
14236 readers.forEach(function (reader) { 14237 reader.cancel(reason); 14238 }); 14239 } 14240 14241} 14242 14243exports.PDFFetchStream = PDFFetchStream; 14244 14245class PDFFetchStreamReader { 14246 constructor(stream) { 14247 this._stream = stream; 14248 this._reader = null; 14249 this._loaded = 0; 14250 this._filename = null; 14251 const source = stream.source; 14252 this._withCredentials = source.withCredentials || false; 14253 this._contentLength = source.length; 14254 this._headersCapability = (0, _util.createPromiseCapability)(); 14255 this._disableRange = source.disableRange || false; 14256 this._rangeChunkSize = source.rangeChunkSize; 14257 14258 if (!this._rangeChunkSize && !this._disableRange) { 14259 this._disableRange = true; 14260 } 14261 14262 if (typeof AbortController !== "undefined") { 14263 this._abortController = new AbortController(); 14264 } 14265 14266 this._isStreamingSupported = !source.disableStream; 14267 this._isRangeSupported = !source.disableRange; 14268 this._headers = createHeaders(this._stream.httpHeaders); 14269 const url = source.url; 14270 fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => { 14271 if (!(0, _network_utils.validateResponseStatus)(response.status)) { 14272 throw (0, _network_utils.createResponseStatusError)(response.status, url); 14273 } 14274 14275 this._reader = response.body.getReader(); 14276 14277 this._headersCapability.resolve(); 14278 14279 const getResponseHeader = name => { 14280 return response.headers.get(name); 14281 }; 14282 14283 const { 14284 allowRangeRequests, 14285 suggestedLength 14286 } = (0, _network_utils.validateRangeRequestCapabilities)({ 14287 getResponseHeader, 14288 isHttp: this._stream.isHttp, 14289 rangeChunkSize: this._rangeChunkSize, 14290 disableRange: this._disableRange 14291 }); 14292 this._isRangeSupported = allowRangeRequests; 14293 this._contentLength = suggestedLength || this._contentLength; 14294 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 14295 14296 if (!this._isStreamingSupported && this._isRangeSupported) { 14297 this.cancel(new _util.AbortException("Streaming is disabled.")); 14298 } 14299 }).catch(this._headersCapability.reject); 14300 this.onProgress = null; 14301 } 14302 14303 get headersReady() { 14304 return this._headersCapability.promise; 14305 } 14306 14307 get filename() { 14308 return this._filename; 14309 } 14310 14311 get contentLength() { 14312 return this._contentLength; 14313 } 14314 14315 get isRangeSupported() { 14316 return this._isRangeSupported; 14317 } 14318 14319 get isStreamingSupported() { 14320 return this._isStreamingSupported; 14321 } 14322 14323 async read() { 14324 await this._headersCapability.promise; 14325 const { 14326 value, 14327 done 14328 } = await this._reader.read(); 14329 14330 if (done) { 14331 return { 14332 value, 14333 done 14334 }; 14335 } 14336 14337 this._loaded += value.byteLength; 14338 14339 if (this.onProgress) { 14340 this.onProgress({ 14341 loaded: this._loaded, 14342 total: this._contentLength 14343 }); 14344 } 14345 14346 const buffer = new Uint8Array(value).buffer; 14347 return { 14348 value: buffer, 14349 done: false 14350 }; 14351 } 14352 14353 cancel(reason) { 14354 if (this._reader) { 14355 this._reader.cancel(reason); 14356 } 14357 14358 if (this._abortController) { 14359 this._abortController.abort(); 14360 } 14361 } 14362 14363} 14364 14365class PDFFetchStreamRangeReader { 14366 constructor(stream, begin, end) { 14367 this._stream = stream; 14368 this._reader = null; 14369 this._loaded = 0; 14370 const source = stream.source; 14371 this._withCredentials = source.withCredentials || false; 14372 this._readCapability = (0, _util.createPromiseCapability)(); 14373 this._isStreamingSupported = !source.disableStream; 14374 14375 if (typeof AbortController !== "undefined") { 14376 this._abortController = new AbortController(); 14377 } 14378 14379 this._headers = createHeaders(this._stream.httpHeaders); 14380 14381 this._headers.append("Range", `bytes=${begin}-${end - 1}`); 14382 14383 const url = source.url; 14384 fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => { 14385 if (!(0, _network_utils.validateResponseStatus)(response.status)) { 14386 throw (0, _network_utils.createResponseStatusError)(response.status, url); 14387 } 14388 14389 this._readCapability.resolve(); 14390 14391 this._reader = response.body.getReader(); 14392 }); 14393 this.onProgress = null; 14394 } 14395 14396 get isStreamingSupported() { 14397 return this._isStreamingSupported; 14398 } 14399 14400 async read() { 14401 await this._readCapability.promise; 14402 const { 14403 value, 14404 done 14405 } = await this._reader.read(); 14406 14407 if (done) { 14408 return { 14409 value, 14410 done 14411 }; 14412 } 14413 14414 this._loaded += value.byteLength; 14415 14416 if (this.onProgress) { 14417 this.onProgress({ 14418 loaded: this._loaded 14419 }); 14420 } 14421 14422 const buffer = new Uint8Array(value).buffer; 14423 return { 14424 value: buffer, 14425 done: false 14426 }; 14427 } 14428 14429 cancel(reason) { 14430 if (this._reader) { 14431 this._reader.cancel(reason); 14432 } 14433 14434 if (this._abortController) { 14435 this._abortController.abort(); 14436 } 14437 } 14438 14439} 14440 14441/***/ }) 14442/******/ ]); 14443});
vendor: 4,101 bytes, lines 14444-14544
14444//# sourceMappingURL=pdf.js.map; 14445/** 14446 * @licstart The following is the entire license notice for the 14447 * Javascript code in this page 14448 * 14449 * Copyright 2020 Mozilla Foundation 14450 * 14451 * Licensed under the Apache License, Version 2.0 (the "License"); 14452 * you may not use this file except in compliance with the License. 14453 * You may obtain a copy of the License at 14454 * 14455 * http://www.apache.org/licenses/LICENSE-2.0 14456 * 14457 * Unless required by applicable law or agreed to in writing, software 14458 * distributed under the License is distributed on an "AS IS" BASIS, 14459 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14460 * See the License for the specific language governing permissions and 14461 * limitations under the License. 14462 * 14463 * @licend The above is the entire license notice for the 14464 * Javascript code in this page 14465 */ 14466 14467(function webpackUniversalModuleDefinition(root, factory) { 14468 if(typeof exports === 'object' && typeof module === 'object') 14469 module.exports = factory(); 14470 else if(typeof define === 'function' && define.amd) 14471 define("pdfjs-dist/build/pdf.worker", [], factory); 14472 else if(typeof exports === 'object') 14473 exports["pdfjs-dist/build/pdf.worker"] = factory(); 14474 else 14475 root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory(); 14476})(this, function() { 14477return /******/ (function(modules) { // webpackBootstrap 14478/******/ // The module cache 14479/******/ var installedModules = {}; 14480/******/ 14481/******/ // The require function 14482/******/ function __w_pdfjs_require__(moduleId) { 14483/******/ 14484/******/ // Check if module is in cache 14485/******/ if(installedModules[moduleId]) { 14486/******/ return installedModules[moduleId].exports; 14487/******/ } 14488/******/ // Create a new module (and put it into the cache) 14489/******/ var module = installedModules[moduleId] = { 14490/******/ i: moduleId, 14491/******/ l: false, 14492/******/ exports: {} 14493/******/ }; 14494/******/ 14495/******/ // Execute the module function 14496/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); 14497/******/ 14498/******/ // Flag the module as loaded 14499/******/ module.l = true; 14500/******/ 14501/******/ // Return the exports of the module 14502/******/ return module.exports; 14503/******/ } 14504/******/ 14505/******/ 14506/******/ // expose the modules object (__webpack_modules__) 14507/******/ __w_pdfjs_require__.m = modules; 14508/******/ 14509/******/ // expose the module cache 14510/******/ __w_pdfjs_require__.c = installedModules; 14511/******/ 14512/******/ // define getter function for harmony exports 14513/******/ __w_pdfjs_require__.d = function(exports, name, getter) { 14514/******/ if(!__w_pdfjs_require__.o(exports, name)) { 14515/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 14516/******/ } 14517/******/ }; 14518/******/ 14519/******/ // define __esModule on exports 14520/******/ __w_pdfjs_require__.r = function(exports) { 14521/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 14522/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 14523/******/ } 14524/******/ Object.defineProperty(exports, '__esModule', { value: true }); 14525/******/ }; 14526/******/ 14527/******/ // create a fake namespace object 14528/******/ // mode & 1: value is a module id, require it 14529/******/ // mode & 2: merge all properties of value into the ns 14530/******/ // mode & 4: return value when already ns object 14531/******/ // mode & 8|1: behave like require 14532/******/ __w_pdfjs_require__.t = function(value, mode) { 14533/******/ if(mode & 1) value = __w_pdfjs_require__(value); 14534/******/ if(mode & 8) return value; 14535/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 14536/******/ var ns = Object.create(null); 14537/******/ __w_pdfjs_require__.r(ns); 14538/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 14539/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 14540/******/ return ns; 14541/******/ }; 14542/******/ 14543/******/ // getDefaultExport function for compatibility with non-harmony modules 14544/******/ __w_pdfjs_require__.n = function(module) {
14545/******/ var getter = module && module.__esModule ? 14546/******/ function getDefault() { return module['default']; } : 14547/******/ function getModuleExports() { return module; }; 14548/******/ __w_pdfjs_require__.d(getter, 'a', getter); 14549/******/ return getter; 14550/******/ }; 14551/******/ 14552/******/ // Object.prototype.hasOwnProperty.call 14553/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 14554/******/ 14555/******/ // __webpack_public_path__ 14556/******/ __w_pdfjs_require__.p = ""; 14557/******/ 14558/******/ 14559/******/ // Load entry module and return exports 14560/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); 14561/******/ }) 14562/************************************************************************/ 14563/******/ ([ 14564/* 0 */ 14565/***/ (function(module, exports, __w_pdfjs_require__) { 14566 14567"use strict"; 14568 14569 14570Object.defineProperty(exports, "__esModule", { 14571 value: true 14572}); 14573Object.defineProperty(exports, "WorkerMessageHandler", { 14574 enumerable: true, 14575 get: function () { 14576 return _worker.WorkerMessageHandler; 14577 } 14578}); 14579 14580var _worker = __w_pdfjs_require__(1); 14581 14582const pdfjsVersion = '2.5.207'; 14583const pdfjsBuild = '0974d6052'; 14584 14585/***/ }), 14586/* 1 */ 14587/***/ (function(module, exports, __w_pdfjs_require__) { 14588 14589"use strict"; 14590 14591 14592Object.defineProperty(exports, "__esModule", { 14593 value: true 14594}); 14595exports.WorkerMessageHandler = exports.WorkerTask = void 0; 14596 14597var _util = __w_pdfjs_require__(2); 14598 14599var _primitives = __w_pdfjs_require__(5); 14600 14601var _pdf_manager = __w_pdfjs_require__(6); 14602 14603var _is_node = __w_pdfjs_require__(4); 14604 14605var _message_handler = __w_pdfjs_require__(45); 14606 14607var _worker_stream = __w_pdfjs_require__(46); 14608 14609var _core_utils = __w_pdfjs_require__(8); 14610 14611var WorkerTask = function WorkerTaskClosure() { 14612 function WorkerTask(name) { 14613 this.name = name; 14614 this.terminated = false; 14615 this._capability = (0, _util.createPromiseCapability)(); 14616 } 14617 14618 WorkerTask.prototype = { 14619 get finished() { 14620 return this._capability.promise; 14621 }, 14622 14623 finish() { 14624 this._capability.resolve(); 14625 }, 14626 14627 terminate() { 14628 this.terminated = true; 14629 }, 14630 14631 ensureNotTerminated() { 14632 if (this.terminated) { 14633 throw new Error("Worker task was terminated"); 14634 } 14635 } 14636 14637 }; 14638 return WorkerTask; 14639}(); 14640 14641exports.WorkerTask = WorkerTask; 14642var WorkerMessageHandler = { 14643 setup(handler, port) { 14644 var testMessageProcessed = false; 14645 handler.on("test", function wphSetupTest(data) { 14646 if (testMessageProcessed) { 14647 return; 14648 } 14649 14650 testMessageProcessed = true; 14651 14652 if (!(data instanceof Uint8Array)) { 14653 handler.send("test", null); 14654 return; 14655 } 14656 14657 const supportTransfers = data[0] === 255; 14658 handler.postMessageTransfers = supportTransfers; 14659 handler.send("test", { 14660 supportTransfers 14661 }); 14662 }); 14663 handler.on("configure", function wphConfigure(data) { 14664 (0, _util.setVerbosityLevel)(data.verbosity); 14665 }); 14666 handler.on("GetDocRequest", function wphSetupDoc(data) { 14667 return WorkerMessageHandler.createDocumentHandler(data, port); 14668 }); 14669 }, 14670 14671 createDocumentHandler(docParams, port) { 14672 var pdfManager; 14673 var terminated = false; 14674 var cancelXHRs = null; 14675 var WorkerTasks = []; 14676 const verbosity = (0, _util.getVerbosityLevel)(); 14677 const apiVersion = docParams.apiVersion; 14678 const workerVersion = '2.5.207'; 14679 14680 if (apiVersion !== workerVersion) { 14681 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 14682 } 14683 14684 const enumerableProperties = []; 14685 14686 for (const property in []) { 14687 enumerableProperties.push(property); 14688 } 14689 14690 if (enumerableProperties.length) { 14691 throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s."); 14692 } 14693 14694 if (typeof ReadableStream === "undefined" || typeof Promise.allSettled === "undefined") { 14695 throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. " + "`ReadableStream` and/or `Promise.allSettled`); " + "please use an ES5-compatible build instead."); 14696 } 14697 14698 var docId = docParams.docId; 14699 var docBaseUrl = docParams.docBaseUrl; 14700 var workerHandlerName = docParams.docId + "_worker"; 14701 var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); 14702 handler.postMessageTransfers = docParams.postMessageTransfers; 14703 14704 function ensureNotTerminated() { 14705 if (terminated) { 14706 throw new Error("Worker was terminated"); 14707 } 14708 } 14709 14710 function startWorkerTask(task) { 14711 WorkerTasks.push(task); 14712 } 14713 14714 function finishWorkerTask(task) { 14715 task.finish(); 14716 var i = WorkerTasks.indexOf(task); 14717 WorkerTasks.splice(i, 1); 14718 } 14719 14720 async function loadDocument(recoveryMode) { 14721 await pdfManager.ensureDoc("checkHeader"); 14722 await pdfManager.ensureDoc("parseStartXRef"); 14723 await pdfManager.ensureDoc("parse", [recoveryMode]); 14724 14725 if (!recoveryMode) { 14726 await pdfManager.ensureDoc("checkFirstPage"); 14727 } 14728 14729 const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]); 14730 return { 14731 numPages, 14732 fingerprint 14733 }; 14734 } 14735 14736 function getPdfManager(data, evaluatorOptions) { 14737 var pdfManagerCapability = (0, _util.createPromiseCapability)(); 14738 let newPdfManager; 14739 var source = data.source; 14740 14741 if (source.data) { 14742 try { 14743 newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl); 14744 pdfManagerCapability.resolve(newPdfManager); 14745 } catch (ex) { 14746 pdfManagerCapability.reject(ex); 14747 } 14748 14749 return pdfManagerCapability.promise; 14750 } 14751 14752 var pdfStream, 14753 cachedChunks = []; 14754
14755 try { 14756 pdfStream = new _worker_stream.PDFWorkerStream(handler); 14757 } catch (ex) { 14758 pdfManagerCapability.reject(ex); 14759 return pdfManagerCapability.promise; 14760 } 14761 14762 var fullRequest = pdfStream.getFullReader(); 14763 fullRequest.headersReady.then(function () { 14764 if (!fullRequest.isRangeSupported) { 14765 return; 14766 } 14767 14768 var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; 14769 newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, { 14770 msgHandler: handler, 14771 password: source.password, 14772 length: fullRequest.contentLength, 14773 disableAutoFetch, 14774 rangeChunkSize: source.rangeChunkSize 14775 }, evaluatorOptions, docBaseUrl); 14776 14777 for (let i = 0; i < cachedChunks.length; i++) { 14778 newPdfManager.sendProgressiveData(cachedChunks[i]); 14779 } 14780 14781 cachedChunks = []; 14782 pdfManagerCapability.resolve(newPdfManager); 14783 cancelXHRs = null; 14784 }).catch(function (reason) { 14785 pdfManagerCapability.reject(reason); 14786 cancelXHRs = null; 14787 }); 14788 var loaded = 0; 14789 14790 var flushChunks = function () { 14791 var pdfFile = (0, _util.arraysToBytes)(cachedChunks); 14792 14793 if (source.length && pdfFile.length !== source.length) { 14794 (0, _util.warn)("reported HTTP length is different from actual"); 14795 } 14796 14797 try { 14798 newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl); 14799 pdfManagerCapability.resolve(newPdfManager); 14800 } catch (ex) { 14801 pdfManagerCapability.reject(ex); 14802 } 14803 14804 cachedChunks = []; 14805 }; 14806 14807 var readPromise = new Promise(function (resolve, reject) { 14808 var readChunk = function ({ 14809 value, 14810 done 14811 }) { 14812 try { 14813 ensureNotTerminated(); 14814 14815 if (done) { 14816 if (!newPdfManager) { 14817 flushChunks(); 14818 } 14819 14820 cancelXHRs = null; 14821 return; 14822 } 14823 14824 loaded += (0, _util.arrayByteLength)(value); 14825 14826 if (!fullRequest.isStreamingSupported) { 14827 handler.send("DocProgress", { 14828 loaded, 14829 total: Math.max(loaded, fullRequest.contentLength || 0) 14830 }); 14831 } 14832 14833 if (newPdfManager) { 14834 newPdfManager.sendProgressiveData(value); 14835 } else { 14836 cachedChunks.push(value); 14837 } 14838 14839 fullRequest.read().then(readChunk, reject); 14840 } catch (e) { 14841 reject(e); 14842 } 14843 }; 14844 14845 fullRequest.read().then(readChunk, reject); 14846 }); 14847 readPromise.catch(function (e) { 14848 pdfManagerCapability.reject(e); 14849 cancelXHRs = null; 14850 }); 14851 14852 cancelXHRs = function (reason) { 14853 pdfStream.cancelAllRequests(reason); 14854 }; 14855 14856 return pdfManagerCapability.promise; 14857 } 14858 14859 function setupDoc(data) { 14860 function onSuccess(doc) { 14861 ensureNotTerminated(); 14862 handler.send("GetDoc", { 14863 pdfInfo: doc 14864 }); 14865 } 14866 14867 function onFailure(ex) { 14868 ensureNotTerminated(); 14869 14870 if (ex instanceof _util.PasswordException) { 14871 var task = new WorkerTask(`PasswordException: response ${ex.code}`); 14872 startWorkerTask(task); 14873 handler.sendWithPromise("PasswordRequest", ex).then(function ({ 14874 password 14875 }) { 14876 finishWorkerTask(task); 14877 pdfManager.updatePassword(password); 14878 pdfManagerReady(); 14879 }).catch(function () { 14880 finishWorkerTask(task); 14881 handler.send("DocException", ex); 14882 }); 14883 } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) { 14884 handler.send("DocException", ex); 14885 } else { 14886 handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString())); 14887 } 14888 } 14889 14890 function pdfManagerReady() { 14891 ensureNotTerminated(); 14892 loadDocument(false).then(onSuccess, function loadFailure(ex) { 14893 ensureNotTerminated(); 14894 14895 if (!(ex instanceof _core_utils.XRefParseException)) { 14896 onFailure(ex); 14897 return; 14898 } 14899 14900 pdfManager.requestLoadedStream(); 14901 pdfManager.onLoadedStream().then(function () { 14902 ensureNotTerminated();
14903 loadDocument(true).then(onSuccess, onFailure); 14904 }); 14905 }, onFailure); 14906 } 14907 14908 ensureNotTerminated(); 14909 var evaluatorOptions = { 14910 maxImageSize: data.maxImageSize, 14911 disableFontFace: data.disableFontFace, 14912 ignoreErrors: data.ignoreErrors, 14913 isEvalSupported: data.isEvalSupported, 14914 fontExtraProperties: data.fontExtraProperties 14915 }; 14916 getPdfManager(data, evaluatorOptions).then(function (newPdfManager) { 14917 if (terminated) { 14918 newPdfManager.terminate(new _util.AbortException("Worker was terminated.")); 14919 throw new Error("Worker was terminated"); 14920 } 14921 14922 pdfManager = newPdfManager; 14923 pdfManager.onLoadedStream().then(function (stream) { 14924 handler.send("DataLoaded", { 14925 length: stream.bytes.byteLength 14926 }); 14927 }); 14928 }).then(pdfManagerReady, onFailure); 14929 } 14930 14931 handler.on("GetPage", function wphSetupGetPage(data) { 14932 return pdfManager.getPage(data.pageIndex).then(function (page) { 14933 return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) { 14934 return { 14935 rotate, 14936 ref, 14937 userUnit, 14938 view 14939 }; 14940 }); 14941 }); 14942 }); 14943 handler.on("GetPageIndex", function wphSetupGetPageIndex(data) { 14944 var ref = _primitives.Ref.get(data.ref.num, data.ref.gen); 14945 14946 var catalog = pdfManager.pdfDocument.catalog; 14947 return catalog.getPageIndex(ref); 14948 }); 14949 handler.on("GetDestinations", function wphSetupGetDestinations(data) { 14950 return pdfManager.ensureCatalog("destinations"); 14951 }); 14952 handler.on("GetDestination", function wphSetupGetDestination(data) { 14953 return pdfManager.ensureCatalog("getDestination", [data.id]); 14954 }); 14955 handler.on("GetPageLabels", function wphSetupGetPageLabels(data) { 14956 return pdfManager.ensureCatalog("pageLabels"); 14957 }); 14958 handler.on("GetPageLayout", function wphSetupGetPageLayout(data) { 14959 return pdfManager.ensureCatalog("pageLayout"); 14960 }); 14961 handler.on("GetPageMode", function wphSetupGetPageMode(data) { 14962 return pdfManager.ensureCatalog("pageMode"); 14963 }); 14964 handler.on("GetViewerPreferences", function (data) { 14965 return pdfManager.ensureCatalog("viewerPreferences"); 14966 }); 14967 handler.on("GetOpenAction", function (data) { 14968 return pdfManager.ensureCatalog("openAction"); 14969 }); 14970 handler.on("GetAttachments", function wphSetupGetAttachments(data) { 14971 return pdfManager.ensureCatalog("attachments"); 14972 }); 14973 handler.on("GetJavaScript", function wphSetupGetJavaScript(data) { 14974 return pdfManager.ensureCatalog("javaScript"); 14975 }); 14976 handler.on("GetOutline", function wphSetupGetOutline(data) { 14977 return pdfManager.ensureCatalog("documentOutline"); 14978 }); 14979 handler.on("GetPermissions", function (data) { 14980 return pdfManager.ensureCatalog("permissions"); 14981 }); 14982 handler.on("GetMetadata", function wphSetupGetMetadata(data) { 14983 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]); 14984 }); 14985 handler.on("GetData", function wphSetupGetData(data) { 14986 pdfManager.requestLoadedStream(); 14987 return pdfManager.onLoadedStream().then(function (stream) { 14988 return stream.bytes; 14989 }); 14990 }); 14991 handler.on("GetStats", function wphSetupGetStats(data) { 14992 return pdfManager.pdfDocument.xref.stats; 14993 }); 14994 handler.on("GetAnnotations", function ({ 14995 pageIndex, 14996 intent 14997 }) { 14998 return pdfManager.getPage(pageIndex).then(function (page) { 14999 return page.getAnnotationsData(intent); 15000 }); 15001 }); 15002 handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) { 15003 var pageIndex = data.pageIndex; 15004 pdfManager.getPage(pageIndex).then(function (page) { 15005 var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 15006 startWorkerTask(task); 15007 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 15008 page.getOperatorList({ 15009 handler, 15010 sink, 15011 task, 15012 intent: data.intent, 15013 renderInteractiveForms: data.renderInteractiveForms 15014 }).then(function (operatorListInfo) { 15015 finishWorkerTask(task); 15016 15017 if (start) { 15018 (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}
15018ms, len=${operatorListInfo.length}`); 15019 } 15020 15021 sink.close(); 15022 }, function (reason) { 15023 finishWorkerTask(task); 15024 15025 if (task.terminated) { 15026 return; 15027 } 15028 15029 handler.send("UnsupportedFeature", { 15030 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 15031 }); 15032 sink.error(reason); 15033 }); 15034 }); 15035 }, this); 15036 handler.on("GetTextContent", function wphExtractText(data, sink) { 15037 var pageIndex = data.pageIndex; 15038 15039 sink.onPull = function (desiredSize) {}; 15040 15041 sink.onCancel = function (reason) {}; 15042 15043 pdfManager.getPage(pageIndex).then(function (page) { 15044 var task = new WorkerTask("GetTextContent: page " + pageIndex); 15045 startWorkerTask(task); 15046 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 15047 page.extractTextContent({ 15048 handler, 15049 task, 15050 sink, 15051 normalizeWhitespace: data.normalizeWhitespace, 15052 combineTextItems: data.combineTextItems 15053 }).then(function () { 15054 finishWorkerTask(task); 15055 15056 if (start) { 15057 (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 15058 } 15059 15060 sink.close(); 15061 }, function (reason) { 15062 finishWorkerTask(task); 15063 15064 if (task.terminated) { 15065 return; 15066 } 15067 15068 sink.error(reason); 15069 }); 15070 }); 15071 }); 15072 handler.on("FontFallback", function (data) { 15073 return pdfManager.fontFallback(data.id, handler); 15074 }); 15075 handler.on("Cleanup", function wphCleanup(data) { 15076 return pdfManager.cleanup(true); 15077 }); 15078 handler.on("Terminate", function wphTerminate(data) { 15079 terminated = true; 15080 const waitOn = []; 15081 15082 if (pdfManager) { 15083 pdfManager.terminate(new _util.AbortException("Worker was terminated.")); 15084 const cleanupPromise = pdfManager.cleanup(); 15085 waitOn.push(cleanupPromise); 15086 pdfManager = null; 15087 } else { 15088 (0, _primitives.clearPrimitiveCaches)(); 15089 } 15090 15091 if (cancelXHRs) { 15092 cancelXHRs(new _util.AbortException("Worker was terminated.")); 15093 } 15094 15095 WorkerTasks.forEach(function (task) { 15096 waitOn.push(task.finished); 15097 task.terminate(); 15098 }); 15099 return Promise.all(waitOn).then(function () { 15100 handler.destroy(); 15101 handler = null; 15102 }); 15103 }); 15104 handler.on("Ready", function wphReady(data) { 15105 setupDoc(docParams); 15106 docParams = null; 15107 }); 15108 return workerHandlerName; 15109 }, 15110 15111 initializeFromPort(port) { 15112 var handler = new _message_handler.MessageHandler("worker", "main", port); 15113 WorkerMessageHandler.setup(handler, port); 15114 handler.send("ready", null); 15115 } 15116 15117}; 15118exports.WorkerMessageHandler = WorkerMessageHandler; 15119 15120function isMessagePort(maybePort) { 15121 return typeof maybePort.postMessage === "function" && "onmessage" in maybePort; 15122} 15123 15124if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) { 15125 WorkerMessageHandler.initializeFromPort(self); 15126} 15127 15128/***/ }), 15129/* 2 */ 15130/***/ (function(module, exports, __w_pdfjs_require__) { 15131 15132"use strict"; 15133 15134 15135Object.defineProperty(exports, "__esModule", { 15136 value: true 15137}); 15138exports.arrayByteLength = arrayByteLength; 15139exports.arraysToBytes = arraysToBytes; 15140exports.assert = assert; 15141exports.bytesToString = bytesToString; 15142exports.createPromiseCapability = createPromiseCapability; 15143exports.getVerbosityLevel = getVerbosityLevel; 15144exports.info = info; 15145exports.isArrayBuffer = isArrayBuffer; 15146exports.isArrayEqual = isArrayEqual; 15147exports.isBool = isBool; 15148exports.isEmptyObj = isEmptyObj; 15149exports.isNum = isNum; 15150exports.isString = isString; 15151exports.isSameOrigin = isSameOrigin; 15152exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 15153exports.removeNullCharacters = removeNullCharacters; 15154exports.setVerbosityLevel = setVerbosityLevel; 15155exports.shadow = shadow; 15156exports.string32 = string32; 15157exports.stringToBytes = stringToBytes; 15158exports.stringToPDFString = stringToPDFString; 15159exports.stringToUTF8String = stringToUTF8String; 15160exports.utf8StringToString = utf8StringToString; 15161exports.warn = warn; 15162exports.unreachable = unreachable; 15163exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exp
15163orts.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; 15164 15165__w_pdfjs_require__(3); 15166 15167const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 15168exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 15169const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 15170exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 15171const PermissionFlag = { 15172 PRINT: 0x04, 15173 MODIFY_CONTENTS: 0x08, 15174 COPY: 0x10, 15175 MODIFY_ANNOTATIONS: 0x20, 15176 FILL_INTERACTIVE_FORMS: 0x100, 15177 COPY_FOR_ACCESSIBILITY: 0x200, 15178 ASSEMBLE: 0x400, 15179 PRINT_HIGH_QUALITY: 0x800 15180}; 15181exports.PermissionFlag = PermissionFlag; 15182const TextRenderingMode = { 15183 FILL: 0, 15184 STROKE: 1, 15185 FILL_STROKE: 2, 15186 INVISIBLE: 3, 15187 FILL_ADD_TO_PATH: 4, 15188 STROKE_ADD_TO_PATH: 5, 15189 FILL_STROKE_ADD_TO_PATH: 6, 15190 ADD_TO_PATH: 7, 15191 FILL_STROKE_MASK: 3, 15192 ADD_TO_PATH_FLAG: 4 15193}; 15194exports.TextRenderingMode = TextRenderingMode; 15195const ImageKind = { 15196 GRAYSCALE_1BPP: 1, 15197 RGB_24BPP: 2, 15198 RGBA_32BPP: 3 15199}; 15200exports.ImageKind = ImageKind; 15201const AnnotationType = { 15202 TEXT: 1, 15203 LINK: 2, 15204 FREETEXT: 3, 15205 LINE: 4, 15206 SQUARE: 5, 15207 CIRCLE: 6, 15208 POLYGON: 7, 15209 POLYLINE: 8, 15210 HIGHLIGHT: 9, 15211 UNDERLINE: 10, 15212 SQUIGGLY: 11, 15213 STRIKEOUT: 12, 15214 STAMP: 13, 15215 CARET: 14, 15216 INK: 15, 15217 POPUP: 16, 15218 FILEATTACHMENT: 17, 15219 SOUND: 18, 15220 MOVIE: 19, 15221 WIDGET: 20, 15222 SCREEN: 21, 15223 PRINTERMARK: 22, 15224 TRAPNET: 23, 15225 WATERMARK: 24, 15226 THREED: 25, 15227 REDACT: 26 15228}; 15229exports.AnnotationType = AnnotationType; 15230const AnnotationStateModelType = { 15231 MARKED: "Marked", 15232 REVIEW: "Review" 15233}; 15234exports.AnnotationStateModelType = AnnotationStateModelType; 15235const AnnotationMarkedState = { 15236 MARKED: "Marked", 15237 UNMARKED: "Unmarked" 15238}; 15239exports.AnnotationMarkedState = AnnotationMarkedState; 15240const AnnotationReviewState = { 15241 ACCEPTED: "Accepted", 15242 REJECTED: "Rejected", 15243 CANCELLED: "Cancelled", 15244 COMPLETED: "Completed", 15245 NONE: "None" 15246}; 15247exports.AnnotationReviewState = AnnotationReviewState; 15248const AnnotationReplyType = { 15249 GROUP: "Group", 15250 REPLY: "R" 15251}; 15252exports.AnnotationReplyType = AnnotationReplyType; 15253const AnnotationFlag = { 15254 INVISIBLE: 0x01, 15255 HIDDEN: 0x02, 15256 PRINT: 0x04, 15257 NOZOOM: 0x08, 15258 NOROTATE: 0x10, 15259 NOVIEW: 0x20, 15260 READONLY: 0x40, 15261 LOCKED: 0x80, 15262 TOGGLENOVIEW: 0x100, 15263 LOCKEDCONTENTS: 0x200 15264}; 15265exports.AnnotationFlag = AnnotationFlag; 15266const AnnotationFieldFlag = { 15267 READONLY: 0x0000001, 15268 REQUIRED: 0x0000002, 15269 NOEXPORT: 0x0000004, 15270 MULTILINE: 0x0001000, 15271 PASSWORD: 0x0002000, 15272 NOTOGGLETOOFF: 0x0004000, 15273 RADIO: 0x0008000, 15274 PUSHBUTTON: 0x0010000, 15275 COMBO: 0x0020000, 15276 EDIT: 0x0040000, 15277 SORT: 0x0080000, 15278 FILESELECT: 0x0100000, 15279 MULTISELECT: 0x0200000, 15280 DONOTSPELLCHECK: 0x0400000, 15281 DONOTSCROLL: 0x0800000, 15282 COMB: 0x1000000, 15283 RICHTEXT: 0x2000000, 15284 RADIOSINUNISON: 0x2000000, 15285 COMMITONSELCHANGE: 0x4000000 15286}; 15287exports.AnnotationFieldFlag = AnnotationFieldFlag; 15288const AnnotationBorderStyleType = { 15289 SOLID: 1, 15290 DASHED: 2, 15291 BEVELED: 3, 15292 INSET: 4, 15293 UNDERLINE: 5 15294}; 15295exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 15296const StreamType = { 15297 UNKNOWN: "UNKNOWN", 15298 FLATE: "FLATE", 15299 LZW: "LZW", 15300 DCT: "DCT", 15301 JPX: "JPX", 15302 JBIG: "JBIG", 15303 A85: "A85", 15304 AHX: "AHX", 15305 CCF: "CCF", 15306 RLX: "RLX" 15307}; 15308exports.StreamType = StreamType; 15309const FontType = { 15310 UNKNOWN: "UNKNOWN", 15311 TYPE1: "TYPE1", 15312 TYPE1C: "TYPE1C", 15313 CIDFONTTYPE0: "CIDFONTTYPE0", 15314 CIDFONTTYPE0C: "CIDFONTTYPE0C", 15315 TRUETYPE: "TRUETYPE", 15316 CIDFONTTYPE2: "CIDFONTTYPE2", 15317 TYPE3: "TYPE3", 15318 OPENTYPE: "OPENTYPE", 15319 TYPE0: "TYPE0", 15320 MMTYPE1: "MMTYPE1" 15321}; 15322exports.FontType = FontType; 15323const VerbosityLevel = { 15324 ERRORS: 0, 15325 WARNINGS: 1, 15326 INFOS: 5 15327}; 15328exports.VerbosityLevel = VerbosityLevel; 15329const CMapCompressionType = { 15330 NONE: 0, 15331 BINARY: 1, 15332 STREAM: 2 15333}; 15334exports.CMapCompressionType = CMapCompressionType; 15335const OPS = { 15336 dependency: 1, 15337 setLineWidth: 2, 15338 setLineCap: 3, 15339 setLineJoin: 4, 15340 setMiterLimit: 5, 15341 setDash: 6, 15342 setRenderingIntent: 7,
15343 setFlatness: 8, 15344 setGState: 9, 15345 save: 10, 15346 restore: 11, 15347 transform: 12, 15348 moveTo: 13, 15349 lineTo: 14, 15350 curveTo: 15, 15351 curveTo2: 16, 15352 curveTo3: 17, 15353 closePath: 18, 15354 rectangle: 19, 15355 stroke: 20, 15356 closeStroke: 21, 15357 fill: 22, 15358 eoFill: 23, 15359 fillStroke: 24, 15360 eoFillStroke: 25, 15361 closeFillStroke: 26, 15362 closeEOFillStroke: 27, 15363 endPath: 28, 15364 clip: 29, 15365 eoClip: 30, 15366 beginText: 31, 15367 endText: 32, 15368 setCharSpacing: 33, 15369 setWordSpacing: 34, 15370 setHScale: 35, 15371 setLeading: 36, 15372 setFont: 37, 15373 setTextRenderingMode: 38, 15374 setTextRise: 39, 15375 moveText: 40, 15376 setLeadingMoveText: 41, 15377 setTextMatrix: 42, 15378 nextLine: 43, 15379 showText: 44, 15380 showSpacedText: 45, 15381 nextLineShowText: 46, 15382 nextLineSetSpacingShowText: 47, 15383 setCharWidth: 48, 15384 setCharWidthAndBounds: 49, 15385 setStrokeColorSpace: 50, 15386 setFillColorSpace: 51, 15387 setStrokeColor: 52, 15388 setStrokeColorN: 53, 15389 setFillColor: 54, 15390 setFillColorN: 55, 15391 setStrokeGray: 56, 15392 setFillGray: 57, 15393 setStrokeRGBColor: 58, 15394 setFillRGBColor: 59, 15395 setStrokeCMYKColor: 60, 15396 setFillCMYKColor: 61, 15397 shadingFill: 62, 15398 beginInlineImage: 63, 15399 beginImageData: 64, 15400 endInlineImage: 65, 15401 paintXObject: 66, 15402 markPoint: 67, 15403 markPointProps: 68, 15404 beginMarkedContent: 69, 15405 beginMarkedContentProps: 70, 15406 endMarkedContent: 71, 15407 beginCompat: 72, 15408 endCompat: 73, 15409 paintFormXObjectBegin: 74, 15410 paintFormXObjectEnd: 75, 15411 beginGroup: 76, 15412 endGroup: 77, 15413 beginAnnotations: 78, 15414 endAnnotations: 79, 15415 beginAnnotation: 80, 15416 endAnnotation: 81, 15417 paintJpegXObject: 82, 15418 paintImageMaskXObject: 83, 15419 paintImageMaskXObjectGroup: 84, 15420 paintImageXObject: 85, 15421 paintInlineImageXObject: 86, 15422 paintInlineImageXObjectGroup: 87, 15423 paintImageXObjectRepeat: 88, 15424 paintImageMaskXObjectRepeat: 89, 15425 paintSolidColorImageMask: 90, 15426 constructPath: 91 15427}; 15428exports.OPS = OPS; 15429const UNSUPPORTED_FEATURES = { 15430 unknown: "unknown", 15431 forms: "forms", 15432 javaScript: "javaScript", 15433 smask: "smask", 15434 shadingPattern: "shadingPattern", 15435 font: "font", 15436 errorTilingPattern: "errorTilingPattern", 15437 errorExtGState: "errorExtGState", 15438 errorXObject: "errorXObject", 15439 errorFontLoadType3: "errorFontLoadType3", 15440 errorFontState: "errorFontState", 15441 errorFontMissing: "errorFontMissing", 15442 errorFontTranslate: "errorFontTranslate", 15443 errorColorSpace: "errorColorSpace", 15444 errorOperatorList: "errorOperatorList", 15445 errorFontToUnicode: "errorFontToUnicode", 15446 errorFontLoadNative: "errorFontLoadNative", 15447 errorFontGetPath: "errorFontGetPath" 15448}; 15449exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 15450const PasswordResponses = { 15451 NEED_PASSWORD: 1, 15452 INCORRECT_PASSWORD: 2 15453}; 15454exports.PasswordResponses = PasswordResponses; 15455let verbosity = VerbosityLevel.WARNINGS; 15456 15457function setVerbosityLevel(level) { 15458 if (Number.isInteger(level)) { 15459 verbosity = level; 15460 } 15461} 15462 15463function getVerbosityLevel() { 15464 return verbosity; 15465} 15466 15467function info(msg) { 15468 if (verbosity >= VerbosityLevel.INFOS) { 15469 console.log(`Info: ${msg}`); 15470 } 15471} 15472 15473function warn(msg) { 15474 if (verbosity >= VerbosityLevel.WARNINGS) { 15475 console.log(`Warning: ${msg}`); 15476 } 15477} 15478 15479function unreachable(msg) { 15480 throw new Error(msg); 15481} 15482 15483function assert(cond, msg) { 15484 if (!cond) { 15485 unreachable(msg); 15486 } 15487} 15488 15489function isSameOrigin(baseUrl, otherUrl) { 15490 let base; 15491 15492 try { 15493 base = new URL(baseUrl); 15494 15495 if (!base.origin || base.origin === "null") { 15496 return false; 15497 } 15498 } catch (e) { 15499 return false; 15500 } 15501 15502 const other = new URL(otherUrl, base); 15503 return base.origin === other.origin; 15504} 15505 15506function _isValidProtocol(url) { 15507 if (!url) { 15508 return false; 15509 } 15510 15511 switch (url.protocol) { 15512 case "http:": 15513 case "https:": 15514 case "ftp:": 15515 case "mailto:": 15516 case "tel:": 15517 return true; 15518 15519 default: 15520 return false; 15521 } 15522} 15523 15524function createValidAbsoluteUrl(url, baseUrl) { 15525 if (!url) { 15526 return null; 15527 } 15528 15529 try { 15530 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 15531 15532 if (_isValidProtocol(absoluteUrl)) { 15533 return absoluteUrl; 15534 } 15535 } catch (ex) {} 15536 15537 return null; 15538} 15539 15540function shadow(obj, prop, value) { 15541 Object.defineProperty(obj, prop, { 15542 value, 15543 enumerable: true, 15544 configurable: true, 15545 writable: false 15546 }); 15547 return value; 15548} 15549 15550const BaseException = function BaseExceptionClosure() { 15551 function BaseException(message) { 15552 if (this.constructor === BaseException) { 15553 unreachable("Cannot initialize BaseException."); 15554 } 15555 15556 this.message = message; 15557 this.name = this.constructor.name; 15558 } 15559 15560 BaseException.prototype = new Error(); 15561 BaseException.constructor = BaseException; 15562 return BaseException; 15563}(); 15564 15565exports.BaseException = BaseException; 15566 15567class PasswordException extends BaseException { 15568 constructor(msg, code) { 15569 super(msg); 15570 this.code = code; 15571 } 15572 15573} 15574 15575exports.PasswordException = PasswordException; 15576 15577class UnknownErrorException extends BaseException { 15578 constructor(msg, details) { 15579 super(msg); 15580 this.details = details; 15581 } 15582 15583} 15584 15585exports.UnknownErrorException = UnknownErrorException; 15586 15587class InvalidPDFException extends BaseException {} 15588 15589exports.InvalidPDFException = InvalidPDFException; 15590 15591class MissingPDFException extends BaseException {} 15592 15593exports.MissingPDFException = MissingPDFException; 15594 15595class UnexpectedResponseException extends BaseException { 15596 constructor(msg, status) { 15597 super(msg); 15598 this.status = status; 15599 } 15600 15601} 15602 15603exports.UnexpectedResponseException = UnexpectedResponseException; 15604 15605class FormatError extends BaseException {} 15606 15607exports.FormatError = FormatError; 15608 15609class AbortException extends BaseException {} 15610 15611exports.AbortException = AbortException; 15612const NullCharactersRegExp = /\x00/g; 15613 15614function removeNullCharacters(str) { 15615 if (typeof str !== "string") { 15616 warn("The argument for removeNullCharacters must be a string."); 15617 return str; 15618 } 15619 15620 return str.replace(NullCharactersRegExp, ""); 15621} 15622 15623function bytesToString(bytes) { 15624 assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); 15625 const length = bytes.length; 15626 const MAX_ARGUMENT_COUNT = 8192; 15627 15628 if (length < MAX_ARGUMENT_COUNT) { 15629 return String.fromCharCode.apply(null, bytes); 15630 } 15631 15632 const strBuf = []; 15633 15634 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 15635 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 15636 const chunk = bytes.subarray(i, chunkEnd); 15637 strBuf.push(String.fromCharCode.apply(null, chunk)); 15638 } 15639 15640 return strBuf.join(""); 15641} 15642 15643function stringToBytes(str) { 15644 assert(typeof str === "string", "Invalid argument for stringToBytes"); 15645 const length = str.length; 15646 const bytes = new Uint8Array(length); 15647 15648 for (let i = 0; i < length; ++i) { 15649 bytes[i] = str.charCodeAt(i) & 0xff;
15650 } 15651 15652 return bytes; 15653} 15654 15655function arrayByteLength(arr) { 15656 if (arr.length !== undefined) { 15657 return arr.length; 15658 } 15659 15660 assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument."); 15661 return arr.byteLength; 15662} 15663 15664function arraysToBytes(arr) { 15665 const length = arr.length; 15666 15667 if (length === 1 && arr[0] instanceof Uint8Array) { 15668 return arr[0]; 15669 } 15670 15671 let resultLength = 0; 15672 15673 for (let i = 0; i < length; i++) { 15674 resultLength += arrayByteLength(arr[i]); 15675 } 15676 15677 let pos = 0; 15678 const data = new Uint8Array(resultLength); 15679 15680 for (let i = 0; i < length; i++) { 15681 let item = arr[i]; 15682 15683 if (!(item instanceof Uint8Array)) { 15684 if (typeof item === "string") { 15685 item = stringToBytes(item); 15686 } else { 15687 item = new Uint8Array(item); 15688 } 15689 } 15690 15691 const itemLength = item.byteLength; 15692 data.set(item, pos); 15693 pos += itemLength; 15694 } 15695 15696 return data; 15697} 15698 15699function string32(value) { 15700 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 15701} 15702 15703function isLittleEndian() { 15704 const buffer8 = new Uint8Array(4); 15705 buffer8[0] = 1; 15706 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 15707 return view32[0] === 1; 15708} 15709 15710const IsLittleEndianCached = { 15711 get value() { 15712 return shadow(this, "value", isLittleEndian()); 15713 } 15714 15715}; 15716exports.IsLittleEndianCached = IsLittleEndianCached; 15717 15718function isEvalSupported() { 15719 try { 15720 new Function(""); 15721 return true; 15722 } catch (e) { 15723 return false; 15724 } 15725} 15726 15727const IsEvalSupportedCached = { 15728 get value() { 15729 return shadow(this, "value", isEvalSupported()); 15730 } 15731 15732}; 15733exports.IsEvalSupportedCached = IsEvalSupportedCached; 15734const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; 15735 15736class Util { 15737 static makeCssRgb(r, g, b) { 15738 rgbBuf[1] = r; 15739 rgbBuf[3] = g; 15740 rgbBuf[5] = b; 15741 return rgbBuf.join(""); 15742 } 15743 15744 static transform(m1, m2) { 15745 return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; 15746 } 15747 15748 static applyTransform(p, m) { 15749 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 15750 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 15751 return [xt, yt]; 15752 } 15753 15754 static applyInverseTransform(p, m) { 15755 const d = m[0] * m[3] - m[1] * m[2]; 15756 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 15757 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 15758 return [xt, yt]; 15759 } 15760 15761 static getAxialAlignedBoundingBox(r, m) { 15762 const p1 = Util.applyTransform(r, m); 15763 const p2 = Util.applyTransform(r.slice(2, 4), m); 15764 const p3 = Util.applyTransform([r[0], r[3]], m); 15765 const p4 = Util.applyTransform([r[2], r[1]], m); 15766 return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; 15767 } 15768 15769 static inverseTransform(m) { 15770 const d = m[0] * m[3] - m[1] * m[2]; 15771 return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; 15772 } 15773 15774 static apply3dTransform(m, v) { 15775 return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; 15776 } 15777 15778 static singularValueDecompose2dScale(m) { 15779 const transpose = [m[0], m[2], m[1], m[3]]; 15780 const a = m[0] * transpose[0] + m[1] * transpose[2]; 15781 const b = m[0] * transpose[1] + m[1] * transpose[3]; 15782 const c = m[2] * transpose[0] + m[3] * transpose[2]; 15783 const d = m[2] * transpose[1] + m[3] * transpose[3]; 15784 const first = (a + d) / 2; 15785 const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; 15786 const sx = first + second || 1; 15787 const sy = first - second || 1; 15788 return [Math.sqrt(sx), Math.sqrt(sy)]; 15789 } 15790 15791 static normalizeRect(rect) { 15792 const r = rect.slice(0); 15793 15794 if (rect[0] > rect[2]) { 15795 r[0] = rect[2]; 15796 r[2] = rect[0]; 15797 } 15798 15799 if (rect[1] > rect[3]) { 15800 r[1] = rect[3]; 15801 r[3] = rect[1]; 15802 } 15803 15804 return r; 15805 } 15806 15807 static intersect(rect1, rect2) { 15808 function compare(a, b) { 15809 return a - b; 15810 } 15811 15812 const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
15813 const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); 15814 const result = []; 15815 rect1 = Util.normalizeRect(rect1); 15816 rect2 = Util.normalizeRect(rect2); 15817 15818 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 15819 result[0] = orderedX[1]; 15820 result[2] = orderedX[2]; 15821 } else { 15822 return null; 15823 } 15824 15825 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 15826 result[1] = orderedY[1]; 15827 result[3] = orderedY[2]; 15828 } else { 15829 return null; 15830 } 15831 15832 return result; 15833 } 15834 15835} 15836 15837exports.Util = Util; 15838const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; 15839 15840function stringToPDFString(str) { 15841 const length = str.length, 15842 strBuf = []; 15843 15844 if (str[0] === "\xFE" && str[1] === "\xFF") { 15845 for (let i = 2; i < length; i += 2) { 15846 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 15847 } 15848 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 15849 for (let i = 2; i < length; i += 2) { 15850 strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i))); 15851 } 15852 } else { 15853 for (let i = 0; i < length; ++i) { 15854 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 15855 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 15856 } 15857 } 15858 15859 return strBuf.join(""); 15860} 15861 15862function stringToUTF8String(str) { 15863 return decodeURIComponent(escape(str)); 15864} 15865 15866function utf8StringToString(str) { 15867 return unescape(encodeURIComponent(str)); 15868} 15869 15870function isEmptyObj(obj) { 15871 for (const key in obj) { 15872 return false; 15873 } 15874 15875 return true; 15876} 15877 15878function isBool(v) { 15879 return typeof v === "boolean"; 15880} 15881 15882function isNum(v) { 15883 return typeof v === "number"; 15884} 15885 15886function isString(v) { 15887 return typeof v === "string"; 15888} 15889 15890function isArrayBuffer(v) { 15891 return typeof v === "object" && v !== null && v.byteLength !== undefined; 15892} 15893 15894function isArrayEqual(arr1, arr2) { 15895 if (arr1.length !== arr2.length) { 15896 return false; 15897 } 15898 15899 return arr1.every(function (element, index) { 15900 return element === arr2[index]; 15901 }); 15902} 15903 15904function createPromiseCapability() { 15905 const capability = Object.create(null); 15906 let isSettled = false; 15907 Object.defineProperty(capability, "settled", { 15908 get() { 15909 return isSettled; 15910 } 15911 15912 }); 15913 capability.promise = new Promise(function (resolve, reject) { 15914 capability.resolve = function (data) { 15915 isSettled = true; 15916 resolve(data); 15917 }; 15918 15919 capability.reject = function (reason) { 15920 isSettled = true; 15921 reject(reason); 15922 }; 15923 }); 15924 return capability; 15925} 15926 15927const createObjectURL = function createObjectURLClosure() { 15928 const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 15929 return function createObjectURL(data, contentType, forceDataSchema = false) { 15930 if (!forceDataSchema && URL.createObjectURL) { 15931 const blob = new Blob([data], { 15932 type: contentType 15933 }); 15934 return URL.createObjectURL(blob); 15935 } 15936 15937 let buffer = `data:${contentType};base64,`; 15938 15939 for (let i = 0, ii = data.length; i < ii; i += 3) { 15940 const b1 = data[i] & 0xff; 15941 const b2 = data[i + 1] & 0xff; 15942 const b3 = data[i + 2] & 0xff;
15943 const d1 = b1 >> 2, 15944 d2 = (b1 & 3) << 4 | b2 >> 4; 15945 const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; 15946 const d4 = i + 2 < ii ? b3 & 0x3f : 64; 15947 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 15948 } 15949 15950 return buffer; 15951 }; 15952}(); 15953 15954exports.createObjectURL = createObjectURL; 15955 15956/***/ }), 15957/* 3 */ 15958/***/ (function(module, exports, __w_pdfjs_require__) { 15959 15960"use strict"; 15961 15962 15963var _is_node = __w_pdfjs_require__(4); 15964 15965; 15966 15967/***/ }), 15968/* 4 */ 15969/***/ (function(module, exports, __w_pdfjs_require__) { 15970 15971"use strict"; 15972 15973 15974Object.defineProperty(exports, "__esModule", { 15975 value: true 15976}); 15977exports.isNodeJS = void 0; 15978const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron; 15979exports.isNodeJS = isNodeJS; 15980 15981/***/ }), 15982/* 5 */ 15983/***/ (function(module, exports, __w_pdfjs_require__) { 15984 15985"use strict"; 15986 15987 15988Object.defineProperty(exports, "__esModule", { 15989 value: true 15990}); 15991exports.clearPrimitiveCaches = clearPrimitiveCaches; 15992exports.isEOF = isEOF; 15993exports.isCmd = isCmd; 15994exports.isDict = isDict; 15995exports.isName = isName; 15996exports.isRef = isRef; 15997exports.isRefsEqual = isRefsEqual; 15998exports.isStream = isStream; 15999exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0; 16000 16001var _util = __w_pdfjs_require__(2); 16002 16003var EOF = {}; 16004exports.EOF = EOF; 16005 16006var Name = function NameClosure() { 16007 let nameCache = Object.create(null); 16008 16009 function Name(name) { 16010 this.name = name; 16011 } 16012 16013 Name.prototype = {}; 16014 16015 Name.get = function Name_get(name) { 16016 var nameValue = nameCache[name]; 16017 return nameValue ? nameValue : nameCache[name] = new Name(name); 16018 }; 16019 16020 Name._clearCache = function () { 16021 nameCache = Object.create(null); 16022 }; 16023 16024 return Name; 16025}(); 16026 16027exports.Name = Name; 16028 16029var Cmd = function CmdClosure() { 16030 let cmdCache = Object.create(null); 16031 16032 function Cmd(cmd) { 16033 this.cmd = cmd; 16034 } 16035 16036 Cmd.prototype = {}; 16037 16038 Cmd.get = function Cmd_get(cmd) { 16039 var cmdValue = cmdCache[cmd]; 16040 return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); 16041 }; 16042 16043 Cmd._clearCache = function () { 16044 cmdCache = Object.create(null); 16045 }; 16046 16047 return Cmd; 16048}(); 16049 16050exports.Cmd = Cmd; 16051 16052var Dict = function DictClosure() { 16053 var nonSerializable = function nonSerializableClosure() { 16054 return nonSerializable; 16055 }; 16056 16057 function Dict(xref) { 16058 this._map = Object.create(null); 16059 this.xref = xref; 16060 this.objId = null; 16061 this.suppressEncryption = false; 16062 this.__nonSerializable__ = nonSerializable; 16063 } 16064 16065 Dict.prototype = { 16066 assignXref: function Dict_assignXref(newXref) { 16067 this.xref = newXref; 16068 }, 16069 16070 get(key1, key2, key3) { 16071 let value = this._map[key1]; 16072 16073 if (value === undefined && key2 !== undefined) { 16074 value = this._map[key2]; 16075 16076 if (value === undefined && key3 !== undefined) { 16077 value = this._map[key3]; 16078 } 16079 } 16080 16081 if (value instanceof Ref && this.xref) { 16082 return this.xref.fetch(value, this.suppressEncryption); 16083 } 16084 16085 return value; 16086 }, 16087 16088 async getAsync(key1, key2, key3) { 16089 let value = this._map[key1]; 16090 16091 if (value === undefined && key2 !== undefined) { 16092 value = this._map[key2]; 16093 16094 if (value === undefined && key3 !== undefined) { 16095 value = this._map[key3]; 16096 } 16097 } 16098 16099 if (value instanceof Ref && this.xref) { 16100 return this.xref.fetchAsync(value, this.suppressEncryption); 16101 } 16102 16103 return value; 16104 }, 16105 16106 getArray(key1, key2, key3) { 16107 let value = this.get(key1, key2, key3); 16108 16109 if (!Array.isArray(value) || !this.xref) { 16110 return value; 16111 } 16112 16113 value = value.slice(); 16114 16115 for (let i = 0, ii = value.length; i < ii; i++) { 16116 if (!(value[i] instanceof Ref)) { 16117 continue; 16118 } 16119 16120 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 16121 } 16122 16123 return value; 16124 }, 16125 16126 getRaw: function Dict_getRaw(key) { 16127 return this._map[key]; 16128 }, 16129 getKeys: function Dict_getKeys() { 16130 return Object.keys(this._map); 16131 }, 16132 set: function Dict_set(key, value) { 16133 this._map[key] = value; 16134 }, 16135 has: function Dict_has(key) { 16136 return this._map[key] !== undefined; 16137 },
16138 forEach: function Dict_forEach(callback) { 16139 for (var key in this._map) { 16140 callback(key, this.get(key)); 16141 } 16142 } 16143 }; 16144 Dict.empty = new Dict(null); 16145 16146 Dict.merge = function (xref, dictArray) { 16147 const mergedDict = new Dict(xref); 16148 16149 for (let i = 0, ii = dictArray.length; i < ii; i++) { 16150 const dict = dictArray[i]; 16151 16152 if (!isDict(dict)) { 16153 continue; 16154 } 16155 16156 for (const keyName in dict._map) { 16157 if (mergedDict._map[keyName] !== undefined) { 16158 continue; 16159 } 16160 16161 mergedDict._map[keyName] = dict._map[keyName]; 16162 } 16163 } 16164 16165 return mergedDict; 16166 }; 16167 16168 return Dict; 16169}(); 16170 16171exports.Dict = Dict; 16172 16173var Ref = function RefClosure() { 16174 let refCache = Object.create(null); 16175 16176 function Ref(num, gen) { 16177 this.num = num; 16178 this.gen = gen; 16179 } 16180 16181 Ref.prototype = { 16182 toString: function Ref_toString() { 16183 if (this.gen === 0) { 16184 return `${this.num}R`; 16185 } 16186 16187 return `${this.num}R${this.gen}`; 16188 } 16189 }; 16190 16191 Ref.get = function (num, gen) { 16192 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 16193 const refValue = refCache[key]; 16194 return refValue ? refValue : refCache[key] = new Ref(num, gen); 16195 }; 16196 16197 Ref._clearCache = function () { 16198 refCache = Object.create(null); 16199 }; 16200 16201 return Ref; 16202}(); 16203 16204exports.Ref = Ref; 16205 16206var RefSet = function RefSetClosure() { 16207 function RefSet() { 16208 this.dict = Object.create(null); 16209 } 16210 16211 RefSet.prototype = { 16212 has: function RefSet_has(ref) { 16213 return ref.toString() in this.dict; 16214 }, 16215 put: function RefSet_put(ref) { 16216 this.dict[ref.toString()] = true; 16217 }, 16218 remove: function RefSet_remove(ref) { 16219 delete this.dict[ref.toString()]; 16220 } 16221 }; 16222 return RefSet; 16223}(); 16224 16225exports.RefSet = RefSet; 16226 16227var RefSetCache = function RefSetCacheClosure() { 16228 function RefSetCache() { 16229 this.dict = Object.create(null); 16230 } 16231 16232 RefSetCache.prototype = { 16233 get size() { 16234 return Object.keys(this.dict).length; 16235 }, 16236 16237 get: function RefSetCache_get(ref) { 16238 return this.dict[ref.toString()]; 16239 }, 16240 has: function RefSetCache_has(ref) { 16241 return ref.toString() in this.dict; 16242 }, 16243 put: function RefSetCache_put(ref, obj) { 16244 this.dict[ref.toString()] = obj; 16245 }, 16246 putAlias: function RefSetCache_putAlias(ref, aliasRef) { 16247 this.dict[ref.toString()] = this.get(aliasRef); 16248 }, 16249 forEach: function RefSetCache_forEach(callback) { 16250 for (const i in this.dict) { 16251 callback(this.dict[i]); 16252 } 16253 }, 16254 clear: function RefSetCache_clear() { 16255 this.dict = Object.create(null); 16256 } 16257 }; 16258 return RefSetCache; 16259}(); 16260 16261exports.RefSetCache = RefSetCache; 16262 16263function isEOF(v) { 16264 return v === EOF; 16265} 16266 16267function isName(v, name) { 16268 return v instanceof Name && (name === undefined || v.name === name); 16269} 16270 16271function isCmd(v, cmd) { 16272 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 16273} 16274 16275function isDict(v, type) { 16276 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 16277} 16278 16279function isRef(v) { 16280 return v instanceof Ref; 16281} 16282 16283function isRefsEqual(v1, v2) { 16284 return v1.num === v2.num && v1.gen === v2.gen; 16285} 16286 16287function isStream(v) { 16288 return typeof v === "object" && v !== null && v.getBytes !== undefined; 16289} 16290 16291function clearPrimitiveCaches() { 16292 Cmd._clearCache(); 16293 16294 Name._clearCache(); 16295 16296 Ref._clearCache(); 16297} 16298 16299/***/ }), 16300/* 6 */ 16301/***/ (function(module, exports, __w_pdfjs_require__) { 16302 16303"use strict"; 16304 16305 16306Object.defineProperty(exports, "__esModule", { 16307 value: true 16308}); 16309exports.NetworkPdfManager = exports.LocalPdfManager = void 0; 16310 16311var _util = __w_pdfjs_require__(2); 16312 16313var _chunked_stream = __w_pdfjs_require__(7); 16314 16315var _core_utils = __w_pdfjs_require__(8); 16316 16317var _document = __w_pdfjs_require__(9); 16318 16319var _stream = __w_pdfjs_require__(12); 16320 16321class BasePdfManager { 16322 constructor() { 16323 if (this.constructor === BasePdfManager) { 16324 (0, _util.unreachable)("Cannot initialize BasePdfManager."); 16325 } 16326 } 16327 16328 get docId() { 16329 return this._docId; 16330 } 16331 16332 get password() { 16333 return this._password; 16334 } 16335 16336 get docBaseUrl() { 16337 let docBaseUrl = null; 16338 16339 if (this._docBaseUrl) { 16340 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl); 16341 16342 if (absoluteUrl) { 16343 docBaseUrl = absoluteUrl.href; 16344 } else { 16345 (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`); 16346 } 16347 } 16348 16349 return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl); 16350 } 16351 16352 onLoadedStream() { 16353 (0, _util.unreachable)("Abstract method `onLoadedStream` called"); 16354 } 16355 16356 ensureDoc(prop, args) { 16357 return this.ensure(this.pdfDocument, prop, args); 16358 } 16359 16360 ensureXRef(prop, args) { 16361 return this.ensure(this.pdfDocument.xref, prop, args); 16362 } 16363 16364 ensureCatalog(prop, args) { 16365 return this.ensure(this.pdfDocument.catalog, prop, args); 16366 } 16367 16368 getPage(pageIndex) { 16369 return this.pdfDocument.getPage(pageIndex); 16370 } 16371 16372 fontFallback(id, handler) { 16373 return this.pdfDocument.fontFallback(id, handler); 16374 } 16375 16376 cleanup(manuallyTriggered = false) { 16377 return this.pdfDocument.cleanup(manuallyTriggered); 16378 } 16379 16380 async ensure(obj, prop, args) { 16381 (0, _util.unreachable)("Abstract method `ensure` called"); 16382 } 16383 16384 requestRange(begin, end) { 16385 (0, _util.unreachable)("Abstract method `requestRange` called"); 16386 } 16387 16388 requestLoadedStream() { 16389 (0, _util.unreachable)("Abstract method `requestLoadedStream` called"); 16390 } 16391 16392 sendProgressiveData(chunk) { 16393 (0, _util.unreachable)("Abstract method `sendProgressiveData` called"); 16394 } 16395 16396 updatePassword(password) { 16397 this._password = password; 16398 } 16399 16400 terminate(reason) { 16401 (0, _util.unreachable)("Abstract method `terminate` called"); 16402 } 16403 16404} 16405 16406class LocalPdfManager extends BasePdfManager { 16407 constructor(docId, data, password, evaluatorOptions, docBaseUrl) { 16408 super(); 16409 this._docId = docId; 16410 this._password = password; 16411 this._docBaseUrl = docBaseUrl; 16412 this.evaluatorOptions = evaluatorOptions; 16413 const stream = new _stream.Stream(data); 16414 this.pdfDocument = new _document.PDFDocument(this, stream); 16415 this._loadedStreamPromise = Promise.resolve(stream); 16416 } 16417 16418 async ensure(obj, prop, args) { 16419 const value = obj[prop]; 16420 16421 if (typeof value === "function") {
16422 return value.apply(obj, args); 16423 } 16424 16425 return value; 16426 } 16427 16428 requestRange(begin, end) { 16429 return Promise.resolve(); 16430 } 16431 16432 requestLoadedStream() {} 16433 16434 onLoadedStream() { 16435 return this._loadedStreamPromise; 16436 } 16437 16438 terminate(reason) {} 16439 16440} 16441 16442exports.LocalPdfManager = LocalPdfManager; 16443 16444class NetworkPdfManager extends BasePdfManager { 16445 constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) { 16446 super(); 16447 this._docId = docId; 16448 this._password = args.password; 16449 this._docBaseUrl = docBaseUrl; 16450 this.msgHandler = args.msgHandler; 16451 this.evaluatorOptions = evaluatorOptions; 16452 this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, { 16453 msgHandler: args.msgHandler, 16454 length: args.length, 16455 disableAutoFetch: args.disableAutoFetch, 16456 rangeChunkSize: args.rangeChunkSize 16457 }); 16458 this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream()); 16459 } 16460 16461 async ensure(obj, prop, args) { 16462 try { 16463 const value = obj[prop]; 16464 16465 if (typeof value === "function") { 16466 return value.apply(obj, args); 16467 } 16468 16469 return value; 16470 } catch (ex) { 16471 if (!(ex instanceof _core_utils.MissingDataException)) { 16472 throw ex; 16473 } 16474 16475 await this.requestRange(ex.begin, ex.end); 16476 return this.ensure(obj, prop, args); 16477 } 16478 } 16479 16480 requestRange(begin, end) { 16481 return this.streamManager.requestRange(begin, end); 16482 } 16483 16484 requestLoadedStream() { 16485 this.streamManager.requestAllChunks(); 16486 } 16487 16488 sendProgressiveData(chunk) { 16489 this.streamManager.onReceiveData({ 16490 chunk 16491 }); 16492 } 16493 16494 onLoadedStream() { 16495 return this.streamManager.onLoadedStream(); 16496 } 16497 16498 terminate(reason) { 16499 this.streamManager.abort(reason); 16500 } 16501 16502} 16503 16504exports.NetworkPdfManager = NetworkPdfManager; 16505 16506/***/ }), 16507/* 7 */ 16508/***/ (function(module, exports, __w_pdfjs_require__) { 16509 16510"use strict"; 16511 16512 16513Object.defineProperty(exports, "__esModule", { 16514 value: true 16515}); 16516exports.ChunkedStreamManager = exports.ChunkedStream = void 0; 16517 16518var _util = __w_pdfjs_require__(2); 16519 16520var _core_utils = __w_pdfjs_require__(8); 16521 16522class ChunkedStream { 16523 constructor(length, chunkSize, manager) { 16524 this.bytes = new Uint8Array(length); 16525 this.start = 0; 16526 this.pos = 0; 16527 this.end = length; 16528 this.chunkSize = chunkSize; 16529 this.loadedChunks = []; 16530 this.numChunksLoaded = 0; 16531 this.numChunks = Math.ceil(length / chunkSize); 16532 this.manager = manager; 16533 this.progressiveDataLength = 0; 16534 this.lastSuccessfulEnsureByteChunk = -1; 16535 } 16536 16537 getMissingChunks() { 16538 const chunks = []; 16539 16540 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 16541 if (!this.loadedChunks[chunk]) { 16542 chunks.push(chunk); 16543 } 16544 } 16545 16546 return chunks; 16547 } 16548 16549 getBaseStreams() { 16550 return [this]; 16551 } 16552 16553 allChunksLoaded() { 16554 return this.numChunksLoaded === this.numChunks; 16555 } 16556 16557 onReceiveData(begin, chunk) { 16558 const chunkSize = this.chunkSize; 16559 16560 if (begin % chunkSize !== 0) { 16561 throw new Error(`Bad begin offset: ${begin}`); 16562 } 16563 16564 const end = begin + chunk.byteLength; 16565 16566 if (end % chunkSize !== 0 && end !== this.bytes.length) { 16567 throw new Error(`Bad end offset: ${end}`); 16568 } 16569 16570 this.bytes.set(new Uint8Array(chunk), begin); 16571 const beginChunk = Math.floor(begin / chunkSize); 16572 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 16573 16574 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 16575 if (!this.loadedChunks[curChunk]) { 16576 this.loadedChunks[curChunk] = true; 16577 ++this.numChunksLoaded; 16578 } 16579 } 16580 } 16581 16582 onReceiveProgressiveData(data) { 16583 let position = this.progressiveDataLength; 16584 const beginChunk = Math.floor(position / this.chunkSize); 16585 this.bytes.set(new Uint8Array(data), position); 16586 position += data.byteLength; 16587 this.progressiveDataLength = position; 16588 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 16589 16590 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 16591 if (!this.loadedChunks[curChunk]) { 16592 this.loadedChunks[curChunk] = true; 16593 ++this.numChunksLoaded; 16594 } 16595 } 16596 } 16597 16598 ensureByte(pos) { 16599 if (pos < this.progressiveDataLength) { 16600 return; 16601 } 16602 16603 const chunk = Math.floor(pos / this.chunkSize); 16604 16605 if (chunk === this.lastSuccessfulEnsureByteChunk) { 16606 return; 16607 } 16608 16609 if (!this.loadedChunks[chunk]) { 16610 throw new _core_utils.MissingDataException(pos, pos + 1); 16611 } 16612 16613 this.lastSuccessfulEnsureByteChunk = chunk; 16614 } 16615 16616 ensureRange(begin, end) { 16617 if (begin >= end) { 16618 return; 16619 } 16620 16621 if (end <= this.progressiveDataLength) { 16622 return; 16623 } 16624 16625 const chunkSize = this.chunkSize; 16626 const beginChunk = Math.floor(begin / chunkSize); 16627 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 16628 16629 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 16630 if (!this.loadedChunks[chunk]) { 16631 throw new _core_utils.MissingDataException(begin, end); 16632 } 16633 } 16634 } 16635 16636 nextEmptyChunk(beginChunk) { 16637 const numChunks = this.numChunks; 16638 16639 for (let i = 0; i < numChunks; ++i) { 16640 const chunk = (beginChunk + i) % numChunks; 16641 16642 if (!this.loadedChunks[chunk]) { 16643 return chunk; 16644 } 16645 } 16646 16647 return null; 16648 } 16649 16650 hasChunk(chunk) { 16651 return !!this.loadedChunks[chunk]; 16652 } 16653 16654 get length() {
16655 return this.end - this.start; 16656 } 16657 16658 get isEmpty() { 16659 return this.length === 0; 16660 } 16661 16662 getByte() { 16663 const pos = this.pos; 16664 16665 if (pos >= this.end) { 16666 return -1; 16667 } 16668 16669 if (pos >= this.progressiveDataLength) { 16670 this.ensureByte(pos); 16671 } 16672 16673 return this.bytes[this.pos++]; 16674 } 16675 16676 getUint16() { 16677 const b0 = this.getByte(); 16678 const b1 = this.getByte(); 16679 16680 if (b0 === -1 || b1 === -1) { 16681 return -1; 16682 } 16683 16684 return (b0 << 8) + b1; 16685 } 16686 16687 getInt32() { 16688 const b0 = this.getByte(); 16689 const b1 = this.getByte(); 16690 const b2 = this.getByte(); 16691 const b3 = this.getByte(); 16692 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 16693 } 16694 16695 getBytes(length, forceClamped = false) { 16696 const bytes = this.bytes; 16697 const pos = this.pos; 16698 const strEnd = this.end; 16699 16700 if (!length) { 16701 if (strEnd > this.progressiveDataLength) { 16702 this.ensureRange(pos, strEnd); 16703 } 16704 16705 const subarray = bytes.subarray(pos, strEnd); 16706 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 16707 } 16708 16709 let end = pos + length; 16710 16711 if (end > strEnd) { 16712 end = strEnd; 16713 } 16714 16715 if (end > this.progressiveDataLength) { 16716 this.ensureRange(pos, end); 16717 } 16718 16719 this.pos = end; 16720 const subarray = bytes.subarray(pos, end); 16721 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 16722 } 16723 16724 peekByte() { 16725 const peekedByte = this.getByte(); 16726 16727 if (peekedByte !== -1) { 16728 this.pos--; 16729 } 16730 16731 return peekedByte; 16732 } 16733 16734 peekBytes(length, forceClamped = false) { 16735 const bytes = this.getBytes(length, forceClamped); 16736 this.pos -= bytes.length; 16737 return bytes; 16738 } 16739 16740 getByteRange(begin, end) { 16741 if (begin < 0) { 16742 begin = 0; 16743 } 16744 16745 if (end > this.end) { 16746 end = this.end; 16747 } 16748 16749 if (end > this.progressiveDataLength) { 16750 this.ensureRange(begin, end); 16751 } 16752 16753 return this.bytes.subarray(begin, end); 16754 } 16755 16756 skip(n) { 16757 if (!n) { 16758 n = 1; 16759 } 16760 16761 this.pos += n; 16762 } 16763 16764 reset() { 16765 this.pos = this.start; 16766 } 16767 16768 moveStart() { 16769 this.start = this.pos; 16770 } 16771 16772 makeSubStream(start, length, dict) { 16773 if (length) { 16774 if (start + length > this.progressiveDataLength) { 16775 this.ensureRange(start, start + length); 16776 } 16777 } else { 16778 if (start >= this.progressiveDataLength) { 16779 this.ensureByte(start); 16780 } 16781 } 16782 16783 function ChunkedStreamSubstream() {} 16784 16785 ChunkedStreamSubstream.prototype = Object.create(this); 16786 16787 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 16788 const chunkSize = this.chunkSize; 16789 const beginChunk = Math.floor(this.start / chunkSize); 16790 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 16791 const missingChunks = []; 16792 16793 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 16794 if (!this.loadedChunks[chunk]) { 16795 missingChunks.push(chunk); 16796 } 16797 } 16798 16799 return missingChunks; 16800 }; 16801 16802 ChunkedStreamSubstream.prototype.allChunksLoaded = function () { 16803 if (this.numChunksLoaded === this.numChunks) { 16804 return true; 16805 } 16806 16807 return this.getMissingChunks().length === 0; 16808 }; 16809 16810 const subStream = new ChunkedStreamSubstream(); 16811 subStream.pos = subStream.start = start; 16812 subStream.end = start + length || this.end; 16813 subStream.dict = dict; 16814 return subStream; 16815 } 16816 16817} 16818 16819exports.ChunkedStream = ChunkedStream; 16820 16821class ChunkedStreamManager { 16822 constructor(pdfNetworkStream, args) { 16823 this.length = args.length; 16824 this.chunkSize = args.rangeChunkSize; 16825 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 16826 this.pdfNetworkStream = pdfNetworkStream; 16827 this.disableAutoFetch = args.disableAutoFetch; 16828 this.msgHandler = args.msgHandler; 16829 this.currRequestId = 0; 16830 this.chunksNeededByRequest = Object.create(null); 16831 this.requestsByChunk = Object.create(null); 16832 this.promisesByRequest = Object.create(null); 16833 this.progressiveDataLength = 0; 16834 this.aborted = false; 16835 this._loadedStreamCapability = (0, _util.createPromiseCapability)(); 16836 } 16837 16838 onLoadedStream() { 16839 return this._loadedStreamCapability.promise; 16840 } 16841 16842 sendRequest(begin, end) { 16843 const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 16844 16845 if (!rangeReader.isStreamingSupported) { 16846 rangeReader.onProgress = this.onProgress.bind(this); 16847 } 16848
16849 let chunks = [], 16850 loaded = 0; 16851 const promise = new Promise((resolve, reject) => { 16852 const readChunk = chunk => { 16853 try { 16854 if (!chunk.done) { 16855 const data = chunk.value; 16856 chunks.push(data); 16857 loaded += (0, _util.arrayByteLength)(data); 16858 16859 if (rangeReader.isStreamingSupported) { 16860 this.onProgress({ 16861 loaded 16862 }); 16863 } 16864 16865 rangeReader.read().then(readChunk, reject); 16866 return; 16867 } 16868 16869 const chunkData = (0, _util.arraysToBytes)(chunks); 16870 chunks = null; 16871 resolve(chunkData); 16872 } catch (e) { 16873 reject(e); 16874 } 16875 }; 16876 16877 rangeReader.read().then(readChunk, reject); 16878 }); 16879 promise.then(data => { 16880 if (this.aborted) { 16881 return; 16882 } 16883 16884 this.onReceiveData({ 16885 chunk: data, 16886 begin 16887 }); 16888 }); 16889 } 16890 16891 requestAllChunks() { 16892 const missingChunks = this.stream.getMissingChunks(); 16893 16894 this._requestChunks(missingChunks); 16895 16896 return this._loadedStreamCapability.promise; 16897 } 16898 16899 _requestChunks(chunks) { 16900 const requestId = this.currRequestId++; 16901 const chunksNeeded = Object.create(null); 16902 this.chunksNeededByRequest[requestId] = chunksNeeded; 16903 16904 for (const chunk of chunks) { 16905 if (!this.stream.hasChunk(chunk)) { 16906 chunksNeeded[chunk] = true; 16907 } 16908 } 16909 16910 if ((0, _util.isEmptyObj)(chunksNeeded)) { 16911 return Promise.resolve(); 16912 } 16913 16914 const capability = (0, _util.createPromiseCapability)(); 16915 this.promisesByRequest[requestId] = capability; 16916 const chunksToRequest = []; 16917 16918 for (let chunk in chunksNeeded) { 16919 chunk = chunk | 0; 16920 16921 if (!(chunk in this.requestsByChunk)) { 16922 this.requestsByChunk[chunk] = []; 16923 chunksToRequest.push(chunk); 16924 } 16925 16926 this.requestsByChunk[chunk].push(requestId); 16927 } 16928 16929 if (!chunksToRequest.length) { 16930 return capability.promise; 16931 } 16932 16933 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 16934 16935 for (const groupedChunk of groupedChunksToRequest) { 16936 const begin = groupedChunk.beginChunk * this.chunkSize; 16937 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 16938 this.sendRequest(begin, end); 16939 } 16940 16941 return capability.promise; 16942 } 16943 16944 getStream() { 16945 return this.stream; 16946 } 16947 16948 requestRange(begin, end) { 16949 end = Math.min(end, this.length); 16950 const beginChunk = this.getBeginChunk(begin); 16951 const endChunk = this.getEndChunk(end); 16952 const chunks = []; 16953 16954 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 16955 chunks.push(chunk); 16956 } 16957 16958 return this._requestChunks(chunks); 16959 } 16960 16961 requestRanges(ranges = []) { 16962 const chunksToRequest = []; 16963 16964 for (const range of ranges) { 16965 const beginChunk = this.getBeginChunk(range.begin); 16966 const endChunk = this.getEndChunk(range.end); 16967 16968 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 16969 if (!chunksToRequest.includes(chunk)) { 16970 chunksToRequest.push(chunk); 16971 } 16972 } 16973 } 16974 16975 chunksToRequest.sort(function (a, b) { 16976 return a - b; 16977 }); 16978 return this._requestChunks(chunksToRequest); 16979 } 16980 16981 groupChunks(chunks) { 16982 const groupedChunks = []; 16983 let beginChunk = -1; 16984 let prevChunk = -1; 16985 16986 for (let i = 0, ii = chunks.length; i < ii; ++i) { 16987 const chunk = chunks[i]; 16988 16989 if (beginChunk < 0) { 16990 beginChunk = chunk; 16991 } 16992 16993 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 16994 groupedChunks.push({ 16995 beginChunk, 16996 endChunk: prevChunk + 1 16997 }); 16998 beginChunk = chunk; 16999 } 17000 17001 if (i + 1 === chunks.length) { 17002 groupedChunks.push({ 17003 beginChunk, 17004 endChunk: chunk + 1 17005 }); 17006 } 17007 17008 prevChunk = chunk; 17009 } 17010 17011 return groupedChunks; 17012 } 17013 17014 onProgress(args) { 17015 this.msgHandler.send("DocProgress", { 17016 loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded, 17017 total: this.length 17018 }); 17019 } 17020 17021 onReceiveData(args) { 17022 const chunk = args.chunk; 17023 const isProgressive = args.begin === undefined; 17024 const begin = isProgressive ? this.progressiveDataLength : args.begin; 17025 const end = begin + chunk.byteLength; 17026 const beginChunk = Math.floor(begin / this.chunkSize); 17027 const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 17028 17029 if (isProgressive) { 17030 this.stream.onReceiveProgressiveData(chunk); 17031 this.progressiveDataLength = end; 17032 } else { 17033 this.stream.onReceiveData(begin, chunk); 17034 } 17035 17036 if (this.stream.allChunksLoaded()) { 17037 this._loadedStreamCapability.resolve(this.stream); 17038 } 17039 17040 const loadedRequests = []; 17041 17042 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 17043 const requestIds = this.requestsByChunk[curChunk] || []; 17044 delete this.requestsByChunk[curChunk]; 17045 17046 for (const requestId of requestIds) { 17047 const chunksNeeded = this.chunksNeededByRequest[requestId]; 17048 17049 if (curChunk in chunksNeeded) { 17050 delete chunksNeeded[curChunk]; 17051 } 17052 17053 if (!(0, _util.isEmptyObj)(chunksNeeded)) { 17054 continue; 17055 } 17056 17057 loadedRequests.push(requestId); 17058 } 17059 } 17060 17061 if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) { 17062 let nextEmptyChunk; 17063 17064 if (this.stream.numChunksLoaded === 1) { 17065 const lastChunk = this.stream.numChunks - 1; 17066 17067 if (!this.stream.hasChunk(lastChunk)) { 17068 nextEmptyChunk = lastChunk; 17069 } 17070 } else { 17071 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 17072 } 17073 17074 if (Number.isInteger(nextEmptyChunk)) { 17075 this._requestChunks([nextEmptyChunk]); 17076 } 17077 } 17078 17079 for (const requestId of loadedRequests) { 17080 const capability = this.promisesByRequest[requestId]; 17081 delete this.promisesByRequest[requestId]; 17082 capability.resolve(); 17083 } 17084 17085 this.msgHandler.send("DocProgress", { 17086 loaded: this.stream.numChunksLoaded * this.chunkSize, 17087 total: this.length 17088 }); 17089 } 17090 17091 onError(err) { 17092 this._loadedStreamCapability.reject(err); 17093 } 17094 17095 getBeginChunk(begin) { 17096 return Math.floor(begin / this.chunkSize); 17097 } 17098
17099 getEndChunk(end) { 17100 return Math.floor((end - 1) / this.chunkSize) + 1; 17101 } 17102 17103 abort(reason) { 17104 this.aborted = true; 17105 17106 if (this.pdfNetworkStream) { 17107 this.pdfNetworkStream.cancelAllRequests(reason); 17108 } 17109 17110 for (const requestId in this.promisesByRequest) { 17111 this.promisesByRequest[requestId].reject(reason); 17112 } 17113 } 17114 17115} 17116 17117exports.ChunkedStreamManager = ChunkedStreamManager; 17118 17119/***/ }), 17120/* 8 */ 17121/***/ (function(module, exports, __w_pdfjs_require__) { 17122 17123"use strict"; 17124 17125 17126Object.defineProperty(exports, "__esModule", { 17127 value: true 17128}); 17129exports.getLookupTableFactory = getLookupTableFactory; 17130exports.getInheritableProperty = getInheritableProperty; 17131exports.toRomanNumerals = toRomanNumerals; 17132exports.log2 = log2; 17133exports.readInt8 = readInt8; 17134exports.readUint16 = readUint16; 17135exports.readUint32 = readUint32; 17136exports.isWhiteSpace = isWhiteSpace; 17137exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0; 17138 17139var _util = __w_pdfjs_require__(2); 17140 17141function getLookupTableFactory(initializer) { 17142 let lookup; 17143 return function () { 17144 if (initializer) { 17145 lookup = Object.create(null); 17146 initializer(lookup); 17147 initializer = null; 17148 } 17149 17150 return lookup; 17151 }; 17152} 17153 17154class MissingDataException extends _util.BaseException { 17155 constructor(begin, end) { 17156 super(`Missing data [${begin}, ${end})`); 17157 this.begin = begin; 17158 this.end = end; 17159 } 17160 17161} 17162 17163exports.MissingDataException = MissingDataException; 17164 17165class XRefEntryException extends _util.BaseException {} 17166 17167exports.XRefEntryException = XRefEntryException; 17168 17169class XRefParseException extends _util.BaseException {} 17170 17171exports.XRefParseException = XRefParseException; 17172 17173function getInheritableProperty({ 17174 dict, 17175 key, 17176 getArray = false, 17177 stopWhenFound = true 17178}) { 17179 const LOOP_LIMIT = 100; 17180 let loopCount = 0; 17181 let values; 17182 17183 while (dict) { 17184 const value = getArray ? dict.getArray(key) : dict.get(key); 17185 17186 if (value !== undefined) { 17187 if (stopWhenFound) { 17188 return value; 17189 } 17190 17191 if (!values) { 17192 values = []; 17193 } 17194 17195 values.push(value); 17196 } 17197 17198 if (++loopCount > LOOP_LIMIT) { 17199 (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`); 17200 break; 17201 } 17202 17203 dict = dict.get("Parent"); 17204 } 17205 17206 return values; 17207} 17208 17209const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; 17210 17211function toRomanNumerals(number, lowerCase = false) { 17212 (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 17213 const romanBuf = []; 17214 let pos; 17215 17216 while (number >= 1000) { 17217 number -= 1000; 17218 romanBuf.push("M"); 17219 } 17220 17221 pos = number / 100 | 0; 17222 number %= 100; 17223 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 17224 pos = number / 10 | 0; 17225 number %= 10; 17226 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 17227 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 17228 const romanStr = romanBuf.join(""); 17229 return lowerCase ? romanStr.toLowerCase() : romanStr; 17230} 17231 17232function log2(x) { 17233 if (x <= 0) { 17234 return 0; 17235 } 17236 17237 return Math.ceil(Math.log2(x)); 17238} 17239 17240function readInt8(data, offset) { 17241 return data[offset] << 24 >> 24; 17242} 17243 17244function readUint16(data, offset) { 17245 return data[offset] << 8 | data[offset + 1]; 17246} 17247 17248function readUint32(data, offset) { 17249 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 17250} 17251 17252function isWhiteSpace(ch) { 17253 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 17254} 17255 17256/***/ }), 17257/* 9 */ 17258/***/ (function(module, exports, __w_pdfjs_require__) { 17259 17260"use strict"; 17261 17262 17263Object.defineProperty(exports, "__esModule", { 17264 value: true 17265}); 17266exports.PDFDocument = exports.Page = void 0; 17267 17268var _util = __w_pdfjs_require__(2); 17269 17270var _obj = __w_pdfjs_require__(10); 17271 17272var _primitives = __w_pdfjs_require__(5); 17273 17274var _core_utils = __w_pdfjs_require__(8); 17275 17276var _stream = __w_pdfjs_require__(12); 17277 17278var _annotation = __w_pdfjs_require__(25); 17279 17280var _crypto = __w_pdfjs_require__(22); 17281 17282var _parser = __w_pdfjs_require__(11); 17283 17284var _operator_list = __w_pdfjs_require__(26); 17285 17286var _evaluator = __w_pdfjs_require__(27); 17287 17288var _function = __w_pdfjs_require__(41); 17289 17290const DEFAULT_USER_UNIT = 1.0; 17291const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 17292 17293function isAnnotationRenderable(annotation, intent) { 17294 return intent === "display" && annotation.viewable || intent === "print" && annotation.printable; 17295} 17296 17297class Page { 17298 constructor({ 17299 pdfManager, 17300 xref, 17301 pageIndex, 17302 pageDict, 17303 ref, 17304 fontCache, 17305 builtInCMapCache, 17306 globalImageCache, 17307 pdfFunctionFactory 17308 }) { 17309 this.pdfManager = pdfManager; 17310 this.pageIndex = pageIndex; 17311 this.pageDict = pageDict; 17312 this.xref = xref; 17313 this.ref = ref; 17314 this.fontCache = fontCache; 17315 this.builtInCMapCache = builtInCMapCache; 17316 this.globalImageCache = globalImageCache; 17317 this.pdfFunctionFactory = pdfFunctionFactory; 17318 this.evaluatorOptions = pdfManager.evaluatorOptions; 17319 this.resourcesPromise = null; 17320 const idCounters = { 17321 obj: 0 17322 }; 17323 this.idFactory = { 17324 createObjId() { 17325 return `p${pageIndex}_${++idCounters.obj}`; 17326 }, 17327 17328 getDocId() { 17329 return `g_${pdfManager.docId}`; 17330 } 17331 17332 }; 17333 } 17334 17335 _getInheritableProperty(key, getArray = false) { 17336 const value = (0, _core_utils.getInheritableProperty)({ 17337 dict: this.pageDict, 17338 key, 17339 getArray, 17340 stopWhenFound: false 17341 }); 17342 17343 if (!Array.isArray(value)) { 17344 return value; 17345 } 17346 17347 if (value.length === 1 || !(0, _primitives.isDict)(value[0])) { 17348 return value[0]; 17349 } 17350 17351 return _primitives.Dict.merge(this.xref, value); 17352 } 17353 17354 get content() { 17355 return this.pageDict.get("Contents"); 17356 } 17357 17358 get resources() { 17359 return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty); 17360 } 17361 17362 _getBoundingBox(name) { 17363 const box = this._getInheritableProperty(name, true); 17364 17365 if (Array.isArray(box) && box.length === 4) { 17366 if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 17367 return box; 17368 } 17369 17370 (0, _util.warn)(`Empty /${name} entry.`); 17371 } 17372 17373 return null; 17374 } 17375 17376 get mediaBox() { 17377 return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 17378 } 17379 17380 get cropBox() { 17381 return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox); 17382 } 17383 17384 get userUnit() { 17385 let obj = this.pageDict.get("UserUnit"); 17386 17387 if (!(0, _util.isNum)(obj) || obj <= 0) { 17388 obj = DEFAULT_USER_UNIT; 17389 } 17390 17391 return (0, _util.shadow)(this, "userUnit", obj); 17392 } 17393 17394 get view() { 17395 const { 17396 cropBox, 17397 mediaBox 17398 } = this; 17399 let view; 17400 17401 if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) { 17402 view = mediaBox; 17403 } else { 17404 const box = _util.Util.intersect(cropBox, mediaBox); 17405 17406 if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 17407 view = box; 17408 } else { 17409 (0, _util.warn)("Empty /CropBox and /MediaBox intersection."); 17410 } 17411 } 17412 17413 return (0, _util.shadow)(this, "view", view || mediaBox); 17414 } 17415 17416 get rotate() { 17417 let rotate = this._getInheritableProperty("Rotate") || 0; 17418 17419 if (rotate % 90 !== 0) { 17420 rotate = 0; 17421 } else if (rotate >= 360) { 17422 rotate = rotate % 360; 17423 } else if (rotate < 0) { 17424 rotate = (rotate % 360 + 360) % 360; 17425 } 17426 17427 return (0, _util.shadow)(this, "rotate", rotate); 17428 } 17429 17430 getContentStream() { 17431 const content = this.content; 17432 let stream; 17433 17434 if (Array.isArray(content)) { 17435 const xref = this.xref; 17436 const streams = []; 17437 17438 for (const subStream of content) { 17439 streams.push(xref.fetchIfRef(subStream)); 17440 } 17441 17442 stream = new _stream.StreamsSequenceStream(streams); 17443 } else if ((0, _primitives.isStream)(content)) { 17444 stream = content; 17445 } else { 17446 stream = new _stream.NullStream(); 17447 } 17448 17449 return stream; 17450 } 17451 17452 loadResources(keys) { 17453 if (!this.resourcesPromise) { 17454 this.resourcesPromise = this.pdfManager.ensure(this, "resources"); 17455 } 17456 17457 return this.resourcesPromise.then(() => { 17458 const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref); 17459 return objectLoader.load(); 17460 }); 17461 } 17462 17463 getOperatorList({ 17464 handler, 17465 sink, 17466 task, 17467 intent, 17468 renderInteractiveForms 17469 }) { 17470 const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream"); 17471 const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]); 17472 const partialEvaluator = new _evaluator.PartialEvaluator({ 17473 xref: this.xref, 17474 handler, 17475 pageIndex: this.pageIndex, 17476 idFactory: this.idFactory, 17477 fontCache: this.fontCache, 17478 builtInCMapCache: this.builtInCMapCache, 17479 globalImageCache: this.globalImageCache, 17480 options: this.evaluatorOptions, 17481 pdfFunctionFactory: this.pdfFunctionFactory 17482 }); 17483 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 17484 const pageListPromise = dataPromises.then(([contentStream]) => { 17485 const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex); 17486 handler.send("StartRenderPage", { 17487 transparency: partialEvaluator.hasBlendModes(this.resources), 17488 pageIndex: this.pageIndex, 17489 intent 17490 }); 17491 return partialEvaluator.getOperatorList({ 17492 stream: contentStream, 17493 task, 17494 resources: this.resources, 17495 operatorList: opList 17496 }).then(function () { 17497 return opList; 17498 }); 17499 }); 17500 return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) { 17501 if (annotations.length === 0) { 17502 pageOpList.flush(true); 17503 return { 17504 length: pageOpList.totalLength 17505 }; 17506 } 17507 17508 const opListPromises = []; 17509 17510 for (const annotation of annotations) { 17511 if (isAnnotationRenderable(annotation, intent)) { 17512 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) { 17513 (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 17514 return null; 17515 })); 17516 } 17517 } 17518 17519 return Promise.all(opListPromises).then(function (opLists) { 17520 pageOpList.addOp(_util.OPS.beginAnnotations, []); 17521 17522 for (const opList of opLists) { 17523 pageOpList.addOpList(opList); 17524 } 17525 17526 pageOpList.addOp(_util.OPS.endAnnotations, []); 17527 pageOpList.flush(true); 17528 return { 17529 length: pageOpList.totalLength 17530 }; 17531 }); 17532 }); 17533 } 17534 17535 extractTextContent({ 17536 handler, 17537 task, 17538 normalizeWhitespace, 17539 sink, 17540 combineTextItems 17541 }) { 17542 const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream"); 17543 const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]); 17544 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 17545 return dataPromises.then(([contentStream]) => { 17546 const partialEvaluator = new _evaluator.PartialEvaluator({ 17547 xref: this.xref, 17548 handler, 17549 pageIndex: this.pageIndex, 17550 idFactory: this.idFactory, 17551 fontCache: this.fontCache, 17552 builtInCMapCache: this.builtInCMapCache, 17553 globalImageCache: this.globalImageCache, 17554 options: this.evaluatorOptions, 17555 pdfFunctionFactory: this.pdfFunctionFactory 17556 }); 17557 return partialEvaluator.getTextContent({ 17558 stream: contentStream, 17559 task, 17560 resources: this.resources, 17561 normalizeWhitespace, 17562 combineTextItems, 17563 sink 17564 }); 17565 }); 17566 } 17567 17568 getAnnotationsData(intent) { 17569 return this._parsedAnnotations.then(function (annotations) { 17570 const annotationsData = []; 17571 17572 for (let i = 0, ii = annotations.length; i < ii; i++) { 17573 if (!intent || isAnnotationRenderable(annotations[i], intent)) { 17574 annotationsData.push(annotations[i].data); 17575 } 17576 } 17577 17578 return annotationsData; 17579 }); 17580 } 17581 17582 get annotations() { 17583 return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []); 17584 } 17585 17586 get _parsedAnnotations() { 17587 const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => { 17588 const annotationPromises = []; 17589 17590 for (const annotationRef of this.annotations) { 17591 annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory).catch(function (reason) { 17592 (0, _util.warn)(`_parsedAnnotations: "${reason}".`); 17593 return null; 17594 })); 17595 } 17596 17597 return Promise.all(annotationPromises).then(function (annotations) { 17598 return annotations.filter(annotation => !!annotation); 17599 }); 17600 }); 17601 return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations); 17602 } 17603 17604} 17605 17606exports.Page = Page; 17607const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 17608const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 17609const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 17610const FINGERPRINT_FIRST_BYTES = 1024; 17611const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 17612const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/; 17613 17614function find(stream, signature, limit = 1024, backwards = false) { 17615 const signatureLength = signature.length; 17616 const scanBytes = stream.peekBytes(limit); 17617 const scanLength = scanBytes.length - signatureLength; 17618 17619 if (scanLength <= 0) { 17620 return false;
17621 } 17622 17623 if (backwards) { 17624 const signatureEnd = signatureLength - 1; 17625 let pos = scanBytes.length - 1; 17626 17627 while (pos >= signatureEnd) { 17628 let j = 0; 17629 17630 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 17631 j++; 17632 } 17633 17634 if (j >= signatureLength) { 17635 stream.pos += pos - signatureEnd; 17636 return true; 17637 } 17638 17639 pos--; 17640 } 17641 } else { 17642 let pos = 0; 17643 17644 while (pos <= scanLength) { 17645 let j = 0; 17646 17647 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 17648 j++; 17649 } 17650 17651 if (j >= signatureLength) { 17652 stream.pos += pos; 17653 return true; 17654 } 17655 17656 pos++; 17657 } 17658 } 17659 17660 return false; 17661} 17662 17663class PDFDocument { 17664 constructor(pdfManager, arg) { 17665 let stream; 17666 17667 if ((0, _primitives.isStream)(arg)) { 17668 stream = arg; 17669 } else if ((0, _util.isArrayBuffer)(arg)) { 17670 stream = new _stream.Stream(arg); 17671 } else { 17672 throw new Error("PDFDocument: Unknown argument type"); 17673 } 17674 17675 if (stream.length <= 0) { 17676 throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 17677 } 17678 17679 this.pdfManager = pdfManager; 17680 this.stream = stream; 17681 this.xref = new _obj.XRef(stream, pdfManager); 17682 this.pdfFunctionFactory = new _function.PDFFunctionFactory({ 17683 xref: this.xref, 17684 isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported 17685 }); 17686 this._pagePromises = []; 17687 } 17688 17689 parse(recoveryMode) { 17690 this.setup(recoveryMode); 17691 const version = this.catalog.catDict.get("Version"); 17692 17693 if ((0, _primitives.isName)(version)) { 17694 this.pdfFormatVersion = version.name; 17695 } 17696 17697 try { 17698 this.acroForm = this.catalog.catDict.get("AcroForm"); 17699 17700 if (this.acroForm) { 17701 this.xfa = this.acroForm.get("XFA"); 17702 const fields = this.acroForm.get("Fields"); 17703 17704 if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) { 17705 this.acroForm = null; 17706 } 17707 } 17708 } catch (ex) { 17709 if (ex instanceof _core_utils.MissingDataException) { 17710 throw ex; 17711 } 17712 17713 (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present"); 17714 this.acroForm = null; 17715 } 17716 17717 try { 17718 const collection = this.catalog.catDict.get("Collection"); 17719 17720 if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) { 17721 this.collection = collection; 17722 } 17723 } catch (ex) { 17724 if (ex instanceof _core_utils.MissingDataException) { 17725 throw ex; 17726 } 17727 17728 (0, _util.info)("Cannot fetch Collection dictionary."); 17729 } 17730 } 17731 17732 get linearization() { 17733 let linearization = null; 17734 17735 try { 17736 linearization = _parser.Linearization.create(this.stream); 17737 } catch (err) { 17738 if (err instanceof _core_utils.MissingDataException) { 17739 throw err; 17740 } 17741 17742 (0, _util.info)(err); 17743 } 17744 17745 return (0, _util.shadow)(this, "linearization", linearization); 17746 } 17747 17748 get startXRef() { 17749 const stream = this.stream; 17750 let startXRef = 0; 17751 17752 if (this.linearization) { 17753 stream.reset(); 17754 17755 if (find(stream, ENDOBJ_SIGNATURE)) { 17756 startXRef = stream.pos + 6 - stream.start; 17757 } 17758 } else { 17759 const step = 1024; 17760 const startXRefLength = STARTXREF_SIGNATURE.length; 17761 let found = false, 17762 pos = stream.end; 17763 17764 while (!found && pos > 0) { 17765 pos -= step - startXRefLength; 17766 17767 if (pos < 0) { 17768 pos = 0; 17769 } 17770 17771 stream.pos = pos; 17772 found = find(stream, STARTXREF_SIGNATURE, step, true); 17773 } 17774 17775 if (found) { 17776 stream.skip(9); 17777 let ch; 17778 17779 do { 17780 ch = stream.getByte(); 17781 } while ((0, _core_utils.isWhiteSpace)(ch)); 17782 17783 let str = ""; 17784 17785 while (ch >= 0x20 && ch <= 0x39) { 17786 str += String.fromCharCode(ch); 17787 ch = stream.getByte(); 17788 } 17789 17790 startXRef = parseInt(str, 10); 17791 17792 if (isNaN(startXRef)) { 17793 startXRef = 0; 17794 } 17795 } 17796 } 17797 17798 return (0, _util.shadow)(this, "startXRef", startXRef); 17799 } 17800 17801 checkHeader() { 17802 const stream = this.stream; 17803 stream.reset(); 17804 17805 if (!find(stream, PDF_HEADER_SIGNATURE)) { 17806 return; 17807 } 17808 17809 stream.moveStart(); 17810 const MAX_PDF_VERSION_LENGTH = 12; 17811 let version = "", 17812 ch; 17813 17814 while ((ch = stream.getByte()) > 0x20) { 17815 if (version.length >= MAX_PDF_VERSION_LENGTH) { 17816 break; 17817 } 17818 17819 version += String.fromCharCode(ch); 17820 } 17821 17822 if (!this.pdfFormatVersion) { 17823 this.pdfFormatVersion = version.substring(5); 17824 } 17825 } 17826 17827 parseStartXRef() { 17828 this.xref.setStartXRef(this.startXRef); 17829 } 17830 17831 setup(recoveryMode) { 17832 this.xref.parse(recoveryMode); 17833 this.catalog = new _obj.Catalog(this.pdfManager, this.xref); 17834 } 17835 17836 get numPages() { 17837 const linearization = this.linearization; 17838 const num = linearization ? linearization.numPages : this.catalog.numPages; 17839 return (0, _util.shadow)(this, "numPages", num); 17840 } 17841 17842 get documentInfo() { 17843 const DocumentInfoValidators = { 17844 Title: _util.isString, 17845 Author: _util.isString, 17846 Subject: _util.isString, 17847 Keywords: _util.isString, 17848 Creator: _util.isString, 17849 Producer: _util.isString, 17850 CreationDate: _util.isString, 17851 ModDate: _util.isString, 17852 Trapped: _primitives.isName 17853 }; 17854 let version = this.pdfFormatVersion; 17855 17856 if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) { 17857 (0, _util.warn)(`Invalid PDF header version number: ${version}`); 17858 version = null; 17859 } 17860 17861 const docInfo = { 17862 PDFFormatVersion: version, 17863 IsLinearized: !!this.linearization, 17864 IsAcroFormPresent: !!this.acroForm, 17865 IsXFAPresent: !!this.xfa, 17866 IsCollectionPresent: !!this.collection 17867 }; 17868 let infoDict; 17869 17870 try { 17871 infoDict = this.xref.trailer.get("Info"); 17872 } catch (err) { 17873 if (err instanceof _core_utils.MissingDataException) { 17874 throw err; 17875 } 17876 17877 (0, _util.info)("The document information dictionary is invali
17877d."); 17878 } 17879 17880 if ((0, _primitives.isDict)(infoDict)) { 17881 for (const key of infoDict.getKeys()) { 17882 const value = infoDict.get(key); 17883 17884 if (DocumentInfoValidators[key]) { 17885 if (DocumentInfoValidators[key](value)) { 17886 docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value); 17887 } else { 17888 (0, _util.info)(`Bad value in document info for "${key}".`); 17889 } 17890 } else if (typeof key === "string") { 17891 let customValue; 17892 17893 if ((0, _util.isString)(value)) { 17894 customValue = (0, _util.stringToPDFString)(value); 17895 } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) { 17896 customValue = value; 17897 } else { 17898 (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`); 17899 continue; 17900 } 17901 17902 if (!docInfo.Custom) { 17903 docInfo.Custom = Object.create(null); 17904 } 17905 17906 docInfo.Custom[key] = customValue; 17907 } 17908 } 17909 } 17910 17911 return (0, _util.shadow)(this, "documentInfo", docInfo); 17912 } 17913 17914 get fingerprint() { 17915 let hash; 17916 const idArray = this.xref.trailer.get("ID"); 17917 17918 if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) { 17919 hash = (0, _util.stringToBytes)(idArray[0]); 17920 } else { 17921 hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 17922 } 17923 17924 const fingerprintBuf = []; 17925 17926 for (let i = 0, ii = hash.length; i < ii; i++) { 17927 const hex = hash[i].toString(16); 17928 fingerprintBuf.push(hex.padStart(2, "0")); 17929 } 17930 17931 return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join("")); 17932 } 17933 17934 _getLinearizationPage(pageIndex) { 17935 const { 17936 catalog, 17937 linearization 17938 } = this; 17939 17940 const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); 17941 17942 return this.xref.fetchAsync(ref).then(obj => { 17943 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) { 17944 if (ref && !catalog.pageKidsCountCache.has(ref)) { 17945 catalog.pageKidsCountCache.put(ref, 1); 17946 } 17947 17948 return [obj, ref]; 17949 } 17950 17951 throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary."); 17952 }).catch(reason => { 17953 (0, _util.info)(reason); 17954 return catalog.getPageDict(pageIndex); 17955 }); 17956 } 17957 17958 getPage(pageIndex) { 17959 if (this._pagePromises[pageIndex] !== undefined) { 17960 return this._pagePromises[pageIndex]; 17961 } 17962 17963 const { 17964 catalog, 17965 linearization 17966 } = this; 17967 const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex); 17968 return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => { 17969 return new Page({ 17970 pdfManager: this.pdfManager, 17971 xref: this.xref, 17972 pageIndex, 17973 pageDict, 17974 ref, 17975 fontCache: catalog.fontCache, 17976 builtInCMapCache: catalog.builtInCMapCache, 17977 globalImageCache: catalog.globalImageCache, 17978 pdfFunctionFactory: this.pdfFunctionFactory 17979 }); 17980 }); 17981 } 17982 17983 checkFirstPage() { 17984 return this.getPage(0).catch(async reason => { 17985 if (reason instanceof _core_utils.XRefEntryException) { 17986 this._pagePromises.length = 0; 17987 await this.cleanup(); 17988 throw new _core_utils.XRefParseException(); 17989 } 17990 }); 17991 } 17992 17993 fontFallback(id, handler) { 17994 return this.catalog.fontFallback(id, handler); 17995 } 17996 17997 async cleanup(manuallyTriggered = false) { 17998 return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)(); 17999 } 18000 18001} 18002 18003exports.PDFDocument = PDFDocument; 18004 18005/***/ }), 18006/* 10 */ 18007/***/ (function(module, exports, __w_pdfjs_require__) { 18008 18009"use strict"; 18010 18011 18012Object.defineProperty(exports, "__esModule", { 18013 value: true 18014}); 18015exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0; 18016 18017var _util = __w_pdfjs_require__(2); 18018 18019var _primitives = __w_pdfjs_require__(5); 18020 18021var _parser = __w_pdfjs_require__(11); 18022 18023var _core_utils = __w_pdfjs_require__(8); 18024 18025var _crypto = __w_pdfjs_require__(22); 18026 18027var _colorspace = __w_pdfjs_require__(23); 18028 18029var _image_utils = __w_pdfjs_require__(24); 18030 18031function fetchDestination(dest) { 18032 return (0, _primitives.isDict)(dest) ? dest.get("D") : dest; 18033} 18034 18035class Catalog { 18036 constructor(pdfManager, xref) { 18037 this.pdfManager = pdfManager; 18038 this.xref = xref; 18039 this.catDict = xref.getCatalogObj(); 18040 18041 if (!(0, _primitives.isDict)(this.catDict)) { 18042 throw new _util.FormatError("Catalog object is not a dictionary."); 18043 } 18044 18045 this.fontCache = new _primitives.RefSetCache(); 18046 this.builtInCMapCache = new Map(); 18047 this.globalImageCache = new _image_utils.GlobalImageCache(); 18048 this.pageKidsCountCache = new _primitives.RefSetCache(); 18049 } 18050 18051 get metadata() { 18052 const streamRef = this.catDict.getRaw("Metadata"); 18053 18054 if (!(0, _primitives.isRef)(streamRef)) { 18055 return (0, _util.shadow)(this, "metadata", null); 18056 } 18057 18058 const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata); 18059 const stream = this.xref.fetch(streamRef, suppressEncryption); 18060 let metadata; 18061 18062 if (stream && (0, _primitives.isDict)(stream.dict)) { 18063 const type = stream.dict.get("Type"); 18064 const subtype = stream.dict.get("Subtype"); 18065 18066 if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) { 18067 try { 18068 metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes())); 18069 } catch (e) { 18070 if (e instanceof _core_utils.MissingDataException) { 18071 throw e; 18072 } 18073 18074 (0, _util.info)("Skipping invalid metadata."); 18075 } 18076 } 18077 } 18078 18079 return (0, _util.shadow)(this, "metadata", metadata); 18080 } 18081 18082 get toplevelPagesDict() { 18083 const pagesObj = this.catDict.get("Pages"); 18084 18085 if (!(0, _primitives.isDict)(pagesObj)) { 18086 throw new _util.FormatError("Invalid top-level pages dictionary."); 18087 } 18088 18089 return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj); 18090 } 18091 18092 get documentOutline() { 18093 let obj = null; 18094 18095 try { 18096 obj = this._readDocumentOutline(); 18097 } catch (ex) { 18098 if (ex instanceof _core_utils.MissingDataException) { 18099 throw ex; 18100 } 18101 18102 (0, _util.warn)("Unable to read document outline."); 18103 } 18104 18105 return (0, _util.shadow)(this, "documentOutline", obj); 18106 } 18107 18108 _readDocumentOutline() { 18109 let obj = this.catDict.get("Outlines"); 18110 18111 if (!(0, _primitives.isDict)(obj)) { 18112 return null; 18113 } 18114 18115 obj = obj.getRaw("First"); 18116 18117 if (!(0, _primitives.isRef)(obj)) { 18118 return null; 18119 } 18120 18121 const root = { 18122 items: [] 18123 }; 18124 const queue = [{ 18125 obj, 18126 parent: root 18127 }]; 18128 const processed = new _primitives.RefSet(); 18129 processed.put(obj); 18130 const xref = this.xref, 18131 blackColor = new Uint8ClampedArray(3); 18132 18133 while (queue.length > 0) { 18134 const i = queue.shift(); 18135 const outlineDict = xref.fetchIfRef(i.obj); 18136 18137 if (outlineDict === null) { 18138 continue; 18139 } 18140 18141 if (!outlineDict.has("Title")) { 18142 throw new _util.FormatError("Invalid outline item encountered."); 18143 } 18144 18145 const data = { 18146 url: null, 18147 dest: null 18148 }; 18149 Catalog.parseDestDictionary({ 18150 destDict: outlineDict, 18151 resultObj: data, 18152 docBaseUrl: this.pdfManager.docBaseUrl 18153 }); 18154 const title = outlineDict.get("Title"); 18155 const flags = outlineDict.get("F") || 0; 18156 const color = outlineDict.getArray("C"); 18157 const count = outlineDict.get("Count"); 18158 let rgbColor = blackColor; 18159 18160 if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 18161 rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); 18162 } 18163 18164 const outlineItem = { 18165 dest: data.dest, 18166 url: data.url, 18167 unsafeUrl: data.unsafeUrl, 18168 newWindow: data.newWindow, 18169 title: (0, _util.stringToPDFString)(title), 18170 color: rgbColor, 18171 count: Number.isInteger(count) ? count : undefined, 18172 bold: !!(flags & 2), 18173 italic: !!(flags & 1), 18174 items: [] 18175 }; 18176 i.parent.items.push(outlineItem); 18177 obj = outlineDict.getRaw("First"); 18178 18179 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 18180 queue.push({ 18181 obj, 18182 parent: outlineItem 18183 }); 18184 processed.put(obj); 18185 } 18186 18187 obj = outlineDict.getRaw("Next"); 18188 18189 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 18190 queue.push({ 18191 obj, 18192 parent: i.parent 18193 }); 18194 processed.put(obj); 18195 } 18196 } 18197 18198 return root.items.length > 0 ? root.items : null; 18199 } 18200 18201 get permissions() { 18202 let permissions = null; 18203 18204 try { 18205 permissions = this._readPermissions(); 18206 } catch (ex) { 18207 if (ex instanceof _core_utils.MissingDataException) { 18208 throw ex; 18209 } 18210 18211 (0, _util.warn)("Unable to read permissions."); 18212 } 18213 18214 return (0, _util.shadow)(this, "permissions", permissions); 18215 } 18216 18217 _readPermissions() { 18218 const encrypt = this.xref.trailer.get("Encrypt"); 18219 18220 if (!(0, _primitives.isDict)(encrypt)) { 18221 return null; 18222 } 18223 18224 let flags = encrypt.get("P"); 18225 18226 if (!(0, _util.isNum)(flags)) { 18227 return null; 18228 } 18229 18230 flags += 2 ** 32; 18231 const permissions = []; 18232 18233 for (const key in _util.PermissionFlag) { 18234 const value = _util.PermissionFlag[key]; 18235 18236 if (flags & value) { 18237 permissions.push(value); 18238 } 18239 } 18240 18241 return permissions; 18242 } 18243 18244 get numPages() { 18245 const obj = this.toplevelPagesDict.get("Count"); 18246 18247 if (!Number.isInteger(obj)) { 18248 throw new _util.FormatError("Page count in top-level pages dictionary is not an integer."); 18249 } 18250 18251 return (0, _util.shadow)(this, "numPages", obj); 18252 } 18253 18254 get destinations() { 18255 const obj = this._readDests(), 18256 dests = Object.create(null); 18257 18258 if (obj instanceof NameTree) { 18259 const names = obj.getAll(); 18260 18261 for (const name in names) { 18262 dests[name] = fetchDestination(names[name]); 18263 } 18264 } else if (obj instanceof _primitives.Dict) {
18265 obj.forEach(function (key, value) { 18266 if (value) { 18267 dests[key] = fetchDestination(value); 18268 } 18269 }); 18270 } 18271 18272 return (0, _util.shadow)(this, "destinations", dests); 18273 } 18274 18275 getDestination(destinationId) { 18276 const obj = this._readDests(); 18277 18278 if (obj instanceof NameTree || obj instanceof _primitives.Dict) { 18279 return fetchDestination(obj.get(destinationId) || null); 18280 } 18281 18282 return null; 18283 } 18284 18285 _readDests() { 18286 const obj = this.catDict.get("Names"); 18287 18288 if (obj && obj.has("Dests")) { 18289 return new NameTree(obj.getRaw("Dests"), this.xref); 18290 } else if (this.catDict.has("Dests")) { 18291 return this.catDict.get("Dests"); 18292 } 18293 18294 return undefined; 18295 } 18296 18297 get pageLabels() { 18298 let obj = null; 18299 18300 try { 18301 obj = this._readPageLabels(); 18302 } catch (ex) { 18303 if (ex instanceof _core_utils.MissingDataException) { 18304 throw ex; 18305 } 18306 18307 (0, _util.warn)("Unable to read page labels."); 18308 } 18309 18310 return (0, _util.shadow)(this, "pageLabels", obj); 18311 } 18312 18313 _readPageLabels() { 18314 const obj = this.catDict.getRaw("PageLabels"); 18315 18316 if (!obj) { 18317 return null; 18318 } 18319 18320 const pageLabels = new Array(this.numPages); 18321 let style = null, 18322 prefix = ""; 18323 const numberTree = new NumberTree(obj, this.xref); 18324 const nums = numberTree.getAll(); 18325 let currentLabel = "", 18326 currentIndex = 1; 18327 18328 for (let i = 0, ii = this.numPages; i < ii; i++) { 18329 if (i in nums) { 18330 const labelDict = nums[i]; 18331 18332 if (!(0, _primitives.isDict)(labelDict)) { 18333 throw new _util.FormatError("PageLabel is not a dictionary."); 18334 } 18335 18336 if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) { 18337 throw new _util.FormatError("Invalid type in PageLabel dictionary."); 18338 } 18339 18340 if (labelDict.has("S")) { 18341 const s = labelDict.get("S"); 18342 18343 if (!(0, _primitives.isName)(s)) { 18344 throw new _util.FormatError("Invalid style in PageLabel dictionary."); 18345 } 18346 18347 style = s.name; 18348 } else { 18349 style = null; 18350 } 18351 18352 if (labelDict.has("P")) { 18353 const p = labelDict.get("P"); 18354 18355 if (!(0, _util.isString)(p)) { 18356 throw new _util.FormatError("Invalid prefix in PageLabel dictionary."); 18357 } 18358 18359 prefix = (0, _util.stringToPDFString)(p); 18360 } else { 18361 prefix = ""; 18362 } 18363 18364 if (labelDict.has("St")) { 18365 const st = labelDict.get("St"); 18366 18367 if (!(Number.isInteger(st) && st >= 1)) { 18368 throw new _util.FormatError("Invalid start in PageLabel dictionary."); 18369 } 18370 18371 currentIndex = st; 18372 } else { 18373 currentIndex = 1; 18374 } 18375 } 18376 18377 switch (style) { 18378 case "D": 18379 currentLabel = currentIndex; 18380 break; 18381 18382 case "R": 18383 case "r": 18384 currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r"); 18385 break; 18386 18387 case "A": 18388 case "a": 18389 const LIMIT = 26; 18390 const A_UPPER_CASE = 0x41, 18391 A_LOWER_CASE = 0x61; 18392 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 18393 const letterIndex = currentIndex - 1; 18394 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 18395 const charBuf = []; 18396 18397 for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) { 18398 charBuf.push(character); 18399 } 18400 18401 currentLabel = charBuf.join(""); 18402 break; 18403 18404 default: 18405 if (style) { 18406 throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 18407 } 18408 18409 currentLabel = ""; 18410 } 18411 18412 pageLabels[i] = prefix + currentLabel; 18413 currentIndex++; 18414 } 18415 18416 return pageLabels; 18417 } 18418 18419 get pageLayout() { 18420 const obj = this.catDict.get("PageLayout"); 18421 let pageLayout = ""; 18422 18423 if ((0, _primitives.isName)(obj)) { 18424 switch (obj.name) { 18425 case "SinglePage": 18426 case "OneColumn": 18427 case "TwoColumnLeft": 18428 case "TwoColumnRight": 18429 case "TwoPageLeft": 18430 case "TwoPageRight": 18431 pageLayout = obj.name; 18432 } 18433 } 18434 18435 return (0, _util.shadow)(this, "pageLayout", pageLayout); 18436 } 18437 18438 get pageMode() { 18439 const obj = this.catDict.get("PageMode"); 18440 let pageMode = "UseNone"; 18441 18442 if ((0, _primitives.isName)(obj)) { 18443 switch (obj.name) { 18444 case "UseNone": 18445 case "UseOutlines": 18446 case "UseThumbs": 18447 case "FullScreen": 18448 case "UseOC": 18449 case "UseAttachments": 18450 pageMode = obj.name; 18451 } 18452 } 18453 18454 return (0, _util.shadow)(this, "pageMode", pageMode); 18455 } 18456 18457 get viewerPreferences() { 18458 const ViewerPreferencesValidators = { 18459 HideToolbar: _util.isBool, 18460 HideMenubar: _util.isBool, 18461 HideWindowUI: _util.isBool, 18462 FitWindow: _util.isBool, 18463 CenterWindow: _util.isBool, 18464 DisplayDocTitle: _util.isBool, 18465 NonFullScreenPageMode: _primitives.isName, 18466 Direction: _primitives.isName, 18467 ViewArea: _primitives.isName, 18468 ViewClip: _primitives.isName, 18469 PrintArea: _primitives.isName, 18470 PrintClip: _primitives.isName, 18471 PrintScaling: _primitives.isName, 18472 Duplex: _primitives.isName, 18473 PickTrayByPDFSize: _util.isBool, 18474 PrintPageRange: Array.isArray, 18475 NumCopies: Number.isInteger 18476 }; 18477 const obj = this.catDict.get("ViewerPreferences"); 18478 let prefs = null; 18479 18480 if ((0, _primitives.isDict)(obj)) { 18481 for (const key in ViewerPreferencesValidators) { 18482 if (!obj.has(key)) { 18483 continue; 18484 } 18485 18486 const value = obj.get(key); 18487 18488 if (!ViewerPreferencesValidators[key](value)) { 18489 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 18490 continue; 18491 } 18492 18493 let prefValue; 18494 18495 switch (key) { 18496 case "NonFullScreenPageMode": 18497 switch (value.name) { 18498 case "UseNone": 18499 case "UseOutlines": 18500 case "UseThumbs": 18501 case "UseOC": 18502 prefValue = value.name; 18503 break; 18504 18505 default: 18506 prefValue = "UseNone"; 18507 } 18508 18509 break; 18510 18511 case "Direction": 18512 switch (value.name) { 18513 case "L2R": 18514 case "R2L": 18515 prefValue = value.name; 18516 break; 18517 18518 default: 18519 prefValue = "L2R"; 18520 } 18521 18522 break; 18523 18524 case "ViewArea": 18525 case "ViewClip": 18526 case "PrintArea": 18527 case "PrintClip": 18528 switch (value.name) { 18529 case "MediaBox": 18530 case "CropBox": 18531 case "BleedBox": 18532 case "TrimBox": 18533 case "ArtBox": 18534 prefValue = value.name; 18535 break; 18536 18537 default: 18538 prefValue = "CropBox"; 18539 } 18540 18541 break; 18542 18543 case "PrintScaling": 18544 switch (value.name) { 18545 case "None": 18546 case "AppDefault": 18547 prefValue = value.name; 18548 break; 18549 18550 default: 18551 prefValue = "AppDefault"; 18552 } 18553 18554 break; 18555 18556 case "Duplex": 18557 switch (value.name) { 18558 case "Simplex": 18559 case "DuplexFlipShortEdge": 18560 case "DuplexFlipLongEdge": 18561 prefValue = value.name; 18562 break; 18563 18564 default: 18565 prefValue = "None"; 18566 } 18567 18568 break; 18569 18570 case "PrintPageRange": 18571 const length = value.length; 18572 18573 if (length % 2 !== 0) { 18574 break; 18575 } 18576 18577 const isValid = value.every((page, i, arr) => { 18578 return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages; 18579 }); 18580 18581 if (isValid) { 18582 prefValue = value; 18583 } 18584 18585 break; 18586 18587 case "NumCopies": 18588 if (value > 0) { 18589 prefValue = value; 18590 } 18591 18592 break; 18593 18594 default: 18595 if (typeof value !== "boolean") { 18596 throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`); 18597 } 18598 18599 prefValue = value; 18600 } 18601 18602 if (prefValue !== undefined) { 18603 if (!prefs) { 18604 prefs = Object.create(null); 18605 } 18606 18607 prefs[key] = prefValue; 18608 } else { 18609 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 18610 } 18611 } 18612 } 18613 18614 return (0, _util.shadow)(this, "viewerPreferences", prefs); 18615 } 18616 18617 get openAction() { 18618 const obj = this.catDict.get("OpenAction"); 18619 let openAction = null; 18620 18621 if ((0, _primitives.isDict)(obj)) { 18622 const destDict = new _primitives.Dict(this.xref); 18623 destDict.set("A", obj); 18624 const resultObj = { 18625 url: null, 18626 dest: null, 18627 action: null 18628 }; 18629 Catalog.parseDestDictionary({ 18630 destDict, 18631 resultObj 18632 }); 18633 18634 if (Array.isArray(resultObj.dest)) { 18635 if (!openAction) { 18636 openAction = Object.create(null); 18637 } 18638 18639 openAction.dest = resultObj.dest; 18640 } else if (resultObj.action) { 18641 if (!openAction) { 18642 openAction = Object.create(null); 18643 } 18644 18645 openAction.action = resultObj.action; 18646 } 18647 } else if (Array.isArray(obj)) { 18648 if (!openAction) { 18649 openAction = Object.create(null); 18650 } 18651 18652 openAction.dest = obj; 18653 } 18654 18655 return (0, _util.shadow)(this, "openAction", openAction); 18656 } 18657 18658 get attachments() { 18659 const obj = this.catDict.get("Names"); 18660 let attachments = null; 18661 18662 if (obj && obj.has("EmbeddedFiles")) {
18663 const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 18664 const names = nameTree.getAll(); 18665 18666 for (const name in names) { 18667 const fs = new FileSpec(names[name], this.xref); 18668 18669 if (!attachments) { 18670 attachments = Object.create(null); 18671 } 18672 18673 attachments[(0, _util.stringToPDFString)(name)] = fs.serializable; 18674 } 18675 } 18676 18677 return (0, _util.shadow)(this, "attachments", attachments); 18678 } 18679 18680 get javaScript() { 18681 const obj = this.catDict.get("Names"); 18682 let javaScript = null; 18683 18684 function appendIfJavaScriptDict(jsDict) { 18685 const type = jsDict.get("S"); 18686 18687 if (!(0, _primitives.isName)(type, "JavaScript")) { 18688 return; 18689 } 18690 18691 let js = jsDict.get("JS"); 18692 18693 if ((0, _primitives.isStream)(js)) { 18694 js = (0, _util.bytesToString)(js.getBytes()); 18695 } else if (!(0, _util.isString)(js)) { 18696 return; 18697 } 18698 18699 if (!javaScript) { 18700 javaScript = []; 18701 } 18702 18703 javaScript.push((0, _util.stringToPDFString)(js)); 18704 } 18705 18706 if (obj && obj.has("JavaScript")) { 18707 const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref); 18708 const names = nameTree.getAll(); 18709 18710 for (const name in names) { 18711 const jsDict = names[name]; 18712 18713 if ((0, _primitives.isDict)(jsDict)) { 18714 appendIfJavaScriptDict(jsDict); 18715 } 18716 } 18717 } 18718 18719 const openAction = this.catDict.get("OpenAction"); 18720 18721 if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) { 18722 appendIfJavaScriptDict(openAction); 18723 } 18724 18725 return (0, _util.shadow)(this, "javaScript", javaScript); 18726 } 18727 18728 fontFallback(id, handler) { 18729 const promises = []; 18730 this.fontCache.forEach(function (promise) { 18731 promises.push(promise); 18732 }); 18733 return Promise.all(promises).then(translatedFonts => { 18734 for (const translatedFont of translatedFonts) { 18735 if (translatedFont.loadedName === id) { 18736 translatedFont.fallback(handler); 18737 return; 18738 } 18739 } 18740 }); 18741 } 18742 18743 cleanup(manuallyTriggered = false) { 18744 (0, _primitives.clearPrimitiveCaches)(); 18745 this.globalImageCache.clear(manuallyTriggered); 18746 this.pageKidsCountCache.clear(); 18747 const promises = []; 18748 this.fontCache.forEach(function (promise) { 18749 promises.push(promise); 18750 }); 18751 return Promise.all(promises).then(translatedFonts => { 18752 for (const { 18753 dict 18754 } of translatedFonts) { 18755 delete dict.translated; 18756 } 18757 18758 this.fontCache.clear(); 18759 this.builtInCMapCache.clear(); 18760 }); 18761 } 18762 18763 getPageDict(pageIndex) { 18764 const capability = (0, _util.createPromiseCapability)(); 18765 const nodesToVisit = [this.catDict.getRaw("Pages")]; 18766 const visitedNodes = new _primitives.RefSet(); 18767 const xref = this.xref, 18768 pageKidsCountCache = this.pageKidsCountCache; 18769 let count, 18770 currentPageIndex = 0; 18771 18772 function next() { 18773 while (nodesToVisit.length) { 18774 const currentNode = nodesToVisit.pop(); 18775 18776 if ((0, _primitives.isRef)(currentNode)) { 18777 count = pageKidsCountCache.get(currentNode); 18778 18779 if (count > 0 && currentPageIndex + count < pageIndex) { 18780 currentPageIndex += count; 18781 continue; 18782 } 18783 18784 if (visitedNodes.has(currentNode)) { 18785 capability.reject(new _util.FormatError("Pages tree contains circular reference.")); 18786 return; 18787 } 18788 18789 visitedNodes.put(currentNode); 18790 xref.fetchAsync(currentNode).then(function (obj) { 18791 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) { 18792 if (pageIndex === currentPageIndex) { 18793 if (currentNode && !pageKidsCountCache.has(currentNode)) { 18794 pageKidsCountCache.put(currentNode, 1); 18795 } 18796 18797 capability.resolve([obj, currentNode]); 18798 } else { 18799 currentPageIndex++; 18800 next(); 18801 } 18802 18803 return; 18804 } 18805 18806 nodesToVisit.push(obj); 18807 next(); 18808 }, capability.reject); 18809 return; 18810 } 18811 18812 if (!(0, _primitives.isDict)(currentNode)) { 18813 capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 18814 return; 18815 } 18816 18817 count = currentNode.get("Count"); 18818 18819 if (Number.isInteger(count) && count >= 0) { 18820 const objId = currentNode.objId; 18821
18822 if (objId && !pageKidsCountCache.has(objId)) { 18823 pageKidsCountCache.put(objId, count); 18824 } 18825 18826 if (currentPageIndex + count <= pageIndex) { 18827 currentPageIndex += count; 18828 continue; 18829 } 18830 } 18831 18832 const kids = currentNode.get("Kids"); 18833 18834 if (!Array.isArray(kids)) { 18835 if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) { 18836 if (currentPageIndex === pageIndex) { 18837 capability.resolve([currentNode, null]); 18838 return; 18839 } 18840 18841 currentPageIndex++; 18842 continue; 18843 } 18844 18845 capability.reject(new _util.FormatError("Page dictionary kids object is not an array.")); 18846 return; 18847 } 18848 18849 for (let last = kids.length - 1; last >= 0; last--) { 18850 nodesToVisit.push(kids[last]); 18851 } 18852 } 18853 18854 capability.reject(new Error(`Page index ${pageIndex} not found.`)); 18855 } 18856 18857 next(); 18858 return capability.promise; 18859 } 18860 18861 getPageIndex(pageRef) { 18862 const xref = this.xref; 18863 18864 function pagesBeforeRef(kidRef) { 18865 let total = 0, 18866 parentRef; 18867 return xref.fetchAsync(kidRef).then(function (node) { 18868 if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) { 18869 throw new _util.FormatError("The reference does not point to a /Page dictionary."); 18870 } 18871 18872 if (!node) { 18873 return null; 18874 } 18875 18876 if (!(0, _primitives.isDict)(node)) { 18877 throw new _util.FormatError("Node must be a dictionary."); 18878 } 18879 18880 parentRef = node.getRaw("Parent"); 18881 return node.getAsync("Parent"); 18882 }).then(function (parent) { 18883 if (!parent) { 18884 return null; 18885 } 18886 18887 if (!(0, _primitives.isDict)(parent)) { 18888 throw new _util.FormatError("Parent must be a dictionary."); 18889 } 18890 18891 return parent.getAsync("Kids"); 18892 }).then(function (kids) { 18893 if (!kids) { 18894 return null; 18895 } 18896 18897 const kidPromises = []; 18898 let found = false; 18899 18900 for (let i = 0, ii = kids.length; i < ii; i++) { 18901 const kid = kids[i]; 18902 18903 if (!(0, _primitives.isRef)(kid)) { 18904 throw new _util.FormatError("Kid must be a reference."); 18905 } 18906 18907 if ((0, _primitives.isRefsEqual)(kid, kidRef)) { 18908 found = true; 18909 break; 18910 } 18911 18912 kidPromises.push(xref.fetchAsync(kid).then(function (obj) { 18913 if (!(0, _primitives.isDict)(obj)) { 18914 throw new _util.FormatError("Kid node must be a dictionary."); 18915 } 18916 18917 if (obj.has("Count")) { 18918 total += obj.get("Count"); 18919 } else { 18920 total++; 18921 } 18922 })); 18923 } 18924 18925 if (!found) { 18926 throw new _util.FormatError("Kid reference not found in parent's kids."); 18927 } 18928 18929 return Promise.all(kidPromises).then(function () { 18930 return [total, parentRef]; 18931 }); 18932 }); 18933 } 18934 18935 let total = 0; 18936 18937 function next(ref) { 18938 return pagesBeforeRef(ref).then(function (args) { 18939 if (!args) { 18940 return total; 18941 } 18942 18943 const [count, parentRef] = args; 18944 total += count; 18945 return next(parentRef); 18946 }); 18947 } 18948 18949 return next(pageRef); 18950 } 18951 18952 static parseDestDictionary(params) { 18953 function addDefaultProtocolToUrl(url) { 18954 return url.startsWith("www.") ? `http://${url}` : url; 18955 } 18956 18957 function tryConvertUrlEncoding(url) { 18958 try { 18959 return (0, _util.stringToUTF8String)(url); 18960 } catch (e) { 18961 return url; 18962 } 18963 } 18964 18965 const destDict = params.destDict; 18966 18967 if (!(0, _primitives.isDict)(destDict)) { 18968 (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary."); 18969 return; 18970 } 18971 18972 const resultObj = params.resultObj; 18973 18974 if (typeof resultObj !== "object") { 18975 (0, _util.warn)("parseDestDictionary: `resultObj` must be an object."); 18976 return; 18977 } 18978 18979 const docBaseUrl = params.docBaseUrl || null; 18980 let action = destDict.get("A"), 18981 url, 18982 dest; 18983 18984 if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) { 18985 action = destDict.get("Dest"); 18986 } 18987 18988 if ((0, _primitives.isDict)(action)) { 18989 const actionType = action.get("S"); 18990 18991 if (!(0, _primitives.isName)(actionType)) { 18992 (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary."); 18993 return; 18994 } 18995
18996 const actionName = actionType.name; 18997 18998 switch (actionName) { 18999 case "URI": 19000 url = action.get("URI"); 19001 19002 if ((0, _primitives.isName)(url)) { 19003 url = "/" + url.name; 19004 } else if ((0, _util.isString)(url)) { 19005 url = addDefaultProtocolToUrl(url); 19006 } 19007 19008 break; 19009 19010 case "GoTo": 19011 dest = action.get("D"); 19012 break; 19013 19014 case "Launch": 19015 case "GoToR": 19016 const urlDict = action.get("F"); 19017 19018 if ((0, _primitives.isDict)(urlDict)) { 19019 url = urlDict.get("F") || null; 19020 } else if ((0, _util.isString)(urlDict)) { 19021 url = urlDict; 19022 } 19023 19024 let remoteDest = action.get("D"); 19025 19026 if (remoteDest) { 19027 if ((0, _primitives.isName)(remoteDest)) { 19028 remoteDest = remoteDest.name; 19029 } 19030 19031 if ((0, _util.isString)(url)) { 19032 const baseUrl = url.split("#")[0]; 19033 19034 if ((0, _util.isString)(remoteDest)) { 19035 url = baseUrl + "#" + remoteDest; 19036 } else if (Array.isArray(remoteDest)) { 19037 url = baseUrl + "#" + JSON.stringify(remoteDest); 19038 } 19039 } 19040 } 19041 19042 const newWindow = action.get("NewWindow"); 19043 19044 if ((0, _util.isBool)(newWindow)) { 19045 resultObj.newWindow = newWindow; 19046 } 19047 19048 break; 19049 19050 case "Named": 19051 const namedAction = action.get("N"); 19052 19053 if ((0, _primitives.isName)(namedAction)) { 19054 resultObj.action = namedAction.name; 19055 } 19056 19057 break; 19058 19059 case "JavaScript": 19060 const jsAction = action.get("JS"); 19061 let js; 19062 19063 if ((0, _primitives.isStream)(jsAction)) { 19064 js = (0, _util.bytesToString)(jsAction.getBytes()); 19065 } else if ((0, _util.isString)(jsAction)) { 19066 js = jsAction; 19067 } 19068 19069 if (js) { 19070 const URL_OPEN_METHODS = ["app.launchURL", "window.open"]; 19071 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 19072 const jsUrl = regex.exec((0, _util.stringToPDFString)(js)); 19073 19074 if (jsUrl && jsUrl[2]) { 19075 url = jsUrl[2]; 19076 19077 if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") { 19078 resultObj.newWindow = true; 19079 } 19080 19081 break; 19082 } 19083 } 19084 19085 default: 19086 (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`); 19087 break; 19088 } 19089 } else if (destDict.has("Dest")) { 19090 dest = destDict.get("Dest"); 19091 } 19092 19093 if ((0, _util.isString)(url)) { 19094 url = tryConvertUrlEncoding(url); 19095 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl); 19096 19097 if (absoluteUrl) { 19098 resultObj.url = absoluteUrl.href; 19099 } 19100 19101 resultObj.unsafeUrl = url; 19102 } 19103 19104 if (dest) { 19105 if ((0, _primitives.isName)(dest)) { 19106 dest = dest.name; 19107 } 19108 19109 if ((0, _util.isString)(dest) || Array.isArray(dest)) { 19110 resultObj.dest = dest; 19111 } 19112 } 19113 } 19114 19115} 19116 19117exports.Catalog = Catalog; 19118 19119var XRef = function XRefClosure() { 19120 function XRef(stream, pdfManager) { 19121 this.stream = stream; 19122 this.pdfManager = pdfManager; 19123 this.entries = []; 19124 this.xrefstms = Object.create(null); 19125 this._cacheMap = new Map(); 19126 this.stats = { 19127 streamTypes: Object.create(null), 19128 fontTypes: Object.create(null) 19129 }; 19130 } 19131 19132 XRef.prototype = { 19133 setStartXRef: function XRef_setStartXRef(startXRef) { 19134 this.startXRefQueue = [startXRef]; 19135 }, 19136 parse: function XRef_parse(recoveryMode) { 19137 var trailerDict; 19138 19139 if (!recoveryMode) { 19140 trailerDict = this.readXRef(); 19141 } else { 19142 (0, _util.warn)("Indexing all PDF objects"); 19143 trailerDict = this.indexObjects(); 19144 } 19145 19146 trailerDict.assignXref(this); 19147 this.trailer = trailerDict; 19148 let encrypt; 19149 19150 try { 19151 encrypt = trailerDict.get("Encrypt"); 19152 } catch (ex) { 19153 if (ex instanceof _core_utils.MissingDataException) { 19154 throw ex; 19155 } 19156 19157 (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 19158 } 19159 19160 if ((0, _primitives.isDict)(encrypt)) { 19161 var ids = trailerDict.get("ID"); 19162 var fileId = ids && ids.length ? ids[0] : ""; 19163 encrypt.suppressEncryption = true; 19164 this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 19165 } 19166 19167 let root; 19168
19169 try { 19170 root = trailerDict.get("Root"); 19171 } catch (ex) { 19172 if (ex instanceof _core_utils.MissingDataException) { 19173 throw ex; 19174 } 19175 19176 (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`); 19177 } 19178 19179 if ((0, _primitives.isDict)(root) && root.has("Pages")) { 19180 this.root = root; 19181 } else { 19182 if (!recoveryMode) { 19183 throw new _core_utils.XRefParseException(); 19184 } 19185 19186 throw new _util.FormatError("Invalid root reference"); 19187 } 19188 }, 19189 processXRefTable: function XRef_processXRefTable(parser) { 19190 if (!("tableState" in this)) { 19191 this.tableState = { 19192 entryNum: 0, 19193 streamPos: parser.lexer.stream.pos, 19194 parserBuf1: parser.buf1, 19195 parserBuf2: parser.buf2 19196 }; 19197 } 19198 19199 var obj = this.readXRefTable(parser); 19200 19201 if (!(0, _primitives.isCmd)(obj, "trailer")) { 19202 throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary"); 19203 } 19204 19205 var dict = parser.getObj(); 19206 19207 if (!(0, _primitives.isDict)(dict) && dict.dict) { 19208 dict = dict.dict; 19209 } 19210 19211 if (!(0, _primitives.isDict)(dict)) { 19212 throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary"); 19213 } 19214 19215 delete this.tableState; 19216 return dict; 19217 }, 19218 readXRefTable: function XRef_readXRefTable(parser) { 19219 var stream = parser.lexer.stream; 19220 var tableState = this.tableState; 19221 stream.pos = tableState.streamPos; 19222 parser.buf1 = tableState.parserBuf1; 19223 parser.buf2 = tableState.parserBuf2; 19224 var obj; 19225 19226 while (true) { 19227 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 19228 if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) { 19229 break; 19230 } 19231 19232 tableState.firstEntryNum = obj; 19233 tableState.entryCount = parser.getObj(); 19234 } 19235 19236 var first = tableState.firstEntryNum; 19237 var count = tableState.entryCount; 19238 19239 if (!Number.isInteger(first) || !Number.isInteger(count)) { 19240 throw new _util.FormatError("Invalid XRef table: wrong types in subsection header"); 19241 } 19242 19243 for (var i = tableState.entryNum; i < count; i++) { 19244 tableState.streamPos = stream.pos; 19245 tableState.entryNum = i; 19246 tableState.parserBuf1 = parser.buf1; 19247 tableState.parserBuf2 = parser.buf2; 19248 var entry = {}; 19249 entry.offset = parser.getObj(); 19250 entry.gen = parser.getObj(); 19251 var type = parser.getObj(); 19252 19253 if (type instanceof _primitives.Cmd) { 19254 switch (type.cmd) { 19255 case "f": 19256 entry.free = true; 19257 break; 19258 19259 case "n": 19260 entry.uncompressed = true; 19261 break; 19262 } 19263 } 19264 19265 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 19266 throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 19267 } 19268 19269 if (i === 0 && entry.free && first === 1) { 19270 first = 0; 19271 } 19272 19273 if (!this.entries[i + first]) { 19274 this.entries[i + first] = entry; 19275 } 19276 } 19277 19278 tableState.entryNum = 0; 19279 tableState.streamPos = stream.pos; 19280 tableState.parserBuf1 = parser.buf1; 19281 tableState.parserBuf2 = parser.buf2; 19282 delete tableState.firstEntryNum; 19283 delete tableState.entryCount; 19284 } 19285 19286 if (this.entries[0] && !this.entries[0].free) { 19287 throw new _util.FormatError("Invalid XRef table: unexpected first object"); 19288 } 19289 19290 return obj; 19291 }, 19292 processXRefStream: function XRef_processXRefStream(stream) { 19293 if (!("streamState" in this)) { 19294 var streamParameters = stream.dict; 19295 var byteWidths = streamParameters.get("W"); 19296 var range = streamParameters.get("Index"); 19297 19298 if (!range) { 19299 range = [0, streamParameters.get("Size")]; 19300 } 19301 19302 this.streamState = { 19303 entryRanges: range, 19304 byteWidths, 19305 entryNum: 0, 19306 streamPos: stream.pos 19307 }; 19308 } 19309 19310 this.readXRefStream(stream); 19311 delete this.streamState; 19312 return stream.dict; 19313 }, 19314 readXRefStream: function XRef_readXRefStream(stream) { 19315 var i, j; 19316 var streamState = this.streamState; 19317 stream.pos = streamState.streamPos;
19318 var byteWidths = streamState.byteWidths; 19319 var typeFieldWidth = byteWidths[0]; 19320 var offsetFieldWidth = byteWidths[1]; 19321 var generationFieldWidth = byteWidths[2]; 19322 var entryRanges = streamState.entryRanges; 19323 19324 while (entryRanges.length > 0) { 19325 var first = entryRanges[0]; 19326 var n = entryRanges[1]; 19327 19328 if (!Number.isInteger(first) || !Number.isInteger(n)) { 19329 throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`); 19330 } 19331 19332 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 19333 throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 19334 } 19335 19336 for (i = streamState.entryNum; i < n; ++i) { 19337 streamState.entryNum = i; 19338 streamState.streamPos = stream.pos; 19339 var type = 0, 19340 offset = 0, 19341 generation = 0; 19342 19343 for (j = 0; j < typeFieldWidth; ++j) { 19344 type = type << 8 | stream.getByte(); 19345 } 19346 19347 if (typeFieldWidth === 0) { 19348 type = 1; 19349 } 19350 19351 for (j = 0; j < offsetFieldWidth; ++j) { 19352 offset = offset << 8 | stream.getByte(); 19353 } 19354 19355 for (j = 0; j < generationFieldWidth; ++j) { 19356 generation = generation << 8 | stream.getByte(); 19357 } 19358 19359 var entry = {}; 19360 entry.offset = offset; 19361 entry.gen = generation; 19362 19363 switch (type) { 19364 case 0: 19365 entry.free = true; 19366 break; 19367 19368 case 1: 19369 entry.uncompressed = true; 19370 break; 19371 19372 case 2: 19373 break; 19374 19375 default: 19376 throw new _util.FormatError(`Invalid XRef entry type: ${type}`); 19377 } 19378 19379 if (!this.entries[first + i]) { 19380 this.entries[first + i] = entry; 19381 } 19382 } 19383 19384 streamState.entryNum = 0; 19385 streamState.streamPos = stream.pos; 19386 entryRanges.splice(0, 2); 19387 } 19388 }, 19389 indexObjects: function XRef_indexObjects() { 19390 var TAB = 0x9, 19391 LF = 0xa, 19392 CR = 0xd, 19393 SPACE = 0x20; 19394 var PERCENT = 0x25, 19395 LT = 0x3c; 19396 19397 function readToken(data, offset) { 19398 var token = "", 19399 ch = data[offset]; 19400 19401 while (ch !== LF && ch !== CR && ch !== LT) { 19402 if (++offset >= data.length) { 19403 break; 19404 } 19405 19406 token += String.fromCharCode(ch); 19407 ch = data[offset]; 19408 } 19409 19410 return token; 19411 } 19412 19413 function skipUntil(data, offset, what) { 19414 var length = what.length, 19415 dataLength = data.length; 19416 var skipped = 0; 19417 19418 while (offset < dataLength) { 19419 var i = 0; 19420 19421 while (i < length && data[offset + i] === what[i]) { 19422 ++i; 19423 } 19424 19425 if (i >= length) { 19426 break; 19427 } 19428 19429 offset++; 19430 skipped++; 19431 } 19432 19433 return skipped; 19434 } 19435 19436 var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 19437 const endobjRegExp = /\bendobj[\b\s]$/; 19438 const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/; 19439 const CHECK_CONTENT_LENGTH = 25; 19440 var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 19441 var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 19442 const objBytes = new Uint8Array([111, 98, 106]); 19443 var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 19444 this.entries.length = 0; 19445 var stream = this.stream; 19446 stream.pos = 0; 19447 var buffer = stream.getBytes(); 19448 var position = stream.start, 19449 length = buffer.length; 19450 var trailers = [], 19451 xrefStms = []; 19452 19453 while (position < length) { 19454 var ch = buffer[position]; 19455 19456 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 19457 ++position; 19458 continue; 19459 } 19460 19461 if (ch === PERCENT) { 19462 do { 19463 ++position; 19464 19465 if (position >= length) { 19466 break; 19467 } 19468 19469 ch = buffer[position]; 19470 } while (ch !== LF && ch !== CR); 19471 19472 continue; 19473 } 19474 19475 var token = readToken(buffer, position); 19476 var m; 19477 19478 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 19479 position += skipUntil(buffer, position, trailerBytes); 19480 trailers.push(position); 19481 position += skipUntil(buffer, position, startxrefBytes); 19482 } else if (m = objRegExp.exec(token)) { 19483 const num = m[1] | 0, 19484 gen = m[2] | 0; 19485 19486 if (!this.entries[num] || this.entries[num].gen === gen) { 19487 this.entries[num] = { 19488 offset: position - stream.start, 19489 gen, 19490 uncompressed: true 19491 }; 19492 } 19493 19494 let contentLength, 19495 startPos = position + token.length; 19496 19497 while (startPos < buffer.length) {
19498 const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4; 19499 contentLength = endPos - position; 19500 const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos); 19501 const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos)); 19502 19503 if (endobjRegExp.test(tokenStr)) { 19504 break; 19505 } else { 19506 const objToken = nestedObjRegExp.exec(tokenStr); 19507 19508 if (objToken && objToken[1]) { 19509 (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.'); 19510 contentLength -= objToken[1].length; 19511 break; 19512 } 19513 } 19514 19515 startPos = endPos; 19516 } 19517 19518 const content = buffer.subarray(position, position + contentLength); 19519 var xrefTagOffset = skipUntil(content, 0, xrefBytes); 19520 19521 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 19522 xrefStms.push(position - stream.start); 19523 this.xrefstms[position - stream.start] = 1; 19524 } 19525 19526 position += contentLength; 19527 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 19528 trailers.push(position); 19529 position += skipUntil(buffer, position, startxrefBytes); 19530 } else { 19531 position += token.length + 1; 19532 } 19533 } 19534 19535 var i, ii; 19536 19537 for (i = 0, ii = xrefStms.length; i < ii; ++i) { 19538 this.startXRefQueue.push(xrefStms[i]); 19539 this.readXRef(true); 19540 } 19541 19542 let trailerDict; 19543 19544 for (i = 0, ii = trailers.length; i < ii; ++i) { 19545 stream.pos = trailers[i]; 19546 const parser = new _parser.Parser({ 19547 lexer: new _parser.Lexer(stream), 19548 xref: this, 19549 allowStreams: true, 19550 recoveryMode: true 19551 }); 19552 var obj = parser.getObj(); 19553 19554 if (!(0, _primitives.isCmd)(obj, "trailer")) { 19555 continue; 19556 } 19557 19558 const dict = parser.getObj(); 19559 19560 if (!(0, _primitives.isDict)(dict)) { 19561 continue; 19562 } 19563 19564 let rootDict; 19565 19566 try { 19567 rootDict = dict.get("Root"); 19568 } catch (ex) { 19569 if (ex instanceof _core_utils.MissingDataException) { 19570 throw ex; 19571 } 19572 19573 continue; 19574 } 19575 19576 if (!(0, _primitives.isDict)(rootDict) || !rootDict.has("Pages")) { 19577 continue; 19578 } 19579 19580 if (dict.has("ID")) { 19581 return dict; 19582 } 19583 19584 trailerDict = dict; 19585 } 19586 19587 if (trailerDict) { 19588 return trailerDict; 19589 } 19590 19591 throw new _util.InvalidPDFException("Invalid PDF structure."); 19592 }, 19593 readXRef: function XRef_readXRef(recoveryMode) { 19594 var stream = this.stream; 19595 const startXRefParsedCache = Object.create(null); 19596 19597 try { 19598 while (this.startXRefQueue.length) { 19599 var startXRef = this.startXRefQueue[0]; 19600 19601 if (startXRefParsedCache[startXRef]) { 19602 (0, _util.warn)("readXRef - skipping XRef table since it was already parsed."); 19603 this.startXRefQueue.shift(); 19604 continue; 19605 } 19606 19607 startXRefParsedCache[startXRef] = true; 19608 stream.pos = startXRef + stream.start; 19609 const parser = new _parser.Parser({ 19610 lexer: new _parser.Lexer(stream), 19611 xref: this, 19612 allowStreams: true 19613 }); 19614 var obj = parser.getObj(); 19615 var dict; 19616 19617 if ((0, _primitives.isCmd)(obj, "xref")) { 19618 dict = this.processXRefTable(parser); 19619 19620 if (!this.topDict) { 19621 this.topDict = dict; 19622 } 19623 19624 obj = dict.get("XRefStm"); 19625 19626 if (Number.isInteger(obj)) { 19627 var pos = obj; 19628 19629 if (!(pos in this.xrefstms)) { 19630 this.xrefstms[pos] = 1; 19631 this.startXRefQueue.push(pos); 19632 } 19633 } 19634 } else if (Number.isInteger(obj)) { 19635 if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) { 19636 throw new _util.FormatError("Invalid XRef stream"); 19637 } 19638 19639 dict = this.processXRefStream(obj); 19640 19641 if (!this.topDict) { 19642 this.topDict = dict; 19643 } 19644 19645 if (!dict) { 19646 throw new _util.FormatError("Failed to read XRef stream"); 19647 } 19648 } else { 19649 throw new _util.FormatError("Invalid XRef stream header"); 19650 } 19651 19652 obj = dict.get("Prev"); 19653 19654 if (Number.isInteger(obj)) { 19655 this.startXRefQueue.push(obj); 19656 } else if ((0, _primitives.isRef)(obj)) { 19657 this.startXRefQueue.push(obj.num); 19658 } 19659 19660 this.startXRefQueue.shift(); 19661 } 19662 19663 return this.topDict; 19664 } catch (e) { 19665 if (e instanceof _core_utils.MissingDataException) { 19666 throw e; 19667 } 19668 19669 (0, _util.info)("(while reading XRef): " + e); 19670 } 19671 19672 if (recoveryMode) { 19673 return undefined; 19674 } 19675 19676 throw new _core_utils.XRefParseException(); 19677 }, 19678 getEntry: function XRef_getEntry(i) { 19679 var xrefEntry = this.entries[i]; 19680 19681 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 19682 return xrefEntry; 19683 } 19684 19685 return null; 19686 }, 19687 fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) { 19688 if (obj instanceof _primitives.Ref) { 19689 return this.fetch(obj, suppressEncryption); 19690 } 19691 19692 return obj; 19693 }, 19694 fetch: function XRef_fetch(ref, suppressEncryption) { 19695 if (!(ref instanceof _primitives.Ref)) { 19696 throw new Error("ref object is not a reference"); 19697 } 19698 19699 const num = ref.num; 19700 19701 const cacheEntry = this._cacheMap.get(num); 19702 19703 if (cacheEntry !== undefined) { 19704 if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { 19705 cacheEntry.objId = ref.toString(); 19706 } 19707 19708 return cacheEntry; 19709 } 19710 19711 let xrefEntry = this.getEntry(num); 19712 19713 if (xrefEntry === null) { 19714 this._cacheMap.set(num, xrefEntry); 19715 19716 return xrefEntry; 19717 } 19718 19719 if (xrefEntry.uncompressed) { 19720 xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); 19721 } else { 19722 xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption); 19723 } 19724 19725 if ((0, _primitives.isDict)(xrefEntry)) { 19726 xrefEntry.objId = ref.toString(); 19727 } else if ((0, _primitives.isStream)(xrefEntry)) { 19728 xrefEntry.dict.objId = ref.toString(); 19729 } 19730 19731 return xrefEntry; 19732 }, 19733 19734 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 19735 var gen = ref.gen; 19736 var num = ref.num; 19737 19738 if (xrefEntry.gen !== gen) { 19739 throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`); 19740 } 19741 19742 var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 19743 const parser = new _parser.Parser({ 19744 lexer: new _parser.Lexer(stream), 19745 xref: this, 19746 allowStreams: true 19747 }); 19748 var obj1 = parser.getObj(); 19749 var obj2 = parser.getObj(); 19750 var obj3 = parser.getObj(); 19751 19752 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { 19753 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 19754 } 19755 19756 if (obj3.cmd !== "obj") { 19757 if (obj3.cmd.startsWith("obj")) { 19758 num = parseInt(obj3.cmd.substring(3), 10); 19759 19760 if (!Number.isNaN(num)) { 19761 return num; 19762 } 19763 } 19764 19765 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 19766 } 19767 19768 if (this.encrypt && !suppressEncryption) { 19769 xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); 19770 } else { 19771 xrefEntry = parser.getObj(); 19772 } 19773 19774 if (!(0, _primitives.isStream)(xrefEntry)) { 19775 this._cacheMap.set(num, xrefEntry); 19776 } 19777 19778 return xrefEntry; 19779 }, 19780 19781 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 19782 const tableOffset = xrefEntry.offset; 19783 const stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); 19784 19785 if (!(0, _primitives.isStream)(stream)) { 19786 throw new _util.FormatError("bad ObjStm stream"); 19787 } 19788 19789 const first = stream.dict.get("First"); 19790 const n = stream.dict.get("N"); 19791 19792 if (!Number.isInteger(first) || !Number.isInteger(n)) { 19793 throw new _util.FormatError("invalid first and n parameters for ObjStm stream"); 19794 } 19795 19796 const parser = new _parser.Parser({ 19797 lexer: new _parser.Lexer(stream), 19798 xref: this, 19799 allowStreams: true 19800 }); 19801 const nums = new Array(n); 19802 19803 for (let i = 0; i < n; ++i) { 19804 const num = parser.getObj(); 19805 19806 if (!Number.isInteger(num)) { 19807 throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`); 19808 } 19809 19810 const offset = parser.getObj(); 19811 19812 if (!Number.isInteger(offset)) { 19813 throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 19814 } 19815 19816 nums[i] = num; 19817 } 19818 19819 const entries = new Array(n); 19820 19821 for (let i = 0; i < n; ++i) { 19822 const obj = parser.getObj();
19823 entries[i] = obj; 19824 19825 if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") { 19826 parser.shift(); 19827 } 19828 19829 if ((0, _primitives.isStream)(obj)) { 19830 continue; 19831 } 19832 19833 const num = nums[i], 19834 entry = this.entries[num]; 19835 19836 if (entry && entry.offset === tableOffset && entry.gen === i) { 19837 this._cacheMap.set(num, obj); 19838 } 19839 } 19840 19841 xrefEntry = entries[xrefEntry.gen]; 19842 19843 if (xrefEntry === undefined) { 19844 throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 19845 } 19846 19847 return xrefEntry; 19848 }, 19849 19850 async fetchIfRefAsync(obj, suppressEncryption) { 19851 if (obj instanceof _primitives.Ref) { 19852 return this.fetchAsync(obj, suppressEncryption); 19853 } 19854 19855 return obj; 19856 }, 19857 19858 async fetchAsync(ref, suppressEncryption) { 19859 try { 19860 return this.fetch(ref, suppressEncryption); 19861 } catch (ex) { 19862 if (!(ex instanceof _core_utils.MissingDataException)) { 19863 throw ex; 19864 } 19865 19866 await this.pdfManager.requestRange(ex.begin, ex.end); 19867 return this.fetchAsync(ref, suppressEncryption); 19868 } 19869 }, 19870 19871 getCatalogObj: function XRef_getCatalogObj() { 19872 return this.root; 19873 } 19874 }; 19875 return XRef; 19876}(); 19877 19878exports.XRef = XRef; 19879 19880class NameOrNumberTree { 19881 constructor(root, xref, type) { 19882 if (this.constructor === NameOrNumberTree) { 19883 (0, _util.unreachable)("Cannot initialize NameOrNumberTree."); 19884 } 19885 19886 this.root = root; 19887 this.xref = xref; 19888 this._type = type; 19889 } 19890 19891 getAll() { 19892 const dict = Object.create(null); 19893 19894 if (!this.root) { 19895 return dict; 19896 } 19897 19898 const xref = this.xref; 19899 const processed = new _primitives.RefSet(); 19900 processed.put(this.root); 19901 const queue = [this.root]; 19902 19903 while (queue.length > 0) { 19904 const obj = xref.fetchIfRef(queue.shift()); 19905 19906 if (!(0, _primitives.isDict)(obj)) { 19907 continue; 19908 } 19909 19910 if (obj.has("Kids")) { 19911 const kids = obj.get("Kids"); 19912 19913 for (let i = 0, ii = kids.length; i < ii; i++) { 19914 const kid = kids[i]; 19915 19916 if (processed.has(kid)) { 19917 throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`); 19918 } 19919 19920 queue.push(kid); 19921 processed.put(kid); 19922 } 19923 19924 continue; 19925 } 19926 19927 const entries = obj.get(this._type); 19928 19929 if (Array.isArray(entries)) { 19930 for (let i = 0, ii = entries.length; i < ii; i += 2) { 19931 dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]); 19932 } 19933 } 19934 } 19935 19936 return dict; 19937 } 19938 19939 get(key) { 19940 if (!this.root) { 19941 return null; 19942 } 19943 19944 const xref = this.xref; 19945 let kidsOrEntries = xref.fetchIfRef(this.root); 19946 let loopCount = 0; 19947 const MAX_LEVELS = 10; 19948 19949 while (kidsOrEntries.has("Kids")) { 19950 if (++loopCount > MAX_LEVELS) { 19951 (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`); 19952 return null; 19953 } 19954 19955 const kids = kidsOrEntries.get("Kids"); 19956 19957 if (!Array.isArray(kids)) { 19958 return null; 19959 } 19960 19961 let l = 0, 19962 r = kids.length - 1; 19963 19964 while (l <= r) { 19965 const m = l + r >> 1; 19966 const kid = xref.fetchIfRef(kids[m]); 19967 const limits = kid.get("Limits"); 19968 19969 if (key < xref.fetchIfRef(limits[0])) { 19970 r = m - 1; 19971 } else if (key > xref.fetchIfRef(limits[1])) { 19972 l = m + 1; 19973 } else { 19974 kidsOrEntries = xref.fetchIfRef(kids[m]); 19975 break; 19976 } 19977 } 19978 19979 if (l > r) { 19980 return null; 19981 } 19982 } 19983 19984 const entries = kidsOrEntries.get(this._type); 19985 19986 if (Array.isArray(entries)) { 19987 let l = 0, 19988 r = entries.length - 2; 19989 19990 while (l <= r) { 19991 const tmp = l + r >> 1, 19992 m = tmp + (tmp & 1); 19993 const currentKey = xref.fetchIfRef(entries[m]); 19994 19995 if (key < currentKey) { 19996 r = m - 2; 19997 } else if (key > currentKey) { 19998 l = m + 2; 19999 } else { 20000 return xref.fetchIfRef(entries[m + 1]); 20001 } 20002 } 20003 20004 (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`); 20005 20006 for (let m = 0, mm = entries.length; m < mm; m += 2) { 20007 const currentKey = xref.fetchIfRef(entries[m]); 20008 20009 if (currentKey === key) { 20010 (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`); 20011 return xref.fetchIfRef(entries[m + 1]); 20012 } 20013 } 20014 } 20015 20016 return null; 20017 } 20018 20019} 20020 20021class NameTree extends NameOrNumberTree { 20022 constructor(root, xref) { 20023 super(root, xref, "Names"); 20024 } 20025 20026} 20027 20028class NumberTree extends NameOrNumberTree { 20029 constructor(root, xref) { 20030 super(root, xref, "Nums"); 20031 } 20032 20033} 20034 20035var FileSpec = function FileSpecClosure() { 20036 function FileSpec(root, xref) { 20037 if (!root || !(0, _primitives.isDict)(root)) { 20038 return; 20039 } 20040 20041 this.xref = xref; 20042 this.root = root; 20043 20044 if (root.has("FS")) { 20045 this.fs = root.get("FS"); 20046 } 20047 20048 this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : ""; 20049 20050 if (root.has("RF")) { 20051 (0, _util.warn)("Related file specifications are not supported"); 20052 } 20053 20054 this.contentAvailable = true; 20055 20056 if (!root.has("EF")) { 20057 this.contentAvailable = false;
20058 (0, _util.warn)("Non-embedded file specifications are not supported"); 20059 } 20060 } 20061 20062 function pickPlatformItem(dict) { 20063 if (dict.has("UF")) { 20064 return dict.get("UF"); 20065 } else if (dict.has("F")) { 20066 return dict.get("F"); 20067 } else if (dict.has("Unix")) { 20068 return dict.get("Unix"); 20069 } else if (dict.has("Mac")) { 20070 return dict.get("Mac"); 20071 } else if (dict.has("DOS")) { 20072 return dict.get("DOS"); 20073 } 20074 20075 return null; 20076 } 20077 20078 FileSpec.prototype = { 20079 get filename() { 20080 if (!this._filename && this.root) { 20081 var filename = pickPlatformItem(this.root) || "unnamed"; 20082 this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/"); 20083 } 20084 20085 return this._filename; 20086 }, 20087 20088 get content() { 20089 if (!this.contentAvailable) { 20090 return null; 20091 } 20092 20093 if (!this.contentRef && this.root) { 20094 this.contentRef = pickPlatformItem(this.root.get("EF")); 20095 } 20096 20097 var content = null; 20098 20099 if (this.contentRef) { 20100 var xref = this.xref; 20101 var fileObj = xref.fetchIfRef(this.contentRef); 20102 20103 if (fileObj && (0, _primitives.isStream)(fileObj)) { 20104 content = fileObj.getBytes(); 20105 } else { 20106 (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content"); 20107 } 20108 } else { 20109 (0, _util.warn)("Embedded file specification does not have a content"); 20110 } 20111 20112 return content; 20113 }, 20114 20115 get serializable() { 20116 return { 20117 filename: this.filename, 20118 content: this.content 20119 }; 20120 } 20121 20122 }; 20123 return FileSpec; 20124}(); 20125 20126exports.FileSpec = FileSpec; 20127 20128const ObjectLoader = function () { 20129 function mayHaveChildren(value) { 20130 return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value); 20131 } 20132 20133 function addChildren(node, nodesToVisit) { 20134 if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) { 20135 const dict = node instanceof _primitives.Dict ? node : node.dict; 20136 const dictKeys = dict.getKeys(); 20137 20138 for (let i = 0, ii = dictKeys.length; i < ii; i++) { 20139 const rawValue = dict.getRaw(dictKeys[i]); 20140 20141 if (mayHaveChildren(rawValue)) { 20142 nodesToVisit.push(rawValue); 20143 } 20144 } 20145 } else if (Array.isArray(node)) { 20146 for (let i = 0, ii = node.length; i < ii; i++) { 20147 const value = node[i]; 20148 20149 if (mayHaveChildren(value)) { 20150 nodesToVisit.push(value); 20151 } 20152 } 20153 } 20154 } 20155 20156 function ObjectLoader(dict, keys, xref) { 20157 this.dict = dict; 20158 this.keys = keys; 20159 this.xref = xref; 20160 this.refSet = null; 20161 } 20162 20163 ObjectLoader.prototype = { 20164 async load() { 20165 if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) { 20166 return undefined; 20167 } 20168 20169 const { 20170 keys, 20171 dict 20172 } = this; 20173 this.refSet = new _primitives.RefSet(); 20174 const nodesToVisit = []; 20175 20176 for (let i = 0, ii = keys.length; i < ii; i++) { 20177 const rawValue = dict.getRaw(keys[i]); 20178 20179 if (rawValue !== undefined) { 20180 nodesToVisit.push(rawValue); 20181 } 20182 } 20183 20184 return this._walk(nodesToVisit); 20185 }, 20186 20187 async _walk(nodesToVisit) { 20188 const nodesToRevisit = []; 20189 const pendingRequests = []; 20190 20191 while (nodesToVisit.length) { 20192 let currentNode = nodesToVisit.pop(); 20193 20194 if (currentNode instanceof _primitives.Ref) { 20195 if (this.refSet.has(currentNode)) { 20196 continue; 20197 } 20198 20199 try { 20200 this.refSet.put(currentNode); 20201 currentNode = this.xref.fetch(currentNode); 20202 } catch (ex) { 20203 if (!(ex instanceof _core_utils.MissingDataException)) { 20204 throw ex; 20205 } 20206 20207 nodesToRevisit.push(currentNode); 20208 pendingRequests.push({ 20209 begin: ex.begin, 20210 end: ex.end 20211 }); 20212 } 20213 } 20214 20215 if (currentNode && currentNode.getBaseStreams) { 20216 const baseStreams = currentNode.getBaseStreams(); 20217 let foundMissingData = false;
20218 20219 for (let i = 0, ii = baseStreams.length; i < ii; i++) { 20220 const stream = baseStreams[i]; 20221 20222 if (stream.allChunksLoaded && !stream.allChunksLoaded()) { 20223 foundMissingData = true; 20224 pendingRequests.push({ 20225 begin: stream.start, 20226 end: stream.end 20227 }); 20228 } 20229 } 20230 20231 if (foundMissingData) { 20232 nodesToRevisit.push(currentNode); 20233 } 20234 } 20235 20236 addChildren(currentNode, nodesToVisit); 20237 } 20238 20239 if (pendingRequests.length) { 20240 await this.xref.stream.manager.requestRanges(pendingRequests); 20241 20242 for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) { 20243 const node = nodesToRevisit[i]; 20244 20245 if (node instanceof _primitives.Ref) { 20246 this.refSet.remove(node); 20247 } 20248 } 20249 20250 return this._walk(nodesToRevisit); 20251 } 20252 20253 this.refSet = null; 20254 return undefined; 20255 } 20256 20257 }; 20258 return ObjectLoader; 20259}(); 20260 20261exports.ObjectLoader = ObjectLoader; 20262 20263/***/ }), 20264/* 11 */ 20265/***/ (function(module, exports, __w_pdfjs_require__) { 20266 20267"use strict"; 20268 20269 20270Object.defineProperty(exports, "__esModule", { 20271 value: true 20272}); 20273exports.Parser = exports.Linearization = exports.Lexer = void 0; 20274 20275var _stream = __w_pdfjs_require__(12); 20276 20277var _util = __w_pdfjs_require__(2); 20278 20279var _primitives = __w_pdfjs_require__(5); 20280 20281var _core_utils = __w_pdfjs_require__(8); 20282 20283var _ccitt_stream = __w_pdfjs_require__(13); 20284 20285var _jbig2_stream = __w_pdfjs_require__(15); 20286 20287var _jpeg_stream = __w_pdfjs_require__(18); 20288 20289var _jpx_stream = __w_pdfjs_require__(20); 20290 20291const MAX_LENGTH_TO_CACHE = 1000; 20292const MAX_ADLER32_LENGTH = 5552; 20293 20294function computeAdler32(bytes) { 20295 const bytesLength = bytes.length; 20296 let a = 1, 20297 b = 0; 20298 20299 for (let i = 0; i < bytesLength; ++i) { 20300 a += bytes[i] & 0xff; 20301 b += a; 20302 } 20303 20304 return b % 65521 << 16 | a % 65521; 20305} 20306 20307class Parser { 20308 constructor({ 20309 lexer, 20310 xref, 20311 allowStreams = false, 20312 recoveryMode = false 20313 }) { 20314 this.lexer = lexer; 20315 this.xref = xref; 20316 this.allowStreams = allowStreams; 20317 this.recoveryMode = recoveryMode; 20318 this.imageCache = Object.create(null); 20319 this.refill(); 20320 } 20321 20322 refill() { 20323 this.buf1 = this.lexer.getObj(); 20324 this.buf2 = this.lexer.getObj(); 20325 } 20326 20327 shift() { 20328 if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") { 20329 this.buf1 = this.buf2; 20330 this.buf2 = null; 20331 } else { 20332 this.buf1 = this.buf2; 20333 this.buf2 = this.lexer.getObj(); 20334 } 20335 } 20336 20337 tryShift() { 20338 try { 20339 this.shift(); 20340 return true; 20341 } catch (e) { 20342 if (e instanceof _core_utils.MissingDataException) { 20343 throw e; 20344 } 20345 20346 return false; 20347 } 20348 } 20349 20350 getObj(cipherTransform = null) { 20351 const buf1 = this.buf1; 20352 this.shift(); 20353 20354 if (buf1 instanceof _primitives.Cmd) { 20355 switch (buf1.cmd) { 20356 case "BI": 20357 return this.makeInlineImage(cipherTransform); 20358 20359 case "[": 20360 const array = []; 20361 20362 while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) { 20363 array.push(this.getObj(cipherTransform)); 20364 } 20365 20366 if ((0, _primitives.isEOF)(this.buf1)) { 20367 if (!this.recoveryMode) { 20368 throw new _util.FormatError("End of file inside array"); 20369 } 20370 20371 return array; 20372 } 20373 20374 this.shift(); 20375 return array; 20376 20377 case "<<": 20378 const dict = new _primitives.Dict(this.xref); 20379 20380 while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) { 20381 if (!(0, _primitives.isName)(this.buf1)) { 20382 (0, _util.info)("Malformed dictionary: key must be a name object"); 20383 this.shift(); 20384 continue; 20385 } 20386 20387 const key = this.buf1.name; 20388 this.shift(); 20389 20390 if ((0, _primitives.isEOF)(this.buf1)) { 20391 break; 20392 } 20393 20394 dict.set(key, this.getObj(cipherTransform)); 20395 } 20396 20397 if ((0, _primitives.isEOF)(this.buf1)) { 20398 if (!this.recoveryMode) { 20399 throw new _util.FormatError("End of file inside dictionary"); 20400 } 20401 20402 return dict; 20403 } 20404 20405 if ((0, _primitives.isCmd)(this.buf2, "stream")) { 20406 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 20407 } 20408 20409 this.shift(); 20410 return dict; 20411 20412 default: 20413 return buf1; 20414 } 20415 } 20416 20417 if (Number.isInteger(buf1)) { 20418 if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) { 20419 const ref = _primitives.Ref.get(buf1, this.buf1); 20420 20421 this.shift(); 20422 this.shift(); 20423 return ref; 20424 } 20425 20426 return buf1; 20427 } 20428 20429 if (typeof buf1 === "string") { 20430 if (cipherTransform) { 20431 return cipherTransform.decryptString(buf1); 20432 } 20433 20434 return buf1; 20435 } 20436 20437 return buf1; 20438 } 20439 20440 findDefaultInlineStreamEnd(stream) { 20441 const E = 0x45, 20442 I = 0x49, 20443 SPACE = 0x20, 20444 LF = 0xa, 20445 CR = 0xd; 20446 const n = 10, 20447 NUL = 0x0; 20448 const startPos = stream.pos; 20449 let state = 0, 20450 ch, 20451 maybeEIPos; 20452 20453 while ((ch = stream.getByte()) !== -1) { 20454 if (state === 0) { 20455 state = ch === E ? 1 : 0; 20456 } else if (state === 1) { 20457 state = ch === I ? 2 : 0; 20458 } else { 20459 (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state."); 20460 20461 if (ch === SPACE || ch === LF || ch === CR) { 20462 maybeEIPos = stream.pos; 20463 const followingBytes = stream.peekBytes(n); 20464 20465 for (let i = 0, ii = followingBytes.length; i < ii; i++) { 20466 ch = followingBytes[i]; 20467 20468 if (ch === NUL && followingBytes[i + 1] !== NUL) { 20469 continue; 20470 } 20471 20472 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 20473 state = 0; 20474 break; 20475 } 20476 } 20477 20478 if (state === 2) { 20479 break; 20480 } 20481 } else { 20482 state = 0; 20483 } 20484 } 20485 } 20486 20487 if (ch === -1) { 20488 (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 20489 20490 if (maybeEIPos) {
20491 (0, _util.warn)('... trying to recover by using the last "EI" occurrence.'); 20492 stream.skip(-(stream.pos - maybeEIPos)); 20493 } 20494 } 20495 20496 let endOffset = 4; 20497 stream.skip(-endOffset); 20498 ch = stream.peekByte(); 20499 stream.skip(endOffset); 20500 20501 if (!(0, _core_utils.isWhiteSpace)(ch)) { 20502 endOffset--; 20503 } 20504 20505 return stream.pos - endOffset - startPos; 20506 } 20507 20508 findDCTDecodeInlineStreamEnd(stream) { 20509 const startPos = stream.pos; 20510 let foundEOI = false, 20511 b, 20512 markerLength; 20513 20514 while ((b = stream.getByte()) !== -1) { 20515 if (b !== 0xff) { 20516 continue; 20517 } 20518 20519 switch (stream.getByte()) { 20520 case 0x00: 20521 break; 20522 20523 case 0xff: 20524 stream.skip(-1); 20525 break; 20526 20527 case 0xd9: 20528 foundEOI = true; 20529 break; 20530 20531 case 0xc0: 20532 case 0xc1: 20533 case 0xc2: 20534 case 0xc3: 20535 case 0xc5: 20536 case 0xc6: 20537 case 0xc7: 20538 case 0xc9: 20539 case 0xca: 20540 case 0xcb: 20541 case 0xcd: 20542 case 0xce: 20543 case 0xcf: 20544 case 0xc4: 20545 case 0xcc: 20546 case 0xda: 20547 case 0xdb: 20548 case 0xdc: 20549 case 0xdd: 20550 case 0xde: 20551 case 0xdf: 20552 case 0xe0: 20553 case 0xe1: 20554 case 0xe2: 20555 case 0xe3: 20556 case 0xe4: 20557 case 0xe5: 20558 case 0xe6: 20559 case 0xe7: 20560 case 0xe8: 20561 case 0xe9: 20562 case 0xea: 20563 case 0xeb: 20564 case 0xec: 20565 case 0xed: 20566 case 0xee: 20567 case 0xef: 20568 case 0xfe: 20569 markerLength = stream.getUint16(); 20570 20571 if (markerLength > 2) { 20572 stream.skip(markerLength - 2); 20573 } else { 20574 stream.skip(-2); 20575 } 20576 20577 break; 20578 } 20579 20580 if (foundEOI) { 20581 break; 20582 } 20583 } 20584 20585 const length = stream.pos - startPos; 20586 20587 if (b === -1) { 20588 (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 20589 stream.skip(-length); 20590 return this.findDefaultInlineStreamEnd(stream); 20591 } 20592 20593 this.inlineStreamSkipEI(stream); 20594 return length; 20595 } 20596 20597 findASCII85DecodeInlineStreamEnd(stream) { 20598 const TILDE = 0x7e, 20599 GT = 0x3e; 20600 const startPos = stream.pos; 20601 let ch; 20602 20603 while ((ch = stream.getByte()) !== -1) { 20604 if (ch === TILDE) { 20605 const tildePos = stream.pos; 20606 ch = stream.peekByte(); 20607 20608 while ((0, _core_utils.isWhiteSpace)(ch)) { 20609 stream.skip(); 20610 ch = stream.peekByte(); 20611 } 20612 20613 if (ch === GT) { 20614 stream.skip(); 20615 break; 20616 } 20617 20618 if (stream.pos > tildePos) { 20619 const maybeEI = stream.peekBytes(2); 20620 20621 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 20622 break; 20623 } 20624 } 20625 } 20626 } 20627 20628 const length = stream.pos - startPos; 20629 20630 if (ch === -1) { 20631 (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 20632 stream.skip(-length); 20633 return this.findDefaultInlineStreamEnd(stream); 20634 } 20635 20636 this.inlineStreamSkipEI(stream); 20637 return length; 20638 } 20639 20640 findASCIIHexDecodeInlineStreamEnd(stream) { 20641 const GT = 0x3e; 20642 const startPos = stream.pos; 20643 let ch; 20644 20645 while ((ch = stream.getByte()) !== -1) { 20646 if (ch === GT) { 20647 break; 20648 } 20649 } 20650 20651 const length = stream.pos - startPos; 20652 20653 if (ch === -1) { 20654 (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 20655 stream.skip(-length); 20656 return this.findDefaultInlineStreamEnd(stream); 20657 } 20658 20659 this.inlineStreamSkipEI(stream); 20660 return length; 20661 } 20662 20663 inlineStreamSkipEI(stream) { 20664 const E = 0x45, 20665 I = 0x49; 20666 let state = 0, 20667 ch; 20668 20669 while ((ch = stream.getByte()) !== -1) { 20670 if (state === 0) { 20671 state = ch === E ? 1 : 0; 20672 } else if (state === 1) { 20673 state = ch === I ? 2 : 0; 20674 } else if (state === 2) { 20675 break; 20676 } 20677 } 20678 } 20679 20680 makeInlineImage(cipherTransform) { 20681 const lexer = this.lexer; 20682 const stream = lexer.stream; 20683 const dict = new _primitives.Dict(this.xref); 20684 let dictLength; 20685 20686 while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) { 20687 if (!(0, _primitives.isName)(this.buf1)) { 20688 throw new _util.FormatError("Dictionary key must be a name object"); 20689 } 20690
20691 const key = this.buf1.name; 20692 this.shift(); 20693 20694 if ((0, _primitives.isEOF)(this.buf1)) { 20695 break; 20696 } 20697 20698 dict.set(key, this.getObj(cipherTransform)); 20699 } 20700 20701 if (lexer.beginInlineImagePos !== -1) { 20702 dictLength = stream.pos - lexer.beginInlineImagePos; 20703 } 20704 20705 const filter = dict.get("Filter", "F"); 20706 let filterName; 20707 20708 if ((0, _primitives.isName)(filter)) { 20709 filterName = filter.name; 20710 } else if (Array.isArray(filter)) { 20711 const filterZero = this.xref.fetchIfRef(filter[0]); 20712 20713 if ((0, _primitives.isName)(filterZero)) { 20714 filterName = filterZero.name; 20715 } 20716 } 20717 20718 const startPos = stream.pos; 20719 let length; 20720 20721 if (filterName === "DCTDecode" || filterName === "DCT") { 20722 length = this.findDCTDecodeInlineStreamEnd(stream); 20723 } else if (filterName === "ASCII85Decode" || filterName === "A85") { 20724 length = this.findASCII85DecodeInlineStreamEnd(stream); 20725 } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") { 20726 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 20727 } else { 20728 length = this.findDefaultInlineStreamEnd(stream); 20729 } 20730 20731 let imageStream = stream.makeSubStream(startPos, length, dict); 20732 let cacheKey; 20733 20734 if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) { 20735 const imageBytes = imageStream.getBytes(); 20736 imageStream.reset(); 20737 const initialStreamPos = stream.pos; 20738 stream.pos = lexer.beginInlineImagePos; 20739 const dictBytes = stream.getBytes(dictLength); 20740 stream.pos = initialStreamPos; 20741 cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes); 20742 const cacheEntry = this.imageCache[cacheKey]; 20743 20744 if (cacheEntry !== undefined) { 20745 this.buf2 = _primitives.Cmd.get("EI"); 20746 this.shift(); 20747 cacheEntry.reset(); 20748 return cacheEntry; 20749 } 20750 } 20751 20752 if (cipherTransform) { 20753 imageStream = cipherTransform.createStream(imageStream, length); 20754 } 20755 20756 imageStream = this.filter(imageStream, dict, length); 20757 imageStream.dict = dict; 20758 20759 if (cacheKey !== undefined) { 20760 imageStream.cacheKey = `inline_${length}_${cacheKey}`; 20761 this.imageCache[cacheKey] = imageStream; 20762 } 20763 20764 this.buf2 = _primitives.Cmd.get("EI"); 20765 this.shift(); 20766 return imageStream; 20767 } 20768 20769 _findStreamLength(startPos, signature) { 20770 const { 20771 stream 20772 } = this.lexer; 20773 stream.pos = startPos; 20774 const SCAN_BLOCK_LENGTH = 2048; 20775 const signatureLength = signature.length; 20776 20777 while (stream.pos < stream.end) { 20778 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 20779 const scanLength = scanBytes.length - signatureLength; 20780 20781 if (scanLength <= 0) { 20782 break; 20783 } 20784 20785 let pos = 0; 20786 20787 while (pos < scanLength) { 20788 let j = 0; 20789 20790 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 20791 j++; 20792 } 20793 20794 if (j >= signatureLength) { 20795 stream.pos += pos; 20796 return stream.pos - startPos; 20797 } 20798 20799 pos++; 20800 } 20801 20802 stream.pos += scanLength; 20803 } 20804 20805 return -1; 20806 } 20807 20808 makeStream(dict, cipherTransform) { 20809 const lexer = this.lexer; 20810 let stream = lexer.stream; 20811 lexer.skipToNextLine(); 20812 const startPos = stream.pos - 1; 20813 let length = dict.get("Length"); 20814 20815 if (!Number.isInteger(length)) { 20816 (0, _util.info)(`Bad length "${length}" in stream`); 20817 length = 0; 20818 } 20819 20820 stream.pos = startPos + length; 20821 lexer.nextChar(); 20822 20823 if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) { 20824 this.shift(); 20825 } else { 20826 const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]); 20827 20828 let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE); 20829 20830 if (actualLength < 0) { 20831 const MAX_TRUNCATION = 1; 20832 20833 for (let i = 1; i <= MAX_TRUNCATION; i++) { 20834 const end = ENDSTREAM_SIGNATURE.length - i; 20835 const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end); 20836 20837 const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE); 20838 20839 if (maybeLength >= 0) { 20840 const lastByte = stream.peekBytes(end + 1)[end]; 20841 20842 if (!(0, _core_utils.isWhiteSpace)(lastByte)) { 20843 break; 20844 } 20845 20846 (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command."); 20847 actualLength = maybeLength; 20848 break; 20849 } 20850 } 20851 20852 if (actualLength < 0) { 20853 throw new _util.FormatError("Missing endstream command."); 20854 } 20855 } 20856 20857 length = actualLength; 20858 lexer.nextChar(); 20859 this.shift(); 20860 this.shift(); 20861 } 20862 20863 this.shift(); 20864 stream = stream.makeSubStream(startPos, length, dict); 20865 20866 if (cipherTransform) { 20867 stream = cipherTransform.createStream(stream, length); 20868 } 20869 20870 stream = this.filter(stream, dict, length); 20871 stream.dict = dict; 20872 return stream; 20873 } 20874 20875 filter(stream, dict, length) { 20876 let filter = dict.get("Filter", "F"); 20877 let params = dict.get("DecodeParms", "DP"); 20878 20879 if ((0, _primitives.isName)(filter)) { 20880 if (Array.isArray(params)) { 20881 (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name."); 20882 } 20883 20884 return this.makeFilter(stream, filter.name, length, params); 20885 } 20886 20887 let maybeLength = length; 20888 20889 if (Array.isArray(filter)) { 20890 const filterArray = filter; 20891 const paramsArray = params; 20892 20893 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 20894 filter = this.xref.fetchIfRef(filterArray[i]); 20895 20896 if (!(0, _primitives.isName)(filter)) { 20897 throw new _util.FormatError(`Bad filter name "${filter}"`); 20898 } 20899 20900 params = null; 20901 20902 if (Array.isArray(paramsArray) && i in paramsArray) { 20903 params = this.xref.fetchIfRef(paramsArray[i]); 20904 } 20905 20906 stream = this.makeFilter(stream, filter.name, maybeLength, params); 20907 maybeLength = null; 20908 } 20909 } 20910 20911 return stream; 20912 } 20913 20914 makeFilter(stream, name, maybeLength, params) { 20915 if (maybeLength === 0) { 20916 (0, _util.warn)(`Empty "${name}" stream.`); 20917 return new _stream.NullStream(); 20918 } 20919 20920 try { 20921 const xrefStreamStats = this.xref.stats.streamTypes; 20922 20923 if (name === "FlateDecode" || name === "Fl") { 20924 xrefStreamStats[_util.StreamType.FLATE] = true; 20925 20926 if (params) { 20927 return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params); 20928 } 20929 20930 return new _stream.FlateStream(stream, maybeLength); 20931 } 20932 20933 if (name === "LZWDecode" || name === "LZW") { 20934 xrefStreamStats[_util.StreamType.LZW] = true; 20935 let earlyChange = 1; 20936 20937 if (params) { 20938 if (params.has("EarlyChange")) { 20939 earlyChange = params.get("EarlyChange"); 20940 } 20941 20942 return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 20943 } 20944 20945 return new _stream.LZWStream(stream, maybeLength, earlyChange); 20946 } 20947 20948 if (name === "DCTDecode" || name === "DCT") { 20949 xrefStreamStats[_util.StreamType.DCT] = true; 20950 return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params); 20951 } 20952 20953 if (name === "JPXDecode" || name === "JPX") { 20954 xrefStreamStats[_util.StreamType.JPX] = true; 20955 return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params); 20956 } 20957 20958 if (name === "ASCII85Decode" || name === "A85") { 20959 xrefStreamStats[_util.StreamType.A85] = true; 20960 return new _stream.Ascii85Stream(stream, maybeLength); 20961 } 20962 20963 if (name === "ASCIIHexDecode" || name === "AHx") { 20964 xrefStreamStats[_util.StreamType.AHX] = true; 20965 return new _stream.AsciiHexStream(stream, maybeLength); 20966 } 20967 20968 if (name === "CCITTFaxDecode" || name === "CCF") { 20969 xrefStreamStats[_util.StreamType.CCF] = true; 20970 return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params); 20971 } 20972 20973 if (name === "RunLengthDecode" || name === "RL") { 20974 xrefStreamStats[_util.StreamType.RLX] = true; 20975 return new _stream.RunLengthStream(stream, maybeLength); 20976 } 20977 20978 if (name === "JBIG2Decode") { 20979 xrefStreamStats[_util.StreamType.JBIG] = true; 20980 return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params); 20981 } 20982 20983 (0, _util.warn)(`Filter "${name}" is not supported.`); 20984 return stream; 20985 } catch (ex) { 20986 if (ex instanceof _core_utils.MissingDataException) { 20987 throw ex; 20988 } 20989 20990 (0, _util.warn)(`Invalid stream: "${ex}"`); 20991 return new _stream.NullStream(); 20992 } 20993 } 20994 20995} 20996 20997exports.Parser = Parser; 20998const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 20999 21000function toHexDigit(ch) { 21001 if (ch >= 0x30 && ch <= 0x39) { 21002 return ch & 0x0f; 21003 } 21004 21005 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 21006 return (ch & 0x0f) + 9; 21007 } 21008 21009 return -1; 21010} 21011 21012class Lexer { 21013 constructor(stream, knownCommands = null) { 21014 this.stream = stream; 21015 this.nextChar(); 21016 this.strBuf = []; 21017 this.knownCommands = knownCommands; 21018 this._hexStringNumWarn = 0; 21019 this.beginInlineImagePos = -1; 21020 } 21021 21022 nextChar() { 21023 return this.currentChar = this.stream.getByte(); 21024 } 21025 21026 peekChar() { 21027 return this.stream.peekByte(); 21028 } 21029 21030 getNumber() {
vendor: 4,648 bytes, lines 21031-21246
21031 let ch = this.currentChar; 21032 let eNotation = false; 21033 let divideBy = 0; 21034 let sign = 0; 21035 21036 if (ch === 0x2d) { 21037 sign = -1; 21038 ch = this.nextChar(); 21039 21040 if (ch === 0x2d) { 21041 ch = this.nextChar(); 21042 } 21043 } else if (ch === 0x2b) { 21044 sign = 1; 21045 ch = this.nextChar(); 21046 } 21047 21048 if (ch === 0x0a || ch === 0x0d) { 21049 do { 21050 ch = this.nextChar(); 21051 } while (ch === 0x0a || ch === 0x0d); 21052 } 21053 21054 if (ch === 0x2e) { 21055 divideBy = 10; 21056 ch = this.nextChar(); 21057 } 21058 21059 if (ch < 0x30 || ch > 0x39) { 21060 if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) { 21061 (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero."); 21062 return 0; 21063 } 21064 21065 throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); 21066 } 21067 21068 sign = sign || 1; 21069 let baseValue = ch - 0x30; 21070 let powerValue = 0; 21071 let powerValueSign = 1; 21072 21073 while ((ch = this.nextChar()) >= 0) { 21074 if (ch >= 0x30 && ch <= 0x39) { 21075 const currentDigit = ch - 0x30; 21076 21077 if (eNotation) { 21078 powerValue = powerValue * 10 + currentDigit; 21079 } else { 21080 if (divideBy !== 0) { 21081 divideBy *= 10; 21082 } 21083 21084 baseValue = baseValue * 10 + currentDigit; 21085 } 21086 } else if (ch === 0x2e) { 21087 if (divideBy === 0) { 21088 divideBy = 1; 21089 } else { 21090 break; 21091 } 21092 } else if (ch === 0x2d) { 21093 (0, _util.warn)("Badly formatted number: minus sign in the middle"); 21094 } else if (ch === 0x45 || ch === 0x65) { 21095 ch = this.peekChar(); 21096 21097 if (ch === 0x2b || ch === 0x2d) { 21098 powerValueSign = ch === 0x2d ? -1 : 1; 21099 this.nextChar(); 21100 } else if (ch < 0x30 || ch > 0x39) { 21101 break; 21102 } 21103 21104 eNotation = true; 21105 } else { 21106 break; 21107 } 21108 } 21109 21110 if (divideBy !== 0) { 21111 baseValue /= divideBy; 21112 } 21113 21114 if (eNotation) { 21115 baseValue *= 10 ** (powerValueSign * powerValue); 21116 } 21117 21118 return sign * baseValue; 21119 } 21120 21121 getString() { 21122 let numParen = 1; 21123 let done = false; 21124 const strBuf = this.strBuf; 21125 strBuf.length = 0; 21126 let ch = this.nextChar(); 21127 21128 while (true) { 21129 let charBuffered = false; 21130 21131 switch (ch | 0) { 21132 case -1: 21133 (0, _util.warn)("Unterminated string"); 21134 done = true; 21135 break; 21136 21137 case 0x28: 21138 ++numParen; 21139 strBuf.push("("); 21140 break; 21141 21142 case 0x29: 21143 if (--numParen === 0) { 21144 this.nextChar(); 21145 done = true; 21146 } else { 21147 strBuf.push(")"); 21148 } 21149 21150 break; 21151 21152 case 0x5c: 21153 ch = this.nextChar(); 21154 21155 switch (ch) { 21156 case -1: 21157 (0, _util.warn)("Unterminated string"); 21158 done = true; 21159 break; 21160 21161 case 0x6e: 21162 strBuf.push("\n"); 21163 break; 21164 21165 case 0x72: 21166 strBuf.push("\r"); 21167 break; 21168 21169 case 0x74: 21170 strBuf.push("\t"); 21171 break; 21172 21173 case 0x62: 21174 strBuf.push("\b"); 21175 break; 21176 21177 case 0x66: 21178 strBuf.push("\f"); 21179 break; 21180 21181 case 0x5c: 21182 case 0x28: 21183 case 0x29: 21184 strBuf.push(String.fromCharCode(ch)); 21185 break; 21186 21187 case 0x30: 21188 case 0x31: 21189 case 0x32: 21190 case 0x33: 21191 case 0x34: 21192 case 0x35: 21193 case 0x36: 21194 case 0x37: 21195 let x = ch & 0x0f; 21196 ch = this.nextChar(); 21197 charBuffered = true; 21198 21199 if (ch >= 0x30 && ch <= 0x37) { 21200 x = (x << 3) + (ch & 0x0f); 21201 ch = this.nextChar(); 21202 21203 if (ch >= 0x30 && ch <= 0x37) { 21204 charBuffered = false; 21205 x = (x << 3) + (ch & 0x0f); 21206 } 21207 } 21208 21209 strBuf.push(String.fromCharCode(x)); 21210 break; 21211 21212 case 0x0d: 21213 if (this.peekChar() === 0x0a) { 21214 this.nextChar(); 21215 } 21216 21217 break; 21218 21219 case 0x0a: 21220 break; 21221 21222 default: 21223 strBuf.push(String.fromCharCode(ch)); 21224 break; 21225 } 21226 21227 break; 21228 21229 default: 21230 strBuf.push(String.fromCharCode(ch)); 21231 break; 21232 } 21233 21234 if (done) { 21235 break; 21236 } 21237 21238 if (!charBuffered) { 21239 ch = this.nextChar(); 21240 } 21241 } 21242 21243 return strBuf.join(""); 21244 } 21245 21246 getName() {
21247 let ch, previousCh; 21248 const strBuf = this.strBuf; 21249 strBuf.length = 0; 21250 21251 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 21252 if (ch === 0x23) { 21253 ch = this.nextChar(); 21254 21255 if (specialChars[ch]) { 21256 (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 21257 strBuf.push("#"); 21258 break; 21259 } 21260 21261 const x = toHexDigit(ch); 21262 21263 if (x !== -1) { 21264 previousCh = ch; 21265 ch = this.nextChar(); 21266 const x2 = toHexDigit(ch); 21267 21268 if (x2 === -1) { 21269 (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 21270 strBuf.push("#", String.fromCharCode(previousCh)); 21271 21272 if (specialChars[ch]) { 21273 break; 21274 } 21275 21276 strBuf.push(String.fromCharCode(ch)); 21277 continue; 21278 } 21279 21280 strBuf.push(String.fromCharCode(x << 4 | x2)); 21281 } else { 21282 strBuf.push("#", String.fromCharCode(ch)); 21283 } 21284 } else { 21285 strBuf.push(String.fromCharCode(ch)); 21286 } 21287 } 21288 21289 if (strBuf.length > 127) { 21290 (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); 21291 } 21292 21293 return _primitives.Name.get(strBuf.join("")); 21294 } 21295 21296 _hexStringWarn(ch) { 21297 const MAX_HEX_STRING_NUM_WARN = 5; 21298 21299 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 21300 (0, _util.warn)("getHexString - ignoring additional invalid characters."); 21301 return; 21302 } 21303 21304 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 21305 return; 21306 } 21307 21308 (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`); 21309 } 21310 21311 getHexString() { 21312 const strBuf = this.strBuf; 21313 strBuf.length = 0; 21314 let ch = this.currentChar; 21315 let isFirstHex = true; 21316 let firstDigit, secondDigit; 21317 this._hexStringNumWarn = 0; 21318 21319 while (true) { 21320 if (ch < 0) { 21321 (0, _util.warn)("Unterminated hex string"); 21322 break; 21323 } else if (ch === 0x3e) { 21324 this.nextChar(); 21325 break; 21326 } else if (specialChars[ch] === 1) { 21327 ch = this.nextChar(); 21328 continue; 21329 } else { 21330 if (isFirstHex) { 21331 firstDigit = toHexDigit(ch); 21332 21333 if (firstDigit === -1) { 21334 this._hexStringWarn(ch); 21335 21336 ch = this.nextChar(); 21337 continue; 21338 } 21339 } else { 21340 secondDigit = toHexDigit(ch); 21341 21342 if (secondDigit === -1) { 21343 this._hexStringWarn(ch); 21344 21345 ch = this.nextChar(); 21346 continue; 21347 } 21348 21349 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 21350 } 21351 21352 isFirstHex = !isFirstHex; 21353 ch = this.nextChar(); 21354 } 21355 } 21356 21357 return strBuf.join(""); 21358 } 21359 21360 getObj() {
21361 let comment = false; 21362 let ch = this.currentChar; 21363 21364 while (true) { 21365 if (ch < 0) { 21366 return _primitives.EOF; 21367 } 21368 21369 if (comment) { 21370 if (ch === 0x0a || ch === 0x0d) { 21371 comment = false; 21372 } 21373 } else if (ch === 0x25) { 21374 comment = true; 21375 } else if (specialChars[ch] !== 1) { 21376 break; 21377 } 21378 21379 ch = this.nextChar(); 21380 } 21381 21382 switch (ch | 0) { 21383 case 0x30: 21384 case 0x31: 21385 case 0x32: 21386 case 0x33: 21387 case 0x34: 21388 case 0x35: 21389 case 0x36: 21390 case 0x37: 21391 case 0x38: 21392 case 0x39: 21393 case 0x2b: 21394 case 0x2d: 21395 case 0x2e: 21396 return this.getNumber(); 21397 21398 case 0x28: 21399 return this.getString(); 21400 21401 case 0x2f: 21402 return this.getName(); 21403 21404 case 0x5b: 21405 this.nextChar(); 21406 return _primitives.Cmd.get("["); 21407 21408 case 0x5d: 21409 this.nextChar(); 21410 return _primitives.Cmd.get("]"); 21411 21412 case 0x3c: 21413 ch = this.nextChar(); 21414 21415 if (ch === 0x3c) { 21416 this.nextChar(); 21417 return _primitives.Cmd.get("<<"); 21418 } 21419 21420 return this.getHexString(); 21421 21422 case 0x3e: 21423 ch = this.nextChar(); 21424 21425 if (ch === 0x3e) { 21426 this.nextChar(); 21427 return _primitives.Cmd.get(">>"); 21428 } 21429 21430 return _primitives.Cmd.get(">"); 21431 21432 case 0x7b: 21433 this.nextChar(); 21434 return _primitives.Cmd.get("{"); 21435 21436 case 0x7d: 21437 this.nextChar(); 21438 return _primitives.Cmd.get("}"); 21439 21440 case 0x29: 21441 this.nextChar(); 21442 throw new _util.FormatError(`Illegal character: ${ch}`); 21443 } 21444 21445 let str = String.fromCharCode(ch); 21446 const knownCommands = this.knownCommands; 21447 let knownCommandFound = knownCommands && knownCommands[str] !== undefined; 21448 21449 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 21450 const possibleCommand = str + String.fromCharCode(ch); 21451 21452 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 21453 break; 21454 } 21455 21456 if (str.length === 128) { 21457 throw new _util.FormatError(`Command token too long: ${str.length}`); 21458 } 21459 21460 str = possibleCommand; 21461 knownCommandFound = knownCommands && knownCommands[str] !== undefined; 21462 } 21463 21464 if (str === "true") { 21465 return true; 21466 } 21467 21468 if (str === "false") { 21469 return false; 21470 } 21471 21472 if (str === "null") { 21473 return null; 21474 } 21475 21476 if (str === "BI") { 21477 this.beginInlineImagePos = this.stream.pos; 21478 } 21479 21480 return _primitives.Cmd.get(str); 21481 } 21482 21483 skipToNextLine() {
21484 let ch = this.currentChar; 21485 21486 while (ch >= 0) { 21487 if (ch === 0x0d) { 21488 ch = this.nextChar(); 21489 21490 if (ch === 0x0a) { 21491 this.nextChar(); 21492 } 21493 21494 break; 21495 } else if (ch === 0x0a) { 21496 this.nextChar(); 21497 break; 21498 } 21499 21500 ch = this.nextChar(); 21501 } 21502 } 21503 21504} 21505 21506exports.Lexer = Lexer; 21507 21508class Linearization { 21509 static create(stream) { 21510 function getInt(linDict, name, allowZeroValue = false) { 21511 const obj = linDict.get(name); 21512 21513 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 21514 return obj; 21515 } 21516 21517 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 21518 } 21519 21520 function getHints(linDict) { 21521 const hints = linDict.get("H"); 21522 let hintsLength; 21523 21524 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 21525 for (let index = 0; index < hintsLength; index++) { 21526 const hint = hints[index]; 21527 21528 if (!(Number.isInteger(hint) && hint > 0)) { 21529 throw new Error(`Hint (${index}
21529) in the linearization dictionary is invalid.`); 21530 } 21531 } 21532 21533 return hints; 21534 } 21535 21536 throw new Error("Hint array in the linearization dictionary is invalid."); 21537 } 21538 21539 const parser = new Parser({ 21540 lexer: new Lexer(stream), 21541 xref: null 21542 }); 21543 const obj1 = parser.getObj(); 21544 const obj2 = parser.getObj(); 21545 const obj3 = parser.getObj(); 21546 const linDict = parser.getObj(); 21547 let obj, length; 21548 21549 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) { 21550 return null; 21551 } else if ((length = getInt(linDict, "L")) !== stream.length) { 21552 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 21553 } 21554 21555 return { 21556 length, 21557 hints: getHints(linDict), 21558 objectNumberFirst: getInt(linDict, "O"), 21559 endFirst: getInt(linDict, "E"), 21560 numPages: getInt(linDict, "N"), 21561 mainXRefEntriesOffset: getInt(linDict, "T"), 21562 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 21563 }; 21564 } 21565 21566} 21567 21568exports.Linearization = Linearization; 21569 21570/***/ }), 21571/* 12 */ 21572/***/ (function(module, exports, __w_pdfjs_require__) { 21573 21574"use strict"; 21575 21576 21577Object.defineProperty(exports, "__esModule", { 21578 value: true 21579}); 21580exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0; 21581 21582var _util = __w_pdfjs_require__(2); 21583 21584var _primitives = __w_pdfjs_require__(5); 21585 21586var _core_utils = __w_pdfjs_require__(8); 21587 21588var Stream = function StreamClosure() { 21589 function Stream(arrayBuffer, start, length, dict) { 21590 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 21591 this.start = start || 0; 21592 this.pos = this.start; 21593 this.end = start + length || this.bytes.length; 21594 this.dict = dict; 21595 } 21596 21597 Stream.prototype = { 21598 get length() { 21599 return this.end - this.start; 21600 }, 21601 21602 get isEmpty() { 21603 return this.length === 0; 21604 }, 21605 21606 getByte: function Stream_getByte() { 21607 if (this.pos >= this.end) { 21608 return -1; 21609 } 21610 21611 return this.bytes[this.pos++]; 21612 }, 21613 getUint16: function Stream_getUint16() { 21614 var b0 = this.getByte(); 21615 var b1 = this.getByte(); 21616 21617 if (b0 === -1 || b1 === -1) { 21618 return -1; 21619 } 21620 21621 return (b0 << 8) + b1; 21622 }, 21623 getInt32: function Stream_getInt32() { 21624 var b0 = this.getByte(); 21625 var b1 = this.getByte(); 21626 var b2 = this.getByte(); 21627 var b3 = this.getByte(); 21628 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 21629 }, 21630 21631 getBytes(length, forceClamped = false) { 21632 var bytes = this.bytes; 21633 var pos = this.pos; 21634 var strEnd = this.end; 21635 21636 if (!length) { 21637 const subarray = bytes.subarray(pos, strEnd); 21638 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 21639 } 21640 21641 var end = pos + length; 21642 21643 if (end > strEnd) { 21644 end = strEnd; 21645 } 21646 21647 this.pos = end; 21648 const subarray = bytes.subarray(pos, end); 21649 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 21650 }, 21651 21652 peekByte: function Stream_peekByte() { 21653 var peekedByte = this.getByte(); 21654 21655 if (peekedByte !== -1) { 21656 this.pos--; 21657 } 21658 21659 return peekedByte; 21660 }, 21661 21662 peekBytes(length, forceClamped = false) { 21663 var bytes = this.getBytes(length, forceClamped); 21664 this.pos -= bytes.length; 21665 return bytes; 21666 }, 21667 21668 getByteRange(begin, end) { 21669 if (begin < 0) { 21670 begin = 0; 21671 } 21672 21673 if (end > this.end) { 21674 end = this.end; 21675 } 21676 21677 return this.bytes.subarray(begin, end); 21678 }, 21679 21680 skip: function Stream_skip(n) { 21681 if (!n) { 21682 n = 1; 21683 } 21684 21685 this.pos += n; 21686 }, 21687 reset: function Stream_reset() { 21688 this.pos = this.start; 21689 }, 21690 moveStart: function Stream_moveStart() { 21691 this.start = this.pos; 21692 }, 21693 makeSubStream: function Stream_makeSubStream(start, length, dict) { 21694 return new Stream(this.bytes.buffer, start, length, dict); 21695 } 21696 }; 21697 return Stream; 21698}(); 21699 21700exports.Stream = Stream; 21701 21702var StringStream = function StringStreamClosure() { 21703 function StringStream(str) { 21704 const bytes = (0, _util.stringToBytes)(str); 21705 Stream.call(this, bytes); 21706 } 21707 21708 StringStream.prototype = Stream.prototype; 21709 return StringStream; 21710}(); 21711 21712exports.StringStream = StringStream; 21713 21714var DecodeStream = function DecodeStreamClosure() { 21715 var emptyBuffer = new Uint8Array(0); 21716 21717 function DecodeStream(maybeMinBufferLength) { 21718 this._rawMinBufferLength = maybeMinBufferLength || 0; 21719 this.pos = 0; 21720 this.bufferLength = 0; 21721 this.eof = false;
21722 this.buffer = emptyBuffer; 21723 this.minBufferLength = 512; 21724 21725 if (maybeMinBufferLength) { 21726 while (this.minBufferLength < maybeMinBufferLength) { 21727 this.minBufferLength *= 2; 21728 } 21729 } 21730 } 21731 21732 DecodeStream.prototype = { 21733 get isEmpty() { 21734 while (!this.eof && this.bufferLength === 0) { 21735 this.readBlock(); 21736 } 21737 21738 return this.bufferLength === 0; 21739 }, 21740 21741 ensureBuffer: function DecodeStream_ensureBuffer(requested) { 21742 var buffer = this.buffer; 21743 21744 if (requested <= buffer.byteLength) { 21745 return buffer; 21746 } 21747 21748 var size = this.minBufferLength; 21749 21750 while (size < requested) { 21751 size *= 2; 21752 } 21753 21754 var buffer2 = new Uint8Array(size); 21755 buffer2.set(buffer); 21756 return this.buffer = buffer2; 21757 }, 21758 getByte: function DecodeStream_getByte() { 21759 var pos = this.pos; 21760 21761 while (this.bufferLength <= pos) { 21762 if (this.eof) { 21763 return -1; 21764 } 21765 21766 this.readBlock(); 21767 } 21768 21769 return this.buffer[this.pos++]; 21770 }, 21771 getUint16: function DecodeStream_getUint16() { 21772 var b0 = this.getByte(); 21773 var b1 = this.getByte(); 21774 21775 if (b0 === -1 || b1 === -1) { 21776 return -1; 21777 } 21778 21779 return (b0 << 8) + b1; 21780 }, 21781 getInt32: function DecodeStream_getInt32() { 21782 var b0 = this.getByte(); 21783 var b1 = this.getByte(); 21784 var b2 = this.getByte(); 21785 var b3 = this.getByte(); 21786 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 21787 }, 21788 21789 getBytes(length, forceClamped = false) { 21790 var end, 21791 pos = this.pos; 21792 21793 if (length) { 21794 this.ensureBuffer(pos + length); 21795 end = pos + length; 21796 21797 while (!this.eof && this.bufferLength < end) { 21798 this.readBlock(); 21799 } 21800 21801 var bufEnd = this.bufferLength; 21802 21803 if (end > bufEnd) { 21804 end = bufEnd; 21805 } 21806 } else { 21807 while (!this.eof) { 21808 this.readBlock(); 21809 } 21810 21811 end = this.bufferLength; 21812 } 21813 21814 this.pos = end; 21815 const subarray = this.buffer.subarray(pos, end); 21816 return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray; 21817 }, 21818 21819 peekByte: function DecodeStream_peekByte() { 21820 var peekedByte = this.getByte(); 21821 21822 if (peekedByte !== -1) { 21823 this.pos--; 21824 } 21825 21826 return peekedByte; 21827 }, 21828 21829 peekBytes(length, forceClamped = false) { 21830 var bytes = this.getBytes(length, forceClamped); 21831 this.pos -= bytes.length; 21832 return bytes; 21833 }, 21834 21835 makeSubStream: function DecodeStream_makeSubStream(start, length, dict) { 21836 var end = start + length; 21837 21838 while (this.bufferLength <= end && !this.eof) { 21839 this.readBlock(); 21840 } 21841 21842 return new Stream(this.buffer, start, length, dict); 21843 }, 21844 21845 getByteRange(begin, end) { 21846 (0, _util.unreachable)("Should not call DecodeStream.getByteRange"); 21847 }, 21848 21849 skip: function DecodeStream_skip(n) { 21850 if (!n) { 21851 n = 1; 21852 } 21853 21854 this.pos += n; 21855 }, 21856 reset: function DecodeStream_reset() { 21857 this.pos = 0; 21858 }, 21859 getBaseStreams: function DecodeStream_getBaseStreams() { 21860 if (this.str && this.str.getBaseStreams) { 21861 return this.str.getBaseStreams(); 21862 } 21863 21864 return []; 21865 } 21866 }; 21867 return DecodeStream; 21868}(); 21869 21870exports.DecodeStream = DecodeStream; 21871 21872var StreamsSequenceStream = function StreamsSequenceStreamClosure() { 21873 function StreamsSequenceStream(streams) { 21874 this.streams = streams; 21875 let maybeLength = 0; 21876 21877 for (let i = 0, ii = streams.length; i < ii; i++) { 21878 const stream = streams[i]; 21879 21880 if (stream instanceof DecodeStream) { 21881 maybeLength += stream._rawMinBufferLength; 21882 } else { 21883 maybeLength += stream.length; 21884 } 21885 } 21886 21887 DecodeStream.call(this, maybeLength); 21888 } 21889 21890 StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype); 21891 21892 StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() { 21893 var streams = this.streams; 21894 21895 if (streams.length === 0) { 21896 this.eof = true; 21897 return; 21898 } 21899 21900 var stream = streams.shift(); 21901 var chunk = stream.getBytes(); 21902 var bufferLength = this.bufferLength; 21903 var newLength = bufferLength + chunk.length; 21904 var buffer = this.ensureBuffer(newLength); 21905 buffer.set(chunk, bufferLength); 21906 this.bufferLength = newLength; 21907 }; 21908 21909 StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() { 21910 var baseStreams = []; 21911 21912 for (var i = 0, ii = this.streams.length; i < ii; i++) { 21913 var stream = this.streams[i]; 21914 21915 if (stream.getBaseStreams) { 21916 baseStreams.push(...stream.getBaseStreams()); 21917 } 21918 } 21919 21920 return baseStreams; 21921 }; 21922 21923 return StreamsSequenceStream; 21924}(); 21925 21926exports.StreamsSequenceStream = StreamsSequenceStream; 21927 21928var FlateStream = function FlateStreamClosure() { 21929 var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 21930 var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]); 21931 var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
21932 var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b,
219320x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9]; 21933 var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5]; 21934 21935 function FlateStream(str, maybeLength) { 21936 this.str = str; 21937 this.dict = str.dict; 21938 var cmf = str.getByte(); 21939 var flg = str.getByte(); 21940 21941 if (cmf === -1 || flg === -1) { 21942 throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 21943 } 21944 21945 if ((cmf & 0x0f) !== 0x08) { 21946 throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 21947 } 21948 21949 if (((cmf << 8) + flg) % 31 !== 0) { 21950 throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 21951 } 21952 21953 if (flg & 0x20) { 21954 throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 21955 } 21956 21957 this.codeSize = 0; 21958 this.codeBuf = 0; 21959 DecodeStream.call(this, maybeLength); 21960 } 21961 21962 FlateStream.prototype = Object.create(DecodeStream.prototype); 21963 21964 FlateStream.prototype.getBits = function FlateStream_getBits(bits) { 21965 var str = this.str; 21966 var codeSize = this.codeSize; 21967 var codeBuf = this.codeBuf; 21968 var b; 21969 21970 while (codeSize < bits) { 21971 if ((b = str.getByte()) === -1) { 21972 throw new _util.FormatError("Bad encoding in flate stream"); 21973 } 21974 21975 codeBuf |= b << codeSize; 21976 codeSize += 8; 21977 } 21978 21979 b = codeBuf & (1 << bits) - 1; 21980 this.codeBuf = codeBuf >> bits; 21981 this.codeSize = codeSize -= bits; 21982 return b; 21983 }; 21984 21985 FlateStream.prototype.getCode = function FlateStream_getCode(table) { 21986 var str = this.str; 21987 var codes = table[0]; 21988 var maxLen = table[1]; 21989 var codeSize = this.codeSize; 21990 var codeBuf = this.codeBuf; 21991 var b; 21992 21993 while (codeSize < maxLen) { 21994 if ((b = str.getByte()) === -1) { 21995 break; 21996 } 21997 21998 codeBuf |= b << codeSize; 21999 codeSize += 8; 22000 } 22001 22002 var code = codes[codeBuf & (1 << maxLen) - 1]; 22003 var codeLen = code >> 16; 22004 var codeVal = code & 0xffff; 22005 22006 if (codeLen < 1 || codeSize < codeLen) { 22007 throw new _util.FormatError("Bad encoding in flate stream"); 22008 } 22009 22010 this.codeBuf = codeBuf >> codeLen; 22011 this.codeSize = codeSize - codeLen; 22012 return codeVal; 22013 }; 22014 22015 FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) { 22016 var n = lengths.length; 22017 var maxLen = 0; 22018 var i; 22019 22020 for (i = 0; i < n; ++i) { 22021 if (lengths[i] > maxLen) { 22022 maxLen = lengths[i]; 22023 } 22024 } 22025 22026 var size = 1 << maxLen; 22027 var codes = new Int32Array(size); 22028 22029 for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 22030 for (var val = 0; val < n; ++val) { 22031 if (lengths[val] === len) { 22032 var code2 = 0; 22033 var t = code; 22034 22035 for (i = 0; i < len; ++i) { 22036 code2 = code2 << 1 | t & 1; 22037 t >>= 1; 22038 } 22039 22040 for (i = code2; i < size; i += skip) { 22041 codes[i] = len << 16 | val; 22042 } 22043 22044 ++code; 22045 } 22046 } 22047 } 22048 22049 return [codes, maxLen]; 22050 }; 22051 22052 FlateStream.prototype.readBlock = function FlateStream_readBlock() { 22053 var buffer, len; 22054 var str = this.str; 22055 var hdr = this.getBits(3); 22056 22057 if (hdr & 1) { 22058 this.eof = true; 22059 } 22060 22061 hdr >>= 1; 22062 22063 if (hdr === 0) { 22064 var b; 22065 22066 if ((b = str.getByte()) === -1) { 22067 throw new _util.FormatError("Bad block header in flate stream"); 22068 } 22069 22070 var blockLen = b; 22071 22072 if ((b = str.getByte()) === -1) { 22073 throw new _util.FormatError("Bad block header in flate stream"); 22074 } 22075 22076 blockLen |= b << 8; 22077 22078 if ((b = str.getByte()) === -1) { 22079 throw new _util.FormatError("Bad block header in flate stream"); 22080 } 22081 22082 var check = b; 22083 22084 if ((b = str.getByte()) === -1) { 22085 throw new _util.FormatError("Bad block header in flate stream"); 22086 } 22087 22088 check |= b << 8; 22089 22090 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 22091 throw new _util.FormatError("Bad uncompressed block length in flate stream"); 22092 } 22093 22094 this.codeBuf = 0; 22095 this.codeSize = 0; 22096 const bufferLength = this.bufferLength, 22097 end = bufferLength + blockLen; 22098 buffer = this.ensureBuffer(end); 22099 this.bufferLength = end; 22100 22101 if (blockLen === 0) { 22102 if (str.peekByte() === -1) { 22103 this.eof = true; 22104 } 22105 } else { 22106 const block = str.getBytes(blockLen); 22107 buffer.set(block, bufferLength); 22108 22109 if (block.length < blockLen) { 22110 this.eof = true; 22111 } 22112 } 22113 22114 return; 22115 } 22116 22117 var litCodeTable; 22118 var distCodeTable; 22119 22120 if (hdr === 1) {
22121 litCodeTable = fixedLitCodeTab; 22122 distCodeTable = fixedDistCodeTab; 22123 } else if (hdr === 2) { 22124 var numLitCodes = this.getBits(5) + 257; 22125 var numDistCodes = this.getBits(5) + 1; 22126 var numCodeLenCodes = this.getBits(4) + 4; 22127 var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 22128 var i; 22129 22130 for (i = 0; i < numCodeLenCodes; ++i) { 22131 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 22132 } 22133 22134 var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 22135 len = 0; 22136 i = 0; 22137 var codes = numLitCodes + numDistCodes; 22138 var codeLengths = new Uint8Array(codes); 22139 var bitsLength, bitsOffset, what; 22140 22141 while (i < codes) { 22142 var code = this.getCode(codeLenCodeTab); 22143 22144 if (code === 16) { 22145 bitsLength = 2; 22146 bitsOffset = 3; 22147 what = len; 22148 } else if (code === 17) { 22149 bitsLength = 3; 22150 bitsOffset = 3; 22151 what = len = 0; 22152 } else if (code === 18) { 22153 bitsLength = 7; 22154 bitsOffset = 11; 22155 what = len = 0; 22156 } else { 22157 codeLengths[i++] = len = code; 22158 continue; 22159 } 22160 22161 var repeatLength = this.getBits(bitsLength) + bitsOffset; 22162 22163 while (repeatLength-- > 0) { 22164 codeLengths[i++] = what; 22165 } 22166 } 22167 22168 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 22169 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 22170 } else { 22171 throw new _util.FormatError("Unknown block type in flate stream"); 22172 } 22173 22174 buffer = this.buffer; 22175 var limit = buffer ? buffer.length : 0; 22176 var pos = this.bufferLength; 22177 22178 while (true) { 22179 var code1 = this.getCode(litCodeTable); 22180 22181 if (code1 < 256) { 22182 if (pos + 1 >= limit) { 22183 buffer = this.ensureBuffer(pos + 1); 22184 limit = buffer.length; 22185 } 22186 22187 buffer[pos++] = code1; 22188 continue; 22189 } 22190 22191 if (code1 === 256) { 22192 this.bufferLength = pos; 22193 return; 22194 } 22195 22196 code1 -= 257; 22197 code1 = lengthDecode[code1]; 22198 var code2 = code1 >> 16; 22199 22200 if (code2 > 0) { 22201 code2 = this.getBits(code2); 22202 } 22203 22204 len = (code1 & 0xffff) + code2; 22205 code1 = this.getCode(distCodeTable); 22206 code1 = distDecode[code1]; 22207 code2 = code1 >> 16; 22208 22209 if (code2 > 0) { 22210 code2 = this.getBits(code2); 22211 } 22212 22213 var dist = (code1 & 0xffff) + code2; 22214 22215 if (pos + len >= limit) { 22216 buffer = this.ensureBuffer(pos + len); 22217 limit = buffer.length; 22218 } 22219 22220 for (var k = 0; k < len; ++k, ++pos) { 22221 buffer[pos] = buffer[pos - dist]; 22222 } 22223 } 22224 }; 22225 22226 return FlateStream; 22227}(); 22228 22229exports.FlateStream = FlateStream; 22230 22231var PredictorStream = function PredictorStreamClosure() { 22232 function PredictorStream(str, maybeLength, params) { 22233 if (!(0, _primitives.isDict)(params)) { 22234 return str; 22235 } 22236 22237 var predictor = this.predictor = params.get("Predictor") || 1; 22238 22239 if (predictor <= 1) { 22240 return str; 22241 } 22242 22243 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 22244 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 22245 } 22246 22247 if (predictor === 2) { 22248 this.readBlock = this.readBlockTiff; 22249 } else { 22250 this.readBlock = this.readBlockPng; 22251 } 22252 22253 this.str = str; 22254 this.dict = str.dict; 22255 var colors = this.colors = params.get("Colors") || 1; 22256 var bits = this.bits = params.get("BitsPerComponent") || 8; 22257 var columns = this.columns = params.get("Columns") || 1; 22258 this.pixBytes = colors * bits + 7 >> 3; 22259 this.rowBytes = columns * colors * bits + 7 >> 3; 22260 DecodeStream.call(this, maybeLength); 22261 return this; 22262 } 22263 22264 PredictorStream.prototype = Object.create(DecodeStream.prototype); 22265 22266 PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() { 22267 var rowBytes = this.rowBytes; 22268 var bufferLength = this.bufferLength; 22269 var buffer = this.ensureBuffer(bufferLength + rowBytes); 22270 var bits = this.bits; 22271 var colors = this.colors; 22272 var rawBytes = this.str.getBytes(rowBytes); 22273 this.eof = !rawBytes.length; 22274 22275 if (this.eof) { 22276 return; 22277 } 22278 22279 var inbuf = 0, 22280 outbuf = 0; 22281 var inbits = 0, 22282 outbits = 0; 22283 var pos = bufferLength; 22284 var i; 22285 22286 if (bits === 1 && colors === 1) { 22287 for (i = 0; i < rowBytes; ++i) { 22288 var c = rawBytes[i] ^ inbuf; 22289 c ^= c >> 1; 22290 c ^= c >> 2; 22291 c ^= c >> 4; 22292 inbuf = (c & 1) << 7; 22293 buffer[pos++] = c; 22294 } 22295 } else if (bits === 8) { 22296 for (i = 0; i < colors; ++i) { 22297 buffer[pos++] = rawBytes[i]; 22298 } 22299 22300 for (; i < rowBytes; ++i) { 22301 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 22302 pos++; 22303 } 22304 } else if (bits === 16) { 22305 var bytesPerPixel = colors * 2; 22306 22307 for (i = 0; i < bytesPerPixel; ++i) { 22308 buffer[pos++] = rawBytes[i]; 22309 } 22310 22311 for (; i < rowBytes; i += 2) { 22312 var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 22313 buffer[pos++] = sum >> 8 & 0xff; 22314 buffer[pos++] = sum & 0xff; 22315 } 22316 } else { 22317 var compArray = new Uint8Array(colors + 1); 22318 var bitMask = (1 << bits) - 1; 22319 var j = 0, 22320 k = bufferLength; 22321 var columns = this.columns; 22322 22323 for (i = 0; i < columns; ++i) { 22324 for (var kk = 0; kk < colors; ++kk) { 22325 if (inbits < bits) { 22326 inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
22327 inbits += 8; 22328 } 22329 22330 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 22331 inbits -= bits; 22332 outbuf = outbuf << bits | compArray[kk]; 22333 outbits += bits; 22334 22335 if (outbits >= 8) { 22336 buffer[k++] = outbuf >> outbits - 8 & 0xff; 22337 outbits -= 8; 22338 } 22339 } 22340 } 22341 22342 if (outbits > 0) { 22343 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 22344 } 22345 } 22346 22347 this.bufferLength += rowBytes; 22348 }; 22349 22350 PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() { 22351 var rowBytes = this.rowBytes; 22352 var pixBytes = this.pixBytes; 22353 var predictor = this.str.getByte(); 22354 var rawBytes = this.str.getBytes(rowBytes); 22355 this.eof = !rawBytes.length; 22356 22357 if (this.eof) { 22358 return; 22359 } 22360 22361 var bufferLength = this.bufferLength; 22362 var buffer = this.ensureBuffer(bufferLength + rowBytes); 22363 var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 22364 22365 if (prevRow.length === 0) { 22366 prevRow = new Uint8Array(rowBytes); 22367 } 22368 22369 var i, 22370 j = bufferLength, 22371 up, 22372 c; 22373 22374 switch (predictor) { 22375 case 0: 22376 for (i = 0; i < rowBytes; ++i) { 22377 buffer[j++] = rawBytes[i]; 22378 } 22379 22380 break; 22381 22382 case 1: 22383 for (i = 0; i < pixBytes; ++i) { 22384 buffer[j++] = rawBytes[i]; 22385 } 22386 22387 for (; i < rowBytes; ++i) { 22388 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 22389 j++; 22390 } 22391 22392 break; 22393 22394 case 2: 22395 for (i = 0; i < rowBytes; ++i) { 22396 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 22397 } 22398 22399 break; 22400 22401 case 3: 22402 for (i = 0; i < pixBytes; ++i) { 22403 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 22404 } 22405 22406 for (; i < rowBytes; ++i) { 22407 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 22408 j++; 22409 } 22410 22411 break; 22412 22413 case 4: 22414 for (i = 0; i < pixBytes; ++i) { 22415 up = prevRow[i]; 22416 c = rawBytes[i]; 22417 buffer[j++] = up + c; 22418 } 22419 22420 for (; i < rowBytes; ++i) { 22421 up = prevRow[i]; 22422 var upLeft = prevRow[i - pixBytes]; 22423 var left = buffer[j - pixBytes]; 22424 var p = left + up - upLeft; 22425 var pa = p - left; 22426 22427 if (pa < 0) { 22428 pa = -pa; 22429 } 22430 22431 var pb = p - up; 22432 22433 if (pb < 0) { 22434 pb = -pb; 22435 } 22436 22437 var pc = p - upLeft; 22438 22439 if (pc < 0) { 22440 pc = -pc; 22441 } 22442 22443 c = rawBytes[i]; 22444 22445 if (pa <= pb && pa <= pc) { 22446 buffer[j++] = left + c; 22447 } else if (pb <= pc) { 22448 buffer[j++] = up + c; 22449 } else { 22450 buffer[j++] = upLeft + c; 22451 } 22452 } 22453 22454 break; 22455 22456 default: 22457 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 22458 } 22459 22460 this.bufferLength += rowBytes; 22461 }; 22462 22463 return PredictorStream; 22464}(); 22465 22466exports.PredictorStream = PredictorStream; 22467 22468var DecryptStream = function DecryptStreamClosure() { 22469 function DecryptStream(str, maybeLength, decrypt) { 22470 this.str = str; 22471 this.dict = str.dict; 22472 this.decrypt = decrypt; 22473 this.nextChunk = null; 22474 this.initialized = false; 22475 DecodeStream.call(this, maybeLength); 22476 } 22477 22478 var chunkSize = 512; 22479 DecryptStream.prototype = Object.create(DecodeStream.prototype); 22480 22481 DecryptStream.prototype.readBlock = function DecryptStream_readBlock() { 22482 var chunk; 22483 22484 if (this.initialized) { 22485 chunk = this.nextChunk; 22486 } else { 22487 chunk = this.str.getBytes(chunkSize); 22488 this.initialized = true; 22489 } 22490 22491 if (!chunk || chunk.length === 0) { 22492 this.eof = true; 22493 return; 22494 } 22495 22496 this.nextChunk = this.str.getBytes(chunkSize); 22497 var hasMoreData = this.nextChunk && this.nextChunk.length > 0; 22498 var decrypt = this.decrypt; 22499 chunk = decrypt(chunk, !hasMoreData); 22500 var bufferLength = this.bufferLength; 22501 var i, 22502 n = chunk.length; 22503 var buffer = this.ensureBuffer(bufferLength + n); 22504 22505 for (i = 0; i < n; i++) { 22506 buffer[bufferLength++] = chunk[i]; 22507 } 22508 22509 this.bufferLength = bufferLength; 22510 }; 22511 22512 return DecryptStream; 22513}(); 22514 22515exports.DecryptStream = DecryptStream; 22516 22517var Ascii85Stream = function Ascii85StreamClosure() { 22518 function Ascii85Stream(str, maybeLength) { 22519 this.str = str; 22520 this.dict = str.dict; 22521 this.input = new Uint8Array(5); 22522 22523 if (maybeLength) { 22524 maybeLength = 0.8 * maybeLength; 22525 } 22526 22527 DecodeStream.call(this, maybeLength); 22528 } 22529 22530 Ascii85Stream.prototype = Object.create(DecodeStream.prototype); 22531 22532 Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() { 22533 var TILDA_CHAR = 0x7e; 22534 var Z_LOWER_CHAR = 0x7a; 22535 var EOF = -1; 22536 var str = this.str; 22537 var c = str.getByte(); 22538 22539 while ((0, _core_utils.isWhiteSpace)(c)) { 22540 c = str.getByte(); 22541 } 22542 22543 if (c === EOF || c === TILDA_CHAR) { 22544 this.eof = true; 22545 return; 22546 } 22547 22548 var bufferLength = this.bufferLength, 22549 buffer; 22550 var i; 22551 22552 if (c === Z_LOWER_CHAR) { 22553 buffer = this.ensureBuffer(bufferLength + 4); 22554 22555 for (i = 0; i < 4; ++i) { 22556 buffer[bufferLength + i] = 0; 22557 } 22558 22559 this.bufferLength += 4; 22560 } else { 22561 var input = this.input; 22562 input[0] = c; 22563 22564 for (i = 1; i < 5; ++i) { 22565 c = str.getByte(); 22566 22567 while ((0, _core_utils.isWhiteSpace)(c)) { 22568 c = str.getByte(); 22569 } 22570 22571 input[i] = c; 22572 22573 if (c === EOF || c === TILDA_CHAR) { 22574 break; 22575 } 22576 } 22577 22578 buffer = this.ensureBuffer(bufferLength + i - 1); 22579 this.bufferLength += i - 1; 22580 22581 if (i < 5) { 22582 for (; i < 5; ++i) { 22583 input[i] = 0x21 + 84; 22584 } 22585 22586 this.eof = true; 22587 } 22588 22589 var t = 0; 22590 22591 for (i = 0; i < 5; ++i) { 22592 t = t * 85 + (input[i] - 0x21); 22593 } 22594 22595 for (i = 3; i >= 0; --i) { 22596 buffer[bufferLength + i] = t & 0xff; 22597 t >>= 8; 22598 } 22599 } 22600 }; 22601 22602 return Ascii85Stream; 22603}(); 22604 22605exports.Ascii85Stream = Ascii85Stream; 22606 22607var AsciiHexStream = function AsciiHexStreamClosure() { 22608 function AsciiHexStream(str, maybeLength) { 22609 this.str = str; 22610 this.dict = str.dict; 22611 this.firstDigit = -1; 22612 22613 if (maybeLength) { 22614 maybeLength = 0.5 * maybeLength; 22615 } 22616 22617 DecodeStream.call(this, maybeLength); 22618 } 22619 22620 AsciiHexStream.prototype = Object.create(DecodeStream.prototype); 22621 22622 AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() { 22623 var UPSTREAM_BLOCK_SIZE = 8000; 22624 var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 22625 22626 if (!bytes.length) { 22627 this.eof = true; 22628 return; 22629 } 22630 22631 var maxDecodeLength = bytes.length + 1 >> 1; 22632 var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 22633 var bufferLength = this.bufferLength; 22634 var firstDigit = this.firstDigit; 22635 22636 for (var i = 0, ii = bytes.length; i < ii; i++) { 22637 var ch = bytes[i], 22638 digit; 22639 22640 if (ch >= 0x30 && ch <= 0x39) { 22641 digit = ch & 0x0f; 22642 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 22643 digit = (ch & 0x0f) + 9; 22644 } else if (ch === 0x3e) { 22645 this.eof = true; 22646 break; 22647 } else { 22648 continue; 22649 } 22650 22651 if (firstDigit < 0) { 22652 firstDigit = digit; 22653 } else { 22654 buffer[bufferLength++] = firstDigit << 4 | digit; 22655 firstDigit = -1; 22656 } 22657 } 22658 22659 if (firstDigit >= 0 && this.eof) { 22660 buffer[bufferLength++] = firstDigit << 4; 22661 firstDigit = -1; 22662 } 22663 22664 this.firstDigit = firstDigit; 22665 this.bufferLength = bufferLength; 22666 }; 22667 22668 return AsciiHexStream; 22669}(); 22670 22671exports.AsciiHexStream = AsciiHexStream; 22672 22673var RunLengthStream = function RunLengthStreamClosure() { 22674 function RunLengthStream(str, maybeLength) { 22675 this.str = str; 22676 this.dict = str.dict; 22677 DecodeStream.call(this, maybeLength); 22678 } 22679 22680 RunLengthStream.prototype = Object.create(DecodeStream.prototype); 22681 22682 RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() { 22683 var repeatHeader = this.str.getBytes(2); 22684 22685 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 22686 this.eof = true; 22687 return; 22688 } 22689 22690 var buffer; 22691 var bufferLength = this.bufferLength; 22692 var n = repeatHeader[0]; 22693 22694 if (n < 128) { 22695 buffer = this.ensureBuffer(bufferLength + n + 1); 22696 buffer[bufferLength++] = repeatHeader[1]; 22697 22698 if (n > 0) { 22699 var source = this.str.getBytes(n); 22700 buffer.set(source, bufferLength); 22701 bufferLength += n; 22702 } 22703 } else { 22704 n = 257 - n; 22705 var b = repeatHeader[1]; 22706 buffer = this.ensureBuffer(bufferLength + n + 1); 22707 22708 for (var i = 0; i < n; i++) { 22709 buffer[bufferLength++] = b; 22710 } 22711 } 22712 22713 this.bufferLength = bufferLength; 22714 }; 22715 22716 return RunLengthStream; 22717}(); 22718 22719exports.RunLengthStream = RunLengthStream; 22720 22721var LZWStream = function LZWStreamClosure() { 22722 function LZWStream(str, maybeLength, earlyChange) { 22723 this.str = str; 22724 this.dict = str.dict; 22725 this.cachedData = 0; 22726 this.bitsCached = 0; 22727 var maxLzwDictionarySize = 4096; 22728 var lzwState = { 22729 earlyChange, 22730 codeLength: 9, 22731 nextCode: 258, 22732 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 22733 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 22734 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 22735 currentSequence: new Uint8Array(maxLzwDictionarySize), 22736 currentSequenceLength: 0 22737 }; 22738 22739 for (var i = 0; i < 256; ++i) { 22740 lzwState.dictionaryValues[i] = i; 22741 lzwState.dictionaryLengths[i] = 1; 22742 } 22743 22744 this.lzwState = lzwState; 22745 DecodeStream.call(this, maybeLength); 22746 } 22747 22748 LZWStream.prototype = Object.create(DecodeStream.prototype); 22749 22750 LZWStream.prototype.readBits = function LZWStream_readBits(n) { 22751 var bitsCached = this.bitsCached; 22752 var cachedData = this.cachedData; 22753 22754 while (bitsCached < n) { 22755 var c = this.str.getByte(); 22756 22757 if (c === -1) { 22758 this.eof = true; 22759 return null; 22760 } 22761 22762 cachedData = cachedData << 8 | c; 22763 bitsCached += 8; 22764 } 22765 22766 this.bitsCached = bitsCached -= n; 22767 this.cachedData = cachedData; 22768 this.lastCode = null; 22769 return cachedData >>>
22769 bitsCached & (1 << n) - 1; 22770 }; 22771 22772 LZWStream.prototype.readBlock = function LZWStream_readBlock() { 22773 var blockSize = 512; 22774 var estimatedDecodedSize = blockSize * 2, 22775 decodedSizeDelta = blockSize; 22776 var i, j, q; 22777 var lzwState = this.lzwState; 22778 22779 if (!lzwState) { 22780 return; 22781 } 22782 22783 var earlyChange = lzwState.earlyChange; 22784 var nextCode = lzwState.nextCode; 22785 var dictionaryValues = lzwState.dictionaryValues; 22786 var dictionaryLengths = lzwState.dictionaryLengths; 22787 var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 22788 var codeLength = lzwState.codeLength; 22789 var prevCode = lzwState.prevCode; 22790 var currentSequence = lzwState.currentSequence; 22791 var currentSequenceLength = lzwState.currentSequenceLength; 22792 var decodedLength = 0; 22793 var currentBufferLength = this.bufferLength; 22794 var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 22795 22796 for (i = 0; i < blockSize; i++) { 22797 var code = this.readBits(codeLength); 22798 var hasPrev = currentSequenceLength > 0; 22799 22800 if (code < 256) { 22801 currentSequence[0] = code; 22802 currentSequenceLength = 1; 22803 } else if (code >= 258) {
22804 if (code < nextCode) { 22805 currentSequenceLength = dictionaryLengths[code]; 22806 22807 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 22808 currentSequence[j] = dictionaryValues[q]; 22809 q = dictionaryPrevCodes[q]; 22810 } 22811 } else { 22812 currentSequence[currentSequenceLength++] = currentSequence[0]; 22813 } 22814 } else if (code === 256) { 22815 codeLength = 9; 22816 nextCode = 258; 22817 currentSequenceLength = 0; 22818 continue; 22819 } else { 22820 this.eof = true; 22821 delete this.lzwState; 22822 break; 22823 } 22824 22825 if (hasPrev) { 22826 dictionaryPrevCodes[nextCode] = prevCode; 22827 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 22828 dictionaryValues[nextCode] = currentSequence[0]; 22829 nextCode++; 22830 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 22831 } 22832 22833 prevCode = code; 22834 decodedLength += currentSequenceLength; 22835 22836 if (estimatedDecodedSize < decodedLength) { 22837 do { 22838 estimatedDecodedSize += decodedSizeDelta; 22839 } while (estimatedDecodedSize < decodedLength); 22840 22841 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 22842 } 22843 22844 for (j = 0; j < currentSequenceLength; j++) { 22845 buffer[currentBufferLength++] = currentSequence[j]; 22846 } 22847 } 22848 22849 lzwState.nextCode = nextCode; 22850 lzwState.codeLength = codeLength; 22851 lzwState.prevCode = prevCode; 22852 lzwState.currentSequenceLength = currentSequenceLength; 22853 this.bufferLength = currentBufferLength; 22854 }; 22855 22856 return LZWStream; 22857}(); 22858 22859exports.LZWStream = LZWStream; 22860 22861var NullStream = function NullStreamClosure() { 22862 function NullStream() { 22863 Stream.call(this, new Uint8Array(0)); 22864 } 22865 22866 NullStream.prototype = Stream.prototype; 22867 return NullStream; 22868}(); 22869 22870exports.NullStream = NullStream; 22871 22872/***/ }), 22873/* 13 */ 22874/***/ (function(module, exports, __w_pdfjs_require__) { 22875 22876"use strict"; 22877 22878 22879Object.defineProperty(exports, "__esModule", { 22880 value: true 22881}); 22882exports.CCITTFaxStream = void 0; 22883 22884var _primitives = __w_pdfjs_require__(5); 22885 22886var _ccitt = __w_pdfjs_require__(14); 22887 22888var _stream = __w_pdfjs_require__(12); 22889 22890var CCITTFaxStream = function CCITTFaxStreamClosure() { 22891 function CCITTFaxStream(str, maybeLength, params) { 22892 this.str = str; 22893 this.dict = str.dict; 22894 22895 if (!(0, _primitives.isDict)(params)) { 22896 params = _primitives.Dict.empty; 22897 } 22898 22899 const source = { 22900 next() { 22901 return str.getByte(); 22902 } 22903 22904 }; 22905 this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, { 22906 K: params.get("K"), 22907 EndOfLine: params.get("EndOfLine"), 22908 EncodedByteAlign: params.get("EncodedByteAlign"), 22909 Columns: params.get("Columns"), 22910 Rows: params.get("Rows"), 22911 EndOfBlock: params.get("EndOfBlock"), 22912 BlackIs1: params.get("BlackIs1") 22913 }); 22914 22915 _stream.DecodeStream.call(this, maybeLength); 22916 } 22917 22918 CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype); 22919 22920 CCITTFaxStream.prototype.readBlock = function () { 22921 while (!this.eof) { 22922 const c = this.ccittFaxDecoder.readNextChar(); 22923 22924 if (c === -1) { 22925 this.eof = true; 22926 return; 22927 } 22928 22929 this.ensureBuffer(this.bufferLength + 1); 22930 this.buffer[this.bufferLength++] = c; 22931 } 22932 }; 22933 22934 return CCITTFaxStream; 22935}(); 22936 22937exports.CCITTFaxStream = CCITTFaxStream; 22938 22939/***/ }), 22940/* 14 */ 22941/***/ (function(module, exports, __w_pdfjs_require__) { 22942 22943"use strict"; 22944 22945 22946Object.defineProperty(exports, "__esModule", { 22947 value: true 22948}); 22949exports.CCITTFaxDecoder = void 0; 22950 22951var _util = __w_pdfjs_require__(2); 22952 22953const CCITTFaxDecoder = function CCITTFaxDecoder() { 22954 const ccittEOL = -2; 22955 const ccittEOF = -1; 22956 const twoDimPass = 0; 22957 const twoDimHoriz = 1; 22958 const twoDimVert0 = 2; 22959 const twoDimVertR1 = 3; 22960 const twoDimVertL1 = 4; 22961 const twoDimVertR2 = 5; 22962 const twoDimVertL2 = 6; 22963 const twoDimVertR3 = 7; 22964 const twoDimVertL3 = 8; 22965 const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
22966 const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]]; 22967 const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
22968 const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]]; 22969 const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]]; 22970 const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]; 22971 22972 function CCITTFaxDecoder(source, options = {}) { 22973 if (!source || typeof source.next !== "function") { 22974 throw new Error('CCITTFaxDecoder - invalid "source" parameter.'); 22975 } 22976 22977 this.source = source; 22978 this.eof = false; 22979 this.encoding = options.K || 0; 22980 this.eoline = options.EndOfLine || false; 22981 this.byteAlign = options.EncodedByteAlign || false; 22982 this.columns = options.Columns || 1728; 22983 this.rows = options.Rows || 0; 22984 let eoblock = options.EndOfBlock; 22985 22986 if (eoblock === null || eoblock === undefined) { 22987 eoblock = true; 22988 } 22989 22990 this.eoblock = eoblock; 22991 this.black = options.BlackIs1 || false; 22992 this.codingLine = new Uint32Array(this.columns + 1); 22993 this.refLine = new Uint32Array(this.columns + 2); 22994 this.codingLine[0] = this.columns; 22995 this.codingPos = 0; 22996 this.row = 0; 22997 this.nextLine2D = this.encoding < 0; 22998 this.inputBits = 0; 22999 this.inputBuf = 0; 23000 this.outputBits = 0; 23001 this.rowsDone = false;
vendor: 8,901 bytes, lines 23002-23352
23002 let code1; 23003 23004 while ((code1 = this._lookBits(12)) === 0) { 23005 this._eatBits(1); 23006 } 23007 23008 if (code1 === 1) { 23009 this._eatBits(12); 23010 } 23011 23012 if (this.encoding > 0) { 23013 this.nextLine2D = !this._lookBits(1); 23014 23015 this._eatBits(1); 23016 } 23017 } 23018 23019 CCITTFaxDecoder.prototype = { 23020 readNextChar() { 23021 if (this.eof) { 23022 return -1; 23023 } 23024 23025 const refLine = this.refLine; 23026 const codingLine = this.codingLine; 23027 const columns = this.columns; 23028 let refPos, blackPixels, bits, i; 23029 23030 if (this.outputBits === 0) { 23031 if (this.rowsDone) { 23032 this.eof = true; 23033 } 23034 23035 if (this.eof) { 23036 return -1; 23037 } 23038 23039 this.err = false; 23040 let code1, code2, code3; 23041 23042 if (this.nextLine2D) { 23043 for (i = 0; codingLine[i] < columns; ++i) { 23044 refLine[i] = codingLine[i]; 23045 } 23046 23047 refLine[i++] = columns; 23048 refLine[i] = columns; 23049 codingLine[0] = 0; 23050 this.codingPos = 0; 23051 refPos = 0; 23052 blackPixels = 0; 23053 23054 while (codingLine[this.codingPos] < columns) { 23055 code1 = this._getTwoDimCode(); 23056 23057 switch (code1) { 23058 case twoDimPass: 23059 this._addPixels(refLine[refPos + 1], blackPixels); 23060 23061 if (refLine[refPos + 1] < columns) { 23062 refPos += 2; 23063 } 23064 23065 break; 23066 23067 case twoDimHoriz: 23068 code1 = code2 = 0; 23069 23070 if (blackPixels) { 23071 do { 23072 code1 += code3 = this._getBlackCode(); 23073 } while (code3 >= 64); 23074 23075 do { 23076 code2 += code3 = this._getWhiteCode(); 23077 } while (code3 >= 64); 23078 } else { 23079 do { 23080 code1 += code3 = this._getWhiteCode(); 23081 } while (code3 >= 64); 23082 23083 do { 23084 code2 += code3 = this._getBlackCode(); 23085 } while (code3 >= 64); 23086 } 23087 23088 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 23089 23090 if (codingLine[this.codingPos] < columns) { 23091 this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 23092 } 23093 23094 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23095 refPos += 2; 23096 } 23097 23098 break; 23099 23100 case twoDimVertR3: 23101 this._addPixels(refLine[refPos] + 3, blackPixels); 23102 23103 blackPixels ^= 1; 23104 23105 if (codingLine[this.codingPos] < columns) { 23106 ++refPos; 23107 23108 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23109 refPos += 2; 23110 } 23111 } 23112 23113 break; 23114 23115 case twoDimVertR2: 23116 this._addPixels(refLine[refPos] + 2, blackPixels); 23117 23118 blackPixels ^= 1; 23119 23120 if (codingLine[this.codingPos] < columns) { 23121 ++refPos; 23122 23123 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23124 refPos += 2; 23125 } 23126 } 23127 23128 break; 23129 23130 case twoDimVertR1: 23131 this._addPixels(refLine[refPos] + 1, blackPixels); 23132 23133 blackPixels ^= 1; 23134 23135 if (codingLine[this.codingPos] < columns) { 23136 ++refPos; 23137 23138 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23139 refPos += 2; 23140 } 23141 } 23142 23143 break; 23144 23145 case twoDimVert0: 23146 this._addPixels(refLine[refPos], blackPixels); 23147 23148 blackPixels ^= 1; 23149 23150 if (codingLine[this.codingPos] < columns) { 23151 ++refPos; 23152 23153 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23154 refPos += 2; 23155 } 23156 } 23157 23158 break; 23159 23160 case twoDimVertL3: 23161 this._addPixelsNeg(refLine[refPos] - 3, blackPixels); 23162 23163 blackPixels ^= 1; 23164 23165 if (codingLine[this.codingPos] < columns) { 23166 if (refPos > 0) { 23167 --refPos; 23168 } else { 23169 ++refPos; 23170 } 23171 23172 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23173 refPos += 2; 23174 } 23175 } 23176 23177 break; 23178 23179 case twoDimVertL2: 23180 this._addPixelsNeg(refLine[refPos] - 2, blackPixels); 23181 23182 blackPixels ^= 1; 23183 23184 if (codingLine[this.codingPos] < columns) { 23185 if (refPos > 0) { 23186 --refPos; 23187 } else { 23188 ++refPos; 23189 } 23190 23191 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23192 refPos += 2; 23193 } 23194 } 23195 23196 break; 23197 23198 case twoDimVertL1: 23199 this._addPixelsNeg(refLine[refPos] - 1, blackPixels); 23200 23201 blackPixels ^= 1; 23202 23203 if (codingLine[this.codingPos] < columns) { 23204 if (refPos > 0) { 23205 --refPos; 23206 } else { 23207 ++refPos; 23208 } 23209 23210 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 23211 refPos += 2; 23212 } 23213 } 23214 23215 break; 23216 23217 case ccittEOF: 23218 this._addPixels(columns, 0); 23219 23220 this.eof = true; 23221 break; 23222 23223 default: 23224 (0, _util.info)("bad 2d code"); 23225 23226 this._addPixels(columns, 0); 23227 23228 this.err = true; 23229 } 23230 } 23231 } else { 23232 codingLine[0] = 0; 23233 this.codingPos = 0; 23234 blackPixels = 0; 23235 23236 while (codingLine[this.codingPos] < columns) { 23237 code1 = 0; 23238 23239 if (blackPixels) { 23240 do { 23241 code1 += code3 = this._getBlackCode(); 23242 } while (code3 >= 64); 23243 } else { 23244 do { 23245 code1 += code3 = this._getWhiteCode(); 23246 } while (code3 >= 64); 23247 } 23248 23249 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 23250 23251 blackPixels ^= 1; 23252 } 23253 } 23254 23255 let gotEOL = false; 23256 23257 if (this.byteAlign) { 23258 this.inputBits &= ~7; 23259 } 23260 23261 if (!this.eoblock && this.row === this.rows - 1) { 23262 this.rowsDone = true; 23263 } else { 23264 code1 = this._lookBits(12); 23265 23266 if (this.eoline) { 23267 while (code1 !== ccittEOF && code1 !== 1) { 23268 this._eatBits(1); 23269 23270 code1 = this._lookBits(12); 23271 } 23272 } else { 23273 while (code1 === 0) { 23274 this._eatBits(1); 23275 23276 code1 = this._lookBits(12); 23277 } 23278 } 23279 23280 if (code1 === 1) { 23281 this._eatBits(12); 23282 23283 gotEOL = true; 23284 } else if (code1 === ccittEOF) { 23285 this.eof = true; 23286 } 23287 } 23288 23289 if (!this.eof && this.encoding > 0 && !this.rowsDone) { 23290 this.nextLine2D = !this._lookBits(1); 23291 23292 this._eatBits(1); 23293 } 23294 23295 if (this.eoblock && gotEOL && this.byteAlign) { 23296 code1 = this._lookBits(12); 23297 23298 if (code1 === 1) { 23299 this._eatBits(12); 23300 23301 if (this.encoding > 0) { 23302 this._lookBits(1); 23303 23304 this._eatBits(1); 23305 } 23306 23307 if (this.encoding >= 0) { 23308 for (i = 0; i < 4; ++i) { 23309 code1 = this._lookBits(12); 23310 23311 if (code1 !== 1) { 23312 (0, _util.info)("bad rtc code: " + code1); 23313 } 23314 23315 this._eatBits(12); 23316 23317 if (this.encoding > 0) { 23318 this._lookBits(1); 23319 23320 this._eatBits(1); 23321 } 23322 } 23323 } 23324 23325 this.eof = true; 23326 } 23327 } else if (this.err && this.eoline) { 23328 while (true) { 23329 code1 = this._lookBits(13); 23330 23331 if (code1 === ccittEOF) { 23332 this.eof = true; 23333 return -1; 23334 } 23335 23336 if (code1 >> 1 === 1) { 23337 break; 23338 } 23339 23340 this._eatBits(1); 23341 } 23342 23343 this._eatBits(12); 23344 23345 if (this.encoding > 0) { 23346 this._eatBits(1); 23347 23348 this.nextLine2D = !(code1 & 1); 23349 } 23350 } 23351 23352 if (codingLine[0] > 0) {
23353 this.outputBits = codingLine[this.codingPos = 0]; 23354 } else { 23355 this.outputBits = codingLine[this.codingPos = 1]; 23356 } 23357 23358 this.row++; 23359 } 23360 23361 let c; 23362 23363 if (this.outputBits >= 8) { 23364 c = this.codingPos & 1 ? 0 : 0xff; 23365 this.outputBits -= 8; 23366 23367 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 23368 this.codingPos++; 23369 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 23370 } 23371 } else { 23372 bits = 8; 23373 c = 0; 23374 23375 do { 23376 if (this.outputBits > bits) { 23377 c <<= bits; 23378 23379 if (!(this.codingPos & 1)) { 23380 c |= 0xff >> 8 - bits; 23381 } 23382 23383 this.outputBits -= bits; 23384 bits = 0; 23385 } else { 23386 c <<= this.outputBits; 23387 23388 if (!(this.codingPos & 1)) { 23389 c |= 0xff >> 8 - this.outputBits; 23390 } 23391 23392 bits -= this.outputBits; 23393 this.outputBits = 0; 23394 23395 if (codingLine[this.codingPos] < columns) { 23396 this.codingPos++; 23397 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 23398 } else if (bits > 0) { 23399 c <<= bits; 23400 bits = 0; 23401 } 23402 } 23403 } while (bits); 23404 } 23405 23406 if (this.black) { 23407 c ^= 0xff; 23408 } 23409 23410 return c; 23411 }, 23412 23413 _addPixels(a1, blackPixels) { 23414 const codingLine = this.codingLine; 23415 let codingPos = this.codingPos; 23416 23417 if (a1 > codingLine[codingPos]) { 23418 if (a1 > this.columns) { 23419 (0, _util.info)("row is wrong length"); 23420 this.err = true; 23421 a1 = this.columns; 23422 } 23423 23424 if (codingPos & 1 ^ blackPixels) { 23425 ++codingPos; 23426 } 23427 23428 codingLine[codingPos] = a1; 23429 } 23430 23431 this.codingPos = codingPos; 23432 }, 23433 23434 _addPixelsNeg(a1, blackPixels) { 23435 const codingLine = this.codingLine; 23436 let codingPos = this.codingPos; 23437 23438 if (a1 > codingLine[codingPos]) { 23439 if (a1 > this.columns) { 23440 (0, _util.info)("row is wrong length"); 23441 this.err = true; 23442 a1 = this.columns; 23443 } 23444 23445 if (codingPos & 1 ^ blackPixels) { 23446 ++codingPos; 23447 } 23448 23449 codingLine[codingPos] = a1; 23450 } else if (a1 < codingLine[codingPos]) { 23451 if (a1 < 0) { 23452 (0, _util.info)("invalid code"); 23453 this.err = true; 23454 a1 = 0; 23455 } 23456 23457 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 23458 --codingPos; 23459 } 23460 23461 codingLine[codingPos] = a1; 23462 } 23463 23464 this.codingPos = codingPos; 23465 }, 23466 23467 _findTableCode(start, end, table, limit) { 23468 const limitValue = limit || 0; 23469 23470 for (let i = start; i <= end; ++i) { 23471 let code = this._lookBits(i); 23472 23473 if (code === ccittEOF) { 23474 return [true, 1, false]; 23475 } 23476 23477 if (i < end) { 23478 code <<= end - i; 23479 } 23480 23481 if (!limitValue || code >= limitValue) { 23482 const p = table[code - limitValue]; 23483 23484 if (p[0] === i) { 23485 this._eatBits(i); 23486 23487 return [true, p[1], true]; 23488 } 23489 } 23490 } 23491 23492 return [false, 0, false]; 23493 }, 23494 23495 _getTwoDimCode() { 23496 let code = 0; 23497 let p; 23498 23499 if (this.eoblock) { 23500 code = this._lookBits(7); 23501 p = twoDimTable[code]; 23502 23503 if (p && p[0] > 0) { 23504 this._eatBits(p[0]); 23505 23506 return p[1]; 23507 } 23508 } else { 23509 const result = this._findTableCode(1, 7, twoDimTable); 23510 23511 if (result[0] && result[2]) { 23512 return result[1]; 23513 } 23514 } 23515 23516 (0, _util.info)("Bad two dim code"); 23517 return ccittEOF; 23518 }, 23519 23520 _getWhiteCode() { 23521 let code = 0; 23522 let p; 23523 23524 if (this.eoblock) { 23525 code = this._lookBits(12); 23526 23527 if (code === ccittEOF) { 23528 return 1; 23529 } 23530 23531 if (code >> 5 === 0) { 23532 p = whiteTable1[code]; 23533 } else { 23534 p = whiteTable2[code >> 3]; 23535 } 23536 23537 if (p[0] > 0) { 23538 this._eatBits(p[0]); 23539 23540 return p[1]; 23541 } 23542 } else { 23543 let result = this._findTableCode(1, 9, whiteTable2); 23544 23545 if (result[0]) { 23546 return result[1]; 23547 } 23548 23549 result = this._findTableCode(11, 12, whiteTable1); 23550 23551 if (result[0]) { 23552 return result[1]; 23553 } 23554 } 23555 23556 (0, _util.info)("bad white code"); 23557 23558 this._eatBits(1); 23559 23560 return 1; 23561 }, 23562 23563 _getBlackCode() { 23564 let code, p; 23565 23566 if (this.eoblock) { 23567 code = this._lookBits(13); 23568 23569 if (code === ccittEOF) { 23570 return 1; 23571 } 23572 23573 if (code >> 7 === 0) { 23574 p = blackTable1[code]; 23575 } else if (code >> 9 === 0 && code >> 7 !== 0) { 23576 p = blackTable2[(code >> 1) - 64]; 23577 } else { 23578 p = blackTable3[code >> 7]; 23579 } 23580 23581 if (p[0] > 0) { 23582 this._eatBits(p[0]); 23583 23584 return p[1]; 23585 } 23586 } else { 23587 let result = this._findTableCode(2, 6, blackTable3); 23588 23589 if (result[0]) { 23590 return result[1]; 23591 } 23592 23593 result = this._findTableCode(7, 12, blackTable2, 64); 23594 23595 if (result[0]) { 23596 return result[1]; 23597 } 23598 23599 result = this._findTableCode(10, 13, blackTable1); 23600 23601 if (result[0]) { 23602 return result[1]; 23603 } 23604 } 23605 23606 (0, _util.info)("bad black code"); 23607 23608 this._eatBits(1); 23609 23610 return 1; 23611 }, 23612 23613 _lookBits(n) { 23614 let c; 23615 23616 while (this.inputBits < n) { 23617 if ((c = this.source.next()) === -1) { 23618 if (this.inputBits === 0) { 23619 return ccittEOF; 23620 } 23621 23622 return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n; 23623 } 23624 23625 this.inputBuf = this.inputBuf << 8 | c; 23626 this.inputBits += 8; 23627 } 23628 23629 return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n; 23630 }, 23631 23632 _eatBits(n) { 23633 if ((this.inputBits -= n) < 0) { 23634 this.inputBits = 0; 23635 } 23636 } 23637 23638 }; 23639 return CCITTFaxDecoder; 23640}(); 23641 23642exports.CCITTFaxDecoder = CCITTFaxDecoder; 23643 23644/***/ }), 23645/* 15 */ 23646/***/ (function(module, exports, __w_pdfjs_require__) { 23647 23648"use strict"; 23649 23650 23651Object.defineProperty(exports, "__esModule", { 23652 value: true 23653}); 23654exports.Jbig2Stream = void 0; 23655 23656var _primitives = __w_pdfjs_require__(5); 23657 23658var _stream = __w_pdfjs_require__(12); 23659 23660var _jbig = __w_pdfjs_require__(16); 23661 23662var _util = __w_pdfjs_require__(2); 23663 23664const Jbig2Stream = function Jbig2StreamClosure() { 23665 function Jbig2Stream(stream, maybeLength, dict, params) { 23666 this.stream = stream; 23667 this.maybeLength = maybeLength; 23668 this.dict = dict; 23669 this.params = params; 23670 23671 _stream.DecodeStream.call(this, maybeLength); 23672 } 23673 23674 Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype); 23675 Object.defineProperty(Jbig2Stream.prototype, "bytes", { 23676 get() { 23677 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 23678 }, 23679 23680 configurable: true 23681 }); 23682 23683 Jbig2Stream.prototype.ensureBuffer = function (requested) {}; 23684 23685 Jbig2Stream.prototype.readBlock = function () { 23686 if (this.eof) { 23687 return; 23688 } 23689 23690 const jbig2Image = new _jbig.Jbig2Image(); 23691 const chunks = []; 23692 23693 if ((0, _primitives.isDict)(this.params)) { 23694 const globalsStream = this.params.get("JBIG2Globals"); 23695 23696 if ((0, _primitives.isStream)(globalsStream)) { 23697 const globals = globalsStream.getBytes(); 23698 chunks.push({ 23699 data: globals, 23700 start: 0, 23701 end: globals.length 23702 }); 23703 } 23704 } 23705 23706 chunks.push({ 23707 data: this.bytes, 23708 start: 0, 23709 end: this.bytes.length 23710 }); 23711 const data = jbig2Image.parseChunks(chunks); 23712 const dataLength = data.length; 23713 23714 for (let i = 0; i < dataLength; i++) { 23715 data[i] ^= 0xff; 23716 } 23717 23718 this.buffer = data; 23719 this.bufferLength = dataLength; 23720 this.eof = true; 23721 }; 23722 23723 return Jbig2Stream; 23724}(); 23725 23726exports.Jbig2Stream = Jbig2Stream; 23727 23728/***/ }), 23729/* 16 */ 23730/***/ (function(module, exports, __w_pdfjs_require__) { 23731 23732"use strict"; 23733 23734 23735Object.defineProperty(exports, "__esModule", { 23736 value: true 23737}); 23738exports.Jbig2Image = void 0; 23739 23740var _util = __w_pdfjs_require__(2); 23741 23742var _core_utils = __w_pdfjs_require__(8); 23743 23744var _arithmetic_decoder = __w_pdfjs_require__(17); 23745 23746var _ccitt = __w_pdfjs_require__(14); 23747 23748class Jbig2Error extends _util.BaseException { 23749 constructor(msg) { 23750 super(`JBIG2 error: ${msg}`); 23751 } 23752 23753} 23754 23755var Jbig2Image = function Jbig2ImageClosure() { 23756 function ContextCache() {} 23757 23758 ContextCache.prototype = { 23759 getContexts(id) { 23760 if (id in this) { 23761 return this[id]; 23762 } 23763 23764 return this[id] = new Int8Array(1 << 16); 23765 } 23766 23767 }; 23768 23769 function DecodingContext(data, start, end) { 23770 this.data = data; 23771 this.start = start; 23772 this.end = end; 23773 } 23774 23775 DecodingContext.prototype = { 23776 get decoder() { 23777 var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end); 23778 return (0, _util.shadow)(this, "decoder", decoder); 23779 }, 23780 23781 get contextCache() { 23782 var cache = new ContextCache(); 23783 return (0, _util.shadow)(this, "contextCache", cache); 23784 } 23785 23786 }; 23787 23788 function decodeInteger(contextCache, procedure, decoder) { 23789 var contexts = contextCache.getContexts(procedure); 23790 var prev = 1; 23791 23792 function readBits(length) { 23793 var v = 0; 23794 23795 for (var i = 0; i < length; i++) { 23796 var bit = decoder.readBit(contexts, prev); 23797 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 23798 v = v << 1 | bit; 23799 } 23800 23801 return v >>> 0; 23802 } 23803 23804 var sign = readBits(1); 23805 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); 23806 23807 if (sign === 0) { 23808 return value; 23809 } else if (value > 0) { 23810 return -value; 23811 } 23812 23813 return null; 23814 } 23815
vendor: 7,274 bytes, lines 23816-24153
23816 function decodeIAID(contextCache, decoder, codeLength) { 23817 var contexts = contextCache.getContexts("IAID"); 23818 var prev = 1; 23819 23820 for (var i = 0; i < codeLength; i++) { 23821 var bit = decoder.readBit(contexts, prev); 23822 prev = prev << 1 | bit; 23823 } 23824 23825 if (codeLength < 31) { 23826 return prev & (1 << codeLength) - 1; 23827 } 23828 23829 return prev & 0x7fffffff; 23830 } 23831 23832 var SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"]; 23833 var CodingTemplates = [[{ 23834 x: -1, 23835 y: -2 23836 }, { 23837 x: 0, 23838 y: -2 23839 }, { 23840 x: 1, 23841 y: -2 23842 }, { 23843 x: -2, 23844 y: -1 23845 }, { 23846 x: -1, 23847 y: -1 23848 }, { 23849 x: 0, 23850 y: -1 23851 }, { 23852 x: 1, 23853 y: -1 23854 }, { 23855 x: 2, 23856 y: -1 23857 }, { 23858 x: -4, 23859 y: 0 23860 }, { 23861 x: -3, 23862 y: 0 23863 }, { 23864 x: -2, 23865 y: 0 23866 }, { 23867 x: -1, 23868 y: 0 23869 }], [{ 23870 x: -1, 23871 y: -2 23872 }, { 23873 x: 0, 23874 y: -2 23875 }, { 23876 x: 1, 23877 y: -2 23878 }, { 23879 x: 2, 23880 y: -2 23881 }, { 23882 x: -2, 23883 y: -1 23884 }, { 23885 x: -1, 23886 y: -1 23887 }, { 23888 x: 0, 23889 y: -1 23890 }, { 23891 x: 1, 23892 y: -1 23893 }, { 23894 x: 2, 23895 y: -1 23896 }, { 23897 x: -3, 23898 y: 0 23899 }, { 23900 x: -2, 23901 y: 0 23902 }, { 23903 x: -1, 23904 y: 0 23905 }], [{ 23906 x: -1, 23907 y: -2 23908 }, { 23909 x: 0, 23910 y: -2 23911 }, { 23912 x: 1, 23913 y: -2 23914 }, { 23915 x: -2, 23916 y: -1 23917 }, { 23918 x: -1, 23919 y: -1 23920 }, { 23921 x: 0, 23922 y: -1 23923 }, { 23924 x: 1, 23925 y: -1 23926 }, { 23927 x: -2, 23928 y: 0 23929 }, { 23930 x: -1, 23931 y: 0 23932 }], [{ 23933 x: -3, 23934 y: -1 23935 }, { 23936 x: -2, 23937 y: -1 23938 }, { 23939 x: -1, 23940 y: -1 23941 }, { 23942 x: 0, 23943 y: -1 23944 }, { 23945 x: 1, 23946 y: -1 23947 }, { 23948 x: -4, 23949 y: 0 23950 }, { 23951 x: -3, 23952 y: 0 23953 }, { 23954 x: -2, 23955 y: 0 23956 }, { 23957 x: -1, 23958 y: 0 23959 }]]; 23960 var RefinementTemplates = [{ 23961 coding: [{ 23962 x: 0, 23963 y: -1 23964 }, { 23965 x: 1, 23966 y: -1 23967 }, { 23968 x: -1, 23969 y: 0 23970 }], 23971 reference: [{ 23972 x: 0, 23973 y: -1 23974 }, { 23975 x: 1, 23976 y: -1 23977 }, { 23978 x: -1, 23979 y: 0 23980 }, { 23981 x: 0, 23982 y: 0 23983 }, { 23984 x: 1, 23985 y: 0 23986 }, { 23987 x: -1, 23988 y: 1 23989 }, { 23990 x: 0, 23991 y: 1 23992 }, { 23993 x: 1, 23994 y: 1 23995 }] 23996 }, { 23997 coding: [{ 23998 x: -1, 23999 y: -1 24000 }, { 24001 x: 0, 24002 y: -1 24003 }, { 24004 x: 1, 24005 y: -1 24006 }, { 24007 x: -1, 24008 y: 0 24009 }], 24010 reference: [{ 24011 x: 0, 24012 y: -1 24013 }, { 24014 x: -1, 24015 y: 0 24016 }, { 24017 x: 0, 24018 y: 0 24019 }, { 24020 x: 1, 24021 y: 0 24022 }, { 24023 x: 0, 24024 y: 1 24025 }, { 24026 x: 1, 24027 y: 1 24028 }] 24029 }]; 24030 var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195]; 24031 var RefinementReusedContexts = [0x0020, 0x0008]; 24032 24033 function decodeBitmapTemplate0(width, height, decodingContext) { 24034 var decoder = decodingContext.decoder; 24035 var contexts = decodingContext.contextCache.getContexts("GB"); 24036 var contextLabel, 24037 i, 24038 j, 24039 pixel, 24040 row, 24041 row1, 24042 row2, 24043 bitmap = []; 24044 var OLD_PIXEL_MASK = 0x7bf7; 24045 24046 for (i = 0; i < height; i++) { 24047 row = bitmap[i] = new Uint8Array(width); 24048 row1 = i < 1 ? row : bitmap[i - 1]; 24049 row2 = i < 2 ? row : bitmap[i - 2]; 24050 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 24051 24052 for (j = 0; j < width; j++) { 24053 row[j] = pixel = decoder.readBit(contexts, contextLabel); 24054 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 24055 } 24056 } 24057 24058 return bitmap; 24059 } 24060 24061 function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 24062 if (mmr) { 24063 const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 24064 return decodeMMRBitmap(input, width, height, false); 24065 } 24066 24067 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) { 24068 return decodeBitmapTemplate0(width, height, decodingContext); 24069 } 24070 24071 var useskip = !!skip; 24072 var template = CodingTemplates[templateIndex].concat(at); 24073 template.sort(function (a, b) { 24074 return a.y - b.y || a.x - b.x; 24075 }); 24076 var templateLength = template.length; 24077 var templateX = new Int8Array(templateLength); 24078 var templateY = new Int8Array(templateLength); 24079 var changingTemplateEntries = []; 24080 var reuseMask = 0, 24081 minX = 0, 24082 maxX = 0, 24083 minY = 0; 24084 var c, k; 24085 24086 for (k = 0; k < templateLength; k++) { 24087 templateX[k] = template[k].x; 24088 templateY[k] = template[k].y; 24089 minX = Math.min(minX, template[k].x); 24090 maxX = Math.max(maxX, template[k].x); 24091 minY = Math.min(minY, template[k].y); 24092 24093 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 24094 reuseMask |= 1 << templateLength - 1 - k; 24095 } else { 24096 changingTemplateEntries.push(k); 24097 } 24098 } 24099 24100 var changingEntriesLength = changingTemplateEntries.length; 24101 var changingTemplateX = new Int8Array(changingEntriesLength); 24102 var changingTemplateY = new Int8Array(changingEntriesLength); 24103 var changingTemplateBit = new Uint16Array(changingEntriesLength); 24104 24105 for (c = 0; c < changingEntriesLength; c++) { 24106 k = changingTemplateEntries[c]; 24107 changingTemplateX[c] = template[k].x; 24108 changingTemplateY[c] = template[k].y; 24109 changingTemplateBit[c] = 1 << templateLength - 1 - k; 24110 } 24111 24112 var sbb_left = -minX; 24113 var sbb_top = -minY; 24114 var sbb_right = width - maxX; 24115 var pseudoPixelContext = ReusedContexts[templateIndex]; 24116 var row = new Uint8Array(width); 24117 var bitmap = []; 24118 var decoder = decodingContext.decoder; 24119 var contexts = decodingContext.contextCache.getContexts("GB"); 24120 var ltp = 0, 24121 j, 24122 i0, 24123 j0, 24124 contextLabel = 0, 24125 bit, 24126 shift; 24127 24128 for (var i = 0; i < height; i++) { 24129 if (prediction) { 24130 var sltp = decoder.readBit(contexts, pseudoPixelContext); 24131 ltp ^= sltp; 24132 24133 if (ltp) { 24134 bitmap.push(row); 24135 continue; 24136 } 24137 } 24138 24139 row = new Uint8Array(row); 24140 bitmap.push(row); 24141 24142 for (j = 0; j < width; j++) { 24143 if (useskip && skip[i][j]) { 24144 row[j] = 0; 24145 continue; 24146 } 24147 24148 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 24149 contextLabel = contextLabel << 1 & reuseMask; 24150 24151 for (k = 0; k < changingEntriesLength; k++) { 24152 i0 = i + changingTemplateY[k]; 24153 j0 = j + changingTemplateX[k];
24154 bit = bitmap[i0][j0]; 24155 24156 if (bit) { 24157 bit = changingTemplateBit[k]; 24158 contextLabel |= bit; 24159 } 24160 } 24161 } else { 24162 contextLabel = 0; 24163 shift = templateLength - 1; 24164 24165 for (k = 0; k < templateLength; k++, shift--) { 24166 j0 = j + templateX[k]; 24167 24168 if (j0 >= 0 && j0 < width) { 24169 i0 = i + templateY[k]; 24170 24171 if (i0 >= 0) { 24172 bit = bitmap[i0][j0]; 24173 24174 if (bit) { 24175 contextLabel |= bit << shift; 24176 } 24177 } 24178 } 24179 } 24180 } 24181 24182 var pixel = decoder.readBit(contexts, contextLabel); 24183 row[j] = pixel; 24184 } 24185 } 24186 24187 return bitmap; 24188 } 24189 24190 function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 24191 var codingTemplate = RefinementTemplates[templateIndex].coding; 24192 24193 if (templateIndex === 0) { 24194 codingTemplate = codingTemplate.concat([at[0]]); 24195 } 24196 24197 var codingTemplateLength = codingTemplate.length; 24198 var codingTemplateX = new Int32Array(codingTemplateLength); 24199 var codingTemplateY = new Int32Array(codingTemplateLength); 24200 var k; 24201 24202 for (k = 0; k < codingTemplateLength; k++) { 24203 codingTemplateX[k] = codingTemplate[k].x; 24204 codingTemplateY[k] = codingTemplate[k].y; 24205 } 24206 24207 var referenceTemplate = RefinementTemplates[templateIndex].reference; 24208 24209 if (templateIndex === 0) { 24210 referenceTemplate = referenceTemplate.concat([at[1]]); 24211 } 24212 24213 var referenceTemplateLength = referenceTemplate.length; 24214 var referenceTemplateX = new Int32Array(referenceTemplateLength); 24215 var referenceTemplateY = new Int32Array(referenceTemplateLength); 24216 24217 for (k = 0; k < referenceTemplateLength; k++) { 24218 referenceTemplateX[k] = referenceTemplate[k].x; 24219 referenceTemplateY[k] = referenceTemplate[k].y; 24220 } 24221 24222 var referenceWidth = referenceBitmap[0].length; 24223 var referenceHeight = referenceBitmap.length; 24224 var pseudoPixelContext = RefinementReusedContexts[templateIndex]; 24225 var bitmap = []; 24226 var decoder = decodingContext.decoder; 24227 var contexts = decodingContext.contextCache.getContexts("GR"); 24228 var ltp = 0; 24229 24230 for (var i = 0; i < height; i++) { 24231 if (prediction) { 24232 var sltp = decoder.readBit(contexts, pseudoPixelContext); 24233 ltp ^= sltp; 24234 24235 if (ltp) { 24236 throw new Jbig2Error("prediction is not supported"); 24237 } 24238 } 24239 24240 var row = new Uint8Array(width); 24241 bitmap.push(row); 24242 24243 for (var j = 0; j < width; j++) { 24244 var i0, j0; 24245 var contextLabel = 0; 24246 24247 for (k = 0; k < codingTemplateLength; k++) { 24248 i0 = i + codingTemplateY[k]; 24249 j0 = j + codingTemplateX[k]; 24250 24251 if (i0 < 0 || j0 < 0 || j0 >= width) { 24252 contextLabel <<= 1; 24253 } else { 24254 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 24255 } 24256 } 24257 24258 for (k = 0; k < referenceTemplateLength; k++) { 24259 i0 = i + referenceTemplateY[k] - offsetY; 24260 j0 = j + referenceTemplateX[k] - offsetX; 24261 24262 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 24263 contextLabel <<= 1; 24264 } else { 24265 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 24266 } 24267 } 24268 24269 var pixel = decoder.readBit(contexts, contextLabel); 24270 row[j] = pixel; 24271 } 24272 } 24273 24274 return bitmap; 24275 } 24276 24277 function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) { 24278 if (huffman && refinement) { 24279 throw new Jbig2Error("symbol refinement with Huffman is not supported"); 24280 } 24281 24282 var newSymbols = []; 24283 var currentHeight = 0; 24284 var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols); 24285 var decoder = decodingContext.decoder; 24286 var contextCache = decodingContext.contextCache;
24287 let tableB1, symbolWidths; 24288 24289 if (huffman) { 24290 tableB1 = getStandardTable(1); 24291 symbolWidths = []; 24292 symbolCodeLength = Math.max(symbolCodeLength, 1); 24293 } 24294 24295 while (newSymbols.length < numberOfNewSymbols) { 24296 var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder); 24297 currentHeight += deltaHeight; 24298 let currentWidth = 0, 24299 totalWidth = 0; 24300 const firstSymbol = huffman ? symbolWidths.length : 0; 24301 24302 while (true) { 24303 var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder); 24304 24305 if (deltaWidth === null) { 24306 break; 24307 } 24308 24309 currentWidth += deltaWidth; 24310 totalWidth += currentWidth; 24311 var bitmap; 24312 24313 if (refinement) { 24314 var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder); 24315 24316 if (numberOfInstances > 1) { 24317 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput); 24318 } else { 24319 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 24320 var rdx = decodeInteger(contextCache, "IARDX", decoder); 24321 var rdy = decodeInteger(contextCache, "IARDY", decoder); 24322 var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 24323 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 24324 } 24325 24326 newSymbols.push(bitmap); 24327 } else if (huffman) { 24328 symbolWidths.push(currentWidth); 24329 } else { 24330 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 24331 newSymbols.push(bitmap); 24332 } 24333 } 24334 24335 if (huffman && !refinement) { 24336 const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput); 24337 huffmanInput.byteAlign(); 24338 let collectiveBitmap; 24339 24340 if (bitmapSize === 0) { 24341 collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight); 24342 } else { 24343 const originalEnd = huffmanInput.end; 24344 const bitmapEnd = huffmanInput.position + bitmapSize; 24345 huffmanInput.end = bitmapEnd; 24346 collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false); 24347 huffmanInput.end = originalEnd; 24348 huffmanInput.position = bitmapEnd; 24349 } 24350 24351 const numberOfSymbolsDecoded = symbolWidths.length; 24352 24353 if (firstSymbol === numberOfSymbolsDecoded - 1) { 24354 newSymbols.push(collectiveBitmap); 24355 } else { 24356 let i, 24357 y, 24358 xMin = 0, 24359 xMax, 24360 bitmapWidth, 24361 symbolBitmap; 24362 24363 for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) { 24364 bitmapWidth = symbolWidths[i]; 24365 xMax = xMin + bitmapWidth; 24366 symbolBitmap = []; 24367 24368 for (y = 0; y < currentHeight; y++) { 24369 symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 24370 } 24371 24372 newSymbols.push(symbolBitmap); 24373 xMin = xMax; 24374 } 24375 } 24376 } 24377 } 24378 24379 var exportedSymbols = []; 24380 var flags = [], 24381 currentFlag = false; 24382 var totalSymbolsLength = symbols.length + numberOfNewSymbols; 24383 24384 while (flags.length < totalSymbolsLength) { 24385 var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder); 24386 24387 while (runLength--) { 24388 flags.push(currentFlag); 24389 } 24390 24391 currentFlag = !currentFlag; 24392 } 24393 24394 for (var i = 0, ii = symbols.length; i < ii; i++) { 24395 if (flags[i]) { 24396 exportedSymbols.push(symbols[i]); 24397 } 24398 } 24399 24400 for (var j = 0; j < numberOfNewSymbols; i++, j++) { 24401 if (flags[i]) { 24402 exportedSymbols.push(newSymbols[j]); 24403 } 24404 } 24405 24406 return exportedSymbols; 24407 } 24408 24409 function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) { 24410 if (huffman && refinement) { 24411 throw new Jbig2Error("refinement with Huffman is not supported"); 24412 } 24413 24414 var bitmap = []; 24415 var i, row; 24416 24417 for (i = 0; i < height; i++) { 24418 row = new Uint8Array(width); 24419 24420 if (defaultPixelValue) { 24421 for (var j = 0; j < width; j++) { 24422 row[j] = defaultPixelValue; 24423 } 24424 } 24425 24426 bitmap.push(row); 24427 } 24428 24429 var decoder = decodingContext.decoder; 24430 var contextCache = decodingContext.contextCache; 24431 var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder); 24432 var firstS = 0; 24433 i = 0; 24434 24435 while (i < numberOfSymbolInstances) { 24436 var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
24437 stripT += deltaT; 24438 var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder); 24439 firstS += deltaFirstS; 24440 var currentS = firstS; 24441 24442 do { 24443 let currentT = 0; 24444 24445 if (stripSize > 1) { 24446 currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder); 24447 } 24448 24449 var t = stripSize * stripT + currentT; 24450 var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength); 24451 var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder)); 24452 var symbolBitmap = inputSymbols[symbolId]; 24453 var symbolWidth = symbolBitmap[0].length; 24454 var symbolHeight = symbolBitmap.length; 24455 24456 if (applyRefinement) { 24457 var rdw = decodeInteger(contextCache, "IARDW", decoder); 24458 var rdh = decodeInteger(contextCache, "IARDH", decoder); 24459 var rdx = decodeInteger(contextCache, "IARDX", decoder); 24460 var rdy = decodeInteger(contextCache, "IARDY", decoder); 24461 symbolWidth += rdw; 24462 symbolHeight += rdh; 24463 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 24464 } 24465 24466 var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1); 24467 var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0); 24468 var s2, t2, symbolRow; 24469 24470 if (transposed) { 24471 for (s2 = 0; s2 < symbolHeight; s2++) { 24472 row = bitmap[offsetS + s2]; 24473 24474 if (!row) { 24475 continue; 24476 } 24477 24478 symbolRow = symbolBitmap[s2]; 24479 var maxWidth = Math.min(width - offsetT, symbolWidth); 24480 24481 switch (combinationOperator) { 24482 case 0: 24483 for (t2 = 0; t2 < maxWidth; t2++) { 24484 row[offsetT + t2] |= symbolRow[t2]; 24485 } 24486 24487 break; 24488 24489 case 2: 24490 for (t2 = 0; t2 < maxWidth; t2++) { 24491 row[offsetT + t2] ^= symbolRow[t2]; 24492 } 24493 24494 break; 24495 24496 default: 24497 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 24498 } 24499 } 24500 24501 currentS += symbolHeight - 1; 24502 } else { 24503 for (t2 = 0; t2 < symbolHeight; t2++) { 24504 row = bitmap[offsetT + t2]; 24505 24506 if (!row) { 24507 continue; 24508 } 24509 24510 symbolRow = symbolBitmap[t2]; 24511 24512 switch (combinationOperator) { 24513 case 0: 24514 for (s2 = 0; s2 < symbolWidth; s2++) { 24515 row[offsetS + s2] |= symbolRow[s2]; 24516 } 24517 24518 break; 24519 24520 case 2: 24521 for (s2 = 0; s2 < symbolWidth; s2++) { 24522 row[offsetS + s2] ^= symbolRow[s2]; 24523 } 24524 24525 break; 24526 24527 default: 24528 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 24529 } 24530 } 24531 24532 currentS += symbolWidth - 1; 24533 } 24534 24535 i++; 24536 var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder); 24537 24538 if (deltaS === null) { 24539 break; 24540 } 24541 24542 currentS += deltaS + dsOffset; 24543 } while (true); 24544 } 24545 24546 return bitmap; 24547 } 24548 24549 function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) { 24550 const at = []; 24551 24552 if (!mmr) { 24553 at.push({ 24554 x: -patternWidth, 24555 y: 0 24556 }); 24557 24558 if (template === 0) { 24559 at.push({ 24560 x: -3, 24561 y: -1 24562 }); 24563 at.push({ 24564 x: 2, 24565 y: -2 24566 }); 24567 at.push({ 24568 x: -2, 24569 y: -2 24570 }); 24571 } 24572 } 24573 24574 const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
24575 const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext); 24576 const patterns = []; 24577 24578 for (let i = 0; i <= maxPatternIndex; i++) { 24579 const patternBitmap = []; 24580 const xMin = patternWidth * i; 24581 const xMax = xMin + patternWidth; 24582 24583 for (let y = 0; y < patternHeight; y++) { 24584 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 24585 } 24586 24587 patterns.push(patternBitmap); 24588 } 24589 24590 return patterns; 24591 } 24592 24593 function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) { 24594 const skip = null; 24595 24596 if (enableSkip) { 24597 throw new Jbig2Error("skip is not supported"); 24598 } 24599 24600 if (combinationOperator !== 0) { 24601 throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region"); 24602 } 24603 24604 const regionBitmap = []; 24605 let i, j, row; 24606 24607 for (i = 0; i < regionHeight; i++) { 24608 row = new Uint8Array(regionWidth); 24609 24610 if (defaultPixelValue) { 24611 for (j = 0; j < regionWidth; j++) { 24612 row[j] = defaultPixelValue; 24613 } 24614 } 24615 24616 regionBitmap.push(row); 24617 } 24618 24619 const numberOfPatterns = patterns.length; 24620 const pattern0 = patterns[0]; 24621 const patternWidth = pattern0[0].length, 24622 patternHeight = pattern0.length; 24623 const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns); 24624 const at = []; 24625 24626 if (!mmr) { 24627 at.push({ 24628 x: template <= 1 ? 3 : 2, 24629 y: -1 24630 }); 24631 24632 if (template === 0) { 24633 at.push({ 24634 x: -3, 24635 y: -1 24636 }); 24637 at.push({ 24638 x: 2, 24639 y: -2 24640 }); 24641 at.push({ 24642 x: -2, 24643 y: -2 24644 }); 24645 } 24646 } 24647 24648 const grayScaleBitPlanes = []; 24649 let mmrInput, bitmap; 24650 24651 if (mmr) { 24652 mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 24653 } 24654 24655 for (i = bitsPerValue - 1; i >= 0; i--) { 24656 if (mmr) { 24657 bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true); 24658 } else { 24659 bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext); 24660 } 24661 24662 grayScaleBitPlanes[i] = bitmap; 24663 } 24664 24665 let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow; 24666 24667 for (mg = 0; mg < gridHeight; mg++) { 24668 for (ng = 0; ng < gridWidth; ng++) { 24669 bit = 0; 24670 patternIndex = 0; 24671 24672 for (j = bitsPerValue - 1; j >= 0; j--) { 24673 bit = grayScaleBitPlanes[j][mg][ng] ^ bit; 24674 patternIndex |= bit << j; 24675 } 24676 24677 patternBitmap = patterns[patternIndex]; 24678 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8; 24679 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8; 24680 24681 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) { 24682 for (i = 0; i < patternHeight; i++) { 24683 regionRow = regionBitmap[y + i]; 24684 patternRow = patternBitmap[i]; 24685 24686 for (j = 0; j < patternWidth; j++) { 24687 regionRow[x + j] |= patternRow[j]; 24688 } 24689 } 24690 } else { 24691 let regionX, regionY; 24692 24693 for (i = 0; i < patternHeight; i++) { 24694 regionY = y + i; 24695 24696 if (regionY < 0 || regionY >= regionHeight) { 24697 continue; 24698 } 24699 24700 regionRow = regionBitmap[regionY]; 24701 patternRow = patternBitmap[i]; 24702 24703 for (j = 0; j < patternWidth; j++) { 24704 regionX = x + j; 24705 24706 if (regionX >= 0 && regionX < regionWidth) { 24707 regionRow[regionX] |= patternRow[j]; 24708 } 24709 } 24710 } 24711 } 24712 } 24713 } 24714 24715 return regionBitmap; 24716 } 24717 24718 function readSegmentHeader(data, start) { 24719 var segmentHeader = {}; 24720 segmentHeader.number = (0, _core_utils.readUint32)(data, start); 24721 var flags = data[start + 4]; 24722 var segmentType = flags & 0x3f; 24723 24724 if (!SegmentTypes[segmentType]) { 24725 throw new Jbig2Error("invalid segment type: " + segmentType); 24726 } 24727 24728 segmentHeader.type = segmentType; 24729 segmentHeader.typeName = SegmentTypes[segmentType]; 24730 segmentHeader.deferredNonRetain = !!(flags & 0x80); 24731 var pageAssociationFieldSize = !!(flags & 0x40); 24732 var referredFlags = data[start + 5]; 24733 var referredToCount = referredFlags >> 5 & 7; 24734 var retainBits = [referredFlags & 31]; 24735 var position = start + 6; 24736 24737 if (referredFlags === 7) { 24738 referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff; 24739 position += 3; 24740 var bytes = referredToCount + 7 >> 3; 24741 retainBits[0] = data[position++]; 24742 24743 while (--bytes > 0) { 24744 retainBits.push(data[position++]); 24745 } 24746 } else if (referredFlags === 5 || referredFlags === 6) { 24747 throw new Jbig2Error("invalid referred-to flags"); 24748 } 24749 24750 segmentHeader.retainBits = retainBits; 24751 let referredToSegmentNumberSize = 4; 24752 24753 if (segmentHeader.number <= 256) { 24754 referredToSegmentNumberSize = 1; 24755 } else if (segmentHeader.number <= 65536) { 24756 referredToSegmentNumberSize = 2; 24757 } 24758 24759 var referredTo = []; 24760 var i, ii; 24761 24762 for (i = 0; i < referredToCount; i++) { 24763 let number; 24764 24765 if (referredToSegmentNumberSize === 1) { 24766 number = data[position]; 24767 } else if (referredToSegmentNumberSize === 2) { 24768 number = (0, _core_utils.readUint16)(data, position); 24769 } else { 24770 number = (0, _core_utils.readUint32)(data, position); 24771 } 24772 24773 referredTo.push(number); 24774 position += referredToSegmentNumberSize; 24775 } 24776 24777 segmentHeader.referredTo = referredTo; 24778 24779 if (!pageAssociationFieldSize) { 24780 segmentHeader.pageAssociation = data[position++]; 24781 } else { 24782 segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position); 24783 position += 4; 24784 } 24785 24786 segmentHeader.length = (0, _core_utils.readUint32)(data, position); 24787 position += 4; 24788 24789 if (segmentHeader.length === 0xffffffff) { 24790 if (segmentType === 38) { 24791 var genericRegionInfo = readRegionSegmentInformation(data, position); 24792 var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 24793 var genericRegionMmr = !!(genericRegionSegmentFlags & 1); 24794 var searchPatternLength = 6; 24795 var searchPattern = new Uint8Array(searchPatternLength); 24796 24797 if (!genericRegionMmr) { 24798 searchPattern[0] = 0xff; 24799 searchPattern[1] = 0xac; 24800 } 24801 24802 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff; 24803 searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
24804 searchPattern[4] = genericRegionInfo.height >> 8 & 0xff; 24805 searchPattern[5] = genericRegionInfo.height & 0xff; 24806 24807 for (i = position, ii = data.length; i < ii; i++) { 24808 var j = 0; 24809 24810 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 24811 j++; 24812 } 24813 24814 if (j === searchPatternLength) { 24815 segmentHeader.length = i + searchPatternLength; 24816 break; 24817 } 24818 } 24819 24820 if (segmentHeader.length === 0xffffffff) { 24821 throw new Jbig2Error("segment end was not found"); 24822 } 24823 } else { 24824 throw new Jbig2Error("invalid unknown segment length"); 24825 } 24826 } 24827 24828 segmentHeader.headerEnd = position; 24829 return segmentHeader; 24830 } 24831 24832 function readSegments(header, data, start, end) { 24833 var segments = []; 24834 var position = start; 24835 24836 while (position < end) { 24837 var segmentHeader = readSegmentHeader(data, position); 24838 position = segmentHeader.headerEnd; 24839 var segment = { 24840 header: segmentHeader, 24841 data 24842 }; 24843 24844 if (!header.randomAccess) { 24845 segment.start = position; 24846 position += segmentHeader.length; 24847 segment.end = position; 24848 } 24849 24850 segments.push(segment); 24851 24852 if (segmentHeader.type === 51) { 24853 break; 24854 } 24855 } 24856 24857 if (header.randomAccess) { 24858 for (var i = 0, ii = segments.length; i < ii; i++) { 24859 segments[i].start = position; 24860 position += segments[i].header.length; 24861 segments[i].end = position; 24862 } 24863 } 24864 24865 return segments; 24866 } 24867 24868 function readRegionSegmentInformation(data, start) { 24869 return { 24870 width: (0, _core_utils.readUint32)(data, start), 24871 height: (0, _core_utils.readUint32)(data, start + 4), 24872 x: (0, _core_utils.readUint32)(data, start + 8), 24873 y: (0, _core_utils.readUint32)(data, start + 12), 24874 combinationOperator: data[start + 16] & 7 24875 }; 24876 } 24877 24878 var RegionSegmentInformationFieldLength = 17; 24879 24880 function processSegment(segment, visitor) { 24881 var header = segment.header; 24882 var data = segment.data, 24883 position = segment.start, 24884 end = segment.end; 24885 var args, at, i, atLength; 24886 24887 switch (header.type) { 24888 case 0: 24889 var dictionary = {}; 24890 var dictionaryFlags = (0, _core_utils.readUint16)(data, position); 24891 dictionary.huffman = !!(dictionaryFlags & 1); 24892 dictionary.refinement = !!(dictionaryFlags & 2); 24893 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 24894 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 24895 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 24896 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 24897 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 24898 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 24899 dictionary.template = dictionaryFlags >> 10 & 3; 24900 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 24901 position += 2; 24902 24903 if (!dictionary.huffman) { 24904 atLength = dictionary.template === 0 ? 4 : 1; 24905 at = []; 24906 24907 for (i = 0; i < atLength; i++) { 24908 at.push({ 24909 x: (0, _core_utils.readInt8)(data, position), 24910 y: (0, _core_utils.readInt8)(data, position + 1) 24911 }); 24912 position += 2; 24913 } 24914 24915 dictionary.at = at; 24916 } 24917 24918 if (dictionary.refinement && !dictionary.refinementTemplate) { 24919 at = []; 24920 24921 for (i = 0; i < 2; i++) { 24922 at.push({ 24923 x: (0, _core_utils.readInt8)(data, position), 24924 y: (0, _core_utils.readInt8)(data, position + 1) 24925 }); 24926 position += 2; 24927 } 24928 24929 dictionary.refinementAt = at; 24930 } 24931 24932 dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position); 24933 position += 4; 24934 dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position); 24935 position += 4; 24936 args = [dictionary, header.number, header.referredTo, data, position, end]; 24937 break; 24938 24939 case 6: 24940 case 7: 24941 var textRegion = {}; 24942 textRegion.info = readRegionSegmentInformation(data, position); 24943 position += RegionSegmentInformationFieldLength; 24944 var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position); 24945 position += 2; 24946 textRegion.huffman = !!(textRegionSegmentFlags & 1); 24947 textRegion.refinement = !!(textRegionSegmentFlags & 2); 24948 textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3; 24949 textRegion.stripSize = 1 << textRegion.logStripSize; 24950 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 24951 textRegion.transposed = !!(textRegionSegmentFlags & 64); 24952 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 24953 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 24954 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 24955 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 24956 24957 if (textRegion.huffman) { 24958 var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position); 24959 position += 2; 24960 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 24961 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 24962 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 24963 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 24964 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 24965 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 24966 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 24967 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000); 24968 } 24969 24970 if (textRegion.refinement && !textRegion.refinementTemplate) { 24971 at = []; 24972 24973 for (i = 0; i < 2; i++) { 24974 at.push({ 24975 x: (0, _core_utils.readInt8)(data, position), 24976 y: (0, _core_utils.readInt8)(data, position + 1) 24977 }); 24978 position += 2; 24979 } 24980 24981 textRegion.refinementAt = at; 24982 } 24983 24984 textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position); 24985 position += 4; 24986 args = [textRegion, header.referredTo, data, position, end]; 24987 break; 24988 24989 case 16: 24990 const patternDictionary = {}; 24991 const patternDictionaryFlags = data[position++]; 24992 patternDictionary.mmr = !!(patternDictionaryFlags & 1); 24993 patternDictionary.template = patternDictionaryFlags >> 1 & 3; 24994 patternDictionary.patternWidth = data[position++]; 24995 patternDictionary.patternHeight = data[position++]; 24996 patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position); 24997 position += 4; 24998 args = [patternDictionary, header.number, data, position, end]; 24999 break; 25000 25001 case 22: 25002 case 23: 25003 const halftoneRegion = {}; 25004 halftoneRegion.info = readRegionSegmentInformation(data, position); 25005 position += RegionSegmentInformationFieldLength;
25006 const halftoneRegionFlags = data[position++]; 25007 halftoneRegion.mmr = !!(halftoneRegionFlags & 1); 25008 halftoneRegion.template = halftoneRegionFlags >> 1 & 3; 25009 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8); 25010 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7; 25011 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1; 25012 halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position); 25013 position += 4; 25014 halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position); 25015 position += 4; 25016 halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 25017 position += 4; 25018 halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 25019 position += 4; 25020 halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position); 25021 position += 2; 25022 halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position); 25023 position += 2; 25024 args = [halftoneRegion, header.referredTo, data, position, end]; 25025 break; 25026 25027 case 38: 25028 case 39: 25029 var genericRegion = {}; 25030 genericRegion.info = readRegionSegmentInformation(data, position); 25031 position += RegionSegmentInformationFieldLength; 25032 var genericRegionSegmentFlags = data[position++]; 25033 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 25034 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 25035 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 25036 25037 if (!genericRegion.mmr) { 25038 atLength = genericRegion.template === 0 ? 4 : 1; 25039 at = []; 25040 25041 for (i = 0; i < atLength; i++) { 25042 at.push({ 25043 x: (0, _core_utils.readInt8)(data, position), 25044 y: (0, _core_utils.readInt8)(data, position + 1) 25045 }); 25046 position += 2; 25047 } 25048 25049 genericRegion.at = at; 25050 } 25051 25052 args = [genericRegion, data, position, end]; 25053 break; 25054 25055 case 48: 25056 var pageInfo = { 25057 width: (0, _core_utils.readUint32)(data, position), 25058 height: (0, _core_utils.readUint32)(data, position + 4), 25059 resolutionX: (0, _core_utils.readUint32)(data, position + 8), 25060 resolutionY: (0, _core_utils.readUint32)(data, position + 12) 25061 }; 25062 25063 if (pageInfo.height === 0xffffffff) { 25064 delete pageInfo.height; 25065 } 25066 25067 var pageSegmentFlags = data[position + 16]; 25068 (0, _core_utils.readUint16)(data, position + 17); 25069 pageInfo.lossless = !!(pageSegmentFlags & 1); 25070 pageInfo.refinement = !!(pageSegmentFlags & 2); 25071 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 25072 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 25073 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 25074 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 25075 args = [pageInfo]; 25076 break; 25077 25078 case 49: 25079 break; 25080 25081 case 50: 25082 break; 25083 25084 case 51: 25085 break; 25086 25087 case 53: 25088 args = [header.number, data, position, end]; 25089 break; 25090 25091 case 62: 25092 break; 25093 25094 default: 25095 throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented"); 25096 } 25097 25098 var callbackName = "on" + header.typeName; 25099 25100 if (callbackName in visitor) { 25101 visitor[callbackName].apply(visitor, args); 25102 } 25103 } 25104 25105 function processSegments(segments, visitor) { 25106 for (var i = 0, ii = segments.length; i < ii; i++) { 25107 processSegment(segments[i], visitor); 25108 } 25109 } 25110 25111 function parseJbig2Chunks(chunks) { 25112 var visitor = new SimpleSegmentVisitor(); 25113 25114 for (var i = 0, ii = chunks.length; i < ii; i++) { 25115 var chunk = chunks[i]; 25116 var segments = readSegments({}, chunk.data, chunk.start, chunk.end); 25117 processSegments(segments, visitor); 25118 } 25119 25120 return visitor.buffer; 25121 } 25122 25123 function parseJbig2(data) { 25124 const end = data.length; 25125 let position = 0; 25126 25127 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) { 25128 throw new Jbig2Error("parseJbig2 - invalid header."); 25129 } 25130 25131 const header = Object.create(null); 25132 position += 8; 25133 const flags = data[position++]; 25134 header.randomAccess = !(flags & 1); 25135 25136 if (!(flags & 2)) { 25137 header.numberOfPages = (0, _core_utils.readUint32)(data, position); 25138 position += 4; 25139 } 25140 25141 const segments = readSegments(header, data, position, end); 25142 const visitor = new SimpleSegmentVisitor(); 25143 processSegments(segments, visitor); 25144 const { 25145 width, 25146 height 25147 } = visitor.currentPageInfo; 25148 const bitPacked = visitor.buffer; 25149 const imgData = new Uint8ClampedArray(width * height); 25150 let q = 0, 25151 k = 0; 25152 25153 for (let i = 0; i < height; i++) { 25154 let mask = 0, 25155 buffer; 25156 25157 for (let j = 0; j < width; j++) { 25158 if (!mask) { 25159 mask = 128; 25160 buffer = bitPacked[k++]; 25161 } 25162
25163 imgData[q++] = buffer & mask ? 0 : 255; 25164 mask >>= 1; 25165 } 25166 } 25167 25168 return { 25169 imgData, 25170 width, 25171 height 25172 }; 25173 } 25174 25175 function SimpleSegmentVisitor() {} 25176 25177 SimpleSegmentVisitor.prototype = { 25178 onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) { 25179 this.currentPageInfo = info; 25180 var rowSize = info.width + 7 >> 3; 25181 var buffer = new Uint8ClampedArray(rowSize * info.height); 25182 25183 if (info.defaultPixelValue) { 25184 for (var i = 0, ii = buffer.length; i < ii; i++) { 25185 buffer[i] = 0xff; 25186 } 25187 } 25188 25189 this.buffer = buffer; 25190 }, 25191 drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) { 25192 var pageInfo = this.currentPageInfo; 25193 var width = regionInfo.width, 25194 height = regionInfo.height; 25195 var rowSize = pageInfo.width + 7 >> 3; 25196 var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 25197 var buffer = this.buffer; 25198 var mask0 = 128 >> (regionInfo.x & 7); 25199 var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 25200 var i, j, mask, offset; 25201 25202 switch (combinationOperator) { 25203 case 0: 25204 for (i = 0; i < height; i++) { 25205 mask = mask0; 25206 offset = offset0; 25207 25208 for (j = 0; j < width; j++) { 25209 if (bitmap[i][j]) { 25210 buffer[offset] |= mask; 25211 } 25212 25213 mask >>= 1; 25214 25215 if (!mask) { 25216 mask = 128; 25217 offset++; 25218 } 25219 } 25220 25221 offset0 += rowSize; 25222 } 25223 25224 break; 25225 25226 case 2: 25227 for (i = 0; i < height; i++) { 25228 mask = mask0; 25229 offset = offset0; 25230 25231 for (j = 0; j < width; j++) { 25232 if (bitmap[i][j]) { 25233 buffer[offset] ^= mask; 25234 } 25235 25236 mask >>= 1; 25237 25238 if (!mask) { 25239 mask = 128; 25240 offset++; 25241 } 25242 } 25243 25244 offset0 += rowSize; 25245 } 25246 25247 break; 25248 25249 default: 25250 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 25251 } 25252 }, 25253 onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) { 25254 var regionInfo = region.info; 25255 var decodingContext = new DecodingContext(data, start, end); 25256 var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 25257 this.drawBitmap(regionInfo, bitmap); 25258 }, 25259 onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() { 25260 this.onImmediateGenericRegion.apply(this, arguments); 25261 }, 25262 onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 25263 let huffmanTables, huffmanInput; 25264 25265 if (dictionary.huffman) { 25266 huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables); 25267 huffmanInput = new Reader(data, start, end); 25268 } 25269 25270 var symbols = this.symbols; 25271 25272 if (!symbols) { 25273 this.symbols = symbols = {}; 25274 } 25275 25276 var inputSymbols = []; 25277 25278 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 25279 const referredSymbols = symbols[referredSegments[i]]; 25280 25281 if (referredSymbols) { 25282 inputSymbols = inputSymbols.concat(referredSymbols); 25283 } 25284 } 25285 25286 var decodingContext = new DecodingContext(data, start, end); 25287 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput); 25288 }, 25289 onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) { 25290 var regionInfo = region.info; 25291 let huffmanTables, huffmanInput; 25292 var symbols = this.symbols; 25293 var inputSymbols = []; 25294 25295 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 25296 const referredSymbols = symbols[referredSegments[i]]; 25297 25298 if (referredSymbols) { 25299 inputSymbols = inputSymbols.concat(referredSymbols); 25300 } 25301 } 25302 25303 var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length); 25304 25305 if (region.huffman) { 25306 huffmanInput = new Reader(data, start, end); 25307 huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput); 25308 } 25309 25310 var decodingContext = new DecodingContext(data, start, end); 25311 var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput); 25312 this.drawBitmap(regionInfo, bitmap); 25313 }, 25314 onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() { 25315 this.onImmediateTextRegion.apply(this, arguments); 25316 }, 25317 25318 onPatternDictionary(dictionary, currentSegment, data, start, end) { 25319 let patterns = this.patterns; 25320 25321 if (!patterns) { 25322 this.patterns = patterns = {}; 25323 } 25324 25325 const decodingContext = new DecodingContext(data, start, end); 25326 patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext); 25327 }, 25328 25329 onImmediateHalftoneRegion(region, referredSegments, data, start, end) { 25330 const patterns = this.patterns[referredSegments[0]]; 25331 const regionInfo = region.info; 25332 const decodingContext = new DecodingContext(data, start, end); 25333 const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext); 25334 this.drawBitmap(regionInfo, bitmap); 25335 }, 25336 25337 onImmediateLosslessHalftoneRegion() { 25338 this.onImmediateHalftoneRegion.apply(this, arguments); 25339 }, 25340 25341 onTables(currentSegment, data, start, end) { 25342 let customTables = this.customTables; 25343 25344 if (!customTables) { 25345 this.customTables = customTables = {}; 25346 } 25347 25348 customTables[currentSegment] = decodeTablesSegment(data, start, end); 25349 } 25350 25351 }; 25352 25353 function HuffmanLine(lineData) { 25354 if (lineData.length === 2) { 25355 this.isOOB = true; 25356 this.rangeLow = 0; 25357 this.prefixLength = lineData[0]; 25358 this.rangeLength = 0; 25359 this.prefixCode = lineData[1]; 25360 this.isLowerRange = false;
vendor: 5,173 bytes, lines 25361-25551
25361 } else { 25362 this.isOOB = false; 25363 this.rangeLow = lineData[0]; 25364 this.prefixLength = lineData[1]; 25365 this.rangeLength = lineData[2]; 25366 this.prefixCode = lineData[3]; 25367 this.isLowerRange = lineData[4] === "lower"; 25368 } 25369 } 25370 25371 function HuffmanTreeNode(line) { 25372 this.children = []; 25373 25374 if (line) { 25375 this.isLeaf = true; 25376 this.rangeLength = line.rangeLength; 25377 this.rangeLow = line.rangeLow; 25378 this.isLowerRange = line.isLowerRange; 25379 this.isOOB = line.isOOB; 25380 } else { 25381 this.isLeaf = false; 25382 } 25383 } 25384 25385 HuffmanTreeNode.prototype = { 25386 buildTree(line, shift) { 25387 const bit = line.prefixCode >> shift & 1; 25388 25389 if (shift <= 0) { 25390 this.children[bit] = new HuffmanTreeNode(line); 25391 } else { 25392 let node = this.children[bit]; 25393 25394 if (!node) { 25395 this.children[bit] = node = new HuffmanTreeNode(null); 25396 } 25397 25398 node.buildTree(line, shift - 1); 25399 } 25400 }, 25401 25402 decodeNode(reader) { 25403 if (this.isLeaf) { 25404 if (this.isOOB) { 25405 return null; 25406 } 25407 25408 const htOffset = reader.readBits(this.rangeLength); 25409 return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset); 25410 } 25411 25412 const node = this.children[reader.readBit()]; 25413 25414 if (!node) { 25415 throw new Jbig2Error("invalid Huffman data"); 25416 } 25417 25418 return node.decodeNode(reader); 25419 } 25420 25421 }; 25422 25423 function HuffmanTable(lines, prefixCodesDone) { 25424 if (!prefixCodesDone) { 25425 this.assignPrefixCodes(lines); 25426 } 25427 25428 this.rootNode = new HuffmanTreeNode(null); 25429 25430 for (let i = 0, ii = lines.length; i < ii; i++) { 25431 const line = lines[i]; 25432 25433 if (line.prefixLength > 0) { 25434 this.rootNode.buildTree(line, line.prefixLength - 1); 25435 } 25436 } 25437 } 25438 25439 HuffmanTable.prototype = { 25440 decode(reader) { 25441 return this.rootNode.decodeNode(reader); 25442 }, 25443 25444 assignPrefixCodes(lines) { 25445 const linesLength = lines.length; 25446 let prefixLengthMax = 0; 25447 25448 for (let i = 0; i < linesLength; i++) { 25449 prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength); 25450 } 25451 25452 const histogram = new Uint32Array(prefixLengthMax + 1); 25453 25454 for (let i = 0; i < linesLength; i++) { 25455 histogram[lines[i].prefixLength]++; 25456 } 25457 25458 let currentLength = 1, 25459 firstCode = 0, 25460 currentCode, 25461 currentTemp, 25462 line; 25463 histogram[0] = 0; 25464 25465 while (currentLength <= prefixLengthMax) { 25466 firstCode = firstCode + histogram[currentLength - 1] << 1; 25467 currentCode = firstCode; 25468 currentTemp = 0; 25469 25470 while (currentTemp < linesLength) { 25471 line = lines[currentTemp]; 25472 25473 if (line.prefixLength === currentLength) { 25474 line.prefixCode = currentCode; 25475 currentCode++; 25476 } 25477 25478 currentTemp++; 25479 } 25480 25481 currentLength++; 25482 } 25483 } 25484 25485 }; 25486 25487 function decodeTablesSegment(data, start, end) { 25488 const flags = data[start]; 25489 const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff; 25490 const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff; 25491 const reader = new Reader(data, start + 9, end); 25492 const prefixSizeBits = (flags >> 1 & 7) + 1; 25493 const rangeSizeBits = (flags >> 4 & 7) + 1; 25494 const lines = []; 25495 let prefixLength, 25496 rangeLength, 25497 currentRangeLow = lowestValue; 25498 25499 do { 25500 prefixLength = reader.readBits(prefixSizeBits); 25501 rangeLength = reader.readBits(rangeSizeBits); 25502 lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])); 25503 currentRangeLow += 1 << rangeLength; 25504 } while (currentRangeLow < highestValue); 25505 25506 prefixLength = reader.readBits(prefixSizeBits); 25507 lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])); 25508 prefixLength = reader.readBits(prefixSizeBits); 25509 lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0])); 25510 25511 if (flags & 1) { 25512 prefixLength = reader.readBits(prefixSizeBits); 25513 lines.push(new HuffmanLine([prefixLength, 0])); 25514 } 25515 25516 return new HuffmanTable(lines, false); 25517 } 25518 25519 const standardTablesCache = {}; 25520 25521 function getStandardTable(number) { 25522 let table = standardTablesCache[number]; 25523 25524 if (table) { 25525 return table; 25526 } 25527 25528 let lines; 25529 25530 switch (number) { 25531 case 1: 25532 lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]]; 25533 break; 25534 25535 case 2: 25536 lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]]; 25537 break; 25538 25539 case 3: 25540 lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]]; 25541 break; 25542 25543 case 4: 25544 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]]; 25545 break; 25546 25547 case 5: 25548 lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]]; 25549 break; 25550 25551 case 6:
25552 lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]]; 25553 break; 25554 25555 case 7: 25556 lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]]; 25557 break; 25558 25559 case 8: 25560 lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]]; 25561 break; 25562 25563 case 9: 25564 lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]]; 25565 break; 25566 25567 case 10: 25568 lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]]; 25569 break; 25570 25571 case 11: 25572 lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 25573 break; 25574 25575 case 12: 25576 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]]; 25577 break; 25578 25579 case 13: 25580 lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 25581 break; 25582 25583 case 14: 25584 lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]]; 25585 break; 25586 25587 case 15: 25588 lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]]; 25589 break; 25590 25591 default: 25592 throw new Jbig2Error(`standard table B.${number} does not exist`); 25593 } 25594 25595 for (let i = 0, ii = lines.length; i < ii; i++) { 25596 lines[i] = new HuffmanLine(lines[i]); 25597 } 25598 25599 table = new HuffmanTable(lines, true); 25600 standardTablesCache[number] = table; 25601 return table; 25602 } 25603 25604 function Reader(data, start, end) { 25605 this.data = data; 25606 this.start = start; 25607 this.end = end; 25608 this.position = start; 25609 this.shift = -1; 25610 this.currentByte = 0; 25611 } 25612 25613 Reader.prototype = { 25614 readBit() { 25615 if (this.shift < 0) { 25616 if (this.position >= this.end) { 25617 throw new Jbig2Error("end of data while reading bit"); 25618 } 25619 25620 this.currentByte = this.data[this.position++]; 25621 this.shift = 7; 25622 } 25623 25624 const bit = this.currentByte >> this.shift & 1; 25625 this.shift--; 25626 return bit; 25627 }, 25628 25629 readBits(numBits) { 25630 let result = 0, 25631 i; 25632 25633 for (i = numBits - 1; i >= 0; i--) { 25634 result |= this.readBit() << i; 25635 } 25636 25637 return result; 25638 }, 25639 25640 byteAlign() { 25641 this.shift = -1; 25642 }, 25643 25644 next() { 25645 if (this.position >= this.end) { 25646 return -1; 25647 } 25648 25649 return this.data[this.position++]; 25650 } 25651 25652 }; 25653 25654 function getCustomHuffmanTable(index, referredTo, customTables) {
vendor: 12,111 bytes, lines 25655-26311
25655 let currentIndex = 0; 25656 25657 for (let i = 0, ii = referredTo.length; i < ii; i++) { 25658 const table = customTables[referredTo[i]]; 25659 25660 if (table) { 25661 if (index === currentIndex) { 25662 return table; 25663 } 25664 25665 currentIndex++; 25666 } 25667 } 25668 25669 throw new Jbig2Error("can't find custom Huffman table"); 25670 } 25671 25672 function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) { 25673 const codes = []; 25674 25675 for (let i = 0; i <= 34; i++) { 25676 const codeLength = reader.readBits(4); 25677 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 25678 } 25679 25680 const runCodesTable = new HuffmanTable(codes, false); 25681 codes.length = 0; 25682 25683 for (let i = 0; i < numberOfSymbols;) { 25684 const codeLength = runCodesTable.decode(reader); 25685 25686 if (codeLength >= 32) { 25687 let repeatedLength, numberOfRepeats, j; 25688 25689 switch (codeLength) { 25690 case 32: 25691 if (i === 0) { 25692 throw new Jbig2Error("no previous value in symbol ID table"); 25693 } 25694 25695 numberOfRepeats = reader.readBits(2) + 3; 25696 repeatedLength = codes[i - 1].prefixLength; 25697 break; 25698 25699 case 33: 25700 numberOfRepeats = reader.readBits(3) + 3; 25701 repeatedLength = 0; 25702 break; 25703 25704 case 34: 25705 numberOfRepeats = reader.readBits(7) + 11; 25706 repeatedLength = 0; 25707 break; 25708 25709 default: 25710 throw new Jbig2Error("invalid code length in symbol ID table"); 25711 } 25712 25713 for (j = 0; j < numberOfRepeats; j++) { 25714 codes.push(new HuffmanLine([i, repeatedLength, 0, 0])); 25715 i++; 25716 } 25717 } else { 25718 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 25719 i++; 25720 } 25721 } 25722 25723 reader.byteAlign(); 25724 const symbolIDTable = new HuffmanTable(codes, false); 25725 let customIndex = 0, 25726 tableFirstS, 25727 tableDeltaS, 25728 tableDeltaT; 25729 25730 switch (textRegion.huffmanFS) { 25731 case 0: 25732 case 1: 25733 tableFirstS = getStandardTable(textRegion.huffmanFS + 6); 25734 break; 25735 25736 case 3: 25737 tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables); 25738 customIndex++; 25739 break; 25740 25741 default: 25742 throw new Jbig2Error("invalid Huffman FS selector"); 25743 } 25744 25745 switch (textRegion.huffmanDS) { 25746 case 0: 25747 case 1: 25748 case 2: 25749 tableDeltaS = getStandardTable(textRegion.huffmanDS + 8); 25750 break; 25751 25752 case 3: 25753 tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables); 25754 customIndex++; 25755 break; 25756 25757 default: 25758 throw new Jbig2Error("invalid Huffman DS selector"); 25759 } 25760 25761 switch (textRegion.huffmanDT) { 25762 case 0: 25763 case 1: 25764 case 2: 25765 tableDeltaT = getStandardTable(textRegion.huffmanDT + 11); 25766 break; 25767 25768 case 3: 25769 tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables); 25770 customIndex++; 25771 break; 25772 25773 default: 25774 throw new Jbig2Error("invalid Huffman DT selector"); 25775 } 25776 25777 if (textRegion.refinement) { 25778 throw new Jbig2Error("refinement with Huffman is not supported"); 25779 } 25780 25781 return { 25782 symbolIDTable, 25783 tableFirstS, 25784 tableDeltaS, 25785 tableDeltaT 25786 }; 25787 } 25788 25789 function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) { 25790 let customIndex = 0, 25791 tableDeltaHeight, 25792 tableDeltaWidth; 25793 25794 switch (dictionary.huffmanDHSelector) { 25795 case 0: 25796 case 1: 25797 tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4); 25798 break; 25799 25800 case 3: 25801 tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables); 25802 customIndex++; 25803 break; 25804 25805 default: 25806 throw new Jbig2Error("invalid Huffman DH selector"); 25807 } 25808 25809 switch (dictionary.huffmanDWSelector) { 25810 case 0: 25811 case 1: 25812 tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2); 25813 break; 25814 25815 case 3: 25816 tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables); 25817 customIndex++; 25818 break; 25819 25820 default: 25821 throw new Jbig2Error("invalid Huffman DW selector"); 25822 } 25823 25824 let tableBitmapSize, tableAggregateInstances; 25825 25826 if (dictionary.bitmapSizeSelector) { 25827 tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables); 25828 customIndex++; 25829 } else { 25830 tableBitmapSize = getStandardTable(1); 25831 } 25832 25833 if (dictionary.aggregationInstancesSelector) { 25834 tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables); 25835 } else { 25836 tableAggregateInstances = getStandardTable(1); 25837 } 25838 25839 return { 25840 tableDeltaHeight, 25841 tableDeltaWidth, 25842 tableBitmapSize, 25843 tableAggregateInstances 25844 }; 25845 } 25846 25847 function readUncompressedBitmap(reader, width, height) { 25848 const bitmap = []; 25849 25850 for (let y = 0; y < height; y++) { 25851 const row = new Uint8Array(width); 25852 bitmap.push(row); 25853 25854 for (let x = 0; x < width; x++) { 25855 row[x] = reader.readBit(); 25856 } 25857 25858 reader.byteAlign(); 25859 } 25860 25861 return bitmap; 25862 } 25863 25864 function decodeMMRBitmap(input, width, height, endOfBlock) { 25865 const params = { 25866 K: -1, 25867 Columns: width, 25868 Rows: height, 25869 BlackIs1: true, 25870 EndOfBlock: endOfBlock 25871 }; 25872 const decoder = new _ccitt.CCITTFaxDecoder(input, params); 25873 const bitmap = []; 25874 let currentByte, 25875 eof = false; 25876 25877 for (let y = 0; y < height; y++) { 25878 const row = new Uint8Array(width); 25879 bitmap.push(row); 25880 let shift = -1; 25881 25882 for (let x = 0; x < width; x++) { 25883 if (shift < 0) { 25884 currentByte = decoder.readNextChar(); 25885 25886 if (currentByte === -1) { 25887 currentByte = 0; 25888 eof = true; 25889 } 25890 25891 shift = 7; 25892 } 25893 25894 row[x] = currentByte >> shift & 1; 25895 shift--; 25896 } 25897 } 25898 25899 if (endOfBlock && !eof) { 25900 const lookForEOFLimit = 5; 25901 25902 for (let i = 0; i < lookForEOFLimit; i++) { 25903 if (decoder.readNextChar() === -1) { 25904 break; 25905 } 25906 } 25907 } 25908 25909 return bitmap; 25910 } 25911 25912 function Jbig2Image() {} 25913 25914 Jbig2Image.prototype = { 25915 parseChunks(chunks) { 25916 return parseJbig2Chunks(chunks); 25917 }, 25918 25919 parse(data) { 25920 const { 25921 imgData, 25922 width, 25923 height 25924 } = parseJbig2(data); 25925 this.width = width; 25926 this.height = height; 25927 return imgData; 25928 } 25929 25930 }; 25931 return Jbig2Image; 25932}(); 25933 25934exports.Jbig2Image = Jbig2Image; 25935 25936/***/ }), 25937/* 17 */ 25938/***/ (function(module, exports, __w_pdfjs_require__) { 25939 25940"use strict"; 25941 25942 25943Object.defineProperty(exports, "__esModule", { 25944 value: true 25945}); 25946exports.ArithmeticDecoder = void 0; 25947const QeTable = [{ 25948 qe: 0x5601, 25949 nmps: 1, 25950 nlps: 1, 25951 switchFlag: 1 25952}, { 25953 qe: 0x3401, 25954 nmps: 2, 25955 nlps: 6, 25956 switchFlag: 0 25957}, { 25958 qe: 0x1801, 25959 nmps: 3, 25960 nlps: 9, 25961 switchFlag: 0 25962}, { 25963 qe: 0x0ac1, 25964 nmps: 4, 25965 nlps: 12, 25966 switchFlag: 0 25967}, { 25968 qe: 0x0521, 25969 nmps: 5, 25970 nlps: 29, 25971 switchFlag: 0 25972}, { 25973 qe: 0x0221, 25974 nmps: 38, 25975 nlps: 33, 25976 switchFlag: 0 25977}, { 25978 qe: 0x5601, 25979 nmps: 7, 25980 nlps: 6, 25981 switchFlag: 1 25982}, { 25983 qe: 0x5401, 25984 nmps: 8, 25985 nlps: 14, 25986 switchFlag: 0 25987}, { 25988 qe: 0x4801, 25989 nmps: 9, 25990 nlps: 14, 25991 switchFlag: 0 25992}, { 25993 qe: 0x3801, 25994 nmps: 10, 25995 nlps: 14, 25996 switchFlag: 0 25997}, { 25998 qe: 0x3001, 25999 nmps: 11, 26000 nlps: 17, 26001 switchFlag: 0 26002}, { 26003 qe: 0x2401, 26004 nmps: 12, 26005 nlps: 18, 26006 switchFlag: 0 26007}, { 26008 qe: 0x1c01, 26009 nmps: 13, 26010 nlps: 20, 26011 switchFlag: 0 26012}, { 26013 qe: 0x1601, 26014 nmps: 29, 26015 nlps: 21, 26016 switchFlag: 0 26017}, { 26018 qe: 0x5601, 26019 nmps: 15, 26020 nlps: 14, 26021 switchFlag: 1 26022}, { 26023 qe: 0x5401, 26024 nmps: 16, 26025 nlps: 14, 26026 switchFlag: 0 26027}, { 26028 qe: 0x5101, 26029 nmps: 17, 26030 nlps: 15, 26031 switchFlag: 0 26032}, { 26033 qe: 0x4801, 26034 nmps: 18, 26035 nlps: 16, 26036 switchFlag: 0 26037}, { 26038 qe: 0x3801, 26039 nmps: 19, 26040 nlps: 17, 26041 switchFlag: 0 26042}, { 26043 qe: 0x3401, 26044 nmps: 20, 26045 nlps: 18, 26046 switchFlag: 0 26047}, { 26048 qe: 0x3001, 26049 nmps: 21, 26050 nlps: 19, 26051 switchFlag: 0 26052}, { 26053 qe: 0x2801, 26054 nmps: 22, 26055 nlps: 19, 26056 switchFlag: 0 26057}, { 26058 qe: 0x2401, 26059 nmps: 23, 26060 nlps: 20, 26061 switchFlag: 0 26062}, { 26063 qe: 0x2201, 26064 nmps: 24, 26065 nlps: 21, 26066 switchFlag: 0 26067}, { 26068 qe: 0x1c01, 26069 nmps: 25, 26070 nlps: 22, 26071 switchFlag: 0 26072}, { 26073 qe: 0x1801, 26074 nmps: 26, 26075 nlps: 23, 26076 switchFlag: 0 26077}, { 26078 qe: 0x1601, 26079 nmps: 27, 26080 nlps: 24, 26081 switchFlag: 0 26082}, { 26083 qe: 0x1401, 26084 nmps: 28, 26085 nlps: 25, 26086 switchFlag: 0 26087}, { 26088 qe: 0x1201, 26089 nmps: 29, 26090 nlps: 26, 26091 switchFlag: 0 26092}, { 26093 qe: 0x1101, 26094 nmps: 30, 26095 nlps: 27, 26096 switchFlag: 0 26097}, { 26098 qe: 0x0ac1, 26099 nmps: 31, 26100 nlps: 28, 26101 switchFlag: 0 26102}, { 26103 qe: 0x09c1, 26104 nmps: 32, 26105 nlps: 29, 26106 switchFlag: 0 26107}, { 26108 qe: 0x08a1, 26109 nmps: 33, 26110 nlps: 30, 26111 switchFlag: 0 26112}, { 26113 qe: 0x0521, 26114 nmps: 34, 26115 nlps: 31, 26116 switchFlag: 0 26117}, { 26118 qe: 0x0441, 26119 nmps: 35, 26120 nlps: 32, 26121 switchFlag: 0 26122}, { 26123 qe: 0x02a1, 26124 nmps: 36, 26125 nlps: 33, 26126 switchFlag: 0 26127}, { 26128 qe: 0x0221, 26129 nmps: 37, 26130 nlps: 34, 26131 switchFlag: 0 26132}, { 26133 qe: 0x0141, 26134 nmps: 38, 26135 nlps: 35, 26136 switchFlag: 0 26137}, { 26138 qe: 0x0111, 26139 nmps: 39, 26140 nlps: 36, 26141 switchFlag: 0 26142}, { 26143 qe: 0x0085, 26144 nmps: 40, 26145 nlps: 37, 26146 switchFlag: 0 26147}, { 26148 qe: 0x0049, 26149 nmps: 41, 26150 nlps: 38, 26151 switchFlag: 0 26152}, { 26153 qe: 0x0025, 26154 nmps: 42, 26155 nlps: 39, 26156 switchFlag: 0 26157}, { 26158 qe: 0x0015, 26159 nmps: 43, 26160 nlps: 40, 26161 switchFlag: 0 26162}, { 26163 qe: 0x0009, 26164 nmps: 44, 26165 nlps: 41, 26166 switchFlag: 0 26167}, { 26168 qe: 0x0005, 26169 nmps: 45, 26170 nlps: 42, 26171 switchFlag: 0 26172}, { 26173 qe: 0x0001, 26174 nmps: 45, 26175 nlps: 43, 26176 switchFlag: 0 26177}, { 26178 qe: 0x5601, 26179 nmps: 46, 26180 nlps: 46, 26181 switchFlag: 0 26182}]; 26183 26184class ArithmeticDecoder { 26185 constructor(data, start, end) { 26186 this.data = data; 26187 this.bp = start; 26188 this.dataEnd = end; 26189 this.chigh = data[start]; 26190 this.clow = 0; 26191 this.byteIn(); 26192 this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f; 26193 this.clow = this.clow << 7 & 0xffff; 26194 this.ct -= 7; 26195 this.a = 0x8000; 26196 } 26197 26198 byteIn() { 26199 const data = this.data; 26200 let bp = this.bp; 26201 26202 if (data[bp] === 0xff) { 26203 if (data[bp + 1] > 0x8f) { 26204 this.clow += 0xff00; 26205 this.ct = 8; 26206 } else { 26207 bp++; 26208 this.clow += data[bp] << 9; 26209 this.ct = 7; 26210 this.bp = bp; 26211 } 26212 } else { 26213 bp++; 26214 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00; 26215 this.ct = 8; 26216 this.bp = bp; 26217 } 26218 26219 if (this.clow > 0xffff) { 26220 this.chigh += this.clow >> 16; 26221 this.clow &= 0xffff; 26222 } 26223 } 26224 26225 readBit(contexts, pos) { 26226 let cx_index = contexts[pos] >> 1, 26227 cx_mps = contexts[pos] & 1; 26228 const qeTableIcx = QeTable[cx_index]; 26229 const qeIcx = qeTableIcx.qe; 26230 let d; 26231 let a = this.a - qeIcx; 26232 26233 if (this.chigh < qeIcx) { 26234 if (a < qeIcx) { 26235 a = qeIcx; 26236 d = cx_mps; 26237 cx_index = qeTableIcx.nmps; 26238 } else { 26239 a = qeIcx; 26240 d = 1 ^ cx_mps; 26241 26242 if (qeTableIcx.switchFlag === 1) { 26243 cx_mps = d; 26244 } 26245 26246 cx_index = qeTableIcx.nlps; 26247 } 26248 } else { 26249 this.chigh -= qeIcx; 26250 26251 if ((a & 0x8000) !== 0) { 26252 this.a = a; 26253 return cx_mps; 26254 } 26255 26256 if (a < qeIcx) { 26257 d = 1 ^ cx_mps; 26258 26259 if (qeTableIcx.switchFlag === 1) { 26260 cx_mps = d; 26261 } 26262 26263 cx_index = qeTableIcx.nlps; 26264 } else { 26265 d = cx_mps; 26266 cx_index = qeTableIcx.nmps; 26267 } 26268 } 26269 26270 do { 26271 if (this.ct === 0) { 26272 this.byteIn(); 26273 } 26274 26275 a <<= 1; 26276 this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1; 26277 this.clow = this.clow << 1 & 0xffff; 26278 this.ct--; 26279 } while ((a & 0x8000) === 0); 26280 26281 this.a = a; 26282 contexts[pos] = cx_index << 1 | cx_mps; 26283 return d; 26284 } 26285 26286} 26287 26288exports.ArithmeticDecoder = ArithmeticDecoder; 26289 26290/***/ }), 26291/* 18 */ 26292/***/ (function(module, exports, __w_pdfjs_require__) { 26293 26294"use strict"; 26295 26296 26297Object.defineProperty(exports, "__esModule", { 26298 value: true 26299}); 26300exports.JpegStream = void 0; 26301 26302var _stream = __w_pdfjs_require__(12); 26303 26304var _primitives = __w_pdfjs_require__(5); 26305 26306var _jpg = __w_pdfjs_require__(19); 26307 26308var _util = __w_pdfjs_require__(2); 26309 26310const JpegStream = function JpegStreamClosure() { 26311 function JpegStream(stream, maybeLength, dict, params) {
26312 let ch; 26313 26314 while ((ch = stream.getByte()) !== -1) { 26315 if (ch === 0xff) { 26316 stream.skip(-1); 26317 break; 26318 } 26319 } 26320 26321 this.stream = stream; 26322 this.maybeLength = maybeLength; 26323 this.dict = dict; 26324 this.params = params; 26325 26326 _stream.DecodeStream.call(this, maybeLength); 26327 } 26328 26329 JpegStream.prototype = Object.create(_stream.DecodeStream.prototype); 26330 Object.defineProperty(JpegStream.prototype, "bytes", { 26331 get: function JpegStream_bytes() { 26332 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 26333 }, 26334 configurable: true 26335 }); 26336 26337 JpegStream.prototype.ensureBuffer = function (requested) {}; 26338 26339 JpegStream.prototype.readBlock = function () { 26340 if (this.eof) { 26341 return; 26342 } 26343 26344 const jpegOptions = { 26345 decodeTransform: undefined, 26346 colorTransform: undefined 26347 }; 26348 const decodeArr = this.dict.getArray("Decode", "D"); 26349 26350 if (this.forceRGB && Array.isArray(decodeArr)) { 26351 const bitsPerComponent = this.dict.get("BitsPerComponent") || 8; 26352 const decodeArrLength = decodeArr.length; 26353 const transform = new Int32Array(decodeArrLength); 26354 let transformNeeded = false; 26355 const maxValue = (1 << bitsPerComponent) - 1; 26356 26357 for (let i = 0; i < decodeArrLength; i += 2) { 26358 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 26359 transform[i + 1] = decodeArr[i] * maxValue | 0; 26360 26361 if (transform[i] !== 256 || transform[i + 1] !== 0) { 26362 transformNeeded = true; 26363 } 26364 } 26365 26366 if (transformNeeded) { 26367 jpegOptions.decodeTransform = transform; 26368 } 26369 } 26370 26371 if ((0, _primitives.isDict)(this.params)) { 26372 const colorTransform = this.params.get("ColorTransform"); 26373 26374 if (Number.isInteger(colorTransform)) { 26375 jpegOptions.colorTransform = colorTransform; 26376 } 26377 } 26378 26379 const jpegImage = new _jpg.JpegImage(jpegOptions); 26380 jpegImage.parse(this.bytes); 26381 const data = jpegImage.getData({ 26382 width: this.drawWidth, 26383 height: this.drawHeight, 26384 forceRGB: this.forceRGB, 26385 isSourcePDF: true 26386 }); 26387 this.buffer = data; 26388 this.bufferLength = data.length; 26389 this.eof = true; 26390 }; 26391 26392 return JpegStream; 26393}(); 26394 26395exports.JpegStream = JpegStream; 26396 26397/***/ }), 26398/* 19 */ 26399/***/ (function(module, exports, __w_pdfjs_require__) { 26400 26401"use strict"; 26402 26403 26404Object.defineProperty(exports, "__esModule", { 26405 value: true 26406}); 26407exports.JpegImage = void 0; 26408 26409var _util = __w_pdfjs_require__(2); 26410 26411var _core_utils = __w_pdfjs_require__(8); 26412 26413class JpegError extends _util.BaseException { 26414 constructor(msg) { 26415 super(`JPEG error: ${msg}`); 26416 } 26417 26418} 26419 26420class DNLMarkerError extends _util.BaseException { 26421 constructor(message, scanLines) { 26422 super(message); 26423 this.scanLines = scanLines; 26424 } 26425 26426} 26427 26428class EOIMarkerError extends _util.BaseException {} 26429 26430var JpegImage = function JpegImageClosure() { 26431 var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]); 26432 var dctCos1 = 4017; 26433 var dctSin1 = 799; 26434 var dctCos3 = 3406; 26435 var dctSin3 = 2276; 26436 var dctCos6 = 1567; 26437 var dctSin6 = 3784; 26438 var dctSqrt2 = 5793; 26439 var dctSqrt1d2 = 2896; 26440 26441 function JpegImage({ 26442 decodeTransform = null, 26443 colorTransform = -1 26444 } = {}) { 26445 this._decodeTransform = decodeTransform; 26446 this._colorTransform = colorTransform; 26447 } 26448 26449 function buildHuffmanTable(codeLengths, values) { 26450 var k = 0, 26451 code = [], 26452 i, 26453 j, 26454 length = 16; 26455 26456 while (length > 0 && !codeLengths[length - 1]) { 26457 length--; 26458 } 26459 26460 code.push({ 26461 children: [], 26462 index: 0 26463 }); 26464 var p = code[0], 26465 q; 26466 26467 for (i = 0; i < length; i++) { 26468 for (j = 0; j < codeLengths[i]; j++) { 26469 p = code.pop(); 26470 p.children[p.index] = values[k]; 26471 26472 while (p.index > 0) { 26473 p = code.pop(); 26474 } 26475 26476 p.index++; 26477 code.push(p); 26478 26479 while (code.length <= i) { 26480 code.push(q = { 26481 children: [], 26482 index: 0 26483 }); 26484 p.children[p.index] = q.children; 26485 p = q; 26486 } 26487 26488 k++; 26489 } 26490 26491 if (i + 1 < length) { 26492 code.push(q = { 26493 children: [], 26494 index: 0 26495 }); 26496 p.children[p.index] = q.children; 26497 p = q; 26498 } 26499 } 26500 26501 return code[0].children; 26502 } 26503 26504 function getBlockBufferOffset(component, row, col) { 26505 return 64 * ((component.blocksPerLine + 1) * row + col); 26506 } 26507 26508 function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 26509 var mcusPerLine = frame.mcusPerLine; 26510 var progressive = frame.progressive; 26511 const startOffset = offset; 26512 let bitsData = 0, 26513 bitsCount = 0; 26514 26515 function readBit() { 26516 if (bitsCount > 0) { 26517 bitsCount--; 26518 return bitsData >> bitsCount & 1; 26519 } 26520 26521 bitsData = data[offset++]; 26522 26523 if (bitsData === 0xff) { 26524 var nextByte = data[offset++]; 26525 26526 if (nextByte) { 26527 if (nextByte === 0xdc && parseDNLMarker) { 26528 offset += 2; 26529 const scanLines = (0, _core_utils.readUint16)(data, offset); 26530 offset += 2; 26531 26532 if (scanLines > 0 && scanLines !== frame.scanLines) { 26533 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 26534 } 26535 } else if (nextByte === 0xd9) { 26536 if (parseDNLMarker) { 26537 const maybeScanLines = blockRow * 8; 26538 26539 if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) { 26540 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 26541 } 26542 } 26543 26544 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 26545 } 26546 26547 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 26548 } 26549 } 26550 26551 bitsCount = 7; 26552 return bitsData >>> 7; 26553 } 26554 26555 function decodeHuffman(tree) { 26556 var node = tree; 26557 26558 while (true) { 26559 node = node[readBit()]; 26560 26561 switch (typeof node) { 26562 case "number": 26563 return node; 26564 26565 case "object": 26566 continue; 26567 } 26568 26569 throw new JpegError("invalid huffman sequence"); 26570 } 26571 } 26572 26573 function receive(length) { 26574 var n = 0; 26575 26576 while (length > 0) { 26577 n = n << 1 | readBit(); 26578 length--; 26579 } 26580 26581 return n; 26582 } 26583 26584 function receiveAndExtend(length) { 26585 if (length === 1) { 26586 return readBit() === 1 ? 1 : -1; 26587 } 26588 26589 var n = receive(length); 26590 26591 if (n >= 1 << length - 1) { 26592 return n; 26593 } 26594 26595 return n + (-1 << length) + 1; 26596 } 26597 26598 function decodeBaseline(component, blockOffset) { 26599 var t = decodeHuffman(component.huffmanTableDC); 26600 var diff = t === 0 ? 0 : receiveAndExtend(t); 26601 component.blockData[blockOffset] = component.pred += diff; 26602 var k = 1; 26603 26604 while (k < 64) { 26605 var rs = decodeHuffman(component.huffmanTableAC); 26606 var s = rs & 15, 26607 r = rs >> 4; 26608 26609 if (s === 0) { 26610 if (r < 15) { 26611 break; 26612 } 26613 26614 k += 16; 26615 continue; 26616 } 26617 26618 k += r; 26619 var z = dctZigZag[k]; 26620 component.blockData[blockOffset + z] = receiveAndExtend(s); 26621 k++; 26622 } 26623 } 26624 26625 function decodeDCFirst(component, blockOffset) { 26626 var t = decodeHuffman(component.huffmanTableDC); 26627 var diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 26628 component.blockData[blockOffset] = component.pred += diff; 26629 } 26630 26631 function decodeDCSuccessive(component, blockOffset) { 26632 component.blockData[blockOffset] |= readBit() << successive; 26633 } 26634 26635 var eobrun = 0; 26636 26637 function decodeACFirst(component, blockOffset) { 26638 if (eobrun > 0) { 26639 eobrun--; 26640 return; 26641 } 26642 26643 var k = spectralStart, 26644 e = spectralEnd; 26645 26646 while (k <= e) { 26647 var rs = decodeHuffman(component.huffmanTableAC); 26648 var s = rs & 15, 26649 r = rs >> 4; 26650 26651 if (s === 0) { 26652 if (r < 15) { 26653 eobrun = receive(r) + (1 << r) - 1; 26654 break; 26655 } 26656 26657 k += 16; 26658 continue; 26659 } 26660 26661 k += r; 26662 var z = dctZigZag[k]; 26663 component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive); 26664 k++; 26665 } 26666 } 26667 26668 var successiveACState = 0, 26669 successiveACNextValue; 26670 26671 function decodeACSuccessive(component, blockOffset) { 26672 var k = spectralStart; 26673 var e = spectralEnd; 26674 var r = 0; 26675 var s; 26676 var rs; 26677 26678 while (k <= e) { 26679 const offsetZ = blockOffset + dctZigZag[k]; 26680 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 26681 26682 switch (successiveACState) { 26683 case 0: 26684 rs = decodeHuffman(component.huffmanTableAC); 26685 s = rs & 15; 26686 r = rs >> 4; 26687 26688 if (s === 0) { 26689 if (r < 15) { 26690 eobrun = receive(r) + (1 << r); 26691 successiveACState = 4; 26692 } else { 26693 r = 16; 26694 successiveACState = 1; 26695 } 26696 } else { 26697 if (s !== 1) { 26698 throw new JpegError("invalid ACn encoding"); 26699 } 26700 26701 successiveACNextValue = receiveAndExtend(s); 26702 successiveACState = r ? 2 : 3; 26703 } 26704 26705 continue; 26706 26707 case 1: 26708 case 2: 26709 if (component.blockData[offsetZ]) { 26710 component.blockData[offsetZ] += sign * (readBit() << successive); 26711 } else { 26712 r--; 26713 26714 if (r === 0) { 26715 successiveACState = successiveACState === 2 ? 3 : 0; 26716 } 26717 } 26718 26719 break; 26720 26721 case 3: 26722 if (component.blockData[offsetZ]) { 26723 component.blockData[offsetZ] += sign * (readBit() << successive); 26724 } else { 26725 component.blockData[offsetZ] = successiveACNextValue << successive; 26726 successiveACState = 0; 26727 } 26728 26729 break; 26730 26731 case 4: 26732 if (component.blockData[offsetZ]) { 26733 component.blockData[offsetZ] += sign * (readBit() << successive); 26734 } 26735 26736 break; 26737 } 26738 26739 k++; 26740 } 26741 26742 if (successiveACState === 4) { 26743 eobrun--; 26744 26745 if (eobrun === 0) { 26746 successiveACState = 0; 26747 } 26748 } 26749 } 26750 26751 let blockRow = 0; 26752 26753 function decodeMcu(component, decode, mcu, row, col) { 26754 var mcuRow = mcu / mcusPerLine | 0; 26755 var mcuCol = mcu % mcusPerLine; 26756 blockRow = mcuRow * component.v + row; 26757 var blockCol = mcuCol * component.h + col; 26758 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 26759 decode(component, blockOffset); 26760 } 26761 26762 function decodeBlock(component, decode, mcu) { 26763 blockRow = mcu / component.blocksPerLine | 0; 26764 var blockCol = mcu % component.blocksPerLine; 26765 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 26766 decode(component, blockOffset); 26767 } 26768 26769 var componentsLength = components.length; 26770 var component, i, j, k, n; 26771 var decodeFn; 26772 26773 if (progressive) { 26774 if (spectralStart === 0) { 26775 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 26776 } else { 26777 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 26778 } 26779 } else { 26780 decodeFn = decodeBaseline; 26781 } 26782 26783 var mcu = 0, 26784 fileMarker; 26785 var mcuExpected; 26786 26787 if (componentsLength === 1) { 26788 mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; 26789 } else { 26790 mcuExpected = mcusPerLine * frame.mcusPerColumn; 26791 } 26792 26793 var h, v; 26794 26795 while (mcu <= mcuExpected) { 26796 var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 26797 26798 if (mcuToRead > 0) { 26799 for (i = 0; i < componentsLength; i++) { 26800 components[i].pred = 0; 26801 } 26802 26803 eobrun = 0; 26804 26805 if (componentsLength === 1) { 26806 component = components[0]; 26807 26808 for (n = 0; n < mcuToRead; n++) { 26809 decodeBlock(component, decodeFn, mcu); 26810 mcu++; 26811 } 26812 } else { 26813 for (n = 0; n < mcuToRead; n++) { 26814 for (i = 0; i < componentsLength; i++) { 26815 component = components[i]; 26816 h = component.h; 26817 v = component.v; 26818 26819 for (j = 0; j < v; j++) { 26820 for (k = 0; k < h; k++) { 26821 decodeMcu(component, decodeFn, mcu, j, k); 26822 } 26823 } 26824 } 26825 26826 mcu++; 26827 } 26828 } 26829 } 26830 26831 bitsCount = 0; 26832 fileMarker = findNextFileMarker(data, offset); 26833 26834 if (!fileMarker) { 26835 break; 26836 } 26837 26838 if (fileMarker.invalid) { 26839 const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive"; 26840 (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`); 26841 offset = fileMarker.offset; 26842 } 26843 26844 if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) { 26845 offset += 2; 26846 } else { 26847 break; 26848 } 26849 } 26850 26851 return offset - startOffset; 26852 } 26853 26854 function quantizeAndInverse(component, blockBufferOffset, p) { 26855 var qt = component.quantizationTable, 26856 blockData = component.blockData; 26857 var v0, v1, v2, v3, v4, v5, v6, v7; 26858 var p0, p1, p2, p3, p4, p5, p6, p7; 26859 var t; 26860 26861 if (!qt) { 26862 throw new JpegError("missing required Quantization Table."); 26863 } 26864 26865 for (var row = 0; row < 64; row += 8) { 26866 p0 = blockData[blockBufferOffset + row]; 26867 p1 = blockData[blockBufferOffset + row + 1]; 26868 p2 = blockData[blockBufferOffset + row + 2]; 26869 p3 = blockData[blockBufferOffset + row + 3]; 26870 p4 = blockData[blockBufferOffset + row + 4]; 26871 p5 = blockData[blockBufferOffset + row + 5]; 26872 p6 = blockData[blockBufferOffset + row + 6]; 26873 p7 = blockData[blockBufferOffset + row + 7]; 26874 p0 *= qt[row]; 26875 26876 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 26877 t = dctSqrt2 * p0 + 512 >> 10; 26878 p[row] = t; 26879 p[row + 1] = t; 26880 p[row + 2] = t; 26881 p[row + 3] = t; 26882 p[row + 4] = t; 26883 p[row + 5] = t; 26884 p[row + 6] = t; 26885 p[row + 7] = t; 26886 continue; 26887 } 26888 26889 p1 *= qt[row + 1]; 26890 p2 *= qt[row + 2]; 26891 p3 *= qt[row + 3]; 26892 p4 *= qt[row + 4]; 26893 p5 *= qt[row + 5]; 26894 p6 *= qt[row + 6]; 26895 p7 *= qt[row + 7]; 26896 v0 = dctSqrt2 * p0 + 128 >> 8; 26897 v1 = dctSqrt2 * p4 + 128 >> 8; 26898 v2 = p2; 26899 v3 = p6; 26900 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 26901 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 26902 v5 = p3 << 4; 26903 v6 = p5 << 4; 26904 v0 = v0 + v1 + 1 >> 1; 26905 v1 = v0 - v1; 26906 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 26907 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 26908 v3 = t; 26909 v4 = v4 + v6 + 1 >> 1; 26910 v6 = v4 - v6; 26911 v7 = v7 + v5 + 1 >> 1; 26912 v5 = v7 - v5; 26913 v0 = v0 + v3 + 1 >> 1;
vendor: 2,105 bytes, lines 26914-26986
26914 v3 = v0 - v3; 26915 v1 = v1 + v2 + 1 >> 1; 26916 v2 = v1 - v2; 26917 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 26918 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 26919 v7 = t; 26920 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 26921 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 26922 v6 = t; 26923 p[row] = v0 + v7; 26924 p[row + 7] = v0 - v7; 26925 p[row + 1] = v1 + v6; 26926 p[row + 6] = v1 - v6; 26927 p[row + 2] = v2 + v5; 26928 p[row + 5] = v2 - v5; 26929 p[row + 3] = v3 + v4; 26930 p[row + 4] = v3 - v4; 26931 } 26932 26933 for (var col = 0; col < 8; ++col) { 26934 p0 = p[col]; 26935 p1 = p[col + 8]; 26936 p2 = p[col + 16]; 26937 p3 = p[col + 24]; 26938 p4 = p[col + 32]; 26939 p5 = p[col + 40]; 26940 p6 = p[col + 48]; 26941 p7 = p[col + 56]; 26942 26943 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 26944 t = dctSqrt2 * p0 + 8192 >> 14; 26945 26946 if (t < -2040) { 26947 t = 0; 26948 } else if (t >= 2024) { 26949 t = 255; 26950 } else { 26951 t = t + 2056 >> 4; 26952 } 26953 26954 blockData[blockBufferOffset + col] = t; 26955 blockData[blockBufferOffset + col + 8] = t; 26956 blockData[blockBufferOffset + col + 16] = t; 26957 blockData[blockBufferOffset + col + 24] = t; 26958 blockData[blockBufferOffset + col + 32] = t; 26959 blockData[blockBufferOffset + col + 40] = t; 26960 blockData[blockBufferOffset + col + 48] = t; 26961 blockData[blockBufferOffset + col + 56] = t; 26962 continue; 26963 } 26964 26965 v0 = dctSqrt2 * p0 + 2048 >> 12; 26966 v1 = dctSqrt2 * p4 + 2048 >> 12; 26967 v2 = p2; 26968 v3 = p6; 26969 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 26970 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 26971 v5 = p3; 26972 v6 = p5; 26973 v0 = (v0 + v1 + 1 >> 1) + 4112; 26974 v1 = v0 - v1; 26975 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 26976 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 26977 v3 = t; 26978 v4 = v4 + v6 + 1 >> 1; 26979 v6 = v4 - v6; 26980 v7 = v7 + v5 + 1 >> 1; 26981 v5 = v7 - v5; 26982 v0 = v0 + v3 + 1 >> 1; 26983 v3 = v0 - v3; 26984 v1 = v1 + v2 + 1 >> 1; 26985 v2 = v1 - v2; 26986 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
26986 12; 26987 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 26988 v7 = t; 26989 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 26990 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 26991 v6 = t; 26992 p0 = v0 + v7; 26993 p7 = v0 - v7; 26994 p1 = v1 + v6; 26995 p6 = v1 - v6; 26996 p2 = v2 + v5; 26997 p5 = v2 - v5; 26998 p3 = v3 + v4; 26999 p4 = v3 - v4; 27000 27001 if (p0 < 16) { 27002 p0 = 0; 27003 } else if (p0 >= 4080) { 27004 p0 = 255; 27005 } else { 27006 p0 >>= 4; 27007 } 27008 27009 if (p1 < 16) { 27010 p1 = 0; 27011 } else if (p1 >= 4080) { 27012 p1 = 255; 27013 } else { 27014 p1 >>= 4; 27015 } 27016 27017 if (p2 < 16) { 27018 p2 = 0; 27019 } else if (p2 >= 4080) { 27020 p2 = 255; 27021 } else { 27022 p2 >>= 4; 27023 } 27024 27025 if (p3 < 16) { 27026 p3 = 0; 27027 } else if (p3 >= 4080) { 27028 p3 = 255; 27029 } else { 27030 p3 >>= 4; 27031 } 27032 27033 if (p4 < 16) { 27034 p4 = 0; 27035 } else if (p4 >= 4080) { 27036 p4 = 255; 27037 } else { 27038 p4 >>= 4; 27039 } 27040 27041 if (p5 < 16) { 27042 p5 = 0; 27043 } else if (p5 >= 4080) { 27044 p5 = 255; 27045 } else { 27046 p5 >>= 4; 27047 } 27048 27049 if (p6 < 16) { 27050 p6 = 0; 27051 } else if (p6 >= 4080) { 27052 p6 = 255; 27053 } else { 27054 p6 >>= 4; 27055 } 27056 27057 if (p7 < 16) { 27058 p7 = 0; 27059 } else if (p7 >= 4080) { 27060 p7 = 255; 27061 } else { 27062 p7 >>= 4; 27063 } 27064 27065 blockData[blockBufferOffset + col] = p0; 27066 blockData[blockBufferOffset + col + 8] = p1; 27067 blockData[blockBufferOffset + col + 16] = p2; 27068 blockData[blockBufferOffset + col + 24] = p3; 27069 blockData[blockBufferOffset + col + 32] = p4; 27070 blockData[blockBufferOffset + col + 40] = p5; 27071 blockData[blockBufferOffset + col + 48] = p6; 27072 blockData[blockBufferOffset + col + 56] = p7; 27073 } 27074 } 27075 27076 function buildComponentData(frame, component) { 27077 var blocksPerLine = component.blocksPerLine; 27078 var blocksPerColumn = component.blocksPerColumn; 27079 var computationBuffer = new Int16Array(64); 27080 27081 for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 27082 for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { 27083 var offset = getBlockBufferOffset(component, blockRow, blockCol); 27084 quantizeAndInverse(component, offset, computationBuffer); 27085 } 27086 } 27087 27088 return component.blockData; 27089 } 27090 27091 function findNextFileMarker(data, currentPos, startPos = currentPos) { 27092 const maxPos = data.length - 1; 27093 var newPos = startPos < currentPos ? startPos : currentPos; 27094 27095 if (currentPos >= maxPos) { 27096 return null; 27097 } 27098 27099 var currentMarker = (0, _core_utils.readUint16)(data, currentPos); 27100 27101 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 27102 return { 27103 invalid: null, 27104 marker: currentMarker, 27105 offset: currentPos 27106 }; 27107 } 27108 27109 var newMarker = (0, _core_utils.readUint16)(data, newPos); 27110 27111 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 27112 if (++newPos >= maxPos) { 27113 return null; 27114 } 27115 27116 newMarker = (0, _core_utils.readUint16)(data, newPos); 27117 } 27118 27119 return { 27120 invalid: currentMarker.toString(16), 27121 marker: newMarker, 27122 offset: newPos 27123 }; 27124 } 27125 27126 JpegImage.prototype = { 27127 parse(data, { 27128 dnlScanLines = null 27129 } = {}) { 27130 function readDataBlock() { 27131 const length = (0, _core_utils.readUint16)(data, offset); 27132 offset += 2; 27133 let endOffset = offset + length - 2; 27134 var fileMarker = findNextFileMarker(data, endOffset, offset); 27135 27136 if (fileMarker && fileMarker.invalid) { 27137 (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 27138 endOffset = fileMarker.offset; 27139 } 27140 27141 var array = data.subarray(offset, endOffset); 27142 offset += array.length; 27143 return array; 27144 } 27145 27146 function prepareComponents(frame) { 27147 var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 27148 var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 27149 27150 for (var i = 0; i < frame.components.length; i++) { 27151 component = frame.components[i];
27152 var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 27153 var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 27154 var blocksPerLineForMcu = mcusPerLine * component.h; 27155 var blocksPerColumnForMcu = mcusPerColumn * component.v; 27156 var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 27157 component.blockData = new Int16Array(blocksBufferSize); 27158 component.blocksPerLine = blocksPerLine; 27159 component.blocksPerColumn = blocksPerColumn; 27160 } 27161 27162 frame.mcusPerLine = mcusPerLine; 27163 frame.mcusPerColumn = mcusPerColumn; 27164 } 27165 27166 var offset = 0; 27167 var jfif = null; 27168 var adobe = null; 27169 var frame, resetInterval; 27170 let numSOSMarkers = 0; 27171 var quantizationTables = []; 27172 var huffmanTablesAC = [], 27173 huffmanTablesDC = []; 27174 let fileMarker = (0, _core_utils.readUint16)(data, offset); 27175 offset += 2; 27176 27177 if (fileMarker !== 0xffd8) { 27178 throw new JpegError("SOI not found"); 27179 } 27180 27181 fileMarker = (0, _core_utils.readUint16)(data, offset); 27182 offset += 2; 27183 27184 markerLoop: while (fileMarker !== 0xffd9) { 27185 var i, j, l; 27186 27187 switch (fileMarker) { 27188 case 0xffe0: 27189 case 0xffe1: 27190 case 0xffe2: 27191 case 0xffe3: 27192 case 0xffe4: 27193 case 0xffe5: 27194 case 0xffe6: 27195 case 0xffe7: 27196 case 0xffe8: 27197 case 0xffe9: 27198 case 0xffea: 27199 case 0xffeb: 27200 case 0xffec: 27201 case 0xffed: 27202 case 0xffee: 27203 case 0xffef: 27204 case 0xfffe: 27205 var appData = readDataBlock(); 27206 27207 if (fileMarker === 0xffe0) { 27208 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 27209 jfif = { 27210 version: { 27211 major: appData[5], 27212 minor: appData[6] 27213 }, 27214 densityUnits: appData[7], 27215 xDensity: appData[8] << 8 | appData[9], 27216 yDensity: appData[10] << 8 | appData[11], 27217 thumbWidth: appData[12], 27218 thumbHeight: appData[13], 27219 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 27220 }; 27221 } 27222 } 27223 27224 if (fileMarker === 0xffee) { 27225 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 27226 adobe = { 27227 version: appData[5] << 8 | appData[6], 27228 flags0: appData[7] << 8 | appData[8], 27229 flags1: appData[9] << 8 | appData[10], 27230 transformCode: appData[11] 27231 }; 27232 } 27233 } 27234 27235 break; 27236 27237 case 0xffdb: 27238 const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset); 27239 offset += 2; 27240 var quantizationTablesEnd = quantizationTablesLength + offset - 2; 27241 var z; 27242 27243 while (offset < quantizationTablesEnd) { 27244 var quantizationTableSpec = data[offset++]; 27245 var tableData = new Uint16Array(64); 27246 27247 if (quantizationTableSpec >> 4 === 0) { 27248 for (j = 0; j < 64; j++) { 27249 z = dctZigZag[j]; 27250 tableData[z] = data[offset++]; 27251 } 27252 } else if (quantizationTableSpec >> 4 === 1) { 27253 for (j = 0; j < 64; j++) { 27254 z = dctZigZag[j]; 27255 tableData[z] = (0, _core_utils.readUint16)(data, offset); 27256 offset += 2; 27257 } 27258 } else { 27259 throw new JpegError("DQT - invalid table spec"); 27260 } 27261 27262 quantizationTables[quantizationTableSpec & 15] = tableData; 27263 } 27264 27265 break; 27266 27267 case 0xffc0: 27268 case 0xffc1: 27269 case 0xffc2: 27270 if (frame) { 27271 throw new JpegError("Only single frame JPEGs supported"); 27272 } 27273 27274 offset += 2; 27275 frame = {}; 27276 frame.extended = fileMarker === 0xffc1; 27277 frame.progressive = fileMarker === 0xffc2; 27278 frame.precision = data[offset++]; 27279 const sofScanLines = (0, _core_utils.readUint16)(data, offset); 27280 offset += 2; 27281 frame.scanLines = dnlScanLines || sofScanLines; 27282 frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset); 27283 offset += 2; 27284 frame.components = []; 27285 frame.componentIds = {}; 27286 var componentsCount = data[offset++], 27287 componentId; 27288 var maxH = 0, 27289 maxV = 0; 27290 27291 for (i = 0; i < componentsCount; i++) { 27292 componentId = data[offset]; 27293 var h = data[offset + 1] >> 4; 27294 var v = data[offset + 1] & 15; 27295 27296 if (maxH < h) { 27297 maxH = h; 27298 } 27299 27300 if (maxV < v) { 27301 maxV = v; 27302 } 27303 27304 var qId = data[offset + 2]; 27305 l = frame.components.push({ 27306 h, 27307 v, 27308 quantizationId: qId, 27309 quantizationTable: null 27310 }); 27311 frame.componentIds[componentId] = l - 1; 27312 offset += 3; 27313 } 27314 27315 frame.maxH = maxH; 27316 frame.maxV = maxV; 27317 prepareComponents(frame); 27318 break; 27319 27320 case 0xffc4: 27321 const huffmanLength = (0, _core_utils.readUint16)(data, offset); 27322 offset += 2; 27323 27324 for (i = 2; i < huffmanLength;) { 27325 var huffmanTableSpec = data[offset++]; 27326 var codeLengths = new Uint8Array(16); 27327 var codeLengthSum = 0; 27328 27329 for (j = 0; j < 16; j++, offset++) { 27330 codeLengthSum += codeLengths[j] = data[offset]; 27331 } 27332 27333 var huffmanValues = new Uint8Array(codeLengthSum); 27334 27335 for (j = 0; j < codeLengthSum; j++, offset++) { 27336 huffmanValues[j] = data[offset]; 27337 } 27338 27339 i += 17 + codeLengthSum; 27340 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 27341 } 27342 27343 break; 27344 27345 case 0xffdd: 27346 offset += 2; 27347 resetInterval = (0, _core_utils.readUint16)(data, offset); 27348 offset += 2; 27349 break; 27350 27351 case 0xffda: 27352 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 27353 offset += 2; 27354 var selectorsCount = data[offset++]; 27355 var components = [], 27356 component; 27357 27358 for (i = 0; i < selectorsCount; i++) { 27359 var componentIndex = frame.componentIds[data[offset++]]; 27360 component = frame.components[componentIndex]; 27361 var tableSpec = data[offset++]; 27362 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 27363 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 27364 components.push(component); 27365 } 27366 27367 var spectralStart = data[offset++]; 27368 var spectralEnd = data[offset++]; 27369 var successiveApproximation = data[offset++]; 27370 27371 try { 27372 var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 27373 offset += processed; 27374 } catch (ex) { 27375 if (ex instanceof DNLMarkerError) { 27376 (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`); 27377 return this.parse(data, { 27378 dnlScanLines: ex.scanLines 27379 }); 27380 } else if (ex instanceof EOIMarkerError) { 27381 (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
27382 break markerLoop; 27383 } 27384 27385 throw ex; 27386 } 27387 27388 break; 27389 27390 case 0xffdc: 27391 offset += 4; 27392 break; 27393 27394 case 0xffff: 27395 if (data[offset] !== 0xff) { 27396 offset--; 27397 } 27398 27399 break; 27400 27401 default: 27402 const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3); 27403 27404 if (nextFileMarker && nextFileMarker.invalid) { 27405 (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 27406 offset = nextFileMarker.offset; 27407 break; 27408 } 27409 27410 if (offset >= data.length - 1) { 27411 (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 27412 break markerLoop; 27413 } 27414 27415 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 27416 } 27417 27418 fileMarker = (0, _core_utils.readUint16)(data, offset); 27419 offset += 2; 27420 } 27421 27422 this.width = frame.samplesPerLine; 27423 this.height = frame.scanLines; 27424 this.jfif = jfif; 27425 this.adobe = adobe; 27426 this.components = []; 27427 27428 for (i = 0; i < frame.components.length; i++) { 27429 component = frame.components[i]; 27430 var quantizationTable = quantizationTables[component.quantizationId]; 27431 27432 if (quantizationTable) { 27433 component.quantizationTable = quantizationTable; 27434 } 27435 27436 this.components.push({ 27437 output: buildComponentData(frame, component), 27438 scaleX: component.h / frame.maxH, 27439 scaleY: component.v / frame.maxV, 27440 blocksPerLine: component.blocksPerLine, 27441 blocksPerColumn: component.blocksPerColumn 27442 }); 27443 } 27444 27445 this.numComponents = this.components.length; 27446 return undefined; 27447 }, 27448 27449 _getLinearizedBlockData(width, height, isSourcePDF = false) { 27450 var scaleX = this.width / width, 27451 scaleY = this.height / height; 27452 var component, componentScaleX, componentScaleY, blocksPerScanline; 27453 var x, y, i, j, k; 27454 var index; 27455 var offset = 0; 27456 var output; 27457 var numComponents = this.components.length; 27458 var dataLength = width * height * numComponents; 27459 var data = new Uint8ClampedArray(dataLength); 27460 var xScaleBlockOffset = new Uint32Array(width); 27461 var mask3LSB = 0xfffffff8; 27462 let lastComponentScaleX; 27463 27464 for (i = 0; i < numComponents; i++) { 27465 component = this.components[i]; 27466 componentScaleX = component.scaleX * scaleX; 27467 componentScaleY = component.scaleY * scaleY; 27468 offset = i; 27469 output = component.output; 27470 blocksPerScanline = component.blocksPerLine + 1 << 3; 27471 27472 if (componentScaleX !== lastComponentScaleX) { 27473 for (x = 0; x < width; x++) { 27474 j = 0 | x * componentScaleX; 27475 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 27476 } 27477 27478 lastComponentScaleX = componentScaleX; 27479 } 27480 27481 for (y = 0; y < height; y++) { 27482 j = 0 | y * componentScaleY; 27483 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 27484 27485 for (x = 0; x < width; x++) { 27486 data[offset] = output[index + xScaleBlockOffset[x]]; 27487 offset += numComponents; 27488 } 27489 } 27490 } 27491 27492 let transform = this._decodeTransform; 27493 27494 if (!isSourcePDF && numComponents === 4 && !transform) { 27495 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 27496 } 27497 27498 if (transform) { 27499 for (i = 0; i < dataLength;) { 27500 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 27501 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 27502 } 27503 } 27504 } 27505 27506 return data; 27507 }, 27508 27509 get _isColorConversionNeeded() { 27510 if (this.adobe) { 27511 return !!this.adobe.transformCode; 27512 } 27513 27514 if (this.numComponents === 3) { 27515 if (this._colorTransform === 0) { 27516 return false; 27517 } 27518 27519 return true; 27520 } 27521 27522 if (this._colorTransform === 1) { 27523 return true; 27524 } 27525 27526 return false;
27527 }, 27528 27529 _convertYccToRgb: function convertYccToRgb(data) { 27530 var Y, Cb, Cr; 27531 27532 for (var i = 0, length = data.length; i < length; i += 3) { 27533 Y = data[i]; 27534 Cb = data[i + 1]; 27535 Cr = data[i + 2]; 27536 data[i] = Y - 179.456 + 1.402 * Cr; 27537 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 27538 data[i + 2] = Y - 226.816 + 1.772 * Cb; 27539 } 27540 27541 return data; 27542 }, 27543 _convertYcckToRgb: function convertYcckToRgb(data) { 27544 var Y, Cb, Cr, k; 27545 var offset = 0; 27546 27547 for (var i = 0, length = data.length; i < length; i += 4) { 27548 Y = data[i]; 27549 Cb = data[i + 1]; 27550 Cr = data[i + 2]; 27551 k = data[i + 3]; 27552 data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776); 27553 data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665); 27554 data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407); 27555 } 27556 27557 return data.subarray(0, offset); 27558 }, 27559 _convertYcckToCmyk: function convertYcckToCmyk(data) { 27560 var Y, Cb, Cr; 27561 27562 for (var i = 0, length = data.length; i < length; i += 4) { 27563 Y = data[i]; 27564 Cb = data[i + 1]; 27565 Cr = data[i + 2]; 27566 data[i] = 434.456 - Y - 1.402 * Cr; 27567 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 27568 data[i + 2] = 481.816 - Y - 1.772 * Cb; 27569 } 27570 27571 return data; 27572 }, 27573 _convertCmykToRgb: function convertCmykToRgb(data) { 27574 var c, m, y, k; 27575 var offset = 0; 27576 27577 for (var i = 0, length = data.length; i < length; i += 4) { 27578 c = data[i]; 27579 m = data[i + 1]; 27580 y = data[i + 2]; 27581 k = data[i + 3]; 27582 data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254); 27583 data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 0.7364883807733168); 27584 data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144); 27585 } 27586 27587 return data.subarray(0, offset); 27588 }, 27589 27590 getData({ 27591 width, 27592 height, 27593 forceRGB = false, 27594 isSourcePDF = false 27595 }) { 27596 if (this.numComponents > 4) { 27597 throw new JpegError("Unsupported color mode"); 27598 } 27599 27600 var data = this._getLinearizedBlockData(width, height, isSourcePDF); 27601 27602 if (this.numComponents === 1 && forceRGB) { 27603 var dataLength = data.length; 27604 var rgbData = new Uint8ClampedArray(dataLength * 3); 27605 var offset = 0; 27606 27607 for (var i = 0; i < dataLength; i++) { 27608 var grayColor = data[i]; 27609 rgbData[offset++] = grayColor; 27610 rgbData[offset++] = grayColor; 27611 rgbData[offset++] = grayColor; 27612 } 27613 27614 return rgbData; 27615 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 27616 return this._convertYccToRgb(data); 27617 } else if (this.numComponents === 4) { 27618 if (this._isColorConversionNeeded) { 27619 if (forceRGB) { 27620 return this._convertYcckToRgb(data); 27621 } 27622 27623 return this._convertYcckToCmyk(data); 27624 } else if (forceRGB) { 27625 return this._convertCmykToRgb(data); 27626 } 27627 } 27628 27629 return data; 27630 } 27631 27632 }; 27633 return JpegImage; 27634}(); 27635 27636exports.JpegImage = JpegImage; 27637 27638/***/ }), 27639/* 20 */ 27640/***/ (function(module, exports, __w_pdfjs_require__) { 27641 27642"use strict"; 27643 27644 27645Object.defineProperty(exports, "__esModule", { 27646 value: true 27647}); 27648exports.JpxStream = void 0; 27649 27650var _stream = __w_pdfjs_require__(12); 27651 27652var _jpx = __w_pdfjs_require__(21); 27653 27654var _util = __w_pdfjs_require__(2); 27655 27656const JpxStream = function JpxStreamClosure() { 27657 function JpxStream(stream, maybeLength, dict, params) { 27658 this.stream = stream; 27659 this.maybeLength = maybeLength; 27660 this.dict = dict; 27661 this.params = params; 27662 27663 _stream.DecodeStream.call(this, maybeLength); 27664 } 27665 27666 JpxStream.prototype = Object.create(_stream.DecodeStream.prototype); 27667 Object.defineProperty(JpxStream.prototype, "bytes", { 27668 get: function JpxStream_bytes() { 27669 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 27670 }, 27671 configurable: true 27672 }); 27673 27674 JpxStream.prototype.ensureBuffer = function (requested) {}; 27675 27676 JpxStream.prototype.readBlock = function () { 27677 if (this.eof) { 27678 return; 27679 } 27680 27681 const jpxImage = new _jpx.JpxImage(); 27682 jpxImage.parse(this.bytes); 27683 const width = jpxImage.width; 27684 const height = jpxImage.height; 27685 const componentsCount = jpxImage.componentsCount;
27686 const tileCount = jpxImage.tiles.length; 27687 27688 if (tileCount === 1) { 27689 this.buffer = jpxImage.tiles[0].items; 27690 } else { 27691 const data = new Uint8ClampedArray(width * height * componentsCount); 27692 27693 for (let k = 0; k < tileCount; k++) { 27694 const tileComponents = jpxImage.tiles[k]; 27695 const tileWidth = tileComponents.width; 27696 const tileHeight = tileComponents.height; 27697 const tileLeft = tileComponents.left; 27698 const tileTop = tileComponents.top; 27699 const src = tileComponents.items; 27700 let srcPosition = 0; 27701 let dataPosition = (width * tileTop + tileLeft) * componentsCount; 27702 const imgRowSize = width * componentsCount; 27703 const tileRowSize = tileWidth * componentsCount; 27704 27705 for (let j = 0; j < tileHeight; j++) { 27706 const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 27707 data.set(rowBytes, dataPosition); 27708 srcPosition += tileRowSize; 27709 dataPosition += imgRowSize; 27710 } 27711 } 27712 27713 this.buffer = data; 27714 } 27715 27716 this.bufferLength = this.buffer.length; 27717 this.eof = true; 27718 }; 27719 27720 return JpxStream; 27721}(); 27722 27723exports.JpxStream = JpxStream; 27724 27725/***/ }), 27726/* 21 */ 27727/***/ (function(module, exports, __w_pdfjs_require__) { 27728 27729"use strict"; 27730 27731 27732Object.defineProperty(exports, "__esModule", { 27733 value: true 27734}); 27735exports.JpxImage = void 0; 27736 27737var _util = __w_pdfjs_require__(2); 27738 27739var _core_utils = __w_pdfjs_require__(8); 27740 27741var _arithmetic_decoder = __w_pdfjs_require__(17); 27742 27743class JpxError extends _util.BaseException { 27744 constructor(msg) { 27745 super(`JPX error: ${msg}`); 27746 } 27747 27748} 27749 27750var JpxImage = function JpxImageClosure() { 27751 var SubbandsGainLog2 = { 27752 LL: 0, 27753 LH: 1, 27754 HL: 1, 27755 HH: 2 27756 }; 27757 27758 function JpxImage() { 27759 this.failOnCorruptedImage = false; 27760 } 27761 27762 JpxImage.prototype = { 27763 parse: function JpxImage_parse(data) { 27764 var head = (0, _core_utils.readUint16)(data, 0); 27765 27766 if (head === 0xff4f) { 27767 this.parseCodestream(data, 0, data.length); 27768 return; 27769 } 27770 27771 var position = 0, 27772 length = data.length; 27773 27774 while (position < length) { 27775 var headerSize = 8; 27776 var lbox = (0, _core_utils.readUint32)(data, position); 27777 var tbox = (0, _core_utils.readUint32)(data, position + 4); 27778 position += headerSize; 27779 27780 if (lbox === 1) { 27781 lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4); 27782 position += 8; 27783 headerSize += 8; 27784 } 27785 27786 if (lbox === 0) { 27787 lbox = length - position + headerSize; 27788 } 27789 27790 if (lbox < headerSize) { 27791 throw new JpxError("Invalid box field size"); 27792 } 27793 27794 var dataLength = lbox - headerSize; 27795 var jumpDataLength = true; 27796 27797 switch (tbox) { 27798 case 0x6a703268: 27799 jumpDataLength = false; 27800 break; 27801 27802 case 0x636f6c72: 27803 var method = data[position]; 27804 27805 if (method === 1) { 27806 var colorspace = (0, _core_utils.readUint32)(data, position + 3); 27807 27808 switch (colorspace) { 27809 case 16: 27810 case 17: 27811 case 18: 27812 break; 27813 27814 default: 27815 (0, _util.warn)("Unknown colorspace " + colorspace); 27816 break; 27817 } 27818 } else if (method === 2) { 27819 (0, _util.info)("ICC profile not supported"); 27820 } 27821 27822 break; 27823 27824 case 0x6a703263: 27825 this.parseCodestream(data, position, position + dataLength); 27826 break; 27827 27828 case 0x6a502020: 27829 if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) { 27830 (0, _util.warn)("Invalid JP2 signature"); 27831 } 27832 27833 break; 27834 27835 case 0x6a501a1a: 27836 case 0x66747970: 27837 case 0x72726571: 27838 case 0x72657320: 27839 case 0x69686472: 27840 break; 27841 27842 default: 27843 var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff); 27844 (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")"); 27845 break; 27846 } 27847 27848 if (jumpDataLength) { 27849 position += dataLength; 27850 } 27851 } 27852 }, 27853 parseImageProperties: function JpxImage_parseImageProperties(stream) { 27854 var newByte = stream.getByte(); 27855 27856 while (newByte >= 0) { 27857 var oldByte = newByte; 27858 newByte = stream.getByte(); 27859 var code = oldByte << 8 | newByte; 27860 27861 if (code === 0xff51) { 27862 stream.skip(4); 27863 var Xsiz = stream.getInt32() >>> 0; 27864 var Ysiz = stream.getInt32() >>> 0; 27865 var XOsiz = stream.getInt32() >>> 0; 27866 var YOsiz = stream.getInt32() >>> 0; 27867 stream.skip(16); 27868 var Csiz = stream.getUint16(); 27869 this.width = Xsiz - XOsiz; 27870 this.height = Ysiz - YOsiz; 27871 this.componentsCount = Csiz; 27872 this.bitsPerComponent = 8; 27873 return; 27874 } 27875 } 27876 27877 throw new JpxError("No size marker found in JPX stream"); 27878 }, 27879 parseCodestream: function JpxImage_parseCodestream(data, start, end) { 27880 var context = {}; 27881 var doNotRecover = false;
27882 27883 try { 27884 var position = start; 27885 27886 while (position + 1 < end) { 27887 var code = (0, _core_utils.readUint16)(data, position); 27888 position += 2; 27889 var length = 0, 27890 j, 27891 sqcd, 27892 spqcds, 27893 spqcdSize, 27894 scalarExpounded, 27895 tile; 27896 27897 switch (code) { 27898 case 0xff4f: 27899 context.mainHeader = true; 27900 break; 27901 27902 case 0xffd9: 27903 break; 27904 27905 case 0xff51: 27906 length = (0, _core_utils.readUint16)(data, position); 27907 var siz = {}; 27908 siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4); 27909 siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8); 27910 siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12); 27911 siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16); 27912 siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20); 27913 siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24); 27914 siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28); 27915 siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32); 27916 var componentsCount = (0, _core_utils.readUint16)(data, position + 36); 27917 siz.Csiz = componentsCount; 27918 var components = []; 27919 j = position + 38; 27920 27921 for (var i = 0; i < componentsCount; i++) { 27922 var component = { 27923 precision: (data[j] & 0x7f) + 1, 27924 isSigned: !!(data[j] & 0x80), 27925 XRsiz: data[j + 1], 27926 YRsiz: data[j + 2] 27927 }; 27928 j += 3; 27929 calculateComponentDimensions(component, siz); 27930 components.push(component); 27931 } 27932 27933 context.SIZ = siz; 27934 context.components = components; 27935 calculateTileGrids(context, components); 27936 context.QCC = []; 27937 context.COC = []; 27938 break; 27939 27940 case 0xff5c: 27941 length = (0, _core_utils.readUint16)(data, position); 27942 var qcd = {}; 27943 j = position + 2; 27944 sqcd = data[j++]; 27945 27946 switch (sqcd & 0x1f) { 27947 case 0: 27948 spqcdSize = 8; 27949 scalarExpounded = true; 27950 break; 27951 27952 case 1: 27953 spqcdSize = 16; 27954 scalarExpounded = false; 27955 break; 27956 27957 case 2: 27958 spqcdSize = 16; 27959 scalarExpounded = true; 27960 break; 27961 27962 default: 27963 throw new Error("Invalid SQcd value " + sqcd); 27964 } 27965 27966 qcd.noQuantization = spqcdSize === 8; 27967 qcd.scalarExpounded = scalarExpounded; 27968 qcd.guardBits = sqcd >> 5; 27969 spqcds = []; 27970 27971 while (j < length + position) { 27972 var spqcd = {}; 27973 27974 if (spqcdSize === 8) { 27975 spqcd.epsilon = data[j++] >> 3; 27976 spqcd.mu = 0; 27977 } else { 27978 spqcd.epsilon = data[j] >> 3; 27979 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 27980 j += 2; 27981 } 27982 27983 spqcds.push(spqcd); 27984 } 27985 27986 qcd.SPqcds = spqcds; 27987 27988 if (context.mainHeader) { 27989 context.QCD = qcd; 27990 } else { 27991 context.currentTile.QCD = qcd; 27992 context.currentTile.QCC = []; 27993 } 27994 27995 break; 27996 27997 case 0xff5d: 27998 length = (0, _core_utils.readUint16)(data, position); 27999 var qcc = {}; 28000 j = position + 2; 28001 var cqcc; 28002 28003 if (context.SIZ.Csiz < 257) { 28004 cqcc = data[j++]; 28005 } else { 28006 cqcc = (0, _core_utils.readUint16)(data, j); 28007 j += 2; 28008 } 28009 28010 sqcd = data[j++]; 28011 28012 switch (sqcd & 0x1f) { 28013 case 0: 28014 spqcdSize = 8; 28015 scalarExpounded = true; 28016 break; 28017 28018 case 1: 28019 spqcdSize = 16; 28020 scalarExpounded = false;
28021 break; 28022 28023 case 2: 28024 spqcdSize = 16; 28025 scalarExpounded = true; 28026 break; 28027 28028 default: 28029 throw new Error("Invalid SQcd value " + sqcd); 28030 } 28031 28032 qcc.noQuantization = spqcdSize === 8; 28033 qcc.scalarExpounded = scalarExpounded; 28034 qcc.guardBits = sqcd >> 5; 28035 spqcds = []; 28036 28037 while (j < length + position) { 28038 spqcd = {}; 28039 28040 if (spqcdSize === 8) { 28041 spqcd.epsilon = data[j++] >> 3; 28042 spqcd.mu = 0; 28043 } else { 28044 spqcd.epsilon = data[j] >> 3; 28045 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 28046 j += 2; 28047 } 28048 28049 spqcds.push(spqcd); 28050 } 28051 28052 qcc.SPqcds = spqcds; 28053 28054 if (context.mainHeader) { 28055 context.QCC[cqcc] = qcc; 28056 } else { 28057 context.currentTile.QCC[cqcc] = qcc; 28058 } 28059 28060 break; 28061 28062 case 0xff52: 28063 length = (0, _core_utils.readUint16)(data, position); 28064 var cod = {}; 28065 j = position + 2; 28066 var scod = data[j++]; 28067 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 28068 cod.sopMarkerUsed = !!(scod & 2); 28069 cod.ephMarkerUsed = !!(scod & 4); 28070 cod.progressionOrder = data[j++]; 28071 cod.layersCount = (0, _core_utils.readUint16)(data, j); 28072 j += 2; 28073 cod.multipleComponentTransform = data[j++]; 28074 cod.decompositionLevelsCount = data[j++]; 28075 cod.xcb = (data[j++] & 0xf) + 2; 28076 cod.ycb = (data[j++] & 0xf) + 2; 28077 var blockStyle = data[j++]; 28078 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 28079 cod.resetContextProbabilities = !!(blockStyle & 2); 28080 cod.terminationOnEachCodingPass = !!(blockStyle & 4); 28081 cod.verticallyStripe = !!(blockStyle & 8); 28082 cod.predictableTermination = !!(blockStyle & 16); 28083 cod.segmentationSymbolUsed = !!(blockStyle & 32); 28084 cod.reversibleTransformation = data[j++]; 28085 28086 if (cod.entropyCoderWithCustomPrecincts) { 28087 var precinctsSizes = []; 28088 28089 while (j < length + position) { 28090 var precinctsSize = data[j++]; 28091 precinctsSizes.push({ 28092 PPx: precinctsSize & 0xf, 28093 PPy: precinctsSize >> 4 28094 }); 28095 } 28096 28097 cod.precinctsSizes = precinctsSizes; 28098 } 28099 28100 var unsupported = []; 28101 28102 if (cod.selectiveArithmeticCodingBypass) { 28103 unsupported.push("selectiveArithmeticCodingBypass"); 28104 } 28105 28106 if (cod.resetContextProbabilities) { 28107 unsupported.push("resetContextProbabilities"); 28108 } 28109 28110 if (cod.terminationOnEachCodingPass) { 28111 unsupported.push("terminationOnEachCodingPass"); 28112 } 28113 28114 if (cod.verticallyStripe) { 28115 unsupported.push("verticallyStripe"); 28116 } 28117 28118 if (cod.predictableTermination) { 28119 unsupported.push("predictableTermination"); 28120 } 28121 28122 if (unsupported.length > 0) { 28123 doNotRecover = true; 28124 throw new Error("Unsupported COD options (" + unsupported.join(", ") + ")"); 28125 } 28126 28127 if (context.mainHeader) { 28128 context.COD = cod; 28129 } else { 28130 context.currentTile.COD = cod; 28131 context.currentTile.COC = []; 28132 } 28133 28134 break; 28135 28136 case 0xff90: 28137 length = (0, _core_utils.readUint16)(data, position); 28138 tile = {}; 28139 tile.index = (0, _core_utils.readUint16)(data, position + 2); 28140 tile.length = (0, _core_utils.readUint32)(data, position + 4); 28141 tile.dataEnd = tile.length + position - 2; 28142 tile.partIndex = data[position + 8]; 28143 tile.partsCount = data[position + 9]; 28144 context.mainHeader = false;
28145 28146 if (tile.partIndex === 0) { 28147 tile.COD = context.COD; 28148 tile.COC = context.COC.slice(0); 28149 tile.QCD = context.QCD; 28150 tile.QCC = context.QCC.slice(0); 28151 } 28152 28153 context.currentTile = tile; 28154 break; 28155 28156 case 0xff93: 28157 tile = context.currentTile; 28158 28159 if (tile.partIndex === 0) { 28160 initializeTile(context, tile.index); 28161 buildPackets(context); 28162 } 28163 28164 length = tile.dataEnd - position; 28165 parseTilePackets(context, data, position, length); 28166 break; 28167 28168 case 0xff55: 28169 case 0xff57: 28170 case 0xff58: 28171 case 0xff64: 28172 length = (0, _core_utils.readUint16)(data, position); 28173 break; 28174 28175 case 0xff53: 28176 throw new Error("Codestream code 0xFF53 (COC) is not implemented"); 28177 28178 default: 28179 throw new Error("Unknown codestream code: " + code.toString(16)); 28180 } 28181 28182 position += length; 28183 } 28184 } catch (e) { 28185 if (doNotRecover || this.failOnCorruptedImage) { 28186 throw new JpxError(e.message); 28187 } else { 28188 (0, _util.warn)("JPX: Trying to recover from: " + e.message); 28189 } 28190 } 28191 28192 this.tiles = transformComponents(context); 28193 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 28194 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 28195 this.componentsCount = context.SIZ.Csiz; 28196 } 28197 }; 28198 28199 function calculateComponentDimensions(component, siz) { 28200 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 28201 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 28202 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 28203 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 28204 component.width = component.x1 - component.x0; 28205 component.height = component.y1 - component.y0; 28206 } 28207 28208 function calculateTileGrids(context, components) { 28209 var siz = context.SIZ; 28210 var tile, 28211 tiles = []; 28212 var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 28213 var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 28214 28215 for (var q = 0; q < numYtiles; q++) { 28216 for (var p = 0; p < numXtiles; p++) { 28217 tile = {}; 28218 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 28219 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 28220 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 28221 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 28222 tile.width = tile.tx1 - tile.tx0; 28223 tile.height = tile.ty1 - tile.ty0; 28224 tile.components = []; 28225 tiles.push(tile); 28226 } 28227 } 28228 28229 context.tiles = tiles; 28230 var componentsCount = siz.Csiz; 28231 28232 for (var i = 0, ii = componentsCount; i < ii; i++) { 28233 var component = components[i]; 28234 28235 for (var j = 0, jj = tiles.length; j < jj; j++) { 28236 var tileComponent = {}; 28237 tile = tiles[j]; 28238 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 28239 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 28240 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 28241 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 28242 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 28243 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 28244 tile.components[i] = tileComponent; 28245 } 28246 } 28247 } 28248 28249 function getBlocksDimensions(context, component, r) { 28250 var codOrCoc = component.codingStyleParameters; 28251 var result = {}; 28252 28253 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 28254 result.PPx = 15; 28255 result.PPy = 15; 28256 } else { 28257 result.PPx = codOrCoc.precinctsSizes[r].PPx; 28258 result.PPy = codOrCoc.precinctsSizes[r].PPy; 28259 } 28260 28261 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 28262 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 28263 return result; 28264 } 28265 28266 function buildPrecincts(context, resolution, dimensions) { 28267 var precinctWidth = 1 << dimensions.PPx; 28268 var precinctHeight = 1 << dimensions.PPy; 28269 var isZeroRes = resolution.resLevel === 0; 28270 var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 28271 var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 28272 var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 28273 var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 28274 var numprecincts = numprecinctswide * numprecinctshigh; 28275 resolution.precinctParameters = { 28276 precinctWidth, 28277 precinctHeight, 28278 numprecinctswide, 28279 numprecinctshigh, 28280 numprecincts, 28281 precinctWidthInSubband, 28282 precinctHeightInSubband 28283 }; 28284 } 28285 28286 function buildCodeblocks(context, subband, dimensions) { 28287 var xcb_ = dimensions.xcb_; 28288 var ycb_ = dimensions.ycb_; 28289 var codeblockWidth = 1 << xcb_; 28290 var codeblockHeight = 1 << ycb_; 28291 var cbx0 = subband.tbx0 >> xcb_; 28292 var cby0 = subband.tby0 >> ycb_; 28293 var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 28294 var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 28295 var precinctParameters = subband.resolution.precinctParameters; 28296 var codeblocks = []; 28297 var precincts = []; 28298 var i, j, codeblock, precinctNumber; 28299 28300 for (j = cby0; j < cby1; j++) { 28301 for (i = cbx0; i < cbx1; i++) { 28302 codeblock = { 28303 cbx: i, 28304 cby: j, 28305 tbx0: codeblockWidth * i, 28306 tby0: codeblockHeight * j, 28307 tbx1: codeblockWidth * (i + 1), 28308 tby1: codeblockHeight * (j + 1) 28309 }; 28310 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 28311 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 28312 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 28313 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 28314 var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 28315 var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 28316 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 28317 codeblock.precinctNumber = precinctNumber; 28318 codeblock.subbandType = subband.type; 28319 codeblock.Lblock = 3; 28320 28321 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 28322 continue; 28323 } 28324 28325 codeblocks.push(codeblock); 28326 var precinct = precincts[precinctNumber]; 28327 28328 if (precinct !== undefined) { 28329 if (i < precinct.cbxMin) { 28330 precinct.cbxMin = i; 28331 } else if (i > precinct.cbxMax) { 28332 precinct.cbxMax = i; 28333 } 28334 28335 if (j < precinct.cbyMin) { 28336 precinct.cbxMin = j; 28337 } else if (j >
28337 precinct.cbyMax) { 28338 precinct.cbyMax = j; 28339 } 28340 } else { 28341 precincts[precinctNumber] = precinct = { 28342 cbxMin: i, 28343 cbyMin: j, 28344 cbxMax: i, 28345 cbyMax: j 28346 }; 28347 } 28348 28349 codeblock.precinct = precinct; 28350 } 28351 } 28352 28353 subband.codeblockParameters = { 28354 codeblockWidth: xcb_, 28355 codeblockHeight: ycb_, 28356 numcodeblockwide: cbx1 - cbx0 + 1, 28357 numcodeblockhigh: cby1 - cby0 + 1 28358 }; 28359 subband.codeblocks = codeblocks; 28360 subband.precincts = precincts; 28361 } 28362 28363 function createPacket(resolution, precinctNumber, layerNumber) { 28364 var precinctCodeblocks = []; 28365 var subbands = resolution.subbands; 28366 28367 for (var i = 0, ii = subbands.length; i < ii; i++) { 28368 var subband = subbands[i]; 28369 var codeblocks = subband.codeblocks; 28370 28371 for (var j = 0, jj = codeblocks.length; j < jj; j++) { 28372 var codeblock = codeblocks[j]; 28373 28374 if (codeblock.precinctNumber !== precinctNumber) { 28375 continue; 28376 } 28377 28378 precinctCodeblocks.push(codeblock); 28379 } 28380 } 28381 28382 return { 28383 layerNumber, 28384 codeblocks: precinctCodeblocks 28385 }; 28386 } 28387 28388 function LayerResolutionComponentPositionIterator(context) { 28389 var siz = context.SIZ; 28390 var tileIndex = context.currentTile.index; 28391 var tile = context.tiles[tileIndex]; 28392 var layersCount = tile.codingStyleDefaultParameters.layersCount; 28393 var componentsCount = siz.Csiz; 28394 var maxDecompositionLevelsCount = 0; 28395 28396 for (var q = 0; q < componentsCount; q++) { 28397 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 28398 } 28399 28400 var l = 0, 28401 r = 0, 28402 i = 0, 28403 k = 0; 28404 28405 this.nextPacket = function JpxImage_nextPacket() { 28406 for (; l < layersCount; l++) { 28407 for (; r <= maxDecompositionLevelsCount; r++) { 28408 for (; i < componentsCount; i++) { 28409 var component = tile.components[i]; 28410 28411 if (r > component.codingStyleParameters.decompositionLevelsCount) { 28412 continue; 28413 } 28414 28415 var resolution = component.resolutions[r]; 28416 var numprecincts = resolution.precinctParameters.numprecincts; 28417 28418 for (; k < numprecincts;) { 28419 var packet = createPacket(resolution, k, l); 28420 k++; 28421 return packet; 28422 } 28423 28424 k = 0; 28425 } 28426 28427 i = 0; 28428 } 28429 28430 r = 0; 28431 } 28432 28433 throw new JpxError("Out of packets"); 28434 }; 28435 } 28436 28437 function ResolutionLayerComponentPositionIterator(context) { 28438 var siz = context.SIZ; 28439 var tileIndex = context.currentTile.index; 28440 var tile = context.tiles[tileIndex]; 28441 var layersCount = tile.codingStyleDefaultParameters.layersCount; 28442 var componentsCount = siz.Csiz; 28443 var maxDecompositionLevelsCount = 0; 28444 28445 for (var q = 0; q < componentsCount; q++) { 28446 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 28447 } 28448 28449 var r = 0, 28450 l = 0, 28451 i = 0, 28452 k = 0; 28453 28454 this.nextPacket = function JpxImage_nextPacket() { 28455 for (; r <= maxDecompositionLevelsCount; r++) { 28456 for (; l < layersCount; l++) { 28457 for (; i < componentsCount; i++) { 28458 var component = tile.components[i]; 28459 28460 if (r > component.codingStyleParameters.decompositionLevelsCount) { 28461 continue; 28462 } 28463 28464 var resolution = component.resolutions[r]; 28465 var numprecincts = resolution.precinctParameters.numprecincts; 28466 28467 for (; k < numprecincts;) { 28468 var packet = createPacket(resolution, k, l); 28469 k++; 28470 return packet; 28471 } 28472 28473 k = 0; 28474 } 28475 28476 i = 0; 28477 } 28478 28479 l = 0; 28480 } 28481 28482 throw new JpxError("Out of packets"); 28483 }; 28484 } 28485 28486 function ResolutionPositionComponentLayerIterator(context) { 28487 var siz = context.SIZ; 28488 var tileIndex = context.currentTile.index; 28489 var tile = context.tiles[tileIndex]; 28490 var layersCount = tile.codingStyleDefaultParameters.layersCount; 28491 var componentsCount = siz.Csiz; 28492 var l, r, c, p; 28493 var maxDecompositionLevelsCount = 0; 28494 28495 for (c = 0; c < componentsCount; c++) { 28496 const component = tile.components[c]; 28497 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 28498 } 28499 28500 var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 28501 28502 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 28503 var maxNumPrecincts = 0; 28504 28505 for (c = 0; c < componentsCount; ++c) { 28506 var resolutions = tile.components[c].resolutions; 28507 28508 if (r < resolutions.length) { 28509 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 28510 } 28511 } 28512 28513 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 28514 } 28515 28516 l = 0; 28517 r = 0; 28518 c = 0; 28519 p = 0; 28520 28521 this.nextPacket = function JpxImage_nextPacket() { 28522 for (; r <= maxDecompositionLevelsCount; r++) { 28523 for (; p < maxNumPrecinctsInLevel[r]; p++) { 28524 for (; c < componentsCount; c++) { 28525 const component = tile.components[c]; 28526 28527 if (r > component.codingStyleParameters.decompositionLevelsCount) { 28528 continue; 28529 } 28530 28531 var resolution = component.resolutions[r]; 28532 var numprecincts = resolution.precinctParameters.numprecincts; 28533 28534 if (p >= numprecincts) { 28535 continue; 28536 } 28537 28538 for (; l < layersCount;) { 28539 var packet = createPacket(resolution, p, l); 28540 l++; 28541 return packet; 28542 } 28543 28544 l = 0; 28545 } 28546 28547 c = 0; 28548 } 28549 28550 p = 0; 28551 } 28552 28553 throw new JpxError("Out of packets"); 28554 }; 28555 } 28556 28557 function PositionComponentResolutionLayerIterator(context) { 28558 var siz = context.SIZ; 28559 var tileIndex = context.currentTile.index; 28560 var tile = context.tiles[tileIndex]; 28561 var layersCount = tile.codingStyleDefaultParameters.layersCount; 28562 var componentsCount = siz.Csiz; 28563 var precinctsSizes = getPrecinctSizesInImageScale(tile); 28564 var precinctsIterationSizes = precinctsSizes; 28565 var l = 0, 28566 r = 0, 28567 c = 0, 28568 px = 0, 28569 py = 0; 28570 28571 this.nextPacket = function JpxImage_nextPacket() { 28572 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 28573 for (; px < precinctsIterationSizes.maxNumWide; px++) { 28574 for (; c < componentsCount; c++) { 28575 var component = tile.components[c]; 28576 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 28577 28578 for (; r <= decompositionLevelsCount; r++) { 28579 var resolution = component.resolutions[r]; 28580 var sizeInImageScale = precinctsSizes.components[c].resolutions[r]; 28581 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 28582 28583 if (k === null) { 28584 continue; 28585 } 28586 28587 for (; l < layersCount;) { 28588 var packet = createPacket(resolution, k, l); 28589 l++; 28590 return packet; 28591 } 28592 28593 l = 0; 28594 } 28595 28596 r = 0; 28597 } 28598 28599 c = 0; 28600 } 28601 28602 px = 0; 28603 } 28604 28605 throw new JpxError("Out of packets"); 28606 }; 28607 } 28608 28609 function ComponentPositionResolutionLayerIterator(context) { 28610 var siz = context.SIZ; 28611 var tileIndex = context.currentTile.index; 28612 var tile = context.tiles[tileIndex]; 28613 var layersCount = tile.codingStyleDefaultParameters.layersCount; 28614 var componentsCount = siz.Csiz; 28615 var precinctsSizes = getPrecinctSizesInImageScale(tile); 28616 var l = 0, 28617 r = 0, 28618 c = 0, 28619 px = 0, 28620 py = 0; 28621 28622 this.nextPacket = function JpxImage_nextPacket() { 28623 for (; c < componentsCount; ++c) { 28624 var component = tile.components[c]; 28625 var precinctsIterationSizes = precinctsSizes.components[c]; 28626 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 28627 28628 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 28629 for (; px < precinctsIterationSizes.maxNumWide; px++) { 28630 for (; r <= decompositionLevelsCount; r++) { 28631 var resolution = component.resolutions[r]; 28632 var sizeInImageScale = precinctsIterationSizes.resolutions[r]; 28633 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 28634 28635 if (k === null) { 28636 continue; 28637 } 28638 28639 for (; l < layersCount;) { 28640 var packet = createPacket(resolution, k, l); 28641 l++; 28642 return packet; 28643 } 28644 28645 l = 0; 28646 } 28647 28648 r = 0; 28649 } 28650 28651 px = 0; 28652 } 28653 28654 py = 0; 28655 } 28656 28657 throw new JpxError("Out of packets"); 28658 }; 28659 } 28660 28661 function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 28662 var posX = pxIndex * precinctIterationSizes.minWidth; 28663 var posY = pyIndex * precinctIterationSizes.minHeight; 28664 28665 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 28666 return null; 28667 } 28668 28669 var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 28670 return posX / sizeInImageScale.height + startPrecinctRowIndex; 28671 } 28672 28673 function getPrecinctSizesInImageScale(tile) { 28674 var componentsCount = tile.components.length; 28675 var minWidth = Number.MAX_VALUE; 28676 var minHeight = Number.MAX_VALUE; 28677 var maxNumWide = 0; 28678 var maxNumHigh = 0; 28679 var sizePerComponent = new Array(componentsCount); 28680 28681 for (var c = 0; c < componentsCount; c++) { 28682 var component = tile.components[c]; 28683 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 28684 var sizePerResolution = new Array(decompositionLevelsCount + 1); 28685 var minWidthCurrentComponent = Number.MAX_VALUE; 28686 var minHeightCurrentComponent = Number.MAX_VALUE; 28687 var maxNumWideCurrentComponent = 0; 28688 var maxNumHighCurrentComponent = 0; 28689 var scale = 1; 28690 28691 for (var r = decompositionLevelsCount; r >= 0; --r) { 28692 var resolution = component.resolutions[r]; 28693 var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 28694 var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 28695 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 28696 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 28697 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 28698 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 28699 sizePerResolution[r] = { 28700 width: widthCurrentResolution,
28701 height: heightCurrentResolution 28702 }; 28703 scale <<= 1; 28704 } 28705 28706 minWidth = Math.min(minWidth, minWidthCurrentComponent); 28707 minHeight = Math.min(minHeight, minHeightCurrentComponent); 28708 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 28709 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 28710 sizePerComponent[c] = { 28711 resolutions: sizePerResolution, 28712 minWidth: minWidthCurrentComponent, 28713 minHeight: minHeightCurrentComponent, 28714 maxNumWide: maxNumWideCurrentComponent, 28715 maxNumHigh: maxNumHighCurrentComponent 28716 }; 28717 } 28718 28719 return { 28720 components: sizePerComponent, 28721 minWidth, 28722 minHeight, 28723 maxNumWide, 28724 maxNumHigh 28725 }; 28726 } 28727 28728 function buildPackets(context) { 28729 var siz = context.SIZ; 28730 var tileIndex = context.currentTile.index; 28731 var tile = context.tiles[tileIndex]; 28732 var componentsCount = siz.Csiz; 28733 28734 for (var c = 0; c < componentsCount; c++) { 28735 var component = tile.components[c]; 28736 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 28737 var resolutions = []; 28738 var subbands = []; 28739 28740 for (var r = 0; r <= decompositionLevelsCount; r++) { 28741 var blocksDimensions = getBlocksDimensions(context, component, r); 28742 var resolution = {}; 28743 var scale = 1 << decompositionLevelsCount - r; 28744 resolution.trx0 = Math.ceil(component.tcx0 / scale); 28745 resolution.try0 = Math.ceil(component.tcy0 / scale); 28746 resolution.trx1 = Math.ceil(component.tcx1 / scale); 28747 resolution.try1 = Math.ceil(component.tcy1 / scale); 28748 resolution.resLevel = r; 28749 buildPrecincts(context, resolution, blocksDimensions); 28750 resolutions.push(resolution); 28751 var subband; 28752 28753 if (r === 0) { 28754 subband = {}; 28755 subband.type = "LL"; 28756 subband.tbx0 = Math.ceil(component.tcx0 / scale); 28757 subband.tby0 = Math.ceil(component.tcy0 / scale); 28758 subband.tbx1 = Math.ceil(component.tcx1 / scale); 28759 subband.tby1 = Math.ceil(component.tcy1 / scale); 28760 subband.resolution = resolution; 28761 buildCodeblocks(context, subband, blocksDimensions); 28762 subbands.push(subband); 28763 resolution.subbands = [subband]; 28764 } else { 28765 var bscale = 1 << decompositionLevelsCount - r + 1; 28766 var resolutionSubbands = []; 28767 subband = {}; 28768 subband.type = "HL"; 28769 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 28770 subband.tby0 = Math.ceil(component.tcy0 / bscale); 28771 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 28772 subband.tby1 = Math.ceil(component.tcy1 / bscale); 28773 subband.resolution = resolution; 28774 buildCodeblocks(context, subband, blocksDimensions); 28775 subbands.push(subband); 28776 resolutionSubbands.push(subband); 28777 subband = {}; 28778 subband.type = "LH"; 28779 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 28780 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 28781 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 28782 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 28783 subband.resolution = resolution; 28784 buildCodeblocks(context, subband, blocksDimensions); 28785 subbands.push(subband); 28786 resolutionSubbands.push(subband); 28787 subband = {}; 28788 subband.type = "HH"; 28789 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 28790 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 28791 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 28792 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 28793 subband.resolution = resolution; 28794 buildCodeblocks(context, subband, blocksDimensions); 28795 subbands.push(subband); 28796 resolutionSubbands.push(subband); 28797 resolution.subbands = resolutionSubbands; 28798 } 28799 } 28800 28801 component.resolutions = resolutions; 28802 component.subbands = subbands; 28803 } 28804 28805 var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 28806 28807 switch (progressionOrder) { 28808 case 0: 28809 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 28810 break; 28811 28812 case 1: 28813 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 28814 break; 28815 28816 case 2: 28817 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 28818 break; 28819 28820 case 3: 28821 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 28822 break; 28823 28824 case 4: 28825 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 28826 break; 28827 28828 default: 28829 throw new JpxError(`Unsupported progression order ${progressionOrder}`); 28830 } 28831 } 28832 28833 function parseTilePackets(context, data, offset, dataLength) { 28834 var position = 0; 28835 var buffer, 28836 bufferSize = 0, 28837 skipNextBit = false;
28838 28839 function readBits(count) { 28840 while (bufferSize < count) { 28841 var b = data[offset + position]; 28842 position++; 28843 28844 if (skipNextBit) { 28845 buffer = buffer << 7 | b; 28846 bufferSize += 7; 28847 skipNextBit = false; 28848 } else { 28849 buffer = buffer << 8 | b; 28850 bufferSize += 8; 28851 } 28852 28853 if (b === 0xff) { 28854 skipNextBit = true; 28855 } 28856 } 28857 28858 bufferSize -= count; 28859 return buffer >>> bufferSize & (1 << count) - 1; 28860 } 28861 28862 function skipMarkerIfEqual(value) { 28863 if (data[offset + position - 1] === 0xff && data[offset + position] === value) { 28864 skipBytes(1); 28865 return true; 28866 } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) { 28867 skipBytes(2); 28868 return true; 28869 } 28870 28871 return false; 28872 } 28873 28874 function skipBytes(count) { 28875 position += count; 28876 } 28877 28878 function alignToByte() { 28879 bufferSize = 0; 28880 28881 if (skipNextBit) { 28882 position++; 28883 skipNextBit = false; 28884 } 28885 } 28886 28887 function readCodingpasses() { 28888 if (readBits(1) === 0) { 28889 return 1; 28890 } 28891 28892 if (readBits(1) === 0) { 28893 return 2; 28894 } 28895 28896 var value = readBits(2); 28897 28898 if (value < 3) { 28899 return value + 3; 28900 } 28901 28902 value = readBits(5); 28903 28904 if (value < 31) { 28905 return value + 6; 28906 } 28907 28908 value = readBits(7); 28909 return value + 37; 28910 } 28911 28912 var tileIndex = context.currentTile.index; 28913 var tile = context.tiles[tileIndex]; 28914 var sopMarkerUsed = context.COD.sopMarkerUsed; 28915 var ephMarkerUsed = context.COD.ephMarkerUsed; 28916 var packetsIterator = tile.packetsIterator; 28917 28918 while (position < dataLength) { 28919 alignToByte(); 28920 28921 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 28922 skipBytes(4); 28923 } 28924 28925 var packet = packetsIterator.nextPacket(); 28926 28927 if (!readBits(1)) { 28928 continue; 28929 } 28930 28931 var layerNumber = packet.layerNumber; 28932 var queue = [], 28933 codeblock; 28934 28935 for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) { 28936 codeblock = packet.codeblocks[i]; 28937 var precinct = codeblock.precinct; 28938 var codeblockColumn = codeblock.cbx - precinct.cbxMin; 28939 var codeblockRow = codeblock.cby - precinct.cbyMin; 28940 var codeblockIncluded = false; 28941 var firstTimeInclusion = false; 28942 var valueReady; 28943 28944 if (codeblock.included !== undefined) { 28945 codeblockIncluded = !!readBits(1); 28946 } else { 28947 precinct = codeblock.precinct; 28948 var inclusionTree, zeroBitPlanesTree; 28949 28950 if (precinct.inclusionTree !== undefined) { 28951 inclusionTree = precinct.inclusionTree; 28952 } else { 28953 var width = precinct.cbxMax - precinct.cbxMin + 1; 28954 var height = precinct.cbyMax - precinct.cbyMin + 1; 28955 inclusionTree = new InclusionTree(width, height, layerNumber); 28956 zeroBitPlanesTree = new TagTree(width, height); 28957 precinct.inclusionTree = inclusionTree; 28958 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 28959 } 28960 28961 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 28962 while (true) { 28963 if (readBits(1)) { 28964 valueReady = !inclusionTree.nextLevel(); 28965 28966 if (valueReady) { 28967 codeblock.included = true; 28968 codeblockIncluded = firstTimeInclusion = true; 28969 break; 28970 } 28971 } else { 28972 inclusionTree.incrementValue(layerNumber); 28973 break; 28974 } 28975 } 28976 } 28977 } 28978 28979 if (!codeblockIncluded) { 28980 continue; 28981 } 28982 28983 if (firstTimeInclusion) { 28984 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 28985 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 28986 28987 while (true) { 28988 if (readBits(1)) { 28989 valueReady = !zeroBitPlanesTree.nextLevel(); 28990 28991 if (valueReady) { 28992 break; 28993 } 28994 } else { 28995 zeroBitPlanesTree.incrementValue(); 28996 } 28997 } 28998 28999 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 29000 } 29001 29002 var codingpasses = readCodingpasses(); 29003 29004 while (readBits(1)) { 29005 codeblock.Lblock++; 29006 } 29007 29008 var codingpassesLog2 = (0, _core_utils.log2)(codingpasses); 29009 var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 29010 var codedDataLength = readBits(bits); 29011 queue.push({ 29012 codeblock, 29013 codingpasses, 29014 dataLength: codedDataLength 29015 }); 29016 } 29017 29018 alignToByte(); 29019 29020 if (ephMarkerUsed) { 29021 skipMarkerIfEqual(0x92); 29022 } 29023 29024 while (queue.length > 0) { 29025 var packetItem = queue.shift(); 29026 codeblock = packetItem.codeblock; 29027 29028 if (codeblock.data === undefined) { 29029 codeblock.data = []; 29030 } 29031 29032 codeblock.data.push({ 29033 data, 29034 start: offset + position, 29035 end: offset + position + packetItem.dataLength, 29036 codingpasses: packetItem.codingpasses 29037 }); 29038 position += packetItem.dataLength; 29039 } 29040 } 29041 29042 return position; 29043 } 29044 29045 function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) { 29046 var x0 = subband.tbx0; 29047 var y0 = subband.tby0; 29048 var width = subband.tbx1 - subband.tbx0; 29049 var codeblocks = subband.codeblocks; 29050 var right = subband.type.charAt(0) === "H" ? 1 : 0; 29051 var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0; 29052 29053 for (var i = 0, ii = codeblocks.length; i < ii; ++i) { 29054 var codeblock = codeblocks[i]; 29055 var blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 29056 var blockHeight = codeblock.tby1_ - codeblock.tby0_; 29057 29058 if (blockWidth === 0 || blockHeight === 0) { 29059 continue; 29060 } 29061 29062 if (codeblock.data === undefined) { 29063 continue; 29064 } 29065 29066 var bitModel, currentCodingpassType; 29067 bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb); 29068 currentCodingpassType = 2; 29069 var data = codeblock.data, 29070 totalLength = 0, 29071 codingpasses = 0; 29072 var j, jj, dataItem; 29073 29074 for (j = 0, jj = data.length; j < jj; j++) { 29075 dataItem = data[j]; 29076 totalLength += dataItem.end - dataItem.start; 29077 codingpasses += dataItem.codingpasses; 29078 } 29079 29080 var encodedData = new Uint8Array(totalLength); 29081 var position = 0; 29082 29083 for (j = 0, jj = data.length; j < jj; j++) { 29084 dataItem = data[j]; 29085 var chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 29086 encodedData.set(chunk, position); 29087 position += chunk.length; 29088 } 29089 29090 var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); 29091 bitModel.setDecoder(decoder); 29092 29093 for (j = 0; j < codingpasses; j++) { 29094 switch (currentCodingpassType) { 29095 case 0: 29096 bitModel.runSignificancePropagationPass(); 29097 break; 29098 29099 case 1: 29100 bitModel.runMagnitudeRefinementPass(); 29101 break; 29102 29103 case 2: 29104 bitModel.runCleanupPass(); 29105 29106 if (segmentationSymbolUsed) { 29107 bitModel.checkSegmentationSymbol(); 29108 } 29109 29110 break; 29111 } 29112 29113 currentCodingpassType = (currentCodingpassType + 1) % 3; 29114 } 29115 29116 var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 29117 var sign = bitModel.coefficentsSign; 29118 var magnitude = bitModel.coefficentsMagnitude; 29119 var bitsDecoded = bitModel.bitsDecoded; 29120 var magnitudeCorrection = reversible ? 0 : 0.5; 29121 var k, n, nb; 29122 position = 0; 29123 var interleave = subband.type !== "LL"; 29124 29125 for (j = 0; j < blockHeight; j++) { 29126 var row = offset / width | 0; 29127 var levelOffset = 2 * row * (levelWidth - width) + right + bottom; 29128 29129 for (k = 0; k < blockWidth; k++) { 29130 n = magnitude[position]; 29131 29132 if (n !== 0) { 29133 n = (n + magnitudeCorrection) * delta; 29134 29135 if (sign[position] !== 0) { 29136 n = -n; 29137 } 29138 29139 nb = bitsDecoded[position]; 29140 var pos = interleave ? levelOffset + (offset << 1) : offset; 29141 29142 if (reversible && nb >= mb) { 29143 coefficients[pos] = n; 29144 } else { 29145 coefficients[pos] = n * (1 << mb - nb); 29146 } 29147 } 29148 29149 offset++; 29150 position++; 29151 } 29152 29153 offset += width - blockWidth; 29154 } 29155 } 29156 } 29157 29158 function transformTile(context, tile, c) { 29159 var component = tile.components[c]; 29160 var codingStyleParameters = component.codingStyleParameters; 29161 var quantizationParameters = component.quantizationParameters; 29162 var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 29163 var spqcds = quantizationParameters.SPqcds; 29164 var scalarExpounded = quantizationParameters.scalarExpounded; 29165 var guardBits = quantizationParameters.guardBits;
29166 var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 29167 var precision = context.components[c].precision; 29168 var reversible = codingStyleParameters.reversibleTransformation; 29169 var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 29170 var subbandCoefficients = []; 29171 var b = 0; 29172 29173 for (var i = 0; i <= decompositionLevelsCount; i++) { 29174 var resolution = component.resolutions[i]; 29175 var width = resolution.trx1 - resolution.trx0; 29176 var height = resolution.try1 - resolution.try0; 29177 var coefficients = new Float32Array(width * height); 29178 29179 for (var j = 0, jj = resolution.subbands.length; j < jj; j++) { 29180 var mu, epsilon; 29181 29182 if (!scalarExpounded) { 29183 mu = spqcds[0].mu; 29184 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 29185 } else { 29186 mu = spqcds[b].mu; 29187 epsilon = spqcds[b].epsilon; 29188 b++; 29189 } 29190 29191 var subband = resolution.subbands[j]; 29192 var gainLog2 = SubbandsGainLog2[subband.type]; 29193 var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048); 29194 var mb = guardBits + epsilon - 1; 29195 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed); 29196 } 29197 29198 subbandCoefficients.push({ 29199 width, 29200 height, 29201 items: coefficients 29202 }); 29203 } 29204 29205 var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0); 29206 return { 29207 left: component.tcx0, 29208 top: component.tcy0, 29209 width: result.width, 29210 height: result.height, 29211 items: result.items 29212 }; 29213 } 29214 29215 function transformComponents(context) { 29216 var siz = context.SIZ; 29217 var components = context.components; 29218 var componentsCount = siz.Csiz; 29219 var resultImages = []; 29220 29221 for (var i = 0, ii = context.tiles.length; i < ii; i++) { 29222 var tile = context.tiles[i]; 29223 var transformedTiles = []; 29224 var c; 29225 29226 for (c = 0; c < componentsCount; c++) { 29227 transformedTiles[c] = transformTile(context, tile, c); 29228 } 29229 29230 var tile0 = transformedTiles[0]; 29231 var out = new Uint8ClampedArray(tile0.items.length * componentsCount); 29232 var result = { 29233 left: tile0.left, 29234 top: tile0.top, 29235 width: tile0.width, 29236 height: tile0.height, 29237 items: out 29238 }; 29239 var shift, offset; 29240 var pos = 0, 29241 j, 29242 jj, 29243 y0, 29244 y1, 29245 y2; 29246 29247 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 29248 var fourComponents = componentsCount === 4; 29249 var y0items = transformedTiles[0].items; 29250 var y1items = transformedTiles[1].items; 29251 var y2items = transformedTiles[2].items; 29252 var y3items = fourComponents ? transformedTiles[3].items : null; 29253 shift = components[0].precision - 8; 29254 offset = (128 << shift) + 0.5; 29255 var component0 = tile.components[0]; 29256 var alpha01 = componentsCount - 3; 29257 jj = y0items.length; 29258 29259 if (!component0.codingStyleParameters.reversibleTransformation) { 29260 for (j = 0; j < jj; j++, pos += alpha01) { 29261 y0 = y0items[j] + offset; 29262 y1 = y1items[j]; 29263 y2 = y2items[j]; 29264 out[pos++] = y0 + 1.402 * y2 >> shift; 29265 out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift; 29266 out[pos++] = y0 + 1.772 * y1 >> shift; 29267 } 29268 } else { 29269 for (j = 0; j < jj; j++, pos += alpha01) { 29270 y0 = y0items[j] + offset; 29271 y1 = y1items[j]; 29272 y2 = y2items[j]; 29273 const g = y0 - (y2 + y1 >> 2); 29274 out[pos++] = g + y2 >> shift; 29275 out[pos++] = g >> shift; 29276 out[pos++] = g + y1 >> shift; 29277 } 29278 } 29279 29280 if (fourComponents) { 29281 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 29282 out[pos] = y3items[j] + offset >> shift; 29283 } 29284 } 29285 } else { 29286 for (c = 0; c < componentsCount; c++) { 29287 var items = transformedTiles[c].items; 29288 shift = components[c].precision - 8; 29289 offset = (128 << shift) + 0.5; 29290 29291 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 29292 out[pos] = items[j] + offset >> shift; 29293 pos += componentsCount; 29294 } 29295 } 29296 } 29297 29298 resultImages.push(result); 29299 } 29300 29301 return resultImages; 29302 } 29303 29304 function initializeTile(context, tileIndex) { 29305 var siz = context.SIZ; 29306 var componentsCount = siz.Csiz; 29307 var tile = context.tiles[tileIndex]; 29308 29309 for (var c = 0; c < componentsCount; c++) { 29310 var component = tile.components[c]; 29311 var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 29312 component.quantizationParameters = qcdOrQcc; 29313 var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 29314 component.codingStyleParameters = codOrCoc; 29315 } 29316 29317 tile.codingStyleDefaultParameters = context.currentTile.COD; 29318 } 29319 29320 var TagTree = function TagTreeClosure() { 29321 function TagTree(width, height) { 29322 var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 29323 this.levels = []; 29324 29325 for (var i = 0; i < levelsLength; i++) { 29326 var level = { 29327 width, 29328 height, 29329 items: [] 29330 }; 29331 this.levels.push(level); 29332 width = Math.ceil(width / 2);
29333 height = Math.ceil(height / 2); 29334 } 29335 } 29336 29337 TagTree.prototype = { 29338 reset: function TagTree_reset(i, j) { 29339 var currentLevel = 0, 29340 value = 0, 29341 level; 29342 29343 while (currentLevel < this.levels.length) { 29344 level = this.levels[currentLevel]; 29345 var index = i + j * level.width; 29346 29347 if (level.items[index] !== undefined) { 29348 value = level.items[index]; 29349 break; 29350 } 29351 29352 level.index = index; 29353 i >>= 1; 29354 j >>= 1; 29355 currentLevel++; 29356 } 29357 29358 currentLevel--; 29359 level = this.levels[currentLevel]; 29360 level.items[level.index] = value; 29361 this.currentLevel = currentLevel; 29362 delete this.value; 29363 }, 29364 incrementValue: function TagTree_incrementValue() { 29365 var level = this.levels[this.currentLevel]; 29366 level.items[level.index]++; 29367 }, 29368 nextLevel: function TagTree_nextLevel() { 29369 var currentLevel = this.currentLevel; 29370 var level = this.levels[currentLevel]; 29371 var value = level.items[level.index]; 29372 currentLevel--; 29373 29374 if (currentLevel < 0) { 29375 this.value = value; 29376 return false; 29377 } 29378 29379 this.currentLevel = currentLevel; 29380 level = this.levels[currentLevel]; 29381 level.items[level.index] = value; 29382 return true; 29383 } 29384 }; 29385 return TagTree; 29386 }(); 29387 29388 var InclusionTree = function InclusionTreeClosure() { 29389 function InclusionTree(width, height, defaultValue) { 29390 var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 29391 this.levels = []; 29392 29393 for (var i = 0; i < levelsLength; i++) { 29394 var items = new Uint8Array(width * height); 29395 29396 for (var j = 0, jj = items.length; j < jj; j++) { 29397 items[j] = defaultValue; 29398 } 29399 29400 var level = { 29401 width, 29402 height, 29403 items 29404 }; 29405 this.levels.push(level); 29406 width = Math.ceil(width / 2); 29407 height = Math.ceil(height / 2); 29408 } 29409 } 29410 29411 InclusionTree.prototype = { 29412 reset: function InclusionTree_reset(i, j, stopValue) { 29413 var currentLevel = 0; 29414 29415 while (currentLevel < this.levels.length) { 29416 var level = this.levels[currentLevel]; 29417 var index = i + j * level.width; 29418 level.index = index; 29419 var value = level.items[index]; 29420 29421 if (value === 0xff) { 29422 break; 29423 } 29424 29425 if (value > stopValue) { 29426 this.currentLevel = currentLevel; 29427 this.propagateValues(); 29428 return false; 29429 } 29430 29431 i >>= 1; 29432 j >>= 1; 29433 currentLevel++; 29434 } 29435 29436 this.currentLevel = currentLevel - 1; 29437 return true; 29438 }, 29439 incrementValue: function InclusionTree_incrementValue(stopValue) { 29440 var level = this.levels[this.currentLevel]; 29441 level.items[level.index] = stopValue + 1; 29442 this.propagateValues(); 29443 }, 29444 propagateValues: function InclusionTree_propagateValues() { 29445 var levelIndex = this.currentLevel; 29446 var level = this.levels[levelIndex]; 29447 var currentValue = level.items[level.index]; 29448 29449 while (--levelIndex >= 0) { 29450 level = this.levels[levelIndex]; 29451 level.items[level.index] = currentValue; 29452 } 29453 }, 29454 nextLevel: function InclusionTree_nextLevel() { 29455 var currentLevel = this.currentLevel; 29456 var level = this.levels[currentLevel]; 29457 var value = level.items[level.index]; 29458 level.items[level.index] = 0xff; 29459 currentLevel--; 29460 29461 if (currentLevel < 0) { 29462 return false; 29463 } 29464 29465 this.currentLevel = currentLevel; 29466 level = this.levels[currentLevel]; 29467 level.items[level.index] = value; 29468 return true; 29469 } 29470 }; 29471 return InclusionTree; 29472 }(); 29473 29474 var BitModel = function BitModelClosure() { 29475 var UNIFORM_CONTEXT = 17; 29476 var RUNLENGTH_CONTEXT = 18; 29477 var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]); 29478 var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]); 29479 var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]); 29480 29481 function BitModel(width, height, subband, zeroBitPlanes, mb) { 29482 this.width = width; 29483 this.height = height; 29484 let contextLabelTable; 29485 29486 if (subband === "HH") { 29487 contextLabelTable = HHContextLabel; 29488 } else if (subband === "HL") { 29489 contextLabelTable = HLContextLabel; 29490 } else { 29491 contextLabelTable = LLAndLHContextsLabel; 29492 } 29493 29494 this.contextLabelTable = contextLabelTable; 29495 var coefficientCount = width * height; 29496 this.neighborsSignificance = new Uint8Array(coefficientCount); 29497 this.coefficentsSign = new Uint8Array(coefficientCount); 29498 let coefficentsMagnitude; 29499 29500 if (mb > 14) { 29501 coefficentsMagnitude = new Uint32Array(coefficientCount); 29502 } else if (mb > 6) { 29503 coefficentsMagnitude = new Uint16Array(coefficientCount); 29504 } else { 29505 coefficentsMagnitude = new Uint8Array(coefficientCount); 29506 } 29507 29508 this.coefficentsMagnitude = coefficentsMagnitude; 29509 this.processingFlags = new Uint8Array(coefficientCount); 29510 var bitsDecoded = new Uint8Array(coefficientCount); 29511 29512 if (zeroBitPlanes !== 0) { 29513 for (var i = 0; i < coefficientCount; i++) { 29514 bitsDecoded[i] = zeroBitPlanes; 29515 } 29516 } 29517 29518 this.bitsDecoded = bitsDecoded; 29519 this.reset(); 29520 } 29521 29522 BitModel.prototype = { 29523 setDecoder: function BitModel_setDecoder(decoder) { 29524 this.decoder = decoder; 29525 }, 29526 reset: function BitModel_reset() { 29527 this.contexts = new Int8Array(19); 29528 this.contexts[0] = 4 << 1 | 0; 29529 this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0; 29530 this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0; 29531 }, 29532 setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) { 29533 var neighborsSignificance = this.neighborsSignificance; 29534 var width = this.width, 29535 height = this.height; 29536 var left = column > 0; 29537 var right = column + 1 < width; 29538 var i; 29539 29540 if (row > 0) { 29541 i = index - width; 29542 29543 if (left) { 29544 neighborsSignificance[i - 1] += 0x10; 29545 } 29546 29547 if (right) { 29548 neighborsSignificance[i + 1] += 0x10; 29549 } 29550
29551 neighborsSignificance[i] += 0x04; 29552 } 29553 29554 if (row + 1 < height) { 29555 i = index + width; 29556 29557 if (left) { 29558 neighborsSignificance[i - 1] += 0x10; 29559 } 29560 29561 if (right) { 29562 neighborsSignificance[i + 1] += 0x10; 29563 } 29564 29565 neighborsSignificance[i] += 0x04; 29566 } 29567 29568 if (left) { 29569 neighborsSignificance[index - 1] += 0x01; 29570 } 29571 29572 if (right) { 29573 neighborsSignificance[index + 1] += 0x01; 29574 } 29575 29576 neighborsSignificance[index] |= 0x80; 29577 }, 29578 runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() { 29579 var decoder = this.decoder; 29580 var width = this.width, 29581 height = this.height; 29582 var coefficentsMagnitude = this.coefficentsMagnitude; 29583 var coefficentsSign = this.coefficentsSign; 29584 var neighborsSignificance = this.neighborsSignificance; 29585 var processingFlags = this.processingFlags; 29586 var contexts = this.contexts; 29587 var labels = this.contextLabelTable; 29588 var bitsDecoded = this.bitsDecoded; 29589 var processedInverseMask = ~1; 29590 var processedMask = 1; 29591 var firstMagnitudeBitMask = 2; 29592 29593 for (var i0 = 0; i0 < height; i0 += 4) { 29594 for (var j = 0; j < width; j++) { 29595 var index = i0 * width + j; 29596 29597 for (var i1 = 0; i1 < 4; i1++, index += width) { 29598 var i = i0 + i1; 29599 29600 if (i >= height) { 29601 break; 29602 } 29603 29604 processingFlags[index] &= processedInverseMask; 29605 29606 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 29607 continue; 29608 } 29609 29610 var contextLabel = labels[neighborsSignificance[index]]; 29611 var decision = decoder.readBit(contexts, contextLabel); 29612 29613 if (decision) { 29614 var sign = this.decodeSignBit(i, j, index); 29615 coefficentsSign[index] = sign; 29616 coefficentsMagnitude[index] = 1; 29617 this.setNeighborsSignificance(i, j, index); 29618 processingFlags[index] |= firstMagnitudeBitMask; 29619 } 29620 29621 bitsDecoded[index]++; 29622 processingFlags[index] |= processedMask; 29623 } 29624 } 29625 } 29626 }, 29627 decodeSignBit: function BitModel_decodeSignBit(row, column, index) { 29628 var width = this.width, 29629 height = this.height; 29630 var coefficentsMagnitude = this.coefficentsMagnitude; 29631 var coefficentsSign = this.coefficentsSign; 29632 var contribution, sign0, sign1, significance1; 29633 var contextLabel, decoded; 29634 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 29635 29636 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 29637 sign1 = coefficentsSign[index + 1]; 29638 29639 if (significance1) { 29640 sign0 = coefficentsSign[index - 1]; 29641 contribution = 1 - sign1 - sign0; 29642 } else { 29643 contribution = 1 - sign1 - sign1; 29644 } 29645 } else if (significance1) { 29646 sign0 = coefficentsSign[index - 1]; 29647 contribution = 1 - sign0 - sign0; 29648 } else { 29649 contribution = 0; 29650 } 29651 29652 var horizontalContribution = 3 * contribution; 29653 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 29654 29655 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 29656 sign1 = coefficentsSign[index + width]; 29657 29658 if (significance1) { 29659 sign0 = coefficentsSign[index - width]; 29660 contribution = 1 - sign1 - sign0 + horizontalContribution; 29661 } else { 29662 contribution = 1 - sign1 - sign1 + horizontalContribution; 29663 } 29664 } else if (significance1) { 29665 sign0 = coefficentsSign[index - width]; 29666 contribution = 1 - sign0 - sign0 + horizontalContribution; 29667 } else { 29668 contribution = horizontalContribution; 29669 } 29670 29671 if (contribution >= 0) { 29672 contextLabel = 9 + contribution; 29673 decoded = this.decoder.readBit(this.contexts, contextLabel); 29674 } else { 29675 contextLabel = 9 - contribution; 29676 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 29677 } 29678 29679 return decoded; 29680 }, 29681 runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() { 29682 var decoder = this.decoder; 29683 var width = this.width, 29684 height = this.height; 29685 var coefficentsMagnitude = this.coefficentsMagnitude; 29686 var neighborsSignificance = this.neighborsSignificance; 29687 var contexts = this.contexts; 29688 var bitsDecoded = this.bitsDecoded; 29689 var processingFlags = this.processingFlags; 29690 var processedMask = 1; 29691 var firstMagnitudeBitMask = 2; 29692 var length = width * height; 29693 var width4 = width * 4; 29694 29695 for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) { 29696 indexNext = Math.min(length, index0 + width4); 29697 29698 for (var j = 0; j < width; j++) { 29699 for (var index = index0 + j; index < indexNext; index += width) { 29700 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 29701 continue; 29702 } 29703 29704 var contextLabel = 16; 29705 29706 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 29707 processingFlags[index] ^= firstMagnitudeBitMask; 29708 var significance = neighborsSignificance[index] & 127; 29709 contextLabel = significance === 0 ? 15 : 14; 29710 } 29711 29712 var bit = decoder.readBit(contexts, contextLabel); 29713 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 29714 bitsDecoded[index]++; 29715 processingFlags[index] |= processedMask; 29716 } 29717 } 29718 } 29719 }, 29720 runCleanupPass: function BitModel_runCleanupPass() { 29721 var decoder = this.decoder; 29722 var width = this.width, 29723 height = this.height; 29724 var neighborsSignificance = this.neighborsSignificance; 29725 var coefficentsMagnitude = this.coefficentsMagnitude; 29726 var coefficentsSign = this.coefficentsSign; 29727 var contexts = this.contexts; 29728 var labels = this.contextLabelTable; 29729 var bitsDecoded = this.bitsDecoded; 29730 var processingFlags = this.processingFlags; 29731 var processedMask = 1; 29732 var firstMagnitudeBitMask = 2; 29733 var oneRowDown = width; 29734 var twoRowsDown = width * 2; 29735 var threeRowsDown = width * 3; 29736 var iNext; 29737 29738 for (var i0 = 0; i0 < height; i0 = iNext) { 29739 iNext = Math.min(i0 + 4, height); 29740 var indexBase = i0 * width; 29741 var checkAllEmpty = i0 + 3 < height; 29742 29743 for (var j = 0; j < width; j++) { 29744 var index0 = indexBase + j; 29745 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; 29746 var i1 = 0, 29747 index = index0; 29748 var i = i0, 29749 sign; 29750 29751 if (allEmpty) { 29752 var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT); 29753 29754 if (!hasSignificantCoefficent) { 29755 bitsDecoded[index0]++; 29756 bitsDecoded[index0 + oneRowDown]++; 29757 bitsDecoded[index0 + twoRowsDown]++; 29758 bitsDecoded[index0 + threeRowsDown]++; 29759 continue; 29760 } 29761 29762 i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 29763 29764 if (i1 !== 0) { 29765 i = i0 + i1; 29766 index += i1 * width; 29767 } 29768 29769 sign = this.decodeSignBit(i, j, index); 29770 coefficentsSign[index] = sign; 29771 coefficentsMagnitude[index] = 1; 29772 this.setNeighborsSignificance(i, j, index);
29773 processingFlags[index] |= firstMagnitudeBitMask; 29774 index = index0; 29775 29776 for (var i2 = i0; i2 <= i; i2++, index += width) { 29777 bitsDecoded[index]++; 29778 } 29779 29780 i1++; 29781 } 29782 29783 for (i = i0 + i1; i < iNext; i++, index += width) { 29784 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 29785 continue; 29786 } 29787 29788 var contextLabel = labels[neighborsSignificance[index]]; 29789 var decision = decoder.readBit(contexts, contextLabel); 29790 29791 if (decision === 1) { 29792 sign = this.decodeSignBit(i, j, index); 29793 coefficentsSign[index] = sign; 29794 coefficentsMagnitude[index] = 1; 29795 this.setNeighborsSignificance(i, j, index); 29796 processingFlags[index] |= firstMagnitudeBitMask; 29797 } 29798 29799 bitsDecoded[index]++; 29800 } 29801 } 29802 } 29803 }, 29804 checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() { 29805 var decoder = this.decoder; 29806 var contexts = this.contexts; 29807 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); 29808 29809 if (symbol !== 0xa) { 29810 throw new JpxError("Invalid segmentation symbol"); 29811 } 29812 } 29813 }; 29814 return BitModel; 29815 }(); 29816 29817 var Transform = function TransformClosure() { 29818 function Transform() {} 29819 29820 Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) { 29821 var ll = subbands[0]; 29822 29823 for (var i = 1, ii = subbands.length; i < ii; i++) { 29824 ll = this.iterate(ll, subbands[i], u0, v0); 29825 } 29826 29827 return ll; 29828 }; 29829 29830 Transform.prototype.extend = function extend(buffer, offset, size) { 29831 var i1 = offset - 1, 29832 j1 = offset + 1; 29833 var i2 = offset + size - 2, 29834 j2 = offset + size; 29835 buffer[i1--] = buffer[j1++]; 29836 buffer[j2++] = buffer[i2--]; 29837 buffer[i1--] = buffer[j1++]; 29838 buffer[j2++] = buffer[i2--]; 29839 buffer[i1--] = buffer[j1++]; 29840 buffer[j2++] = buffer[i2--]; 29841 buffer[i1] = buffer[j1]; 29842 buffer[j2] = buffer[i2]; 29843 }; 29844 29845 Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) { 29846 var llWidth = ll.width, 29847 llHeight = ll.height, 29848 llItems = ll.items; 29849 var width = hl_lh_hh.width; 29850 var height = hl_lh_hh.height; 29851 var items = hl_lh_hh.items; 29852 var i, j, k, l, u, v; 29853 29854 for (k = 0, i = 0; i < llHeight; i++) { 29855 l = i * 2 * width; 29856 29857 for (j = 0; j < llWidth; j++, k++, l += 2) { 29858 items[l] = llItems[k]; 29859 } 29860 } 29861 29862 llItems = ll.items = null; 29863 var bufferPadding = 4; 29864 var rowBuffer = new Float32Array(width + 2 * bufferPadding); 29865 29866 if (width === 1) { 29867 if ((u0 & 1) !== 0) { 29868 for (v = 0, k = 0; v < height; v++, k += width) { 29869 items[k] *= 0.5; 29870 } 29871 } 29872 } else { 29873 for (v = 0, k = 0; v < height; v++, k += width) { 29874 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 29875 this.extend(rowBuffer, bufferPadding, width); 29876 this.filter(rowBuffer, bufferPadding, width); 29877 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 29878 } 29879 } 29880 29881 var numBuffers = 16; 29882 var colBuffers = []; 29883 29884 for (i = 0; i < numBuffers; i++) { 29885 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 29886 } 29887 29888 var b, 29889 currentBuffer = 0; 29890 ll = bufferPadding + height; 29891 29892 if (height === 1) { 29893 if ((v0 & 1) !== 0) { 29894 for (u = 0; u < width; u++) { 29895 items[u] *= 0.5; 29896 } 29897 } 29898 } else { 29899 for (u = 0; u < width; u++) { 29900 if (currentBuffer === 0) { 29901 numBuffers = Math.min(width - u, numBuffers); 29902 29903 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 29904 for (b = 0; b < numBuffers; b++) { 29905 colBuffers[b][l] = items[k + b]; 29906 } 29907 } 29908 29909 currentBuffer = numBuffers; 29910 } 29911 29912 currentBuffer--; 29913 var buffer = colBuffers[currentBuffer]; 29914 this.extend(buffer, bufferPadding, height); 29915 this.filter(buffer, bufferPadding, height); 29916 29917 if (currentBuffer === 0) { 29918 k = u - numBuffers + 1; 29919 29920 for (l = bufferPadding; l < ll; k += width, l++) { 29921 for (b = 0; b < numBuffers; b++) { 29922 items[k + b] = colBuffers[b][l]; 29923 } 29924 } 29925 } 29926 } 29927 } 29928 29929 return { 29930 width, 29931 height, 29932 items 29933 }; 29934 }; 29935 29936 return Transform; 29937 }(); 29938 29939 var IrreversibleTransform = function IrreversibleTransformClosure() { 29940 function IrreversibleTransform() { 29941 Transform.call(this); 29942 } 29943 29944 IrreversibleTransform.prototype = Object.create(Transform.prototype); 29945 29946 IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) { 29947 var len = length >> 1; 29948 offset = offset | 0; 29949 var j, n, current, next; 29950 var alpha = -1.586134342059924; 29951 var beta = -0.052980118572961; 29952 var gamma = 0.882911075530934; 29953 var delta = 0.443506852043971; 29954 var K = 1.230174104914001; 29955 var K_ = 1 / K; 29956 j = offset - 3; 29957 29958 for (n = len + 4; n--; j += 2) { 29959 x[j] *= K_; 29960 } 29961 29962 j = offset - 2; 29963 current = delta * x[j - 1]; 29964 29965 for (n = len + 3; n--; j += 2) { 29966 next = delta * x[j + 1]; 29967 x[j] = K * x[j] - current - next; 29968 29969 if (n--) { 29970 j += 2; 29971 current = delta * x[j + 1]; 29972 x[j] = K * x[j] - current - next; 29973 } else { 29974 break; 29975 } 29976 } 29977 29978 j = offset - 1; 29979 current = gamma * x[j - 1]; 29980 29981 for (n = len + 2; n--; j += 2) { 29982 next = gamma * x[j + 1]; 29983 x[j] -= current + next; 29984 29985 if (n--) { 29986 j += 2; 29987 current = gamma * x[j + 1]; 29988 x[j] -= current + next; 29989 } else { 29990 break; 29991 } 29992 } 29993 29994 j = offset; 29995 current = beta * x[j - 1]; 29996 29997 for (n = len + 1; n--; j += 2) { 29998 next = beta * x[j + 1]; 29999 x[j] -= current + next; 30000 30001 if (n--) { 30002 j += 2; 30003 current = beta * x[j + 1]; 30004 x[j] -= current + next; 30005 } else { 30006 break; 30007 } 30008 } 30009 30010 if (len !== 0) { 30011 j = offset + 1; 30012 current = alpha * x[j - 1]; 30013 30014 for (n = len; n--; j += 2) { 30015 next = alpha * x[j + 1]; 30016 x[j] -= current + next; 30017 30018 if (n--) { 30019 j += 2; 30020 current = alpha * x[j + 1]; 30021 x[j] -= current + next; 30022 } else { 30023 break; 30024 } 30025 } 30026 } 30027 }; 30028 30029 return IrreversibleTransform; 30030 }(); 30031
30032 var ReversibleTransform = function ReversibleTransformClosure() { 30033 function ReversibleTransform() { 30034 Transform.call(this); 30035 } 30036 30037 ReversibleTransform.prototype = Object.create(Transform.prototype); 30038 30039 ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) { 30040 var len = length >> 1; 30041 offset = offset | 0; 30042 var j, n; 30043 30044 for (j = offset, n = len + 1; n--; j += 2) { 30045 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 30046 } 30047 30048 for (j = offset + 1, n = len; n--; j += 2) { 30049 x[j] += x[j - 1] + x[j + 1] >> 1; 30050 } 30051 }; 30052 30053 return ReversibleTransform; 30054 }(); 30055 30056 return JpxImage; 30057}(); 30058 30059exports.JpxImage = JpxImage; 30060 30061/***/ }), 30062/* 22 */ 30063/***/ (function(module, exports, __w_pdfjs_require__) { 30064 30065"use strict"; 30066 30067 30068Object.defineProperty(exports, "__esModule", { 30069 value: true 30070}); 30071exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; 30072 30073var _util = __w_pdfjs_require__(2); 30074 30075var _primitives = __w_pdfjs_require__(5); 30076 30077var _stream = __w_pdfjs_require__(12); 30078 30079var ARCFourCipher = function ARCFourCipherClosure() { 30080 function ARCFourCipher(key) { 30081 this.a = 0; 30082 this.b = 0; 30083 var s = new Uint8Array(256); 30084 var i, 30085 j = 0, 30086 tmp, 30087 keyLength = key.length; 30088 30089 for (i = 0; i < 256; ++i) { 30090 s[i] = i; 30091 } 30092 30093 for (i = 0; i < 256; ++i) { 30094 tmp = s[i]; 30095 j = j + tmp + key[i % keyLength] & 0xff; 30096 s[i] = s[j]; 30097 s[j] = tmp; 30098 } 30099 30100 this.s = s; 30101 } 30102 30103 ARCFourCipher.prototype = { 30104 encryptBlock: function ARCFourCipher_encryptBlock(data) { 30105 var i, 30106 n = data.length, 30107 tmp, 30108 tmp2; 30109 var a = this.a, 30110 b = this.b, 30111 s = this.s; 30112 var output = new Uint8Array(n); 30113 30114 for (i = 0; i < n; ++i) { 30115 a = a + 1 & 0xff; 30116 tmp = s[a]; 30117 b = b + tmp & 0xff; 30118 tmp2 = s[b]; 30119 s[a] = tmp2; 30120 s[b] = tmp; 30121 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 30122 } 30123 30124 this.a = a; 30125 this.b = b; 30126 return output; 30127 } 30128 }; 30129 ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock; 30130 return ARCFourCipher; 30131}(); 30132 30133exports.ARCFourCipher = ARCFourCipher; 30134 30135var calculateMD5 = function calculateMD5Closure() { 30136 var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]); 30137 var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]); 30138 30139 function hash(data, offset, length) { 30140 var h0 = 1732584193, 30141 h1 = -271733879, 30142 h2 = -1732584194, 30143 h3 = 271733878; 30144 var paddedLength = length + 72 & ~63; 30145 var padded = new Uint8Array(paddedLength); 30146 var i, j, n; 30147 30148 for (i = 0; i < length; ++i) { 30149 padded[i] = data[offset++]; 30150 } 30151 30152 padded[i++] = 0x80; 30153 n = paddedLength - 8; 30154 30155 while (i < n) { 30156 padded[i++] = 0; 30157 } 30158 30159 padded[i++] = length << 3 & 0xff; 30160 padded[i++] = length >> 5 & 0xff;
30161 padded[i++] = length >> 13 & 0xff; 30162 padded[i++] = length >> 21 & 0xff; 30163 padded[i++] = length >>> 29 & 0xff; 30164 padded[i++] = 0; 30165 padded[i++] = 0; 30166 padded[i++] = 0; 30167 var w = new Int32Array(16); 30168 30169 for (i = 0; i < paddedLength;) { 30170 for (j = 0; j < 16; ++j, i += 4) { 30171 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 30172 } 30173 30174 var a = h0, 30175 b = h1, 30176 c = h2, 30177 d = h3, 30178 f, 30179 g; 30180 30181 for (j = 0; j < 64; ++j) { 30182 if (j < 16) { 30183 f = b & c | ~b & d; 30184 g = j; 30185 } else if (j < 32) { 30186 f = d & b | ~d & c; 30187 g = 5 * j + 1 & 15; 30188 } else if (j < 48) { 30189 f = b ^ c ^ d; 30190 g = 3 * j + 5 & 15; 30191 } else { 30192 f = c ^ (b | ~d); 30193 g = 7 * j & 15; 30194 } 30195 30196 var tmp = d, 30197 rotateArg = a + f + k[j] + w[g] | 0, 30198 rotate = r[j]; 30199 d = c; 30200 c = b; 30201 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 30202 a = tmp; 30203 } 30204 30205 h0 = h0 + a | 0; 30206 h1 = h1 + b | 0; 30207 h2 = h2 + c | 0; 30208 h3 = h3 + d | 0; 30209 } 30210 30211 return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]); 30212 } 30213 30214 return hash; 30215}(); 30216 30217exports.calculateMD5 = calculateMD5; 30218 30219var Word64 = function Word64Closure() { 30220 function Word64(highInteger, lowInteger) { 30221 this.high = highInteger | 0; 30222 this.low = lowInteger | 0; 30223 } 30224 30225 Word64.prototype = { 30226 and: function Word64_and(word) { 30227 this.high &= word.high; 30228 this.low &= word.low; 30229 }, 30230 xor: function Word64_xor(word) { 30231 this.high ^= word.high; 30232 this.low ^= word.low; 30233 }, 30234 or: function Word64_or(word) { 30235 this.high |= word.high; 30236 this.low |= word.low; 30237 }, 30238 shiftRight: function Word64_shiftRight(places) { 30239 if (places >= 32) { 30240 this.low = this.high >>> places - 32 | 0; 30241 this.high = 0; 30242 } else { 30243 this.low = this.low >>> places | this.high << 32 - places; 30244 this.high = this.high >>> places | 0; 30245 } 30246 }, 30247 shiftLeft: function Word64_shiftLeft(places) { 30248 if (places >= 32) { 30249 this.high = this.low << places - 32; 30250 this.low = 0; 30251 } else { 30252 this.high = this.high << places | this.low >>> 32 - places; 30253 this.low = this.low << places; 30254 } 30255 }, 30256 rotateRight: function Word64_rotateRight(places) { 30257 var low, high; 30258 30259 if (places & 32) { 30260 high = this.low; 30261 low = this.high; 30262 } else { 30263 low = this.low; 30264 high = this.high; 30265 } 30266 30267 places &= 31; 30268 this.low = low >>> places | high << 32 - places; 30269 this.high = high >>> places | low << 32 - places; 30270 }, 30271 not: function Word64_not() { 30272 this.high = ~this.high; 30273 this.low = ~this.low; 30274 }, 30275 add: function Word64_add(word) { 30276 var lowAdd = (this.low >>> 0) + (word.low >>> 0); 30277 var highAdd = (this.high >>> 0) + (word.high >>> 0); 30278 30279 if (lowAdd > 0xffffffff) { 30280 highAdd += 1; 30281 } 30282 30283 this.low = lowAdd | 0; 30284 this.high = highAdd | 0; 30285 }, 30286 copyTo: function Word64_copyTo(bytes, offset) { 30287 bytes[offset] = this.high >>> 24 & 0xff; 30288 bytes[offset + 1] = this.high >> 16 & 0xff; 30289 bytes[offset + 2] = this.high >> 8 & 0xff; 30290 bytes[offset + 3] = this.high & 0xff; 30291 bytes[offset + 4] = this.low >>> 24 & 0xff; 30292 bytes[offset + 5] = this.low >> 16 & 0xff; 30293 bytes[offset + 6] = this.low >> 8 & 0xff; 30294 bytes[offset + 7] = this.low & 0xff; 30295 }, 30296 assign: function Word64_assign(word) { 30297 this.high = word.high; 30298 this.low = word.low; 30299 } 30300 }; 30301 return Word64; 30302}(); 30303 30304var calculateSHA256 = function calculateSHA256Closure() { 30305 function rotr(x, n) { 30306 return x >>> n | x << 32 - n; 30307 } 30308 30309 function ch(x, y, z) { 30310 return x & y ^ ~x & z; 30311 } 30312 30313 function maj(x, y, z) { 30314 return x & y ^ x & z ^ y & z; 30315 } 30316 30317 function sigma(x) {
30318 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 30319 } 30320 30321 function sigmaPrime(x) { 30322 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 30323 } 30324 30325 function littleSigma(x) { 30326 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 30327 } 30328 30329 function littleSigmaPrime(x) { 30330 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 30331 } 30332 30333 var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; 30334 30335 function hash(data, offset, length) { 30336 var h0 = 0x6a09e667, 30337 h1 = 0xbb67ae85, 30338 h2 = 0x3c6ef372, 30339 h3 = 0xa54ff53a, 30340 h4 = 0x510e527f, 30341 h5 = 0x9b05688c, 30342 h6 = 0x1f83d9ab, 30343 h7 = 0x5be0cd19; 30344 var paddedLength = Math.ceil((length + 9) / 64) * 64; 30345 var padded = new Uint8Array(paddedLength); 30346 var i, j, n; 30347 30348 for (i = 0; i < length; ++i) { 30349 padded[i] = data[offset++]; 30350 } 30351 30352 padded[i++] = 0x80; 30353 n = paddedLength - 8; 30354 30355 while (i < n) { 30356 padded[i++] = 0; 30357 } 30358 30359 padded[i++] = 0; 30360 padded[i++] = 0; 30361 padded[i++] = 0; 30362 padded[i++] = length >>> 29 & 0xff; 30363 padded[i++] = length >> 21 & 0xff; 30364 padded[i++] = length >> 13 & 0xff; 30365 padded[i++] = length >> 5 & 0xff;
30366 padded[i++] = length << 3 & 0xff; 30367 var w = new Uint32Array(64); 30368 30369 for (i = 0; i < paddedLength;) { 30370 for (j = 0; j < 16; ++j) { 30371 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 30372 i += 4; 30373 } 30374 30375 for (j = 16; j < 64; ++j) { 30376 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 30377 } 30378 30379 var a = h0, 30380 b = h1, 30381 c = h2, 30382 d = h3, 30383 e = h4, 30384 f = h5, 30385 g = h6, 30386 h = h7, 30387 t1, 30388 t2; 30389 30390 for (j = 0; j < 64; ++j) { 30391 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 30392 t2 = sigma(a) + maj(a, b, c); 30393 h = g; 30394 g = f; 30395 f = e; 30396 e = d + t1 | 0; 30397 d = c; 30398 c = b; 30399 b = a; 30400 a = t1 + t2 | 0; 30401 } 30402 30403 h0 = h0 + a | 0; 30404 h1 = h1 + b | 0; 30405 h2 = h2 + c | 0; 30406 h3 = h3 + d | 0; 30407 h4 = h4 + e | 0; 30408 h5 = h5 + f | 0; 30409 h6 = h6 + g | 0; 30410 h7 = h7 + h | 0; 30411 } 30412 30413 return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]); 30414 } 30415 30416 return hash; 30417}(); 30418 30419exports.calculateSHA256 = calculateSHA256; 30420 30421var calculateSHA512 = function calculateSHA512Closure() { 30422 function ch(result, x, y, z, tmp) { 30423 result.assign(x); 30424 result.and(y); 30425 tmp.assign(x); 30426 tmp.not(); 30427 tmp.and(z); 30428 result.xor(tmp); 30429 } 30430 30431 function maj(result, x, y, z, tmp) { 30432 result.assign(x); 30433 result.and(y); 30434 tmp.assign(x); 30435 tmp.and(z); 30436 result.xor(tmp); 30437 tmp.assign(y); 30438 tmp.and(z); 30439 result.xor(tmp); 30440 } 30441 30442 function sigma(result, x, tmp) { 30443 result.assign(x); 30444 result.rotateRight(28); 30445 tmp.assign(x); 30446 tmp.rotateRight(34); 30447 result.xor(tmp); 30448 tmp.assign(x); 30449 tmp.rotateRight(39); 30450 result.xor(tmp); 30451 } 30452 30453 function sigmaPrime(result, x, tmp) { 30454 result.assign(x); 30455 result.rotateRight(14); 30456 tmp.assign(x); 30457 tmp.rotateRight(18); 30458 result.xor(tmp); 30459 tmp.assign(x); 30460 tmp.rotateRight(41); 30461 result.xor(tmp); 30462 } 30463 30464 function littleSigma(result, x, tmp) { 30465 result.assign(x); 30466 result.rotateRight(1); 30467 tmp.assign(x); 30468 tmp.rotateRight(8); 30469 result.xor(tmp); 30470 tmp.assign(x); 30471 tmp.shiftRight(7); 30472 result.xor(tmp); 30473 } 30474 30475 function littleSigmaPrime(result, x, tmp) { 30476 result.assign(x); 30477 result.rotateRight(19); 30478 tmp.assign(x); 30479 tmp.rotateRight(61); 30480 result.xor(tmp); 30481 tmp.assign(x); 30482 tmp.shiftRight(6); 30483 result.xor(tmp); 30484 } 30485 30486 var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb,
304860x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]; 30487 30488 function hash(data, offset, length, mode384) { 30489 mode384 = !!mode384; 30490 var h0, h1, h2, h3, h4, h5, h6, h7; 30491 30492 if (!mode384) { 30493 h0 = new Word64(0x6a09e667, 0xf3bcc908); 30494 h1 = new Word64(0xbb67ae85, 0x84caa73b); 30495 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 30496 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 30497 h4 = new Word64(0x510e527f, 0xade682d1); 30498 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 30499 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 30500 h7 = new Word64(0x5be0cd19, 0x137e2179); 30501 } else { 30502 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 30503 h1 = new Word64(0x629a292a, 0x367cd507); 30504 h2 = new Word64(0x9159015a, 0x3070dd17); 30505 h3 = new Word64(0x152fecd8, 0xf70e5939); 30506 h4 = new Word64(0x67332667, 0xffc00b31); 30507 h5 = new Word64(0x8eb44a87, 0x68581511); 30508 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 30509 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 30510 } 30511 30512 var paddedLength = Math.ceil((length + 17) / 128) * 128; 30513 var padded = new Uint8Array(paddedLength); 30514 var i, j, n; 30515 30516 for (i = 0; i < length; ++i) { 30517 padded[i] = data[offset++]; 30518 } 30519 30520 padded[i++] = 0x80; 30521 n = paddedLength - 16; 30522 30523 while (i < n) { 30524 padded[i++] = 0; 30525 } 30526 30527 padded[i++] = 0; 30528 padded[i++] = 0; 30529 padded[i++] = 0; 30530 padded[i++] = 0; 30531 padded[i++] = 0; 30532 padded[i++] = 0; 30533 padded[i++] = 0; 30534 padded[i++] = 0; 30535 padded[i++] = 0; 30536 padded[i++] = 0; 30537 padded[i++] = 0; 30538 padded[i++] = length >>> 29 & 0xff; 30539 padded[i++] = length >> 21 & 0xff; 30540 padded[i++] = length >> 13 & 0xff; 30541 padded[i++] = length >> 5 & 0xff;
30542 padded[i++] = length << 3 & 0xff; 30543 var w = new Array(80); 30544 30545 for (i = 0; i < 80; i++) { 30546 w[i] = new Word64(0, 0); 30547 } 30548 30549 var a = new Word64(0, 0), 30550 b = new Word64(0, 0), 30551 c = new Word64(0, 0); 30552 var d = new Word64(0, 0), 30553 e = new Word64(0, 0), 30554 f = new Word64(0, 0); 30555 var g = new Word64(0, 0), 30556 h = new Word64(0, 0); 30557 var t1 = new Word64(0, 0), 30558 t2 = new Word64(0, 0); 30559 var tmp1 = new Word64(0, 0), 30560 tmp2 = new Word64(0, 0), 30561 tmp3; 30562 30563 for (i = 0; i < paddedLength;) { 30564 for (j = 0; j < 16; ++j) { 30565 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 30566 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 30567 i += 8; 30568 } 30569 30570 for (j = 16; j < 80; ++j) { 30571 tmp3 = w[j]; 30572 littleSigmaPrime(tmp3, w[j - 2], tmp2); 30573 tmp3.add(w[j - 7]); 30574 littleSigma(tmp1, w[j - 15], tmp2); 30575 tmp3.add(tmp1); 30576 tmp3.add(w[j - 16]); 30577 } 30578 30579 a.assign(h0); 30580 b.assign(h1); 30581 c.assign(h2); 30582 d.assign(h3); 30583 e.assign(h4); 30584 f.assign(h5); 30585 g.assign(h6); 30586 h.assign(h7); 30587 30588 for (j = 0; j < 80; ++j) { 30589 t1.assign(h); 30590 sigmaPrime(tmp1, e, tmp2); 30591 t1.add(tmp1); 30592 ch(tmp1, e, f, g, tmp2); 30593 t1.add(tmp1); 30594 t1.add(k[j]); 30595 t1.add(w[j]); 30596 sigma(t2, a, tmp2); 30597 maj(tmp1, a, b, c, tmp2); 30598 t2.add(tmp1); 30599 tmp3 = h; 30600 h = g; 30601 g = f; 30602 f = e; 30603 d.add(t1); 30604 e = d; 30605 d = c; 30606 c = b; 30607 b = a; 30608 tmp3.assign(t1); 30609 tmp3.add(t2); 30610 a = tmp3; 30611 } 30612 30613 h0.add(a); 30614 h1.add(b); 30615 h2.add(c); 30616 h3.add(d); 30617 h4.add(e); 30618 h5.add(f); 30619 h6.add(g); 30620 h7.add(h); 30621 } 30622 30623 var result; 30624 30625 if (!mode384) { 30626 result = new Uint8Array(64); 30627 h0.copyTo(result, 0); 30628 h1.copyTo(result, 8); 30629 h2.copyTo(result, 16); 30630 h3.copyTo(result, 24); 30631 h4.copyTo(result, 32); 30632 h5.copyTo(result, 40); 30633 h6.copyTo(result, 48); 30634 h7.copyTo(result, 56); 30635 } else { 30636 result = new Uint8Array(48); 30637 h0.copyTo(result, 0); 30638 h1.copyTo(result, 8); 30639 h2.copyTo(result, 16); 30640 h3.copyTo(result, 24); 30641 h4.copyTo(result, 32); 30642 h5.copyTo(result, 40); 30643 } 30644 30645 return result; 30646 } 30647 30648 return hash; 30649}(); 30650 30651exports.calculateSHA512 = calculateSHA512; 30652 30653var calculateSHA384 = function calculateSHA384Closure() { 30654 function hash(data, offset, length) { 30655 return calculateSHA512(data, offset, length, true); 30656 } 30657 30658 return hash; 30659}(); 30660 30661exports.calculateSHA384 = calculateSHA384; 30662 30663var NullCipher = function NullCipherClosure() { 30664 function NullCipher() {} 30665 30666 NullCipher.prototype = { 30667 decryptBlock: function NullCipher_decryptBlock(data) { 30668 return data; 30669 } 30670 }; 30671 return NullCipher; 30672}(); 30673 30674class AESBaseCipher { 30675 constructor() { 30676 if (this.constructor === AESBaseCipher) { 30677 (0, _util.unreachable)("Cannot initialize AESBaseCipher."); 30678 } 30679 30680 this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]); 30681 this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42,
306810xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]); 30682 this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23
vendor: 6,242 bytes, lines 30682-30948
30682c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 30683 this._mixCol = new Uint8Array(256); 30684 30685 for (let i = 0; i < 256; i++) { 30686 if (i < 128) { 30687 this._mixCol[i] = i << 1; 30688 } else { 30689 this._mixCol[i] = i << 1 ^ 0x1b; 30690 } 30691 } 30692 30693 this.buffer = new Uint8Array(16); 30694 this.bufferPosition = 0; 30695 } 30696 30697 _expandKey(cipherKey) { 30698 (0, _util.unreachable)("Cannot call `_expandKey` on the base class"); 30699 } 30700 30701 _decrypt(input, key) { 30702 let t, u, v; 30703 const state = new Uint8Array(16); 30704 state.set(input); 30705 30706 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 30707 state[j] ^= key[k]; 30708 } 30709 30710 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 30711 t = state[13]; 30712 state[13] = state[9]; 30713 state[9] = state[5]; 30714 state[5] = state[1]; 30715 state[1] = t; 30716 t = state[14]; 30717 u = state[10]; 30718 state[14] = state[6]; 30719 state[10] = state[2]; 30720 state[6] = t; 30721 state[2] = u; 30722 t = state[15]; 30723 u = state[11]; 30724 v = state[7]; 30725 state[15] = state[3]; 30726 state[11] = t; 30727 state[7] = u; 30728 state[3] = v; 30729 30730 for (let j = 0; j < 16; ++j) { 30731 state[j] = this._inv_s[state[j]]; 30732 } 30733 30734 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 30735 state[j] ^= key[k]; 30736 } 30737 30738 for (let j = 0; j < 16; j += 4) { 30739 const s0 = this._mix[state[j]]; 30740 const s1 = this._mix[state[j + 1]]; 30741 const s2 = this._mix[state[j + 2]]; 30742 const s3 = this._mix[state[j + 3]]; 30743 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 30744 state[j] = t >>> 24 & 0xff; 30745 state[j + 1] = t >> 16 & 0xff; 30746 state[j + 2] = t >> 8 & 0xff; 30747 state[j + 3] = t & 0xff; 30748 } 30749 } 30750 30751 t = state[13]; 30752 state[13] = state[9]; 30753 state[9] = state[5]; 30754 state[5] = state[1]; 30755 state[1] = t; 30756 t = state[14]; 30757 u = state[10]; 30758 state[14] = state[6]; 30759 state[10] = state[2]; 30760 state[6] = t; 30761 state[2] = u; 30762 t = state[15]; 30763 u = state[11]; 30764 v = state[7]; 30765 state[15] = state[3]; 30766 state[11] = t; 30767 state[7] = u; 30768 state[3] = v; 30769 30770 for (let j = 0; j < 16; ++j) { 30771 state[j] = this._inv_s[state[j]]; 30772 state[j] ^= key[j]; 30773 } 30774 30775 return state; 30776 } 30777 30778 _encrypt(input, key) { 30779 const s = this._s; 30780 let t, u, v; 30781 const state = new Uint8Array(16); 30782 state.set(input); 30783 30784 for (let j = 0; j < 16; ++j) { 30785 state[j] ^= key[j]; 30786 } 30787 30788 for (let i = 1; i < this._cyclesOfRepetition; i++) { 30789 for (let j = 0; j < 16; ++j) { 30790 state[j] = s[state[j]]; 30791 } 30792 30793 v = state[1]; 30794 state[1] = state[5]; 30795 state[5] = state[9]; 30796 state[9] = state[13]; 30797 state[13] = v; 30798 v = state[2]; 30799 u = state[6]; 30800 state[2] = state[10]; 30801 state[6] = state[14]; 30802 state[10] = v; 30803 state[14] = u; 30804 v = state[3]; 30805 u = state[7]; 30806 t = state[11]; 30807 state[3] = state[15]; 30808 state[7] = v; 30809 state[11] = u; 30810 state[15] = t; 30811 30812 for (let j = 0; j < 16; j += 4) { 30813 const s0 = state[j + 0]; 30814 const s1 = state[j + 1]; 30815 const s2 = state[j + 2]; 30816 const s3 = state[j + 3]; 30817 t = s0 ^ s1 ^ s2 ^ s3; 30818 state[j + 0] ^= t ^ this._mixCol[s0 ^ s1]; 30819 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 30820 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 30821 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 30822 } 30823 30824 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 30825 state[j] ^= key[k]; 30826 } 30827 } 30828 30829 for (let j = 0; j < 16; ++j) { 30830 state[j] = s[state[j]]; 30831 } 30832 30833 v = state[1]; 30834 state[1] = state[5]; 30835 state[5] = state[9]; 30836 state[9] = state[13]; 30837 state[13] = v; 30838 v = state[2]; 30839 u = state[6]; 30840 state[2] = state[10]; 30841 state[6] = state[14]; 30842 state[10] = v; 30843 state[14] = u; 30844 v = state[3]; 30845 u = state[7]; 30846 t = state[11]; 30847 state[3] = state[15]; 30848 state[7] = v; 30849 state[11] = u; 30850 state[15] = t; 30851 30852 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 30853 state[j] ^= key[k]; 30854 } 30855 30856 return state; 30857 } 30858 30859 _decryptBlock2(data, finalize) { 30860 const sourceLength = data.length; 30861 let buffer = this.buffer, 30862 bufferLength = this.bufferPosition; 30863 const result = []; 30864 let iv = this.iv; 30865 30866 for (let i = 0; i < sourceLength; ++i) { 30867 buffer[bufferLength] = data[i]; 30868 ++bufferLength; 30869 30870 if (bufferLength < 16) { 30871 continue; 30872 } 30873 30874 const plain = this._decrypt(buffer, this._key); 30875 30876 for (let j = 0; j < 16; ++j) { 30877 plain[j] ^= iv[j]; 30878 } 30879 30880 iv = buffer; 30881 result.push(plain); 30882 buffer = new Uint8Array(16); 30883 bufferLength = 0; 30884 } 30885 30886 this.buffer = buffer; 30887 this.bufferLength = bufferLength; 30888 this.iv = iv; 30889 30890 if (result.length === 0) { 30891 return new Uint8Array(0); 30892 } 30893 30894 let outputLength = 16 * result.length; 30895 30896 if (finalize) { 30897 const lastBlock = result[result.length - 1]; 30898 let psLen = lastBlock[15]; 30899 30900 if (psLen <= 16) { 30901 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 30902 if (lastBlock[i] !== psLen) { 30903 psLen = 0; 30904 break; 30905 } 30906 } 30907 30908 outputLength -= psLen; 30909 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 30910 } 30911 } 30912 30913 const output = new Uint8Array(outputLength); 30914 30915 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 30916 output.set(result[i], j); 30917 } 30918 30919 return output; 30920 } 30921 30922 decryptBlock(data, finalize, iv = null) { 30923 const sourceLength = data.length; 30924 const buffer = this.buffer; 30925 let bufferLength = this.bufferPosition; 30926 30927 if (iv) { 30928 this.iv = iv; 30929 } else { 30930 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 30931 buffer[bufferLength] = data[i]; 30932 } 30933 30934 if (bufferLength < 16) { 30935 this.bufferLength = bufferLength; 30936 return new Uint8Array(0); 30937 } 30938 30939 this.iv = buffer; 30940 data = data.subarray(16); 30941 } 30942 30943 this.buffer = new Uint8Array(16); 30944 this.bufferLength = 0; 30945 this.decryptBlock = this._decryptBlock2; 30946 return this.decryptBlock(data, finalize); 30947 } 30948
vendor: 4,326 bytes, lines 30949-31079
30949 encrypt(data, iv) { 30950 const sourceLength = data.length; 30951 let buffer = this.buffer, 30952 bufferLength = this.bufferPosition; 30953 const result = []; 30954 30955 if (!iv) { 30956 iv = new Uint8Array(16); 30957 } 30958 30959 for (let i = 0; i < sourceLength; ++i) { 30960 buffer[bufferLength] = data[i]; 30961 ++bufferLength; 30962 30963 if (bufferLength < 16) { 30964 continue; 30965 } 30966 30967 for (let j = 0; j < 16; ++j) { 30968 buffer[j] ^= iv[j]; 30969 } 30970 30971 const cipher = this._encrypt(buffer, this._key); 30972 30973 iv = cipher; 30974 result.push(cipher); 30975 buffer = new Uint8Array(16); 30976 bufferLength = 0; 30977 } 30978 30979 this.buffer = buffer; 30980 this.bufferLength = bufferLength; 30981 this.iv = iv; 30982 30983 if (result.length === 0) { 30984 return new Uint8Array(0); 30985 } 30986 30987 const outputLength = 16 * result.length; 30988 const output = new Uint8Array(outputLength); 30989 30990 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 30991 output.set(result[i], j); 30992 } 30993 30994 return output; 30995 } 30996 30997} 30998 30999class AES128Cipher extends AESBaseCipher { 31000 constructor(key) { 31001 super(); 31002 this._cyclesOfRepetition = 10; 31003 this._keySize = 160; 31004 this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]); 31005 this._key = this._expandKey(key); 31006 } 31007 31008 _expandKey(cipherKey) { 31009 const b = 176; 31010 const s = this._s; 31011 const rcon = this._rcon; 31012 const result = new Uint8Array(b); 31013 result.set(cipherKey); 31014 31015 for (let j = 16, i = 1; j < b; ++i) { 31016 let t1 = result[j - 3]; 31017 let t2 = result[j - 2]; 31018 let t3 = result[j - 1]; 31019 let t4 = result[j - 4]; 31020 t1 = s[t1]; 31021 t2 = s[t2]; 31022 t3 = s[t3]; 31023 t4 = s[t4]; 31024 t1 = t1 ^ rcon[i]; 31025 31026 for (let n = 0; n < 4; ++n) { 31027 result[j] = t1 ^= result[j - 16]; 31028 j++; 31029 result[j] = t2 ^= result[j - 16]; 31030 j++; 31031 result[j] = t3 ^= result[j - 16]; 31032 j++; 31033 result[j] = t4 ^= result[j - 16]; 31034 j++; 31035 } 31036 } 31037 31038 return result; 31039 } 31040 31041} 31042 31043exports.AES128Cipher = AES128Cipher; 31044 31045class AES256Cipher extends AESBaseCipher { 31046 constructor(key) { 31047 super(); 31048 this._cyclesOfRepetition = 14; 31049 this._keySize = 224; 31050 this._key = this._expandKey(key); 31051 } 31052 31053 _expandKey(cipherKey) { 31054 const b = 240; 31055 const s = this._s; 31056 const result = new Uint8Array(b); 31057 result.set(cipherKey); 31058 let r = 1; 31059 let t1, t2, t3, t4; 31060 31061 for (let j = 32, i = 1; j < b; ++i) { 31062 if (j % 32 === 16) { 31063 t1 = s[t1]; 31064 t2 = s[t2]; 31065 t3 = s[t3]; 31066 t4 = s[t4]; 31067 } else if (j % 32 === 0) { 31068 t1 = result[j - 3]; 31069 t2 = result[j - 2]; 31070 t3 = result[j - 1]; 31071 t4 = result[j - 4]; 31072 t1 = s[t1]; 31073 t2 = s[t2]; 31074 t3 = s[t3]; 31075 t4 = s[t4]; 31076 t1 = t1 ^ r; 31077 31078 if ((r <<= 1) >= 256) { 31079 r = (r ^ 0x1b) & 0xff;
31080 } 31081 } 31082 31083 for (let n = 0; n < 4; ++n) { 31084 result[j] = t1 ^= result[j - 32]; 31085 j++; 31086 result[j] = t2 ^= result[j - 32]; 31087 j++; 31088 result[j] = t3 ^= result[j - 32]; 31089 j++; 31090 result[j] = t4 ^= result[j - 32]; 31091 j++; 31092 } 31093 } 31094 31095 return result; 31096 } 31097 31098} 31099 31100exports.AES256Cipher = AES256Cipher; 31101 31102var PDF17 = function PDF17Closure() { 31103 function compareByteArrays(array1, array2) { 31104 if (array1.length !== array2.length) { 31105 return false; 31106 } 31107 31108 for (var i = 0; i < array1.length; i++) { 31109 if (array1[i] !== array2[i]) { 31110 return false; 31111 } 31112 } 31113 31114 return true; 31115 } 31116 31117 function PDF17() {} 31118 31119 PDF17.prototype = { 31120 checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 31121 var hashData = new Uint8Array(password.length + 56); 31122 hashData.set(password, 0); 31123 hashData.set(ownerValidationSalt, password.length); 31124 hashData.set(userBytes, password.length + ownerValidationSalt.length); 31125 var result = calculateSHA256(hashData, 0, hashData.length); 31126 return compareByteArrays(result, ownerPassword); 31127 }, 31128 checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) { 31129 var hashData = new Uint8Array(password.length + 8); 31130 hashData.set(password, 0); 31131 hashData.set(userValidationSalt, password.length); 31132 var result = calculateSHA256(hashData, 0, hashData.length); 31133 return compareByteArrays(result, userPassword); 31134 }, 31135 getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 31136 var hashData = new Uint8Array(password.length + 56); 31137 hashData.set(password, 0); 31138 hashData.set(ownerKeySalt, password.length); 31139 hashData.set(userBytes, password.length + ownerKeySalt.length); 31140 var key = calculateSHA256(hashData, 0, hashData.length); 31141 var cipher = new AES256Cipher(key); 31142 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 31143 }, 31144 getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) { 31145 var hashData = new Uint8Array(password.length + 8); 31146 hashData.set(password, 0); 31147 hashData.set(userKeySalt, password.length); 31148 var key = calculateSHA256(hashData, 0, hashData.length); 31149 var cipher = new AES256Cipher(key); 31150 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 31151 } 31152 }; 31153 return PDF17; 31154}(); 31155 31156exports.PDF17 = PDF17; 31157 31158var PDF20 = function PDF20Closure() { 31159 function concatArrays(array1, array2) { 31160 var t = new Uint8Array(array1.length + array2.length); 31161 t.set(array1, 0); 31162 t.set(array2, array1.length); 31163 return t; 31164 } 31165 31166 function calculatePDF20Hash(password, input, userBytes) { 31167 var k = calculateSHA256(input, 0, input.length).subarray(0, 32); 31168 var e = [0]; 31169 var i = 0; 31170 31171 while (i < 64 || e[e.length - 1] > i - 32) { 31172 var arrayLength = password.length + k.length + userBytes.length; 31173 var k1 = new Uint8Array(arrayLength * 64); 31174 var array = concatArrays(password, k); 31175 array = concatArrays(array, userBytes); 31176 31177 for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) { 31178 k1.set(array, pos); 31179 } 31180 31181 var cipher = new AES128Cipher(k.subarray(0, 16)); 31182 e = cipher.encrypt(k1, k.subarray(16, 32)); 31183 var remainder = 0; 31184 31185 for (var z = 0; z < 16; z++) { 31186 remainder *= 256 % 3; 31187 remainder %= 3; 31188 remainder += (e[z] >>> 0) % 3; 31189 remainder %= 3; 31190 } 31191 31192 if (remainder === 0) { 31193 k = calculateSHA256(e, 0, e.length); 31194 } else if (remainder === 1) { 31195 k = calculateSHA384(e, 0, e.length); 31196 } else if (remainder === 2) { 31197 k = calculateSHA512(e, 0, e.length); 31198 } 31199 31200 i++; 31201 } 31202 31203 return k.subarray(0, 32); 31204 } 31205 31206 function PDF20() {} 31207 31208 function compareByteArrays(array1, array2) { 31209 if (array1.length !== array2.length) { 31210 return false; 31211 } 31212 31213 for (var i = 0; i < array1.length; i++) { 31214 if (array1[i] !== array2[i]) { 31215 return false; 31216 } 31217 } 31218 31219 return true; 31220 } 31221 31222 PDF20.prototype = { 31223 hash: function PDF20_hash(password, concatBytes, userBytes) { 31224 return calculatePDF20Hash(password, concatBytes, userBytes); 31225 }, 31226 checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 31227 var hashData = new Uint8Array(password.length + 56); 31228 hashData.set(password, 0); 31229 hashData.set(ownerValidationSalt, password.length); 31230 hashData.set(userBytes, password.length + ownerValidationSalt.length); 31231 var result = calculatePDF20Hash(password, hashData, userBytes); 31232 return compareByteArrays(result, ownerPassword); 31233 }, 31234 checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) { 31235 var hashData = new Uint8Array(password.length + 8); 31236 hashData.set(password, 0); 31237 hashData.set(userValidationSalt, password.length); 31238 var result = calculatePDF20Hash(password, hashData, []); 31239 return compareByteArrays(result, userPassword); 31240 },
31241 getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 31242 var hashData = new Uint8Array(password.length + 56); 31243 hashData.set(password, 0); 31244 hashData.set(ownerKeySalt, password.length); 31245 hashData.set(userBytes, password.length + ownerKeySalt.length); 31246 var key = calculatePDF20Hash(password, hashData, userBytes); 31247 var cipher = new AES256Cipher(key); 31248 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 31249 }, 31250 getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) { 31251 var hashData = new Uint8Array(password.length + 8); 31252 hashData.set(password, 0); 31253 hashData.set(userKeySalt, password.length); 31254 var key = calculatePDF20Hash(password, hashData, []); 31255 var cipher = new AES256Cipher(key); 31256 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 31257 } 31258 }; 31259 return PDF20; 31260}(); 31261 31262exports.PDF20 = PDF20; 31263 31264var CipherTransform = function CipherTransformClosure() { 31265 function CipherTransform(stringCipherConstructor, streamCipherConstructor) { 31266 this.StringCipherConstructor = stringCipherConstructor; 31267 this.StreamCipherConstructor = streamCipherConstructor; 31268 } 31269 31270 CipherTransform.prototype = { 31271 createStream: function CipherTransform_createStream(stream, length) { 31272 var cipher = new this.StreamCipherConstructor(); 31273 return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 31274 return cipher.decryptBlock(data, finalize); 31275 }); 31276 }, 31277 decryptString: function CipherTransform_decryptString(s) { 31278 var cipher = new this.StringCipherConstructor(); 31279 var data = (0, _util.stringToBytes)(s); 31280 data = cipher.decryptBlock(data, true); 31281 return (0, _util.bytesToString)(data); 31282 } 31283 }; 31284 return CipherTransform; 31285}(); 31286 31287var CipherTransformFactory = function CipherTransformFactoryClosure() { 31288 var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]); 31289 31290 function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 31291 if (password) { 31292 var passwordLength = Math.min(127, password.length); 31293 password = password.subarray(0, passwordLength); 31294 } else { 31295 password = []; 31296 } 31297 31298 var pdfAlgorithm; 31299 31300 if (revision === 6) { 31301 pdfAlgorithm = new PDF20(); 31302 } else { 31303 pdfAlgorithm = new PDF17(); 31304 } 31305 31306 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 31307 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 31308 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 31309 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 31310 } 31311 31312 return null; 31313 } 31314 31315 function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 31316 var hashDataSize = 40 + ownerPassword.length + fileId.length; 31317 var hashData = new Uint8Array(hashDataSize), 31318 i = 0, 31319 j, 31320 n; 31321 31322 if (password) { 31323 n = Math.min(32, password.length); 31324 31325 for (; i < n; ++i) { 31326 hashData[i] = password[i]; 31327 } 31328 } 31329 31330 j = 0; 31331 31332 while (i < 32) { 31333 hashData[i++] = defaultPasswordBytes[j++]; 31334 } 31335 31336 for (j = 0, n = ownerPassword.length; j < n; ++j) { 31337 hashData[i++] = ownerPassword[j]; 31338 } 31339 31340 hashData[i++] = flags & 0xff; 31341 hashData[i++] = flags >> 8 & 0xff; 31342 hashData[i++] = flags >> 16 & 0xff; 31343 hashData[i++] = flags >>> 24 & 0xff; 31344 31345 for (j = 0, n = fileId.length; j < n; ++j) { 31346 hashData[i++] = fileId[j]; 31347 } 31348 31349 if (revision >= 4 && !encryptMetadata) { 31350 hashData[i++] = 0xff; 31351 hashData[i++] = 0xff; 31352 hashData[i++] = 0xff; 31353 hashData[i++] = 0xff; 31354 } 31355 31356 var hash = calculateMD5(hashData, 0, i); 31357 var keyLengthInBytes = keyLength >> 3; 31358 31359 if (revision >= 3) { 31360 for (j = 0; j < 50; ++j) { 31361 hash = calculateMD5(hash, 0, keyLengthInBytes); 31362 } 31363 } 31364 31365 var encryptionKey = hash.subarray(0, keyLengthInBytes); 31366 var cipher, checkData; 31367 31368 if (revision >= 3) { 31369 for (i = 0; i < 32; ++i) { 31370 hashData[i] = defaultPasswordBytes[i]; 31371 } 31372 31373 for (j = 0, n = fileId.length; j < n; ++j) { 31374 hashData[i++] = fileId[j]; 31375 } 31376 31377 cipher = new ARCFourCipher(encryptionKey); 31378 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 31379 n = encryptionKey.length; 31380 var derivedKey = new Uint8Array(n), 31381 k; 31382 31383 for (j = 1; j <= 19; ++j) { 31384 for (k = 0; k < n; ++k) { 31385 derivedKey[k] = encryptionKey[k] ^ j; 31386 } 31387 31388 cipher = new ARCFourCipher(derivedKey); 31389 checkData = cipher.encryptBlock(checkData); 31390 } 31391 31392 for (j = 0, n = checkData.length; j < n; ++j) { 31393 if (userPassword[j] !== checkData[j]) { 31394 return null; 31395 } 31396 } 31397 } else { 31398 cipher = new ARCFourCipher(encryptionKey); 31399 checkData = cipher.encryptBlock(defaultPasswordBytes); 31400 31401 for (j = 0, n = checkData.length; j < n; ++j) { 31402 if (userPassword[j] !== checkData[j]) { 31403 return null; 31404 } 31405 } 31406 } 31407 31408 return encryptionKey; 31409 } 31410
31411 function decodeUserPassword(password, ownerPassword, revision, keyLength) { 31412 var hashData = new Uint8Array(32), 31413 i = 0, 31414 j, 31415 n; 31416 n = Math.min(32, password.length); 31417 31418 for (; i < n; ++i) { 31419 hashData[i] = password[i]; 31420 } 31421 31422 j = 0; 31423 31424 while (i < 32) { 31425 hashData[i++] = defaultPasswordBytes[j++]; 31426 } 31427 31428 var hash = calculateMD5(hashData, 0, i); 31429 var keyLengthInBytes = keyLength >> 3; 31430 31431 if (revision >= 3) { 31432 for (j = 0; j < 50; ++j) { 31433 hash = calculateMD5(hash, 0, hash.length); 31434 } 31435 } 31436 31437 var cipher, userPassword; 31438 31439 if (revision >= 3) { 31440 userPassword = ownerPassword; 31441 var derivedKey = new Uint8Array(keyLengthInBytes), 31442 k; 31443 31444 for (j = 19; j >= 0; j--) { 31445 for (k = 0; k < keyLengthInBytes; ++k) { 31446 derivedKey[k] = hash[k] ^ j; 31447 } 31448 31449 cipher = new ARCFourCipher(derivedKey); 31450 userPassword = cipher.encryptBlock(userPassword); 31451 } 31452 } else { 31453 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 31454 userPassword = cipher.encryptBlock(ownerPassword); 31455 } 31456 31457 return userPassword; 31458 } 31459 31460 var identityName = _primitives.Name.get("Identity"); 31461 31462 function CipherTransformFactory(dict, fileId, password) { 31463 var filter = dict.get("Filter"); 31464 31465 if (!(0, _primitives.isName)(filter, "Standard")) { 31466 throw new _util.FormatError("unknown encryption method"); 31467 } 31468 31469 this.dict = dict; 31470 var algorithm = dict.get("V"); 31471 31472 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 31473 throw new _util.FormatError("unsupported encryption algorithm"); 31474 } 31475 31476 this.algorithm = algorithm; 31477 var keyLength = dict.get("Length"); 31478 31479 if (!keyLength) { 31480 if (algorithm <= 3) { 31481 keyLength = 40; 31482 } else { 31483 var cfDict = dict.get("CF"); 31484 var streamCryptoName = dict.get("StmF"); 31485 31486 if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) { 31487 cfDict.suppressEncryption = true; 31488 var handlerDict = cfDict.get(streamCryptoName.name); 31489 keyLength = handlerDict && handlerDict.get("Length") || 128; 31490 31491 if (keyLength < 40) { 31492 keyLength <<= 3; 31493 } 31494 } 31495 } 31496 } 31497 31498 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 31499 throw new _util.FormatError("invalid key length"); 31500 } 31501 31502 var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32); 31503 var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32); 31504 var flags = dict.get("P"); 31505 var revision = dict.get("R"); 31506 var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 31507 this.encryptMetadata = encryptMetadata; 31508 var fileIdBytes = (0, _util.stringToBytes)(fileId); 31509 var passwordBytes; 31510 31511 if (password) { 31512 if (revision === 6) { 31513 try { 31514 password = (0, _util.utf8StringToString)(password); 31515 } catch (ex) { 31516 (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password."); 31517 } 31518 } 31519 31520 passwordBytes = (0, _util.stringToBytes)(password); 31521 } 31522 31523 var encryptionKey; 31524 31525 if (algorithm !== 5) { 31526 encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 31527 } else { 31528 var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40); 31529 var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48); 31530 var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48); 31531 var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40); 31532 var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48); 31533 var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE")); 31534 var userEncryption = (0, _util.stringToBytes)(dict.get("UE")); 31535 var perms = (0, _util.stringToBytes)(dict.get("Perms")); 31536 encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 31537 } 31538 31539 if (!encryptionKey && !password) { 31540 throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD); 31541 } else if (!encryptionKey && password) { 31542 var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 31543 encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 31544 } 31545 31546 if (!encryptionKey) { 31547 throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD); 31548 } 31549 31550 this.encryptionKey = encryptionKey; 31551 31552 if (algorithm >= 4) { 31553 var cf = dict.get("CF"); 31554 31555 if ((0, _primitives.isDict)(cf)) {
31556 cf.suppressEncryption = true; 31557 } 31558 31559 this.cf = cf; 31560 this.stmf = dict.get("StmF") || identityName; 31561 this.strf = dict.get("StrF") || identityName; 31562 this.eff = dict.get("EFF") || this.stmf; 31563 } 31564 } 31565 31566 function buildObjectKey(num, gen, encryptionKey, isAes) { 31567 var key = new Uint8Array(encryptionKey.length + 9), 31568 i, 31569 n; 31570 31571 for (i = 0, n = encryptionKey.length; i < n; ++i) { 31572 key[i] = encryptionKey[i]; 31573 } 31574 31575 key[i++] = num & 0xff; 31576 key[i++] = num >> 8 & 0xff; 31577 key[i++] = num >> 16 & 0xff; 31578 key[i++] = gen & 0xff; 31579 key[i++] = gen >> 8 & 0xff; 31580 31581 if (isAes) { 31582 key[i++] = 0x73; 31583 key[i++] = 0x41; 31584 key[i++] = 0x6c; 31585 key[i++] = 0x54; 31586 } 31587 31588 var hash = calculateMD5(key, 0, i); 31589 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 31590 } 31591 31592 function buildCipherConstructor(cf, name, num, gen, key) { 31593 if (!(0, _primitives.isName)(name)) { 31594 throw new _util.FormatError("Invalid crypt filter name."); 31595 } 31596 31597 var cryptFilter = cf.get(name.name); 31598 var cfm; 31599
31600 if (cryptFilter !== null && cryptFilter !== undefined) { 31601 cfm = cryptFilter.get("CFM"); 31602 } 31603 31604 if (!cfm || cfm.name === "None") { 31605 return function cipherTransformFactoryBuildCipherConstructorNone() { 31606 return new NullCipher(); 31607 }; 31608 } 31609 31610 if (cfm.name === "V2") { 31611 return function cipherTransformFactoryBuildCipherConstructorV2() { 31612 return new ARCFourCipher(buildObjectKey(num, gen, key, false)); 31613 }; 31614 } 31615 31616 if (cfm.name === "AESV2") { 31617 return function cipherTransformFactoryBuildCipherConstructorAESV2() { 31618 return new AES128Cipher(buildObjectKey(num, gen, key, true)); 31619 }; 31620 } 31621 31622 if (cfm.name === "AESV3") { 31623 return function cipherTransformFactoryBuildCipherConstructorAESV3() { 31624 return new AES256Cipher(key); 31625 }; 31626 } 31627 31628 throw new _util.FormatError("Unknown crypto method"); 31629 } 31630 31631 CipherTransformFactory.prototype = { 31632 createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) { 31633 if (this.algorithm === 4 || this.algorithm === 5) { 31634 return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey)); 31635 } 31636 31637 var key = buildObjectKey(num, gen, this.encryptionKey, false); 31638 31639 var cipherConstructor = function buildCipherCipherConstructor() { 31640 return new ARCFourCipher(key); 31641 }; 31642 31643 return new CipherTransform(cipherConstructor, cipherConstructor); 31644 } 31645 }; 31646 return CipherTransformFactory; 31647}(); 31648 31649exports.CipherTransformFactory = CipherTransformFactory; 31650 31651/***/ }), 31652/* 23 */ 31653/***/ (function(module, exports, __w_pdfjs_require__) { 31654 31655"use strict"; 31656 31657 31658Object.defineProperty(exports, "__esModule", { 31659 value: true 31660}); 31661exports.ColorSpace = void 0; 31662 31663var _util = __w_pdfjs_require__(2); 31664 31665var _primitives = __w_pdfjs_require__(5); 31666 31667function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 31668 const COMPONENTS = 3; 31669 alpha01 = alpha01 !== 1 ? 0 : alpha01; 31670 const xRatio = w1 / w2; 31671 const yRatio = h1 / h2; 31672 let newIndex = 0, 31673 oldIndex; 31674 const xScaled = new Uint16Array(w2); 31675 const w1Scanline = w1 * COMPONENTS; 31676 31677 for (let i = 0; i < w2; i++) { 31678 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 31679 } 31680 31681 for (let i = 0; i < h2; i++) { 31682 const py = Math.floor(i * yRatio) * w1Scanline; 31683 31684 for (let j = 0; j < w2; j++) { 31685 oldIndex = py + xScaled[j]; 31686 dest[newIndex++] = src[oldIndex++]; 31687 dest[newIndex++] = src[oldIndex++]; 31688 dest[newIndex++] = src[oldIndex++]; 31689 newIndex += alpha01; 31690 } 31691 } 31692} 31693 31694class ColorSpace { 31695 constructor(name, numComps) { 31696 if (this.constructor === ColorSpace) { 31697 (0, _util.unreachable)("Cannot initialize ColorSpace."); 31698 } 31699 31700 this.name = name; 31701 this.numComps = numComps; 31702 } 31703 31704 getRgb(src, srcOffset) { 31705 const rgb = new Uint8ClampedArray(3); 31706 this.getRgbItem(src, srcOffset, rgb, 0); 31707 return rgb; 31708 } 31709 31710 getRgbItem(src, srcOffset, dest, destOffset) { 31711 (0, _util.unreachable)("Should not call ColorSpace.getRgbItem"); 31712 } 31713 31714 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 31715 (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer"); 31716 } 31717 31718 getOutputLength(inputLength, alpha01) { 31719 (0, _util.unreachable)("Should not call ColorSpace.getOutputLength"); 31720 } 31721 31722 isPassthrough(bits) { 31723 return false; 31724 } 31725 31726 isDefaultDecode(decodeMap, bpc) { 31727 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 31728 } 31729 31730 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 31731 const count = originalWidth * originalHeight; 31732 let rgbBuf = null; 31733 const numComponentColors = 1 << bpc; 31734 const needsResizing = originalHeight !== height || originalWidth !== width; 31735 31736 if (this.isPassthrough(bpc)) { 31737 rgbBuf = comps; 31738 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 31739 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 31740 31741 for (let i = 0; i < numComponentColors; i++) { 31742 allColors[i] = i; 31743 } 31744 31745 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 31746 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 31747 31748 if (!needsResizing) { 31749 let destPos = 0; 31750 31751 for (let i = 0; i < count; ++i) {
31752 const key = comps[i] * 3; 31753 dest[destPos++] = colorMap[key]; 31754 dest[destPos++] = colorMap[key + 1]; 31755 dest[destPos++] = colorMap[key + 2]; 31756 destPos += alpha01; 31757 } 31758 } else { 31759 rgbBuf = new Uint8Array(count * 3); 31760 let rgbPos = 0; 31761 31762 for (let i = 0; i < count; ++i) { 31763 const key = comps[i] * 3; 31764 rgbBuf[rgbPos++] = colorMap[key]; 31765 rgbBuf[rgbPos++] = colorMap[key + 1]; 31766 rgbBuf[rgbPos++] = colorMap[key + 2]; 31767 } 31768 } 31769 } else { 31770 if (!needsResizing) { 31771 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 31772 } else { 31773 rgbBuf = new Uint8ClampedArray(count * 3); 31774 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 31775 } 31776 } 31777 31778 if (rgbBuf) { 31779 if (needsResizing) { 31780 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 31781 } else { 31782 let destPos = 0, 31783 rgbPos = 0; 31784 31785 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 31786 dest[destPos++] = rgbBuf[rgbPos++]; 31787 dest[destPos++] = rgbBuf[rgbPos++]; 31788 dest[destPos++] = rgbBuf[rgbPos++]; 31789 destPos += alpha01; 31790 } 31791 } 31792 } 31793 } 31794 31795 get usesZeroToOneRange() { 31796 return (0, _util.shadow)(this, "usesZeroToOneRange", true); 31797 } 31798 31799 static parse(cs, xref, res, pdfFunctionFactory) { 31800 const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory); 31801 return this.fromIR(IR); 31802 } 31803 31804 static fromIR(IR) { 31805 const name = Array.isArray(IR) ? IR[0] : IR; 31806 let whitePoint, blackPoint, gamma; 31807 31808 switch (name) { 31809 case "DeviceGrayCS": 31810 return this.singletons.gray; 31811 31812 case "DeviceRgbCS": 31813 return this.singletons.rgb; 31814 31815 case "DeviceCmykCS": 31816 return this.singletons.cmyk; 31817 31818 case "CalGrayCS": 31819 whitePoint = IR[1]; 31820 blackPoint = IR[2]; 31821 gamma = IR[3]; 31822 return new CalGrayCS(whitePoint, blackPoint, gamma); 31823 31824 case "CalRGBCS": 31825 whitePoint = IR[1]; 31826 blackPoint = IR[2]; 31827 gamma = IR[3]; 31828 const matrix = IR[4]; 31829 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 31830 31831 case "PatternCS": 31832 let basePatternCS = IR[1]; 31833 31834 if (basePatternCS) { 31835 basePatternCS = this.fromIR(basePatternCS); 31836 } 31837 31838 return new PatternCS(basePatternCS); 31839 31840 case "IndexedCS": 31841 const baseIndexedCS = IR[1]; 31842 const hiVal = IR[2]; 31843 const lookup = IR[3]; 31844 return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup); 31845 31846 case "AlternateCS": 31847 const numComps = IR[1]; 31848 const alt = IR[2]; 31849 const tintFn = IR[3]; 31850 return new AlternateCS(numComps, this.fromIR(alt), tintFn); 31851 31852 case "LabCS": 31853 whitePoint = IR[1]; 31854 blackPoint = IR[2]; 31855 const range = IR[3]; 31856 return new LabCS(whitePoint, blackPoint, range); 31857 31858 default: 31859 throw new _util.FormatError(`Unknown colorspace name: ${name}`); 31860 } 31861 } 31862 31863 static parseToIR(cs, xref, res = null, pdfFunctionFactory) { 31864 cs = xref.fetchIfRef(cs); 31865 31866 if ((0, _primitives.isName)(cs)) { 31867 switch (cs.name) { 31868 case "DeviceGray": 31869 case "G": 31870 return "DeviceGrayCS"; 31871 31872 case "DeviceRGB": 31873 case "RGB": 31874 return "DeviceRgbCS"; 31875 31876 case "DeviceCMYK": 31877 case "CMYK": 31878 return "DeviceCmykCS"; 31879 31880 case "Pattern": 31881 return ["PatternCS", null]; 31882 31883 default: 31884 if ((0, _primitives.isDict)(res)) { 31885 const colorSpaces = res.get("ColorSpace"); 31886 31887 if ((0, _primitives.isDict)(colorSpaces)) { 31888 const resCS = colorSpaces.get(cs.name); 31889 31890 if (resCS) { 31891 if ((0, _primitives.isName)(resCS)) { 31892 return this.parseToIR(resCS, xref, res, pdfFunctionFactory); 31893 } 31894 31895 cs = resCS; 31896 break; 31897 } 31898 } 31899 } 31900 31901 throw new _util.FormatError(`unrecognized colorspace ${cs.name}`); 31902 } 31903 } 31904 31905 if (Array.isArray(cs)) { 31906 const mode = xref.fetchIfRef(cs[0]).name; 31907 let numComps, params, alt, whitePoint, blackPoint, gamma; 31908 31909 switch (mode) { 31910 case "DeviceGray": 31911 case "G": 31912 return "DeviceGrayCS"; 31913 31914 case "DeviceRGB": 31915 case "RGB": 31916 return "DeviceRgbCS"; 31917 31918 case "DeviceCMYK": 31919 case "CMYK": 31920 return "DeviceCmykCS"; 31921 31922 case "CalGray": 31923 params = xref.fetchIfRef(cs[1]); 31924 whitePoint = params.getArray("WhitePoint"); 31925 blackPoint = params.getArray("BlackPoint"); 31926 gamma = params.get("Gamma"); 31927 return ["CalGrayCS", whitePoint, blackPoint, gamma]; 31928 31929 case "CalRGB": 31930 params = xref.fetchIfRef(cs[1]); 31931 whitePoint = params.getArray("WhitePoint"); 31932 blackPoint = params.getArray("BlackPoint"); 31933 gamma = params.getArray("Gamma"); 31934 const matrix = params.getArray("Matrix"); 31935 return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix]; 31936 31937 case "ICCBased": 31938 const stream = xref.fetchIfRef(cs[1]); 31939 const dict = stream.dict; 31940 numComps = dict.get("N"); 31941 alt = dict.get("Alternate"); 31942 31943 if (alt) { 31944 const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory); 31945 const altCS = this.fromIR(altIR, pdfFunctionFactory); 31946 31947 if (altCS.numComps === numComps) { 31948 return altIR; 31949 } 31950 31951 (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry."); 31952 } 31953 31954 if (numComps === 1) { 31955 return "DeviceGrayCS"; 31956 } else if (numComps === 3) { 31957 return "DeviceRgbCS"; 31958 } else if (numComps === 4) { 31959 return "DeviceCmykCS"; 31960 } 31961 31962 break; 31963 31964 case "Pattern": 31965 let basePatternCS = cs[1] || null; 31966 31967 if (basePatternCS) { 31968 basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory); 31969 } 31970 31971 return ["PatternCS", basePatternCS]; 31972 31973 case "Indexed": 31974 case "I": 31975 const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory); 31976 const hiVal = xref.fetchIfRef(cs[2]) + 1; 31977 let lookup = xref.fetchIfRef(cs[3]); 31978 31979 if ((0, _primitives.isStream)(lookup)) { 31980 lookup = lookup.getBytes(); 31981 } 31982 31983 return ["IndexedCS", baseIndexedCS, hiVal, lookup]; 31984 31985 case "Separation": 31986 case "DeviceN": 31987 const name = xref.fetchIfRef(cs[1]); 31988 numComps = Array.isArray(name) ? name.length : 1; 31989 alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory); 31990 const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3])); 31991 return ["AlternateCS", numComps, alt, tintFn]; 31992 31993 case "Lab": 31994 params = xref.fetchIfRef(cs[1]); 31995 whitePoint = params.getArray("WhitePoint"); 31996 blackPoint = params.getArray("BlackPoint"); 31997 const range = params.getArray("Range"); 31998 return ["LabCS", whitePoint, blackPoint, range]; 31999 32000 default: 32001 throw new _util.FormatError(`unimplemented color space object "${mode}"`); 32002 } 32003 } 32004 32005 throw new _util.FormatError(`unrecognized color space object: "${cs}"`); 32006 } 32007 32008 static isDefaultDecode(decode, numComps) { 32009 if (!Array.isArray(decode)) { 32010 return true; 32011 } 32012 32013 if (numComps * 2 !== decode.length) { 32014 (0, _util.warn)("The decode map is not the correct length"); 32015 return true; 32016 } 32017 32018 for (let i = 0, ii = decode.length; i < ii; i += 2) { 32019 if (decode[i] !== 0 || decode[i + 1] !== 1) { 32020 return false;
32021 } 32022 } 32023 32024 return true; 32025 } 32026 32027 static get singletons() { 32028 return (0, _util.shadow)(this, "singletons", { 32029 get gray() { 32030 return (0, _util.shadow)(this, "gray", new DeviceGrayCS()); 32031 }, 32032 32033 get rgb() { 32034 return (0, _util.shadow)(this, "rgb", new DeviceRgbCS()); 32035 }, 32036 32037 get cmyk() { 32038 return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS()); 32039 } 32040 32041 }); 32042 } 32043 32044} 32045 32046exports.ColorSpace = ColorSpace; 32047 32048class AlternateCS extends ColorSpace { 32049 constructor(numComps, base, tintFn) { 32050 super("Alternate", numComps); 32051 this.base = base; 32052 this.tintFn = tintFn; 32053 this.tmpBuf = new Float32Array(base.numComps); 32054 } 32055 32056 getRgbItem(src, srcOffset, dest, destOffset) { 32057 const tmpBuf = this.tmpBuf; 32058 this.tintFn(src, srcOffset, tmpBuf, 0); 32059 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 32060 } 32061 32062 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32063 const tintFn = this.tintFn; 32064 const base = this.base; 32065 const scale = 1 / ((1 << bits) - 1); 32066 const baseNumComps = base.numComps; 32067 const usesZeroToOneRange = base.usesZeroToOneRange; 32068 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 32069 let pos = isPassthrough ? destOffset : 0; 32070 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 32071 const numComps = this.numComps; 32072 const scaled = new Float32Array(numComps); 32073 const tinted = new Float32Array(baseNumComps); 32074 let i, j; 32075 32076 for (i = 0; i < count; i++) { 32077 for (j = 0; j < numComps; j++) { 32078 scaled[j] = src[srcOffset++] * scale; 32079 } 32080 32081 tintFn(scaled, 0, tinted, 0); 32082 32083 if (usesZeroToOneRange) { 32084 for (j = 0; j < baseNumComps; j++) { 32085 baseBuf[pos++] = tinted[j] * 255; 32086 } 32087 } else { 32088 base.getRgbItem(tinted, 0, baseBuf, pos); 32089 pos += baseNumComps; 32090 } 32091 } 32092 32093 if (!isPassthrough) { 32094 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 32095 } 32096 } 32097 32098 getOutputLength(inputLength, alpha01) { 32099 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 32100 } 32101 32102} 32103 32104class PatternCS extends ColorSpace { 32105 constructor(baseCS) { 32106 super("Pattern", null); 32107 this.base = baseCS; 32108 } 32109 32110 isDefaultDecode(decodeMap, bpc) { 32111 (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode"); 32112 } 32113 32114} 32115 32116class IndexedCS extends ColorSpace { 32117 constructor(base, highVal, lookup) { 32118 super("Indexed", 1); 32119 this.base = base; 32120 this.highVal = highVal; 32121 const baseNumComps = base.numComps; 32122 const length = baseNumComps * highVal; 32123 32124 if ((0, _primitives.isStream)(lookup)) { 32125 this.lookup = new Uint8Array(length); 32126 const bytes = lookup.getBytes(length); 32127 this.lookup.set(bytes); 32128 } else if ((0, _util.isString)(lookup)) { 32129 this.lookup = new Uint8Array(length); 32130 32131 for (let i = 0; i < length; ++i) { 32132 this.lookup[i] = lookup.charCodeAt(i); 32133 } 32134 } else if (lookup instanceof Uint8Array) { 32135 this.lookup = lookup; 32136 } else { 32137 throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`); 32138 } 32139 } 32140 32141 getRgbItem(src, srcOffset, dest, destOffset) { 32142 const numComps = this.base.numComps; 32143 const start = src[srcOffset] * numComps; 32144 this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0); 32145 } 32146 32147 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32148 const base = this.base; 32149 const numComps = base.numComps; 32150 const outputDelta = base.getOutputLength(numComps, alpha01); 32151 const lookup = this.lookup; 32152 32153 for (let i = 0; i < count; ++i) { 32154 const lookupPos = src[srcOffset++] * numComps; 32155 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 32156 destOffset += outputDelta; 32157 } 32158 } 32159 32160 getOutputLength(inputLength, alpha01) { 32161 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 32162 } 32163 32164 isDefaultDecode(decodeMap, bpc) { 32165 if (!Array.isArray(decodeMap)) { 32166 return true; 32167 } 32168 32169 if (decodeMap.length !== 2) { 32170 (0, _util.warn)("Decode map length is not correct"); 32171 return true; 32172 } 32173 32174 if (!Number.isInteger(bpc) || bpc < 1) { 32175 (0, _util.warn)("Bits per component is not correct"); 32176 return true; 32177 } 32178 32179 return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1; 32180 } 32181 32182} 32183 32184class DeviceGrayCS extends ColorSpace { 32185 constructor() { 32186 super("DeviceGray", 1); 32187 } 32188
32189 getRgbItem(src, srcOffset, dest, destOffset) { 32190 const c = src[srcOffset] * 255; 32191 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 32192 } 32193 32194 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32195 const scale = 255 / ((1 << bits) - 1); 32196 let j = srcOffset, 32197 q = destOffset; 32198 32199 for (let i = 0; i < count; ++i) { 32200 const c = scale * src[j++]; 32201 dest[q++] = c; 32202 dest[q++] = c; 32203 dest[q++] = c; 32204 q += alpha01; 32205 } 32206 } 32207 32208 getOutputLength(inputLength, alpha01) { 32209 return inputLength * (3 + alpha01); 32210 } 32211 32212} 32213 32214class DeviceRgbCS extends ColorSpace { 32215 constructor() { 32216 super("DeviceRGB", 3); 32217 } 32218 32219 getRgbItem(src, srcOffset, dest, destOffset) { 32220 dest[destOffset] = src[srcOffset] * 255; 32221 dest[destOffset + 1] = src[srcOffset + 1] * 255; 32222 dest[destOffset + 2] = src[srcOffset + 2] * 255; 32223 } 32224 32225 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32226 if (bits === 8 && alpha01 === 0) { 32227 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 32228 return; 32229 } 32230 32231 const scale = 255 / ((1 << bits) - 1); 32232 let j = srcOffset, 32233 q = destOffset; 32234 32235 for (let i = 0; i < count; ++i) { 32236 dest[q++] = scale * src[j++]; 32237 dest[q++] = scale * src[j++]; 32238 dest[q++] = scale * src[j++]; 32239 q += alpha01; 32240 } 32241 } 32242 32243 getOutputLength(inputLength, alpha01) { 32244 return inputLength * (3 + alpha01) / 3 | 0; 32245 } 32246 32247 isPassthrough(bits) { 32248 return bits === 8; 32249 } 32250 32251} 32252 32253const DeviceCmykCS = function DeviceCmykCSClosure() { 32254 function convertToRgb(src, srcOffset, srcScale, dest, destOffset) { 32255 const c = src[srcOffset] * srcScale; 32256 const m = src[srcOffset + 1] * srcScale; 32257 const y = src[srcOffset + 2] * srcScale; 32258 const k = src[srcOffset + 3] * srcScale; 32259 dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747); 32260 dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578); 32261 dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367); 32262 } 32263 32264 class DeviceCmykCS extends ColorSpace { 32265 constructor() { 32266 super("DeviceCMYK", 4); 32267 } 32268 32269 getRgbItem(src, srcOffset, dest, destOffset) { 32270 convertToRgb(src, srcOffset, 1, dest, destOffset); 32271 } 32272 32273 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32274 const scale = 1 / ((1 << bits) - 1); 32275 32276 for (let i = 0; i < count; i++) { 32277 convertToRgb(src, srcOffset, scale, dest, destOffset); 32278 srcOffset += 4; 32279 destOffset += 3 + alpha01; 32280 } 32281 } 32282 32283 getOutputLength(inputLength, alpha01) { 32284 return inputLength / 4 * (3 + alpha01) | 0; 32285 } 32286 32287 } 32288 32289 return DeviceCmykCS; 32290}(); 32291 32292const CalGrayCS = function CalGrayCSClosure() { 32293 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 32294 const A = src[srcOffset] * scale; 32295 const AG = A ** cs.G; 32296 const L = cs.YW * AG; 32297 const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0); 32298 dest[destOffset] = val; 32299 dest[destOffset + 1] = val; 32300 dest[destOffset + 2] = val; 32301 } 32302 32303 class CalGrayCS extends ColorSpace { 32304 constructor(whitePoint, blackPoint, gamma) { 32305 super("CalGray", 1); 32306 32307 if (!whitePoint) { 32308 throw new _util.FormatError("WhitePoint missing - required for color space CalGray"); 32309 } 32310 32311 blackPoint = blackPoint || [0, 0, 0]; 32312 gamma = gamma || 1; 32313 this.XW = whitePoint[0]; 32314 this.YW = whitePoint[1]; 32315 this.ZW = whitePoint[2]; 32316 this.XB = blackPoint[0]; 32317 this.YB = blackPoint[1]; 32318 this.ZB = blackPoint[2]; 32319 this.G = gamma; 32320 32321 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 32322 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 32323 } 32324 32325 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 32326 (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`); 32327 this.XB = this.YB = this.ZB = 0; 32328 } 32329 32330 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 32331 (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 32332 } 32333 32334 if (this.G < 1) { 32335 (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default."); 32336 this.G = 1; 32337 } 32338 } 32339
32340 getRgbItem(src, srcOffset, dest, destOffset) { 32341 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 32342 } 32343 32344 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32345 const scale = 1 / ((1 << bits) - 1); 32346 32347 for (let i = 0; i < count; ++i) { 32348 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 32349 srcOffset += 1; 32350 destOffset += 3 + alpha01; 32351 } 32352 } 32353 32354 getOutputLength(inputLength, alpha01) { 32355 return inputLength * (3 + alpha01); 32356 } 32357 32358 } 32359 32360 return CalGrayCS; 32361}(); 32362 32363const CalRGBCS = function CalRGBCSClosure() { 32364 const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 32365 const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]); 32366 const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]); 32367 const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 32368 const tempNormalizeMatrix = new Float32Array(3); 32369 const tempConvertMatrix1 = new Float32Array(3); 32370 const tempConvertMatrix2 = new Float32Array(3); 32371 const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 32372 32373 function matrixProduct(a, b, result) { 32374 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 32375 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 32376 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 32377 } 32378 32379 function convertToFlat(sourceWhitePoint, LMS, result) { 32380 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 32381 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 32382 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 32383 } 32384 32385 function convertToD65(sourceWhitePoint, LMS, result) { 32386 const D65X = 0.95047; 32387 const D65Y = 1; 32388 const D65Z = 1.08883; 32389 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 32390 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 32391 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 32392 } 32393 32394 function sRGBTransferFunction(color) { 32395 if (color <= 0.0031308) { 32396 return adjustToRange(0, 1, 12.92 * color); 32397 } 32398 32399 return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055); 32400 } 32401 32402 function adjustToRange(min, max, value) { 32403 return Math.max(min, Math.min(max, value)); 32404 } 32405 32406 function decodeL(L) { 32407 if (L < 0) { 32408 return -decodeL(-L); 32409 } 32410 32411 if (L > 8.0) { 32412 return ((L + 16) / 116) ** 3; 32413 } 32414 32415 return L * DECODE_L_CONSTANT; 32416 } 32417 32418 function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 32419 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 32420 result[0] = XYZ_Flat[0]; 32421 result[1] = XYZ_Flat[1]; 32422 result[2] = XYZ_Flat[2]; 32423 return; 32424 } 32425 32426 const zeroDecodeL = decodeL(0); 32427 const X_DST = zeroDecodeL; 32428 const X_SRC = decodeL(sourceBlackPoint[0]); 32429 const Y_DST = zeroDecodeL; 32430 const Y_SRC = decodeL(sourceBlackPoint[1]); 32431 const Z_DST = zeroDecodeL; 32432 const Z_SRC = decodeL(sourceBlackPoint[2]); 32433 const X_Scale = (1 - X_DST) / (1 - X_SRC); 32434 const X_Offset = 1 - X_Scale; 32435 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 32436 const Y_Offset = 1 - Y_Scale; 32437 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 32438 const Z_Offset = 1 - Z_Scale; 32439 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 32440 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 32441 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 32442 } 32443 32444 function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 32445 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 32446 result[0] = XYZ_In[0]; 32447 result[1] = XYZ_In[1]; 32448 result[2] = XYZ_In[2]; 32449 return; 32450 } 32451 32452 const LMS = result; 32453 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 32454 const LMS_Flat = tempNormalizeMatrix; 32455 convertToFlat(sourceWhitePoint, LMS, LMS_Flat); 32456 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 32457 } 32458 32459 function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 32460 const LMS = result; 32461 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 32462 const LMS_D65 = tempNormalizeMatrix; 32463 convertToD65(sourceWhitePoint, LMS, LMS_D65);
32464 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 32465 } 32466 32467 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 32468 const A = adjustToRange(0, 1, src[srcOffset] * scale); 32469 const B = adjustToRange(0, 1, src[srcOffset + 1] * scale); 32470 const C = adjustToRange(0, 1, src[srcOffset + 2] * scale); 32471 const AGR = A ** cs.GR; 32472 const BGG = B ** cs.GG; 32473 const CGB = C ** cs.GB; 32474 const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; 32475 const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; 32476 const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; 32477 const XYZ = tempConvertMatrix1; 32478 XYZ[0] = X; 32479 XYZ[1] = Y; 32480 XYZ[2] = Z; 32481 const XYZ_Flat = tempConvertMatrix2; 32482 normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); 32483 const XYZ_Black = tempConvertMatrix1; 32484 compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); 32485 const XYZ_D65 = tempConvertMatrix2; 32486 normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 32487 const SRGB = tempConvertMatrix1; 32488 matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 32489 dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255; 32490 dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255; 32491 dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255; 32492 } 32493 32494 class CalRGBCS extends ColorSpace { 32495 constructor(whitePoint, blackPoint, gamma, matrix) { 32496 super("CalRGB", 3); 32497 32498 if (!whitePoint) { 32499 throw new _util.FormatError("WhitePoint missing - required for color space CalRGB"); 32500 } 32501 32502 blackPoint = blackPoint || new Float32Array(3); 32503 gamma = gamma || new Float32Array([1, 1, 1]); 32504 matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 32505 const XW = whitePoint[0]; 32506 const YW = whitePoint[1]; 32507 const ZW = whitePoint[2]; 32508 this.whitePoint = whitePoint; 32509 const XB = blackPoint[0]; 32510 const YB = blackPoint[1]; 32511 const ZB = blackPoint[2]; 32512 this.blackPoint = blackPoint; 32513 this.GR = gamma[0]; 32514 this.GG = gamma[1]; 32515 this.GB = gamma[2]; 32516 this.MXA = matrix[0]; 32517 this.MYA = matrix[1]; 32518 this.MZA = matrix[2]; 32519 this.MXB = matrix[3]; 32520 this.MYB = matrix[4]; 32521 this.MZB = matrix[5]; 32522 this.MXC = matrix[6]; 32523 this.MYC = matrix[7]; 32524 this.MZC = matrix[8]; 32525 32526 if (XW < 0 || ZW < 0 || YW !== 1) { 32527 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 32528 } 32529 32530 if (XB < 0 || YB < 0 || ZB < 0) { 32531 (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 32532 this.blackPoint = new Float32Array(3); 32533 } 32534 32535 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 32536 (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 32537 this.GR = this.GG = this.GB = 1; 32538 } 32539 } 32540 32541 getRgbItem(src, srcOffset, dest, destOffset) { 32542 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 32543 } 32544 32545 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32546 const scale = 1 / ((1 << bits) - 1); 32547 32548 for (let i = 0; i < count; ++i) { 32549 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 32550 srcOffset += 3; 32551 destOffset += 3 + alpha01; 32552 } 32553 } 32554 32555 getOutputLength(inputLength, alpha01) { 32556 return inputLength * (3 + alpha01) / 3 | 0; 32557 } 32558 32559 } 32560 32561 return CalRGBCS; 32562}(); 32563 32564const LabCS = function LabCSClosure() { 32565 function fn_g(x) { 32566 let result; 32567 32568 if (x >= 6 / 29) { 32569 result = x * x * x; 32570 } else { 32571 result = 108 / 841 * (x - 4 / 29); 32572 } 32573 32574 return result; 32575 } 32576 32577 function decode(value, high1, low2, high2) { 32578 return low2 + value * (high2 - low2) / high1; 32579 } 32580 32581 function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) { 32582 let Ls = src[srcOffset]; 32583 let as = src[srcOffset + 1]; 32584 let bs = src[srcOffset + 2]; 32585 32586 if (maxVal !== false) { 32587 Ls = decode(Ls, maxVal, 0, 100); 32588 as = decode(as, maxVal, cs.amin, cs.amax); 32589 bs = decode(bs, maxVal, cs.bmin, cs.bmax); 32590 } 32591 32592 if (as > cs.amax) { 32593 as = cs.amax; 32594 } else if (as < cs.amin) { 32595 as = cs.amin; 32596 } 32597 32598 if (bs > cs.bmax) { 32599 bs = cs.bmax; 32600 } else if (bs < cs.bmin) { 32601 bs = cs.bmin; 32602 } 32603 32604 const M = (Ls + 16) / 116; 32605 const L = M + as / 500; 32606 const N = M - bs / 200; 32607 const X = cs.XW * fn_g(L); 32608 const Y = cs.YW * fn_g(M); 32609 const Z = cs.ZW * fn_g(N); 32610 let r, g, b; 32611 32612 if (cs.ZW < 1) { 32613 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 32614 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 32615 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 32616 } else { 32617 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 32618 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 32619 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 32620 } 32621 32622 dest[destOffset] = Math.sqrt(r) * 255; 32623 dest[destOffset + 1] = Math.sqrt(g) * 255; 32624 dest[destOffset + 2] = Math.sqrt(b) * 255; 32625 } 32626 32627 class LabCS extends ColorSpace { 32628 constructor(whitePoint, blackPoint, range) { 32629 super("Lab", 3); 32630 32631 if (!whitePoint) { 32632 throw new _util.FormatError("WhitePoint missing - required for color space Lab"); 32633 } 32634 32635 blackPoint = blackPoint || [0, 0, 0]; 32636 range = range || [-100, 100, -100, 100]; 32637 this.XW = whitePoint[0]; 32638 this.YW = whitePoint[1]; 32639 this.ZW = whitePoint[2]; 32640 this.amin = range[0]; 32641 this.amax = range[1]; 32642 this.bmin = range[2]; 32643 this.bmax = range[3]; 32644 this.XB = blackPoint[0]; 32645 this.YB = blackPoint[1]; 32646 this.ZB = blackPoint[2]; 32647 32648 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 32649 throw new _util.FormatError("Invalid WhitePoint components, no fallback available"); 32650 } 32651 32652 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 32653 (0, _util.info)("Invalid BlackPoint, falling back to default"); 32654 this.XB = this.YB = this.ZB = 0; 32655 } 32656 32657 if (this.amin > this.amax || this.bmin > this.bmax) { 32658 (0, _util.info)("Invalid Range, falling back to defaults"); 32659 this.amin = -100; 32660 this.amax = 100; 32661 this.bmin = -100; 32662 this.bmax = 100; 32663 } 32664 } 32665
32666 getRgbItem(src, srcOffset, dest, destOffset) { 32667 convertToRgb(this, src, srcOffset, false, dest, destOffset); 32668 } 32669 32670 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 32671 const maxVal = (1 << bits) - 1; 32672 32673 for (let i = 0; i < count; i++) { 32674 convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); 32675 srcOffset += 3; 32676 destOffset += 3 + alpha01; 32677 } 32678 } 32679 32680 getOutputLength(inputLength, alpha01) { 32681 return inputLength * (3 + alpha01) / 3 | 0; 32682 } 32683 32684 isDefaultDecode(decodeMap, bpc) { 32685 return true; 32686 } 32687 32688 get usesZeroToOneRange() { 32689 return (0, _util.shadow)(this, "usesZeroToOneRange", false); 32690 } 32691 32692 } 32693 32694 return LabCS; 32695}(); 32696 32697/***/ }), 32698/* 24 */ 32699/***/ (function(module, exports, __w_pdfjs_require__) { 32700 32701"use strict"; 32702 32703 32704Object.defineProperty(exports, "__esModule", { 32705 value: true 32706}); 32707exports.GlobalImageCache = exports.LocalImageCache = void 0; 32708 32709var _util = __w_pdfjs_require__(2); 32710 32711var _primitives = __w_pdfjs_require__(5); 32712 32713class LocalImageCache { 32714 constructor() { 32715 this._nameRefMap = new Map(); 32716 this._imageMap = new Map(); 32717 this._imageCache = new _primitives.RefSetCache(); 32718 } 32719 32720 getByName(name) { 32721 const ref = this._nameRefMap.get(name); 32722 32723 if (ref) { 32724 return this.getByRef(ref); 32725 } 32726 32727 return this._imageMap.get(name) || null; 32728 } 32729 32730 getByRef(ref) { 32731 return this._imageCache.get(ref) || null; 32732 } 32733 32734 set(name, ref = null, data) { 32735 if (!name) { 32736 throw new Error('LocalImageCache.set - expected "name" argument.'); 32737 } 32738 32739 if (ref) { 32740 if (this._imageCache.has(ref)) { 32741 return; 32742 } 32743 32744 this._nameRefMap.set(name, ref); 32745 32746 this._imageCache.put(ref, data); 32747 32748 return; 32749 } 32750 32751 if (this._imageMap.has(name)) { 32752 return; 32753 } 32754 32755 this._imageMap.set(name, data); 32756 } 32757 32758} 32759 32760exports.LocalImageCache = LocalImageCache; 32761 32762class GlobalImageCache { 32763 static get NUM_PAGES_THRESHOLD() { 32764 return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2); 32765 } 32766 32767 static get MAX_IMAGES_TO_CACHE() { 32768 return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10); 32769 } 32770 32771 constructor() { 32772 this._refCache = new _primitives.RefSetCache(); 32773 this._imageCache = new _primitives.RefSetCache(); 32774 } 32775 32776 shouldCache(ref, pageIndex) { 32777 const pageIndexSet = this._refCache.get(ref); 32778 32779 const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1; 32780 32781 if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) { 32782 return false; 32783 } 32784 32785 if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) { 32786 return false; 32787 } 32788 32789 return true; 32790 } 32791 32792 addPageIndex(ref, pageIndex) { 32793 let pageIndexSet = this._refCache.get(ref); 32794 32795 if (!pageIndexSet) { 32796 pageIndexSet = new Set(); 32797 32798 this._refCache.put(ref, pageIndexSet); 32799 } 32800 32801 pageIndexSet.add(pageIndex); 32802 } 32803 32804 getData(ref, pageIndex) { 32805 if (!this._refCache.has(ref)) { 32806 return null; 32807 } 32808 32809 const pageIndexSet = this._refCache.get(ref); 32810 32811 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 32812 return null; 32813 } 32814 32815 if (!this._imageCache.has(ref)) { 32816 return null; 32817 } 32818 32819 pageIndexSet.add(pageIndex); 32820 return this._imageCache.get(ref); 32821 } 32822 32823 setData(ref, data) { 32824 if (!this._refCache.has(ref)) { 32825 throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.'); 32826 } 32827 32828 if (this._imageCache.has(ref)) { 32829 return; 32830 } 32831 32832 if (this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) { 32833 (0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE."); 32834 return; 32835 } 32836 32837 this._imageCache.put(ref, data); 32838 } 32839 32840 clear(onlyData = false) { 32841 if (!onlyData) { 32842 this._refCache.clear(); 32843 } 32844 32845 this._imageCache.clear(); 32846 } 32847 32848} 32849 32850exports.GlobalImageCache = GlobalImageCache; 32851 32852/***/ }), 32853/* 25 */ 32854/***/ (function(module, exports, __w_pdfjs_require__) { 32855 32856"use strict"; 32857 32858 32859Object.defineProperty(exports, "__esModule", { 32860 value: true 32861}); 32862exports.getQuadPoints = getQuadPoints;
32863exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; 32864 32865var _util = __w_pdfjs_require__(2); 32866 32867var _obj = __w_pdfjs_require__(10); 32868 32869var _primitives = __w_pdfjs_require__(5); 32870 32871var _colorspace = __w_pdfjs_require__(23); 32872 32873var _core_utils = __w_pdfjs_require__(8); 32874 32875var _operator_list = __w_pdfjs_require__(26); 32876 32877var _stream = __w_pdfjs_require__(12); 32878 32879class AnnotationFactory { 32880 static create(xref, ref, pdfManager, idFactory) { 32881 return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]); 32882 } 32883 32884 static _create(xref, ref, pdfManager, idFactory) { 32885 const dict = xref.fetchIfRef(ref); 32886 32887 if (!(0, _primitives.isDict)(dict)) { 32888 return undefined; 32889 } 32890 32891 const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; 32892 let subtype = dict.get("Subtype"); 32893 subtype = (0, _primitives.isName)(subtype) ? subtype.name : null; 32894 const parameters = { 32895 xref, 32896 dict, 32897 subtype, 32898 id, 32899 pdfManager 32900 }; 32901 32902 switch (subtype) { 32903 case "Link": 32904 return new LinkAnnotation(parameters); 32905 32906 case "Text": 32907 return new TextAnnotation(parameters); 32908 32909 case "Widget": 32910 let fieldType = (0, _core_utils.getInheritableProperty)({ 32911 dict, 32912 key: "FT" 32913 }); 32914 fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; 32915 32916 switch (fieldType) { 32917 case "Tx": 32918 return new TextWidgetAnnotation(parameters); 32919 32920 case "Btn": 32921 return new ButtonWidgetAnnotation(parameters); 32922 32923 case "Ch": 32924 return new ChoiceWidgetAnnotation(parameters); 32925 } 32926 32927 (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type."); 32928 return new WidgetAnnotation(parameters); 32929 32930 case "Popup": 32931 return new PopupAnnotation(parameters); 32932 32933 case "FreeText": 32934 return new FreeTextAnnotation(parameters); 32935 32936 case "Line": 32937 return new LineAnnotation(parameters); 32938 32939 case "Square": 32940 return new SquareAnnotation(parameters); 32941 32942 case "Circle": 32943 return new CircleAnnotation(parameters); 32944 32945 case "PolyLine": 32946 return new PolylineAnnotation(parameters); 32947 32948 case "Polygon": 32949 return new PolygonAnnotation(parameters); 32950 32951 case "Caret": 32952 return new CaretAnnotation(parameters); 32953 32954 case "Ink": 32955 return new InkAnnotation(parameters); 32956 32957 case "Highlight": 32958 return new HighlightAnnotation(parameters); 32959 32960 case "Underline": 32961 return new UnderlineAnnotation(parameters); 32962 32963 case "Squiggly": 32964 return new SquigglyAnnotation(parameters); 32965 32966 case "StrikeOut": 32967 return new StrikeOutAnnotation(parameters); 32968 32969 case "Stamp": 32970 return new StampAnnotation(parameters); 32971 32972 case "FileAttachment": 32973 return new FileAttachmentAnnotation(parameters); 32974 32975 default: 32976 if (!subtype) { 32977 (0, _util.warn)("Annotation is missing the required /Subtype."); 32978 } else { 32979 (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation."); 32980 } 32981 32982 return new Annotation(parameters); 32983 } 32984 } 32985 32986} 32987 32988exports.AnnotationFactory = AnnotationFactory; 32989 32990function getQuadPoints(dict, rect) { 32991 if (!dict.has("QuadPoints")) { 32992 return null; 32993 } 32994 32995 const quadPoints = dict.getArray("QuadPoints"); 32996 32997 if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) { 32998 return null; 32999 } 33000 33001 const quadPointsLists = []; 33002 33003 for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) { 33004 quadPointsLists.push([]); 33005 33006 for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) { 33007 const x = quadPoints[j]; 33008 const y = quadPoints[j + 1]; 33009 33010 if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) { 33011 return null; 33012 } 33013 33014 quadPointsLists[i].push({ 33015 x, 33016 y 33017 }); 33018 } 33019 } 33020 33021 return quadPointsLists; 33022} 33023 33024function getTransformMatrix(rect, bbox, matrix) { 33025 const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); 33026 33027 if (minX === maxX || minY === maxY) { 33028 return [1, 0, 0, 1, rect[0], rect[1]]; 33029 } 33030 33031 const xRatio = (rect[2] - rect[0]) / (maxX - minX);
33032 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 33033 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 33034} 33035 33036class Annotation { 33037 constructor(params) { 33038 const dict = params.dict; 33039 this.setContents(dict.get("Contents")); 33040 this.setModificationDate(dict.get("M")); 33041 this.setFlags(dict.get("F")); 33042 this.setRectangle(dict.getArray("Rect")); 33043 this.setColor(dict.getArray("C")); 33044 this.setBorderStyle(dict); 33045 this.setAppearance(dict); 33046 this.data = { 33047 annotationFlags: this.flags, 33048 borderStyle: this.borderStyle, 33049 color: this.color, 33050 contents: this.contents, 33051 hasAppearance: !!this.appearance, 33052 id: params.id, 33053 modificationDate: this.modificationDate, 33054 rect: this.rectangle, 33055 subtype: params.subtype 33056 }; 33057 } 33058 33059 _hasFlag(flags, flag) { 33060 return !!(flags & flag); 33061 } 33062 33063 _isViewable(flags) { 33064 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); 33065 } 33066 33067 _isPrintable(flags) { 33068 return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN); 33069 } 33070 33071 get viewable() { 33072 if (this.flags === 0) { 33073 return true; 33074 } 33075 33076 return this._isViewable(this.flags); 33077 } 33078 33079 get printable() { 33080 if (this.flags === 0) { 33081 return false; 33082 } 33083 33084 return this._isPrintable(this.flags); 33085 } 33086 33087 setContents(contents) { 33088 this.contents = (0, _util.stringToPDFString)(contents || ""); 33089 } 33090 33091 setModificationDate(modificationDate) { 33092 this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null; 33093 } 33094 33095 setFlags(flags) { 33096 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 33097 } 33098 33099 hasFlag(flag) { 33100 return this._hasFlag(this.flags, flag); 33101 } 33102 33103 setRectangle(rectangle) { 33104 if (Array.isArray(rectangle) && rectangle.length === 4) { 33105 this.rectangle = _util.Util.normalizeRect(rectangle); 33106 } else { 33107 this.rectangle = [0, 0, 0, 0]; 33108 } 33109 } 33110 33111 setColor(color) { 33112 const rgbColor = new Uint8ClampedArray(3); 33113 33114 if (!Array.isArray(color)) { 33115 this.color = rgbColor; 33116 return; 33117 } 33118 33119 switch (color.length) { 33120 case 0: 33121 this.color = null; 33122 break; 33123 33124 case 1: 33125 _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 33126 33127 this.color = rgbColor; 33128 break; 33129 33130 case 3: 33131 _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 33132 33133 this.color = rgbColor; 33134 break; 33135 33136 case 4: 33137 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 33138 33139 this.color = rgbColor; 33140 break; 33141 33142 default: 33143 this.color = rgbColor; 33144 break; 33145 } 33146 } 33147 33148 setBorderStyle(borderStyle) { 33149 this.borderStyle = new AnnotationBorderStyle(); 33150 33151 if (!(0, _primitives.isDict)(borderStyle)) { 33152 return; 33153 } 33154 33155 if (borderStyle.has("BS")) { 33156 const dict = borderStyle.get("BS"); 33157 const dictType = dict.get("Type"); 33158 33159 if (!dictType || (0, _primitives.isName)(dictType, "Border")) { 33160 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 33161 this.borderStyle.setStyle(dict.get("S")); 33162 this.borderStyle.setDashArray(dict.getArray("D")); 33163 } 33164 } else if (borderStyle.has("Border")) { 33165 const array = borderStyle.getArray("Border"); 33166 33167 if (Array.isArray(array) && array.length >= 3) { 33168 this.borderStyle.setHorizontalCornerRadius(array[0]); 33169 this.borderStyle.setVerticalCornerRadius(array[1]); 33170 this.borderStyle.setWidth(array[2], this.rectangle); 33171 33172 if (array.length === 4) { 33173 this.borderStyle.setDashArray(array[3]); 33174 } 33175 } 33176 } else { 33177 this.borderStyle.setWidth(0); 33178 } 33179 } 33180 33181 setAppearance(dict) { 33182 this.appearance = null; 33183 const appearanceStates = dict.get("AP"); 33184 33185 if (!(0, _primitives.isDict)(appearanceStates)) { 33186 return; 33187 } 33188 33189 const normalAppearanceState = appearanceStates.get("N"); 33190 33191 if ((0, _primitives.isStream)(normalAppearanceState)) { 33192 this.appearance = normalAppearanceState; 33193 return; 33194 } 33195 33196 if (!(0, _primitives.isDict)(normalAppearanceState)) { 33197 return; 33198 } 33199 33200 const as = dict.get("AS"); 33201 33202 if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) { 33203 return; 33204 } 33205 33206 this.appearance = normalAppearanceState.get(as.name); 33207 } 33208 33209 loadResources(keys) { 33210 return this.appearance.dict.getAsync("Resources").then(resources => { 33211 if (!resources) { 33212 return undefined; 33213 } 33214 33215 const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref); 33216 return objectLoader.load().then(function () { 33217 return resources; 33218 }); 33219 }); 33220 } 33221 33222 getOperatorList(evaluator, task, renderForms) { 33223 if (!this.appearance) { 33224 return Promise.resolve(new _operator_list.OperatorList()); 33225 } 33226 33227 const data = this.data; 33228 const appearanceDict = this.appearance.dict; 33229 const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]); 33230 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 33231 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 33232 const transform = getTransformMatrix(data.rect, bbox, matrix); 33233 return resourcesPromise.then(resources => { 33234 const opList = new _operator_list.OperatorList(); 33235 opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]); 33236 return evaluator.getOperatorList({ 33237 stream: this.appearance, 33238 task, 33239 resources, 33240 operatorList: opList 33241 }).then(() => { 33242 opList.addOp(_util.OPS.endAnnotation, []); 33243 this.appearance.reset(); 33244 return opList; 33245 }); 33246 }); 33247 } 33248 33249} 33250 33251exports.Annotation = Annotation; 33252 33253class AnnotationBorderStyle { 33254 constructor() { 33255 this.width = 1; 33256 this.style = _util.AnnotationBorderStyleType.SOLID; 33257 this.dashArray = [3]; 33258 this.horizontalCornerRadius = 0; 33259 this.verticalCornerRadius = 0; 33260 } 33261 33262 setWidth(width, rect = [0, 0, 0, 0]) { 33263 if ((0, _primitives.isName)(width)) { 33264 this.width = 0; 33265 return; 33266 } 33267 33268 if (Number.isInteger(width)) { 33269 if (width > 0) { 33270 const maxWidth = (rect[2] - rect[0]) / 2; 33271 const maxHeight = (rect[3] - rect[1]) / 2; 33272 33273 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 33274 (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 33275 width = 1; 33276 } 33277 } 33278 33279 this.width = width; 33280 } 33281 } 33282 33283 setStyle(style) { 33284 if (!(0, _primitives.isName)(style)) { 33285 return; 33286 } 33287 33288 switch (style.name) { 33289 case "S": 33290 this.style = _util.AnnotationBorderStyleType.SOLID; 33291 break; 33292 33293 case "D": 33294 this.style = _util.AnnotationBorderStyleType.DASHED; 33295 break; 33296 33297 case "B": 33298 this.style = _util.AnnotationBorderStyleType.BEVELED; 33299 break; 33300 33301 case "I": 33302 this.style = _util.AnnotationBorderStyleType.INSET; 33303 break; 33304 33305 case "U": 33306 this.style = _util.AnnotationBorderStyleType.UNDERLINE; 33307 break; 33308 33309 default: 33310 break; 33311 } 33312 } 33313 33314 setDashArray(dashArray) { 33315 if (Array.isArray(dashArray) && dashArray.length > 0) { 33316 let isValid = true; 33317 let allZeros = true; 33318 33319 for (const element of dashArray) { 33320 const validNumber = +element >= 0; 33321 33322 if (!validNumber) { 33323 isValid = false;
33324 break; 33325 } else if (element > 0) { 33326 allZeros = false; 33327 } 33328 } 33329 33330 if (isValid && !allZeros) { 33331 this.dashArray = dashArray; 33332 } else { 33333 this.width = 0; 33334 } 33335 } else if (dashArray) { 33336 this.width = 0; 33337 } 33338 } 33339 33340 setHorizontalCornerRadius(radius) { 33341 if (Number.isInteger(radius)) { 33342 this.horizontalCornerRadius = radius; 33343 } 33344 } 33345 33346 setVerticalCornerRadius(radius) { 33347 if (Number.isInteger(radius)) { 33348 this.verticalCornerRadius = radius; 33349 } 33350 } 33351 33352} 33353 33354exports.AnnotationBorderStyle = AnnotationBorderStyle; 33355 33356class MarkupAnnotation extends Annotation { 33357 constructor(parameters) { 33358 super(parameters); 33359 const dict = parameters.dict; 33360 33361 if (dict.has("IRT")) { 33362 const rawIRT = dict.getRaw("IRT"); 33363 this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null; 33364 const rt = dict.get("RT"); 33365 this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY; 33366 } 33367 33368 if (this.data.replyType === _util.AnnotationReplyType.GROUP) { 33369 const parent = dict.get("IRT"); 33370 this.data.title = (0, _util.stringToPDFString)(parent.get("T") || ""); 33371 this.setContents(parent.get("Contents")); 33372 this.data.contents = this.contents; 33373 33374 if (!parent.has("CreationDate")) { 33375 this.data.creationDate = null; 33376 } else { 33377 this.setCreationDate(parent.get("CreationDate")); 33378 this.data.creationDate = this.creationDate; 33379 } 33380 33381 if (!parent.has("M")) { 33382 this.data.modificationDate = null; 33383 } else { 33384 this.setModificationDate(parent.get("M")); 33385 this.data.modificationDate = this.modificationDate; 33386 } 33387 33388 this.data.hasPopup = parent.has("Popup"); 33389 33390 if (!parent.has("C")) { 33391 this.data.color = null; 33392 } else { 33393 this.setColor(parent.getArray("C")); 33394 this.data.color = this.color; 33395 } 33396 } else { 33397 this.data.title = (0, _util.stringToPDFString)(dict.get("T") || ""); 33398 this.setCreationDate(dict.get("CreationDate")); 33399 this.data.creationDate = this.creationDate; 33400 this.data.hasPopup = dict.has("Popup"); 33401 33402 if (!dict.has("C")) { 33403 this.data.color = null; 33404 } 33405 } 33406 } 33407 33408 setCreationDate(creationDate) { 33409 this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null; 33410 } 33411 33412} 33413 33414exports.MarkupAnnotation = MarkupAnnotation; 33415 33416class WidgetAnnotation extends Annotation { 33417 constructor(params) { 33418 super(params); 33419 const dict = params.dict; 33420 const data = this.data; 33421 data.annotationType = _util.AnnotationType.WIDGET; 33422 data.fieldName = this._constructFieldName(dict); 33423 data.fieldValue = (0, _core_utils.getInheritableProperty)({ 33424 dict, 33425 key: "V", 33426 getArray: true 33427 }); 33428 data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || ""); 33429 data.defaultAppearance = (0, _core_utils.getInheritableProperty)({ 33430 dict, 33431 key: "DA" 33432 }) || ""; 33433 const fieldType = (0, _core_utils.getInheritableProperty)({ 33434 dict, 33435 key: "FT" 33436 }); 33437 data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; 33438 this.fieldResources = (0, _core_utils.getInheritableProperty)({ 33439 dict, 33440 key: "DR" 33441 }) || _primitives.Dict.empty; 33442 data.fieldFlags = (0, _core_utils.getInheritableProperty)({ 33443 dict, 33444 key: "Ff" 33445 }); 33446 33447 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 33448 data.fieldFlags = 0; 33449 } 33450 33451 data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); 33452 33453 if (data.fieldType === "Sig") { 33454 data.fieldValue = null; 33455 this.setFlags(_util.AnnotationFlag.HIDDEN); 33456 } 33457 } 33458 33459 _constructFieldName(dict) { 33460 if (!dict.has("T") && !dict.has("Parent")) { 33461 (0, _util.warn)("Unknown field name, falling back to empty field name."); 33462 return ""; 33463 } 33464 33465 if (!dict.has("Parent")) { 33466 return (0, _util.stringToPDFString)(dict.get("T")); 33467 } 33468 33469 const fieldName = []; 33470 33471 if (dict.has("T")) { 33472 fieldName.unshift((0, _util.stringToPDFString)(dict.get("T"))); 33473 } 33474 33475 let loopDict = dict; 33476 33477 while (loopDict.has("Parent")) { 33478 loopDict = loopDict.get("Parent"); 33479 33480 if (!(0, _primitives.isDict)(loopDict)) { 33481 break; 33482 } 33483 33484 if (loopDict.has("T")) { 33485 fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T"))); 33486 } 33487 } 33488 33489 return fieldName.join("."); 33490 } 33491 33492 hasFieldFlag(flag) { 33493 return !!(this.data.fieldFlags & flag); 33494 } 33495 33496 getOperatorList(evaluator, task, renderForms) { 33497 if (renderForms) { 33498 return Promise.resolve(new _operator_list.OperatorList()); 33499 } 33500 33501 return super.getOperatorList(evaluator, task, renderForms); 33502 } 33503 33504} 33505 33506class TextWidgetAnnotation extends WidgetAnnotation { 33507 constructor(params) { 33508 super(params); 33509 const dict = params.dict; 33510 this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || ""); 33511 let alignment = (0, _core_utils.getInheritableProperty)({ 33512 dict, 33513 key: "Q" 33514 }); 33515 33516 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 33517 alignment = null; 33518 } 33519 33520 this.data.textAlignment = alignment; 33521 let maximumLength = (0, _core_utils.getInheritableProperty)({ 33522 dict, 33523 key: "MaxLen" 33524 }); 33525 33526 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 33527 maximumLength = null; 33528 } 33529 33530 this.data.maxLen = maximumLength; 33531 this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); 33532 this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; 33533 } 33534 33535 getOperatorList(evaluator, task, renderForms) { 33536 if (renderForms || this.appearance) { 33537 return super.getOperatorList(evaluator, task, renderForms); 33538 } 33539 33540 const operatorList = new _operator_list.OperatorList(); 33541 33542 if (!this.data.defaultAppearance) { 33543 return Promise.resolve(operatorList); 33544 } 33545 33546 const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance)); 33547 return evaluator.getOperatorList({ 33548 stream, 33549 task, 33550 resources: this.fieldResources, 33551 operatorList 33552 }).then(function () { 33553 return operatorList; 33554 }); 33555 } 33556 33557} 33558 33559class ButtonWidgetAnnotation extends WidgetAnnotation { 33560 constructor(params) { 33561 super(params); 33562 this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 33563 this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 33564 this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 33565 33566 if (this.data.checkBox) { 33567 this._processCheckBox(params); 33568 } else if (this.data.radioButton) { 33569 this._processRadioButton(params); 33570 } else if (this.data.pushButton) { 33571 this._processPushButton(params); 33572 } else { 33573 (0, _util.warn)("Invalid field flags for button widget annotation"); 33574 } 33575 } 33576 33577 _processCheckBox(params) { 33578 if ((0, _primitives.isName)(this.data.fieldValue)) { 33579 this.data.fieldValue = this.data.fieldValue.name; 33580 } 33581 33582 const customAppearance = params.dict.get("AP"); 33583 33584 if (!(0, _primitives.isDict)(customAppearance)) { 33585 return; 33586 } 33587 33588 const exportValueOptionsDict = customAppearance.get("D"); 33589 33590 if (!(0, _primitives.isDict)(exportValueOptionsDict)) { 33591 return; 33592 } 33593
33594 const exportValues = exportValueOptionsDict.getKeys(); 33595 const hasCorrectOptionCount = exportValues.length === 2; 33596 33597 if (!hasCorrectOptionCount) { 33598 return; 33599 } 33600 33601 this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0]; 33602 } 33603 33604 _processRadioButton(params) { 33605 this.data.fieldValue = this.data.buttonValue = null; 33606 const fieldParent = params.dict.get("Parent"); 33607 33608 if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) { 33609 const fieldParentValue = fieldParent.get("V"); 33610 33611 if ((0, _primitives.isName)(fieldParentValue)) { 33612 this.data.fieldValue = fieldParentValue.name; 33613 } 33614 } 33615 33616 const appearanceStates = params.dict.get("AP"); 33617 33618 if (!(0, _primitives.isDict)(appearanceStates)) { 33619 return; 33620 } 33621 33622 const normalAppearanceState = appearanceStates.get("N"); 33623 33624 if (!(0, _primitives.isDict)(normalAppearanceState)) { 33625 return; 33626 } 33627 33628 for (const key of normalAppearanceState.getKeys()) { 33629 if (key !== "Off") { 33630 this.data.buttonValue = key; 33631 break; 33632 } 33633 } 33634 } 33635 33636 _processPushButton(params) { 33637 if (!params.dict.has("A")) { 33638 (0, _util.warn)("Push buttons without action dictionaries are not supported"); 33639 return; 33640 } 33641 33642 _obj.Catalog.parseDestDictionary({ 33643 destDict: params.dict, 33644 resultObj: this.data, 33645 docBaseUrl: params.pdfManager.docBaseUrl 33646 }); 33647 } 33648 33649} 33650 33651class ChoiceWidgetAnnotation extends WidgetAnnotation { 33652 constructor(params) { 33653 super(params); 33654 this.data.options = []; 33655 const options = (0, _core_utils.getInheritableProperty)({ 33656 dict: params.dict, 33657 key: "Opt" 33658 }); 33659 33660 if (Array.isArray(options)) { 33661 const xref = params.xref; 33662 33663 for (let i = 0, ii = options.length; i < ii; i++) { 33664 const option = xref.fetchIfRef(options[i]); 33665 const isOptionArray = Array.isArray(option); 33666 this.data.options[i] = { 33667 exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option, 33668 displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option) 33669 }; 33670 } 33671 } 33672 33673 if (!Array.isArray(this.data.fieldValue)) { 33674 this.data.fieldValue = [this.data.fieldValue]; 33675 } 33676 33677 this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); 33678 this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); 33679 } 33680 33681} 33682 33683class TextAnnotation extends MarkupAnnotation { 33684 constructor(parameters) { 33685 const DEFAULT_ICON_SIZE = 22; 33686 super(parameters); 33687 const dict = parameters.dict; 33688 this.data.annotationType = _util.AnnotationType.TEXT; 33689 33690 if (this.data.hasAppearance) { 33691 this.data.name = "NoIcon"; 33692 } else { 33693 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 33694 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 33695 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 33696 } 33697 33698 if (dict.has("State")) { 33699 this.data.state = dict.get("State") || null; 33700 this.data.stateModel = dict.get("StateModel") || null; 33701 } else { 33702 this.data.state = null; 33703 this.data.stateModel = null; 33704 } 33705 } 33706 33707} 33708 33709class LinkAnnotation extends Annotation { 33710 constructor(params) { 33711 super(params); 33712 this.data.annotationType = _util.AnnotationType.LINK; 33713 const quadPoints = getQuadPoints(params.dict, this.rectangle); 33714 33715 if (quadPoints) { 33716 this.data.quadPoints = quadPoints; 33717 } 33718 33719 _obj.Catalog.parseDestDictionary({ 33720 destDict: params.dict, 33721 resultObj: this.data, 33722 docBaseUrl: params.pdfManager.docBaseUrl 33723 }); 33724 } 33725 33726} 33727 33728class PopupAnnotation extends Annotation { 33729 constructor(parameters) { 33730 super(parameters); 33731 this.data.annotationType = _util.AnnotationType.POPUP; 33732 let parentItem = parameters.dict.get("Parent"); 33733 33734 if (!parentItem) { 33735 (0, _util.warn)("Popup annotation has a missing or invalid parent annotation."); 33736 return; 33737 } 33738 33739 const parentSubtype = parentItem.get("Subtype"); 33740 this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; 33741 const rawParent = parameters.dict.getRaw("Parent"); 33742 this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null; 33743 const rt = parentItem.get("RT"); 33744 33745 if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) { 33746 parentItem = parentItem.get("IRT"); 33747 } 33748 33749 if (!parentItem.has("M")) { 33750 this.data.modificationDate = null; 33751 } else { 33752 this.setModificationDate(parentItem.get("M")); 33753 this.data.modificationDate = this.modificationDate; 33754 } 33755 33756 if (!parentItem.has("C")) { 33757 this.data.color = null; 33758 } else { 33759 this.setColor(parentItem.getArray("C")); 33760 this.data.color = this.color; 33761 } 33762 33763 if (!this.viewable) { 33764 const parentFlags = parentItem.get("F"); 33765 33766 if (this._isViewable(parentFlags)) { 33767 this.setFlags(parentFlags); 33768 } 33769 } 33770 33771 this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || ""); 33772 this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || ""); 33773 } 33774 33775} 33776 33777class FreeTextAnnotation extends MarkupAnnotation { 33778 constructor(parameters) { 33779 super(parameters); 33780 this.data.annotationType = _util.AnnotationType.FREETEXT; 33781 } 33782 33783} 33784 33785class LineAnnotation extends MarkupAnnotation { 33786 constructor(parameters) { 33787 super(parameters); 33788 this.data.annotationType = _util.AnnotationType.LINE; 33789 this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L")); 33790 } 33791 33792} 33793 33794class SquareAnnotation extends MarkupAnnotation { 33795 constructor(parameters) { 33796 super(parameters); 33797 this.data.annotationType = _util.AnnotationType.SQUARE; 33798 } 33799 33800} 33801 33802class CircleAnnotation extends MarkupAnnotation { 33803 constructor(parameters) { 33804 super(parameters); 33805 this.data.annotationType = _util.AnnotationType.CIRCLE; 33806 } 33807 33808} 33809 33810class PolylineAnnotation extends MarkupAnnotation { 33811 constructor(parameters) { 33812 super(parameters); 33813 this.data.annotationType = _util.AnnotationType.POLYLINE; 33814 const rawVertices = parameters.dict.getArray("Vertices"); 33815 this.data.vertices = []; 33816 33817 for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { 33818 this.data.vertices.push({ 33819 x: rawVertices[i], 33820 y: rawVertices[i + 1] 33821 }); 33822 } 33823 } 33824 33825} 33826 33827class PolygonAnnotation extends PolylineAnnotation { 33828 constructor(parameters) { 33829 super(parameters); 33830 this.data.annotationType = _util.AnnotationType.POLYGON; 33831 } 33832 33833} 33834 33835class CaretAnnotation extends MarkupAnnotation { 33836 constructor(parameters) { 33837 super(parameters); 33838 this.data.annotationType = _util.AnnotationType.CARET; 33839 } 33840 33841} 33842 33843class InkAnnotation extends MarkupAnnotation { 33844 constructor(parameters) { 33845 super(parameters); 33846 this.data.annotationType = _util.AnnotationType.INK; 33847 const xref = parameters.xref; 33848 const originalInkLists = parameters.dict.getArray("InkList"); 33849 this.data.inkLists = []; 33850 33851 for (let i = 0, ii = originalInkLists.length; i < ii; ++i) { 33852 this.data.inkLists.push([]); 33853 33854 for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) { 33855 this.data.inkLists[i].push({ 33856 x: xref.fetchIfRef(originalInkLists[i][j]), 33857 y: xref.fetchIfRef(originalInkLists[i][j + 1]) 33858 }); 33859 } 33860 } 33861 } 33862 33863} 33864 33865class HighlightAnnotation extends MarkupAnnotation { 33866 constructor(parameters) { 33867 super(parameters); 33868 this.data.annotationType = _util.AnnotationType.HIGHLIGHT; 33869 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 33870 33871 if (quadPoints) { 33872 this.data.quadPoints = quadPoints; 33873 } 33874 } 33875 33876} 33877 33878class UnderlineAnnotation extends MarkupAnnotation { 33879 constructor(parameters) { 33880 super(parameters); 33881 this.data.annotationType = _util.AnnotationType.UNDERLINE; 33882 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 33883 33884 if (quadPoints) { 33885 this.data.quadPoints = quadPoints; 33886 } 33887 } 33888 33889} 33890 33891class SquigglyAnnotation extends MarkupAnnotation { 33892 constructor(parameters) { 33893 super(parameters); 33894 this.data.annotationType = _util.AnnotationType.SQUIGGLY; 33895 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 33896 33897 if (quadPoints) { 33898 this.data.quadPoints = quadPoints; 33899 } 33900 } 33901 33902} 33903 33904class StrikeOutAnnotation extends MarkupAnnotation { 33905 constructor(parameters) { 33906 super(parameters); 33907 this.data.annotationType = _util.AnnotationType.STRIKEOUT; 33908 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 33909 33910 if (quadPoints) { 33911 this.data.quadPoints = quadPoints; 33912 } 33913 } 33914 33915} 33916 33917class StampAnnotation extends MarkupAnnotation { 33918 constructor(parameters) { 33919 super(parameters); 33920 this.data.annotationType = _util.AnnotationType.STAMP; 33921 } 33922 33923} 33924 33925class FileAttachmentAnnotation extends MarkupAnnotation { 33926 constructor(parameters) { 33927 super(parameters); 33928 const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref); 33929 this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; 33930 this.data.file = file.serializable; 33931 } 33932 33933} 33934 33935/***/ }), 33936/* 26 */ 33937/***/ (function(module, exports, __w_pdfjs_require__) { 33938 33939"use strict"; 33940 33941 33942Object.defineProperty(exports, "__esModule", { 33943 value: true 33944}); 33945exports.OperatorList = void 0; 33946 33947var _util = __w_pdfjs_require__(2); 33948 33949var QueueOptimizer = function QueueOptimizerClosure() { 33950 function addState(parentState, pattern, checkFn, iterateFn, processFn) { 33951 var state = parentState; 33952 33953 for (var i = 0, ii = pattern.length - 1; i < ii; i++) { 33954 var item = pattern[i]; 33955 state = state[item] || (state[item] = []); 33956 } 33957 33958 state[pattern[pattern.length - 1]] = { 33959 checkFn, 33960 iterateFn, 33961 processFn 33962 }; 33963 } 33964 33965 function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) { 33966 var iFirstPIMXO = iFirstSave + 2; 33967 33968 for (var i = 0; i < count; i++) { 33969 var arg = argsArray[iFirstPIMXO + 4 * i]; 33970 var imageMask = arg.length === 1 && arg[0]; 33971 33972 if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) { 33973 fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask; 33974 continue; 33975 } 33976 33977 break; 33978 } 33979 33980 return count - i; 33981 } 33982 33983 var InitialState = []; 33984 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) { 33985 var fnArray = context.fnArray;
vendor: 3,556 bytes, lines 33986-34093
33986 var iFirstSave = context.iCurr - 3; 33987 var pos = (i - iFirstSave) % 4; 33988 33989 switch (pos) { 33990 case 0: 33991 return fnArray[i] === _util.OPS.save; 33992 33993 case 1: 33994 return fnArray[i] === _util.OPS.transform; 33995 33996 case 2: 33997 return fnArray[i] === _util.OPS.paintInlineImageXObject; 33998 33999 case 3: 34000 return fnArray[i] === _util.OPS.restore; 34001 } 34002 34003 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 34004 }, function foundInlineImageGroup(context, i) { 34005 var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 34006 var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 34007 var MAX_WIDTH = 1000; 34008 var IMAGE_PADDING = 1; 34009 var fnArray = context.fnArray, 34010 argsArray = context.argsArray; 34011 var curr = context.iCurr; 34012 var iFirstSave = curr - 3; 34013 var iFirstTransform = curr - 2; 34014 var iFirstPIIXO = curr - 1; 34015 var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 34016 34017 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 34018 return i - (i - iFirstSave) % 4; 34019 } 34020 34021 var maxX = 0; 34022 var map = [], 34023 maxLineHeight = 0; 34024 var currentX = IMAGE_PADDING, 34025 currentY = IMAGE_PADDING; 34026 var q; 34027 34028 for (q = 0; q < count; q++) { 34029 var transform = argsArray[iFirstTransform + (q << 2)]; 34030 var img = argsArray[iFirstPIIXO + (q << 2)][0]; 34031 34032 if (currentX + img.width > MAX_WIDTH) { 34033 maxX = Math.max(maxX, currentX); 34034 currentY += maxLineHeight + 2 * IMAGE_PADDING; 34035 currentX = 0; 34036 maxLineHeight = 0; 34037 } 34038 34039 map.push({ 34040 transform, 34041 x: currentX, 34042 y: currentY, 34043 w: img.width, 34044 h: img.height 34045 }); 34046 currentX += img.width + 2 * IMAGE_PADDING; 34047 maxLineHeight = Math.max(maxLineHeight, img.height); 34048 } 34049 34050 var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 34051 var imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 34052 var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4); 34053 var imgRowSize = imgWidth << 2; 34054 34055 for (q = 0; q < count; q++) { 34056 var data = argsArray[iFirstPIIXO + (q << 2)][0].data; 34057 var rowSize = map[q].w << 2; 34058 var dataOffset = 0; 34059 var offset = map[q].x + map[q].y * imgWidth << 2; 34060 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 34061 34062 for (var k = 0, kk = map[q].h; k < kk; k++) { 34063 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 34064 dataOffset += rowSize; 34065 offset += imgRowSize; 34066 } 34067 34068 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 34069 34070 while (offset >= 0) { 34071 data[offset - 4] = data[offset]; 34072 data[offset - 3] = data[offset + 1]; 34073 data[offset - 2] = data[offset + 2]; 34074 data[offset - 1] = data[offset + 3]; 34075 data[offset + rowSize] = data[offset + rowSize - 4]; 34076 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 34077 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 34078 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 34079 offset -= imgRowSize; 34080 } 34081 } 34082 34083 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); 34084 argsArray.splice(iFirstSave, count * 4, [{ 34085 width: imgWidth, 34086 height: imgHeight, 34087 kind: _util.ImageKind.RGBA_32BPP, 34088 data: imgData 34089 }, map]); 34090 return iFirstSave + 1; 34091 }); 34092 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) { 34093 var fnArray = context.fnArray;
34094 var iFirstSave = context.iCurr - 3; 34095 var pos = (i - iFirstSave) % 4; 34096 34097 switch (pos) { 34098 case 0: 34099 return fnArray[i] === _util.OPS.save; 34100 34101 case 1: 34102 return fnArray[i] === _util.OPS.transform; 34103 34104 case 2: 34105 return fnArray[i] === _util.OPS.paintImageMaskXObject; 34106 34107 case 3: 34108 return fnArray[i] === _util.OPS.restore; 34109 } 34110 34111 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 34112 }, function foundImageMaskGroup(context, i) { 34113 var MIN_IMAGES_IN_MASKS_BLOCK = 10; 34114 var MAX_IMAGES_IN_MASKS_BLOCK = 100; 34115 var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 34116 var fnArray = context.fnArray, 34117 argsArray = context.argsArray; 34118 var curr = context.iCurr; 34119 var iFirstSave = curr - 3; 34120 var iFirstTransform = curr - 2; 34121 var iFirstPIMXO = curr - 1; 34122 var count = Math.floor((i - iFirstSave) / 4); 34123 count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray); 34124 34125 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 34126 return i - (i - iFirstSave) % 4; 34127 } 34128 34129 var q; 34130 var isSameImage = false; 34131 var iTransform, transformArgs; 34132 var firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 34133 34134 if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) { 34135 isSameImage = true; 34136 var firstTransformArg0 = argsArray[iFirstTransform][0]; 34137 var firstTransformArg3 = argsArray[iFirstTransform][3]; 34138 iTransform = iFirstTransform + 4; 34139 var iPIMXO = iFirstPIMXO + 4; 34140 34141 for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 34142 transformArgs = argsArray[iTransform]; 34143 34144 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) { 34145 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 34146 isSameImage = false; 34147 } else { 34148 count = q; 34149 } 34150 34151 break; 34152 } 34153 } 34154 } 34155 34156 if (isSameImage) { 34157 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 34158 var positions = new Float32Array(count * 2); 34159 iTransform = iFirstTransform; 34160 34161 for (q = 0; q < count; q++, iTransform += 4) { 34162 transformArgs = argsArray[iTransform]; 34163 positions[q << 1] = transformArgs[4]; 34164 positions[(q << 1) + 1] = transformArgs[5]; 34165 } 34166 34167 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); 34168 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]); 34169 } else { 34170 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 34171 var images = []; 34172 34173 for (q = 0; q < count; q++) { 34174 transformArgs = argsArray[iFirstTransform + (q << 2)]; 34175 var maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 34176 images.push({ 34177 data: maskParams.data, 34178 width: maskParams.width, 34179 height: maskParams.height, 34180 transform: transformArgs 34181 }); 34182 } 34183 34184 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); 34185 argsArray.splice(iFirstSave, count * 4, [images]); 34186 } 34187 34188 return iFirstSave + 1; 34189 }); 34190 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { 34191 var argsArray = context.argsArray;
34192 var iFirstTransform = context.iCurr - 2; 34193 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 34194 }, function iterateImageGroup(context, i) { 34195 var fnArray = context.fnArray, 34196 argsArray = context.argsArray; 34197 var iFirstSave = context.iCurr - 3; 34198 var pos = (i - iFirstSave) % 4; 34199 34200 switch (pos) { 34201 case 0: 34202 return fnArray[i] === _util.OPS.save; 34203 34204 case 1: 34205 if (fnArray[i] !== _util.OPS.transform) { 34206 return false; 34207 } 34208 34209 var iFirstTransform = context.iCurr - 2; 34210 var firstTransformArg0 = argsArray[iFirstTransform][0]; 34211 var firstTransformArg3 = argsArray[iFirstTransform][3]; 34212 34213 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 34214 return false; 34215 } 34216 34217 return true; 34218 34219 case 2: 34220 if (fnArray[i] !== _util.OPS.paintImageXObject) { 34221 return false; 34222 } 34223 34224 var iFirstPIXO = context.iCurr - 1; 34225 var firstPIXOArg0 = argsArray[iFirstPIXO][0]; 34226 34227 if (argsArray[i][0] !== firstPIXOArg0) { 34228 return false; 34229 } 34230 34231 return true; 34232 34233 case 3: 34234 return fnArray[i] === _util.OPS.restore; 34235 } 34236 34237 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 34238 }, function (context, i) { 34239 var MIN_IMAGES_IN_BLOCK = 3; 34240 var MAX_IMAGES_IN_BLOCK = 1000; 34241 var fnArray = context.fnArray, 34242 argsArray = context.argsArray; 34243 var curr = context.iCurr; 34244 var iFirstSave = curr - 3; 34245 var iFirstTransform = curr - 2; 34246 var iFirstPIXO = curr - 1; 34247 var firstPIXOArg0 = argsArray[iFirstPIXO][0]; 34248 var firstTransformArg0 = argsArray[iFirstTransform][0]; 34249 var firstTransformArg3 = argsArray[iFirstTransform][3]; 34250 var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 34251 34252 if (count < MIN_IMAGES_IN_BLOCK) { 34253 return i - (i - iFirstSave) % 4; 34254 } 34255 34256 var positions = new Float32Array(count * 2); 34257 var iTransform = iFirstTransform; 34258 34259 for (var q = 0; q < count; q++, iTransform += 4) { 34260 var transformArgs = argsArray[iTransform]; 34261 positions[q << 1] = transformArgs[4]; 34262 positions[(q << 1) + 1] = transformArgs[5]; 34263 } 34264 34265 var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 34266 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); 34267 argsArray.splice(iFirstSave, count * 4, args); 34268 return iFirstSave + 1; 34269 }); 34270 addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { 34271 var fnArray = context.fnArray, 34272 argsArray = context.argsArray;
34273 var iFirstSave = context.iCurr - 4; 34274 var pos = (i - iFirstSave) % 5; 34275 34276 switch (pos) { 34277 case 0: 34278 return fnArray[i] === _util.OPS.beginText; 34279 34280 case 1: 34281 return fnArray[i] === _util.OPS.setFont; 34282 34283 case 2: 34284 return fnArray[i] === _util.OPS.setTextMatrix; 34285 34286 case 3: 34287 if (fnArray[i] !== _util.OPS.showText) { 34288 return false; 34289 } 34290 34291 var iFirstSetFont = context.iCurr - 3; 34292 var firstSetFontArg0 = argsArray[iFirstSetFont][0]; 34293 var firstSetFontArg1 = argsArray[iFirstSetFont][1]; 34294 34295 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 34296 return false; 34297 } 34298 34299 return true; 34300 34301 case 4: 34302 return fnArray[i] === _util.OPS.endText; 34303 } 34304 34305 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 34306 }, function (context, i) { 34307 var MIN_CHARS_IN_BLOCK = 3; 34308 var MAX_CHARS_IN_BLOCK = 1000; 34309 var fnArray = context.fnArray, 34310 argsArray = context.argsArray; 34311 var curr = context.iCurr; 34312 var iFirstBeginText = curr - 4; 34313 var iFirstSetFont = curr - 3; 34314 var iFirstSetTextMatrix = curr - 2; 34315 var iFirstShowText = curr - 1; 34316 var iFirstEndText = curr; 34317 var firstSetFontArg0 = argsArray[iFirstSetFont][0]; 34318 var firstSetFontArg1 = argsArray[iFirstSetFont][1]; 34319 var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 34320 34321 if (count < MIN_CHARS_IN_BLOCK) { 34322 return i - (i - iFirstBeginText) % 5; 34323 } 34324 34325 var iFirst = iFirstBeginText; 34326 34327 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) { 34328 count++; 34329 iFirst -= 5; 34330 } 34331 34332 var iEndText = iFirst + 4; 34333 34334 for (var q = 1; q < count; q++) { 34335 fnArray.splice(iEndText, 3); 34336 argsArray.splice(iEndText, 3); 34337 iEndText += 2; 34338 } 34339 34340 return iEndText + 1; 34341 }); 34342 34343 function QueueOptimizer(queue) { 34344 this.queue = queue; 34345 this.state = null; 34346 this.context = { 34347 iCurr: 0, 34348 fnArray: queue.fnArray, 34349 argsArray: queue.argsArray 34350 }; 34351 this.match = null; 34352 this.lastProcessed = 0; 34353 } 34354 34355 QueueOptimizer.prototype = { 34356 _optimize() { 34357 const fnArray = this.queue.fnArray; 34358 let i = this.lastProcessed, 34359 ii = fnArray.length; 34360 let state = this.state; 34361 let match = this.match; 34362 34363 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 34364 this.lastProcessed = ii; 34365 return; 34366 } 34367 34368 const context = this.context; 34369 34370 while (i < ii) { 34371 if (match) { 34372 const iterate = (0, match.iterateFn)(context, i); 34373 34374 if (iterate) { 34375 i++; 34376 continue; 34377 } 34378 34379 i = (0, match.processFn)(context, i + 1); 34380 ii = fnArray.length; 34381 match = null; 34382 state = null; 34383 34384 if (i >= ii) { 34385 break; 34386 } 34387 } 34388 34389 state = (state || InitialState)[fnArray[i]]; 34390 34391 if (!state || Array.isArray(state)) { 34392 i++; 34393 continue; 34394 } 34395 34396 context.iCurr = i; 34397 i++; 34398 34399 if (state.checkFn && !(0, state.checkFn)(context)) { 34400 state = null; 34401 continue; 34402 } 34403 34404 match = state; 34405 state = null; 34406 } 34407 34408 this.state = state; 34409 this.match = match; 34410 this.lastProcessed = i; 34411 }, 34412 34413 push(fn, args) { 34414 this.queue.fnArray.push(fn); 34415 this.queue.argsArray.push(args); 34416 34417 this._optimize(); 34418 }, 34419 34420 flush() { 34421 while (this.match) { 34422 const length = this.queue.fnArray.length; 34423 this.lastProcessed = (0, this.match.processFn)(this.context, length); 34424 this.match = null; 34425 this.state = null; 34426 34427 this._optimize(); 34428 } 34429 }, 34430 34431 reset() { 34432 this.state = null; 34433 this.match = null; 34434 this.lastProcessed = 0; 34435 } 34436 34437 }; 34438 return QueueOptimizer; 34439}(); 34440 34441var NullOptimizer = function NullOptimizerClosure() { 34442 function NullOptimizer(queue) { 34443 this.queue = queue; 34444 } 34445 34446 NullOptimizer.prototype = { 34447 push(fn, args) { 34448 this.queue.fnArray.push(fn); 34449 this.queue.argsArray.push(args); 34450 }, 34451 34452 flush() {}, 34453 34454 reset() {} 34455 34456 }; 34457 return NullOptimizer; 34458}(); 34459 34460var OperatorList = function OperatorListClosure() { 34461 var CHUNK_SIZE = 1000; 34462 var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; 34463 34464 function OperatorList(intent, streamSink, pageIndex) { 34465 this._streamSink = streamSink; 34466 this.fnArray = []; 34467 this.argsArray = []; 34468 34469 if (streamSink && intent !== "oplist") { 34470 this.optimizer = new QueueOptimizer(this); 34471 } else { 34472 this.optimizer = new NullOptimizer(this); 34473 } 34474 34475 this.dependencies = Object.create(null); 34476 this._totalLength = 0; 34477 this.pageIndex = pageIndex; 34478 this.intent = intent; 34479 this.weight = 0; 34480 this._resolved = streamSink ? null : Promise.resolve(); 34481 } 34482 34483 OperatorList.prototype = { 34484 get length() { 34485 return this.argsArray.length; 34486 }, 34487 34488 get ready() { 34489 return this._resolved || this._streamSink.ready; 34490 }, 34491 34492 get totalLength() { 34493 return this._totalLength + this.length; 34494 }, 34495 34496 addOp(fn, args) { 34497 this.optimizer.push(fn, args); 34498 this.weight++; 34499 34500 if (this._streamSink) { 34501 if (this.weight >= CHUNK_SIZE) { 34502 this.flush(); 34503 } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { 34504 this.flush(); 34505 } 34506 } 34507 }, 34508 34509 addDependency(dependency) { 34510 if (dependency in this.dependencies) { 34511 return; 34512 } 34513 34514 this.dependencies[dependency] = true;
34515 this.addOp(_util.OPS.dependency, [dependency]); 34516 }, 34517 34518 addDependencies(dependencies) { 34519 for (var key in dependencies) { 34520 this.addDependency(key); 34521 } 34522 }, 34523 34524 addOpList(opList) { 34525 if (!(opList instanceof OperatorList)) { 34526 (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.'); 34527 return; 34528 } 34529 34530 Object.assign(this.dependencies, opList.dependencies); 34531 34532 for (var i = 0, ii = opList.length; i < ii; i++) { 34533 this.addOp(opList.fnArray[i], opList.argsArray[i]); 34534 } 34535 }, 34536 34537 getIR() { 34538 return { 34539 fnArray: this.fnArray, 34540 argsArray: this.argsArray, 34541 length: this.length 34542 }; 34543 }, 34544 34545 get _transfers() { 34546 const transfers = []; 34547 const { 34548 fnArray, 34549 argsArray, 34550 length 34551 } = this; 34552 34553 for (let i = 0; i < length; i++) { 34554 switch (fnArray[i]) { 34555 case _util.OPS.paintInlineImageXObject: 34556 case _util.OPS.paintInlineImageXObjectGroup: 34557 case _util.OPS.paintImageMaskXObject: 34558 const arg = argsArray[i][0]; 34559 ; 34560 34561 if (!arg.cached) { 34562 transfers.push(arg.data.buffer); 34563 } 34564 34565 break; 34566 } 34567 } 34568 34569 return transfers; 34570 }, 34571 34572 flush(lastChunk = false) { 34573 this.optimizer.flush(); 34574 const length = this.length; 34575 this._totalLength += length; 34576 34577 this._streamSink.enqueue({ 34578 fnArray: this.fnArray, 34579 argsArray: this.argsArray, 34580 lastChunk, 34581 length 34582 }, 1, this._transfers); 34583 34584 this.dependencies = Object.create(null); 34585 this.fnArray.length = 0; 34586 this.argsArray.length = 0; 34587 this.weight = 0; 34588 this.optimizer.reset(); 34589 } 34590 34591 }; 34592 return OperatorList; 34593}(); 34594 34595exports.OperatorList = OperatorList; 34596 34597/***/ }), 34598/* 27 */ 34599/***/ (function(module, exports, __w_pdfjs_require__) { 34600 34601"use strict"; 34602 34603 34604Object.defineProperty(exports, "__esModule", { 34605 value: true 34606}); 34607exports.PartialEvaluator = void 0; 34608 34609var _util = __w_pdfjs_require__(2); 34610 34611var _cmap = __w_pdfjs_require__(28); 34612 34613var _primitives = __w_pdfjs_require__(5); 34614 34615var _fonts = __w_pdfjs_require__(29); 34616 34617var _encodings = __w_pdfjs_require__(32); 34618 34619var _core_utils = __w_pdfjs_require__(8); 34620 34621var _unicode = __w_pdfjs_require__(35); 34622 34623var _standard_fonts = __w_pdfjs_require__(34); 34624 34625var _pattern = __w_pdfjs_require__(38); 34626 34627var _parser = __w_pdfjs_require__(11); 34628 34629var _bidi = __w_pdfjs_require__(39); 34630 34631var _colorspace = __w_pdfjs_require__(23); 34632 34633var _stream = __w_pdfjs_require__(12); 34634 34635var _glyphlist = __w_pdfjs_require__(33); 34636 34637var _metrics = __w_pdfjs_require__(40); 34638 34639var _function = __w_pdfjs_require__(41); 34640 34641var _image_utils = __w_pdfjs_require__(24); 34642 34643var _murmurhash = __w_pdfjs_require__(43); 34644 34645var _operator_list = __w_pdfjs_require__(26); 34646 34647var _image = __w_pdfjs_require__(44); 34648 34649var PartialEvaluator = function PartialEvaluatorClosure() { 34650 const DefaultPartialEvaluatorOptions = { 34651 maxImageSize: -1, 34652 disableFontFace: false, 34653 ignoreErrors: false, 34654 isEvalSupported: true, 34655 fontExtraProperties: false 34656 }; 34657 34658 function PartialEvaluator({ 34659 xref, 34660 handler, 34661 pageIndex, 34662 idFactory, 34663 fontCache, 34664 builtInCMapCache, 34665 globalImageCache, 34666 options = null, 34667 pdfFunctionFactory 34668 }) { 34669 this.xref = xref; 34670 this.handler = handler; 34671 this.pageIndex = pageIndex; 34672 this.idFactory = idFactory; 34673 this.fontCache = fontCache; 34674 this.builtInCMapCache = builtInCMapCache; 34675 this.globalImageCache = globalImageCache; 34676 this.options = options || DefaultPartialEvaluatorOptions; 34677 this.pdfFunctionFactory = pdfFunctionFactory; 34678 this.parsingType3Font = false; 34679 34680 this.fetchBuiltInCMap = async name => { 34681 if (this.builtInCMapCache.has(name)) { 34682 return this.builtInCMapCache.get(name); 34683 } 34684 34685 const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", { 34686 name 34687 }); 34688 const reader = readableStream.getReader(); 34689 const data = await new Promise(function (resolve, reject) { 34690 function pump() { 34691 reader.read().then(function ({ 34692 value, 34693 done 34694 }) { 34695 if (done) { 34696 return; 34697 } 34698 34699 resolve(value); 34700 pump(); 34701 }, reject); 34702 } 34703 34704 pump(); 34705 }); 34706 34707 if (data.compressionType !== _util.CMapCompressionType.NONE) { 34708 this.builtInCMapCache.set(name, data); 34709 } 34710 34711 return data; 34712 }; 34713 } 34714 34715 var TIME_SLOT_DURATION_MS = 20; 34716 var CHECK_TIME_EVERY = 100; 34717 34718 function TimeSlotManager() { 34719 this.reset(); 34720 } 34721 34722 TimeSlotManager.prototype = { 34723 check: function TimeSlotManager_check() { 34724 if (++this.checked < CHECK_TIME_EVERY) { 34725 return false;
34726 } 34727 34728 this.checked = 0; 34729 return this.endTime <= Date.now(); 34730 }, 34731 reset: function TimeSlotManager_reset() { 34732 this.endTime = Date.now() + TIME_SLOT_DURATION_MS; 34733 this.checked = 0; 34734 } 34735 }; 34736 34737 function normalizeBlendMode(value, parsingArray = false) { 34738 if (Array.isArray(value)) { 34739 for (let i = 0, ii = value.length; i < ii; i++) { 34740 const maybeBM = normalizeBlendMode(value[i], true); 34741 34742 if (maybeBM) { 34743 return maybeBM; 34744 } 34745 } 34746 34747 (0, _util.warn)(`Unsupported blend mode Array: ${value}`); 34748 return "source-over"; 34749 } 34750 34751 if (!(0, _primitives.isName)(value)) { 34752 if (parsingArray) { 34753 return null; 34754 } 34755 34756 return "source-over"; 34757 } 34758 34759 switch (value.name) { 34760 case "Normal": 34761 case "Compatible": 34762 return "source-over"; 34763 34764 case "Multiply": 34765 return "multiply"; 34766 34767 case "Screen": 34768 return "screen"; 34769 34770 case "Overlay": 34771 return "overlay"; 34772 34773 case "Darken": 34774 return "darken"; 34775 34776 case "Lighten": 34777 return "lighten"; 34778 34779 case "ColorDodge": 34780 return "color-dodge"; 34781 34782 case "ColorBurn": 34783 return "color-burn"; 34784 34785 case "HardLight": 34786 return "hard-light"; 34787 34788 case "SoftLight": 34789 return "soft-light"; 34790 34791 case "Difference": 34792 return "difference"; 34793 34794 case "Exclusion": 34795 return "exclusion"; 34796 34797 case "Hue": 34798 return "hue"; 34799 34800 case "Saturation": 34801 return "saturation"; 34802 34803 case "Color": 34804 return "color"; 34805 34806 case "Luminosity": 34807 return "luminosity"; 34808 } 34809 34810 if (parsingArray) { 34811 return null; 34812 } 34813 34814 (0, _util.warn)(`Unsupported blend mode: ${value.name}`); 34815 return "source-over"; 34816 } 34817 34818 var deferred = Promise.resolve(); 34819 var TILING_PATTERN = 1, 34820 SHADING_PATTERN = 2; 34821 PartialEvaluator.prototype = { 34822 clone(newOptions = DefaultPartialEvaluatorOptions) { 34823 var newEvaluator = Object.create(this); 34824 newEvaluator.options = newOptions; 34825 return newEvaluator; 34826 }, 34827 34828 hasBlendModes: function PartialEvaluator_hasBlendModes(resources) { 34829 if (!(resources instanceof _primitives.Dict)) { 34830 return false; 34831 } 34832 34833 var processed = Object.create(null); 34834 34835 if (resources.objId) { 34836 processed[resources.objId] = true; 34837 } 34838 34839 var nodes = [resources], 34840 xref = this.xref; 34841 34842 while (nodes.length) { 34843 var node = nodes.shift();
34844 var graphicStates = node.get("ExtGState"); 34845 34846 if (graphicStates instanceof _primitives.Dict) { 34847 var graphicStatesKeys = graphicStates.getKeys(); 34848 34849 for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) { 34850 const key = graphicStatesKeys[i]; 34851 let graphicState = graphicStates.getRaw(key); 34852 34853 if (graphicState instanceof _primitives.Ref) { 34854 if (processed[graphicState.toString()]) { 34855 continue; 34856 } 34857 34858 try { 34859 graphicState = xref.fetch(graphicState); 34860 } catch (ex) { 34861 if (ex instanceof _core_utils.MissingDataException) { 34862 throw ex; 34863 } 34864 34865 if (this.options.ignoreErrors) { 34866 if (graphicState instanceof _primitives.Ref) { 34867 processed[graphicState.toString()] = true; 34868 } 34869 34870 this.handler.send("UnsupportedFeature", { 34871 featureId: _util.UNSUPPORTED_FEATURES.errorExtGState 34872 }); 34873 (0, _util.warn)(`hasBlendModes - ignoring ExtGState: "${ex}".`); 34874 continue; 34875 } 34876 34877 throw ex; 34878 } 34879 } 34880 34881 if (!(graphicState instanceof _primitives.Dict)) { 34882 continue; 34883 } 34884 34885 if (graphicState.objId) { 34886 processed[graphicState.objId] = true; 34887 } 34888 34889 const bm = graphicState.get("BM"); 34890 34891 if (bm instanceof _primitives.Name) { 34892 if (bm.name !== "Normal") { 34893 return true; 34894 } 34895 34896 continue; 34897 } 34898 34899 if (bm !== undefined && Array.isArray(bm)) { 34900 for (let j = 0, jj = bm.length; j < jj; j++) { 34901 if (bm[j] instanceof _primitives.Name && bm[j].name !== "Normal") { 34902 return true; 34903 } 34904 } 34905 } 34906 } 34907 } 34908 34909 var xObjects = node.get("XObject"); 34910 34911 if (!(xObjects instanceof _primitives.Dict)) { 34912 continue; 34913 } 34914 34915 var xObjectsKeys = xObjects.getKeys(); 34916 34917 for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) { 34918 const key = xObjectsKeys[i]; 34919 var xObject = xObjects.getRaw(key); 34920 34921 if (xObject instanceof _primitives.Ref) { 34922 if (processed[xObject.toString()]) { 34923 continue; 34924 } 34925 34926 try { 34927 xObject = xref.fetch(xObject); 34928 } catch (ex) { 34929 if (ex instanceof _core_utils.MissingDataException) { 34930 throw ex; 34931 } 34932 34933 if (this.options.ignoreErrors) { 34934 if (xObject instanceof _primitives.Ref) { 34935 processed[xObject.toString()] = true; 34936 } 34937 34938 this.handler.send("UnsupportedFeature", { 34939 featureId: _util.UNSUPPORTED_FEATURES.errorXObject 34940 }); 34941 (0, _util.warn)(`hasBlendModes - ignoring XObject: "${ex}".`); 34942 continue; 34943 } 34944 34945 throw ex; 34946 } 34947 } 34948 34949 if (!(0, _primitives.isStream)(xObject)) { 34950 continue; 34951 } 34952 34953 if (xObject.dict.objId) { 34954 if (processed[xObject.dict.objId]) { 34955 continue; 34956 } 34957 34958 processed[xObject.dict.objId] = true; 34959 } 34960 34961 var xResources = xObject.dict.get("Resources"); 34962 34963 if (xResources instanceof _primitives.Dict && (!xResources.objId || !processed[xResources.objId])) { 34964 nodes.push(xResources); 34965 34966 if (xResources.objId) { 34967 processed[xResources.objId] = true; 34968 } 34969 } 34970 } 34971 } 34972 34973 return false; 34974 }, 34975 34976 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) { 34977 var dict = xobj.dict; 34978 var matrix = dict.getArray("Matrix"); 34979 var bbox = dict.getArray("BBox"); 34980 34981 if (Array.isArray(bbox) && bbox.length === 4) { 34982 bbox = _util.Util.normalizeRect(bbox); 34983 } else { 34984 bbox = null; 34985 } 34986 34987 var group = dict.get("Group"); 34988 34989 if (group) { 34990 var groupOptions = { 34991 matrix, 34992 bbox, 34993 smask, 34994 isolated: false, 34995 knockout: false 34996 }; 34997 var groupSubtype = group.get("S"); 34998 var colorSpace = null; 34999 35000 if ((0, _primitives.isName)(groupSubtype, "Transparency")) { 35001 groupOptions.isolated = group.get("I") || false; 35002 groupOptions.knockout = group.get("K") || false; 35003 35004 if (group.has("CS")) { 35005 colorSpace = await this.parseColorSpace({ 35006 cs: group.get("CS"), 35007 resources 35008 }); 35009 } 35010 } 35011 35012 if (smask && smask.backdrop) { 35013 colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb; 35014 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 35015 } 35016 35017 operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); 35018 } 35019 35020 operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]); 35021 return this.getOperatorList({ 35022 stream: xobj, 35023 task, 35024 resources: dict.get("Resources") || resources, 35025 operatorList, 35026 initialState 35027 }).then(function () { 35028 operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); 35029 35030 if (group) { 35031 operatorList.addOp(_util.OPS.endGroup, [groupOptions]); 35032 } 35033 }); 35034 }, 35035 35036 async buildPaintImageXObject({ 35037 resources, 35038 image, 35039 isInline = false, 35040 operatorList, 35041 cacheKey, 35042 localImageCache 35043 }) { 35044 var dict = image.dict; 35045 const imageRef = dict.objId; 35046 var w = dict.get("Width", "W"); 35047 var h = dict.get("Height", "H"); 35048 35049 if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { 35050 (0, _util.warn)("Image dimensions are missing, or not numbers."); 35051 return undefined; 35052 } 35053 35054 var maxImageSize = this.options.maxImageSize; 35055 35056 if (maxImageSize !== -1 && w * h > maxImageSize) { 35057 (0, _util.warn)("Image exceeded maximum allowed size and was removed."); 35058 return undefined; 35059 } 35060 35061 var imageMask = dict.get("ImageMask", "IM") || false; 35062 var imgData, args; 35063 35064 if (imageMask) { 35065 var width = dict.get("Width", "W"); 35066 var height = dict.get("Height", "H"); 35067 var bitStrideLength = width + 7 >> 3; 35068 var imgArray = image.getBytes(bitStrideLength * height, true); 35069 var decode = dict.getArray("Decode", "D"); 35070 imgData = _image.PDFImage.createMask({ 35071 imgArray, 35072 width, 35073 height,
35074 imageIsFromDecodeStream: image instanceof _stream.DecodeStream, 35075 inverseDecode: !!decode && decode[0] > 0 35076 }); 35077 imgData.cached = !!cacheKey; 35078 args = [imgData]; 35079 operatorList.addOp(_util.OPS.paintImageMaskXObject, args); 35080 35081 if (cacheKey) { 35082 localImageCache.set(cacheKey, imageRef, { 35083 fn: _util.OPS.paintImageMaskXObject, 35084 args 35085 }); 35086 } 35087 35088 return undefined; 35089 } 35090 35091 var softMask = dict.get("SMask", "SM") || false; 35092 var mask = dict.get("Mask") || false; 35093 var SMALL_IMAGE_DIMENSIONS = 200; 35094 35095 if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) { 35096 const imageObj = new _image.PDFImage({ 35097 xref: this.xref, 35098 res: resources, 35099 image, 35100 isInline, 35101 pdfFunctionFactory: this.pdfFunctionFactory 35102 }); 35103 imgData = imageObj.createImageData(true); 35104 operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); 35105 return undefined; 35106 } 35107 35108 let objId = `img_${this.idFactory.createObjId()}`, 35109 cacheGlobally = false; 35110 35111 if (this.parsingType3Font) { 35112 objId = `${this.idFactory.getDocId()}_type3res_${objId}`; 35113 } else if (imageRef) { 35114 cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex); 35115 35116 if (cacheGlobally) { 35117 objId = `${this.idFactory.getDocId()}_${objId}`; 35118 } 35119 } 35120 35121 operatorList.addDependency(objId); 35122 args = [objId, w, h]; 35123 35124 const imgPromise = _image.PDFImage.buildImage({ 35125 xref: this.xref, 35126 res: resources, 35127 image, 35128 isInline, 35129 pdfFunctionFactory: this.pdfFunctionFactory 35130 }).then(imageObj => { 35131 imgData = imageObj.createImageData(false); 35132 35133 if (this.parsingType3Font) { 35134 return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]); 35135 } else if (cacheGlobally) { 35136 this.handler.send("commonobj", [objId, "Image", imgData], [imgData.data.buffer]); 35137 return undefined; 35138 } 35139 35140 this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], [imgData.data.buffer]); 35141 return undefined; 35142 }).catch(reason => { 35143 (0, _util.warn)("Unable to decode image: " + reason); 35144 35145 if (this.parsingType3Font) { 35146 return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]); 35147 } else if (cacheGlobally) { 35148 this.handler.send("commonobj", [objId, "Image", null]); 35149 return undefined; 35150 } 35151 35152 this.handler.send("obj", [objId, this.pageIndex, "Image", null]); 35153 return undefined; 35154 }); 35155 35156 if (this.parsingType3Font) { 35157 await imgPromise; 35158 } 35159 35160 operatorList.addOp(_util.OPS.paintImageXObject, args); 35161 35162 if (cacheKey) { 35163 localImageCache.set(cacheKey, imageRef, { 35164 fn: _util.OPS.paintImageXObject, 35165 args 35166 }); 35167 35168 if (imageRef) { 35169 (0, _util.assert)(!isInline, "Cannot cache an inline image globally."); 35170 this.globalImageCache.addPageIndex(imageRef, this.pageIndex); 35171 35172 if (cacheGlobally) { 35173 this.globalImageCache.setData(imageRef, { 35174 objId, 35175 fn: _util.OPS.paintImageXObject, 35176 args 35177 }); 35178 } 35179 } 35180 } 35181 35182 return undefined; 35183 }, 35184 35185 handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { 35186 var smaskContent = smask.get("G"); 35187 var smaskOptions = { 35188 subtype: smask.get("S").name, 35189 backdrop: smask.get("BC") 35190 }; 35191 var transferObj = smask.get("TR"); 35192 35193 if ((0, _function.isPDFFunction)(transferObj)) { 35194 const transferFn = this.pdfFunctionFactory.create(transferObj); 35195 var transferMap = new Uint8Array(256); 35196 var tmp = new Float32Array(1); 35197 35198 for (var i = 0; i < 256; i++) { 35199 tmp[0] = i / 255; 35200 transferFn(tmp, 0, tmp, 0); 35201 transferMap[i] = tmp[0] * 255 | 0; 35202 } 35203 35204 smaskOptions.transferMap = transferMap; 35205 } 35206 35207 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone()); 35208 }, 35209 35210 handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) { 35211 const tilingOpList = new _operator_list.OperatorList(); 35212 const resourcesArray = [patternDict.get("Resources"), resources]; 35213 35214 const patternResources = _primitives.Dict.merge(this.xref, resourcesArray); 35215 35216 return this.getOperatorList({ 35217 stream: pattern, 35218 task,
35219 resources: patternResources, 35220 operatorList: tilingOpList 35221 }).then(function () { 35222 return (0, _pattern.getTilingPatternIR)({ 35223 fnArray: tilingOpList.fnArray, 35224 argsArray: tilingOpList.argsArray 35225 }, patternDict, args); 35226 }).then(function (tilingPatternIR) { 35227 operatorList.addDependencies(tilingOpList.dependencies); 35228 operatorList.addOp(fn, tilingPatternIR); 35229 }, reason => { 35230 if (reason instanceof _util.AbortException) { 35231 return; 35232 } 35233 35234 if (this.options.ignoreErrors) { 35235 this.handler.send("UnsupportedFeature", { 35236 featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern 35237 }); 35238 (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`); 35239 return; 35240 } 35241 35242 throw reason; 35243 }); 35244 }, 35245 35246 handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) { 35247 var fontName; 35248 35249 if (fontArgs) { 35250 fontArgs = fontArgs.slice(); 35251 fontName = fontArgs[0].name; 35252 } 35253 35254 return this.loadFont(fontName, fontRef, resources).then(translated => { 35255 if (!translated.font.isType3Font) { 35256 return translated; 35257 } 35258 35259 return translated.loadType3Data(this, resources, operatorList, task).then(function () { 35260 return translated; 35261 }).catch(reason => { 35262 this.handler.send("UnsupportedFeature", { 35263 featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3 35264 }); 35265 return new TranslatedFont({ 35266 loadedName: "g_font_error", 35267 font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`), 35268 dict: translated.font, 35269 extraProperties: this.options.fontExtraProperties 35270 }); 35271 }); 35272 }).then(translated => { 35273 state.font = translated.font; 35274 translated.send(this.handler); 35275 return translated.loadedName; 35276 }); 35277 }, 35278
35279 handleText(chars, state) { 35280 const font = state.font; 35281 const glyphs = font.charsToGlyphs(chars); 35282 35283 if (font.data) { 35284 const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 35285 35286 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) { 35287 PartialEvaluator.buildFontPaths(font, glyphs, this.handler); 35288 } 35289 } 35290 35291 return glyphs; 35292 }, 35293 35294 ensureStateFont(state) { 35295 if (state.font) { 35296 return; 35297 } 35298 35299 const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator."); 35300 35301 if (this.options.ignoreErrors) { 35302 this.handler.send("UnsupportedFeature", { 35303 featureId: _util.UNSUPPORTED_FEATURES.errorFontState 35304 }); 35305 (0, _util.warn)(`ensureStateFont: "${reason}".`); 35306 return; 35307 } 35308 35309 throw reason; 35310 }, 35311 35312 setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) { 35313 var gStateObj = []; 35314 var gStateKeys = gState.getKeys(); 35315 var promise = Promise.resolve(); 35316 35317 for (var i = 0, ii = gStateKeys.length; i < ii; i++) { 35318 const key = gStateKeys[i]; 35319 const value = gState.get(key); 35320 35321 switch (key) { 35322 case "Type": 35323 break; 35324 35325 case "LW": 35326 case "LC": 35327 case "LJ": 35328 case "ML": 35329 case "D": 35330 case "RI": 35331 case "FL": 35332 case "CA": 35333 case "ca": 35334 gStateObj.push([key, value]); 35335 break; 35336 35337 case "Font": 35338 promise = promise.then(() => { 35339 return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 35340 operatorList.addDependency(loadedName); 35341 gStateObj.push([key, [loadedName, value[1]]]); 35342 }); 35343 }); 35344 break; 35345 35346 case "BM": 35347 gStateObj.push([key, normalizeBlendMode(value)]); 35348 break; 35349 35350 case "SMask": 35351 if ((0, _primitives.isName)(value, "None")) { 35352 gStateObj.push([key, false]); 35353 break; 35354 } 35355 35356 if ((0, _primitives.isDict)(value)) { 35357 promise = promise.then(() => { 35358 return this.handleSMask(value, resources, operatorList, task, stateManager); 35359 }); 35360 gStateObj.push([key, true]); 35361 } else { 35362 (0, _util.warn)("Unsupported SMask type"); 35363 } 35364 35365 break; 35366 35367 case "OP": 35368 case "op": 35369 case "OPM": 35370 case "BG": 35371 case "BG2": 35372 case "UCR": 35373 case "UCR2": 35374 case "TR": 35375 case "TR2": 35376 case "HT": 35377 case "SM": 35378 case "SA": 35379 case "AIS": 35380 case "TK": 35381 (0, _util.info)("graphic state operator " + key); 35382 break; 35383 35384 default: 35385 (0, _util.info)("Unknown graphic state operator " + key); 35386 break; 35387 } 35388 } 35389 35390 return promise.then(function () { 35391 if (gStateObj.length > 0) { 35392 operatorList.addOp(_util.OPS.setGState, [gStateObj]); 35393 } 35394 }); 35395 }, 35396 loadFont: function PartialEvaluator_loadFont(fontName, font, resources) { 35397 const errorFont = () => { 35398 return Promise.resolve(new TranslatedFont({ 35399 loadedName: "g_font_error", 35400 font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`), 35401 dict: font, 35402 extraProperties: this.options.fontExtraProperties 35403 })); 35404 }; 35405 35406 var fontRef, 35407 xref = this.xref; 35408 35409 if (font) { 35410 if (!(0, _primitives.isRef)(font)) { 35411 throw new _util.FormatError('The "font" object should be a reference.'); 35412 } 35413 35414 fontRef = font; 35415 } else { 35416 var fontRes = resources.get("Font"); 35417 35418 if (fontRes) { 35419 fontRef = fontRes.getRaw(fontName); 35420 } 35421 } 35422 35423 if (!fontRef) { 35424 const partialMsg = `Font "${fontName || font && font.toString()}" is not available`; 35425 35426 if (!this.options.ignoreErrors && !this.parsingType3Font) { 35427 (0, _util.warn)(`${partialMsg}.`); 35428 return errorFont(); 35429 } 35430 35431 this.handler.send("UnsupportedFeature", { 35432 featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing 35433 }); 35434 (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`); 35435 fontRef = PartialEvaluator.getFallbackFontDict(); 35436 } 35437 35438 if (this.fontCache.has(fontRef)) { 35439 return this.fontCache.get(fontRef); 35440 } 35441 35442 font = xref.fetchIfRef(fontRef); 35443 35444 if (!(0, _primitives.isDict)(font)) { 35445 return errorFont(); 35446 } 35447 35448 if (font.translated) { 35449 return font.translated; 35450 } 35451 35452 var fontCapability = (0, _util.createPromiseCapability)(); 35453 var preEvaluatedFont = this.preEvaluateFont(font); 35454 const { 35455 descriptor, 35456 hash 35457 } = preEvaluatedFont; 35458 var fontRefIsRef = (0, _primitives.isRef)(fontRef), 35459 fontID; 35460 35461 if (fontRefIsRef) { 35462 fontID = fontRef.toString(); 35463 } 35464 35465 if (hash && (0, _primitives.isDict)(descriptor)) { 35466 if (!descriptor.fontAliases) { 35467 descriptor.fontAliases = Object.create(null); 35468 } 35469 35470 var fontAliases = descriptor.fontAliases; 35471 35472 if (fontAliases[hash]) { 35473 var aliasFontRef = fontAliases[hash].aliasRef; 35474 35475 if (fontRefIsRef && aliasFontRef && this.fontCache.has(ali
35475asFontRef)) { 35476 this.fontCache.putAlias(fontRef, aliasFontRef); 35477 return this.fontCache.get(fontRef); 35478 } 35479 } else { 35480 fontAliases[hash] = { 35481 fontID: _fonts.Font.getFontID() 35482 }; 35483 } 35484 35485 if (fontRefIsRef) { 35486 fontAliases[hash].aliasRef = fontRef; 35487 } 35488 35489 fontID = fontAliases[hash].fontID; 35490 } 35491 35492 if (fontRefIsRef) { 35493 this.fontCache.put(fontRef, fontCapability.promise); 35494 } else { 35495 if (!fontID) { 35496 fontID = this.idFactory.createObjId(); 35497 } 35498 35499 this.fontCache.put(`id_${fontID}`, fontCapability.promise); 35500 } 35501 35502 (0, _util.assert)(fontID, 'The "fontID" must be defined.'); 35503 font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`; 35504 font.translated = fontCapability.promise; 35505 var translatedPromise; 35506 35507 try { 35508 translatedPromise = this.translateFont(preEvaluatedFont); 35509 } catch (e) { 35510 translatedPromise = Promise.reject(e); 35511 } 35512 35513 translatedPromise.then(translatedFont => { 35514 if (translatedFont.fontType !== undefined) { 35515 var xrefFontStats = xref.stats.fontTypes; 35516 xrefFontStats[translatedFont.fontType] = true; 35517 } 35518 35519 fontCapability.resolve(new TranslatedFont({ 35520 loadedName: font.loadedName, 35521 font: translatedFont, 35522 dict: font, 35523 extraProperties: this.options.fontExtraProperties 35524 })); 35525 }).catch(reason => { 35526 this.handler.send("UnsupportedFeature", { 35527 featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate 35528 }); 35529 35530 try { 35531 var fontFile3 = descriptor && descriptor.get("FontFile3"); 35532 var subtype = fontFile3 && fontFile3.get("Subtype"); 35533 var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name); 35534 var xrefFontStats = xref.stats.fontTypes; 35535 xrefFontStats[fontType] = true; 35536 } catch (ex) {} 35537 35538 fontCapability.resolve(new TranslatedFont({ 35539 loadedName: font.loadedName, 35540 font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), 35541 dict: font, 35542 extraProperties: this.options.fontExtraProperties 35543 })); 35544 }); 35545 return fontCapability.promise; 35546 }, 35547 35548 buildPath(operatorList, fn, args, parsingText = false) { 35549 var lastIndex = operatorList.length - 1; 35550 35551 if (!args) { 35552 args = []; 35553 } 35554 35555 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { 35556 if (parsingText) { 35557 (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`); 35558 operatorList.addOp(_util.OPS.save, null); 35559 } 35560 35561 operatorList.addOp(_util.OPS.constructPath, [[fn], args]); 35562 35563 if (parsingText) { 35564 operatorList.addOp(_util.OPS.restore, null); 35565 } 35566 } else { 35567 var opArgs = operatorList.argsArray[lastIndex]; 35568 opArgs[0].push(fn); 35569 Array.prototype.push.apply(opArgs[1], args); 35570 } 35571 }, 35572 35573 parseColorSpace({ 35574 cs, 35575 resources 35576 }) { 35577 return new Promise(resolve => { 35578 resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory)); 35579 }).catch(reason => { 35580 if (reason instanceof _util.AbortException) { 35581 return null; 35582 } 35583 35584 if (this.options.ignoreErrors) { 35585 this.handler.send("UnsupportedFeature", { 35586 featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace 35587 }); 35588 (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`); 35589 return null; 35590 } 35591 35592 throw reason; 35593 }); 35594 }, 35595 35596 async handleColorN(operatorList, fn, args, cs, patterns, resources, task) { 35597 var patternName = args[args.length - 1]; 35598 var pattern; 35599 35600 if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) { 35601 var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; 35602 var typeNum = dict.get("PatternType"); 35603 35604 if (typeNum === TILING_PATTERN) { 35605 var color = cs.base ? cs.base.getRgb(args, 0) : null; 35606 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task); 35607 } else if (typeNum === SHADING_PATTERN) { 35608 var shading = dict.get("Shading"); 35609 var matrix = dict.getArray("Matrix"); 35610 pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory); 35611 operatorList.addOp(fn, pattern.getIR()); 35612 return undefined; 35613 } 35614 35615 throw new _util.FormatError(`Unknown PatternType: ${typeNum}`); 35616 } 35617 35618 throw new _util.FormatError(`Unknown PatternName: ${patternName}`); 35619 }, 35620 35621 getOperatorList({ 35622 stream, 35623 task, 35624 resources, 35625 operatorList, 35626 initialState = null 35627 }) { 35628 resources = resources || _primitives.Dict.empty; 35629 initialState = initialState || new EvalState(); 35630 35631 if (!operatorList) { 35632 throw new Error('getOperatorList: missing "operatorList" parameter'); 35633 } 35634 35635 var self = this; 35636 var xref = this.xref; 35637 let parsingText = false;
35638 const localImageCache = new _image_utils.LocalImageCache(); 35639 35640 var xobjs = resources.get("XObject") || _primitives.Dict.empty; 35641 35642 var patterns = resources.get("Pattern") || _primitives.Dict.empty; 35643 35644 var stateManager = new StateManager(initialState); 35645 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 35646 var timeSlotManager = new TimeSlotManager(); 35647 35648 function closePendingRestoreOPS(argument) { 35649 for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 35650 operatorList.addOp(_util.OPS.restore, []); 35651 } 35652 } 35653 35654 return new Promise(function promiseBody(resolve, reject) { 35655 const next = function (promise) { 35656 Promise.all([promise, operatorList.ready]).then(function () { 35657 try { 35658 promiseBody(resolve, reject); 35659 } catch (ex) { 35660 reject(ex); 35661 } 35662 }, reject); 35663 }; 35664 35665 task.ensureNotTerminated(); 35666 timeSlotManager.reset(); 35667 var stop, 35668 operation = {}, 35669 i, 35670 ii, 35671 cs; 35672 35673 while (!(stop = timeSlotManager.check())) { 35674 operation.args = null; 35675 35676 if (!preprocessor.read(operation)) { 35677 break; 35678 } 35679 35680 var args = operation.args; 35681 var fn = operation.fn; 35682 35683 switch (fn | 0) { 35684 case _util.OPS.paintXObject: 35685 var name = args[0].name; 35686 35687 if (name) { 35688 const localImage = localImageCache.getByName(name); 35689 35690 if (localImage) { 35691 operatorList.addOp(localImage.fn, localImage.args); 35692 args = null; 35693 continue; 35694 } 35695 } 35696 35697 next(new Promise(function (resolveXObject, rejectXObject) { 35698 if (!name) { 35699 throw new _util.FormatError("XObject must be referred to by name."); 35700 } 35701 35702 let xobj = xobjs.getRaw(name); 35703 35704 if (xobj instanceof _primitives.Ref) { 35705 const localImage = localImageCache.getByRef(xobj); 35706 35707 if (localImage) { 35708 operatorList.addOp(localImage.fn, localImage.args); 35709 resolveXObject(); 35710 return; 35711 } 35712 35713 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 35714 35715 if (globalImage) { 35716 operatorList.addDependency(globalImage.objId); 35717 operatorList.addOp(globalImage.fn, globalImage.args); 35718 resolveXObject(); 35719 return; 35720 } 35721 35722 xobj = xref.fetch(xobj); 35723 } 35724 35725 if (!xobj) { 35726 operatorList.addOp(fn, args); 35727 resolveXObject(); 35728 return; 35729 } 35730 35731 if (!(0, _primitives.isStream)(xobj)) { 35732 throw new _util.FormatError("XObject should be a stream"); 35733 } 35734 35735 const type = xobj.dict.get("Subtype"); 35736 35737 if (!(0, _primitives.isName)(type)) { 35738 throw new _util.FormatError("XObject should have a Name subtype"); 35739 } 35740 35741 if (type.name === "Form") { 35742 stateManager.save(); 35743 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () { 35744 stateManager.restore(); 35745 resolveXObject(); 35746 }, rejectXObject); 35747 return; 35748 } else if (type.name === "Image") { 35749 self.buildPaintImageXObject({ 35750 resources, 35751 image: xobj, 35752 operatorList, 35753 cacheKey: name, 35754 localImageCache 35755 }).then(resolveXObject, rejectXObject); 35756 return; 35757 } else if (type.name === "PS") { 35758 (0, _util.info)("Ignored XObject subtype PS"); 35759 } else { 35760 throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`); 35761 } 35762 35763 resolveXObject(); 35764 }).catch(function (reason) { 35765 if (reason instanceof _util.AbortException) { 35766 return; 35767 } 35768 35769 if (self.options.ignoreErrors) { 35770 self.handler.send("UnsupportedFeature", { 35771 featureId: _util.UNSUPPORTED_FEATURES.errorXObject 35772 }); 35773 (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`); 35774 return; 35775 } 35776 35777 throw reason; 35778 })); 35779 return; 35780 35781 case _util.OPS.setFont: 35782 var fontSize = args[1]; 35783 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) { 35784 operatorList.addDependency(loadedName); 35785 operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); 35786 })); 35787 return; 35788 35789 case _util.OPS.beginText: 35790 parsingText = true; 35791 break; 35792 35793 case _util.OPS.endText: 35794 parsingText = false;
35795 break; 35796 35797 case _util.OPS.endInlineImage: 35798 var cacheKey = args[0].cacheKey; 35799 35800 if (cacheKey) { 35801 const localImage = localImageCache.getByName(cacheKey); 35802 35803 if (localImage) { 35804 operatorList.addOp(localImage.fn, localImage.args); 35805 args = null; 35806 continue; 35807 } 35808 } 35809 35810 next(self.buildPaintImageXObject({ 35811 resources, 35812 image: args[0], 35813 isInline: true, 35814 operatorList, 35815 cacheKey, 35816 localImageCache 35817 })); 35818 return; 35819 35820 case _util.OPS.showText: 35821 if (!stateManager.state.font) { 35822 self.ensureStateFont(stateManager.state); 35823 continue; 35824 } 35825 35826 args[0] = self.handleText(args[0], stateManager.state); 35827 break; 35828 35829 case _util.OPS.showSpacedText: 35830 if (!stateManager.state.font) { 35831 self.ensureStateFont(stateManager.state); 35832 continue; 35833 } 35834 35835 var arr = args[0]; 35836 var combinedGlyphs = []; 35837 var arrLength = arr.length; 35838 var state = stateManager.state; 35839 35840 for (i = 0; i < arrLength; ++i) { 35841 var arrItem = arr[i]; 35842 35843 if ((0, _util.isString)(arrItem)) { 35844 Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); 35845 } else if ((0, _util.isNum)(arrItem)) { 35846 combinedGlyphs.push(arrItem); 35847 } 35848 } 35849 35850 args[0] = combinedGlyphs; 35851 fn = _util.OPS.showText; 35852 break; 35853 35854 case _util.OPS.nextLineShowText: 35855 if (!stateManager.state.font) { 35856 self.ensureStateFont(stateManager.state); 35857 continue; 35858 } 35859 35860 operatorList.addOp(_util.OPS.nextLine); 35861 args[0] = self.handleText(args[0], stateManager.state); 35862 fn = _util.OPS.showText; 35863 break; 35864 35865 case _util.OPS.nextLineSetSpacingShowText: 35866 if (!stateManager.state.font) { 35867 self.ensureStateFont(stateManager.state); 35868 continue; 35869 } 35870 35871 operatorList.addOp(_util.OPS.nextLine); 35872 operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); 35873 operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); 35874 args[0] = self.handleText(args[0], stateManager.state); 35875 fn = _util.OPS.showText; 35876 break; 35877 35878 case _util.OPS.setTextRenderingMode: 35879 stateManager.state.textRenderingMode = args[0]; 35880 break; 35881 35882 case _util.OPS.setFillColorSpace: 35883 next(self.parseColorSpace({ 35884 cs: args[0], 35885 resources 35886 }).then(function (colorSpace) { 35887 if (colorSpace) { 35888 stateManager.state.fillColorSpace = colorSpace; 35889 } 35890 })); 35891 return; 35892 35893 case _util.OPS.setStrokeColorSpace: 35894 next(self.parseColorSpace({ 35895 cs: args[0], 35896 resources 35897 }).then(function (colorSpace) { 35898 if (colorSpace) { 35899 stateManager.state.strokeColorSpace = colorSpace; 35900 } 35901 })); 35902 return; 35903 35904 case _util.OPS.setFillColor: 35905 cs = stateManager.state.fillColorSpace; 35906 args = cs.getRgb(args, 0); 35907 fn = _util.OPS.setFillRGBColor; 35908 break; 35909 35910 case _util.OPS.setStrokeColor: 35911 cs = stateManager.state.strokeColorSpace; 35912 args = cs.getRgb(args, 0); 35913 fn = _util.OPS.setStrokeRGBColor; 35914 break; 35915 35916 case _util.OPS.setFillGray: 35917 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 35918 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 35919 fn = _util.OPS.setFillRGBColor; 35920 break; 35921 35922 case _util.OPS.setStrokeGray: 35923 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 35924 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 35925 fn = _util.OPS.setStrokeRGBColor; 35926 break; 35927 35928 case _util.OPS.setFillCMYKColor: 35929 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; 35930 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 35931 fn = _util.OPS.setFillRGBColor; 35932 break; 35933 35934 case _util.OPS.setStrokeCMYKColor: 35935 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; 35936 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 35937 fn = _util.OPS.setStrokeRGBColor; 35938 break; 35939 35940 case _util.OPS.setFillRGBColor: 35941 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; 35942 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 35943 break; 35944 35945 case _util.OPS.setStrokeRGBColor: 35946 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; 35947 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 35948 break; 35949 35950 case _util.OPS.setFillColorN: 35951 cs = stateManager.state.fillColorSpace; 35952 35953 if (cs.name === "Pattern") { 35954 next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task)); 35955 return; 35956 } 35957 35958 args = cs.getRgb(args, 0); 35959 fn = _util.OPS.setFillRGBColor; 35960 break; 35961 35962 case _util.OPS.setStrokeColorN: 35963 cs = stateManager.state.strokeColorSpace; 35964 35965 if (cs.name === "Pattern") { 35966 next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task)); 35967 return; 35968 } 35969 35970 args = cs.getRgb(args, 0); 35971 fn = _util.OPS.setStrokeRGBColor; 35972 break; 35973 35974 case _util.OPS.shadingFill: 35975 var shadingRes = resources.get("Shading"); 35976 35977 if (!shadingRes) { 35978 throw new _util.FormatError("No shading resource found"); 35979 } 35980 35981 var shading = shadingRes.get(args[0].name); 35982 35983 if (!shading) { 35984 throw new _util.FormatError("No shading object found"); 35985 } 35986 35987 var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory); 35988 35989 var patternIR = shadingFill.getIR(); 35990 args = [patternIR]; 35991 fn = _util.OPS.shadingFill; 35992 break; 35993 35994 case _util.OPS.setGState: 35995 var dictName = args[0];
35996 var extGState = resources.get("ExtGState"); 35997 35998 if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) { 35999 break; 36000 } 36001 36002 var gState = extGState.get(dictName.name); 36003 next(self.setGState(resources, gState, operatorList, task, stateManager)); 36004 return; 36005 36006 case _util.OPS.moveTo: 36007 case _util.OPS.lineTo: 36008 case _util.OPS.curveTo: 36009 case _util.OPS.curveTo2: 36010 case _util.OPS.curveTo3: 36011 case _util.OPS.closePath: 36012 case _util.OPS.rectangle: 36013 self.buildPath(operatorList, fn, args, parsingText); 36014 continue; 36015 36016 case _util.OPS.markPoint: 36017 case _util.OPS.markPointProps: 36018 case _util.OPS.beginMarkedContent: 36019 case _util.OPS.beginMarkedContentProps: 36020 case _util.OPS.endMarkedContent: 36021 case _util.OPS.beginCompat: 36022 case _util.OPS.endCompat: 36023 continue; 36024 36025 default: 36026 if (args !== null) { 36027 for (i = 0, ii = args.length; i < ii; i++) { 36028 if (args[i] instanceof _primitives.Dict) { 36029 break; 36030 } 36031 } 36032 36033 if (i < ii) { 36034 (0, _util.warn)("getOperatorList - ignoring operator: " + fn); 36035 continue; 36036 } 36037 } 36038 36039 } 36040 36041 operatorList.addOp(fn, args); 36042 } 36043 36044 if (stop) { 36045 next(deferred); 36046 return; 36047 } 36048 36049 closePendingRestoreOPS(); 36050 resolve(); 36051 }).catch(reason => { 36052 if (reason instanceof _util.AbortException) { 36053 return; 36054 } 36055 36056 if (this.options.ignoreErrors) { 36057 this.handler.send("UnsupportedFeature", { 36058 featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList 36059 }); 36060 (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 36061 closePendingRestoreOPS(); 36062 return; 36063 } 36064 36065 throw reason; 36066 }); 36067 }, 36068 36069 getTextContent({ 36070 stream, 36071 task, 36072 resources, 36073 stateManager = null, 36074 normalizeWhitespace = false, 36075 combineTextItems = false, 36076 sink, 36077 seenStyles = Object.create(null) 36078 }) { 36079 resources = resources || _primitives.Dict.empty; 36080 stateManager = stateManager || new StateManager(new TextState()); 36081 var WhitespaceRegexp = /\s/g; 36082 var textContent = { 36083 items: [], 36084 styles: Object.create(null) 36085 }; 36086 var textContentItem = { 36087 initialized: false, 36088 str: [], 36089 width: 0, 36090 height: 0, 36091 vertical: false, 36092 lastAdvanceWidth: 0, 36093 lastAdvanceHeight: 0, 36094 textAdvanceScale: 0, 36095 spaceWidth: 0, 36096 fakeSpaceMin: Infinity, 36097 fakeMultiSpaceMin: Infinity, 36098 fakeMultiSpaceMax: -0, 36099 textRunBreakAllowed: false, 36100 transform: null, 36101 fontName: null 36102 }; 36103 var SPACE_FACTOR = 0.3; 36104 var MULTI_SPACE_FACTOR = 1.5; 36105 var MULTI_SPACE_FACTOR_MAX = 4; 36106 var self = this; 36107 var xref = this.xref; 36108 var xobjs = null; 36109 const emptyXObjectCache = new _image_utils.LocalImageCache(); 36110 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 36111 var textState; 36112 36113 function ensureTextContentItem() { 36114 if (textContentItem.initialized) { 36115 return textContentItem; 36116 } 36117 36118 var font = textState.font; 36119 36120 if (!(font.loadedName in seenStyles)) { 36121 seenStyles[font.loadedName] = true; 36122 textContent.styles[font.loadedName] = { 36123 fontFamily: font.fallbackName, 36124 ascent: font.ascent, 36125 descent: font.descent, 36126 vertical: font.vertical 36127 }; 36128 } 36129 36130 textContentItem.fontName = font.loadedName; 36131 var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 36132 36133 if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { 36134 const glyphHeight = font.bbox[3] - font.bbox[1]; 36135 36136 if (glyphHeight > 0) { 36137 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 36138 } 36139 } 36140 36141 var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); 36142 36143 textContentItem.transform = trm; 36144 36145 if (!font.vertical) { 36146 textContentItem.width = 0; 36147 textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]); 36148 textContentItem.vertical = false;
36149 } else { 36150 textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]); 36151 textContentItem.height = 0; 36152 textContentItem.vertical = true; 36153 } 36154 36155 var a = textState.textLineMatrix[0]; 36156 var b = textState.textLineMatrix[1]; 36157 var scaleLineX = Math.sqrt(a * a + b * b); 36158 a = textState.ctm[0]; 36159 b = textState.ctm[1]; 36160 var scaleCtmX = Math.sqrt(a * a + b * b); 36161 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 36162 textContentItem.lastAdvanceWidth = 0; 36163 textContentItem.lastAdvanceHeight = 0; 36164 var spaceWidth = font.spaceWidth / 1000 * textState.fontSize; 36165 36166 if (spaceWidth) { 36167 textContentItem.spaceWidth = spaceWidth; 36168 textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR; 36169 textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR; 36170 textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX; 36171 textContentItem.textRunBreakAllowed = !font.isMonospace; 36172 } else { 36173 textContentItem.spaceWidth = 0; 36174 textContentItem.fakeSpaceMin = Infinity; 36175 textContentItem.fakeMultiSpaceMin = Infinity; 36176 textContentItem.fakeMultiSpaceMax = 0; 36177 textContentItem.textRunBreakAllowed = false; 36178 } 36179 36180 textContentItem.initialized = true; 36181 return textContentItem; 36182 } 36183 36184 function replaceWhitespace(str) { 36185 var i = 0, 36186 ii = str.length, 36187 code; 36188 36189 while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) { 36190 i++; 36191 } 36192 36193 return i < ii ? str.replace(WhitespaceRegexp, " ") : str; 36194 } 36195 36196 function runBidiTransform(textChunk) { 36197 var str = textChunk.str.join(""); 36198 var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical); 36199 return { 36200 str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str, 36201 dir: bidiResult.dir, 36202 width: textChunk.width, 36203 height: textChunk.height, 36204 transform: textChunk.transform, 36205 fontName: textChunk.fontName 36206 }; 36207 } 36208 36209 function handleSetFont(fontName, fontRef) { 36210 return self.loadFont(fontName, fontRef, resources).then(function (translated) { 36211 textState.font = translated.font; 36212 textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; 36213 }); 36214 } 36215 36216 function buildTextContentItem(chars) { 36217 var font = textState.font; 36218 var textChunk = ensureTextContentItem(); 36219 var width = 0; 36220 var height = 0; 36221 var glyphs = font.charsToGlyphs(chars); 36222 36223 for (var i = 0; i < glyphs.length; i++) { 36224 var glyph = glyphs[i]; 36225 var glyphWidth = null; 36226 36227 if (font.vertical && glyph.vmetric) { 36228 glyphWidth = glyph.vmetric[0]; 36229 } else { 36230 glyphWidth = glyph.width; 36231 } 36232 36233 var glyphUnicode = glyph.unicode; 36234 var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)(); 36235 36236 if (NormalizedUnicodes[glyphUnicode] !== undefined) { 36237 glyphUnicode = NormalizedUnicodes[glyphUnicode]; 36238 } 36239 36240 glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode); 36241 var charSpacing = textState.charSpacing; 36242 36243 if (glyph.isSpace) { 36244 var wordSpacing = textState.wordSpacing; 36245 charSpacing += wordSpacing; 36246 36247 if (wordSpacing > 0) { 36248 addFakeSpaces(wordSpacing, textChunk.str); 36249 } 36250 } 36251 36252 var tx = 0; 36253 var ty = 0; 36254 36255 if (!font.vertical) { 36256 var w0 = glyphWidth * textState.fontMatrix[0]; 36257 tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale; 36258 width += tx; 36259 } else { 36260 var w1 = glyphWidth * textState.fontMatrix[0]; 36261 ty = w1 * textState.fontSize + charSpacing; 36262 height += ty; 36263 } 36264 36265 textState.translateTextMatrix(tx, ty); 36266 textChunk.str.push(glyphUnicode); 36267 } 36268 36269 if (!font.vertical) { 36270 textChunk.lastAdvanceWidth = width; 36271 textChunk.width += width; 36272 } else { 36273 textChunk.lastAdvanceHeight = height; 36274 textChunk.height += Math.abs(height); 36275 } 36276 36277 return textChunk; 36278 } 36279 36280 function addFakeSpaces(width, strBuf) { 36281 if (width < textContentItem.fakeSpaceMin) { 36282 return; 36283 } 36284 36285 if (width < textContentItem.fakeMultiSpaceMin) { 36286 strBuf.push(" "); 36287 return; 36288 } 36289 36290 var fakeSpaces = Math.round(width / textContentItem.spaceWi
36290dth); 36291 36292 while (fakeSpaces-- > 0) { 36293 strBuf.push(" "); 36294 } 36295 } 36296 36297 function flushTextContentItem() { 36298 if (!textContentItem.initialized) { 36299 return; 36300 } 36301 36302 if (!textContentItem.vertical) { 36303 textContentItem.width *= textContentItem.textAdvanceScale; 36304 } else { 36305 textContentItem.height *= textContentItem.textAdvanceScale; 36306 } 36307 36308 textContent.items.push(runBidiTransform(textContentItem)); 36309 textContentItem.initialized = false; 36310 textContentItem.str.length = 0; 36311 } 36312 36313 function enqueueChunk() { 36314 const length = textContent.items.length; 36315 36316 if (length > 0) { 36317 sink.enqueue(textContent, length); 36318 textContent.items = []; 36319 textContent.styles = Object.create(null); 36320 } 36321 } 36322 36323 var timeSlotManager = new TimeSlotManager(); 36324 return new Promise(function promiseBody(resolve, reject) { 36325 const next = function (promise) { 36326 enqueueChunk(); 36327 Promise.all([promise, sink.ready]).then(function () { 36328 try { 36329 promiseBody(resolve, reject); 36330 } catch (ex) { 36331 reject(ex); 36332 } 36333 }, reject); 36334 }; 36335 36336 task.ensureNotTerminated(); 36337 timeSlotManager.reset(); 36338 var stop, 36339 operation = {}, 36340 args = []; 36341 36342 while (!(stop = timeSlotManager.check())) { 36343 args.length = 0; 36344 operation.args = args; 36345 36346 if (!preprocessor.read(operation)) { 36347 break; 36348 } 36349 36350 textState = stateManager.state; 36351 var fn = operation.fn; 36352 args = operation.args; 36353 var advance, diff; 36354 36355 switch (fn | 0) { 36356 case _util.OPS.setFont: 36357 var fontNameArg = args[0].name, 36358 fontSizeArg = args[1]; 36359 36360 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 36361 break; 36362 } 36363 36364 flushTextContentItem(); 36365 textState.fontName = fontNameArg; 36366 textState.fontSize = fontSizeArg; 36367 next(handleSetFont(fontNameArg, null)); 36368 return; 36369 36370 case _util.OPS.setTextRise: 36371 flushTextContentItem(); 36372 textState.textRise = args[0]; 36373 break; 36374 36375 case _util.OPS.setHScale: 36376 flushTextContentItem(); 36377 textState.textHScale = args[0] / 100; 36378 break; 36379 36380 case _util.OPS.setLeading: 36381 flushTextContentItem(); 36382 textState.leading = args[0]; 36383 break; 36384 36385 case _util.OPS.moveText: 36386 var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0; 36387 advance = args[0] - args[1]; 36388 36389 if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) { 36390 textState.translateTextLineMatrix(args[0], args[1]); 36391 textContentItem.width += args[0] - textContentItem.lastAdvanceWidth; 36392 textContentItem.height += args[1] - textContentItem.lastAdvanceHeight; 36393 diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight); 36394 addFakeSpaces(diff, textContentItem.str); 36395 break; 36396 } 36397 36398 flushTextContentItem(); 36399 textState.translateTextLineMatrix(args[0], args[1]);
vendor: 1,954 bytes, lines 36400-36442
36400 textState.textMatrix = textState.textLineMatrix.slice(); 36401 break; 36402 36403 case _util.OPS.setLeadingMoveText: 36404 flushTextContentItem(); 36405 textState.leading = -args[1]; 36406 textState.translateTextLineMatrix(args[0], args[1]); 36407 textState.textMatrix = textState.textLineMatrix.slice(); 36408 break; 36409 36410 case _util.OPS.nextLine: 36411 flushTextContentItem(); 36412 textState.carriageReturn(); 36413 break; 36414 36415 case _util.OPS.setTextMatrix: 36416 advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]); 36417 36418 if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) { 36419 textState.translateTextLineMatrix(advance.width, advance.height); 36420 textContentItem.width += advance.width - textContentItem.lastAdvanceWidth; 36421 textContentItem.height += advance.height - textContentItem.lastAdvanceHeight; 36422 diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight); 36423 addFakeSpaces(diff, textContentItem.str); 36424 break; 36425 } 36426 36427 flushTextContentItem(); 36428 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 36429 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 36430 break; 36431 36432 case _util.OPS.setCharSpacing: 36433 textState.charSpacing = args[0]; 36434 break; 36435 36436 case _util.OPS.setWordSpacing: 36437 textState.wordSpacing = args[0]; 36438 break; 36439 36440 case _util.OPS.beginText: 36441 flushTextContentItem(); 36442 textState.textMatrix = _util.IDENTITY_MATRIX.slice();
36443 textState.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 36444 break; 36445 36446 case _util.OPS.showSpacedText: 36447 if (!stateManager.state.font) { 36448 self.ensureStateFont(stateManager.state); 36449 continue; 36450 } 36451 36452 var items = args[0]; 36453 var offset; 36454 36455 for (var j = 0, jj = items.length; j < jj; j++) { 36456 if (typeof items[j] === "string") { 36457 buildTextContentItem(items[j]); 36458 } else if ((0, _util.isNum)(items[j])) { 36459 ensureTextContentItem(); 36460 advance = items[j] * textState.fontSize / 1000; 36461 var breakTextRun = false; 36462 36463 if (textState.font.vertical) { 36464 offset = advance; 36465 textState.translateTextMatrix(0, offset); 36466 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 36467 36468 if (!breakTextRun) { 36469 textContentItem.height += offset; 36470 } 36471 } else { 36472 advance = -advance; 36473 offset = advance * textState.textHScale; 36474 textState.translateTextMatrix(offset, 0); 36475 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 36476 36477 if (!breakTextRun) { 36478 textContentItem.width += offset; 36479 } 36480 } 36481 36482 if (breakTextRun) { 36483 flushTextContentItem(); 36484 } else if (advance > 0) { 36485 addFakeSpaces(advance, textContentItem.str); 36486 } 36487 } 36488 } 36489 36490 break; 36491 36492 case _util.OPS.showText: 36493 if (!stateManager.state.font) { 36494 self.ensureStateFont(stateManager.state); 36495 continue; 36496 } 36497 36498 buildTextContentItem(args[0]); 36499 break; 36500 36501 case _util.OPS.nextLineShowText: 36502 if (!stateManager.state.font) { 36503 self.ensureStateFont(stateManager.state); 36504 continue; 36505 } 36506 36507 flushTextContentItem(); 36508 textState.carriageReturn(); 36509 buildTextContentItem(args[0]); 36510 break; 36511 36512 case _util.OPS.nextLineSetSpacingShowText: 36513 if (!stateManager.state.font) { 36514 self.ensureStateFont(stateManager.state); 36515 continue; 36516 } 36517 36518 flushTextContentItem(); 36519 textState.wordSpacing = args[0]; 36520 textState.charSpacing = args[1]; 36521 textState.carriageReturn(); 36522 buildTextContentItem(args[2]); 36523 break; 36524 36525 case _util.OPS.paintXObject: 36526 flushTextContentItem(); 36527 36528 if (!xobjs) { 36529 xobjs = resources.get("XObject") || _primitives.Dict.empty; 36530 } 36531 36532 var name = args[0].name; 36533 36534 if (name && emptyXObjectCache.getByName(name)) { 36535 break; 36536 } 36537 36538 next(new Promise(function (resolveXObject, rejectXObject) { 36539 if (!name) { 36540 throw new _util.FormatError("XObject must be referred to by name."); 36541 } 36542 36543 let xobj = xobjs.getRaw(name); 36544 36545 if (xobj instanceof _primitives.Ref) { 36546 if (emptyXObjectCache.getByRef(xobj)) { 36547 resolveXObject(); 36548 return; 36549 } 36550 36551 xobj = xref.fetch(xobj); 36552 } 36553 36554 if (!xobj) { 36555 resolveXObject(); 36556 return; 36557 } 36558 36559 if (!(0, _primitives.isStream)(xobj)) { 36560 throw new _util.FormatError("XObject should be a stream"); 36561 } 36562 36563 const type = xobj.dict.get("Subtype"); 36564 36565 if (!(0, _primitives.isName)(type)) { 36566 throw new _util.FormatError("XObject should have a Name subtype"); 36567 } 36568 36569 if (type.name !== "Form") { 36570 emptyXObjectCache.set(name, xobj.dict.objId, true); 36571 resolveXObject(); 36572 return; 36573 } 36574 36575 const currentState = stateManager.state.clone(); 36576 const xObjStateManager = new StateManager(currentState); 36577 const matrix = xobj.dict.getArray("Matrix"); 36578 36579 if (Array.isArray(matrix) && matrix.length === 6) { 36580 xObjStateManager.transform(matrix); 36581 } 36582 36583 enqueueChunk(); 36584 const sinkWrapper = {
36585 enqueueInvoked: false, 36586 36587 enqueue(chunk, size) { 36588 this.enqueueInvoked = true; 36589 sink.enqueue(chunk, size); 36590 }, 36591 36592 get desiredSize() { 36593 return sink.desiredSize; 36594 }, 36595 36596 get ready() { 36597 return sink.ready; 36598 } 36599 36600 }; 36601 self.getTextContent({ 36602 stream: xobj, 36603 task, 36604 resources: xobj.dict.get("Resources") || resources, 36605 stateManager: xObjStateManager, 36606 normalizeWhitespace, 36607 combineTextItems, 36608 sink: sinkWrapper, 36609 seenStyles 36610 }).then(function () { 36611 if (!sinkWrapper.enqueueInvoked) { 36612 emptyXObjectCache.set(name, xobj.dict.objId, true); 36613 } 36614 36615 resolveXObject(); 36616 }, rejectXObject); 36617 }).catch(function (reason) { 36618 if (reason instanceof _util.AbortException) { 36619 return; 36620 } 36621 36622 if (self.options.ignoreErrors) { 36623 (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`); 36624 return; 36625 } 36626 36627 throw reason; 36628 })); 36629 return; 36630 36631 case _util.OPS.setGState: 36632 flushTextContentItem(); 36633 var dictName = args[0]; 36634 var extGState = resources.get("ExtGState"); 36635 36636 if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) { 36637 break; 36638 } 36639 36640 var gState = extGState.get(dictName.name); 36641 36642 if (!(0, _primitives.isDict)(gState)) { 36643 break; 36644 } 36645 36646 var gStateFont = gState.get("Font"); 36647 36648 if (gStateFont) { 36649 textState.fontName = null; 36650 textState.fontSize = gStateFont[1]; 36651 next(handleSetFont(null, gStateFont[0])); 36652 return; 36653 } 36654 36655 break; 36656 } 36657 36658 if (textContent.items.length >= sink.desiredSize) { 36659 stop = true; 36660 break; 36661 } 36662 } 36663 36664 if (stop) { 36665 next(deferred); 36666 return; 36667 } 36668 36669 flushTextContentItem(); 36670 enqueueChunk(); 36671 resolve(); 36672 }).catch(reason => { 36673 if (reason instanceof _util.AbortException) { 36674 return; 36675 } 36676 36677 if (this.options.ignoreErrors) { 36678 (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 36679 flushTextContentItem(); 36680 enqueueChunk(); 36681 return; 36682 } 36683 36684 throw reason; 36685 }); 36686 }, 36687 36688 extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) { 36689 const xref = this.xref; 36690 let cidToGidBytes; 36691 var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 36692 var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); 36693 36694 if (properties.composite) { 36695 var cidSystemInfo = dict.get("CIDSystemInfo"); 36696 36697 if ((0, _primitives.isDict)(cidSystemInfo)) { 36698 properties.cidSystemInfo = { 36699 registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")), 36700 ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")), 36701 supplement: cidSystemInfo.get("Supplement") 36702 }; 36703 } 36704 36705 var cidToGidMap = dict.get("CIDToGIDMap"); 36706 36707 if ((0, _primitives.isStream)(cidToGidMap)) { 36708 cidToGidBytes = cidToGidMap.getBytes(); 36709 } 36710 } 36711 36712 var differences = []; 36713 var baseEncodingName = null; 36714 var encoding; 36715 36716 if (dict.has("Encoding")) { 36717 encoding = dict.get("Encoding"); 36718 36719 if ((0, _primitives.isDict)(encoding)) { 36720 baseEncodingName = encoding.get("BaseEncoding"); 36721 baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null; 36722 36723 if (encoding.has("Differences")) { 36724 var diffEncoding = encoding.get("Differences"); 36725 var index = 0; 36726 36727 for (var j = 0, jj = diffEncoding.length; j < jj; j++) { 36728 var data = xref.fetchIfRef(diffEncoding[j]); 36729 36730 if ((0, _util.isNum)(data)) { 36731 index = data; 36732 } else if ((0, _primitives.isName)(data)) { 36733 differences[index++] = data.name; 36734 } else { 36735 throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`); 36736 } 36737 } 36738 } 36739 } else if ((0, _primitives.isName)(encoding)) { 36740 baseEncodingName = encoding.name; 36741 } else { 36742 throw new _util.FormatError("Encoding is not a Name nor a Dict"); 36743 } 36744 36745 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 36746 baseEncodingName = null; 36747 } 36748 } 36749 36750 if (baseEncodingName) { 36751 properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice(); 36752 } else { 36753 var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic); 36754 var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic); 36755 encoding = _encodings.StandardEncoding; 36756 36757 if (properties.type === "TrueType" && !isNonsymbolicFont) { 36758 encoding = _encodings.WinAnsiEncoding; 36759 } 36760 36761 if (isSymbolicFont) { 36762 encoding = _encodings.MacRomanEncoding; 36763 36764 if (!properties.file) { 36765 if (/Symbol/i.test(properties.name)) { 36766 encoding = _encodings.SymbolSetEncoding; 36767 } else if (/Dingbats|Wingdings/i.test(properties.name)) { 36768 encoding = _encodings.ZapfDingbatsEncoding; 36769 } 36770 } 36771 } 36772 36773 properties.defaultEncoding = encoding; 36774 } 36775 36776 properties.differences = differences; 36777 properties.baseEncodingName = baseEncodingName; 36778 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 36779 properties.dict = dict; 36780 return toUnicodePromise.then(readToUnicode => { 36781 properties.toUnicode = readToUnicode; 36782 return this.buildToUnicode(properties); 36783 }).then(builtToUnicode => { 36784 properties.toUnicode = builtToUnicode; 36785 36786 if (cidToGidBytes) { 36787 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode); 36788 } 36789 36790 return properties; 36791 }); 36792 }, 36793 36794 _buildSimpleFontToUnicode(properties, forceGlyphs = false) { 36795 (0, _util.assert)(!properties.composite, "Must be a simple font."); 36796 const toUnicode = []; 36797 const encoding = properties.defaultEncoding.slice(); 36798 const baseEncodingName = properties.baseEncodingName; 36799 const differences = properties.differences; 36800 36801 for (const charcode in differences) { 36802 const glyphName = differences[charcode]; 36803 36804 if (glyphName === ".notdef") { 36805 continue; 36806 } 36807 36808 encoding[charcode] = glyphName; 36809 } 36810 36811 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 36812 36813 for (const charcode in encoding) { 36814 let glyphName = encoding[charcode]; 36815 36816 if (glyphName === "") { 36817 continue; 36818 } else if (glyphsUnicodeMap[glyphName] === undefined) { 36819 let code = 0; 36820 36821 switch (glyphName[0]) { 36822 case "G": 36823 if (glyphName.length === 3) { 36824 code = parseInt(glyphName.substring(1), 16); 36825 } 36826 36827 break; 36828 36829 case "g": 36830 if (glyphName.length === 5) { 36831 code = parseInt(glyphName.substring(1), 16); 36832 } 36833 36834 break; 36835 36836 case "C": 36837 case "c": 36838 if (glyphName.length >= 3 && glyphName.length <= 4) { 36839 const codeStr = glyphName.substring(1); 36840 36841 if (forceGlyphs) { 36842 code = parseInt(codeStr, 16); 36843 break; 36844 } 36845 36846 code = +codeStr; 36847 36848 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 36849 return this._buildSimpleFontToUnicode(properties, true); 36850 } 36851 } 36852 36853 break; 36854 36855 default: 36856 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 36857 36858 if (unicode !== -1) { 36859 code = unicode; 36860 } 36861 36862 } 36863 36864 if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) { 36865 if (baseEncodingName && code === +charcode) { 36866 const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); 36867 36868 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 36869 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 36870 continue; 36871 } 36872 } 36873 36874 toUnicode[charcode] = String.fromCodePoint(code); 36875 } 36876 36877 continue; 36878 } 36879 36880 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 36881 } 36882 36883 return new _fonts.ToUnicodeMap(toUnicode); 36884 }, 36885 36886 buildToUnicode(properties) { 36887 properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; 36888 36889 if (properties.hasIncludedToUnicodeMap) { 36890 if (!properties.composite && properties.hasEncoding) { 36891 properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties); 36892 } 36893 36894 return Promise.resolve(properties.toUnicode); 36895 } 36896 36897 if (!properties.composite) { 36898 return Promise.resolve(this._buildSimpleFontToUnicode(properties)); 36899 } 36900 36901 if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) { 36902 const registry = properties.cidSystemInfo.registry; 36903 const ordering = properties.cidSystemInfo.ordering; 36904 36905 const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2"); 36906 36907 return _cmap.CMapFactory.create({ 36908 encoding: ucs2CMapName, 36909 fetchBuiltInCMap: this.fetchBuiltInCMap, 36910 useCMap: null 36911 }).then(function (ucs2CMap) { 36912 const cMap = properties.cMap; 36913 const toUnicode = [];
36914 cMap.forEach(function (charcode, cid) { 36915 if (cid > 0xffff) { 36916 throw new _util.FormatError("Max size of CID is 65,535"); 36917 } 36918 36919 const ucs2 = ucs2CMap.lookup(cid); 36920 36921 if (ucs2) { 36922 toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); 36923 } 36924 }); 36925 return new _fonts.ToUnicodeMap(toUnicode); 36926 }); 36927 } 36928 36929 return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); 36930 }, 36931 36932 readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) { 36933 var cmapObj = toUnicode; 36934 36935 if ((0, _primitives.isName)(cmapObj)) { 36936 return _cmap.CMapFactory.create({ 36937 encoding: cmapObj, 36938 fetchBuiltInCMap: this.fetchBuiltInCMap, 36939 useCMap: null 36940 }).then(function (cmap) { 36941 if (cmap instanceof _cmap.IdentityCMap) { 36942 return new _fonts.IdentityToUnicodeMap(0, 0xffff); 36943 } 36944 36945 return new _fonts.ToUnicodeMap(cmap.getMap()); 36946 }); 36947 } else if ((0, _primitives.isStream)(cmapObj)) { 36948 return _cmap.CMapFactory.create({ 36949 encoding: cmapObj, 36950 fetchBuiltInCMap: this.fetchBuiltInCMap, 36951 useCMap: null 36952 }).then(function (cmap) { 36953 if (cmap instanceof _cmap.IdentityCMap) { 36954 return new _fonts.IdentityToUnicodeMap(0, 0xffff); 36955 } 36956 36957 var map = new Array(cmap.length); 36958 cmap.forEach(function (charCode, token) { 36959 var str = []; 36960 36961 for (var k = 0; k < token.length; k += 2) {
36962 var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 36963 36964 if ((w1 & 0xf800) !== 0xd800) { 36965 str.push(w1); 36966 continue; 36967 } 36968 36969 k += 2; 36970 var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 36971 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 36972 } 36973 36974 map[charCode] = String.fromCodePoint.apply(String, str); 36975 }); 36976 return new _fonts.ToUnicodeMap(map); 36977 }, reason => { 36978 if (reason instanceof _util.AbortException) { 36979 return null; 36980 } 36981 36982 if (this.options.ignoreErrors) { 36983 this.handler.send("UnsupportedFeature", { 36984 featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode 36985 }); 36986 (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 36987 return null; 36988 } 36989 36990 throw reason; 36991 }); 36992 } 36993 36994 return Promise.resolve(null); 36995 }, 36996 36997 readCidToGidMap(glyphsData, toUnicode) { 36998 var result = []; 36999 37000 for (var j = 0, jj = glyphsData.length; j < jj; j++) { 37001 var glyphID = glyphsData[j++] << 8 | glyphsData[j]; 37002 const code = j >> 1; 37003 37004 if (glyphID === 0 && !toUnicode.has(code)) { 37005 continue; 37006 } 37007 37008 result[code] = glyphID; 37009 } 37010 37011 return result; 37012 }, 37013 37014 extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) { 37015 var xref = this.xref; 37016 var glyphsWidths = []; 37017 var defaultWidth = 0; 37018 var glyphsVMetrics = []; 37019 var defaultVMetrics; 37020 var i, ii, j, jj, start, code, widths; 37021 37022 if (properties.composite) { 37023 defaultWidth = dict.has("DW") ? dict.get("DW") : 1000; 37024 widths = dict.get("W"); 37025 37026 if (widths) { 37027 for (i = 0, ii = widths.length; i < ii; i++) { 37028 start = xref.fetchIfRef(widths[i++]); 37029 code = xref.fetchIfRef(widths[i]); 37030 37031 if (Array.isArray(code)) { 37032 for (j = 0, jj = code.length; j < jj; j++) { 37033 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 37034 } 37035 } else { 37036 var width = xref.fetchIfRef(widths[++i]); 37037 37038 for (j = start; j <= code; j++) { 37039 glyphsWidths[j] = width; 37040 } 37041 } 37042 } 37043 } 37044 37045 if (properties.vertical) { 37046 var vmetrics = dict.getArray("DW2") || [880, -1000]; 37047 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 37048 vmetrics = dict.get("W2"); 37049 37050 if (vmetrics) { 37051 for (i = 0, ii = vmetrics.length; i < ii; i++) { 37052 start = xref.fetchIfRef(vmetrics[i++]); 37053 code = xref.fetchIfRef(vmetrics[i]); 37054 37055 if (Array.isArray(code)) { 37056 for (j = 0, jj = code.length; j < jj; j++) { 37057 glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 37058 } 37059 } else { 37060 var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 37061 37062 for (j = start; j <= code; j++) { 37063 glyphsVMetrics[j] = vmetric; 37064 } 37065 } 37066 } 37067 } 37068 } 37069 } else { 37070 var firstChar = properties.firstChar; 37071 widths = dict.get("Widths"); 37072 37073 if (widths) { 37074 j = firstChar; 37075 37076 for (i = 0, ii = widths.length; i < ii; i++) { 37077 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 37078 } 37079 37080 defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0; 37081 } else { 37082 var baseFontName = dict.get("BaseFont"); 37083 37084 if ((0, _primitives.isName)(baseFontName)) { 37085 var metrics = this.getBaseFontMetrics(baseFontName.name); 37086 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 37087 defaultWidth = metrics.defaultWidth; 37088 } 37089 } 37090 } 37091 37092 var isMonospace = true; 37093 var firstWidth = defaultWidth; 37094 37095 for (var glyph in glyphsWidths) { 37096 var glyphWidth = glyphsWidths[glyph]; 37097 37098 if (!glyphWidth) { 37099 continue; 37100 } 37101 37102 if (!firstWidth) { 37103 firstWidth = glyphWidth; 37104 continue; 37105 } 37106 37107 if (firstWidth !== glyphWidth) { 37108 isMonospace = false;
37109 break; 37110 } 37111 } 37112 37113 if (isMonospace) { 37114 properties.flags |= _fonts.FontFlags.FixedPitch; 37115 } 37116 37117 properties.defaultWidth = defaultWidth; 37118 properties.widths = glyphsWidths; 37119 properties.defaultVMetrics = defaultVMetrics; 37120 properties.vmetrics = glyphsVMetrics; 37121 }, 37122 isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) { 37123 var fontNameWoStyle = baseFontName.split("-")[0]; 37124 return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1; 37125 }, 37126 getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) { 37127 var defaultWidth = 0; 37128 var widths = []; 37129 var monospace = false; 37130 var stdFontMap = (0, _standard_fonts.getStdFontMap)(); 37131 var lookupName = stdFontMap[name] || name; 37132 var Metrics = (0, _metrics.getMetrics)(); 37133 37134 if (!(lookupName in Metrics)) { 37135 if (this.isSerifFont(name)) { 37136 lookupName = "Times-Roman"; 37137 } else { 37138 lookupName = "Helvetica"; 37139 } 37140 } 37141 37142 var glyphWidths = Metrics[lookupName]; 37143 37144 if ((0, _util.isNum)(glyphWidths)) { 37145 defaultWidth = glyphWidths; 37146 monospace = true; 37147 } else { 37148 widths = glyphWidths(); 37149 } 37150 37151 return { 37152 defaultWidth, 37153 monospace, 37154 widths 37155 }; 37156 }, 37157 buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) { 37158 var widths = Object.create(null); 37159 var differences = properties.differences; 37160 var encoding = properties.defaultEncoding; 37161 37162 for (var charCode = 0; charCode < 256; charCode++) { 37163 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 37164 widths[charCode] = widthsByGlyphName[differences[charCode]]; 37165 continue; 37166 } 37167 37168 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 37169 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 37170 continue; 37171 } 37172 } 37173 37174 return widths; 37175 }, 37176 preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) { 37177 var baseDict = dict; 37178 var type = dict.get("Subtype"); 37179 37180 if (!(0, _primitives.isName)(type)) { 37181 throw new _util.FormatError("invalid font Subtype"); 37182 } 37183 37184 var composite = false; 37185 var uint8array; 37186 37187 if (type.name === "Type0") { 37188 var df = dict.get("DescendantFonts"); 37189 37190 if (!df) { 37191 throw new _util.FormatError("Descendant fonts are not specified"); 37192 } 37193 37194 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 37195 type = dict.get("Subtype"); 37196 37197 if (!(0, _primitives.isName)(type)) { 37198 throw new _util.FormatError("invalid font Subtype"); 37199 } 37200 37201 composite = true; 37202 } 37203 37204 var descriptor = dict.get("FontDescriptor"); 37205 37206 if (descriptor) { 37207 var hash = new _murmurhash.MurmurHash3_64(); 37208 var encoding = baseDict.getRaw("Encoding"); 37209 37210 if ((0, _primitives.isName)(encoding)) { 37211 hash.update(encoding.name); 37212 } else if ((0, _primitives.isRef)(encoding)) { 37213 hash.update(encoding.toString()); 37214 } else if ((0, _primitives.isDict)(encoding)) { 37215 var keys = encoding.getKeys(); 37216 37217 for (var i = 0, ii = keys.length; i < ii; i++) { 37218 var entry = encoding.getRaw(keys[i]); 37219 37220 if ((0, _primitives.isName)(entry)) { 37221 hash.update(entry.name); 37222 } else if ((0, _primitives.isRef)(entry)) { 37223 hash.update(entry.toString()); 37224 } else if (Array.isArray(entry)) { 37225 var diffLength = entry.length, 37226 diffBuf = new Array(diffLength); 37227 37228 for (var j = 0; j < diffLength; j++) { 37229 var diffEntry = entry[j]; 37230 37231 if ((0, _primitives.isName)(diffEntry)) { 37232 diffBuf[j] = diffEntry.name; 37233 } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) { 37234 diffBuf[j] = diffEntry.toString(); 37235 } 37236 } 37237 37238 hash.update(diffBuf.join()); 37239 } 37240 } 37241 } 37242 37243 const firstChar = dict.get("FirstChar") || 0; 37244 const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); 37245 hash.update(`${firstChar}-${lastChar}`); 37246 var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 37247 37248 if ((0, _primitives.isStream)(toUnicode)) { 37249 var stream = toUnicode.str || toUnicode; 37250 uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 37251 hash.update(uint8array); 37252 } else if ((0, _primitives.isName)(toUnicode)) { 37253 hash.update(toUnicode.name); 37254 } 37255 37256 var widths = dict.get("Widths") || baseDict.get("Widths"); 37257 37258 if (widths) { 37259 uint8array = new Uint8Array(new Uint32Array(widths).buffer); 37260 hash.update(uint8array); 37261 } 37262 } 37263 37264 return { 37265 descriptor, 37266 dict, 37267 baseDict, 37268 composite,
37269 type: type.name, 37270 hash: hash ? hash.hexdigest() : "" 37271 }; 37272 }, 37273 translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) { 37274 var baseDict = preEvaluatedFont.baseDict; 37275 var dict = preEvaluatedFont.dict; 37276 var composite = preEvaluatedFont.composite; 37277 var descriptor = preEvaluatedFont.descriptor; 37278 var type = preEvaluatedFont.type; 37279 var maxCharIndex = composite ? 0xffff : 0xff; 37280 var properties; 37281 const firstChar = dict.get("FirstChar") || 0; 37282 const lastChar = dict.get("LastChar") || maxCharIndex; 37283 37284 if (!descriptor) { 37285 if (type === "Type3") { 37286 descriptor = new _primitives.Dict(null); 37287 descriptor.set("FontName", _primitives.Name.get(type)); 37288 descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]); 37289 } else { 37290 var baseFontName = dict.get("BaseFont"); 37291 37292 if (!(0, _primitives.isName)(baseFontName)) { 37293 throw new _util.FormatError("Base font is not specified"); 37294 } 37295 37296 baseFontName = baseFontName.name.replace(/[,_]/g, "-"); 37297 var metrics = this.getBaseFontMetrics(baseFontName); 37298 var fontNameWoStyle = baseFontName.split("-")[0]; 37299 var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic); 37300 properties = { 37301 type, 37302 name: baseFontName, 37303 widths: metrics.widths, 37304 defaultWidth: metrics.defaultWidth, 37305 flags, 37306 firstChar, 37307 lastChar 37308 }; 37309 const widths = dict.get("Widths"); 37310 return this.extractDataStructures(dict, dict, properties).then(newProperties => { 37311 if (widths) { 37312 const glyphWidths = []; 37313 let j = firstChar; 37314 37315 for (let i = 0, ii = widths.length; i < ii; i++) { 37316 glyphWidths[j++] = this.xref.fetchIfRef(widths[i]); 37317 } 37318 37319 newProperties.widths = glyphWidths; 37320 } else { 37321 newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); 37322 } 37323 37324 return new _fonts.Font(baseFontName, null, newProperties); 37325 }); 37326 } 37327 } 37328 37329 var fontName = descriptor.get("FontName"); 37330 var baseFont = dict.get("BaseFont"); 37331 37332 if ((0, _util.isString)(fontName)) { 37333 fontName = _primitives.Name.get(fontName); 37334 } 37335 37336 if ((0, _util.isString)(baseFont)) { 37337 baseFont = _primitives.Name.get(baseFont); 37338 } 37339 37340 if (type !== "Type3") { 37341 var fontNameStr = fontName && fontName.name; 37342 var baseFontStr = baseFont && baseFont.name; 37343 37344 if (fontNameStr !== baseFontStr) { 37345 (0, _util.info)(`The FontDescriptor\'s FontName is "${fontNameStr}" but ` + `should be the same as the Font\'s BaseFont "${baseFontStr}".`); 37346 37347 if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) { 37348 fontName = baseFont; 37349 } 37350 } 37351 } 37352 37353 fontName = fontName || baseFont; 37354 37355 if (!(0, _primitives.isName)(fontName)) { 37356 throw new _util.FormatError("invalid font name"); 37357 } 37358 37359 var fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 37360 37361 if (fontFile) { 37362 if (fontFile.dict) { 37363 var subtype = fontFile.dict.get("Subtype"); 37364 37365 if (subtype) { 37366 subtype = subtype.name; 37367 } 37368 37369 var length1 = fontFile.dict.get("Length1"); 37370 var length2 = fontFile.dict.get("Length2"); 37371 var length3 = fontFile.dict.get("Length3"); 37372 } 37373 } 37374 37375 properties = { 37376 type, 37377 name: fontName.name, 37378 subtype, 37379 file: fontFile, 37380 length1, 37381 length2, 37382 length3, 37383 loadedName: baseDict.loadedName, 37384 composite, 37385 fixedPitch: false, 37386 fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX, 37387 firstChar: firstChar || 0,
37388 lastChar: lastChar || maxCharIndex, 37389 bbox: descriptor.getArray("FontBBox"), 37390 ascent: descriptor.get("Ascent"), 37391 descent: descriptor.get("Descent"), 37392 xHeight: descriptor.get("XHeight"), 37393 capHeight: descriptor.get("CapHeight"), 37394 flags: descriptor.get("Flags"), 37395 italicAngle: descriptor.get("ItalicAngle"), 37396 isType3Font: false 37397 }; 37398 var cMapPromise; 37399 37400 if (composite) { 37401 var cidEncoding = baseDict.get("Encoding"); 37402 37403 if ((0, _primitives.isName)(cidEncoding)) { 37404 properties.cidEncoding = cidEncoding.name; 37405 } 37406 37407 cMapPromise = _cmap.CMapFactory.create({ 37408 encoding: cidEncoding, 37409 fetchBuiltInCMap: this.fetchBuiltInCMap, 37410 useCMap: null 37411 }).then(function (cMap) { 37412 properties.cMap = cMap; 37413 properties.vertical = properties.cMap.vertical; 37414 }); 37415 } else { 37416 cMapPromise = Promise.resolve(undefined); 37417 } 37418 37419 return cMapPromise.then(() => { 37420 return this.extractDataStructures(dict, baseDict, properties); 37421 }).then(newProperties => { 37422 this.extractWidths(dict, descriptor, newProperties); 37423 37424 if (type === "Type3") { 37425 newProperties.isType3Font = true; 37426 } 37427 37428 return new _fonts.Font(fontName.name, fontFile, newProperties); 37429 }); 37430 } 37431 }; 37432 37433 PartialEvaluator.buildFontPaths = function (font, glyphs, handler) { 37434 function buildPath(fontChar) { 37435 if (font.renderer.hasBuiltPath(fontChar)) { 37436 return; 37437 } 37438 37439 handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]); 37440 } 37441 37442 for (const glyph of glyphs) { 37443 buildPath(glyph.fontChar); 37444 const accent = glyph.accent; 37445 37446 if (accent && accent.fontChar) { 37447 buildPath(accent.fontChar); 37448 } 37449 } 37450 }; 37451 37452 PartialEvaluator.getFallbackFontDict = function () { 37453 if (this._fallbackFontDict) { 37454 return this._fallbackFontDict; 37455 } 37456 37457 const dict = new _primitives.Dict(); 37458 dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont")); 37459 dict.set("Type", _primitives.Name.get("FallbackType")); 37460 dict.set("Subtype", _primitives.Name.get("FallbackType")); 37461 dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 37462 return this._fallbackFontDict = dict; 37463 }; 37464 37465 return PartialEvaluator; 37466}(); 37467 37468exports.PartialEvaluator = PartialEvaluator; 37469 37470class TranslatedFont { 37471 constructor({ 37472 loadedName, 37473 font, 37474 dict, 37475 extraProperties = false 37476 }) { 37477 this.loadedName = loadedName; 37478 this.font = font; 37479 this.dict = dict; 37480 this._extraProperties = extraProperties; 37481 this.type3Loaded = null; 37482 this.sent = false; 37483 } 37484 37485 send(handler) { 37486 if (this.sent) { 37487 return; 37488 } 37489 37490 this.sent = true; 37491 handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]); 37492 } 37493 37494 fallback(handler) { 37495 if (!this.font.data) { 37496 return; 37497 } 37498 37499 this.font.disableFontFace = true; 37500 const glyphs = this.font.glyphCacheValues;
37501 PartialEvaluator.buildFontPaths(this.font, glyphs, handler); 37502 } 37503 37504 loadType3Data(evaluator, resources, parentOperatorList, task) { 37505 if (!this.font.isType3Font) { 37506 throw new Error("Must be a Type3 font."); 37507 } 37508 37509 if (this.type3Loaded) { 37510 return this.type3Loaded; 37511 } 37512 37513 var type3Options = Object.create(evaluator.options); 37514 type3Options.ignoreErrors = false; 37515 var type3Evaluator = evaluator.clone(type3Options); 37516 type3Evaluator.parsingType3Font = true; 37517 var translatedFont = this.font; 37518 var loadCharProcsPromise = Promise.resolve(); 37519 var charProcs = this.dict.get("CharProcs"); 37520 var fontResources = this.dict.get("Resources") || resources; 37521 var charProcKeys = charProcs.getKeys(); 37522 var charProcOperatorList = Object.create(null); 37523 37524 for (var i = 0, n = charProcKeys.length; i < n; ++i) { 37525 const key = charProcKeys[i]; 37526 loadCharProcsPromise = loadCharProcsPromise.then(function () { 37527 var glyphStream = charProcs.get(key); 37528 var operatorList = new _operator_list.OperatorList(); 37529 return type3Evaluator.getOperatorList({ 37530 stream: glyphStream, 37531 task, 37532 resources: fontResources, 37533 operatorList 37534 }).then(function () { 37535 charProcOperatorList[key] = operatorList.getIR(); 37536 parentOperatorList.addDependencies(operatorList.dependencies); 37537 }).catch(function (reason) { 37538 (0, _util.warn)(`Type3 font resource "${key}" is not available.`); 37539 const dummyOperatorList = new _operator_list.OperatorList(); 37540 charProcOperatorList[key] = dummyOperatorList.getIR(); 37541 }); 37542 }); 37543 } 37544 37545 this.type3Loaded = loadCharProcsPromise.then(function () { 37546 translatedFont.charProcOperatorList = charProcOperatorList; 37547 }); 37548 return this.type3Loaded; 37549 } 37550 37551} 37552 37553var StateManager = function StateManagerClosure() { 37554 function StateManager(initialState) { 37555 this.state = initialState; 37556 this.stateStack = []; 37557 } 37558 37559 StateManager.prototype = { 37560 save() { 37561 var old = this.state; 37562 this.stateStack.push(this.state); 37563 this.state = old.clone(); 37564 }, 37565 37566 restore() { 37567 var prev = this.stateStack.pop(); 37568 37569 if (prev) { 37570 this.state = prev; 37571 } 37572 }, 37573 37574 transform(args) { 37575 this.state.ctm = _util.Util.transform(this.state.ctm, args); 37576 } 37577 37578 }; 37579 return StateManager; 37580}(); 37581 37582var TextState = function TextStateClosure() { 37583 function TextState() { 37584 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 37585 this.fontName = null; 37586 this.fontSize = 0; 37587 this.font = null; 37588 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 37589 this.textMatrix = _util.IDENTITY_MATRIX.slice();
37590 this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 37591 this.charSpacing = 0; 37592 this.wordSpacing = 0; 37593 this.leading = 0; 37594 this.textHScale = 1; 37595 this.textRise = 0; 37596 } 37597 37598 TextState.prototype = { 37599 setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 37600 var m = this.textMatrix; 37601 m[0] = a; 37602 m[1] = b; 37603 m[2] = c; 37604 m[3] = d; 37605 m[4] = e; 37606 m[5] = f; 37607 }, 37608 setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 37609 var m = this.textLineMatrix; 37610 m[0] = a; 37611 m[1] = b; 37612 m[2] = c; 37613 m[3] = d; 37614 m[4] = e; 37615 m[5] = f; 37616 }, 37617 translateTextMatrix: function TextState_translateTextMatrix(x, y) { 37618 var m = this.textMatrix; 37619 m[4] = m[0] * x + m[2] * y + m[4]; 37620 m[5] = m[1] * x + m[3] * y + m[5]; 37621 }, 37622 translateTextLineMatrix: function TextState_translateTextMatrix(x, y) { 37623 var m = this.textLineMatrix; 37624 m[4] = m[0] * x + m[2] * y + m[4]; 37625 m[5] = m[1] * x + m[3] * y + m[5]; 37626 }, 37627 calcTextLineMatr
37627ixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) { 37628 var font = this.font; 37629 37630 if (!font) { 37631 return null; 37632 } 37633 37634 var m = this.textLineMatrix; 37635 37636 if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) { 37637 return null; 37638 } 37639 37640 var txDiff = e - m[4], 37641 tyDiff = f - m[5]; 37642 37643 if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) { 37644 return null; 37645 } 37646 37647 var tx, 37648 ty, 37649 denominator = a * d - b * c; 37650 37651 if (font.vertical) { 37652 tx = -tyDiff * c / denominator; 37653 ty = tyDiff * a / denominator; 37654 } else { 37655 tx = txDiff * d / denominator; 37656 ty = -txDiff * b / denominator; 37657 } 37658 37659 return { 37660 width: tx, 37661 height: ty, 37662 value: font.vertical ? ty : tx 37663 }; 37664 }, 37665 calcRenderMatrix: function TextState_calcRendeMatrix(ctm) { 37666 var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise]; 37667 return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm)); 37668 }, 37669 carriageReturn: function TextState_carriageReturn() { 37670 this.translateTextLineMatrix(0, -this.leading);
37671 this.textMatrix = this.textLineMatrix.slice(); 37672 }, 37673 clone: function TextState_clone() { 37674 var clone = Object.create(this); 37675 clone.textMatrix = this.textMatrix.slice(); 37676 clone.textLineMatrix = this.textLineMatrix.slice(); 37677 clone.fontMatrix = this.fontMatrix.slice(); 37678 return clone; 37679 } 37680 }; 37681 return TextState; 37682}(); 37683 37684var EvalState = function EvalStateClosure() { 37685 function EvalState() { 37686 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 37687 this.font = null; 37688 this.textRenderingMode = _util.TextRenderingMode.FILL; 37689 this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 37690 this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 37691 } 37692 37693 EvalState.prototype = { 37694 clone: function CanvasExtraState_clone() { 37695 return Object.create(this); 37696 } 37697 }; 37698 return EvalState; 37699}(); 37700 37701var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { 37702 var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) { 37703 t.w = { 37704 id: _util.OPS.setLineWidth, 37705 numArgs: 1, 37706 variableArgs: false 37707 }; 37708 t.J = { 37709 id: _util.OPS.setLineCap, 37710 numArgs: 1, 37711 variableArgs: false 37712 }; 37713 t.j = { 37714 id: _util.OPS.setLineJoin, 37715 numArgs: 1, 37716 variableArgs: false 37717 };
37718 t.M = { 37719 id: _util.OPS.setMiterLimit, 37720 numArgs: 1, 37721 variableArgs: false 37722 }; 37723 t.d = { 37724 id: _util.OPS.setDash, 37725 numArgs: 2, 37726 variableArgs: false 37727 }; 37728 t.ri = { 37729 id: _util.OPS.setRenderingIntent, 37730 numArgs: 1, 37731 variableArgs: false 37732 }; 37733 t.i = { 37734 id: _util.OPS.setFlatness, 37735 numArgs: 1, 37736 variableArgs: false 37737 }; 37738 t.gs = { 37739 id: _util.OPS.setGState, 37740 numArgs: 1, 37741 variableArgs: false 37742 }; 37743 t.q = { 37744 id: _util.OPS.save, 37745 numArgs: 0, 37746 variableArgs: false 37747 }; 37748 t.Q = { 37749 id: _util.OPS.restore, 37750 numArgs: 0, 37751 variableArgs: false 37752 }; 37753 t.cm = { 37754 id: _util.OPS.transform, 37755 numArgs: 6, 37756 variableArgs: false 37757 }; 37758 t.m = { 37759 id: _util.OPS.moveTo, 37760 numArgs: 2, 37761 variableArgs: false 37762 }; 37763 t.l = { 37764 id: _util.OPS.lineTo, 37765 numArgs: 2, 37766 variableArgs: false 37767 }; 37768 t.c = { 37769 id: _util.OPS.curveTo, 37770 numArgs: 6, 37771 variableArgs: false 37772 }; 37773 t.v = { 37774 id: _util.OPS.curveTo2, 37775 numArgs: 4, 37776 variableArgs: false 37777 }; 37778 t.y = { 37779 id: _util.OPS.curveTo3, 37780 numArgs: 4, 37781 variableArgs: false 37782 }; 37783 t.h = { 37784 id: _util.OPS.closePath, 37785 numArgs: 0, 37786 variableArgs: false 37787 }; 37788 t.re = { 37789 id: _util.OPS.rectangle, 37790 numArgs: 4, 37791 variableArgs: false 37792 }; 37793 t.S = { 37794 id: _util.OPS.stroke, 37795 numArgs: 0, 37796 variableArgs: false 37797 }; 37798 t.s = { 37799 id: _util.OPS.closeStroke, 37800 numArgs: 0, 37801 variableArgs: false 37802 }; 37803 t.f = { 37804 id: _util.OPS.fill, 37805 numArgs: 0, 37806 variableArgs: false 37807 }; 37808 t.F = { 37809 id: _util.OPS.fill, 37810 numArgs: 0, 37811 variableArgs: false 37812 }; 37813 t["f*"] = { 37814 id: _util.OPS.eoFill, 37815 numArgs: 0, 37816 variableArgs: false 37817 }; 37818 t.B = { 37819 id: _util.OPS.fillStroke, 37820 numArgs: 0, 37821 variableArgs: false 37822 }; 37823 t["B*"] = { 37824 id: _util.OPS.eoFillStroke, 37825 numArgs: 0, 37826 variableArgs: false 37827 }; 37828 t.b = { 37829 id: _util.OPS.closeFillStroke, 37830 numArgs: 0, 37831 variableArgs: false 37832 }; 37833 t["b*"] = { 37834 id: _util.OPS.closeEOFillStroke, 37835 numArgs: 0, 37836 variableArgs: false 37837 }; 37838 t.n = { 37839 id: _util.OPS.endPath, 37840 numArgs: 0, 37841 variableArgs: false 37842 }; 37843 t.W = { 37844 id: _util.OPS.clip, 37845 numArgs: 0, 37846 variableArgs: false 37847 }; 37848 t["W*"] = { 37849 id: _util.OPS.eoClip, 37850 numArgs: 0, 37851 variableArgs: false 37852 }; 37853 t.BT = { 37854 id: _util.OPS.beginText, 37855 numArgs: 0, 37856 variableArgs: false 37857 }; 37858 t.ET = { 37859 id: _util.OPS.endText, 37860 numArgs: 0, 37861 variableArgs: false 37862 }; 37863 t.Tc = { 37864 id: _util.OPS.setCharSpacing, 37865 numArgs: 1, 37866 variableArgs: false 37867 }; 37868 t.Tw = { 37869 id: _util.OPS.setWordSpacing, 37870 numArgs: 1, 37871 variableArgs: false 37872 }; 37873 t.Tz = { 37874 id: _util.OPS.setHScale, 37875 numArgs: 1, 37876 variableArgs: false 37877 }; 37878 t.TL = { 37879 id: _util.OPS.setLeading, 37880 numArgs: 1, 37881 variableArgs: false 37882 }; 37883 t.Tf = { 37884 id: _util.OPS.setFont, 37885 numArgs: 2, 37886 variableArgs: false 37887 }; 37888 t.Tr = { 37889 id: _util.OPS.setTextRenderingMode, 37890 numArgs: 1, 37891 variableArgs: false 37892 }; 37893 t.Ts = { 37894 id: _util.OPS.setTextRise, 37895 numArgs: 1, 37896 variableArgs: false 37897 }; 37898 t.Td = { 37899 id: _util.OPS.moveText, 37900 numArgs: 2, 37901 variableArgs: false 37902 }; 37903 t.TD = { 37904 id: _util.OPS.setLeadingMoveText, 37905 numArgs: 2, 37906 variableArgs: false 37907 }; 37908 t.Tm = { 37909 id: _util.OPS.setTextMatrix, 37910 numArgs: 6, 37911 variableArgs: false 37912 }; 37913 t["T*"] = { 37914 id: _util.OPS.nextLine, 37915 numArgs: 0, 37916 variableArgs: false 37917 }; 37918 t.Tj = { 37919 id: _util.OPS.showText, 37920 numArgs: 1, 37921 variableArgs: false 37922 }; 37923 t.TJ = { 37924 id: _util.OPS.showSpacedText, 37925 numArgs: 1, 37926 variableArgs: false 37927 }; 37928 t["'"] = { 37929 id: _util.OPS.nextLineShowText, 37930 numArgs: 1, 37931 variableArgs: false 37932 }; 37933 t['"'] = { 37934 id: _util.OPS.nextLineSetSpacingShowText, 37935 numArgs: 3, 37936 variableArgs: false 37937 }; 37938 t.d0 = { 37939 id: _util.OPS.setCharWidth, 37940 numArgs: 2, 37941 variableArgs: false 37942 }; 37943 t.d1 = { 37944 id: _util.OPS.setCharWidthAndBounds, 37945 numArgs: 6, 37946 variableArgs: false 37947 }; 37948 t.CS = { 37949 id: _util.OPS.setStrokeColorSpace, 37950 numArgs: 1, 37951 variableArgs: false 37952 }; 37953 t.cs = { 37954 id: _util.OPS.setFillColorSpace, 37955 numArgs: 1, 37956 variableArgs: false 37957 }; 37958 t.SC = { 37959 id: _util.OPS.setStrokeColor, 37960 numArgs: 4, 37961 variableArgs: true 37962 }; 37963 t.SCN = { 37964 id: _util.OPS.setStrokeColorN, 37965 numArgs: 33, 37966 variableArgs: true 37967 }; 37968 t.sc = { 37969 id: _util.OPS.setFillColor, 37970 numArgs: 4, 37971 variableArgs: true 37972 }; 37973 t.scn = { 37974 id: _util.OPS.setFillColorN, 37975 numArgs: 33, 37976 variableArgs: true 37977 }; 37978 t.G = { 37979 id: _util.OPS.setStrokeGray, 37980 numArgs: 1, 37981 variableArgs: false 37982 }; 37983 t.g = { 37984 id: _util.OPS.setFillGray, 37985 numArgs: 1, 37986 variableArgs: false 37987 }; 37988 t.RG = { 37989 id: _util.OPS.setStrokeRGBColor, 37990 numArgs: 3, 37991 variableArgs: false 37992 }; 37993 t.rg = { 37994 id: _util.OPS.setFillRGBColor, 37995 numArgs: 3, 37996 variableArgs: false 37997 }; 37998 t.K = { 37999 id: _util.OPS.setStrokeCMYKColor, 38000 numArgs: 4, 38001 variableArgs: false 38002 }; 38003 t.k = { 38004 id: _util.OPS.setFillCMYKColor, 38005 numArgs: 4, 38006 variableArgs: false 38007 }; 38008 t.sh = { 38009 id: _util.OPS.shadingFill, 38010 numArgs: 1, 38011 variableArgs: false 38012 }; 38013 t.BI = { 38014 id: _util.OPS.beginInlineImage, 38015 numArgs: 0, 38016 variableArgs: false 38017 }; 38018 t.ID = { 38019 id: _util.OPS.beginImageData, 38020 numArgs: 0, 38021 variableArgs: false 38022 }; 38023 t.EI = { 38024 id: _util.OPS.endInlineImage, 38025 numArgs: 1, 38026 variableArgs: false 38027 }; 38028 t.Do = { 38029 id: _util.OPS.paintXObject, 38030 numArgs: 1, 38031 variableArgs: false 38032 }; 38033 t.MP = { 38034 id: _util.OPS.markPoint, 38035 numArgs: 1, 38036 variableArgs: false 38037 }; 38038 t.DP = { 38039 id: _util.OPS.markPointProps, 38040 numArgs: 2, 38041 variableArgs: false 38042 }; 38043 t.BMC = { 38044 id: _util.OPS.beginMarkedContent, 38045 numArgs: 1, 38046 variableArgs: false 38047 }; 38048 t.BDC = { 38049 id: _util.OPS.beginMarkedContentProps, 38050 numArgs: 2, 38051 variableArgs: false 38052 }; 38053 t.EMC = { 38054 id: _util.OPS.endMarkedContent, 38055 numArgs: 0, 38056 variableArgs: false 38057 }; 38058 t.BX = { 38059 id: _util.OPS.beginCompat, 38060 numArgs: 0, 38061 variableArgs: false 38062 }; 38063 t.EX = { 38064 id: _util.OPS.endCompat, 38065 numArgs: 0, 38066 variableArgs: false 38067 }; 38068 t.BM = null; 38069 t.BD = null; 38070 t.true = null; 38071 t.fa = null; 38072 t.fal = null; 38073 t.fals = null; 38074 t.false = null; 38075 t.nu = null; 38076 t.nul = null; 38077 t.null = null; 38078 });
38079 const MAX_INVALID_PATH_OPS = 20; 38080 38081 function EvaluatorPreprocessor(stream, xref, stateManager) { 38082 this.opMap = getOPMap(); 38083 this.parser = new _parser.Parser({ 38084 lexer: new _parser.Lexer(stream, this.opMap), 38085 xref 38086 }); 38087 this.stateManager = stateManager; 38088 this.nonProcessedArgs = []; 38089 this._numInvalidPathOPS = 0; 38090 } 38091 38092 EvaluatorPreprocessor.prototype = { 38093 get savedStatesDepth() { 38094 return this.stateManager.stateStack.length; 38095 }, 38096 38097 read: function EvaluatorPreprocessor_read(operation) { 38098 var args = operation.args; 38099 38100 while (true) { 38101 var obj = this.parser.getObj(); 38102 38103 if (obj instanceof _primitives.Cmd) { 38104 var cmd = obj.cmd; 38105 var opSpec = this.opMap[cmd]; 38106 38107 if (!opSpec) { 38108 (0, _util.warn)(`Unknown command "${cmd}".`); 38109 continue; 38110 } 38111 38112 var fn = opSpec.id; 38113 var numArgs = opSpec.numArgs; 38114 var argsLength = args !== null ? args.length : 0; 38115 38116 if (!opSpec.variableArgs) { 38117 if (argsLength !== numArgs) { 38118 var nonProcessedArgs = this.nonProcessedArgs; 38119 38120 while (argsLength > numArgs) { 38121 nonProcessedArgs.push(args.shift()); 38122 argsLength--; 38123 } 38124 38125 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 38126 if (args === null) { 38127 args = []; 38128 } 38129 38130 args.unshift(nonProcessedArgs.pop()); 38131 argsLength++; 38132 } 38133 } 38134 38135 if (argsLength < numArgs) { 38136 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 38137 38138 if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) { 38139 throw new _util.FormatError(`Invalid ${partialMsg}`); 38140 } 38141 38142 (0, _util.warn)(`Skipping ${partialMsg}`); 38143 38144 if (args !== null) { 38145 args.length = 0; 38146 } 38147 38148 continue; 38149 } 38150 } else if (argsLength > numArgs) { 38151 (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 38152 } 38153 38154 this.preprocessCommand(fn, args); 38155 operation.fn = fn; 38156 operation.args = args; 38157 return true; 38158 } 38159 38160 if (obj === _primitives.EOF) { 38161 return false; 38162 } 38163 38164 if (obj !== null) { 38165 if (args === null) { 38166 args = []; 38167 } 38168 38169 args.push(obj); 38170 38171 if (args.length > 33) { 38172 throw new _util.FormatError("Too many arguments"); 38173 } 38174 } 38175 } 38176 }, 38177 preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) { 38178 switch (fn | 0) { 38179 case _util.OPS.save: 38180 this.stateManager.save(); 38181 break; 38182 38183 case _util.OPS.restore: 38184 this.stateManager.restore(); 38185 break; 38186 38187 case _util.OPS.transform: 38188 this.stateManager.transform(args); 38189 break; 38190 } 38191 } 38192 }; 38193 return EvaluatorPreprocessor; 38194}(); 38195 38196/***/ }), 38197/* 28 */ 38198/***/ (function(module, exports, __w_pdfjs_require__) { 38199 38200"use strict"; 38201 38202 38203Object.defineProperty(exports, "__esModule", { 38204 value: true 38205}); 38206exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0; 38207 38208var _util = __w_pdfjs_require__(2); 38209 38210var _primitives = __w_pdfjs_require__(5); 38211 38212var _parser = __w_pdfjs_require__(11); 38213 38214var _core_utils = __w_pdfjs_require__(8); 38215 38216var _stream = __w_pdfjs_require__(12); 38217 38218var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"]; 38219const MAX_MAP_RANGE = 2 ** 24 - 1; 38220 38221class CMap { 38222 constructor(builtInCMap = false) { 38223 this.codespaceRanges = [[], [], [], []]; 38224 this.numCodespaceRanges = 0; 38225 this._map = []; 38226 this.name = ""; 38227 this.vertical = false;
vendor: 1,875 bytes, lines 38228-38322
38228 this.useCMap = null; 38229 this.builtInCMap = builtInCMap; 38230 } 38231 38232 addCodespaceRange(n, low, high) { 38233 this.codespaceRanges[n - 1].push(low, high); 38234 this.numCodespaceRanges++; 38235 } 38236 38237 mapCidRange(low, high, dstLow) { 38238 if (high - low > MAX_MAP_RANGE) { 38239 throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE."); 38240 } 38241 38242 while (low <= high) { 38243 this._map[low++] = dstLow++; 38244 } 38245 } 38246 38247 mapBfRange(low, high, dstLow) { 38248 if (high - low > MAX_MAP_RANGE) { 38249 throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE."); 38250 } 38251 38252 var lastByte = dstLow.length - 1; 38253 38254 while (low <= high) { 38255 this._map[low++] = dstLow; 38256 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1); 38257 } 38258 } 38259 38260 mapBfRangeToArray(low, high, array) { 38261 if (high - low > MAX_MAP_RANGE) { 38262 throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."); 38263 } 38264 38265 const ii = array.length; 38266 let i = 0; 38267 38268 while (low <= high && i < ii) { 38269 this._map[low] = array[i++]; 38270 ++low; 38271 } 38272 } 38273 38274 mapOne(src, dst) { 38275 this._map[src] = dst; 38276 } 38277 38278 lookup(code) { 38279 return this._map[code]; 38280 } 38281 38282 contains(code) { 38283 return this._map[code] !== undefined; 38284 } 38285 38286 forEach(callback) { 38287 const map = this._map; 38288 const length = map.length; 38289 38290 if (length <= 0x10000) { 38291 for (let i = 0; i < length; i++) { 38292 if (map[i] !== undefined) { 38293 callback(i, map[i]); 38294 } 38295 } 38296 } else { 38297 for (const i in map) { 38298 callback(i, map[i]); 38299 } 38300 } 38301 } 38302 38303 charCodeOf(value) { 38304 const map = this._map; 38305 38306 if (map.length <= 0x10000) { 38307 return map.indexOf(value); 38308 } 38309 38310 for (const charCode in map) { 38311 if (map[charCode] === value) { 38312 return charCode | 0; 38313 } 38314 } 38315 38316 return -1; 38317 } 38318 38319 getMap() { 38320 return this._map; 38321 } 38322
38323 readCharCode(str, offset, out) { 38324 let c = 0; 38325 const codespaceRanges = this.codespaceRanges; 38326 38327 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 38328 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 38329 const codespaceRange = codespaceRanges[n]; 38330 38331 for (let k = 0, kk = codespaceRange.length; k < kk;) { 38332 const low = codespaceRange[k++]; 38333 const high = codespaceRange[k++]; 38334 38335 if (c >= low && c <= high) { 38336 out.charcode = c; 38337 out.length = n + 1; 38338 return; 38339 } 38340 } 38341 } 38342 38343 out.charcode = 0; 38344 out.length = 1; 38345 } 38346 38347 get length() { 38348 return this._map.length; 38349 } 38350 38351 get isIdentityCMap() { 38352 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 38353 return false; 38354 } 38355 38356 if (this._map.length !== 0x10000) { 38357 return false; 38358 } 38359 38360 for (let i = 0; i < 0x10000; i++) { 38361 if (this._map[i] !== i) { 38362 return false; 38363 } 38364 } 38365 38366 return true; 38367 } 38368 38369} 38370 38371exports.CMap = CMap; 38372 38373class IdentityCMap extends CMap { 38374 constructor(vertical, n) { 38375 super(); 38376 this.vertical = vertical; 38377 this.addCodespaceRange(n, 0, 0xffff); 38378 } 38379 38380 mapCidRange(low, high, dstLow) { 38381 (0, _util.unreachable)("should not call mapCidRange"); 38382 } 38383 38384 mapBfRange(low, high, dstLow) { 38385 (0, _util.unreachable)("should not call mapBfRange"); 38386 } 38387 38388 mapBfRangeToArray(low, high, array) { 38389 (0, _util.unreachable)("should not call mapBfRangeToArray"); 38390 } 38391 38392 mapOne(src, dst) { 38393 (0, _util.unreachable)("should not call mapCidOne"); 38394 } 38395 38396 lookup(code) { 38397 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 38398 } 38399 38400 contains(code) { 38401 return Number.isInteger(code) && code <= 0xffff; 38402 } 38403 38404 forEach(callback) { 38405 for (let i = 0; i <= 0xffff; i++) { 38406 callback(i, i); 38407 } 38408 } 38409 38410 charCodeOf(value) { 38411 return Number.isInteger(value) && value <= 0xffff ? value : -1; 38412 } 38413 38414 getMap() { 38415 const map = new Array(0x10000); 38416 38417 for (let i = 0; i <= 0xffff; i++) { 38418 map[i] = i; 38419 } 38420 38421 return map; 38422 } 38423 38424 get length() { 38425 return 0x10000; 38426 } 38427 38428 get isIdentityCMap() { 38429 (0, _util.unreachable)("should not access .isIdentityCMap"); 38430 } 38431 38432} 38433 38434exports.IdentityCMap = IdentityCMap; 38435 38436var BinaryCMapReader = function BinaryCMapReaderClosure() { 38437 function hexToInt(a, size) { 38438 var n = 0; 38439 38440 for (var i = 0; i <= size; i++) { 38441 n = n << 8 | a[i]; 38442 } 38443 38444 return n >>> 0; 38445 } 38446 38447 function hexToStr(a, size) { 38448 if (size === 1) { 38449 return String.fromCharCode(a[0], a[1]); 38450 } 38451 38452 if (size === 3) { 38453 return String.fromCharCode(a[0], a[1], a[2], a[3]); 38454 } 38455 38456 return String.fromCharCode.apply(null, a.subarray(0, size + 1)); 38457 } 38458 38459 function addHex(a, b, size) { 38460 var c = 0; 38461 38462 for (var i = size; i >= 0; i--) { 38463 c += a[i] + b[i]; 38464 a[i] = c & 255; 38465 c >>= 8; 38466 } 38467 } 38468 38469 function incHex(a, size) { 38470 var c = 1; 38471 38472 for (var i = size; i >= 0 && c > 0; i--) { 38473 c += a[i]; 38474 a[i] = c & 255; 38475 c >>= 8; 38476 } 38477 } 38478 38479 var MAX_NUM_SIZE = 16; 38480 var MAX_ENCODED_NUM_SIZE = 19; 38481 38482 function BinaryCMapStream(data) { 38483 this.buffer = data; 38484 this.pos = 0; 38485 this.end = data.length; 38486 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 38487 } 38488 38489 BinaryCMapStream.prototype = { 38490 readByte() { 38491 if (this.pos >= this.end) { 38492 return -1; 38493 } 38494 38495 return this.buffer[this.pos++]; 38496 }, 38497 38498 readNumber() { 38499 var n = 0; 38500 var last; 38501 38502 do { 38503 var b = this.readByte(); 38504 38505 if (b < 0) { 38506 throw new _util.FormatError("unexpected EOF in bcmap"); 38507 } 38508 38509 last = !(b & 0x80); 38510 n = n << 7 | b & 0x7f; 38511 } while (!last); 38512 38513 return n; 38514 }, 38515 38516 readSigned() { 38517 var n = this.readNumber(); 38518 return n & 1 ? ~(n >>> 1) : n >>> 1; 38519 }, 38520 38521 readHex(num, size) { 38522 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 38523 this.pos += size + 1; 38524 }, 38525 38526 readHexNumber(num, size) { 38527 var last; 38528 var stack = this.tmpBuf, 38529 sp = 0; 38530 38531 do { 38532 var b = this.readByte(); 38533 38534 if (b < 0) { 38535 throw new _util.FormatError("unexpected EOF in bcmap"); 38536 } 38537 38538 last = !(b & 0x80); 38539 stack[sp++] = b & 0x7f; 38540 } while (!last); 38541 38542 var i = size, 38543 buffer = 0, 38544 bufferSize = 0; 38545 38546 while (i >= 0) { 38547 while (bufferSize < 8 && stack.length > 0) { 38548 buffer = stack[--sp] << bufferSize | buffer; 38549 bufferSize += 7; 38550 } 38551 38552 num[i] = buffer & 255; 38553 i--; 38554 buffer >>= 8; 38555 bufferSize -= 8; 38556 } 38557 }, 38558 38559 readHexSigned(num, size) { 38560 this.readHexNumber(num, size); 38561 var sign = num[size] & 1 ? 255 : 0; 38562 var c = 0; 38563 38564 for (var i = 0; i <= size; i++) { 38565 c = (c & 1) << 8 | num[i]; 38566 num[i] = c >> 1 ^ sign; 38567 } 38568 }, 38569 38570 readString() { 38571 var len = this.readNumber(); 38572 var s = ""; 38573 38574 for (var i = 0; i < len; i++) { 38575 s += String.fromCharCode(this.readNumber()); 38576 } 38577 38578 return s; 38579 } 38580 38581 }; 38582 38583 function processBinaryCMap(data, cMap, extend) { 38584 return new Promise(function (resolve, reject) { 38585 var stream = new BinaryCMapStream(data); 38586 var header = stream.readByte(); 38587 cMap.vertical = !!(header & 1); 38588 var useCMap = null; 38589 var start = new Uint8Array(MAX_NUM_SIZE); 38590 var end = new Uint8Array(MAX_NUM_SIZE); 38591 var char = new Uint8Array(MAX_NUM_SIZE);
38592 var charCode = new Uint8Array(MAX_NUM_SIZE); 38593 var tmp = new Uint8Array(MAX_NUM_SIZE); 38594 var code; 38595 var b; 38596 38597 while ((b = stream.readByte()) >= 0) { 38598 var type = b >> 5; 38599 38600 if (type === 7) { 38601 switch (b & 0x1f) { 38602 case 0: 38603 stream.readString(); 38604 break; 38605 38606 case 1: 38607 useCMap = stream.readString(); 38608 break; 38609 } 38610 38611 continue; 38612 } 38613 38614 var sequence = !!(b & 0x10); 38615 var dataSize = b & 15; 38616 38617 if (dataSize + 1 > MAX_NUM_SIZE) { 38618 throw new Error("processBinaryCMap: Invalid dataSize."); 38619 } 38620 38621 var ucs2DataSize = 1; 38622 var subitemsCount = stream.readNumber(); 38623 var i; 38624 38625 switch (type) { 38626 case 0: 38627 stream.readHex(start, dataSize); 38628 stream.readHexNumber(end, dataSize); 38629 addHex(end, start, dataSize); 38630 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 38631 38632 for (i = 1; i < subitemsCount; i++) { 38633 incHex(end, dataSize); 38634 stream.readHexNumber(start, dataSize); 38635 addHex(start, end, dataSize); 38636 stream.readHexNumber(end, dataSize); 38637 addHex(end, start, dataSize); 38638 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 38639 } 38640 38641 break; 38642 38643 case 1: 38644 stream.readHex(start, dataSize); 38645 stream.readHexNumber(end, dataSize); 38646 addHex(end, start, dataSize); 38647 stream.readNumber(); 38648 38649 for (i = 1; i < subitemsCount; i++) { 38650 incHex(end, dataSize); 38651 stream.readHexNumber(start, dataSize); 38652 addHex(start, end, dataSize); 38653 stream.readHexNumber(end, dataSize); 38654 addHex(end, start, dataSize); 38655 stream.readNumber(); 38656 } 38657 38658 break; 38659 38660 case 2: 38661 stream.readHex(char, dataSize); 38662 code = stream.readNumber(); 38663 cMap.mapOne(hexToInt(char, dataSize), code); 38664 38665 for (i = 1; i < subitemsCount; i++) { 38666 incHex(char, dataSize); 38667 38668 if (!sequence) { 38669 stream.readHexNumber(tmp, dataSize); 38670 addHex(char, tmp, dataSize); 38671 } 38672 38673 code = stream.readSigned() + (code + 1); 38674 cMap.mapOne(hexToInt(char, dataSize), code); 38675 } 38676 38677 break; 38678 38679 case 3: 38680 stream.readHex(start, dataSize); 38681 stream.readHexNumber(end, dataSize); 38682 addHex(end, start, dataSize); 38683 code = stream.readNumber(); 38684 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 38685 38686 for (i = 1; i < subitemsCount; i++) { 38687 incHex(end, dataSize); 38688 38689 if (!sequence) { 38690 stream.readHexNumber(start, dataSize); 38691 addHex(start, end, dataSize); 38692 } else { 38693 start.set(end); 38694 } 38695 38696 stream.readHexNumber(end, dataSize); 38697 addHex(end, start, dataSize); 38698 code = stream.readNumber(); 38699 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 38700 } 38701 38702 break; 38703 38704 case 4: 38705 stream.readHex(char, ucs2DataSize); 38706 stream.readHex(charCode, dataSize); 38707 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 38708 38709 for (i = 1; i < subitemsCount; i++) { 38710 incHex(char, ucs2DataSize); 38711 38712 if (!sequence) { 38713 stream.readHexNumber(tmp, ucs2DataSize); 38714 addHex(char, tmp, ucs2DataSize); 38715 } 38716 38717 incHex(charCode, dataSize); 38718 stream.readHexSigned(tmp, dataSize); 38719 addHex(charCode, tmp, dataSize); 38720 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 38721 } 38722 38723 break; 38724 38725 case 5: 38726 stream.readHex(start, ucs2DataSize); 38727 stream.readHexNumber(end, ucs2DataSize); 38728 addHex(end, start, ucs2DataSize); 38729 stream.readHex(charCode, dataSize); 38730 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 38731 38732 for (i = 1; i < subitemsCount; i++) { 38733 incHex(end, ucs2DataSize); 38734 38735 if (!sequence) { 38736 stream.readHexNumber(start, ucs2DataSize); 38737 addHex(start, end, ucs2DataSize); 38738 } else { 38739 start.set(end); 38740 } 38741 38742 stream.readHexNumber(end, ucs2DataSize); 38743 addHex(end, start, ucs2DataSize); 38744 stream.readHex(charCode, dataSize); 38745 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 38746 } 38747 38748 break; 38749 38750 default: 38751 reject(new Error("processBinaryCMap: Unknown type: " + type)); 38752 return; 38753 } 38754 } 38755 38756 if (useCMap) { 38757 resolve(extend(useCMap)); 38758 return; 38759 } 38760 38761 resolve(cMap); 38762 }); 38763 } 38764 38765 function BinaryCMapReader() {} 38766 38767 BinaryCMapReader.prototype = { 38768 process: processBinaryCMap 38769 }; 38770 return BinaryCMapReader; 38771}(); 38772
38773var CMapFactory = function CMapFactoryClosure() { 38774 function strToInt(str) { 38775 var a = 0; 38776 38777 for (var i = 0; i < str.length; i++) { 38778 a = a << 8 | str.charCodeAt(i); 38779 } 38780 38781 return a >>> 0; 38782 } 38783 38784 function expectString(obj) { 38785 if (!(0, _util.isString)(obj)) { 38786 throw new _util.FormatError("Malformed CMap: expected string."); 38787 } 38788 } 38789 38790 function expectInt(obj) { 38791 if (!Number.isInteger(obj)) { 38792 throw new _util.FormatError("Malformed CMap: expected int."); 38793 } 38794 } 38795 38796 function parseBfChar(cMap, lexer) { 38797 while (true) { 38798 var obj = lexer.getObj(); 38799 38800 if ((0, _primitives.isEOF)(obj)) { 38801 break; 38802 } 38803 38804 if ((0, _primitives.isCmd)(obj, "endbfchar")) { 38805 return; 38806 } 38807 38808 expectString(obj); 38809 var src = strToInt(obj); 38810 obj = lexer.getObj(); 38811 expectString(obj); 38812 var dst = obj; 38813 cMap.mapOne(src, dst); 38814 } 38815 } 38816 38817 function parseBfRange(cMap, lexer) { 38818 while (true) { 38819 var obj = lexer.getObj(); 38820 38821 if ((0, _primitives.isEOF)(obj)) { 38822 break; 38823 } 38824 38825 if ((0, _primitives.isCmd)(obj, "endbfrange")) { 38826 return; 38827 } 38828 38829 expectString(obj); 38830 var low = strToInt(obj); 38831 obj = lexer.getObj(); 38832 expectString(obj); 38833 var high = strToInt(obj); 38834 obj = lexer.getObj(); 38835 38836 if (Number.isInteger(obj) || (0, _util.isString)(obj)) { 38837 var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 38838 cMap.mapBfRange(low, high, dstLow); 38839 } else if ((0, _primitives.isCmd)(obj, "[")) { 38840 obj = lexer.getObj(); 38841 var array = []; 38842 38843 while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) { 38844 array.push(obj); 38845 obj = lexer.getObj(); 38846 } 38847 38848 cMap.mapBfRangeToArray(low, high, array); 38849 } else { 38850 break; 38851 } 38852 } 38853 38854 throw new _util.FormatError("Invalid bf range."); 38855 } 38856 38857 function parseCidChar(cMap, lexer) { 38858 while (true) { 38859 var obj = lexer.getObj(); 38860 38861 if ((0, _primitives.isEOF)(obj)) { 38862 break; 38863 } 38864 38865 if ((0, _primitives.isCmd)(obj, "endcidchar")) { 38866 return; 38867 } 38868 38869 expectString(obj); 38870 var src = strToInt(obj); 38871 obj = lexer.getObj(); 38872 expectInt(obj); 38873 var dst = obj; 38874 cMap.mapOne(src, dst); 38875 } 38876 } 38877 38878 function parseCidRange(cMap, lexer) { 38879 while (true) { 38880 var obj = lexer.getObj(); 38881 38882 if ((0, _primitives.isEOF)(obj)) { 38883 break; 38884 } 38885 38886 if ((0, _primitives.isCmd)(obj, "endcidrange")) { 38887 return; 38888 } 38889 38890 expectString(obj); 38891 var low = strToInt(obj); 38892 obj = lexer.getObj(); 38893 expectString(obj); 38894 var high = strToInt(obj); 38895 obj = lexer.getObj(); 38896 expectInt(obj); 38897 var dstLow = obj; 38898 cMap.mapCidRange(low, high, dstLow); 38899 } 38900 } 38901 38902 function parseCodespaceRange(cMap, lexer) { 38903 while (true) { 38904 var obj = lexer.getObj(); 38905 38906 if ((0, _primitives.isEOF)(obj)) { 38907 break; 38908 } 38909 38910 if ((0, _primitives.isCmd)(obj, "endcodespacerange")) { 38911 return; 38912 } 38913 38914 if (!(0, _util.isString)(obj)) { 38915 break; 38916 } 38917 38918 var low = strToInt(obj); 38919 obj = lexer.getObj(); 38920 38921 if (!(0, _util.isString)(obj)) { 38922 break; 38923 } 38924 38925 var high = strToInt(obj); 38926 cMap.addCodespaceRange(obj.length, low, high); 38927 } 38928 38929 throw new _util.FormatError("Invalid codespace range."); 38930 } 38931 38932 function parseWMode(cMap, lexer) { 38933 var obj = lexer.getObj(); 38934 38935 if (Number.isInteger(obj)) { 38936 cMap.vertical = !!obj; 38937 } 38938 } 38939 38940 function parseCMapName(cMap, lexer) { 38941 var obj = lexer.getObj(); 38942 38943 if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) { 38944 cMap.name = obj.name; 38945 } 38946 } 38947 38948 function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 38949 var previous; 38950 var embeddedUseCMap; 38951 38952 objLoop: while (true) { 38953 try { 38954 var obj = lexer.getObj(); 38955 38956 if ((0, _primitives.isEOF)(obj)) { 38957 break; 38958 } else if ((0, _primitives.isName)(obj)) { 38959 if (obj.name === "WMode") { 38960 parseWMode(cMap, lexer); 38961 } else if (obj.name === "CMapName") {
38962 parseCMapName(cMap, lexer); 38963 } 38964 38965 previous = obj; 38966 } else if ((0, _primitives.isCmd)(obj)) { 38967 switch (obj.cmd) { 38968 case "endcmap": 38969 break objLoop; 38970 38971 case "usecmap": 38972 if ((0, _primitives.isName)(previous)) { 38973 embeddedUseCMap = previous.name; 38974 } 38975 38976 break; 38977 38978 case "begincodespacerange": 38979 parseCodespaceRange(cMap, lexer); 38980 break; 38981 38982 case "beginbfchar": 38983 parseBfChar(cMap, lexer); 38984 break; 38985 38986 case "begincidchar": 38987 parseCidChar(cMap, lexer); 38988 break; 38989 38990 case "beginbfrange": 38991 parseBfRange(cMap, lexer); 38992 break; 38993 38994 case "begincidrange": 38995 parseCidRange(cMap, lexer); 38996 break; 38997 } 38998 } 38999 } catch (ex) { 39000 if (ex instanceof _core_utils.MissingDataException) { 39001 throw ex; 39002 } 39003 39004 (0, _util.warn)("Invalid cMap data: " + ex); 39005 continue; 39006 } 39007 } 39008 39009 if (!useCMap && embeddedUseCMap) { 39010 useCMap = embeddedUseCMap; 39011 } 39012 39013 if (useCMap) { 39014 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 39015 } 39016 39017 return Promise.resolve(cMap); 39018 } 39019 39020 function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 39021 return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) { 39022 cMap.useCMap = newCMap; 39023 39024 if (cMap.numCodespaceRanges === 0) { 39025 var useCodespaceRanges = cMap.useCMap.codespaceRanges; 39026 39027 for (var i = 0; i < useCodespaceRanges.length; i++) { 39028 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 39029 } 39030 39031 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 39032 } 39033 39034 cMap.useCMap.forEach(function (key, value) { 39035 if (!cMap.contains(key)) { 39036 cMap.mapOne(key, cMap.useCMap.lookup(key)); 39037 } 39038 }); 39039 return cMap; 39040 }); 39041 } 39042 39043 function createBuiltInCMap(name, fetchBuiltInCMap) { 39044 if (name === "Identity-H") { 39045 return Promise.resolve(new IdentityCMap(false, 2)); 39046 } else if (name === "Identity-V") { 39047 return Promise.resolve(new IdentityCMap(true, 2)); 39048 } 39049 39050 if (!BUILT_IN_CMAPS.includes(name)) { 39051 return Promise.reject(new Error("Unknown CMap name: " + name)); 39052 } 39053 39054 if (!fetchBuiltInCMap) { 39055 return Promise.reject(new Error("Built-in CMap parameters are not provided.")); 39056 } 39057 39058 return fetchBuiltInCMap(name).then(function (data) { 39059 var cMapData = data.cMapData, 39060 compressionType = data.compressionType; 39061 var cMap = new CMap(true); 39062 39063 if (compressionType === _util.CMapCompressionType.BINARY) { 39064 return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) { 39065 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 39066 }); 39067 } 39068 39069 if (compressionType === _util.CMapCompressionType.NONE) { 39070 var lexer = new _parser.Lexer(new _stream.Stream(cMapData)); 39071 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 39072 } 39073 39074 return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported.")); 39075 }); 39076 } 39077 39078 return { 39079 async create(params) { 39080 var encoding = params.encoding; 39081 var fetchBuiltInCMap = params.fetchBuiltInCMap; 39082 var useCMap = params.useCMap; 39083 39084 if ((0, _primitives.isName)(encoding)) { 39085 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 39086 } else if ((0, _primitives.isStream)(encoding)) { 39087 var cMap = new CMap(); 39088 var lexer = new _parser.Lexer(encoding); 39089 return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) { 39090 if (parsedCMap.isIdentityCMap) { 39091 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 39092 } 39093 39094 return parsedCMap; 39095 }); 39096 } 39097 39098 throw new Error("Encoding required."); 39099 } 39100 39101 }; 39102}(); 39103 39104exports.CMapFactory = CMapFactory; 39105 39106/***/ }), 39107/* 29 */ 39108/***/ (function(module, exports, __w_pdfjs_require__) { 39109 39110"use strict"; 39111 39112 39113Object.defineProperty(exports, "__esModule", { 39114 value: true 39115}); 39116exports.getFontType = getFontType;
39117exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0; 39118 39119var _util = __w_pdfjs_require__(2); 39120 39121var _cff_parser = __w_pdfjs_require__(30); 39122 39123var _glyphlist = __w_pdfjs_require__(33); 39124 39125var _encodings = __w_pdfjs_require__(32); 39126 39127var _standard_fonts = __w_pdfjs_require__(34); 39128 39129var _unicode = __w_pdfjs_require__(35); 39130 39131var _core_utils = __w_pdfjs_require__(8); 39132 39133var _font_renderer = __w_pdfjs_require__(36); 39134 39135var _cmap = __w_pdfjs_require__(28); 39136 39137var _stream = __w_pdfjs_require__(12); 39138 39139var _type1_parser = __w_pdfjs_require__(37); 39140 39141const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 39142var PDF_GLYPH_SPACE_UNITS = 1000; 39143var SEAC_ANALYSIS_ENABLED = true; 39144exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED; 39145const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"]; 39146const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"]; 39147var FontFlags = { 39148 FixedPitch: 1, 39149 Serif: 2, 39150 Symbolic: 4, 39151 Script: 8, 39152 Nonsymbolic: 32, 39153 Italic: 64, 39154 AllCap: 65536, 39155 SmallCap: 131072, 39156 ForceBold: 262144 39157}; 39158exports.FontFlags = FontFlags; 39159var MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodce
39159ntered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"]; 39160 39161function adjustWidths(properties) { 39162 if (!properties.fontMatrix) { 39163 return; 39164 } 39165 39166 if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) { 39167 return; 39168 } 39169 39170 var scale = 0.001 / properties.fontMatrix[0]; 39171 var glyphsWidths = properties.widths; 39172 39173 for (var glyph in glyphsWidths) { 39174 glyphsWidths[glyph] *= scale; 39175 } 39176 39177 properties.defaultWidth *= scale; 39178} 39179 39180function adjustToUnicode(properties, builtInEncoding) { 39181 if (properties.hasIncludedToUnicodeMap) { 39182 return; 39183 } 39184 39185 if (properties.hasEncoding) { 39186 return; 39187 } 39188 39189 if (builtInEncoding === properties.defaultEncoding) { 39190 return; 39191 } 39192 39193 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 39194 return; 39195 } 39196 39197 var toUnicode = [], 39198 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 39199 39200 for (var charCode in builtInEncoding) { 39201 var glyphName = builtInEncoding[charCode]; 39202 var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 39203 39204 if (unicode !== -1) { 39205 toUnicode[charCode] = String.fromCharCode(unicode); 39206 } 39207 } 39208 39209 properties.toUnicode.amend(toUnicode); 39210} 39211 39212function getFontType(type, subtype) { 39213 switch (type) { 39214 case "Type1": 39215 return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1; 39216 39217 case "CIDFontType0": 39218 return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0; 39219 39220 case "OpenType": 39221 return _util.FontType.OPENTYPE; 39222 39223 case "TrueType": 39224 return _util.FontType.TRUETYPE; 39225 39226 case "CIDFontType2": 39227 return _util.FontType.CIDFONTTYPE2; 39228 39229 case "MMType1": 39230 return _util.FontType.MMTYPE1; 39231 39232 case "Type0": 39233 return _util.FontType.TYPE0; 39234 39235 default: 39236 return _util.FontType.UNKNOWN; 39237 } 39238} 39239 39240function recoverGlyphName(name, glyphsUnicodeMap) { 39241 if (glyphsUnicodeMap[name] !== undefined) { 39242 return name; 39243 } 39244 39245 var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap); 39246 39247 if (unicode !== -1) { 39248 for (var key in glyphsUnicodeMap) { 39249 if (glyphsUnicodeMap[key] === unicode) { 39250 return key; 39251 } 39252 } 39253 } 39254 39255 (0, _util.info)("Unable to recover a standard glyph name for: " + name); 39256 return name; 39257} 39258 39259var Glyph = function GlyphClosure() { 39260 function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 39261 this.fontChar = fontChar; 39262 this.unicode = unicode; 39263 this.accent = accent; 39264 this.width = width; 39265 this.vmetric = vmetric; 39266 this.operatorListId = operatorListId; 39267 this.isSpace = isSpace; 39268 this.isInFont = isInFont; 39269 } 39270 39271 Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 39272 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; 39273 }; 39274 39275 return Glyph; 39276}(); 39277 39278var ToUnicodeMap = function ToUnicodeMapClosure() { 39279 function ToUnicodeMap(cmap = []) { 39280 this._map = cmap; 39281 } 39282 39283 ToUnicodeMap.prototype = { 39284 get length() { 39285 return this._map.length; 39286 }, 39287 39288 forEach(callback) { 39289 for (var charCode in this._map) { 39290 callback(charCode, this._map[charCode].charCodeAt(0)); 39291 } 39292 }, 39293 39294 has(i) { 39295 return this._map[i] !== undefined; 39296 }, 39297 39298 get(i) { 39299 return this._map[i]; 39300 }, 39301
39302 charCodeOf(value) { 39303 const map = this._map; 39304 39305 if (map.length <= 0x10000) { 39306 return map.indexOf(value); 39307 } 39308 39309 for (const charCode in map) { 39310 if (map[charCode] === value) { 39311 return charCode | 0; 39312 } 39313 } 39314 39315 return -1; 39316 }, 39317 39318 amend(map) { 39319 for (var charCode in map) { 39320 this._map[charCode] = map[charCode]; 39321 } 39322 } 39323 39324 }; 39325 return ToUnicodeMap; 39326}(); 39327 39328exports.ToUnicodeMap = ToUnicodeMap; 39329 39330var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() { 39331 function IdentityToUnicodeMap(firstChar, lastChar) { 39332 this.firstChar = firstChar; 39333 this.lastChar = lastChar; 39334 } 39335 39336 IdentityToUnicodeMap.prototype = { 39337 get length() { 39338 return this.lastChar + 1 - this.firstChar; 39339 }, 39340 39341 forEach(callback) { 39342 for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 39343 callback(i, i); 39344 } 39345 }, 39346 39347 has(i) { 39348 return this.firstChar <= i && i <= this.lastChar; 39349 }, 39350 39351 get(i) { 39352 if (this.firstChar <= i && i <= this.lastChar) { 39353 return String.fromCharCode(i); 39354 } 39355 39356 return undefined; 39357 }, 39358 39359 charCodeOf(v) { 39360 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 39361 }, 39362 39363 amend(map) { 39364 (0, _util.unreachable)("Should not call amend()"); 39365 } 39366 39367 }; 39368 return IdentityToUnicodeMap; 39369}(); 39370 39371exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 39372 39373var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() { 39374 function writeInt16(dest, offset, num) { 39375 dest[offset] = num >> 8 & 0xff; 39376 dest[offset + 1] = num & 0xff; 39377 } 39378 39379 function writeInt32(dest, offset, num) { 39380 dest[offset] = num >> 24 & 0xff; 39381 dest[offset + 1] = num >> 16 & 0xff; 39382 dest[offset + 2] = num >> 8 & 0xff; 39383 dest[offset + 3] = num & 0xff; 39384 } 39385 39386 function writeData(dest, offset, data) { 39387 var i, ii; 39388 39389 if (data instanceof Uint8Array) { 39390 dest.set(data, offset); 39391 } else if (typeof data === "string") { 39392 for (i = 0, ii = data.length; i < ii; i++) { 39393 dest[offset++] = data.charCodeAt(i) & 0xff; 39394 } 39395 } else { 39396 for (i = 0, ii = data.length; i < ii; i++) { 39397 dest[offset++] = data[i] & 0xff; 39398 } 39399 } 39400 } 39401 39402 function OpenTypeFileBuilder(sfnt) { 39403 this.sfnt = sfnt; 39404 this.tables = Object.create(null); 39405 } 39406 39407 OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) { 39408 var maxPower2 = 1, 39409 log2 = 0; 39410 39411 while ((maxPower2 ^ entriesCount) > maxPower2) { 39412 maxPower2 <<= 1; 39413 log2++; 39414 } 39415 39416 var searchRange = maxPower2 * entrySize; 39417 return { 39418 range: searchRange, 39419 entry: log2, 39420 rangeShift: entrySize * entriesCount - searchRange 39421 }; 39422 }; 39423 39424 var OTF_HEADER_SIZE = 12; 39425 var OTF_TABLE_ENTRY_SIZE = 16; 39426 OpenTypeFileBuilder.prototype = { 39427 toArray: function OpenTypeFileBuilder_toArray() { 39428 var sfnt = this.sfnt; 39429 var tables = this.tables; 39430 var tablesNames = Object.keys(tables); 39431 tablesNames.sort(); 39432 var numTables = tablesNames.length; 39433 var i, j, jj, table, tableName; 39434 var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 39435 var tableOffsets = [offset]; 39436 39437 for (i = 0; i < numTables; i++) { 39438 table = tables[tablesNames[i]]; 39439 var paddedLength = (table.length + 3 & ~3) >>> 0; 39440 offset += paddedLength; 39441 tableOffsets.push(offset); 39442 } 39443 39444 var file = new Uint8Array(offset); 39445 39446 for (i = 0; i < numTables; i++) { 39447 table = tables[tablesNames[i]]; 39448 writeData(file, tableOffsets[i], table); 39449 } 39450 39451 if (sfnt === "true") { 39452 sfnt = (0, _util.string32)(0x00010000); 39453 } 39454 39455 file[0] = sfnt.charCodeAt(0) & 0xff; 39456 file[1] = sfnt.charCodeAt(1) & 0xff; 39457 file[2] = sfnt.charCodeAt(2) & 0xff;
39458 file[3] = sfnt.charCodeAt(3) & 0xff; 39459 writeInt16(file, 4, numTables); 39460 var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 39461 writeInt16(file, 6, searchParams.range); 39462 writeInt16(file, 8, searchParams.entry); 39463 writeInt16(file, 10, searchParams.rangeShift); 39464 offset = OTF_HEADER_SIZE; 39465 39466 for (i = 0; i < numTables; i++) { 39467 tableName = tablesNames[i]; 39468 file[offset] = tableName.charCodeAt(0) & 0xff; 39469 file[offset + 1] = tableName.charCodeAt(1) & 0xff; 39470 file[offset + 2] = tableName.charCodeAt(2) & 0xff; 39471 file[offset + 3] = tableName.charCodeAt(3) & 0xff; 39472 var checksum = 0; 39473 39474 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 39475 var quad = (0, _core_utils.readUint32)(file, j); 39476 checksum = checksum + quad >>> 0; 39477 } 39478 39479 writeInt32(file, offset + 4, checksum); 39480 writeInt32(file, offset + 8, tableOffsets[i]); 39481 writeInt32(file, offset + 12, tables[tableName].length); 39482 offset += OTF_TABLE_ENTRY_SIZE; 39483 } 39484 39485 return file; 39486 }, 39487 addTable: function OpenTypeFileBuilder_addTable(tag, data) { 39488 if (tag in this.tables) { 39489 throw new Error("Table " + tag + " already exists"); 39490 } 39491 39492 this.tables[tag] = data; 39493 } 39494 }; 39495 return OpenTypeFileBuilder; 39496}(); 39497 39498var Font = function FontClosure() { 39499 function Font(name, file, properties) { 39500 var charCode; 39501 this.name = name; 39502 this.loadedName = properties.loadedName; 39503 this.isType3Font = properties.isType3Font; 39504 this.missingFile = false; 39505 this.glyphCache = Object.create(null); 39506 this.isSerifFont = !!(properties.flags & FontFlags.Serif); 39507 this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 39508 this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); 39509 var type = properties.type; 39510 var subtype = properties.subtype; 39511 this.type = type; 39512 this.subtype = subtype; 39513 let fallbackName = "sans-serif"; 39514 39515 if (this.isMonospace) { 39516 fallbackName = "monospace"; 39517 } else if (this.isSerifFont) { 39518 fallbackName = "serif"; 39519 } 39520 39521 this.fallbackName = fallbackName; 39522 this.differences = properties.differences; 39523 this.widths = properties.widths; 39524 this.defaultWidth = properties.defaultWidth; 39525 this.composite = properties.composite; 39526 this.cMap = properties.cMap; 39527 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 39528 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 39529 this.fontMatrix = properties.fontMatrix; 39530 this.bbox = properties.bbox; 39531 this.defaultEncoding = properties.defaultEncoding; 39532 this.toUnicode = properties.toUnicode; 39533 this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap(); 39534 this.toFontChar = []; 39535 39536 if (properties.type === "Type3") { 39537 for (charCode = 0; charCode < 256; charCode++) { 39538 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 39539 } 39540 39541 this.fontType = _util.FontType.TYPE3; 39542 return; 39543 } 39544 39545 this.cidEncoding = properties.cidEncoding; 39546 this.vertical = !!properties.vertical; 39547 39548 if (this.vertical) { 39549 this.vmetrics = properties.vmetrics; 39550 this.defaultVMetrics = properties.defaultVMetrics; 39551 } 39552 39553 if (!file || file.isEmpty) { 39554 if (file) { 39555 (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 39556 } 39557 39558 this.fallbackToSystemFont(); 39559 return; 39560 } 39561 39562 [type, subtype] = getFontFileType(file, properties); 39563 39564 if (type !== this.type || subtype !== this.subtype) { 39565 (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 39566 } 39567 39568 try { 39569 var data; 39570 39571 switch (type) { 39572 case "MMType1": 39573 (0, _util.info)("MMType1 font (" + name + "), falling back to Type1."); 39574 39575 case "Type1": 39576 case "CIDFontType0": 39577 this.mimetype = "font/opentype"; 39578 var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties); 39579 adjustWidths(properties); 39580 data = this.convert(name, cff, properties); 39581 break; 39582 39583 case "OpenType": 39584 case "TrueType": 39585 case "CIDFontType2": 39586 this.mimetype = "font/opentype"; 39587 data = this.checkAndRepair(name, file, properties); 39588 39589 if (this.isOpenType) { 39590 adjustWidths(properties); 39591 type = "OpenType"; 39592 } 39593 39594 break; 39595 39596 default: 39597 throw new _util.FormatError(`Font ${type} is not supported`); 39598 } 39599 } catch (e) { 39600 (0, _util.warn)(e); 39601 this.fallbackToSystemFont(); 39602 return; 39603 } 39604 39605 this.data = data; 39606 this.fontType = getFontType(type, subtype); 39607 this.fontMatrix = properties.fontMatrix; 39608 this.widths = properties.widths; 39609 this.defaultWidth = properties.defaultWidth; 39610 this.toUnicode = properties.toUnicode; 39611 this.seacMap = properties.seacMap; 39612 } 39613 39614 Font.getFontID = function () { 39615 var ID = 1; 39616 return function Font_getFontID() { 39617 return String(ID++); 39618 }; 39619 }(); 39620 39621 function int16(b0, b1) { 39622 return (b0 << 8) + b1; 39623 } 39624 39625 function writeSignedInt16(bytes, index, value) { 39626 bytes[index + 1] = value; 39627 bytes[index] = value >>> 8; 39628 } 39629 39630 function signedInt16(b0, b1) { 39631 var value = (b0 << 8) + b1; 39632 return value & 1 << 15 ? value - 0x10000 : value; 39633 } 39634 39635 function int32(b0, b1, b2, b3) { 39636 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 39637 } 39638 39639 function string16(value) { 39640 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 39641 } 39642 39643 function safeString16(value) { 39644 if (value > 0x7fff) { 39645 value = 0x7fff; 39646 } else if (value < -0x8000) { 39647 value = -0x8000; 39648 } 39649 39650 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 39651 } 39652 39653 function isTrueTypeFile(file) { 39654 var header = file.peekBytes(4); 39655 return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true"; 39656 } 39657 39658 function isTrueTypeCollectionFile(file) { 39659 const header = file.peekBytes(4); 39660 return (0, _util.bytesToString)(header) === "ttcf"; 39661 } 39662 39663 function isOpenTypeFile(file) { 39664 var header = file.peekBytes(4); 39665 return (0, _util.bytesToString)(header) === "OTTO"; 39666 } 39667 39668 function isType1File(file) { 39669 var header = file.peekBytes(2); 39670 39671 if (header[0] === 0x25 && header[1] === 0x21) { 39672 return true; 39673 } 39674 39675 if (header[0] === 0x80 && header[1] === 0x01) { 39676 return true; 39677 } 39678 39679 return false;
39680 } 39681 39682 function isCFFFile(file) { 39683 const header = file.peekBytes(4); 39684 39685 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 39686 return true; 39687 } 39688 39689 return false; 39690 } 39691 39692 function getFontFileType(file, { 39693 type, 39694 subtype, 39695 composite 39696 }) { 39697 let fileType, fileSubtype; 39698 39699 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 39700 if (composite) { 39701 fileType = "CIDFontType2"; 39702 } else { 39703 fileType = "TrueType"; 39704 } 39705 } else if (isOpenTypeFile(file)) { 39706 if (composite) { 39707 fileType = "CIDFontType2"; 39708 } else { 39709 fileType = "OpenType"; 39710 } 39711 } else if (isType1File(file)) { 39712 if (composite) { 39713 fileType = "CIDFontType0"; 39714 } else { 39715 fileType = type === "MMType1" ? "MMType1" : "Type1"; 39716 } 39717 } else if (isCFFFile(file)) { 39718 if (composite) { 39719 fileType = "CIDFontType0"; 39720 fileSubtype = "CIDFontType0C"; 39721 } else { 39722 fileType = type === "MMType1" ? "MMType1" : "Type1"; 39723 fileSubtype = "Type1C"; 39724 } 39725 } else { 39726 (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype."); 39727 fileType = type; 39728 fileSubtype = subtype; 39729 } 39730 39731 return [fileType, fileSubtype]; 39732 } 39733 39734 function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 39735 var toFontChar = [], 39736 unicode; 39737 39738 for (var i = 0, ii = encoding.length; i < ii; i++) { 39739 unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap); 39740 39741 if (unicode !== -1) { 39742 toFontChar[i] = unicode; 39743 } 39744 } 39745 39746 for (var charCode in differences) { 39747 unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap); 39748 39749 if (unicode !== -1) { 39750 toFontChar[+charCode] = unicode; 39751 } 39752 } 39753 39754 return toFontChar; 39755 } 39756 39757 function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) { 39758 var newMap = Object.create(null); 39759 var toFontChar = []; 39760 var privateUseAreaIndex = 0; 39761 var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 39762 var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 39763 39764 for (var originalCharCode in charCodeToGlyphId) { 39765 originalCharCode |= 0; 39766 var glyphId = charCodeToGlyphId[originalCharCode]; 39767 39768 if (!hasGlyph(glyphId)) { 39769 continue; 39770 } 39771 39772 if (nextAvailableFontCharCode > privateUseOffetEnd) { 39773 privateUseAreaIndex++; 39774 39775 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 39776 (0, _util.warn)("Ran out of space in font private use area."); 39777 break; 39778 } 39779 39780 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 39781 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 39782 } 39783 39784 var fontCharCode = nextAvailableFontCharCode++; 39785 39786 if (glyphId === 0) { 39787 glyphId = newGlyphZeroId; 39788 } 39789 39790 newMap[fontCharCode] = glyphId; 39791 toFontChar[originalCharCode] = fontCharCode; 39792 } 39793 39794 return { 39795 toFontChar, 39796 charCodeToGlyphId: newMap, 39797 nextAvailableFontCharCode 39798 }; 39799 } 39800 39801 function getRanges(glyphs, numGlyphs) { 39802 var codes = []; 39803 39804 for (var charCode in glyphs) { 39805 if (glyphs[charCode] >= numGlyphs) { 39806 continue; 39807 } 39808 39809 codes.push({ 39810 fontCharCode: charCode | 0, 39811 glyphId: glyphs[charCode] 39812 }); 39813 } 39814 39815 if (codes.length === 0) { 39816 codes.push({ 39817 fontCharCode: 0, 39818 glyphId: 0 39819 }); 39820 } 39821 39822 codes.sort(function fontGetRangesSort(a, b) { 39823 return a.fontCharCode - b.fontCharCode; 39824 }); 39825 var ranges = []; 39826 var length = codes.length; 39827 39828 for (var n = 0; n < length;) { 39829 var start = codes[n].fontCharCode; 39830 var codeIndices = [codes[n].glyphId]; 39831 ++n; 39832 var end = start; 39833 39834 while (n < length && end + 1 === codes[n].fontCharCode) { 39835 codeIndices.push(codes[n].glyphId); 39836 ++end; 39837 ++n; 39838 39839 if (end === 0xffff) { 39840 break; 39841 } 39842 } 39843 39844 ranges.push([start, end, codeIndices]); 39845 } 39846 39847 return ranges; 39848 } 39849 39850 function createCmapTable(glyphs, numGlyphs) { 39851 var ranges = getRanges(glyphs, numGlyphs); 39852 var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1; 39853 var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8); 39854 var i, ii, j, jj; 39855 39856 for (i = ranges.length - 1; i >= 0; --i) { 39857 if (ranges[i][0] <= 0xffff) { 39858 break; 39859 } 39860 } 39861 39862 var bmpLength = i + 1; 39863 39864 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 39865 ranges[i][1] = 0xfffe; 39866 } 39867 39868 var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 39869 var segCount = bmpLength + trailingRangesCount; 39870 var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); 39871 var startCount = ""; 39872 var endCount = ""; 39873 var idDeltas = ""; 39874 var idRangeOffsets = ""; 39875 var glyphsIds = ""; 39876 var bias = 0; 39877 var range, start, end, codes; 39878 39879 for (i = 0, ii = bmpLength; i < ii; i++) { 39880 range = ranges[i]; 39881 start = range[0]; 39882 end = range[1]; 39883 startCount += string16(start); 39884 endCount += string16(end); 39885 codes = range[2]; 39886 var contiguous = true; 39887 39888 for (j = 1, jj = codes.length; j < jj; ++j) { 39889 if (codes[j] !== codes[j - 1] + 1) { 39890 contiguous = false;
39891 break; 39892 } 39893 } 39894 39895 if (!contiguous) { 39896 var offset = (segCount - i) * 2 + bias * 2; 39897 bias += end - start + 1; 39898 idDeltas += string16(0); 39899 idRangeOffsets += string16(offset); 39900 39901 for (j = 0, jj = codes.length; j < jj; ++j) { 39902 glyphsIds += string16(codes[j]); 39903 } 39904 } else { 39905 var startCode = codes[0]; 39906 idDeltas += string16(startCode - start & 0xffff); 39907 idRangeOffsets += string16(0); 39908 } 39909 } 39910 39911 if (trailingRangesCount > 0) { 39912 endCount += "\xFF\xFF"; 39913 startCount += "\xFF\xFF"; 39914 idDeltas += "\x00\x01"; 39915 idRangeOffsets += "\x00\x00"; 39916 } 39917 39918 var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; 39919 var format31012 = ""; 39920 var header31012 = ""; 39921 39922 if (numTables > 1) { 39923 cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length); 39924 format31012 = ""; 39925 39926 for (i = 0, ii = ranges.length; i < ii; i++) { 39927 range = ranges[i]; 39928 start = range[0]; 39929 codes = range[2]; 39930 var code = codes[0]; 39931 39932 for (j = 1, jj = codes.length; j < jj; ++j) { 39933 if (codes[j] !== codes[j - 1] + 1) { 39934 end = range[0] + j - 1; 39935 format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code); 39936 start = end + 1; 39937 code = codes[j]; 39938 } 39939 } 39940 39941 format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code); 39942 } 39943 39944 header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12); 39945 } 39946 39947 return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; 39948 } 39949 39950 function validateOS2Table(os2, file) { 39951 file.pos = (file.start || 0) + os2.offset; 39952 var version = file.getUint16(); 39953 file.skip(60); 39954 var selection = file.getUint16(); 39955 39956 if (version < 4 && selection & 0x0300) { 39957 return false; 39958 } 39959 39960 var firstChar = file.getUint16(); 39961 var lastChar = file.getUint16(); 39962 39963 if (firstChar > lastChar) { 39964 return false; 39965 } 39966 39967 file.skip(6); 39968 var usWinAscent = file.getUint16(); 39969 39970 if (usWinAscent === 0) { 39971 return false; 39972 } 39973 39974 os2.data[8] = os2.data[9] = 0; 39975 return true; 39976 } 39977 39978 function createOS2Table(properties, charstrings, override) { 39979 override = override || { 39980 unitsPerEm: 0, 39981 yMax: 0, 39982 yMin: 0, 39983 ascent: 0, 39984 descent: 0 39985 }; 39986 var ulUnicodeRange1 = 0; 39987 var ulUnicodeRange2 = 0; 39988 var ulUnicodeRange3 = 0; 39989 var ulUnicodeRange4 = 0; 39990 var firstCharIndex = null; 39991 var lastCharIndex = 0; 39992 39993 if (charstrings) { 39994 for (var code in charstrings) { 39995 code |= 0; 39996 39997 if (firstCharIndex > code || !firstCharIndex) { 39998 firstCharIndex = code; 39999 } 40000 40001 if (lastCharIndex < code) { 40002 lastCharIndex = code; 40003 } 40004 40005 var position = (0, _unicode.getUnicodeRangeFor)(code); 40006 40007 if (position < 32) { 40008 ulUnicodeRange1 |= 1 << position; 40009 } else if (position < 64) { 40010 ulUnicodeRange2 |= 1 << position - 32; 40011 } else if (position < 96) { 40012 ulUnicodeRange3 |= 1 << position - 64; 40013 } else if (position < 123) { 40014 ulUnicodeRange4 |= 1 << position - 96; 40015 } else { 40016 throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 40017 } 40018 } 40019 40020 if (lastCharIndex > 0xffff) { 40021 lastCharIndex = 0xffff; 40022 } 40023 } else { 40024 firstCharIndex = 0; 40025 lastCharIndex = 255; 40026 } 40027 40028 var bbox = properties.bbox || [0, 0, 0, 0]; 40029 var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 40030 var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 40031 var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 40032 var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 40033 40034 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 40035 typoDescent = -typoDescent; 40036 } 40037 40038 var winAscent = override.yMax || typoAscent; 40039 var winDescent = -override.yMin || -typoDescent; 40040 return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03"; 40041 } 40042 40043 function createPostTable(properties) { 40044 var angle = Math.floor(properties.italicAngle * 2 ** 16); 40045 return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00"; 40046 } 40047 40048 function createNameTable(name, proto) { 40049 if (!proto) { 40050 proto = [[], []]; 40051 } 40052 40053 var strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || "", proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"]; 40054 var stringsUnicode = []; 40055 var i, ii, j, jj, str; 40056 40057 for (i = 0, ii = strings.length; i < ii; i++) { 40058 str = proto[1][i] || strings[i]; 40059 var strBufUnicode = []; 40060 40061 for (j = 0, jj = str.length; j < jj; j++) { 40062 strBufUnicode.push(string16(str.charCodeAt(j))); 40063 } 40064
40065 stringsUnicode.push(strBufUnicode.join("")); 40066 } 40067 40068 var names = [strings, stringsUnicode]; 40069 var platforms = ["\x00\x01", "\x00\x03"]; 40070 var encodings = ["\x00\x00", "\x00\x01"]; 40071 var languages = ["\x00\x00", "\x04\x09"]; 40072 var namesRecordCount = strings.length * platforms.length; 40073 var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 40074 var strOffset = 0; 40075 40076 for (i = 0, ii = platforms.length; i < ii; i++) { 40077 var strs = names[i]; 40078 40079 for (j = 0, jj = strs.length; j < jj; j++) { 40080 str = strs[j]; 40081 var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 40082 nameTable += nameRecord; 40083 strOffset += str.length; 40084 } 40085 } 40086 40087 nameTable += strings.join("") + stringsUnicode.join(""); 40088 return nameTable; 40089 } 40090 40091 Font.prototype = { 40092 name: null, 40093 font: null, 40094 mimetype: null, 40095 disableFontFace: false, 40096 40097 get renderer() { 40098 var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED); 40099 40100 return (0, _util.shadow)(this, "renderer", renderer); 40101 }, 40102 40103 exportData(extraProperties = false) { 40104 const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES; 40105 const data = Object.create(null); 40106 let property, value; 40107 40108 for (property of exportDataProperties) { 40109 value = this[property]; 40110 40111 if (value !== undefined) { 40112 data[property] = value; 40113 } 40114 } 40115 40116 return data; 40117 }, 40118 40119 fallbackToSystemFont: function Font_fallbackToSystemFont() { 40120 this.missingFile = true; 40121 var name = this.name; 40122 var type = this.type; 40123 var subtype = this.subtype; 40124 let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, ""); 40125 var stdFontMap = (0, _standard_fonts.getStdFontMap)(), 40126 nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); 40127 var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 40128 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 40129 this.bold = fontName.search(/bold/gi) !== -1; 40130 this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; 40131 this.black = name.search(/Black/g) !== -1; 40132 this.remeasure = Object.keys(this.widths).length > 0; 40133 40134 if (isStandardFont && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 40135 const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(); 40136 const map = []; 40137 40138 for (const charCode in GlyphMapForStandardFonts) { 40139 map[+charCode] = GlyphMapForStandardFonts[charCode]; 40140 } 40141 40142 if (/Arial-?Black/i.test(name)) { 40143 var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)(); 40144 40145 for (const charCode in SupplementalGlyphMapForArialBlack) { 40146 map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; 40147 } 40148 } else if (/Calibri/i.test(name)) { 40149 const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)(); 40150 40151 for (const charCode in SupplementalGlyphMapForCalibri) { 40152 map[+charCode] = SupplementalGlyphMapForCalibri[charCode]; 40153 } 40154 } 40155 40156 var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; 40157 40158 if (!isIdentityUnicode) { 40159 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 40160 map[+charCode] = unicodeCharCode; 40161 }); 40162 } 40163 40164 this.toFontChar = map; 40165 this.toUnicode = new ToUnicodeMap(map); 40166 } else if (/Symbol/i.test(fontName)) { 40167 this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 40168 } else if (/Dingbats/i.test(fontName)) { 40169 if (/Wingdings/i.test(name)) { 40170 (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats."); 40171 } 40172 40173 this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences); 40174 } else if (isStandardFont) { 40175 this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 40176 } else { 40177 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 40178 const map = []; 40179 this.toUnicode.forEach((charCode, unicodeCharCode) => { 40180 if (!this.composite) { 40181 var glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 40182 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 40183 40184 if (unicode !== -1) { 40185 unicodeCharCode = unicode; 40186 } 40187 } 40188
40189 map[+charCode] = unicodeCharCode; 40190 }); 40191 40192 if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) { 40193 if (/Verdana/i.test(name)) { 40194 const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(); 40195 40196 for (const charCode in GlyphMapForStandardFonts) { 40197 map[+charCode] = GlyphMapForStandardFonts[charCode]; 40198 } 40199 } 40200 } 40201 40202 this.toFontChar = map; 40203 } 40204 40205 this.loadedName = fontName.split("-")[0]; 40206 this.fontType = getFontType(type, subtype); 40207 }, 40208 checkAndRepair: function Font_checkAndRepair(name, font, properties) { 40209 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 40210 40211 function readTables(file, numTables) { 40212 const tables = Object.create(null); 40213 tables["OS/2"] = null; 40214 tables.cmap = null; 40215 tables.head = null; 40216 tables.hhea = null; 40217 tables.hmtx = null; 40218 tables.maxp = null; 40219 tables.name = null; 40220 tables.post = null; 40221 40222 for (let i = 0; i < numTables; i++) { 40223 const table = readTableEntry(file); 40224 40225 if (!VALID_TABLES.includes(table.tag)) { 40226 continue; 40227 } 40228 40229 if (table.length === 0) { 40230 continue; 40231 } 40232 40233 tables[table.tag] = table; 40234 } 40235 40236 return tables; 40237 } 40238 40239 function readTableEntry(file) { 40240 var tag = (0, _util.bytesToString)(file.getBytes(4)); 40241 var checksum = file.getInt32() >>> 0; 40242 var offset = file.getInt32() >>> 0; 40243 var length = file.getInt32() >>> 0; 40244 var previousPosition = file.pos; 40245 file.pos = file.start ? file.start : 0; 40246 file.skip(offset); 40247 var data = file.getBytes(length); 40248 file.pos = previousPosition; 40249 40250 if (tag === "head") { 40251 data[8] = data[9] = data[10] = data[11] = 0; 40252 data[17] |= 0x20; 40253 } 40254 40255 return { 40256 tag, 40257 checksum, 40258 length, 40259 offset, 40260 data 40261 }; 40262 } 40263 40264 function readOpenTypeHeader(ttf) { 40265 return { 40266 version: (0, _util.bytesToString)(ttf.getBytes(4)), 40267 numTables: ttf.getUint16(), 40268 searchRange: ttf.getUint16(), 40269 entrySelector: ttf.getUint16(), 40270 rangeShift: ttf.getUint16() 40271 }; 40272 } 40273 40274 function readTrueTypeCollectionHeader(ttc) { 40275 const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4)); 40276 (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font."); 40277 const majorVersion = ttc.getUint16(); 40278 const minorVersion = ttc.getUint16(); 40279 const numFonts = ttc.getInt32() >>> 0; 40280 const offsetTable = []; 40281 40282 for (let i = 0; i < numFonts; i++) { 40283 offsetTable.push(ttc.getInt32() >>> 0); 40284 } 40285 40286 const header = { 40287 ttcTag, 40288 majorVersion, 40289 minorVersion, 40290 numFonts, 40291 offsetTable 40292 }; 40293 40294 switch (majorVersion) { 40295 case 1: 40296 return header; 40297 40298 case 2: 40299 header.dsigTag = ttc.getInt32() >>> 0; 40300 header.dsigLength = ttc.getInt32() >>> 0; 40301 header.dsigOffset = ttc.getInt32() >>> 0; 40302 return header; 40303 } 40304 40305 throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 40306 } 40307 40308 function readTrueTypeCollectionData(ttc, fontName) { 40309 const { 40310 numFonts, 40311 offsetTable 40312 } = readTrueTypeCollectionHeader(ttc); 40313 40314 for (let i = 0; i < numFonts; i++) { 40315 ttc.pos = (ttc.start || 0) + offsetTable[i]; 40316 const potentialHeader = readOpenTypeHeader(ttc); 40317 const potentialTables = readTables(ttc, potentialHeader.numTables); 40318 40319 if (!potentialTables.name) { 40320 throw new _util.FormatError('TrueType Collection font must contain a "name" table.'); 40321 } 40322 40323 const nameTable = readNameTable(potentialTables.name); 40324 40325 for (let j = 0, jj = nameTable.length; j < jj; j++) { 40326 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 40327 const nameEntry = nameTable[j][k]; 40328 40329 if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) { 40330 return { 40331 header: potentialHeader, 40332 tables: potentialTables 40333 }; 40334 } 40335 } 40336 } 40337 } 40338 40339 throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`); 40340 } 40341 40342 function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { 40343 if (!cmap) { 40344 (0, _util.warn)("No cmap table available."); 40345 return { 40346 platformId: -1, 40347 encodingId: -1, 40348 mappings: [], 40349 hasShortCmap: false 40350 }; 40351 } 40352 40353 var segment; 40354 var start = (file.start ? file.start : 0) + cmap.offset; 40355 file.pos = start; 40356 file.skip(2); 40357 var numTables = file.getUint16(); 40358 var potentialTable; 40359 var canBreak = false;
40360 40361 for (var i = 0; i < numTables; i++) { 40362 var platformId = file.getUint16(); 40363 var encodingId = file.getUint16(); 40364 var offset = file.getInt32() >>> 0; 40365 var useTable = false; 40366 40367 if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) { 40368 continue; 40369 } 40370 40371 if (platformId === 0 && encodingId === 0) { 40372 useTable = true; 40373 } else if (platformId === 1 && encodingId === 0) { 40374 useTable = true; 40375 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 40376 useTable = true; 40377 40378 if (!isSymbolicFont) { 40379 canBreak = true; 40380 } 40381 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 40382 useTable = true; 40383 canBreak = true; 40384 } 40385 40386 if (useTable) { 40387 potentialTable = { 40388 platformId, 40389 encodingId, 40390 offset 40391 }; 40392 } 40393 40394 if (canBreak) { 40395 break; 40396 } 40397 } 40398 40399 if (potentialTable) { 40400 file.pos = start + potentialTable.offset; 40401 } 40402 40403 if (!potentialTable || file.peekByte() === -1) { 40404 (0, _util.warn)("Could not find a preferred cmap table."); 40405 return { 40406 platformId: -1, 40407 encodingId: -1, 40408 mappings: [], 40409 hasShortCmap: false 40410 }; 40411 } 40412 40413 var format = file.getUint16(); 40414 file.skip(2 + 2); 40415 var hasShortCmap = false; 40416 var mappings = []; 40417 var j, glyphId; 40418 40419 if (format === 0) { 40420 for (j = 0; j < 256; j++) { 40421 var index = file.getByte(); 40422 40423 if (!index) { 40424 continue; 40425 } 40426 40427 mappings.push({ 40428 charCode: j, 40429 glyphId: index 40430 }); 40431 } 40432 40433 hasShortCmap = true; 40434 } else if (format === 4) { 40435 var segCount = file.getUint16() >> 1; 40436 file.skip(6); 40437 var segIndex, 40438 segments = []; 40439 40440 for (segIndex = 0; segIndex < segCount; segIndex++) { 40441 segments.push({ 40442 end: file.getUint16() 40443 }); 40444 } 40445 40446 file.skip(2); 40447 40448 for (segIndex = 0; segIndex < segCount; segIndex++) { 40449 segments[segIndex].start = file.getUint16(); 40450 } 40451 40452 for (segIndex = 0; segIndex < segCount; segIndex++) { 40453 segments[segIndex].delta = file.getUint16(); 40454 } 40455 40456 var offsetsCount = 0; 40457 40458 for (segIndex = 0; segIndex < segCount; segIndex++) { 40459 segment = segments[segIndex]; 40460 var rangeOffset = file.getUint16(); 40461 40462 if (!rangeOffset) { 40463 segment.offsetIndex = -1; 40464 continue; 40465 } 40466 40467 var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 40468 segment.offsetIndex = offsetIndex; 40469 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 40470 } 40471 40472 var offsets = []; 40473 40474 for (j = 0; j < offsetsCount; j++) { 40475 offsets.push(file.getUint16()); 40476 } 40477 40478 for (segIndex = 0; segIndex < segCount; segIndex++) { 40479 segment = segments[segIndex]; 40480 start = segment.start; 40481 var end = segment.end; 40482 var delta = segment.delta; 40483 offsetIndex = segment.offsetIndex; 40484 40485 for (j = start; j <= end; j++) { 40486 if (j === 0xffff) { 40487 continue; 40488 } 40489 40490 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 40491 glyphId = glyphId + delta & 0xffff; 40492 mappings.push({ 40493 charCode: j, 40494 glyphId 40495 }); 40496 } 40497 } 40498 } else if (format === 6) { 40499 var firstCode = file.getUint16(); 40500 var entryCount = file.getUint16(); 40501 40502 for (j = 0; j < entryCount; j++) { 40503 glyphId = file.getUint16();
40504 var charCode = firstCode + j; 40505 mappings.push({ 40506 charCode, 40507 glyphId 40508 }); 40509 } 40510 } else { 40511 (0, _util.warn)("cmap table has unsupported format: " + format); 40512 return { 40513 platformId: -1, 40514 encodingId: -1, 40515 mappings: [], 40516 hasShortCmap: false 40517 }; 40518 } 40519 40520 mappings.sort(function (a, b) { 40521 return a.charCode - b.charCode; 40522 }); 40523 40524 for (i = 1; i < mappings.length; i++) { 40525 if (mappings[i - 1].charCode === mappings[i].charCode) { 40526 mappings.splice(i, 1); 40527 i--; 40528 } 40529 } 40530 40531 return { 40532 platformId: potentialTable.platformId, 40533 encodingId: potentialTable.encodingId, 40534 mappings, 40535 hasShortCmap 40536 }; 40537 } 40538 40539 function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) { 40540 if (!header) { 40541 if (metrics) { 40542 metrics.data = null; 40543 } 40544 40545 return; 40546 } 40547 40548 file.pos = (file.start ? file.start : 0) + header.offset; 40549 file.pos += 4; 40550 file.pos += 2; 40551 file.pos += 2; 40552 file.pos += 2; 40553 file.pos += 2; 40554 file.pos += 2; 40555 file.pos += 2; 40556 file.pos += 2; 40557 file.pos += 2; 40558 file.pos += 2; 40559 file.pos += 2; 40560 file.pos += 8; 40561 file.pos += 2; 40562 var numOfMetrics = file.getUint16(); 40563 40564 if (numOfMetrics > numGlyphs) { 40565 (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")"); 40566 numOfMetrics = numGlyphs; 40567 header.data[34] = (numOfMetrics & 0xff00) >> 8; 40568 header.data[35] = numOfMetrics & 0x00ff; 40569 } 40570 40571 var numOfSidebearings = numGlyphs - numOfMetrics; 40572 var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 40573 40574 if (numMissing > 0) { 40575 var entries = new Uint8Array(metrics.length + numMissing * 2); 40576 entries.set(metrics.data); 40577 40578 if (dupFirstEntry) { 40579 entries[metrics.length] = metrics.data[2]; 40580 entries[metrics.length + 1] = metrics.data[3]; 40581 } 40582 40583 metrics.data = entries; 40584 } 40585 } 40586 40587 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 40588 var glyphProfile = { 40589 length: 0, 40590 sizeOfInstructions: 0 40591 }; 40592 40593 if (sourceEnd - sourceStart <= 12) { 40594 return glyphProfile; 40595 } 40596 40597 var glyf = source.subarray(sourceStart, sourceEnd); 40598 var contoursCount = signedInt16(glyf[0], glyf[1]); 40599 40600 if (contoursCount < 0) { 40601 contoursCount = -1; 40602 writeSignedInt16(glyf, 0, contoursCount); 40603 dest.set(glyf, destStart); 40604 glyphProfile.length = glyf.length; 40605 return glyphProfile; 40606 } 40607 40608 var i, 40609 j = 10, 40610 flagsCount = 0; 40611 40612 for (i = 0; i < contoursCount; i++) { 40613 var endPoint = glyf[j] << 8 | glyf[j + 1]; 40614 flagsCount = endPoint + 1; 40615 j += 2; 40616 } 40617 40618 var instructionsStart = j; 40619 var instructionsLength = glyf[j] << 8 | glyf[j + 1]; 40620 glyphProfile.sizeOfInstructions = instructionsLength; 40621 j += 2 + instructionsLength; 40622 var instructionsEnd = j; 40623 var coordinatesLength = 0; 40624 40625 for (i = 0; i < flagsCount; i++) { 40626 var flag = glyf[j++]; 40627 40628 if (flag & 0xc0) { 40629 glyf[j - 1] = flag & 0x3f; 40630 } 40631 40632 let xLength = 2; 40633 40634 if (flag & 2) { 40635 xLength = 1; 40636 } else if (flag & 16) { 40637 xLength = 0; 40638 } 40639 40640 let yLength = 2; 40641 40642 if (flag & 4) { 40643 yLength = 1; 40644 } else if (flag & 32) { 40645 yLength = 0; 40646 } 40647 40648 const xyLength = xLength + yLength; 40649 coordinatesLength += xyLength; 40650 40651 if (flag & 8) { 40652 var repeat = glyf[j++]; 40653 i += repeat;
40654 coordinatesLength += repeat * xyLength; 40655 } 40656 } 40657 40658 if (coordinatesLength === 0) { 40659 return glyphProfile; 40660 } 40661 40662 var glyphDataLength = j + coordinatesLength; 40663 40664 if (glyphDataLength > glyf.length) { 40665 return glyphProfile; 40666 } 40667 40668 if (!hintsValid && instructionsLength > 0) { 40669 dest.set(glyf.subarray(0, instructionsStart), destStart); 40670 dest.set([0, 0], destStart + instructionsStart); 40671 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 40672 glyphDataLength -= instructionsLength; 40673 40674 if (glyf.length - glyphDataLength > 3) { 40675 glyphDataLength = glyphDataLength + 3 & ~3; 40676 } 40677 40678 glyphProfile.length = glyphDataLength; 40679 return glyphProfile; 40680 } 40681 40682 if (glyf.length - glyphDataLength > 3) { 40683 glyphDataLength = glyphDataLength + 3 & ~3; 40684 dest.set(glyf.subarray(0, glyphDataLength), destStart); 40685 glyphProfile.length = glyphDataLength; 40686 return glyphProfile; 40687 } 40688 40689 dest.set(glyf, destStart); 40690 glyphProfile.length = glyf.length; 40691 return glyphProfile; 40692 } 40693 40694 function sanitizeHead(head, numGlyphs, locaLength) { 40695 var data = head.data; 40696 var version = int32(data[0], data[1], data[2], data[3]); 40697 40698 if (version >> 16 !== 1) { 40699 (0, _util.info)("Attempting to fix invalid version in head table: " + version); 40700 data[0] = 0; 40701 data[1] = 1; 40702 data[2] = 0; 40703 data[3] = 0; 40704 } 40705 40706 var indexToLocFormat = int16(data[50], data[51]); 40707 40708 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 40709 (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 40710 var numGlyphsPlusOne = numGlyphs + 1; 40711 40712 if (locaLength === numGlyphsPlusOne << 1) { 40713 data[50] = 0; 40714 data[51] = 0; 40715 } else if (locaLength === numGlyphsPlusOne << 2) { 40716 data[50] = 0; 40717 data[51] = 1; 40718 } else { 40719 throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 40720 } 40721 } 40722 } 40723 40724 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 40725 var itemSize, itemDecode, itemEncode; 40726 40727 if (isGlyphLocationsLong) { 40728 itemSize = 4; 40729 40730 itemDecode = function fontItemDecodeLong(data, offset) { 40731 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 40732 }; 40733 40734 itemEncode = function fontItemEncodeLong(data, offset, value) { 40735 data[offset] = value >>> 24 & 0xff; 40736 data[offset + 1] = value >> 16 & 0xff; 40737 data[offset + 2] = value >> 8 & 0xff; 40738 data[offset + 3] = value & 0xff; 40739 }; 40740 } else { 40741 itemSize = 2; 40742 40743 itemDecode = function fontItemDecode(data, offset) { 40744 return data[offset] << 9 | data[offset + 1] << 1; 40745 }; 40746 40747 itemEncode = function fontItemEncode(data, offset, value) { 40748 data[offset] = value >> 9 & 0xff; 40749 data[offset + 1] = value >> 1 & 0xff; 40750 }; 40751 } 40752 40753 var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 40754 var locaDataSize = itemSize * (1 + numGlyphsOut); 40755 var locaData = new Uint8Array(locaDataSize); 40756 locaData.set(loca.data.subarray(0, locaDataSize)); 40757 loca.data = locaData; 40758 var oldGlyfData = glyf.data; 40759 var oldGlyfDataLength = oldGlyfData.length; 40760 var newGlyfData = new Uint8Array(oldGlyfDataLength); 40761 var startOffset = itemDecode(locaData, 0); 40762 var writeOffset = 0; 40763 var missingGlyphs = Object.create(null); 40764 itemEncode(locaData, 0, writeOffset); 40765 var i, j; 40766 40767 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 40768 var endOffset = itemDecode(locaData, j); 40769 40770 if (endOffset === 0) { 40771 endOffset = startOffset; 40772 } 40773 40774 if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) { 40775 endOffset = oldGlyfDataLength; 40776 } 40777 40778 if (endOffset > oldGlyfDataLength) { 40779 startOffset = endOffset; 40780 } 40781 40782 var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid); 40783 var newLength = glyphProfile.length; 40784 40785 if (newLength === 0) { 40786 missingGlyphs[i] = true; 40787 } 40788
40789 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 40790 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 40791 } 40792 40793 writeOffset += newLength; 40794 itemEncode(locaData, j, writeOffset); 40795 startOffset = endOffset; 40796 } 40797 40798 if (writeOffset === 0) { 40799 var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 40800 40801 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 40802 itemEncode(locaData, j, simpleGlyph.length); 40803 } 40804 40805 glyf.data = simpleGlyph; 40806 } else if (dupFirstEntry) { 40807 var firstEntryLength = itemDecode(locaData, itemSize); 40808 40809 if (newGlyfData.length > firstEntryLength + writeOffset) { 40810 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 40811 } else { 40812 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 40813 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 40814 } 40815 40816 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 40817 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 40818 } else { 40819 glyf.data = newGlyfData.subarray(0, writeOffset); 40820 } 40821 40822 return { 40823 missingGlyphs, 40824 maxSizeOfInstructions 40825 }; 40826 } 40827 40828 function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { 40829 var start = (font.start ? font.start : 0) + post.offset; 40830 font.pos = start; 40831 var length = post.length, 40832 end = start + length; 40833 var version = font.getInt32(); 40834 font.skip(28); 40835 var glyphNames; 40836 var valid = true; 40837 var i; 40838 40839 switch (version) { 40840 case 0x00010000: 40841 glyphNames = MacStandardGlyphOrdering; 40842 break; 40843 40844 case 0x00020000: 40845 var numGlyphs = font.getUint16(); 40846 40847 if (numGlyphs !== maxpNumGlyphs) { 40848 valid = false; 40849 break; 40850 } 40851 40852 var glyphNameIndexes = []; 40853 40854 for (i = 0; i < numGlyphs; ++i) { 40855 var index = font.getUint16(); 40856 40857 if (index >= 32768) { 40858 valid = false; 40859 break; 40860 } 40861 40862 glyphNameIndexes.push(index); 40863 } 40864 40865 if (!valid) { 40866 break; 40867 } 40868 40869 var customNames = []; 40870 var strBuf = []; 40871 40872 while (font.pos < end) { 40873 var stringLength = font.getByte(); 40874 strBuf.length = stringLength; 40875 40876 for (i = 0; i < stringLength; ++i) { 40877 strBuf[i] = String.fromCharCode(font.getByte()); 40878 } 40879 40880 customNames.push(strBuf.join("")); 40881 } 40882 40883 glyphNames = []; 40884 40885 for (i = 0; i < numGlyphs; ++i) { 40886 var j = glyphNameIndexes[i]; 40887 40888 if (j < 258) { 40889 glyphNames.push(MacStandardGlyphOrdering[j]); 40890 continue; 40891 } 40892 40893 glyphNames.push(customNames[j - 258]); 40894 } 40895 40896 break; 40897 40898 case 0x00030000: 40899 break; 40900 40901 default: 40902 (0, _util.warn)("Unknown/unsupported post table version " + version); 40903 valid = false; 40904 40905 if (propertiesObj.defaultEncoding) { 40906 glyphNames = propertiesObj.defaultEncoding; 40907 } 40908 40909 break; 40910 } 40911 40912 propertiesObj.glyphNames = glyphNames; 40913 return valid; 40914 } 40915 40916 function readNameTable(nameTable) { 40917 var start = (font.start ? font.start : 0) + nameTable.offset; 40918 font.pos = start; 40919 var names = [[], []]; 40920 var length = nameTable.length, 40921 end = start + length; 40922 var format = font.getUint16(); 40923 var FORMAT_0_HEADER_LENGTH = 6; 40924 40925 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 40926 return names; 40927 } 40928 40929 var numRecords = font.getUint16(); 40930 var stringsStart = font.getUint16(); 40931 var records = []; 40932 var NAME_RECORD_LENGTH = 12; 40933 var i, ii; 40934 40935 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 40936 var r = { 40937 platform: font.getUint16(), 40938 encoding: font.getUint16(), 40939 language: font.getUint16(), 40940 name: font.getUint16(), 40941 length: font.getUint16(), 40942 offset: font.getUint16() 40943 }; 40944 40945 if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) { 40946 records.push(r); 40947 } 40948 } 40949 40950 for (i = 0, ii = records.length; i < ii; i++) { 40951 var record = records[i]; 40952 40953 if (record.length <= 0) { 40954 continue; 40955 } 40956 40957 var pos = start + stringsStart + record.offset; 40958 40959 if (pos + record.length > end) { 40960 continue; 40961 } 40962 40963 font.pos = pos; 40964 var nameIndex = record.name; 40965 40966 if (record.encoding) { 40967 var str = ""; 40968 40969 for (var j = 0, jj = record.length; j < jj; j += 2) { 40970 str += String.fromCharCode(font.getUint16()); 40971 } 40972 40973 names[1][nameIndex] = str; 40974 } else { 40975 names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(rec
40975ord.length)); 40976 } 40977 } 40978 40979 return names; 40980 } 40981 40982 var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; 40983 40984 function sanitizeTTProgram(table, ttContext) { 40985 var data = table.data; 40986 var i = 0, 40987 j, 40988 n, 40989 b, 40990 funcId, 40991 pc, 40992 lastEndf = 0, 40993 lastDeff = 0; 40994 var stack = []; 40995 var callstack = []; 40996 var functionsCalled = []; 40997 var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 40998 var inFDEF = false, 40999 ifLevel = 0, 41000 inELSE = 0; 41001 41002 for (var ii = data.length; i < ii;) { 41003 var op = data[i++]; 41004 41005 if (op === 0x40) { 41006 n = data[i++]; 41007 41008 if (inFDEF || inELSE) { 41009 i += n; 41010 } else { 41011 for (j = 0; j < n; j++) { 41012 stack.push(data[i++]); 41013 } 41014 } 41015 } else if (op === 0x41) { 41016 n = data[i++]; 41017 41018 if (inFDEF || inELSE) { 41019 i += n * 2; 41020 } else { 41021 for (j = 0; j < n; j++) { 41022 b = data[i++]; 41023 stack.push(b << 8 | data[i++]); 41024 } 41025 } 41026 } else if ((op & 0xf8) === 0xb0) { 41027 n = op - 0xb0 + 1; 41028 41029 if (inFDEF || inELSE) { 41030 i += n; 41031 } else { 41032 for (j = 0; j < n; j++) { 41033 stack.push(data[i++]); 41034 } 41035 } 41036 } else if ((op & 0xf8) === 0xb8) { 41037 n = op - 0xb8 + 1; 41038 41039 if (inFDEF || inELSE) { 41040 i += n * 2; 41041 } else { 41042 for (j = 0; j < n; j++) { 41043 b = data[i++]; 41044 stack.push(b << 8 | data[i++]); 41045 } 41046 } 41047 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 41048 if (!inFDEF && !inELSE) { 41049 funcId = stack[stack.length - 1]; 41050 41051 if (isNaN(funcId)) { 41052 (0, _util.info)("TT: CALL empty stack (or invalid entry)."); 41053 } else { 41054 ttContext.functionsUsed[funcId] = true; 41055 41056 if (funcId in ttContext.functionsStackDeltas) { 41057 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 41058 41059 if (newStackLength < 0) {
vendor: 4,116 bytes, lines 41060-41198
41060 (0, _util.warn)("TT: CALL invalid functions stack delta."); 41061 ttContext.hintsValid = false; 41062 return; 41063 } 41064 41065 stack.length = newStackLength; 41066 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 41067 callstack.push({ 41068 data, 41069 i, 41070 stackTop: stack.length - 1 41071 }); 41072 functionsCalled.push(funcId); 41073 pc = ttContext.functionsDefined[funcId]; 41074 41075 if (!pc) { 41076 (0, _util.warn)("TT: CALL non-existent function"); 41077 ttContext.hintsValid = false; 41078 return; 41079 } 41080 41081 data = pc.data; 41082 i = pc.i; 41083 } 41084 } 41085 } 41086 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 41087 if (inFDEF || inELSE) { 41088 (0, _util.warn)("TT: nested FDEFs not allowed"); 41089 tooComplexToFollowFunctions = true; 41090 } 41091 41092 inFDEF = true; 41093 lastDeff = i; 41094 funcId = stack.pop(); 41095 ttContext.functionsDefined[funcId] = { 41096 data, 41097 i 41098 }; 41099 } else if (op === 0x2d) { 41100 if (inFDEF) { 41101 inFDEF = false; 41102 lastEndf = i; 41103 } else { 41104 pc = callstack.pop(); 41105 41106 if (!pc) { 41107 (0, _util.warn)("TT: ENDF bad stack"); 41108 ttContext.hintsValid = false; 41109 return; 41110 } 41111 41112 funcId = functionsCalled.pop(); 41113 data = pc.data; 41114 i = pc.i; 41115 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 41116 } 41117 } else if (op === 0x89) { 41118 if (inFDEF || inELSE) { 41119 (0, _util.warn)("TT: nested IDEFs not allowed"); 41120 tooComplexToFollowFunctions = true; 41121 } 41122 41123 inFDEF = true; 41124 lastDeff = i; 41125 } else if (op === 0x58) { 41126 ++ifLevel; 41127 } else if (op === 0x1b) { 41128 inELSE = ifLevel; 41129 } else if (op === 0x59) { 41130 if (inELSE === ifLevel) { 41131 inELSE = 0; 41132 } 41133 41134 --ifLevel; 41135 } else if (op === 0x1c) { 41136 if (!inFDEF && !inELSE) { 41137 var offset = stack[stack.length - 1]; 41138 41139 if (offset > 0) { 41140 i += offset - 1; 41141 } 41142 } 41143 } 41144 41145 if (!inFDEF && !inELSE) { 41146 let stackDelta = 0; 41147 41148 if (op <= 0x8e) { 41149 stackDelta = TTOpsStackDeltas[op]; 41150 } else if (op >= 0xc0 && op <= 0xdf) { 41151 stackDelta = -1; 41152 } else if (op >= 0xe0) { 41153 stackDelta = -2; 41154 } 41155 41156 if (op >= 0x71 && op <= 0x75) { 41157 n = stack.pop(); 41158 41159 if (!isNaN(n)) { 41160 stackDelta = -n * 2; 41161 } 41162 } 41163 41164 while (stackDelta < 0 && stack.length > 0) { 41165 stack.pop(); 41166 stackDelta++; 41167 } 41168 41169 while (stackDelta > 0) { 41170 stack.push(NaN); 41171 stackDelta--; 41172 } 41173 } 41174 } 41175 41176 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 41177 var content = [data]; 41178 41179 if (i > data.length) { 41180 content.push(new Uint8Array(i - data.length)); 41181 } 41182 41183 if (lastDeff > lastEndf) { 41184 (0, _util.warn)("TT: complementing a missing function tail"); 41185 content.push(new Uint8Array([0x22, 0x2d])); 41186 } 41187 41188 foldTTTable(table, content); 41189 } 41190 41191 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 41192 if (ttContext.tooComplexToFollowFunctions) { 41193 return; 41194 } 41195 41196 if (ttContext.functionsDefined.length > maxFunctionDefs) { 41197 (0, _util.warn)("TT: more functions defined than expected"); 41198 ttContext.hintsValid = false;
41199 return; 41200 } 41201 41202 for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 41203 if (j > maxFunctionDefs) { 41204 (0, _util.warn)("TT: invalid function id: " + j); 41205 ttContext.hintsValid = false; 41206 return; 41207 } 41208 41209 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 41210 (0, _util.warn)("TT: undefined function: " + j); 41211 ttContext.hintsValid = false; 41212 return; 41213 } 41214 } 41215 } 41216 41217 function foldTTTable(table, content) { 41218 if (content.length > 1) { 41219 var newLength = 0; 41220 var j, jj; 41221 41222 for (j = 0, jj = content.length; j < jj; j++) { 41223 newLength += content[j].length; 41224 } 41225 41226 newLength = newLength + 3 & ~3; 41227 var result = new Uint8Array(newLength); 41228 var pos = 0; 41229 41230 for (j = 0, jj = content.length; j < jj; j++) { 41231 result.set(content[j], pos); 41232 pos += content[j].length; 41233 } 41234 41235 table.data = result; 41236 table.length = newLength; 41237 } 41238 } 41239 41240 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 41241 var ttContext = { 41242 functionsDefined: [], 41243 functionsUsed: [], 41244 functionsStackDeltas: [], 41245 tooComplexToFollowFunctions: false, 41246 hintsValid: true 41247 }; 41248 41249 if (fpgm) { 41250 sanitizeTTProgram(fpgm, ttContext); 41251 } 41252 41253 if (prep) { 41254 sanitizeTTProgram(prep, ttContext); 41255 } 41256 41257 if (fpgm) { 41258 checkInvalidFunctions(ttContext, maxFunctionDefs); 41259 } 41260 41261 if (cvt && cvt.length & 1) { 41262 var cvtData = new Uint8Array(cvt.length + 1); 41263 cvtData.set(cvt.data); 41264 cvt.data = cvtData; 41265 } 41266 41267 return ttContext.hintsValid; 41268 } 41269 41270 font = new _stream.Stream(new Uint8Array(font.getBytes())); 41271 let header, tables; 41272 41273 if (isTrueTypeCollectionFile(font)) { 41274 const ttcData = readTrueTypeCollectionData(font, this.name); 41275 header = ttcData.header; 41276 tables = ttcData.tables; 41277 } else { 41278 header = readOpenTypeHeader(font); 41279 tables = readTables(font, header.numTables); 41280 } 41281 41282 let cff, cffFile; 41283 var isTrueType = !tables["CFF "]; 41284 41285 if (!isTrueType) { 41286 const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap)); 41287 41288 if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { 41289 cffFile = new _stream.Stream(tables["CFF "].data); 41290 cff = new CFFFont(cffFile, properties); 41291 adjustWidths(properties); 41292 return this.convert(name, cff, properties); 41293 } 41294 41295 delete tables.glyf; 41296 delete tables.loca; 41297 delete tables.fpgm; 41298 delete tables.prep; 41299 delete tables["cvt "]; 41300 this.isOpenType = true; 41301 } else { 41302 if (!tables.loca) { 41303 throw new _util.FormatError('Required "loca" table is not found'); 41304 } 41305 41306 if (!tables.glyf) { 41307 (0, _util.warn)('Required "glyf" table is not found -- trying to recover.'); 41308 tables.glyf = { 41309 tag: "glyf", 41310 data: new Uint8Array(0) 41311 }; 41312 } 41313 41314 this.isOpenType = false;
41315 } 41316 41317 if (!tables.maxp) { 41318 throw new _util.FormatError('Required "maxp" table is not found'); 41319 } 41320 41321 font.pos = (font.start || 0) + tables.maxp.offset; 41322 var version = font.getInt32(); 41323 const numGlyphs = font.getUint16(); 41324 let numGlyphsOut = numGlyphs + 1; 41325 let dupFirstEntry = true; 41326 41327 if (numGlyphsOut > 0xffff) { 41328 dupFirstEntry = false; 41329 numGlyphsOut = numGlyphs; 41330 (0, _util.warn)("Not enough space in glyfs to duplicate first glyph."); 41331 } 41332 41333 var maxFunctionDefs = 0; 41334 var maxSizeOfInstructions = 0; 41335 41336 if (version >= 0x00010000 && tables.maxp.length >= 22) { 41337 font.pos += 8; 41338 var maxZones = font.getUint16(); 41339 41340 if (maxZones > 2) { 41341 tables.maxp.data[14] = 0; 41342 tables.maxp.data[15] = 2; 41343 } 41344 41345 font.pos += 4; 41346 maxFunctionDefs = font.getUint16(); 41347 font.pos += 4; 41348 maxSizeOfInstructions = font.getUint16(); 41349 } 41350 41351 tables.maxp.data[4] = numGlyphsOut >> 8; 41352 tables.maxp.data[5] = numGlyphsOut & 255; 41353 var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); 41354 41355 if (!hintsValid) { 41356 delete tables.fpgm; 41357 delete tables.prep; 41358 delete tables["cvt "]; 41359 } 41360 41361 sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry); 41362 41363 if (!tables.head) { 41364 throw new _util.FormatError('Required "head" table is not found'); 41365 } 41366 41367 sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); 41368 var missingGlyphs = Object.create(null); 41369 41370 if (isTrueType) { 41371 var isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 41372 var glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 41373 missingGlyphs = glyphsInfo.missingGlyphs; 41374 41375 if (version >= 0x00010000 && tables.maxp.length >= 22) { 41376 tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 41377 tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; 41378 } 41379 } 41380 41381 if (!tables.hhea) { 41382 throw new _util.FormatError('Required "hhea" table is not found'); 41383 } 41384 41385 if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { 41386 tables.hhea.data[10] = 0xff; 41387 tables.hhea.data[11] = 0xff; 41388 } 41389 41390 var metricsOverride = { 41391 unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), 41392 yMax: int16(tables.head.data[42], tables.head.data[43]), 41393 yMin: signedInt16(tables.head.data[38], tables.head.data[39]), 41394 ascent: int16(tables.hhea.data[4], tables.hhea.data[5]), 41395 descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]) 41396 }; 41397 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 41398 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 41399 41400 if (tables.post) { 41401 readPostScriptTable(tables.post, properties, numGlyphs); 41402 } 41403 41404 tables.post = { 41405 tag: "post", 41406 data: createPostTable(properties) 41407 }; 41408 const charCodeToGlyphId = []; 41409 41410 function hasGlyph(glyphId) { 41411 return !missingGlyphs[glyphId]; 41412 } 41413 41414 if (properties.composite) { 41415 var cidToGidMap = properties.cidToGidMap || []; 41416 var isCidToGidMapEmpty = cidToGidMap.length === 0; 41417 properties.cMap.forEach(function (charCode, cid) { 41418 if (cid > 0xffff) { 41419 throw new _util.FormatError("Max size of CID is 65,535"); 41420 } 41421 41422 var glyphId = -1; 41423 41424 if (isCidToGidMapEmpty) { 41425 glyphId = cid; 41426 } else if (cidToGidMap[cid] !== undefined) { 41427 glyphId = cidToGidMap[cid]; 41428 } 41429 41430 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 41431 charCodeToGlyphId[charCode] = glyphId; 41432 } 41433 }); 41434 } else { 41435 var cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); 41436 var cmapPlatformId = cmapTable.platformId; 41437 var cmapEncodingId = cmapTable.encodingId; 41438 var cmapMappings = cmapTable.mappings; 41439 var cmapMappingsLength = cmapMappings.length; 41440 41441 if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) { 41442 var baseEncoding = []; 41443 41444 if (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding") { 41445 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 41446 } 41447 41448 var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 41449 41450 for (let charCode = 0; charCode < 256; charCode++) { 41451 var glyphName, standardGlyphName; 41452
41453 if (this.differences && charCode in this.differences) { 41454 glyphName = this.differences[charCode]; 41455 } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") { 41456 glyphName = baseEncoding[charCode]; 41457 } else { 41458 glyphName = _encodings.StandardEncoding[charCode]; 41459 } 41460 41461 if (!glyphName) { 41462 continue; 41463 } 41464 41465 standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 41466 var unicodeOrCharCode; 41467 41468 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 41469 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 41470 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 41471 unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName); 41472 } 41473 41474 var found = false; 41475 41476 for (let i = 0; i < cmapMappingsLength; ++i) { 41477 if (cmapMappings[i].charCode !== unicodeOrCharCode) { 41478 continue; 41479 } 41480 41481 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 41482 found = true; 41483 break; 41484 } 41485 41486 if (!found && properties.glyphNames) { 41487 var glyphId = properties.glyphNames.indexOf(glyphName); 41488 41489 if (glyphId === -1 && standardGlyphName !== glyphName) { 41490 glyphId = properties.glyphNames.indexOf(standardGlyphName); 41491 } 41492 41493 if (glyphId > 0 && hasGlyph(glyphId)) { 41494 charCodeToGlyphId[charCode] = glyphId; 41495 } 41496 } 41497 } 41498 } else if (cmapPlatformId === 0 && cmapEncodingId === 0) { 41499 for (let i = 0; i < cmapMappingsLength; ++i) { 41500 charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId; 41501 } 41502 } else { 41503 for (let i = 0; i < cmapMappingsLength; ++i) { 41504 let charCode = cmapMappings[i].charCode; 41505 41506 if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) { 41507 charCode &= 0xff; 41508 } 41509 41510 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 41511 } 41512 } 41513 } 41514 41515 if (charCodeToGlyphId.length === 0) { 41516 charCodeToGlyphId[0] = 0; 41517 } 41518 41519 let glyphZeroId = numGlyphsOut - 1; 41520 41521 if (!dupFirstEntry) { 41522 glyphZeroId = 0; 41523 } 41524 41525 var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId); 41526 this.toFontChar = newMapping.toFontChar; 41527 tables.cmap = { 41528 tag: "cmap", 41529 data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut) 41530 }; 41531 41532 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { 41533 tables["OS/2"] = { 41534 tag: "OS/2", 41535 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 41536 }; 41537 } 41538 41539 if (!isTrueType) { 41540 try { 41541 cffFile = new _stream.Stream(tables["CFF "].data); 41542 var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED); 41543 cff = parser.parse(); 41544 cff.duplicateFirstGlyph(); 41545 var compiler = new _cff_parser.CFFCompiler(cff); 41546 tables["CFF "].data = compiler.compile(); 41547 } catch (e) { 41548 (0, _util.warn)("Failed to compile font " + properties.loadedName); 41549 } 41550 } 41551 41552 if (!tables.name) { 41553 tables.name = { 41554 tag: "name", 41555 data: createNameTable(this.name) 41556 }; 41557 } else { 41558 var namePrototype = readNameTable(tables.name); 41559 tables.name.data = createNameTable(name, namePrototype); 41560 } 41561 41562 var builder = new OpenTypeFileBuilder(header.version); 41563 41564 for (var tableTag in tables) { 41565 builder.addTable(tableTag, tables[tableTag].data); 41566 } 41567 41568 return builder.toArray(); 41569 }, 41570 convert: function Font_convert(fontName, font, properties) { 41571 properties.fixedPitch = false; 41572 41573 if (properties.builtInEncoding) { 41574 adjustToUnicode(properties, properties.builtInEncoding); 41575 } 41576 41577 let glyphZeroId = 1; 41578 41579 if (font instanceof CFFFont) { 41580 glyphZeroId = font.numGlyphs - 1; 41581 } 41582 41583 var mapping = font.getGlyphMapping(properties); 41584 var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId); 41585 this.toFontChar = newMapping.toFontChar; 41586 var numGlyphs = font.numGlyphs; 41587 41588 function getCharCodes(charCodeToGlyphId, glyphId) {
41589 var charCodes = null; 41590 41591 for (var charCode in charCodeToGlyphId) { 41592 if (glyphId === charCodeToGlyphId[charCode]) { 41593 if (!charCodes) { 41594 charCodes = []; 41595 } 41596 41597 charCodes.push(charCode | 0); 41598 } 41599 } 41600 41601 return charCodes; 41602 } 41603 41604 function createCharCode(charCodeToGlyphId, glyphId) { 41605 for (var charCode in charCodeToGlyphId) { 41606 if (glyphId === charCodeToGlyphId[charCode]) { 41607 return charCode | 0; 41608 } 41609 } 41610 41611 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 41612 return newMapping.nextAvailableFontCharCode++; 41613 } 41614 41615 var seacs = font.seacs; 41616 41617 if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { 41618 var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX; 41619 var charset = font.getCharset(); 41620 var seacMap = Object.create(null); 41621 41622 for (var glyphId in seacs) { 41623 glyphId |= 0; 41624 var seac = seacs[glyphId]; 41625 var baseGlyphName = _encodings.StandardEncoding[seac[2]]; 41626 var accentGlyphName = _encodings.StandardEncoding[seac[3]]; 41627 var baseGlyphId = charset.indexOf(baseGlyphName); 41628 var accentGlyphId = charset.indexOf(accentGlyphName); 41629 41630 if (baseGlyphId < 0 || accentGlyphId < 0) { 41631 continue; 41632 } 41633 41634 var accentOffset = { 41635 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 41636 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 41637 }; 41638 var charCodes = getCharCodes(mapping, glyphId); 41639 41640 if (!charCodes) { 41641 continue; 41642 } 41643 41644 for (let i = 0, ii = charCodes.length; i < ii; i++) { 41645 var charCode = charCodes[i]; 41646 var charCodeToGlyphId = newMapping.charCodeToGlyphId; 41647 var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 41648 var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 41649 seacMap[charCode] = { 41650 baseFontCharCode, 41651 accentFontCharCode, 41652 accentOffset 41653 }; 41654 } 41655 } 41656 41657 properties.seacMap = seacMap; 41658 } 41659 41660 var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 41661 var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 41662 builder.addTable("CFF ", font.data); 41663 builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId)); 41664 builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)); 41665 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"); 41666 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)); 41667 builder.addTable("hmtx", function fontFieldsHmtx() { 41668 var charstrings = font.charstrings; 41669 var cffWidths = font.cff ? font.cff.widths : null; 41670 var hmtx = "\x00\x00\x00\x00"; 41671 41672 for (let i = 1, ii = numGlyphs; i < ii; i++) { 41673 var width = 0; 41674 41675 if (charstrings) { 41676 var charstring = charstrings[i - 1]; 41677 width = "width" in charstring ? charstring.width : 0; 41678 } else if (cffWidths) { 41679 width = Math.ceil(cffWidths[i] || 0); 41680 } 41681 41682 hmtx += string16(width) + string16(0); 41683 } 41684 41685 return hmtx; 41686 }()); 41687 builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); 41688 builder.addTable("name", createNameTable(fontName)); 41689 builder.addTable("post", createPostTable(properties)); 41690 return builder.toArray(); 41691 }, 41692 41693 get spaceWidth() { 41694 var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 41695 var width; 41696 41697 for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { 41698 var glyphName = possibleSpaceReplacements[i]; 41699 41700 if (glyphName in this.widths) { 41701 width = this.widths[glyphName]; 41702 break; 41703 } 41704 41705 var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 41706 var glyphUnicode = glyphsUnicodeMap[glyphName]; 41707 var charcode = 0; 41708 41709 if (this.composite && this.cMap.contains(glyphUnicode)) { 41710 charcode = this.cMap.lookup(glyphUnicode); 41711 } 41712 41713 if (!charcode && this.toUnicode) { 41714 charcode = this.toUnicode.charCodeOf(glyphUnicode); 41715 } 41716 41717 if (charcode <= 0) { 41718 charcode = glyphUnicode; 41719 } 41720 41721 width = this.widths[charcode]; 41722 41723 if (width) { 41724 break; 41725 } 41726 } 41727 41728 width = width || this.defaultWidth;
41729 return (0, _util.shadow)(this, "spaceWidth", width); 41730 }, 41731 41732 charToGlyph: function Font_charToGlyph(charcode, isSpace) { 41733 var fontCharCode, width, operatorListId; 41734 var widthCode = charcode; 41735 41736 if (this.cMap && this.cMap.contains(charcode)) { 41737 widthCode = this.cMap.lookup(charcode); 41738 } 41739 41740 width = this.widths[widthCode]; 41741 width = (0, _util.isNum)(width) ? width : this.defaultWidth; 41742 var vmetric = this.vmetrics && this.vmetrics[widthCode]; 41743 let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode; 41744 41745 if (typeof unicode === "number") { 41746 unicode = String.fromCharCode(unicode); 41747 } 41748 41749 var isInFont = (charcode in this.toFontChar); 41750 fontCharCode = this.toFontChar[charcode] || charcode; 41751 41752 if (this.missingFile) { 41753 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 41754 41755 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 41756 fontCharCode = 0x20; 41757 } 41758 41759 fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode); 41760 } 41761 41762 if (this.isType3Font) { 41763 operatorListId = fontCharCode; 41764 } 41765 41766 var accent = null; 41767 41768 if (this.seacMap && this.seacMap[charcode]) { 41769 isInFont = true; 41770 var seac = this.seacMap[charcode]; 41771 fontCharCode = seac.baseFontCharCode; 41772 accent = { 41773 fontChar: String.fromCodePoint(seac.accentFontCharCode), 41774 offset: seac.accentOffset 41775 }; 41776 } 41777 41778 let fontChar = ""; 41779 41780 if (typeof fontCharCode === "number") { 41781 if (fontCharCode <= 0x10ffff) { 41782 fontChar = String.fromCodePoint(fontCharCode); 41783 } else { 41784 (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); 41785 } 41786 } 41787 41788 var glyph = this.glyphCache[charcode]; 41789 41790 if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { 41791 glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 41792 this.glyphCache[charcode] = glyph; 41793 } 41794 41795 return glyph; 41796 }, 41797 charsToGlyphs: function Font_charsToGlyphs(chars) { 41798 var charsCache = this.charsCache; 41799 var glyphs, glyph, charcode; 41800 41801 if (charsCache) { 41802 glyphs = charsCache[chars]; 41803 41804 if (glyphs) { 41805 return glyphs; 41806 } 41807 } 41808 41809 if (!charsCache) { 41810 charsCache = this.charsCache = Object.create(null); 41811 } 41812 41813 glyphs = []; 41814 var charsCacheKey = chars; 41815 var i = 0, 41816 ii; 41817 41818 if (this.cMap) { 41819 var c = Object.create(null); 41820 41821 while (i < chars.length) { 41822 this.cMap.readCharCode(chars, i, c); 41823 charcode = c.charcode; 41824 var length = c.length; 41825 i += length; 41826 var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20; 41827 glyph = this.charToGlyph(charcode, isSpace); 41828 glyphs.push(glyph); 41829 } 41830 } else { 41831 for (i = 0, ii = chars.length; i < ii; ++i) { 41832 charcode = chars.charCodeAt(i); 41833 glyph = this.charToGlyph(charcode, charcode === 0x20); 41834 glyphs.push(glyph); 41835 } 41836 } 41837 41838 return charsCache[charsCacheKey] = glyphs; 41839 }, 41840 41841 get glyphCacheValues() { 41842 return Object.values(this.glyphCache); 41843 } 41844 41845 }; 41846 return Font; 41847}(); 41848 41849exports.Font = Font; 41850 41851var ErrorFont = function ErrorFontClosure() { 41852 function ErrorFont(error) { 41853 this.error = error; 41854 this.loadedName = "g_font_error"; 41855 this.missingFile = true; 41856 } 41857 41858 ErrorFont.prototype = { 41859 charsToGlyphs: function ErrorFont_charsToGlyphs() { 41860 return []; 41861 }, 41862 41863 exportData(extraProperties = false) { 41864 return { 41865 error: this.error 41866 }; 41867 } 41868 41869 }; 41870 return ErrorFont; 41871}(); 41872 41873exports.ErrorFont = ErrorFont; 41874 41875function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 41876 var charCodeToGlyphId = Object.create(null); 41877 var glyphId, charCode, baseEncoding; 41878 var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 41879 41880 if (properties.baseEncodingName) { 41881 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 41882 41883 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 41884 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 41885 41886 if (glyphId >= 0) {
41887 charCodeToGlyphId[charCode] = glyphId; 41888 } else { 41889 charCodeToGlyphId[charCode] = 0; 41890 } 41891 } 41892 } else if (isSymbolicFont) { 41893 for (charCode in builtInEncoding) { 41894 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 41895 } 41896 } else { 41897 baseEncoding = _encodings.StandardEncoding; 41898 41899 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 41900 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 41901 41902 if (glyphId >= 0) { 41903 charCodeToGlyphId[charCode] = glyphId; 41904 } else { 41905 charCodeToGlyphId[charCode] = 0; 41906 } 41907 } 41908 } 41909 41910 var differences = properties.differences, 41911 glyphsUnicodeMap; 41912 41913 if (differences) { 41914 for (charCode in differences) { 41915 var glyphName = differences[charCode]; 41916 glyphId = glyphNames.indexOf(glyphName); 41917 41918 if (glyphId === -1) { 41919 if (!glyphsUnicodeMap) { 41920 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 41921 } 41922 41923 var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 41924 41925 if (standardGlyphName !== glyphName) { 41926 glyphId = glyphNames.indexOf(standardGlyphName); 41927 } 41928 } 41929 41930 if (glyphId >= 0) { 41931 charCodeToGlyphId[charCode] = glyphId; 41932 } else { 41933 charCodeToGlyphId[charCode] = 0; 41934 } 41935 } 41936 } 41937 41938 return charCodeToGlyphId; 41939} 41940 41941var Type1Font = function Type1FontClosure() { 41942 function findBlock(streamBytes, signature, startIndex) { 41943 var streamBytesLength = streamBytes.length; 41944 var signatureLength = signature.length; 41945 var scanLength = streamBytesLength - signatureLength; 41946 var i = startIndex, 41947 j, 41948 found = false; 41949 41950 while (i < scanLength) { 41951 j = 0; 41952 41953 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 41954 j++; 41955 } 41956 41957 if (j >= signatureLength) { 41958 i += j; 41959 41960 while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) { 41961 i++; 41962 } 41963 41964 found = true; 41965 break; 41966 } 41967 41968 i++; 41969 } 41970 41971 return { 41972 found, 41973 length: i 41974 }; 41975 } 41976 41977 function getHeaderBlock(stream, suggestedLength) { 41978 var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 41979 var streamStartPos = stream.pos; 41980 var headerBytes, headerBytesLength, block; 41981 41982 try { 41983 headerBytes = stream.getBytes(suggestedLength); 41984 headerBytesLength = headerBytes.length; 41985 } catch (ex) { 41986 if (ex instanceof _core_utils.MissingDataException) { 41987 throw ex; 41988 } 41989 } 41990 41991 if (headerBytesLength === suggestedLength) { 41992 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 41993 41994 if (block.found && block.length === suggestedLength) { 41995 return { 41996 stream: new _stream.Stream(headerBytes), 41997 length: suggestedLength 41998 }; 41999 } 42000 } 42001 42002 (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.'); 42003 stream.pos = streamStartPos; 42004 var SCAN_BLOCK_LENGTH = 2048; 42005 var actualLength; 42006 42007 while (true) { 42008 var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 42009 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 42010 42011 if (block.length === 0) { 42012 break; 42013 } 42014 42015 stream.pos += block.length; 42016 42017 if (block.found) { 42018 actualLength = stream.pos - streamStartPos; 42019 break; 42020 } 42021 } 42022 42023 stream.pos = streamStartPos; 42024 42025 if (actualLength) { 42026 return { 42027 stream: new _stream.Stream(stream.getBytes(actualLength)), 42028 length: actualLength 42029 }; 42030 } 42031 42032 (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.'); 42033 return { 42034 stream: new _stream.Stream(stream.getBytes(suggestedLength)), 42035 length: suggestedLength 42036 }; 42037 } 42038 42039 function getEexecBlock(stream, suggestedLength) { 42040 var eexecBytes = stream.getBytes(); 42041 return { 42042 stream: new _stream.Stream(eexecBytes), 42043 length: eexecBytes.length 42044 }; 42045 } 42046 42047 function Type1Font(name, file, properties) { 42048 var PFB_HEADER_SIZE = 6; 42049 var headerBlockLength = properties.length1; 42050 var eexecBlockLength = properties.length2; 42051 var pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 42052 var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 42053 42054 if (pfbHeaderPresent) { 42055 file.skip(PFB_HEADER_SIZE); 42056 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 42057 } 42058 42059 var headerBlock = getHeaderBlock(file, headerBlockLength); 42060 var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED); 42061 headerBlockParser.extractFontHeader(properties); 42062 42063 if (pfbHeaderPresent) { 42064 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 42065 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 42066 } 42067 42068 var eexecBlock = getEexecBlock(file, eexecBlockLength); 42069 var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED); 42070 var data = eexecBlockParser.extractFontProgram(properties); 42071 42072 for (const key in data.properties) { 42073 properties[key] = data.properties[key]; 42074 } 42075 42076 var charstrings = data.charstrings; 42077 var type2Charstrings = this.getType2Charstrings(charstrings); 42078 var subrs = this.getType2Subrs(data.subrs); 42079 this.charstrings = charstrings; 42080 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
42081 this.seacs = this.getSeacs(data.charstrings); 42082 } 42083 42084 Type1Font.prototype = { 42085 get numGlyphs() { 42086 return this.charstrings.length + 1; 42087 }, 42088 42089 getCharset: function Type1Font_getCharset() { 42090 var charset = [".notdef"]; 42091 var charstrings = this.charstrings; 42092 42093 for (var glyphId = 0; glyphId < charstrings.length; glyphId++) { 42094 charset.push(charstrings[glyphId].glyphName); 42095 } 42096 42097 return charset; 42098 }, 42099 getGlyphMapping: function Type1Font_getGlyphMapping(properties) { 42100 var charstrings = this.charstrings; 42101 42102 if (properties.composite) { 42103 const charCodeToGlyphId = Object.create(null); 42104 42105 for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) { 42106 const charCode = properties.cMap.charCodeOf(glyphId); 42107 charCodeToGlyphId[charCode] = glyphId + 1; 42108 } 42109 42110 return charCodeToGlyphId; 42111 } 42112 42113 var glyphNames = [".notdef"], 42114 glyphId; 42115 42116 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 42117 glyphNames.push(charstrings[glyphId].glyphName); 42118 } 42119 42120 var encoding = properties.builtInEncoding; 42121 42122 if (encoding) { 42123 var builtInEncoding = Object.create(null); 42124 42125 for (var charCode in encoding) { 42126 glyphId = glyphNames.indexOf(encoding[charCode]); 42127 42128 if (glyphId >= 0) { 42129 builtInEncoding[charCode] = glyphId; 42130 } 42131 } 42132 } 42133 42134 return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); 42135 }, 42136 hasGlyphId: function Type1Font_hasGlyphID(id) { 42137 if (id < 0 || id >= this.numGlyphs) { 42138 return false; 42139 } 42140 42141 if (id === 0) { 42142 return true; 42143 } 42144 42145 var glyph = this.charstrings[id - 1]; 42146 return glyph.charstring.length > 0; 42147 }, 42148 getSeacs: function Type1Font_getSeacs(charstrings) { 42149 var i, ii; 42150 var seacMap = []; 42151 42152 for (i = 0, ii = charstrings.length; i < ii; i++) { 42153 var charstring = charstrings[i]; 42154 42155 if (charstring.seac) { 42156 seacMap[i + 1] = charstring.seac; 42157 } 42158 } 42159 42160 return seacMap; 42161 }, 42162 getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) { 42163 var type2Charstrings = []; 42164 42165 for (var i = 0, ii = type1Charstrings.length; i < ii; i++) { 42166 type2Charstrings.push(type1Charstrings[i].charstring); 42167 } 42168 42169 return type2Charstrings; 42170 }, 42171 getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) { 42172 var bias = 0; 42173 var count = type1Subrs.length; 42174 42175 if (count < 1133) { 42176 bias = 107; 42177 } else if (count < 33769) { 42178 bias = 1131; 42179 } else { 42180 bias = 32768; 42181 } 42182 42183 var type2Subrs = []; 42184 var i; 42185 42186 for (i = 0; i < bias; i++) { 42187 type2Subrs.push([0x0b]); 42188 } 42189 42190 for (i = 0; i < count; i++) { 42191 type2Subrs.push(type1Subrs[i]); 42192 } 42193 42194 return type2Subrs; 42195 }, 42196 wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) { 42197 var cff = new _cff_parser.CFF(); 42198 cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4); 42199 cff.names = [name]; 42200 var topDict = new _cff_parser.CFFTopDict(); 42201 topDict.setByName("version", 391); 42202 topDict.setByName("Notice", 392); 42203 topDict.setByName("FullName", 393); 42204 topDict.setByName("FamilyName", 394); 42205 topDict.setByName("Weight", 395); 42206 topDict.setByName("Encoding", null); 42207 topDict.setByName("FontMatrix", properties.fontMatrix); 42208 topDict.setByName("FontBBox", properties.bbox); 42209 topDict.setByName("charset", null); 42210 topDict.setByName("CharStrings", null); 42211 topDict.setByName("Private", null); 42212 cff.topDict = topDict; 42213 var strings = new _cff_parser.CFFStrings(); 42214 strings.add("Version 0.11"); 42215 strings.add("See original notice"); 42216 strings.add(name); 42217 strings.add(name); 42218 strings.add("Medium"); 42219 cff.strings = strings; 42220 cff.globalSubrIndex = new _cff_parser.CFFIndex(); 42221 var count = glyphs.length; 42222 var charsetArray = [".notdef"]; 42223 var i, ii; 42224 42225 for (i = 0; i < count; i++) { 42226 const glyphName = charstrings[i].glyphName; 42227 42228 const index = _cff_parser.CFFStandardStrings.indexOf(glyphName); 42229 42230 if (index === -1) {
42231 strings.add(glyphName); 42232 } 42233 42234 charsetArray.push(glyphName); 42235 } 42236 42237 cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); 42238 var charStringsIndex = new _cff_parser.CFFIndex(); 42239 charStringsIndex.add([0x8b, 0x0e]); 42240 42241 for (i = 0; i < count; i++) { 42242 charStringsIndex.add(glyphs[i]); 42243 } 42244 42245 cff.charStrings = charStringsIndex; 42246 var privateDict = new _cff_parser.CFFPrivateDict(); 42247 privateDict.setByName("Subrs", null); 42248 var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 42249 42250 for (i = 0, ii = fields.length; i < ii; i++) { 42251 var field = fields[i]; 42252 42253 if (!(field in properties.privateData)) { 42254 continue; 42255 } 42256 42257 var value = properties.privateData[field]; 42258 42259 if (Array.isArray(value)) { 42260 for (var j = value.length - 1; j > 0; j--) { 42261 value[j] -= value[j - 1]; 42262 } 42263 } 42264 42265 privateDict.setByName(field, value); 42266 } 42267 42268 cff.topDict.privateDict = privateDict; 42269 var subrIndex = new _cff_parser.CFFIndex(); 42270 42271 for (i = 0, ii = subrs.length; i < ii; i++) { 42272 subrIndex.add(subrs[i]); 42273 } 42274 42275 privateDict.subrsIndex = subrIndex; 42276 var compiler = new _cff_parser.CFFCompiler(cff); 42277 return compiler.compile(); 42278 } 42279 }; 42280 return Type1Font; 42281}(); 42282 42283var CFFFont = function CFFFontClosure() { 42284 function CFFFont(file, properties) { 42285 this.properties = properties; 42286 var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED); 42287 this.cff = parser.parse(); 42288 this.cff.duplicateFirstGlyph(); 42289 var compiler = new _cff_parser.CFFCompiler(this.cff); 42290 this.seacs = this.cff.seacs; 42291 42292 try { 42293 this.data = compiler.compile(); 42294 } catch (e) { 42295 (0, _util.warn)("Failed to compile font " + properties.loadedName); 42296 this.data = file; 42297 } 42298 } 42299 42300 CFFFont.prototype = { 42301 get numGlyphs() { 42302 return this.cff.charStrings.count; 42303 }, 42304 42305 getCharset: function CFFFont_getCharset() { 42306 return this.cff.charset.charset; 42307 }, 42308 getGlyphMapping: function CFFFont_getGlyphMapping() { 42309 var cff = this.cff; 42310 var properties = this.properties; 42311 var charsets = cff.charset.charset; 42312 var charCodeToGlyphId; 42313 var glyphId; 42314 42315 if (properties.composite) { 42316 charCodeToGlyphId = Object.create(null); 42317 let charCode; 42318 42319 if (cff.isCIDFont) { 42320 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 42321 var cid = charsets[glyphId]; 42322 charCode = properties.cMap.charCodeOf(cid); 42323 charCodeToGlyphId[charCode] = glyphId; 42324 } 42325 } else { 42326 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 42327 charCode = properties.cMap.charCodeOf(glyphId); 42328 charCodeToGlyphId[charCode] = glyphId; 42329 } 42330 } 42331 42332 return charCodeToGlyphId; 42333 } 42334 42335 var encoding = cff.encoding ? cff.encoding.encoding : null; 42336 charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); 42337 return charCodeToGlyphId; 42338 }, 42339 hasGlyphId: function CFFFont_hasGlyphID(id) { 42340 return this.cff.hasGlyphId(id); 42341 } 42342 }; 42343 return CFFFont; 42344}(); 42345 42346/***/ }), 42347/* 30 */ 42348/***/ (function(module, exports, __w_pdfjs_require__) { 42349 42350"use strict"; 42351 42352 42353Object.defineProperty(exports, "__esModule", { 42354 value: true 42355}); 42356exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0; 42357 42358var _util = __w_pdfjs_require__(2); 42359 42360var _charsets = __w_pdfjs_require__(31); 42361 42362var _encodings = __w_pdfjs_require__(32); 42363 42364var MAX_SUBR_NESTING = 10; 42365var CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
42365ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"]; 42366exports.CFFStandardStrings = CFFStandardStrings; 42367const NUM_STANDARD_CFF_STRINGS = 391; 42368 42369var CFFParser = function CFFParserClosure() { 42370 var CharstringValidationData = [null, { 42371 id: "hstem", 42372 min: 2, 42373 stackClearing: true, 42374 stem: true 42375 }, null, { 42376 id: "vstem", 42377 min: 2, 42378 stackClearing: true, 42379 stem: true 42380 }, { 42381 id: "vmoveto", 42382 min: 1, 42383 stackClearing: true 42384 }, { 42385 id: "rlineto", 42386 min: 2, 42387 resetStack: true 42388 }, { 42389 id: "hlineto", 42390 min: 1, 42391 resetStack: true 42392 }, { 42393 id: "vlineto", 42394 min: 1, 42395 resetStack: true 42396 }, { 42397 id: "rrcurveto", 42398 min: 6, 42399 resetStack: true 42400 }, null, { 42401 id: "callsubr", 42402 min: 1, 42403 undefStack: true 42404 }, { 42405 id: "return", 42406 min: 0, 42407 undefStack: true 42408 }, null, null, { 42409 id: "endchar", 42410 min: 0, 42411 stackClearing: true 42412 }, null, null, null, { 42413 id: "hstemhm", 42414 min: 2, 42415 stackClearing: true, 42416 stem: true 42417 }, { 42418 id: "hintmask", 42419 min: 0, 42420 stackClearing: true 42421 }, { 42422 id: "cntrmask", 42423 min: 0, 42424 stackClearing: true 42425 }, { 42426 id: "rmoveto", 42427 min: 2, 42428 stackClearing: true 42429 }, { 42430 id: "hmoveto", 42431 min: 1, 42432 stackClearing: true 42433 }, { 42434 id: "vstemhm", 42435 min: 2, 42436 stackClearing: true, 42437 stem: true 42438 }, { 42439 id: "rcurveline", 42440 min: 8, 42441 resetStack: true 42442 }, { 42443 id: "rlinecurve", 42444 min: 8, 42445 resetStack: true 42446 }, { 42447 id: "vvcurveto", 42448 min: 4, 42449 resetStack: true 42450 }, { 42451 id: "hhcurveto", 42452 min: 4, 42453 resetStack: true 42454 }, null, { 42455 id: "callgsubr", 42456 min: 1, 42457 undefStack: true 42458 }, { 42459 id: "vhcurveto", 42460 min: 4, 42461 resetStack: true 42462 }, { 42463 id: "hvcurveto", 42464 min: 4, 42465 resetStack: true 42466 }]; 42467 var CharstringValidationData12 = [null, null, null, { 42468 id: "and", 42469 min: 2, 42470 stackDelta: -1 42471 }, { 42472 id: "or", 42473 min: 2, 42474 stackDelta: -1 42475 }, { 42476 id: "not", 42477 min: 1, 42478 stackDelta: 0 42479 }, null, null, null, { 42480 id: "abs", 42481 min: 1, 42482 stackDelta: 0 42483 }, { 42484 id: "add", 42485 min: 2, 42486 stackDelta: -1, 42487 stackFn: function stack_div(stack, index) { 42488 stack[index - 2] = stack[index - 2] + stack[index - 1]; 42489 } 42490 }, { 42491 id: "sub", 42492 min: 2, 42493 stackDelta: -1, 42494 stackFn: function stack_div(stack, index) { 42495 stack[index - 2] = stack[index - 2] - stack[index - 1]; 42496 } 42497 }, { 42498 id: "div", 42499 min: 2, 42500 stackDelta: -1, 42501 stackFn: function stack_div(stack, index) { 42502 stack[index - 2] = stack[index - 2] / stack[index - 1]; 42503 } 42504 }, null, { 42505 id: "neg", 42506 min: 1, 42507 stackDelta: 0, 42508 stackFn: function stack_div(stack, index) { 42509 stack[index - 1] = -stack[index - 1]; 42510 } 42511 }, { 42512 id: "eq", 42513 min: 2, 42514 stackDelta: -1 42515 }, null, null, { 42516 id: "drop", 42517 min: 1, 42518 stackDelta: -1 42519 }, null, { 42520 id: "put", 42521 min: 2, 42522 stackDelta: -2 42523 }, { 42524 id: "get", 42525 min: 1, 42526 stackDelta: 0 42527 }, { 42528 id: "ifelse", 42529 min: 4, 42530 stackDelta: -3 42531 }, { 42532 id: "random", 42533 min: 0, 42534 stackDelta: 1 42535 }, { 42536 id: "mul", 42537 min: 2, 42538 stackDelta: -1, 42539 stackFn: function stack_div(stack, index) { 42540 stack[index - 2] = stack[index - 2] * stack[index - 1]; 42541 } 42542 }, null, { 42543 id: "sqrt", 42544 min: 1, 42545 stackDelta: 0 42546 }, { 42547 id: "dup", 42548 min: 1, 42549 stackDelta: 1 42550 }, { 42551 id: "exch", 42552 min: 2, 42553 stackDelta: 0 42554 }, { 42555 id: "index", 42556 min: 2, 42557 stackDelta: 0 42558 }, { 42559 id: "roll", 42560 min: 3, 42561 stackDelta: -2 42562 }, null, null, null, { 42563 id: "hflex", 42564 min: 7, 42565 resetStack: true 42566 }, { 42567 id: "flex", 42568 min: 13, 42569 resetStack: true 42570 }, { 42571 id: "hflex1", 42572 min: 9, 42573 resetStack: true 42574 }, { 42575 id: "flex1", 42576 min: 11, 42577 resetStack: true 42578 }]; 42579 42580 function CFFParser(file, properties, seacAnalysisEnabled) { 42581 this.bytes = file.getBytes(); 42582 this.properties = properties; 42583 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 42584 } 42585 42586 CFFParser.prototype = { 42587 parse: function CFFParser_parse() { 42588 var properties = this.properties; 42589 var cff = new CFF(); 42590 this.cff = cff; 42591 var header = this.parseHeader(); 42592 var nameIndex = this.parseIndex(header.endPos); 42593 var topDictIndex = this.parseIndex(nameIndex.endPos); 42594 var stringIndex = this.parseIndex(topDictIndex.endPos); 42595 var globalSubrIndex = this.parseIndex(stringIndex.endPos); 42596 var topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 42597 var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 42598 cff.header = header.obj; 42599 cff.names = this.parseNameIndex(nameIndex.obj); 42600 cff.strings = this.parseStringIndex(stringIndex.obj); 42601 cff.topDict = topDict; 42602 cff.globalSubrIndex = globalSubrIndex.obj; 42603 this.parsePrivateDict(cff.topDict); 42604 cff.isCIDFont = topDict.hasName("ROS"); 42605 var charStringOffset = topDict.getByName("CharStrings"); 42606 var charStringIndex = this.parseIndex(charStringOffset).obj; 42607 var fontMatrix = topDict.getByName("FontMatrix"); 42608 42609 if (fontMatrix) { 42610 properties.fontMatrix = fontMatrix; 42611 } 42612 42613 var fontBBox = topDict.getByName("FontBBox"); 42614 42615 if (fontBBox) { 42616 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 42617 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 42618 properties.ascentScaled = true; 42619 } 42620 42621 var charset, encoding; 42622 42623 if (cff.isCIDFont) { 42624 var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 42625 42626 for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 42627 var dictRaw = fdArrayIndex.get(i); 42628 var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 42629 this.parsePrivateDict(fontDict); 42630 cff.fdArray.push(fontDict); 42631 } 42632 42633 encoding = null; 42634 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 42635 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 42636 } else { 42637 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 42638 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 42639 } 42640 42641 cff.charset = charset; 42642 cff.encoding = encoding; 42643 var charStringsAndSeacs = this.parseCharStrings({ 42644 charStrings: charStringIndex, 42645 localSubrIndex: topDict.privateDict.subrsIndex, 42646 globalSubrIndex: globalSubrIndex.obj, 42647 fdSelect: cff.fdSelect, 42648 fdArray: cff.fdArray, 42649 privateDict: topDict.privateDict 42650 }); 42651 cff.charStrings = charStringsAndSeacs.charStrings; 42652 cff.seacs = charStringsAndSeacs.seacs; 42653 cff.widths = charStringsAndSeacs.widths; 42654 return cff; 42655 }, 42656 parseHeader: function CFFParser_parseHeader() { 42657 var bytes = this.bytes; 42658 var bytesLength = bytes.length; 42659 var offset = 0; 42660 42661 while (offset < bytesLength && bytes[offset] !== 1) { 42662 ++offset; 42663 } 42664 42665 if (offset >= bytesLength) { 42666 throw new _util.FormatError("Invalid CFF header"); 42667 } 42668 42669 if (offset !== 0) { 42670 (0, _util.info)("cff data is shifted"); 42671 bytes = bytes.subarray(offset); 42672 this.bytes = bytes; 42673 } 42674 42675 var major = bytes[0]; 42676 var minor = bytes[1]; 42677 var hdrSize = bytes[2]; 42678 var offSize = bytes[3]; 42679 var header = new CFFHeader(major, minor, hdrSize, offSize); 42680 return { 42681 obj: header, 42682 endPos: hdrSize 42683 }; 42684 }, 42685 parseDict: function CFFParser_parseDict(dict) { 42686 var pos = 0; 42687 42688 function parseOperand() { 42689 var value = dict[pos++]; 42690 42691 if (value === 30) { 42692 return parseFloatOperand(); 42693 } else if (value === 28) { 42694 value = dict[pos++]; 42695 value = (value << 24 | dict[pos++] << 16) >> 16; 42696 return value; 42697 } else if (value === 29) { 42698 value = dict[pos++]; 42699 value = value << 8 | dict[pos++]; 42700 value = value << 8 | dict[pos++]; 42701 value = value << 8 | dict[pos++]; 42702 return value; 42703 } else if (value >= 32 && value <= 246) { 42704 return value - 139; 42705 } else if (value >= 247 && value <= 250) { 42706 return (value - 247) * 256 + dict[pos++] + 108; 42707 } else if (value >= 251 && value <= 254) { 42708 return -((value - 251) * 256) - dict[pos++] - 108; 42709 } 42710 42711 (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); 42712 return NaN; 42713 } 42714 42715 function parseFloatOperand() { 42716 var str = ""; 42717 var eof = 15; 42718 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 42719 var length = dict.length; 42720 42721 while (pos < length) { 42722 var b = dict[pos++]; 42723 var b1 = b >> 4; 42724 var b2 = b & 15; 42725 42726 if (b1 === eof) { 42727 break; 42728 } 42729 42730 str += lookup[b1]; 42731 42732 if (b2 === eof) { 42733 break; 42734 } 42735 42736 str += lookup[b2]; 42737 } 42738 42739 return parseFloat(str); 42740 } 42741 42742 var operands = []; 42743 var entries = []; 42744 pos = 0; 42745 var end = dict.length; 42746 42747 while (pos < end) { 42748 var b = dict[pos]; 42749 42750 if (b <= 21) { 42751 if (b === 12) { 42752 b = b << 8 | dict[++pos]; 42753 } 42754
42755 entries.push([b, operands]); 42756 operands = []; 42757 ++pos; 42758 } else { 42759 operands.push(parseOperand()); 42760 } 42761 } 42762 42763 return entries; 42764 }, 42765 parseIndex: function CFFParser_parseIndex(pos) { 42766 var cffIndex = new CFFIndex(); 42767 var bytes = this.bytes; 42768 var count = bytes[pos++] << 8 | bytes[pos++]; 42769 var offsets = []; 42770 var end = pos; 42771 var i, ii; 42772 42773 if (count !== 0) { 42774 var offsetSize = bytes[pos++]; 42775 var startPos = pos + (count + 1) * offsetSize - 1; 42776 42777 for (i = 0, ii = count + 1; i < ii; ++i) { 42778 var offset = 0; 42779 42780 for (var j = 0; j < offsetSize; ++j) { 42781 offset <<= 8; 42782 offset += bytes[pos++]; 42783 } 42784 42785 offsets.push(startPos + offset); 42786 } 42787 42788 end = offsets[count]; 42789 } 42790 42791 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 42792 var offsetStart = offsets[i]; 42793 var offsetEnd = offsets[i + 1]; 42794 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 42795 } 42796 42797 return { 42798 obj: cffIndex, 42799 endPos: end 42800 }; 42801 }, 42802 parseNameIndex: function CFFParser_parseNameIndex(index) { 42803 var names = []; 42804 42805 for (var i = 0, ii = index.count; i < ii; ++i) { 42806 var name = index.get(i); 42807 names.push((0, _util.bytesToString)(name)); 42808 } 42809 42810 return names; 42811 }, 42812 parseStringIndex: function CFFParser_parseStringIndex(index) { 42813 var strings = new CFFStrings(); 42814 42815 for (var i = 0, ii = index.count; i < ii; ++i) { 42816 var data = index.get(i); 42817 strings.add((0, _util.bytesToString)(data)); 42818 } 42819 42820 return strings; 42821 }, 42822 createDict: function CFFParser_createDict(Type, dict, strings) { 42823 var cffDict = new Type(strings); 42824 42825 for (var i = 0, ii = dict.length; i < ii; ++i) { 42826 var pair = dict[i]; 42827 var key = pair[0]; 42828 var value = pair[1]; 42829 cffDict.setByKey(key, value); 42830 } 42831 42832 return cffDict; 42833 }, 42834 parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) { 42835 if (!data || state.callDepth > MAX_SUBR_NESTING) { 42836 return false; 42837 } 42838 42839 var stackSize = state.stackSize; 42840 var stack = state.stack; 42841 var length = data.length; 42842 42843 for (var j = 0; j < length;) { 42844 var value = data[j++]; 42845 var validationCommand = null; 42846 42847 if (value === 12) { 42848 var q = data[j++]; 42849 42850 if (q === 0) { 42851 data[j - 2] = 139; 42852 data[j - 1] = 22; 42853 stackSize = 0; 42854 } else { 42855 validationCommand = CharstringValidationData12[q]; 42856 } 42857 } else if (value === 28) { 42858 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 42859 j += 2; 42860 stackSize++; 42861 } else if (value === 14) { 42862 if (stackSize >= 4) { 42863 stackSize -= 4; 42864 42865 if (this.seacAnalysisEnabled) { 42866 state.seac = stack.slice(stackSize, stackSize + 4); 42867 return false; 42868 } 42869 } 42870 42871 validationCommand = CharstringValidationData[value]; 42872 } else if (value >= 32 && value <= 246) { 42873 stack[stackSize] = value - 139; 42874 stackSize++; 42875 } else if (value >= 247 && value <= 254) { 42876 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 42877 j++; 42878 stackSize++; 42879 } else if (value === 255) { 42880 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 42881 j += 4; 42882 stackSize++; 42883 } else if (value === 19 || value === 20) { 42884 state.hints += stackSize >> 1; 42885 j += state.hints + 7 >> 3; 42886 stackSize %= 2; 42887 validationCommand = CharstringValidationData[value]; 42888 } else if (value === 10 || value === 29) { 42889 var subrsIndex; 42890 42891 if (value === 10) { 42892 subrsIndex = localSubrIndex; 42893 } else { 42894 subrsIndex = globalSubrIndex; 42895 } 42896 42897 if (!subrsIndex) { 42898 validationCommand = CharstringValidationData[value]; 42899 (0, _util.warn)("Missing subrsIndex for " + validationCommand.id); 42900 return false;
42901 } 42902 42903 var bias = 32768; 42904 42905 if (subrsIndex.count < 1240) { 42906 bias = 107; 42907 } else if (subrsIndex.count < 33900) { 42908 bias = 1131; 42909 } 42910 42911 var subrNumber = stack[--stackSize] + bias; 42912 42913 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 42914 validationCommand = CharstringValidationData[value]; 42915 (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id); 42916 return false; 42917 } 42918 42919 state.stackSize = stackSize; 42920 state.callDepth++; 42921 var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 42922 42923 if (!valid) { 42924 return false; 42925 } 42926 42927 state.callDepth--; 42928 stackSize = state.stackSize; 42929 continue; 42930 } else if (value === 11) { 42931 state.stackSize = stackSize; 42932 return true; 42933 } else { 42934 validationCommand = CharstringValidationData[value]; 42935 } 42936 42937 if (validationCommand) { 42938 if (validationCommand.stem) { 42939 state.hints += stackSize >> 1; 42940 42941 if (value === 3 || value === 23) { 42942 state.hasVStems = true; 42943 } else if (state.hasVStems && (value === 1 || value === 18)) { 42944 (0, _util.warn)("CFF stem hints are in wrong order"); 42945 data[j - 1] = value === 1 ? 3 : 23; 42946 } 42947 } 42948 42949 if ("min" in validationCommand) { 42950 if (!state.undefStack && stackSize < validationCommand.min) { 42951 (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 42952 return false; 42953 } 42954 } 42955 42956 if (state.firstStackClearing && validationCommand.stackClearing) { 42957 state.firstStackClearing = false; 42958 stackSize -= validationCommand.min; 42959 42960 if (stackSize >= 2 && validationCommand.stem) { 42961 stackSize %= 2; 42962 } else if (stackSize > 1) { 42963 (0, _util.warn)("Found too many parameters for stack-clearing command"); 42964 } 42965 42966 if (stackSize > 0 && stack[stackSize - 1] >= 0) { 42967 state.width = stack[stackSize - 1]; 42968 } 42969 } 42970 42971 if ("stackDelta" in validationCommand) { 42972 if ("stackFn" in validationCommand) { 42973 validationCommand.stackFn(stack, stackSize); 42974 } 42975 42976 stackSize += validationCommand.stackDelta; 42977 } else if (validationCommand.stackClearing) { 42978 stackSize = 0; 42979 } else if (validationCommand.resetStack) { 42980 stackSize = 0; 42981 state.undefStack = false; 42982 } else if (validationCommand.undefStack) { 42983 stackSize = 0; 42984 state.undefStack = true; 42985 state.firstStackClearing = false; 42986 } 42987 } 42988 } 42989 42990 state.stackSize = stackSize; 42991 return true; 42992 }, 42993 42994 parseCharStrings({ 42995 charStrings, 42996 localSubrIndex, 42997 globalSubrIndex, 42998 fdSelect, 42999 fdArray, 43000 privateDict 43001 }) { 43002 var seacs = []; 43003 var widths = []; 43004 var count = charStrings.count; 43005 43006 for (var i = 0; i < count; i++) { 43007 var charstring = charStrings.get(i); 43008 var state = { 43009 callDepth: 0, 43010 stackSize: 0, 43011 stack: [], 43012 undefStack: true, 43013 hints: 0, 43014 firstStackClearing: true, 43015 seac: null, 43016 width: null, 43017 hasVStems: false 43018 }; 43019 var valid = true; 43020 var localSubrToUse = null; 43021 var privateDictToUse = privateDict; 43022 43023 if (fdSelect && fdArray.length) { 43024 var fdIndex = fdSelect.getFDIndex(i); 43025 43026 if (fdIndex === -1) { 43027 (0, _util.warn)("Glyph index is not in fd select."); 43028 valid = false; 43029 } 43030 43031 if (fdIndex >= fdArray.length) { 43032 (0, _util.warn)("Invalid fd index for glyph index."); 43033 valid = false; 43034 } 43035 43036 if (valid) { 43037 privateDictToUse = fdArray[fdIndex].privateDict; 43038 localSubrToUse = privateDictToUse.subrsIndex; 43039 } 43040 } else if (localSubrIndex) { 43041 localSubrToUse = localSubrIndex; 43042 } 43043 43044 if (valid) { 43045 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 43046 } 43047 43048 if (state.width !== null) { 43049 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 43050 widths[i] = nominalWidth + state.width; 43051 } else { 43052 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 43053 widths[i] = defaultWidth; 43054 } 43055 43056 if (state.seac !== null) { 43057 seacs[i] = state.seac; 43058 } 43059 43060 if (!valid) { 43061 charStrings.set(i, new Uint8Array([14])); 43062 } 43063 } 43064 43065 return { 43066 charStrings, 43067 seacs, 43068 widths 43069 }; 43070 }, 43071 43072 emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) { 43073 var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 43074 parentDict.setByKey(18, [0, 0]); 43075 parentDict.privateDict = privateDict; 43076 }, 43077 parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) { 43078 if (!parentDict.hasName("Private")) { 43079 this.emptyPrivateDictionary(parentDict); 43080 return; 43081 } 43082 43083 var privateOffset = parentDict.getByName("Private"); 43084 43085 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 43086 parentDict.removeByName("Private"); 43087 return; 43088 } 43089 43090 var size = privateOffset[0]; 43091 var offset = privateOffset[1]; 43092 43093 if (size === 0 || offset >= this.bytes.length) { 43094 this.emptyPrivateDictionary(parentDict); 43095 return; 43096 } 43097 43098 var privateDictEnd = offset + size; 43099 var dictData = this.bytes.subarray(offset, privateDictEnd); 43100 var dict = this.parseDict(dictData); 43101 var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 43102 parentDict.privateDict = privateDict; 43103 43104 if (!privateDict.getByName("Subrs")) { 43105 return; 43106 } 43107 43108 var subrsOffset = privateDict.getByName("Subrs"); 43109 var relativeOffset = offset + subrsOffset; 43110 43111 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 43112 this.emptyPrivateDictionary(parentDict); 43113 return; 43114 } 43115 43116 var subrsIndex = this.parseIndex(relativeOffset); 43117 privateDict.subrsIndex = subrsIndex.obj; 43118 }, 43119 parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) { 43120 if (pos === 0) { 43121 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); 43122 } else if (pos === 1) { 43123 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); 43124 } else if (pos === 2) { 43125 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); 43126 } 43127 43128 var bytes = this.bytes; 43129 var start = pos; 43130 var format = bytes[pos++]; 43131 const charset = [cid ? 0 : ".notdef"]; 43132 var id, count, i; 43133 length -= 1; 43134 43135 switch (format) { 43136 case 0: 43137 for (i = 0; i < length; i++) {
43138 id = bytes[pos++] << 8 | bytes[pos++]; 43139 charset.push(cid ? id : strings.get(id)); 43140 } 43141 43142 break; 43143 43144 case 1: 43145 while (charset.length <= length) { 43146 id = bytes[pos++] << 8 | bytes[pos++]; 43147 count = bytes[pos++]; 43148 43149 for (i = 0; i <= count; i++) { 43150 charset.push(cid ? id++ : strings.get(id++)); 43151 } 43152 } 43153 43154 break; 43155 43156 case 2: 43157 while (charset.length <= length) { 43158 id = bytes[pos++] << 8 | bytes[pos++]; 43159 count = bytes[pos++] << 8 | bytes[pos++]; 43160 43161 for (i = 0; i <= count; i++) { 43162 charset.push(cid ? id++ : strings.get(id++)); 43163 } 43164 } 43165 43166 break; 43167 43168 default: 43169 throw new _util.FormatError("Unknown charset format"); 43170 } 43171 43172 var end = pos; 43173 var raw = bytes.subarray(start, end); 43174 return new CFFCharset(false, format, charset, raw); 43175 }, 43176 parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) { 43177 var encoding = Object.create(null); 43178 var bytes = this.bytes; 43179 var predefined = false; 43180 var format, i, ii; 43181 var raw = null; 43182 43183 function readSupplement() { 43184 var supplementsCount = bytes[pos++]; 43185 43186 for (i = 0; i < supplementsCount; i++) { 43187 var code = bytes[pos++]; 43188 var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 43189 encoding[code] = charset.indexOf(strings.get(sid)); 43190 } 43191 } 43192 43193 if (pos === 0 || pos === 1) { 43194 predefined = true; 43195 format = pos; 43196 var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; 43197 43198 for (i = 0, ii = charset.length; i < ii; i++) { 43199 var index = baseEncoding.indexOf(charset[i]); 43200 43201 if (index !== -1) { 43202 encoding[index] = i; 43203 } 43204 } 43205 } else { 43206 var dataStart = pos; 43207 format = bytes[pos++]; 43208 43209 switch (format & 0x7f) { 43210 case 0: 43211 var glyphsCount = bytes[pos++]; 43212 43213 for (i = 1; i <= glyphsCount; i++) { 43214 encoding[bytes[pos++]] = i; 43215 } 43216 43217 break; 43218 43219 case 1: 43220 var rangesCount = bytes[pos++]; 43221 var gid = 1; 43222 43223 for (i = 0; i < rangesCount; i++) { 43224 var start = bytes[pos++]; 43225 var left = bytes[pos++]; 43226 43227 for (var j = start; j <= start + left; j++) { 43228 encoding[j] = gid++; 43229 } 43230 } 43231 43232 break; 43233 43234 default: 43235 throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`); 43236 } 43237 43238 var dataEnd = pos; 43239 43240 if (format & 0x80) { 43241 bytes[dataStart] &= 0x7f; 43242 readSupplement(); 43243 } 43244 43245 raw = bytes.subarray(dataStart, dataEnd); 43246 } 43247 43248 format = format & 0x7f; 43249 return new CFFEncoding(predefined, format, encoding, raw); 43250 }, 43251 parseFDSelect: function CFFParser_parseFDSelect(pos, length) { 43252 var bytes = this.bytes; 43253 var format = bytes[pos++]; 43254 var fdSelect = []; 43255 var i; 43256 43257 switch (format) { 43258 case 0: 43259 for (i = 0; i < length; ++i) { 43260 var id = bytes[pos++]; 43261 fdSelect.push(id); 43262 } 43263 43264 break; 43265 43266 case 3: 43267 var rangesCount = bytes[pos++] << 8 | bytes[pos++]; 43268 43269 for (i = 0; i < rangesCount; ++i) { 43270 var first = bytes[pos++] << 8 | bytes[pos++]; 43271 43272 if (i === 0 && first !== 0) { 43273 (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 43274 first = 0; 43275 } 43276 43277 var fdIndex = bytes[pos++]; 43278 var next = bytes[pos] << 8 | bytes[pos + 1]; 43279 43280 for (var j = first; j < next; ++j) { 43281 fdSelect.push(fdIndex); 43282 } 43283 } 43284 43285 pos += 2; 43286 break; 43287 43288 default: 43289 throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`); 43290 } 43291 43292 if (fdSelect.length !== length) { 43293 throw new _util.FormatError("parseFDSelect: Invalid font data."); 43294 } 43295 43296 return new CFFFDSelect(format, fdSelect); 43297 } 43298 }; 43299 return CFFParser; 43300}(); 43301 43302exports.CFFParser = CFFParser; 43303 43304var CFF = function CFFClosure() { 43305 function CFF() { 43306 this.header = null; 43307 this.names = []; 43308 this.topDict = null; 43309 this.strings = new CFFStrings(); 43310 this.globalSubrIndex = null; 43311 this.encoding = null; 43312 this.charset = null; 43313 this.charStrings = null; 43314 this.fdArray = []; 43315 this.fdSelect = null; 43316 this.isCIDFont = false;
43317 } 43318 43319 CFF.prototype = { 43320 duplicateFirstGlyph: function CFF_duplicateFirstGlyph() { 43321 if (this.charStrings.count >= 65535) { 43322 (0, _util.warn)("Not enough space in charstrings to duplicate first glyph."); 43323 return; 43324 } 43325 43326 var glyphZero = this.charStrings.get(0); 43327 this.charStrings.add(glyphZero); 43328 43329 if (this.isCIDFont) { 43330 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 43331 } 43332 }, 43333 hasGlyphId: function CFF_hasGlyphID(id) { 43334 if (id < 0 || id >= this.charStrings.count) { 43335 return false; 43336 } 43337 43338 var glyph = this.charStrings.get(id); 43339 return glyph.length > 0; 43340 } 43341 }; 43342 return CFF; 43343}(); 43344 43345exports.CFF = CFF; 43346 43347var CFFHeader = function CFFHeaderClosure() { 43348 function CFFHeader(major, minor, hdrSize, offSize) { 43349 this.major = major; 43350 this.minor = minor; 43351 this.hdrSize = hdrSize; 43352 this.offSize = offSize; 43353 } 43354 43355 return CFFHeader; 43356}(); 43357 43358exports.CFFHeader = CFFHeader; 43359 43360var CFFStrings = function CFFStringsClosure() { 43361 function CFFStrings() { 43362 this.strings = []; 43363 } 43364 43365 CFFStrings.prototype = { 43366 get: function CFFStrings_get(index) { 43367 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 43368 return CFFStandardStrings[index]; 43369 } 43370 43371 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 43372 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 43373 } 43374 43375 return CFFStandardStrings[0]; 43376 }, 43377 getSID: function CFFStrings_getSID(str) { 43378 let index = CFFStandardStrings.indexOf(str); 43379 43380 if (index !== -1) { 43381 return index; 43382 } 43383 43384 index = this.strings.indexOf(str); 43385 43386 if (index !== -1) { 43387 return index + NUM_STANDARD_CFF_STRINGS; 43388 } 43389 43390 return -1; 43391 }, 43392 add: function CFFStrings_add(value) { 43393 this.strings.push(value); 43394 }, 43395 43396 get count() { 43397 return this.strings.length; 43398 } 43399 43400 }; 43401 return CFFStrings; 43402}(); 43403 43404exports.CFFStrings = CFFStrings; 43405 43406var CFFIndex = function CFFIndexClosure() { 43407 function CFFIndex() { 43408 this.objects = []; 43409 this.length = 0; 43410 } 43411 43412 CFFIndex.prototype = { 43413 add: function CFFIndex_add(data) { 43414 this.length += data.length; 43415 this.objects.push(data); 43416 }, 43417 set: function CFFIndex_set(index, data) { 43418 this.length += data.length - this.objects[index].length; 43419 this.objects[index] = data; 43420 }, 43421 get: function CFFIndex_get(index) { 43422 return this.objects[index]; 43423 }, 43424 43425 get count() { 43426 return this.objects.length; 43427 } 43428 43429 }; 43430 return CFFIndex; 43431}(); 43432 43433exports.CFFIndex = CFFIndex; 43434 43435var CFFDict = function CFFDictClosure() { 43436 function CFFDict(tables, strings) { 43437 this.keyToNameMap = tables.keyToNameMap; 43438 this.nameToKeyMap = tables.nameToKeyMap; 43439 this.defaults = tables.defaults; 43440 this.types = tables.types; 43441 this.opcodes = tables.opcodes; 43442 this.order = tables.order; 43443 this.strings = strings; 43444 this.values = Object.create(null); 43445 } 43446 43447 CFFDict.prototype = { 43448 setByKey: function CFFDict_setByKey(key, value) { 43449 if (!(key in this.keyToNameMap)) { 43450 return false; 43451 } 43452 43453 var valueLength = value.length; 43454 43455 if (valueLength === 0) { 43456 return true; 43457 } 43458 43459 for (var i = 0; i < valueLength; i++) { 43460 if (isNaN(value[i])) { 43461 (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); 43462 return true; 43463 } 43464 } 43465 43466 var type = this.types[key]; 43467 43468 if (type === "num" || type === "sid" || type === "offset") { 43469 value = value[0]; 43470 } 43471 43472 this.values[key] = value; 43473 return true; 43474 }, 43475 setByName: function CFFDict_setByName(name, value) { 43476 if (!(name in this.nameToKeyMap)) { 43477 throw new _util.FormatError(`Invalid dictionary name "${name}"`); 43478 } 43479 43480 this.values[this.nameToKeyMap[name]] = value; 43481 }, 43482 hasName: function CFFDict_hasName(name) { 43483 return this.nameToKeyMap[name] in this.values; 43484 }, 43485 getByName: function CFFDict_getByName(name) { 43486 if (!(name in this.nameToKeyMap)) { 43487 throw new _util.FormatError(`Invalid dictionary name ${name}"`); 43488 } 43489 43490 var key = this.nameToKeyMap[name]; 43491 43492 if (!(key in this.values)) { 43493 return this.defaults[key]; 43494 } 43495 43496 return this.values[key]; 43497 }, 43498 removeByName: function CFFDict_removeByName(name) { 43499 delete this.values[this.nameToKeyMap[name]]; 43500 } 43501 }; 43502 43503 CFFDict.createTables = function CFFDict_createTables(layout) { 43504 var tables = { 43505 keyToNameMap: {}, 43506 nameToKeyMap: {}, 43507 defaults: {}, 43508 types: {}, 43509 opcodes: {}, 43510 order: [] 43511 }; 43512 43513 for (var i = 0, ii = layout.length; i < ii; ++i) { 43514 var entry = layout[i]; 43515 var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 43516 tables.keyToNameMap[key] = entry[1]; 43517 tables.nameToKeyMap[entry[1]] = key; 43518 tables.types[key] = entry[2]; 43519 tables.defaults[key] = entry[3]; 43520 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 43521 tables.order.push(key); 43522 } 43523 43524 return tables; 43525 }; 43526 43527 return CFFDict; 43528}(); 43529 43530var CFFTopDict = function CFFTopDictClosure() { 43531 var layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]]; 43532 var tables = null; 43533 43534 function CFFTopDict(strings) { 43535 if (tables === null) { 43536 tables = CFFDict.createTables(layout); 43537 } 43538 43539 CFFDict.call(this, tables, strings); 43540 this.privateDict = null; 43541 } 43542 43543 CFFTopDict.prototype = Object.create(CFFDict.prototype); 43544 return CFFTopDict; 43545}(); 43546 43547exports.CFFTopDict = CFFTopDict; 43548
43549var CFFPrivateDict = function CFFPrivateDictClosure() { 43550 var layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 43551 var tables = null; 43552 43553 function CFFPrivateDict(strings) { 43554 if (tables === null) { 43555 tables = CFFDict.createTables(layout); 43556 } 43557 43558 CFFDict.call(this, tables, strings); 43559 this.subrsIndex = null; 43560 } 43561 43562 CFFPrivateDict.prototype = Object.create(CFFDict.prototype); 43563 return CFFPrivateDict; 43564}(); 43565 43566exports.CFFPrivateDict = CFFPrivateDict; 43567var CFFCharsetPredefinedTypes = { 43568 ISO_ADOBE: 0, 43569 EXPERT: 1, 43570 EXPERT_SUBSET: 2 43571}; 43572 43573var CFFCharset = function CFFCharsetClosure() { 43574 function CFFCharset(predefined, format, charset, raw) { 43575 this.predefined = predefined; 43576 this.format = format; 43577 this.charset = charset; 43578 this.raw = raw; 43579 } 43580 43581 return CFFCharset; 43582}(); 43583 43584exports.CFFCharset = CFFCharset; 43585 43586var CFFEncoding = function CFFEncodingClosure() { 43587 function CFFEncoding(predefined, format, encoding, raw) { 43588 this.predefined = predefined; 43589 this.format = format; 43590 this.encoding = encoding; 43591 this.raw = raw; 43592 } 43593 43594 return CFFEncoding; 43595}(); 43596 43597var CFFFDSelect = function CFFFDSelectClosure() { 43598 function CFFFDSelect(format, fdSelect) { 43599 this.format = format; 43600 this.fdSelect = fdSelect; 43601 } 43602 43603 CFFFDSelect.prototype = { 43604 getFDIndex: function CFFFDSelect_get(glyphIndex) { 43605 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 43606 return -1; 43607 } 43608 43609 return this.fdSelect[glyphIndex]; 43610 } 43611 }; 43612 return CFFFDSelect; 43613}(); 43614 43615exports.CFFFDSelect = CFFFDSelect; 43616 43617var CFFOffsetTracker = function CFFOffsetTrackerClosure() { 43618 function CFFOffsetTracker() { 43619 this.offsets = Object.create(null); 43620 } 43621 43622 CFFOffsetTracker.prototype = { 43623 isTracking: function CFFOffsetTracker_isTracking(key) { 43624 return key in this.offsets; 43625 }, 43626 track: function CFFOffsetTracker_track(key, location) { 43627 if (key in this.offsets) { 43628 throw new _util.FormatError(`Already tracking location of ${key}`); 43629 } 43630 43631 this.offsets[key] = location; 43632 }, 43633 offset: function CFFOffsetTracker_offset(value) { 43634 for (var key in this.offsets) { 43635 this.offsets[key] += value; 43636 } 43637 }, 43638 setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) { 43639 if (!(key in this.offsets)) { 43640 throw new _util.FormatError(`Not tracking location of ${key}`); 43641 } 43642 43643 var data = output.data; 43644 var dataOffset = this.offsets[key]; 43645 var size = 5; 43646 43647 for (var i = 0, ii = values.length; i < ii; ++i) { 43648 var offset0 = i * size + dataOffset; 43649 var offset1 = offset0 + 1; 43650 var offset2 = offset0 + 2; 43651 var offset3 = offset0 + 3; 43652 var offset4 = offset0 + 4; 43653 43654 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 43655 throw new _util.FormatError("writing to an offset that is not empty"); 43656 } 43657 43658 var value = values[i]; 43659 data[offset0] = 0x1d; 43660 data[offset1] = value >> 24 & 0xff; 43661 data[offset2] = value >> 16 & 0xff; 43662 data[offset3] = value >> 8 & 0xff; 43663 data[offset4] = value & 0xff; 43664 } 43665 } 43666 }; 43667 return CFFOffsetTracker; 43668}(); 43669 43670var CFFCompiler = function CFFCompilerClosure() { 43671 function CFFCompiler(cff) { 43672 this.cff = cff; 43673 } 43674 43675 CFFCompiler.prototype = { 43676 compile: function CFFCompiler_compile() { 43677 var cff = this.cff; 43678 var output = { 43679 data: [], 43680 length: 0, 43681 add: function CFFCompiler_add(data) { 43682 this.data = this.data.concat(data); 43683 this.length = this.data.length; 43684 } 43685 }; 43686 var header = this.compileHeader(cff.header); 43687 output.add(header);
43688 var nameIndex = this.compileNameIndex(cff.names); 43689 output.add(nameIndex); 43690 43691 if (cff.isCIDFont) { 43692 if (cff.topDict.hasName("FontMatrix")) { 43693 var base = cff.topDict.getByName("FontMatrix"); 43694 cff.topDict.removeByName("FontMatrix"); 43695 43696 for (var i = 0, ii = cff.fdArray.length; i < ii; i++) { 43697 var subDict = cff.fdArray[i]; 43698 var matrix = base.slice(0); 43699 43700 if (subDict.hasName("FontMatrix")) { 43701 matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix")); 43702 } 43703 43704 subDict.setByName("FontMatrix", matrix); 43705 } 43706 } 43707 } 43708 43709 cff.topDict.setByName("charset", 0); 43710 var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 43711 output.add(compiled.output); 43712 var topDictTracker = compiled.trackers[0]; 43713 var stringIndex = this.compileStringIndex(cff.strings.strings); 43714 output.add(stringIndex); 43715 var globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 43716 output.add(globalSubrIndex); 43717 43718 if (cff.encoding && cff.topDict.hasName("Encoding")) { 43719 if (cff.encoding.predefined) { 43720 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 43721 } else { 43722 var encoding = this.compileEncoding(cff.encoding); 43723 topDictTracker.setEntryLocation("Encoding", [output.length], output); 43724 output.add(encoding); 43725 } 43726 } 43727 43728 var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 43729 topDictTracker.setEntryLocation("charset", [output.length], output); 43730 output.add(charset); 43731 var charStrings = this.compileCharStrings(cff.charStrings); 43732 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 43733 output.add(charStrings); 43734 43735 if (cff.isCIDFont) { 43736 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 43737 var fdSelect = this.compileFDSelect(cff.fdSelect); 43738 output.add(fdSelect); 43739 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 43740 topDictTracker.setEntryLocation("FDArray", [output.length], output); 43741 output.add(compiled.output); 43742 var fontDictTrackers = compiled.trackers; 43743 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 43744 } 43745 43746 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 43747 output.add([0]); 43748 return output.data; 43749 }, 43750 encodeNumber: function CFFCompiler_encodeNumber(value) { 43751 if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) { 43752 return this.encodeInteger(value); 43753 } 43754 43755 return this.encodeFloat(value); 43756 }, 43757 encodeFloat: function CFFCompiler_encodeFloat(num) { 43758 var value = num.toString(); 43759 var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value); 43760 43761 if (m) { 43762 var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 43763 value = (Math.round(num * epsilon) / epsilon).toString(); 43764 } 43765 43766 var nibbles = ""; 43767 var i, ii; 43768 43769 for (i = 0, ii = value.length; i < ii; ++i) { 43770 var a = value[i]; 43771 43772 if (a === "e") { 43773 nibbles += value[++i] === "-" ? "c" : "b"; 43774 } else if (a === ".") { 43775 nibbles += "a"; 43776 } else if (a === "-") { 43777 nibbles += "e"; 43778 } else { 43779 nibbles += a; 43780 } 43781 } 43782 43783 nibbles += nibbles.length & 1 ? "f" : "ff"; 43784 var out = [30]; 43785 43786 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 43787 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 43788 } 43789 43790 return out; 43791 }, 43792 encodeInteger: function CFFCompiler_encodeInteger(value) { 43793 var code; 43794 43795 if (value >= -107 && value <= 107) { 43796 code = [value + 139]; 43797 } else if (value >= 108 && value <= 1131) { 43798 value = value - 108; 43799 code = [(value >> 8) + 247, value & 0xff]; 43800 } else if (value >= -1131 && value <= -108) { 43801 value = -value - 108; 43802 code = [(value >> 8) + 251, value & 0xff]; 43803 } else if (value >= -32768 && value <= 32767) { 43804 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 43805 } else { 43806 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 43807 } 43808 43809 return code; 43810 }, 43811 compileHeader: function CFFCompiler_compileHeader(header) { 43812 return [header.major, header.minor, header.hdrSize, header.offSize]; 43813 }, 43814 compileNameIndex: function CFFCompiler_compileNameIndex(names) { 43815 var nameIndex = new CFFIndex(); 43816 43817 for (var i = 0, ii = names.length; i < ii; ++i) { 43818 var name = names[i]; 43819 var length = Math.min(name.length, 127); 43820 var sanitizedName = new Array(length); 43821 43822 for (var j = 0; j < length; j++) { 43823 var char = name[j]; 43824 43825 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 43826 char = "_"; 43827 } 43828 43829 sanitizedName[j] = char; 43830 } 43831 43832 sanitizedName = sanitizedName.join(""); 43833 43834 if (sanitizedName === "") { 43835 sanitizedName = "Bad_Font_Name"; 43836 } 43837 43838 nameIndex.add((0, _util.stringToBytes)(sanitizedName)); 43839 } 43840 43841 return this.compileIndex(nameIndex); 43842 }, 43843 compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) { 43844 var fontDictTrackers = []; 43845 var fdArrayIndex = new CFFIndex(); 43846 43847 for (var i = 0, ii = dicts.length; i < ii; ++i) { 43848 var fontDict = dicts[i]; 43849 43850 if (removeCidKeys) { 43851 fontDict.removeByName("CIDFontVersion"); 43852 fontDict.removeByName("CIDFontRevision"); 43853 fontDict.removeByName("CIDFontType"); 43854 fontDict.removeByName("CIDCount"); 43855 fontDict.removeByName("UIDBase"); 43856 } 43857 43858 var fontDictTracker = new CFFOffsetTracker(); 43859 var fontDictData = this.compileDict(fontDict, fontDictTracker); 43860 fontDictTrackers.push(fontDictTracker); 43861 fdArrayIndex.add(fontDictData); 43862 fontDictTracker.offset(length); 43863 } 43864 43865 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 43866 return { 43867 trackers: fontDictTrackers, 43868 output: fdArrayIndex 43869 }; 43870 }, 43871 compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) { 43872 for (var i = 0, ii = dicts.length; i < ii; ++i) { 43873 var fontDict = dicts[i]; 43874 var privateDict = fontDict.privateDict; 43875 43876 if (!privateDict || !fontDict.hasName("Private")) { 43877 throw new _util.FormatError("There must be a private dictionary."); 43878 } 43879 43880 var privateDictTracker = new CFFOffsetTracker(); 43881 var privateDictData = this.compileDict(privateDict, privateDictTracker); 43882 var outputLength = output.length; 43883 privateDictTracker.offset(outputLength); 43884 43885 if (!privateDictData.length) { 43886 outputLength = 0; 43887 } 43888 43889 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 43890 output.add(privateDictData); 43891 43892 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 43893 var subrs = this.compileIndex(privateDict.subrsIndex); 43894 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 43895 output.add(subrs); 43896 } 43897 } 43898 }, 43899 compileDict: function CFFCompiler_compileDict(dict, offsetTracker) { 43900 var out = []; 43901 var order = dict.order; 43902 43903 for (var i = 0; i < order.length; ++i) { 43904 var key = order[i]; 43905 43906 if (!(key in dict.values)) { 43907 continue; 43908 } 43909 43910 var values = dict.values[key]; 43911 var types = dict.types[key]; 43912 43913 if (!Array.isArray(types)) { 43914 types = [types]; 43915 } 43916 43917 if (!Array.isArray(values)) { 43918 values = [values]; 43919 } 43920 43921 if (values.length === 0) { 43922 continue; 43923 } 43924 43925 for (var j = 0, jj = types.length; j < jj; ++j) { 43926 var type = types[j]; 43927 var value = values[j]; 43928 43929 switch (type) { 43930 case "num": 43931 case "sid": 43932 out = out.concat(this.encodeNumber(value)); 43933 break; 43934 43935 case "offset": 43936 var name = dict.keyToNameMap[key]; 43937 43938 if (!offsetTracker.isTracking(name)) { 43939 offsetTracker.track(name, out.length); 43940 } 43941 43942 out = out.concat([0x1d, 0, 0, 0, 0]); 43943 break; 43944 43945 case "array": 43946 case "delta": 43947 out = out.concat(this.encodeNumber(value)); 43948 43949 for (var k = 1, kk = values.length; k < kk; ++k) { 43950 out = out.concat(this.encodeNumber(values[k])); 43951 } 43952 43953 break; 43954 43955 default: 43956 throw new _util.FormatError(`Unknown data type of ${type}`); 43957 } 43958 } 43959 43960 out = out.concat(dict.opcodes[key]); 43961 } 43962 43963 return out; 43964 }, 43965 compileStringIndex: function CFFCompiler_compileStringIndex(strings) { 43966 var stringIndex = new CFFIndex(); 43967 43968 for (var i = 0, ii = strings.length; i < ii; ++i) {
43969 stringIndex.add((0, _util.stringToBytes)(strings[i])); 43970 } 43971 43972 return this.compileIndex(stringIndex); 43973 }, 43974 compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() { 43975 var globalSubrIndex = this.cff.globalSubrIndex; 43976 this.out.writeByteArray(this.compileIndex(globalSubrIndex)); 43977 }, 43978 compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) { 43979 var charStringsIndex = new CFFIndex(); 43980 43981 for (var i = 0; i < charStrings.count; i++) { 43982 var glyph = charStrings.get(i); 43983 43984 if (glyph.length === 0) { 43985 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 43986 continue; 43987 } 43988 43989 charStringsIndex.add(glyph); 43990 } 43991 43992 return this.compileIndex(charStringsIndex); 43993 }, 43994 compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) { 43995 let out; 43996 const numGlyphsLessNotDef = numGlyphs - 1; 43997 43998 if (isCIDFont) { 43999 out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]); 44000 } else { 44001 const length = 1 + numGlyphsLessNotDef * 2; 44002 out = new Uint8Array(length); 44003 out[0] = 0; 44004 let charsetIndex = 0; 44005 const numCharsets = charset.charset.length; 44006 let warned = false; 44007 44008 for (let i = 1; i < out.length; i += 2) { 44009 let sid = 0; 44010 44011 if (charsetIndex < numCharsets) { 44012 const name = charset.charset[charsetIndex++]; 44013 sid = strings.getSID(name); 44014 44015 if (sid === -1) { 44016 sid = 0; 44017 44018 if (!warned) { 44019 warned = true; 44020 (0, _util.warn)(`Couldn't find ${name} in CFF strings`); 44021 } 44022 } 44023 } 44024 44025 out[i] = sid >> 8 & 0xff; 44026 out[i + 1] = sid & 0xff; 44027 } 44028 } 44029 44030 return this.compileTypedArray(out); 44031 }, 44032 compileEncoding: function CFFCompiler_compileEncoding(encoding) { 44033 return this.compileTypedArray(encoding.raw); 44034 }, 44035 compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) { 44036 const format = fdSelect.format; 44037 let out, i; 44038 44039 switch (format) { 44040 case 0: 44041 out = new Uint8Array(1 + fdSelect.fdSelect.length); 44042 out[0] = format; 44043 44044 for (i = 0; i < fdSelect.fdSelect.length; i++) { 44045 out[i + 1] = fdSelect.fdSelect[i]; 44046 } 44047 44048 break; 44049 44050 case 3: 44051 const start = 0; 44052 let lastFD = fdSelect.fdSelect[0]; 44053 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 44054 44055 for (i = 1; i < fdSelect.fdSelect.length; i++) { 44056 const currentFD = fdSelect.fdSelect[i]; 44057 44058 if (currentFD !== lastFD) { 44059 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 44060 lastFD = currentFD; 44061 } 44062 } 44063 44064 const numRanges = (ranges.length - 3) / 3; 44065 ranges[1] = numRanges >> 8 & 0xff; 44066 ranges[2] = numRanges & 0xff; 44067 ranges.push(i >> 8 & 0xff, i & 0xff); 44068 out = new Uint8Array(ranges); 44069 break; 44070 } 44071 44072 return this.compileTypedArray(out); 44073 }, 44074 compileTypedArray: function CFFCompiler_compileTypedArray(data) { 44075 var out = []; 44076 44077 for (var i = 0, ii = data.length; i < ii; ++i) { 44078 out[i] = data[i]; 44079 } 44080 44081 return out; 44082 }, 44083 compileIndex: function CFFCompiler_compileIndex(index, trackers) { 44084 trackers = trackers || []; 44085 var objects = index.objects; 44086 var count = objects.length; 44087 44088 if (count === 0) { 44089 return [0, 0, 0]; 44090 } 44091 44092 var data = [count >> 8 & 0xff, count & 0xff]; 44093 var lastOffset = 1, 44094 i; 44095 44096 for (i = 0; i < count; ++i) { 44097 lastOffset += objects[i].length; 44098 } 44099 44100 var offsetSize; 44101 44102 if (lastOffset < 0x100) { 44103 offsetSize = 1; 44104 } else if (lastOffset < 0x10000) { 44105 offsetSize = 2; 44106 } else if (lastOffset < 0x1000000) { 44107 offsetSize = 3; 44108 } else { 44109 offsetSize = 4; 44110 } 44111 44112 data.push(offsetSize); 44113 var relativeOffset = 1; 44114 44115 for (i = 0; i < count + 1; i++) { 44116 if (offsetSize === 1) { 44117 data.push(relativeOffset & 0xff); 44118 } else if (offsetSize === 2) { 44119 data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 44120 } else if (offsetSize === 3) { 44121 data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 44122 } else { 44123 data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 44124 } 44125 44126 if (objects[i]) { 44127 relativeOffset += objects[i].length; 44128 } 44129 } 44130 44131 for (i = 0; i < count; i++) { 44132 if (trackers[i]) { 44133 trackers[i].offset(data.length); 44134 } 44135 44136 for (var j = 0, jj = objects[i].length; j < jj; j++) { 44137 data.push(objects[i][j]); 44138 } 44139 } 44140 44141 return data; 44142 } 44143 }; 44144 return CFFCompiler; 44145}(); 44146 44147exports.CFFCompiler = CFFCompiler; 44148 44149/***/ }), 44150/* 31 */ 44151/***/ (function(module, exports, __w_pdfjs_require__) { 44152 44153"use strict"; 44154 44155 44156Object.defineProperty(exports, "__esModule", { 44157 value: true 44158}); 44159exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0; 44160const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
44160ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"]; 44161exports.ISOAdobeCharset = ISOAdobeCharset; 44162const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 44163exports.ExpertCharset = ExpertCharset; 44164const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"]; 44165exports.ExpertSubsetCharset = ExpertSubsetCharset; 44166 44167/***/ }), 44168/* 32 */ 44169/***/ (function(module, exports, __w_pdfjs_require__) { 44170 44171"use strict"; 44172 44173 44174Object.defineProperty(exports, "__esModule", { 44175 value: true 44176}); 44177exports.getEncoding = getEncoding; 44178exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0; 44179const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 44180exports.ExpertEncoding = ExpertEncoding; 44181const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""]; 44182const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodce
44182ntered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"]; 44183exports.MacRomanEncoding = MacRomanEncoding; 44184const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodce
44184ntered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""]; 44185exports.StandardEncoding = StandardEncoding; 44186const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"]; 44187exports.WinAnsiEncoding = WinAnsiEncoding; 44188const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "cir
44188clemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""]; 44189exports.SymbolSetEncoding = SymbolSetEncoding; 44190const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""]; 44191exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding; 44192 44193function getEncoding(encodingName) { 44194 switch (encodingName) { 44195 case "WinAnsiEncoding": 44196 return WinAnsiEncoding; 44197 44198 case "StandardEncoding": 44199 return StandardEncoding; 44200 44201 case "MacRomanEncoding": 44202 return MacRomanEncoding; 44203 44204 case "SymbolSetEncoding": 44205 return SymbolSetEncoding; 44206 44207 case "ZapfDingbatsEncoding": 44208 return ZapfDingbatsEncoding; 44209 44210 case "ExpertEncoding": 44211 return ExpertEncoding; 44212 44213 case "MacExpertEncoding": 44214 return MacExpertEncoding; 44215 44216 default: 44217 return null; 44218 } 44219} 44220 44221/***/ }), 44222/* 33 */ 44223/***/ (function(module, exports, __w_pdfjs_require__) { 44224 44225var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory; 44226var getGlyphsUnicode = getLookupTableFactory(function (t) { 44227 t.A = 0x0041; 44228 t.AE = 0x00c6; 44229 t.AEacute = 0x01fc; 44230 t.AEmacron = 0x01e2; 44231 t.AEsmall = 0xf7e6; 44232 t.Aacute = 0x00c1; 44233 t.Aacutesmall = 0xf7e1; 44234 t.Abreve = 0x0102; 44235 t.Abreveacute = 0x1eae; 44236 t.Abrevecyrillic = 0x04d0; 44237 t.Abrevedotbelow = 0x1eb6; 44238 t.Abrevegrave = 0x1eb0; 44239 t.Abrevehookabove = 0x1eb2; 44240 t.Abrevetilde = 0x1eb4; 44241 t.Acaron = 0x01cd; 44242 t.Acircle = 0x24b6; 44243 t.Acircumflex = 0x00c2; 44244 t.Acircumflexacute = 0x1ea4; 44245 t.Acircumflexdotbelow = 0x1eac; 44246 t.Acircumflexgrave = 0x1ea6; 44247 t.Acircumflexhookabove = 0x1ea8; 44248 t.Acircumflexsmall = 0xf7e2; 44249 t.Acircumflextilde = 0x1eaa; 44250 t.Acute = 0xf6c9; 44251 t.Acutesmall = 0xf7b4; 44252 t.Acyrillic = 0x0410; 44253 t.Adblgrave = 0x0200; 44254 t.Adieresis = 0x00c4; 44255 t.Adieresiscyrillic = 0x04d2; 44256 t.Adieresismacron = 0x01de; 44257 t.Adieresissmall = 0xf7e4; 44258 t.Adotbelow = 0x1ea0; 44259 t.Adotmacron = 0x01e0; 44260 t.Agrave = 0x00c0; 44261 t.Agravesmall = 0xf7e0; 44262 t.Ahookabove = 0x1ea2; 44263 t.Aiecyrillic = 0x04d4; 44264 t.Ainvertedbreve = 0x0202; 44265 t.Alpha = 0x0391; 44266 t.Alphatonos = 0x0386; 44267 t.Amacron = 0x0100; 44268 t.Amonospace = 0xff21; 44269 t.Aogonek = 0x0104; 44270 t.Aring = 0x00c5; 44271 t.Aringacute = 0x01fa; 44272 t.Aringbelow = 0x1e00; 44273 t.Aringsmall = 0xf7e5; 44274 t.Asmall = 0xf761; 44275 t.Atilde = 0x00c3; 44276 t.Atildesmall = 0xf7e3; 44277 t.Aybarmenian = 0x0531; 44278 t.B = 0x0042; 44279 t.Bcircle = 0x24b7; 44280 t.Bdotaccent = 0x1e02; 44281 t.Bdotbelow = 0x1e04; 44282 t.Becyrillic = 0x0411; 44283 t.Benarmenian = 0x0532; 44284 t.Beta = 0x0392; 44285 t.Bhook = 0x0181; 44286 t.Blinebelow = 0x1e06; 44287 t.Bmonospace = 0xff22; 44288 t.Brevesmall = 0xf6f4; 44289 t.Bsmall = 0xf762; 44290 t.Btopbar = 0x0182; 44291 t.C = 0x0043; 44292 t.Caarmenian = 0x053e; 44293 t.Cacute = 0x0106; 44294 t.Caron = 0xf6ca; 44295 t.Caronsmall = 0xf6f5; 44296 t.Ccaron = 0x010c; 44297 t.Ccedilla = 0x00c7; 44298 t.Ccedillaacute = 0x1e08; 44299 t.Ccedillasmall = 0xf7e7; 44300 t.Ccircle = 0x24b8; 44301 t.Ccircumflex = 0x0108; 44302 t.Cdot = 0x010a; 44303 t.Cdotaccent = 0x010a; 44304 t.Cedillasmall = 0xf7b8; 44305 t.Chaarmenian = 0x0549; 44306 t.Cheabkhasiancyrillic = 0x04bc; 44307 t.Checyrillic = 0x0427;
44308 t.Chedescenderabkhasiancyrillic = 0x04be; 44309 t.Chedescendercyrillic = 0x04b6; 44310 t.Chedieresiscyrillic = 0x04f4; 44311 t.Cheharmenian = 0x0543; 44312 t.Chekhakassiancyrillic = 0x04cb; 44313 t.Cheverticalstrokecyrillic = 0x04b8; 44314 t.Chi = 0x03a7; 44315 t.Chook = 0x0187; 44316 t.Circumflexsmall = 0xf6f6; 44317 t.Cmonospace = 0xff23; 44318 t.Coarmenian = 0x0551; 44319 t.Csmall = 0xf763; 44320 t.D = 0x0044; 44321 t.DZ = 0x01f1; 44322 t.DZcaron = 0x01c4; 44323 t.Daarmenian = 0x0534; 44324 t.Dafrican = 0x0189; 44325 t.Dcaron = 0x010e; 44326 t.Dcedilla = 0x1e10; 44327 t.Dcircle = 0x24b9; 44328 t.Dcircumflexbelow = 0x1e12; 44329 t.Dcroat = 0x0110; 44330 t.Ddotaccent = 0x1e0a; 44331 t.Ddotbelow = 0x1e0c; 44332 t.Decyrillic = 0x0414; 44333 t.Deicoptic = 0x03ee; 44334 t.Delta = 0x2206; 44335 t.Deltagreek = 0x0394; 44336 t.Dhook = 0x018a; 44337 t.Dieresis = 0xf6cb; 44338 t.DieresisAcute = 0xf6cc; 44339 t.DieresisGrave = 0xf6cd; 44340 t.Dieresissmall = 0xf7a8; 44341 t.Digammagreek = 0x03dc; 44342 t.Djecyrillic = 0x0402; 44343 t.Dlinebelow = 0x1e0e; 44344 t.Dmonospace = 0xff24; 44345 t.Dotaccentsmall = 0xf6f7; 44346 t.Dslash = 0x0110; 44347 t.Dsmall = 0xf764; 44348 t.Dtopbar = 0x018b; 44349 t.Dz = 0x01f2; 44350 t.Dzcaron = 0x01c5; 44351 t.Dzeabkhasiancyrillic = 0x04e0; 44352 t.Dzecyrillic = 0x0405; 44353 t.Dzhecyrillic = 0x040f; 44354 t.E = 0x0045; 44355 t.Eacute = 0x00c9; 44356 t.Eacutesmall = 0xf7e9; 44357 t.Ebreve = 0x0114; 44358 t.Ecaron = 0x011a; 44359 t.Ecedillabreve = 0x1e1c; 44360 t.Echarmenian = 0x0535; 44361 t.Ecircle = 0x24ba; 44362 t.Ecircumflex = 0x00ca; 44363 t.Ecircumflexacute = 0x1ebe; 44364 t.Ecircumflexbelow = 0x1e18; 44365 t.Ecircumflexdotbelow = 0x1ec6; 44366 t.Ecircumflexgrave = 0x1ec0; 44367 t.Ecircumflexhookabove = 0x1ec2; 44368 t.Ecircumflexsmall = 0xf7ea; 44369 t.Ecircumflextilde = 0x1ec4; 44370 t.Ecyrillic = 0x0404; 44371 t.Edblgrave = 0x0204; 44372 t.Edieresis = 0x00cb; 44373 t.Edieresissmall = 0xf7eb; 44374 t.Edot = 0x0116; 44375 t.Edotaccent = 0x0116; 44376 t.Edotbelow = 0x1eb8; 44377 t.Efcyrillic = 0x0424; 44378 t.Egrave = 0x00c8; 44379 t.Egravesmall = 0xf7e8; 44380 t.Eharmenian = 0x0537; 44381 t.Ehookabove = 0x1eba; 44382 t.Eightroman = 0x2167; 44383 t.Einvertedbreve = 0x0206; 44384 t.Eiotifiedcyrillic = 0x0464; 44385 t.Elcyrillic = 0x041b; 44386 t.Elevenroman = 0x216a; 44387 t.Emacron = 0x0112; 44388 t.Emacronacute = 0x1e16; 44389 t.Emacrongrave = 0x1e14; 44390 t.Emcyrillic = 0x041c; 44391 t.Emonospace = 0xff25; 44392 t.Encyrillic = 0x041d; 44393 t.Endescendercyrillic = 0x04a2; 44394 t.Eng = 0x014a; 44395 t.Enghecyrillic = 0x04a4; 44396 t.Enhookcyrillic = 0x04c7; 44397 t.Eogonek = 0x0118; 44398 t.Eopen = 0x0190; 44399 t.Epsilon = 0x0395; 44400 t.Epsilontonos = 0x0388; 44401 t.Ercyrillic = 0x0420; 44402 t.Ereversed = 0x018e; 44403 t.Ereversedcyrillic = 0x042d; 44404 t.Escyrillic = 0x0421; 44405 t.Esdescendercyrillic = 0x04aa; 44406 t.Esh = 0x01a9; 44407 t.Esmall = 0xf765; 44408 t.Eta = 0x0397; 44409 t.Etarmenian = 0x0538; 44410 t.Etatonos = 0x0389; 44411 t.Eth = 0x00d0; 44412 t.Ethsmall = 0xf7f0; 44413 t.Etilde = 0x1ebc; 44414 t.Etildebelow = 0x1e1a; 44415 t.Euro = 0x20ac; 44416 t.Ezh = 0x01b7; 44417 t.Ezhcaron = 0x01ee; 44418 t.Ezhreversed = 0x01b8; 44419 t.F = 0x0046; 44420 t.Fcircle = 0x24bb; 44421 t.Fdotaccent = 0x1e1e; 44422 t.Feharmenian = 0x0556; 44423 t.Feicoptic = 0x03e4; 44424 t.Fhook = 0x0191; 44425 t.Fitacyrillic = 0x0472; 44426 t.Fiveroman = 0x2164; 44427 t.Fmonospace = 0xff26; 44428 t.Fourroman = 0x2163; 44429 t.Fsmall = 0xf766; 44430 t.G = 0x0047; 44431 t.GBsquare = 0x3387; 44432 t.Gacute = 0x01f4; 44433 t.Gamma = 0x0393; 44434 t.Gammaafrican = 0x0194; 44435 t.Gangiacoptic = 0x03ea; 44436 t.Gbreve = 0x011e; 44437 t.Gcaron = 0x01e6; 44438 t.Gcedilla = 0x0122; 44439 t.Gcircle = 0x24bc; 44440 t.Gcircumflex = 0x011c; 44441 t.Gcommaaccent = 0x0122; 44442 t.Gdot = 0x0120; 44443 t.Gdotaccent = 0x0120; 44444 t.Gecyrillic = 0x0413; 44445 t.Ghadarmenian = 0x0542; 44446 t.Ghemiddlehookcyrillic = 0x0494; 44447 t.Ghestrokecyrillic = 0x0492; 44448 t.Gheupturncyrillic = 0x0490; 44449 t.Ghook = 0x0193; 44450 t.Gimarmenian = 0x0533; 44451 t.Gjecyrillic = 0x0403; 44452 t.Gmacron = 0x1e20; 44453 t.Gmonospace = 0xff27; 44454 t.Grave = 0xf6ce; 44455 t.Gravesmall = 0xf760; 44456 t.Gsmall = 0xf767; 44457 t.Gsmallhook = 0x029b; 44458 t.Gstroke = 0x01e4; 44459 t.H = 0x0048; 44460 t.H18533 = 0x25cf; 44461 t.H18543 = 0x25aa; 44462 t.H18551 = 0x25ab; 44463 t.H22073 = 0x25a1; 44464 t.HPsquare = 0x33cb; 44465 t.Haabkhasiancyrillic = 0x04a8; 44466 t.Hadescendercyrillic = 0x04b2; 44467 t.Hardsigncyrillic = 0x042a; 44468 t.Hbar = 0x0126; 44469 t.Hbrevebelow = 0x1e2a; 44470 t.Hcedilla = 0x1e28; 44471 t.Hcircle = 0x24bd; 44472 t.Hcircumflex = 0x0124; 44473 t.Hdieresis = 0x1e26; 44474 t.Hdotaccent = 0x1e22; 44475 t.Hdotbelow = 0x1e24; 44476 t.Hmonospace = 0xff28; 44477 t.Hoarmenian = 0x0540; 44478 t.Horicoptic = 0x03e8; 44479 t.Hsmall = 0xf768; 44480 t.Hungarumlaut = 0xf6cf; 44481 t.Hungarumlautsmall = 0xf6f8;
44482 t.Hzsquare = 0x3390; 44483 t.I = 0x0049; 44484 t.IAcyrillic = 0x042f; 44485 t.IJ = 0x0132; 44486 t.IUcyrillic = 0x042e; 44487 t.Iacute = 0x00cd; 44488 t.Iacutesmall = 0xf7ed; 44489 t.Ibreve = 0x012c; 44490 t.Icaron = 0x01cf; 44491 t.Icircle = 0x24be; 44492 t.Icircumflex = 0x00ce; 44493 t.Icircumflexsmall = 0xf7ee; 44494 t.Icyrillic = 0x0406; 44495 t.Idblgrave = 0x0208; 44496 t.Idieresis = 0x00cf; 44497 t.Idieresisacute = 0x1e2e; 44498 t.Idieresiscyrillic = 0x04e4; 44499 t.Idieresissmall = 0xf7ef; 44500 t.Idot = 0x0130; 44501 t.Idotaccent = 0x0130; 44502 t.Idotbelow = 0x1eca; 44503 t.Iebrevecyrillic = 0x04d6; 44504 t.Iecyrillic = 0x0415; 44505 t.Ifraktur = 0x2111; 44506 t.Igrave = 0x00cc; 44507 t.Igravesmall = 0xf7ec; 44508 t.Ihookabove = 0x1ec8; 44509 t.Iicyrillic = 0x0418; 44510 t.Iinvertedbreve = 0x020a; 44511 t.Iishortcyrillic = 0x0419; 44512 t.Imacron = 0x012a; 44513 t.Imacroncyrillic = 0x04e2; 44514 t.Imonospace = 0xff29; 44515 t.Iniarmenian = 0x053b; 44516 t.Iocyrillic = 0x0401; 44517 t.Iogonek = 0x012e; 44518 t.Iota = 0x0399; 44519 t.Iotaafrican = 0x0196; 44520 t.Iotadieresis = 0x03aa; 44521 t.Iotatonos = 0x038a; 44522 t.Ismall = 0xf769; 44523 t.Istroke = 0x0197; 44524 t.Itilde = 0x0128; 44525 t.Itildebelow = 0x1e2c; 44526 t.Izhitsacyrillic = 0x0474; 44527 t.Izhitsadblgravecyrillic = 0x0476; 44528 t.J = 0x004a; 44529 t.Jaarmenian = 0x0541; 44530 t.Jcircle = 0x24bf; 44531 t.Jcircumflex = 0x0134; 44532 t.Jecyrillic = 0x0408; 44533 t.Jheharmenian = 0x054b; 44534 t.Jmonospace = 0xff2a; 44535 t.Jsmall = 0xf76a; 44536 t.K = 0x004b; 44537 t.KBsquare = 0x3385; 44538 t.KKsquare = 0x33cd; 44539 t.Kabashkircyrillic = 0x04a0; 44540 t.Kacute = 0x1e30; 44541 t.Kacyrillic = 0x041a; 44542 t.Kadescendercyrillic = 0x049a; 44543 t.Kahookcyrillic = 0x04c3; 44544 t.Kappa = 0x039a; 44545 t.Kastrokecyrillic = 0x049e; 44546 t.Kaverticalstrokecyrillic = 0x049c; 44547 t.Kcaron = 0x01e8; 44548 t.Kcedilla = 0x0136; 44549 t.Kcircle = 0x24c0; 44550 t.Kcommaaccent = 0x0136; 44551 t.Kdotbelow = 0x1e32; 44552 t.Keharmenian = 0x0554; 44553 t.Kenarmenian = 0x053f; 44554 t.Khacyrillic = 0x0425; 44555 t.Kheicoptic = 0x03e6; 44556 t.Khook = 0x0198; 44557 t.Kjecyrillic = 0x040c; 44558 t.Klinebelow = 0x1e34; 44559 t.Kmonospace = 0xff2b; 44560 t.Koppacyrillic = 0x0480; 44561 t.Koppagreek = 0x03de; 44562 t.Ksicyrillic = 0x046e; 44563 t.Ksmall = 0xf76b; 44564 t.L = 0x004c; 44565 t.LJ = 0x01c7; 44566 t.LL = 0xf6bf; 44567 t.Lacute = 0x0139; 44568 t.Lambda = 0x039b; 44569 t.Lcaron = 0x013d; 44570 t.Lcedilla = 0x013b; 44571 t.Lcircle = 0x24c1; 44572 t.Lcircumflexbelow = 0x1e3c; 44573 t.Lcommaaccent = 0x013b; 44574 t.Ldot = 0x013f; 44575 t.Ldotaccent = 0x013f; 44576 t.Ldotbelow = 0x1e36; 44577 t.Ldotbelowmacron = 0x1e38; 44578 t.Liwnarmenian = 0x053c; 44579 t.Lj = 0x01c8; 44580 t.Ljecyrillic = 0x0409; 44581 t.Llinebelow = 0x1e3a; 44582 t.Lmonospace = 0xff2c; 44583 t.Lslash = 0x0141; 44584 t.Lslashsmall = 0xf6f9; 44585 t.Lsmall = 0xf76c; 44586 t.M = 0x004d; 44587 t.MBsquare = 0x3386; 44588 t.Macron = 0xf6d0; 44589 t.Macronsmall = 0xf7af; 44590 t.Macute = 0x1e3e; 44591 t.Mcircle = 0x24c2; 44592 t.Mdotaccent = 0x1e40; 44593 t.Mdotbelow = 0x1e42; 44594 t.Menarmenian = 0x0544; 44595 t.Mmonospace = 0xff2d; 44596 t.Msmall = 0xf76d; 44597 t.Mturned = 0x019c; 44598 t.Mu = 0x039c; 44599 t.N = 0x004e; 44600 t.NJ = 0x01ca; 44601 t.Nacute = 0x0143; 44602 t.Ncaron = 0x0147; 44603 t.Ncedilla = 0x0145; 44604 t.Ncircle = 0x24c3; 44605 t.Ncircumflexbelow = 0x1e4a; 44606 t.Ncommaaccent = 0x0145; 44607 t.Ndotaccent = 0x1e44; 44608 t.Ndotbelow = 0x1e46; 44609 t.Nhookleft = 0x019d; 44610 t.Nineroman = 0x2168; 44611 t.Nj = 0x01cb; 44612 t.Njecyrillic = 0x040a; 44613 t.Nlinebelow = 0x1e48; 44614 t.Nmonospace = 0xff2e; 44615 t.Nowarmenian = 0x0546; 44616 t.Nsmall = 0xf76e; 44617 t.Ntilde = 0x00d1; 44618 t.Ntildesmall = 0xf7f1; 44619 t.Nu = 0x039d; 44620 t.O = 0x004f; 44621 t.OE = 0x0152; 44622 t.OEsmall = 0xf6fa; 44623 t.Oacute = 0x00d3; 44624 t.Oacutesmall = 0xf7f3; 44625 t.Obarredcyrillic = 0x04e8; 44626 t.Obarreddieresiscyrillic = 0x04ea; 44627 t.Obreve = 0x014e; 44628 t.Ocaron = 0x01d1; 44629 t.Ocenteredtilde = 0x019f; 44630 t.Ocircle = 0x24c4; 44631 t.Ocircumflex = 0x00d4; 44632 t.Ocircumflexacute = 0x1ed0; 44633 t.Ocircumflexdotbelow = 0x1ed8; 44634 t.Ocircumflexgrave = 0x1ed2; 44635 t.Ocircumflexhookabove = 0x1ed4; 44636 t.Ocircumflexsmall = 0xf7f4; 44637 t.Ocircumflextilde = 0x1ed6; 44638 t.Ocyrillic = 0x041e; 44639 t.Odblacute = 0x0150; 44640 t.Odblgrave = 0x020c; 44641 t.Odieresis = 0x00d6; 44642 t.Odieresiscyrillic = 0x04e6; 44643 t.Odieresissmall = 0xf7f6; 44644 t.Odotbelow = 0x1ecc; 44645 t.Ogoneksmall = 0xf6fb; 44646 t.Ograve = 0x00d2; 44647 t.Ogravesmall = 0xf7f2; 44648 t.Oharmenian = 0x0555; 44649 t.Ohm = 0x2126; 44650 t.Ohookabove = 0x1ece; 44651 t.Ohorn = 0x01a0; 44652 t.Ohornacute = 0x1eda; 44653 t.Ohorndotbelow = 0x1ee2; 44654 t.Ohorngrave = 0x1edc; 44655 t.Ohornhookabove = 0x1ede; 44656 t.Ohorntilde = 0x1ee0; 44657 t.Ohungarumlaut = 0x0150; 44658 t.Oi = 0x01a2; 44659 t.Oinvertedbreve = 0x020e; 44660 t.Omacron = 0x014c; 44661 t.Omacronacute = 0x1e52; 44662 t.Omacrongrave = 0x1e50; 44663 t.Omega = 0x2126; 44664 t.Omegacyrillic = 0x0460; 44665 t.Omegagreek = 0x03a9; 44666 t.Omegaroundcyrillic = 0x047a; 44667 t.Omegatitlocyrillic = 0x047c; 44668 t.Omegatonos = 0x038f; 44669 t.Omicron = 0x039f; 44670 t.Omicrontonos = 0x038c; 44671 t.Omonospace = 0xff2f; 44672 t.Oneroman = 0x2160; 44673 t.Oogonek = 0x01ea; 44674 t.Oogonekmacron = 0x01ec; 44675 t.Oopen = 0x0186; 44676 t.Oslash = 0x00d8; 44677 t.Oslashacute = 0x01fe; 44678 t.Oslashsmall = 0xf7f8; 44679 t.Osmall = 0xf76f; 44680 t.Ostrokeacute = 0x01fe; 44681 t.Otcyrillic = 0x047e; 44682 t.Otilde = 0x00d5; 44683 t.Otildeacute = 0x1e4c; 44684 t.Otildedieresis = 0x1e4e; 44685 t.Otildesmall = 0xf7f5; 44686 t.P = 0x0050; 44687 t.Pacute = 0x1e54; 44688 t.Pcircle = 0x24c5; 44689 t.Pdotaccent = 0x1e56; 44690 t.Pecyrillic = 0x041f; 44691 t.Peharmenian = 0x054a; 44692 t.Pemiddlehookcyrillic = 0x04a6; 44693 t.Phi = 0x03a6; 44694 t.Phook = 0x01a4; 44695 t.Pi = 0x03a0; 44696 t.Piwrarmenian = 0x0553; 44697 t.Pmonospace = 0xff30; 44698 t.Psi = 0x03a8; 44699 t.Psicyrillic = 0x0470; 44700 t.Psmall = 0xf770; 44701 t.Q = 0x0051; 44702 t.Qcircle = 0x24c6; 44703 t.Qmonospace = 0xff31; 44704 t.Qsmall = 0xf771; 44705 t.R = 0x0052; 44706 t.Raarmenian = 0x054c; 44707 t.Racute = 0x0154; 44708 t.Rcaron = 0x0158; 44709 t.Rcedilla = 0x0156; 44710 t.Rcircle = 0x24c7; 44711 t.Rcommaaccent = 0x0156; 44712 t.Rdblgrave = 0x0210; 44713 t.Rdotaccent = 0x1e58; 44714 t.Rdotbelow = 0x1e5a; 44715 t.Rdotbelowmacron = 0x1e5c; 44716 t.Reharmenian = 0x0550; 44717 t.Rfraktur = 0x211c; 44718 t.Rho = 0x03a1; 44719 t.Ringsmall = 0xf6fc; 44720 t.Rinvertedbreve = 0x0212; 44721 t.Rlinebelow = 0x1e5e; 44722 t.Rmonospace = 0xff32; 44723 t.Rsmall = 0xf772; 44724 t.Rsmallinverted = 0x0281; 44725 t.Rsmallinvertedsuperior = 0x02b6; 44726 t.S = 0x0053; 44727 t.SF010000 = 0x250c; 44728 t.SF020000 = 0x2514; 44729 t.SF030000 = 0x2510; 44730 t.SF040000 = 0x2518; 44731 t.SF050000 = 0x253c; 44732 t.SF060000 = 0x252c; 44733 t.SF070000 = 0x2534; 44734 t.SF080000 = 0x251c; 44735 t.SF090000 = 0x2524; 44736 t.SF100000 = 0x2500; 44737 t.SF110000 = 0x2502; 44738 t.SF190000 = 0x2561; 44739 t.SF200000 = 0x2562; 44740 t.SF210000 = 0x2556; 44741 t.SF220000 = 0x2555; 44742 t.SF230000 = 0x2563; 44743 t.SF240000 = 0x2551; 44744 t.SF250000 = 0x2557; 44745 t.SF260000 = 0x255d;
44746 t.SF270000 = 0x255c; 44747 t.SF280000 = 0x255b; 44748 t.SF360000 = 0x255e; 44749 t.SF370000 = 0x255f; 44750 t.SF380000 = 0x255a; 44751 t.SF390000 = 0x2554; 44752 t.SF400000 = 0x2569; 44753 t.SF410000 = 0x2566; 44754 t.SF420000 = 0x2560; 44755 t.SF430000 = 0x2550; 44756 t.SF440000 = 0x256c; 44757 t.SF450000 = 0x2567; 44758 t.SF460000 = 0x2568; 44759 t.SF470000 = 0x2564; 44760 t.SF480000 = 0x2565; 44761 t.SF490000 = 0x2559; 44762 t.SF500000 = 0x2558; 44763 t.SF510000 = 0x2552; 44764 t.SF520000 = 0x2553; 44765 t.SF530000 = 0x256b; 44766 t.SF540000 = 0x256a; 44767 t.Sacute = 0x015a; 44768 t.Sacutedotaccent = 0x1e64; 44769 t.Sampigreek = 0x03e0; 44770 t.Scaron = 0x0160; 44771 t.Scarondotaccent = 0x1e66; 44772 t.Scaronsmall = 0xf6fd; 44773 t.Scedilla = 0x015e; 44774 t.Schwa = 0x018f; 44775 t.Schwacyrillic = 0x04d8; 44776 t.Schwadieresiscyrillic = 0x04da; 44777 t.Scircle = 0x24c8; 44778 t.Scircumflex = 0x015c; 44779 t.Scommaaccent = 0x0218; 44780 t.Sdotaccent = 0x1e60; 44781 t.Sdotbelow = 0x1e62; 44782 t.Sdotbelowdotaccent = 0x1e68; 44783 t.Seharmenian = 0x054d; 44784 t.Sevenroman = 0x2166; 44785 t.Shaarmenian = 0x0547; 44786 t.Shacyrillic = 0x0428; 44787 t.Shchacyrillic = 0x0429; 44788 t.Sheicoptic = 0x03e2; 44789 t.Shhacyrillic = 0x04ba; 44790 t.Shimacoptic = 0x03ec; 44791 t.Sigma = 0x03a3; 44792 t.Sixroman = 0x2165; 44793 t.Smonospace = 0xff33; 44794 t.Softsigncyrillic = 0x042c; 44795 t.Ssmall = 0xf773; 44796 t.Stigmagreek = 0x03da; 44797 t.T = 0x0054; 44798 t.Tau = 0x03a4; 44799 t.Tbar = 0x0166; 44800 t.Tcaron = 0x0164; 44801 t.Tcedilla = 0x0162; 44802 t.Tcircle = 0x24c9; 44803 t.Tcircumflexbelow = 0x1e70; 44804 t.Tcommaaccent = 0x0162; 44805 t.Tdotaccent = 0x1e6a; 44806 t.Tdotbelow = 0x1e6c; 44807 t.Tecyrillic = 0x0422; 44808 t.Tedescendercyrillic = 0x04ac; 44809 t.Tenroman = 0x2169; 44810 t.Tetsecyrillic = 0x04b4; 44811 t.Theta = 0x0398; 44812 t.Thook = 0x01ac; 44813 t.Thorn = 0x00de; 44814 t.Thornsmall = 0xf7fe; 44815 t.Threeroman = 0x2162; 44816 t.Tildesmall = 0xf6fe; 44817 t.Tiwnarmenian = 0x054f; 44818 t.Tlinebelow = 0x1e6e; 44819 t.Tmonospace = 0xff34; 44820 t.Toarmenian = 0x0539; 44821 t.Tonefive = 0x01bc; 44822 t.Tonesix = 0x0184; 44823 t.Tonetwo = 0x01a7; 44824 t.Tretroflexhook = 0x01ae; 44825 t.Tsecyrillic = 0x0426; 44826 t.Tshecyrillic = 0x040b; 44827 t.Tsmall = 0xf774; 44828 t.Twelveroman = 0x216b; 44829 t.Tworoman = 0x2161; 44830 t.U = 0x0055; 44831 t.Uacute = 0x00da; 44832 t.Uacutesmall = 0xf7fa; 44833 t.Ubreve = 0x016c; 44834 t.Ucaron = 0x01d3; 44835 t.Ucircle = 0x24ca; 44836 t.Ucircumflex = 0x00db; 44837 t.Ucircumflexbelow = 0x1e76; 44838 t.Ucircumflexsmall = 0xf7fb; 44839 t.Ucyrillic = 0x0423; 44840 t.Udblacute = 0x0170; 44841 t.Udblgrave = 0x0214; 44842 t.Udieresis = 0x00dc; 44843 t.Udieresisacute = 0x01d7; 44844 t.Udieresisbelow = 0x1e72; 44845 t.Udieresiscaron = 0x01d9; 44846 t.Udieresiscyrillic = 0x04f0; 44847 t.Udieresisgrave = 0x01db; 44848 t.Udieresismacron = 0x01d5; 44849 t.Udieresissmall = 0xf7fc; 44850 t.Udotbelow = 0x1ee4; 44851 t.Ugrave = 0x00d9; 44852 t.Ugravesmall = 0xf7f9; 44853 t.Uhookabove = 0x1ee6; 44854 t.Uhorn = 0x01af; 44855 t.Uhornacute = 0x1ee8; 44856 t.Uhorndotbelow = 0x1ef0; 44857 t.Uhorngrave = 0x1eea; 44858 t.Uhornhookabove = 0x1eec; 44859 t.Uhorntilde = 0x1eee; 44860 t.Uhungarumlaut = 0x0170; 44861 t.Uhungarumlautcyrillic = 0x04f2; 44862 t.Uinvertedbreve = 0x0216; 44863 t.Ukcyrillic = 0x0478; 44864 t.Umacron = 0x016a; 44865 t.Umacroncyrillic = 0x04ee; 44866 t.Umacrondieresis = 0x1e7a; 44867 t.Umonospace = 0xff35; 44868 t.Uogonek = 0x0172; 44869 t.Upsilon = 0x03a5; 44870 t.Upsilon1 = 0x03d2; 44871 t.Upsilonacutehooksymbolgreek = 0x03d3; 44872 t.Upsilonafrican = 0x01b1; 44873 t.Upsilondieresis = 0x03ab; 44874 t.Upsilondieresishooksymbolgreek = 0x03d4; 44875 t.Upsilonhooksymbol = 0x03d2; 44876 t.Upsilontonos = 0x038e; 44877 t.Uring = 0x016e; 44878 t.Ushortcyrillic = 0x040e; 44879 t.Usmall = 0xf775; 44880 t.Ustraightcyrillic = 0x04ae; 44881 t.Ustraightstrokecyrillic = 0x04b0; 44882 t.Utilde = 0x0168; 44883 t.Utildeacute = 0x1e78; 44884 t.Utildebelow = 0x1e74; 44885 t.V = 0x0056; 44886 t.Vcircle = 0x24cb; 44887 t.Vdotbelow = 0x1e7e; 44888 t.Vecyrillic = 0x0412; 44889 t.Vewarmenian = 0x054e; 44890 t.Vhook = 0x01b2; 44891 t.Vmonospace = 0xff36; 44892 t.Voarmenian = 0x0548; 44893 t.Vsmall = 0xf776; 44894 t.Vtilde = 0x1e7c; 44895 t.W = 0x0057; 44896 t.Wacute = 0x1e82; 44897 t.Wcircle = 0x24cc; 44898 t.Wcircumflex = 0x0174; 44899 t.Wdieresis = 0x1e84; 44900 t.Wdotaccent = 0x1e86; 44901 t.Wdotbelow = 0x1e88; 44902 t.Wgrave = 0x1e80; 44903 t.Wmonospace = 0xff37; 44904 t.Wsmall = 0xf777; 44905 t.X = 0x0058; 44906 t.Xcircle = 0x24cd; 44907 t.Xdieresis = 0x1e8c; 44908 t.Xdotaccent = 0x1e8a; 44909 t.Xeharmenian = 0x053d; 44910 t.Xi = 0x039e; 44911 t.Xmonospace = 0xff38; 44912 t.Xsmall = 0xf778; 44913 t.Y = 0x0059; 44914 t.Yacute = 0x00dd; 44915 t.Yacutesmall = 0xf7fd; 44916 t.Yatcyrillic = 0x0462; 44917 t.Ycircle = 0x24ce; 44918 t.Ycircumflex = 0x0176; 44919 t.Ydieresis = 0x0178; 44920 t.Ydieresissmall = 0xf7ff; 44921 t.Ydotaccent = 0x1e8e; 44922 t.Ydotbelow = 0x1ef4; 44923 t.Yericyrillic = 0x042b; 44924 t.Yerudieresiscyrillic = 0x04f8; 44925 t.Ygrave = 0x1ef2; 44926 t.Yhook = 0x01b3; 44927 t.Yhookabove = 0x1ef6; 44928 t.Yiarmenian = 0x0545; 44929 t.Yicyrillic = 0x0407; 44930 t.Yiwnarmenian = 0x0552; 44931 t.Ymonospace = 0xff39; 44932 t.Ysmall = 0xf779; 44933 t.Ytilde = 0x1ef8; 44934 t.Yusbigcyrillic = 0x046a; 44935 t.Yusbigiotifiedcyrillic = 0x046c; 44936 t.Yuslittlecyrillic = 0x0466; 44937 t.Yuslittleiotifiedcyrillic = 0x0468; 44938 t.Z = 0x005a; 44939 t.Zaarmenian = 0x0536; 44940 t.Zacute = 0x0179; 44941 t.Zcaron = 0x017d; 44942 t.Zcaronsmall = 0xf6ff; 44943 t.Zcircle = 0x24cf; 44944 t.Zcircumflex = 0x1e90; 44945 t.Zdot = 0x017b; 44946 t.Zdotaccent = 0x017b; 44947 t.Zdotbelow = 0x1e92; 44948 t.Zecyrillic = 0x0417; 44949 t.Zedescendercyrillic = 0x0498; 44950 t.Zedieresiscyrillic = 0x04de; 44951 t.Zeta = 0x0396; 44952 t.Zhearmenian = 0x053a; 44953 t.Zhebrevecyrillic = 0x04c1; 44954 t.Zhecyrillic = 0x0416; 44955 t.Zhedescendercyrillic = 0x0496; 44956 t.Zhedieresiscyrillic = 0x04dc; 44957 t.Zlinebelow = 0x1e94; 44958 t.Zmonospace = 0xff3a; 44959 t.Zsmall = 0xf77a; 44960 t.Zstroke = 0x01b5; 44961 t.a = 0x0061; 44962 t.aabengali = 0x0986; 44963 t.aacute = 0x00e1; 44964 t.aadeva = 0x0906; 44965 t.aagujarati = 0x0a86; 44966 t.aagurmukhi = 0x0a06; 44967 t.aamatragurmukhi = 0x0a3e; 44968 t.aarusquare = 0x3303; 44969 t.aavowelsignbengali = 0x09be; 44970 t.aavowelsigndeva = 0x093e; 44971 t.aavowelsigngujarati = 0x0abe; 44972 t.abbreviationmarkarmenian = 0x055f; 44973 t.abbreviationsigndeva = 0x0970; 44974 t.abengali = 0x0985; 44975 t.abopomofo = 0x311a; 44976 t.abreve = 0x0103; 44977 t.abreveacute = 0x1eaf; 44978 t.abrevecyrillic = 0x04d1; 44979 t.abrevedotbelow = 0x1eb7; 44980 t.abrevegrave = 0x1eb1; 44981 t.abrevehookabove = 0x1eb3; 44982 t.abrevetilde = 0x1eb5; 44983 t.acaron = 0x01ce; 44984 t.acircle = 0x24d0; 44985 t.acircumflex = 0x00e2; 44986 t.acircumflexacute = 0x1ea5; 44987 t.acircumflexdotbelow = 0x1ead; 44988 t.acircumflexgrave = 0x1ea7; 44989 t.acircumflexhookabove = 0x1ea9; 44990 t.acircumflextilde = 0x1eab; 44991 t.acute = 0x00b4; 44992 t.acutebelowcmb = 0x0317; 44993 t.acutecmb = 0x0301; 44994 t.acutecomb = 0x0301; 44995 t.acutedeva = 0x0954; 44996 t.acutelowmod = 0x02cf; 44997 t.acutetonecmb = 0x0341; 44998 t.acyrillic = 0x0430; 44999 t.adblgrave = 0x0201; 45000 t.addakgurmukhi = 0x0a71; 45001 t.adeva = 0x0905; 45002 t.adieresis = 0x00e4; 45003 t.adieresiscyrillic = 0x04d3; 45004 t.adieresismacron = 0x01df; 45005 t.adotbelow = 0x1ea1; 45006 t.adotmacron = 0x01e1; 45007 t.ae = 0x00e6; 45008 t.aeacute = 0x01fd; 45009 t.aekorean = 0x3150; 45010 t.aemacron = 0x01e3; 45011 t.afii00208 = 0x2015; 45012 t.afii08941 = 0x20a4; 45013 t.afii10017 = 0x0410; 45014 t.afii10018 = 0x0411; 45015 t.afii10019 = 0x0412; 45016 t.afii10020 = 0x0413;
45017 t.afii10021 = 0x0414; 45018 t.afii10022 = 0x0415; 45019 t.afii10023 = 0x0401; 45020 t.afii10024 = 0x0416; 45021 t.afii10025 = 0x0417; 45022 t.afii10026 = 0x0418; 45023 t.afii10027 = 0x0419; 45024 t.afii10028 = 0x041a; 45025 t.afii10029 = 0x041b; 45026 t.afii10030 = 0x041c; 45027 t.afii10031 = 0x041d; 45028 t.afii10032 = 0x041e; 45029 t.afii10033 = 0x041f; 45030 t.afii10034 = 0x0420; 45031 t.afii10035 = 0x0421; 45032 t.afii10036 = 0x0422; 45033 t.afii10037 = 0x0423; 45034 t.afii10038 = 0x0424; 45035 t.afii10039 = 0x0425; 45036 t.afii10040 = 0x0426; 45037 t.afii10041 = 0x0427; 45038 t.afii10042 = 0x0428; 45039 t.afii10043 = 0x0429; 45040 t.afii10044 = 0x042a; 45041 t.afii10045 = 0x042b; 45042 t.afii10046 = 0x042c; 45043 t.afii10047 = 0x042d; 45044 t.afii10048 = 0x042e; 45045 t.afii10049 = 0x042f; 45046 t.afii10050 = 0x0490; 45047 t.afii10051 = 0x0402; 45048 t.afii10052 = 0x0403; 45049 t.afii10053 = 0x0404; 45050 t.afii10054 = 0x0405; 45051 t.afii10055 = 0x0406; 45052 t.afii10056 = 0x0407; 45053 t.afii10057 = 0x0408; 45054 t.afii10058 = 0x0409; 45055 t.afii10059 = 0x040a; 45056 t.afii10060 = 0x040b; 45057 t.afii10061 = 0x040c; 45058 t.afii10062 = 0x040e; 45059 t.afii10063 = 0xf6c4; 45060 t.afii10064 = 0xf6c5; 45061 t.afii10065 = 0x0430; 45062 t.afii10066 = 0x0431; 45063 t.afii10067 = 0x0432; 45064 t.afii10068 = 0x0433; 45065 t.afii10069 = 0x0434; 45066 t.afii10070 = 0x0435; 45067 t.afii10071 = 0x0451; 45068 t.afii10072 = 0x0436; 45069 t.afii10073 = 0x0437; 45070 t.afii10074 = 0x0438; 45071 t.afii10075 = 0x0439; 45072 t.afii10076 = 0x043a; 45073 t.afii10077 = 0x043b; 45074 t.afii10078 = 0x043c; 45075 t.afii10079 = 0x043d; 45076 t.afii10080 = 0x043e; 45077 t.afii10081 = 0x043f; 45078 t.afii10082 = 0x0440; 45079 t.afii10083 = 0x0441; 45080 t.afii10084 = 0x0442; 45081 t.afii10085 = 0x0443; 45082 t.afii10086 = 0x0444; 45083 t.afii10087 = 0x0445; 45084 t.afii10088 = 0x0446; 45085 t.afii10089 = 0x0447; 45086 t.afii10090 = 0x0448; 45087 t.afii10091 = 0x0449; 45088 t.afii10092 = 0x044a; 45089 t.afii10093 = 0x044b; 45090 t.afii10094 = 0x044c; 45091 t.afii10095 = 0x044d; 45092 t.afii10096 = 0x044e; 45093 t.afii10097 = 0x044f; 45094 t.afii10098 = 0x0491; 45095 t.afii10099 = 0x0452; 45096 t.afii10100 = 0x0453; 45097 t.afii10101 = 0x0454; 45098 t.afii10102 = 0x0455; 45099 t.afii10103 = 0x0456; 45100 t.afii10104 = 0x0457; 45101 t.afii10105 = 0x0458; 45102 t.afii10106 = 0x0459;
45103 t.afii10107 = 0x045a; 45104 t.afii10108 = 0x045b; 45105 t.afii10109 = 0x045c; 45106 t.afii10110 = 0x045e; 45107 t.afii10145 = 0x040f; 45108 t.afii10146 = 0x0462; 45109 t.afii10147 = 0x0472; 45110 t.afii10148 = 0x0474; 45111 t.afii10192 = 0xf6c6; 45112 t.afii10193 = 0x045f; 45113 t.afii10194 = 0x0463; 45114 t.afii10195 = 0x0473; 45115 t.afii10196 = 0x0475; 45116 t.afii10831 = 0xf6c7; 45117 t.afii10832 = 0xf6c8; 45118 t.afii10846 = 0x04d9; 45119 t.afii299 = 0x200e; 45120 t.afii300 = 0x200f; 45121 t.afii301 = 0x200d; 45122 t.afii57381 = 0x066a; 45123 t.afii57388 = 0x060c; 45124 t.afii57392 = 0x0660; 45125 t.afii57393 = 0x0661; 45126 t.afii57394 = 0x0662; 45127 t.afii57395 = 0x0663; 45128 t.afii57396 = 0x0664; 45129 t.afii57397 = 0x0665; 45130 t.afii57398 = 0x0666; 45131 t.afii57399 = 0x0667; 45132 t.afii57400 = 0x0668; 45133 t.afii57401 = 0x0669; 45134 t.afii57403 = 0x061b; 45135 t.afii57407 = 0x061f; 45136 t.afii57409 = 0x0621; 45137 t.afii57410 = 0x0622; 45138 t.afii57411 = 0x0623; 45139 t.afii57412 = 0x0624; 45140 t.afii57413 = 0x0625; 45141 t.afii57414 = 0x0626; 45142 t.afii57415 = 0x0627; 45143 t.afii57416 = 0x0628; 45144 t.afii57417 = 0x0629; 45145 t.afii57418 = 0x062a; 45146 t.afii57419 = 0x062b; 45147 t.afii57420 = 0x062c; 45148 t.afii57421 = 0x062d; 45149 t.afii57422 = 0x062e; 45150 t.afii57423 = 0x062f; 45151 t.afii57424 = 0x0630; 45152 t.afii57425 = 0x0631; 45153 t.afii57426 = 0x0632; 45154 t.afii57427 = 0x0633; 45155 t.afii57428 = 0x0634; 45156 t.afii57429 = 0x0635; 45157 t.afii57430 = 0x0636; 45158 t.afii57431 = 0x0637; 45159 t.afii57432 = 0x0638; 45160 t.afii57433 = 0x0639; 45161 t.afii57434 = 0x063a; 45162 t.afii57440 = 0x0640; 45163 t.afii57441 = 0x0641; 45164 t.afii57442 = 0x0642; 45165 t.afii57443 = 0x0643; 45166 t.afii57444 = 0x0644; 45167 t.afii57445 = 0x0645; 45168 t.afii57446 = 0x0646; 45169 t.afii57448 = 0x0648; 45170 t.afii57449 = 0x0649; 45171 t.afii57450 = 0x064a; 45172 t.afii57451 = 0x064b; 45173 t.afii57452 = 0x064c; 45174 t.afii57453 = 0x064d; 45175 t.afii57454 = 0x064e; 45176 t.afii57455 = 0x064f; 45177 t.afii57456 = 0x0650; 45178 t.afii57457 = 0x0651; 45179 t.afii57458 = 0x0652; 45180 t.afii57470 = 0x0647; 45181 t.afii57505 = 0x06a4; 45182 t.afii57506 = 0x067e; 45183 t.afii57507 = 0x0686; 45184 t.afii57508 = 0x0698; 45185 t.afii57509 = 0x06af; 45186 t.afii57511 = 0x0679; 45187 t.afii57512 = 0x0688; 45188 t.afii57513 = 0x0691; 45189 t.afii57514 = 0x06ba; 45190 t.afii57519 = 0x06d2; 45191 t.afii57534 = 0x06d5; 45192 t.afii57636 = 0x20aa; 45193 t.afii57645 = 0x05be; 45194 t.afii57658 = 0x05c3; 45195 t.afii57664 = 0x05d0; 45196 t.afii57665 = 0x05d1; 45197 t.afii57666 = 0x05d2; 45198 t.afii57667 = 0x05d3; 45199 t.afii57668 = 0x05d4; 45200 t.afii57669 = 0x05d5; 45201 t.afii57670 = 0x05d6; 45202 t.afii57671 = 0x05d7; 45203 t.afii57672 = 0x05d8; 45204 t.afii57673 = 0x05d9; 45205 t.afii57674 = 0x05da; 45206 t.afii57675 = 0x05db; 45207 t.afii57676 = 0x05dc; 45208 t.afii57677 = 0x05dd; 45209 t.afii57678 = 0x05de; 45210 t.afii57679 = 0x05df; 45211 t.afii57680 = 0x05e0; 45212 t.afii57681 = 0x05e1; 45213 t.afii57682 = 0x05e2; 45214 t.afii57683 = 0x05e3; 45215 t.afii57684 = 0x05e4; 45216 t.afii57685 = 0x05e5; 45217 t.afii57686 = 0x05e6; 45218 t.afii57687 = 0x05e7; 45219 t.afii57688 = 0x05e8; 45220 t.afii57689 = 0x05e9; 45221 t.afii57690 = 0x05ea; 45222 t.afii57694 = 0xfb2a; 45223 t.afii57695 = 0xfb2b; 45224 t.afii57700 = 0xfb4b; 45225 t.afii57705 = 0xfb1f; 45226 t.afii57716 = 0x05f0; 45227 t.afii57717 = 0x05f1; 45228 t.afii57718 = 0x05f2; 45229 t.afii57723 = 0xfb35; 45230 t.afii57793 = 0x05b4; 45231 t.afii57794 = 0x05b5; 45232 t.afii57795 = 0x05b6; 45233 t.afii57796 = 0x05bb; 45234 t.afii57797 = 0x05b8; 45235 t.afii57798 = 0x05b7; 45236 t.afii57799 = 0x05b0; 45237 t.afii57800 = 0x05b2; 45238 t.afii57801 = 0x05b1; 45239 t.afii57802 = 0x05b3; 45240 t.afii57803 = 0x05c2; 45241 t.afii57804 = 0x05c1; 45242 t.afii57806 = 0x05b9; 45243 t.afii57807 = 0x05bc; 45244 t.afii57839 = 0x05bd; 45245 t.afii57841 = 0x05bf; 45246 t.afii57842 = 0x05c0; 45247 t.afii57929 = 0x02bc; 45248 t.afii61248 = 0x2105; 45249 t.afii61289 = 0x2113; 45250 t.afii61352 = 0x2116; 45251 t.afii61573 = 0x202c; 45252 t.afii61574 = 0x202d; 45253 t.afii61575 = 0x202e; 45254 t.afii61664 = 0x200c; 45255 t.afii63167 = 0x066d; 45256 t.afii64937 = 0x02bd; 45257 t.agrave = 0x00e0; 45258 t.agujarati = 0x0a85; 45259 t.agurmukhi = 0x0a05; 45260 t.ahiragana = 0x3042; 45261 t.ahookabove = 0x1ea3; 45262 t.aibengali = 0x0990; 45263 t.aibopomofo = 0x311e; 45264 t.aideva = 0x0910; 45265 t.aiecyrillic = 0x04d5; 45266 t.aigujarati = 0x0a90; 45267 t.aigurmukhi = 0x0a10; 45268 t.aimatragurmukhi = 0x0a48; 45269 t.ainarabic = 0x0639; 45270 t.ainfinalarabic = 0xfeca; 45271 t.aininitialarabic = 0xfecb; 45272 t.ainmedialarabic = 0xfecc; 45273 t.ainvertedbreve = 0x0203; 45274 t.aivowelsignbengali = 0x09c8; 45275 t.aivowelsigndeva = 0x0948; 45276 t.aivowelsigngujarati = 0x0ac8; 45277 t.akatakana = 0x30a2; 45278 t.akatakanahalfwidth = 0xff71; 45279 t.akorean = 0x314f; 45280 t.alef = 0x05d0; 45281 t.alefarabic = 0x0627; 45282 t.alefdageshhebrew = 0xfb30; 45283 t.aleffinalarabic = 0xfe8e; 45284 t.alefhamzaabovearabic = 0x0623; 45285 t.alefhamzaabovefinalarabic = 0xfe84; 45286 t.alefhamzabelowarabic = 0x0625; 45287 t.alefhamzabelowfinalarabic = 0xfe88; 45288 t.alefhebrew = 0x05d0; 45289 t.aleflamedhebrew = 0xfb4f; 45290 t.alefmaddaabovearabic = 0x0622; 45291 t.alefmaddaabovefinalarabic = 0xfe82; 45292 t.alefmaksuraarabic = 0x0649; 45293 t.alefmaksurafinalarabic = 0xfef0; 45294 t.alefmaksurainitialarabic = 0xfef3; 45295 t.alefmaksuramedialarabic = 0xfef4;
45296 t.alefpatahhebrew = 0xfb2e; 45297 t.alefqamatshebrew = 0xfb2f; 45298 t.aleph = 0x2135; 45299 t.allequal = 0x224c; 45300 t.alpha = 0x03b1; 45301 t.alphatonos = 0x03ac; 45302 t.amacron = 0x0101; 45303 t.amonospace = 0xff41; 45304 t.ampersand = 0x0026; 45305 t.ampersandmonospace = 0xff06; 45306 t.ampersandsmall = 0xf726; 45307 t.amsquare = 0x33c2; 45308 t.anbopomofo = 0x3122; 45309 t.angbopomofo = 0x3124; 45310 t.angbracketleft = 0x3008; 45311 t.angbracketright = 0x3009; 45312 t.angkhankhuthai = 0x0e5a; 45313 t.angle = 0x2220; 45314 t.anglebracketleft = 0x3008; 45315 t.anglebracketleftvertical = 0xfe3f; 45316 t.anglebracketright = 0x3009; 45317 t.anglebracketrightvertical = 0xfe40; 45318 t.angleleft = 0x2329; 45319 t.angleright = 0x232a; 45320 t.angstrom = 0x212b; 45321 t.anoteleia = 0x0387; 45322 t.anudattadeva = 0x0952; 45323 t.anusvarabengali = 0x0982; 45324 t.anusvaradeva = 0x0902; 45325 t.anusvaragujarati = 0x0a82; 45326 t.aogonek = 0x0105; 45327 t.apaatosquare = 0x3300; 45328 t.aparen = 0x249c; 45329 t.apostrophearmenian = 0x055a; 45330 t.apostrophemod = 0x02bc; 45331 t.apple = 0xf8ff; 45332 t.approaches = 0x2250; 45333 t.approxequal = 0x2248; 45334 t.approxequalorimage = 0x2252; 45335 t.approximatelyequal = 0x2245; 45336 t.araeaekorean = 0x318e; 45337 t.araeakorean = 0x318d; 45338 t.arc = 0x2312; 45339 t.arighthalfring = 0x1e9a; 45340 t.aring = 0x00e5; 45341 t.aringacute = 0x01fb; 45342 t.aringbelow = 0x1e01; 45343 t.arrowboth = 0x2194; 45344 t.arrowdashdown = 0x21e3; 45345 t.arrowdashleft = 0x21e0; 45346 t.arrowdashright = 0x21e2; 45347 t.arrowdashup = 0x21e1; 45348 t.arrowdblboth = 0x21d4; 45349 t.arrowdbldown = 0x21d3; 45350 t.arrowdblleft = 0x21d0; 45351 t.arrowdblright = 0x21d2; 45352 t.arrowdblup = 0x21d1; 45353 t.arrowdown = 0x2193; 45354 t.arrowdownleft = 0x2199; 45355 t.arrowdownright = 0x2198; 45356 t.arrowdownwhite = 0x21e9; 45357 t.arrowheaddownmod = 0x02c5; 45358 t.arrowheadleftmod = 0x02c2; 45359 t.arrowheadrightmod = 0x02c3; 45360 t.arrowheadupmod = 0x02c4; 45361 t.arrowhorizex = 0xf8e7; 45362 t.arrowleft = 0x2190; 45363 t.arrowleftdbl = 0x21d0; 45364 t.arrowleftdblstroke = 0x21cd; 45365 t.arrowleftoverright = 0x21c6; 45366 t.arrowleftwhite = 0x21e6; 45367 t.arrowright = 0x2192; 45368 t.arrowrightdblstroke = 0x21cf; 45369 t.arrowrightheavy = 0x279e; 45370 t.arrowrightoverleft = 0x21c4; 45371 t.arrowrightwhite = 0x21e8; 45372 t.arrowtableft = 0x21e4; 45373 t.arrowtabright = 0x21e5; 45374 t.arrowup = 0x2191; 45375 t.arrowupdn = 0x2195; 45376 t.arrowupdnbse = 0x21a8; 45377 t.arrowupdownbase = 0x21a8; 45378 t.arrowupleft = 0x2196; 45379 t.arrowupleftofdown = 0x21c5; 45380 t.arrowupright = 0x2197; 45381 t.arrowupwhite = 0x21e7; 45382 t.arrowvertex = 0xf8e6; 45383 t.asciicircum = 0x005e; 45384 t.asciicircummonospace = 0xff3e; 45385 t.asciitilde = 0x007e; 45386 t.asciitildemonospace = 0xff5e; 45387 t.ascript = 0x0251; 45388 t.ascriptturned = 0x0252; 45389 t.asmallhiragana = 0x3041; 45390 t.asmallkatakana = 0x30a1; 45391 t.asmallkatakanahalfwidth = 0xff67; 45392 t.asterisk = 0x002a; 45393 t.asteriskaltonearabic = 0x066d; 45394 t.asteriskarabic = 0x066d; 45395 t.asteriskmath = 0x2217; 45396 t.asteriskmonospace = 0xff0a; 45397 t.asterisksmall = 0xfe61; 45398 t.asterism = 0x2042; 45399 t.asuperior = 0xf6e9; 45400 t.asymptoticallyequal = 0x2243; 45401 t.at = 0x0040; 45402 t.atilde = 0x00e3; 45403 t.atmonospace = 0xff20; 45404 t.atsmall = 0xfe6b; 45405 t.aturned = 0x0250; 45406 t.aubengali = 0x0994; 45407 t.aubopomofo = 0x3120; 45408 t.audeva = 0x0914; 45409 t.augujarati = 0x0a94; 45410 t.augurmukhi = 0x0a14; 45411 t.aulengthmarkbengali = 0x09d7; 45412 t.aumatragurmukhi = 0x0a4c; 45413 t.auvowelsignbengali = 0x09cc; 45414 t.auvowelsigndeva = 0x094c; 45415 t.auvowelsigngujarati = 0x0acc; 45416 t.avagrahadeva = 0x093d; 45417 t.aybarmenian = 0x0561; 45418 t.ayin = 0x05e2; 45419 t.ayinaltonehebrew = 0xfb20; 45420 t.ayinhebrew = 0x05e2; 45421 t.b = 0x0062; 45422 t.babengali = 0x09ac; 45423 t.backslash = 0x005c; 45424 t.backslashmonospace = 0xff3c; 45425 t.badeva = 0x092c; 45426 t.bagujarati = 0x0aac; 45427 t.bagurmukhi = 0x0a2c; 45428 t.bahiragana = 0x3070; 45429 t.bahtthai = 0x0e3f; 45430 t.bakatakana = 0x30d0; 45431 t.bar = 0x007c; 45432 t.barmonospace = 0xff5c; 45433 t.bbopomofo = 0x3105; 45434 t.bcircle = 0x24d1; 45435 t.bdotaccent = 0x1e03; 45436 t.bdotbelow = 0x1e05; 45437 t.beamedsixteenthnotes = 0x266c; 45438 t.because = 0x2235; 45439 t.becyrillic = 0x0431; 45440 t.beharabic = 0x0628; 45441 t.behfinalarabic = 0xfe90; 45442 t.behinitialarabic = 0xfe91; 45443 t.behiragana = 0x3079; 45444 t.behmedialarabic = 0xfe92; 45445 t.behmeeminitialarabic = 0xfc9f; 45446 t.behmeemisolatedarabic = 0xfc08; 45447 t.behnoonfinalarabic = 0xfc6d; 45448 t.bekatakana = 0x30d9; 45449 t.benarmenian = 0x0562; 45450 t.bet = 0x05d1; 45451 t.beta = 0x03b2; 45452 t.betasymbolgreek = 0x03d0; 45453 t.betdagesh = 0xfb31; 45454 t.betdageshhebrew = 0xfb31; 45455 t.bethebrew = 0x05d1; 45456 t.betrafehebrew = 0xfb4c; 45457 t.bhabengali = 0x09ad; 45458 t.bhadeva = 0x092d; 45459 t.bhagujarati = 0x0aad; 45460 t.bhagurmukhi = 0x0a2d; 45461 t.bhook = 0x0253; 45462 t.bihiragana = 0x3073; 45463 t.bikatakana = 0x30d3; 45464 t.bilabialclick = 0x0298; 45465 t.bindigurmukhi = 0x0a02; 45466 t.birusquare = 0x3331; 45467 t.blackcircle = 0x25cf; 45468 t.blackdiamond = 0x25c6; 45469 t.blackdownpointingtriangle = 0x25bc; 45470 t.blackleftpointingpointer = 0x25c4; 45471 t.blackleftpointingtriangle = 0x25c0; 45472 t.blacklenticularbracketleft = 0x3010; 45473 t.blacklenticularbracketleftvertical = 0xfe3b; 45474 t.blacklenticularbracketright = 0x3011; 45475 t.blacklenticularbracketrightvertical = 0xfe3c; 45476 t.blacklowerlefttriangle = 0x25e3; 45477 t.blacklowerrighttriangle = 0x25e2; 45478 t.blackrectangle = 0x25ac; 45479 t.blackrightpointingpointer = 0x25ba; 45480 t.blackrightpointingtriangle = 0x25b6; 45481 t.blacksmallsquare = 0x25aa; 45482 t.blacksmilingface = 0x263b; 45483 t.blacksquare = 0x25a0; 45484 t.blackstar = 0x2605; 45485 t.blackupperlefttriangle = 0x25e4; 45486 t.blackupperrighttriangle = 0x25e5;
45487 t.blackuppointingsmalltriangle = 0x25b4; 45488 t.blackuppointingtriangle = 0x25b2; 45489 t.blank = 0x2423; 45490 t.blinebelow = 0x1e07; 45491 t.block = 0x2588; 45492 t.bmonospace = 0xff42; 45493 t.bobaimaithai = 0x0e1a; 45494 t.bohiragana = 0x307c; 45495 t.bokatakana = 0x30dc; 45496 t.bparen = 0x249d; 45497 t.bqsquare = 0x33c3; 45498 t.braceex = 0xf8f4; 45499 t.braceleft = 0x007b; 45500 t.braceleftbt = 0xf8f3; 45501 t.braceleftmid = 0xf8f2; 45502 t.braceleftmonospace = 0xff5b; 45503 t.braceleftsmall = 0xfe5b; 45504 t.bracelefttp = 0xf8f1; 45505 t.braceleftvertical = 0xfe37; 45506 t.braceright = 0x007d; 45507 t.bracerightbt = 0xf8fe; 45508 t.bracerightmid = 0xf8fd; 45509 t.bracerightmonospace = 0xff5d; 45510 t.bracerightsmall = 0xfe5c; 45511 t.bracerighttp = 0xf8fc; 45512 t.bracerightvertical = 0xfe38; 45513 t.bracketleft = 0x005b; 45514 t.bracketleftbt = 0xf8f0; 45515 t.bracketleftex = 0xf8ef; 45516 t.bracketleftmonospace = 0xff3b; 45517 t.bracketlefttp = 0xf8ee; 45518 t.bracketright = 0x005d; 45519 t.bracketrightbt = 0xf8fb; 45520 t.bracketrightex = 0xf8fa; 45521 t.bracketrightmonospace = 0xff3d; 45522 t.bracketrighttp = 0xf8f9; 45523 t.breve = 0x02d8; 45524 t.brevebelowcmb = 0x032e; 45525 t.brevecmb = 0x0306; 45526 t.breveinvertedbelowcmb = 0x032f; 45527 t.breveinvertedcmb = 0x0311; 45528 t.breveinverteddoublecmb = 0x0361; 45529 t.bridgebelowcmb = 0x032a; 45530 t.bridgeinvertedbelowcmb = 0x033a; 45531 t.brokenbar = 0x00a6; 45532 t.bstroke = 0x0180; 45533 t.bsuperior = 0xf6ea; 45534 t.btopbar = 0x0183; 45535 t.buhiragana = 0x3076; 45536 t.bukatakana = 0x30d6; 45537 t.bullet = 0x2022; 45538 t.bulletinverse = 0x25d8; 45539 t.bulletoperator = 0x2219; 45540 t.bullseye = 0x25ce; 45541 t.c = 0x0063; 45542 t.caarmenian = 0x056e; 45543 t.cabengali = 0x099a; 45544 t.cacute = 0x0107; 45545 t.cadeva = 0x091a; 45546 t.cagujarati = 0x0a9a; 45547 t.cagurmukhi = 0x0a1a; 45548 t.calsquare = 0x3388; 45549 t.candrabindubengali = 0x0981; 45550 t.candrabinducmb = 0x0310; 45551 t.candrabindudeva = 0x0901; 45552 t.candrabindugujarati = 0x0a81; 45553 t.capslock = 0x21ea; 45554 t.careof = 0x2105; 45555 t.caron = 0x02c7; 45556 t.caronbelowcmb = 0x032c; 45557 t.caroncmb = 0x030c; 45558 t.carriagereturn = 0x21b5; 45559 t.cbopomofo = 0x3118; 45560 t.ccaron = 0x010d; 45561 t.ccedilla = 0x00e7; 45562 t.ccedillaacute = 0x1e09; 45563 t.ccircle = 0x24d2; 45564 t.ccircumflex = 0x0109; 45565 t.ccurl = 0x0255; 45566 t.cdot = 0x010b; 45567 t.cdotaccent = 0x010b; 45568 t.cdsquare = 0x33c5; 45569 t.cedilla = 0x00b8; 45570 t.cedillacmb = 0x0327; 45571 t.cent = 0x00a2; 45572 t.centigrade = 0x2103; 45573 t.centinferior = 0xf6df; 45574 t.centmonospace = 0xffe0; 45575 t.centoldstyle = 0xf7a2; 45576 t.centsuperior = 0xf6e0; 45577 t.chaarmenian = 0x0579; 45578 t.chabengali = 0x099b; 45579 t.chadeva = 0x091b; 45580 t.chagujarati = 0x0a9b; 45581 t.chagurmukhi = 0x0a1b; 45582 t.chbopomofo = 0x3114; 45583 t.cheabkhasiancyrillic = 0x04bd; 45584 t.checkmark = 0x2713; 45585 t.checyrillic = 0x0447; 45586 t.chedescenderabkhasiancyrillic = 0x04bf; 45587 t.chedescendercyrillic = 0x04b7; 45588 t.chedieresiscyrillic = 0x04f5; 45589 t.cheharmenian = 0x0573; 45590 t.chekhakassiancyrillic = 0x04cc; 45591 t.cheverticalstrokecyrillic = 0x04b9; 45592 t.chi = 0x03c7; 45593 t.chieuchacirclekorean = 0x3277; 45594 t.chieuchaparenkorean = 0x3217; 45595 t.chieuchcirclekorean = 0x3269; 45596 t.chieuchkorean = 0x314a; 45597 t.chieuchparenkorean = 0x3209; 45598 t.chochangthai = 0x0e0a; 45599 t.chochanthai = 0x0e08; 45600 t.chochingthai = 0x0e09; 45601 t.chochoethai = 0x0e0c; 45602 t.chook = 0x0188; 45603 t.cieucacirclekorean = 0x3276; 45604 t.cieucaparenkorean = 0x3216; 45605 t.cieuccirclekorean = 0x3268; 45606 t.cieuckorean = 0x3148; 45607 t.cieucparenkorean = 0x3208; 45608 t.cieucuparenkorean = 0x321c; 45609 t.circle = 0x25cb; 45610 t.circlecopyrt = 0x00a9; 45611 t.circlemultiply = 0x2297; 45612 t.circleot = 0x2299; 45613 t.circleplus = 0x2295; 45614 t.circlepostalmark = 0x3036; 45615 t.circlewithlefthalfblack = 0x25d0; 45616 t.circlewithrighthalfblack = 0x25d1; 45617 t.circumflex = 0x02c6; 45618 t.circumflexbelowcmb = 0x032d; 45619 t.circumflexcmb = 0x0302; 45620 t.clear = 0x2327; 45621 t.clickalveolar = 0x01c2; 45622 t.clickdental = 0x01c0; 45623 t.clicklateral = 0x01c1; 45624 t.clickretroflex = 0x01c3; 45625 t.club = 0x2663; 45626 t.clubsuitblack = 0x2663; 45627 t.clubsuitwhite = 0x2667; 45628 t.cmcubedsquare = 0x33a4; 45629 t.cmonospace = 0xff43; 45630 t.cmsquaredsquare = 0x33a0; 45631 t.coarmenian = 0x0581; 45632 t.colon = 0x003a; 45633 t.colonmonetary = 0x20a1; 45634 t.colonmonospace = 0xff1a; 45635 t.colonsign = 0x20a1; 45636 t.colonsmall = 0xfe55; 45637 t.colontriangularhalfmod = 0x02d1; 45638 t.colontriangularmod = 0x02d0; 45639 t.comma = 0x002c; 45640 t.commaabovecmb = 0x0313; 45641 t.commaaboverightcmb = 0x0315; 45642 t.commaaccent = 0xf6c3; 45643 t.commaarabic = 0x060c; 45644 t.commaarmenian = 0x055d; 45645 t.commainferior = 0xf6e1; 45646 t.commamonospace = 0xff0c; 45647 t.commareversedabovecmb = 0x0314; 45648 t.commareversedmod = 0x02bd; 45649 t.commasmall = 0xfe50; 45650 t.commasuperior = 0xf6e2; 45651 t.commaturnedabovecmb = 0x0312; 45652 t.commaturnedmod = 0x02bb; 45653 t.compass = 0x263c; 45654 t.congruent = 0x2245; 45655 t.contourintegral = 0x222e; 45656 t.control = 0x2303; 45657 t.controlACK = 0x0006; 45658 t.controlBEL = 0x0007; 45659 t.controlBS = 0x0008; 45660 t.controlCAN = 0x0018; 45661 t.controlCR = 0x000d; 45662 t.controlDC1 = 0x0011; 45663 t.controlDC2 = 0x0012; 45664 t.controlDC3 = 0x0013; 45665 t.controlDC4 = 0x0014; 45666 t.controlDEL = 0x007f; 45667 t.controlDLE = 0x0010; 45668 t.controlEM = 0x0019; 45669 t.controlENQ = 0x0005; 45670 t.controlEOT = 0x0004; 45671 t.controlESC = 0x001b; 45672 t.controlETB = 0x0017; 45673 t.controlETX = 0x0003; 45674 t.controlFF = 0x000c; 45675 t.controlFS = 0x001c; 45676 t.controlGS = 0x001d; 45677 t.controlHT = 0x0009; 45678 t.controlLF = 0x000a; 45679 t.controlNAK = 0x0015; 45680 t.controlNULL = 0x0000; 45681 t.controlRS = 0x001e; 45682 t.controlSI = 0x000f; 45683 t.controlSO = 0x000e; 45684 t.controlSOT = 0x0002; 45685 t.controlSTX = 0x0001; 45686 t.controlSUB = 0x001a; 45687 t.controlSYN = 0x0016; 45688 t.controlUS = 0x001f; 45689 t.controlVT = 0x000b; 45690 t.copyright = 0x00a9; 45691 t.copyrightsans = 0xf8e9; 45692 t.copyrightserif = 0xf6d9; 45693 t.cornerbracketleft = 0x300c; 45694 t.cornerbracketlefthalfwidth = 0xff62; 45695 t.cornerbracketleftvertical = 0xfe41; 45696 t.cornerbracketright = 0x300d; 45697 t.cornerbracketrighthalfwidth = 0xff63; 45698 t.cornerbracketrightvertical = 0xfe42; 45699 t.corporationsquare = 0x337f; 45700 t.cosquare = 0x33c7; 45701 t.coverkgsquare = 0x33c6; 45702 t.cparen = 0x249e; 45703 t.cruzeiro = 0x20a2; 45704 t.cstretched = 0x0297; 45705 t.curlyand = 0x22cf; 45706 t.curlyor = 0x22ce; 45707 t.currency = 0x00a4; 45708 t.cyrBreve = 0xf6d1; 45709 t.cyrFlex = 0xf6d2; 45710 t.cyrbreve = 0xf6d4; 45711 t.cyrflex = 0xf6d5; 45712 t.d = 0x0064; 45713 t.daarmenian = 0x0564; 45714 t.dabengali = 0x09a6; 45715 t.dadarabic = 0x0636; 45716 t.dadeva = 0x0926; 45717 t.dadfinalarabic = 0xfebe; 45718 t.dadinitialarabic = 0xfebf; 45719 t.dadmedialarabic = 0xfec0; 45720 t.dagesh = 0x05bc; 45721 t.dageshhebrew = 0x05bc; 45722 t.dagger = 0x2020; 45723 t.daggerdbl = 0x2021; 45724 t.dagujarati = 0x0aa6; 45725 t.dagurmukhi = 0x0a26; 45726 t.dahiragana = 0x3060; 45727 t.dakatakana = 0x30c0; 45728 t.dalarabic = 0x062f; 45729 t.dalet = 0x05d3; 45730 t.daletdagesh = 0xfb33; 45731 t.daletdageshhebrew = 0xfb33; 45732 t.dalethebrew = 0x05d3; 45733 t.dalfinalarabic = 0xfeaa; 45734 t.dammaarabic = 0x064f; 45735 t.dammalowarabic = 0x064f; 45736 t.dammatanaltonearabic = 0x064c; 45737 t.dammatanarabic = 0x064c; 45738 t.danda = 0x0964; 45739 t.dargahebrew = 0x05a7; 45740 t.dargalefthebrew = 0x05a7; 45741 t.dasiapneumatacyrilliccmb = 0x0485; 45742 t.dblGrave = 0xf6d3; 45743 t.dblanglebracketleft = 0x300a; 45744 t.dblanglebracketleftvertical = 0xfe3d; 45745 t.dblanglebracketright = 0x300b; 45746 t.dblanglebracketrightvertical = 0xfe3e; 45747 t.dblarchinvertedbelowcmb = 0x032b; 45748 t.dblarrowleft = 0x21d4; 45749 t.dblarrowright = 0x21d2; 45750 t.dbldanda = 0x0965; 45751 t.dblgrave = 0xf6d6; 45752 t.dblgravecmb = 0x030f; 45753 t.dblintegral = 0x222c; 45754 t.dbllowline = 0x2017; 45755 t.dbllowlinecmb = 0x0333; 45756 t.dbloverlinecmb = 0x033f; 45757 t.dblprimemod = 0x02ba; 45758 t.dblverticalbar = 0x2016; 45759 t.dblverticallineabovecmb = 0x030e; 45760 t.dbopomofo = 0x3109; 45761 t.dbsquare = 0x33c8; 45762 t.dcaron = 0x010f; 45763 t.dcedilla = 0x1e11; 45764 t.dcircle = 0x24d3; 45765 t.dcircumflexbelow = 0x1e13; 45766 t.dcroat = 0x0111; 45767 t.ddabengali = 0x09a1; 45768 t.ddadeva = 0x0921; 45769 t.ddagujarati = 0x0aa1; 45770 t.ddagurmukhi = 0x0a21; 45771 t.ddalarabic = 0x0688; 45772 t.ddalfinalarabic = 0xfb89; 45773 t.dddhadeva = 0x095c; 45774 t.ddhabengali = 0x09a2; 45775 t.ddhadeva = 0x0922; 45776 t.ddhagujarati = 0x0aa2; 45777 t.ddhagurmukhi = 0x0a22; 45778 t.ddotaccent = 0x1e0b; 45779 t.ddotbelow = 0x1e0d; 45780 t.decimalseparatorarabic = 0x066b; 45781 t.decimalseparatorpersian = 0x066b; 45782 t.decyrillic = 0x0434; 45783 t.degree = 0x00b0; 45784 t.dehihebrew = 0x05ad; 45785 t.dehiragana = 0x3067; 45786 t.deicoptic = 0x03ef; 45787 t.dekatakana = 0x30c7; 45788 t.deleteleft = 0x232b; 45789 t.deleteright = 0x2326; 45790 t.delta = 0x03b4; 45791 t.deltaturned = 0x018d; 45792 t.denominatorminusonenumeratorbengali = 0x09f8; 45793 t.dezh = 0x02a4; 45794 t.dhabengali = 0x09a7; 45795 t.dhadeva = 0x0927; 45796 t.dhagujarati = 0x0aa7; 45797 t.dhagurmukhi = 0x0a27; 45798 t.dhook = 0x0257; 45799 t.dialytikatonos = 0x0385; 45800 t.dialytikatonoscmb = 0x0344;
45801 t.diamond = 0x2666; 45802 t.diamondsuitwhite = 0x2662; 45803 t.dieresis = 0x00a8; 45804 t.dieresisacute = 0xf6d7; 45805 t.dieresisbelowcmb = 0x0324; 45806 t.dieresiscmb = 0x0308; 45807 t.dieresisgrave = 0xf6d8; 45808 t.dieresistonos = 0x0385; 45809 t.dihiragana = 0x3062; 45810 t.dikatakana = 0x30c2; 45811 t.dittomark = 0x3003; 45812 t.divide = 0x00f7; 45813 t.divides = 0x2223; 45814 t.divisionslash = 0x2215; 45815 t.djecyrillic = 0x0452; 45816 t.dkshade = 0x2593; 45817 t.dlinebelow = 0x1e0f; 45818 t.dlsquare = 0x3397; 45819 t.dmacron = 0x0111; 45820 t.dmonospace = 0xff44; 45821 t.dnblock = 0x2584; 45822 t.dochadathai = 0x0e0e; 45823 t.dodekthai = 0x0e14; 45824 t.dohiragana = 0x3069; 45825 t.dokatakana = 0x30c9; 45826 t.dollar = 0x0024; 45827 t.dollarinferior = 0xf6e3; 45828 t.dollarmonospace = 0xff04; 45829 t.dollaroldstyle = 0xf724; 45830 t.dollarsmall = 0xfe69; 45831 t.dollarsuperior = 0xf6e4; 45832 t.dong = 0x20ab; 45833 t.dorusquare = 0x3326; 45834 t.dotaccent = 0x02d9; 45835 t.dotaccentcmb = 0x0307; 45836 t.dotbelowcmb = 0x0323; 45837 t.dotbelowcomb = 0x0323; 45838 t.dotkatakana = 0x30fb; 45839 t.dotlessi = 0x0131; 45840 t.dotlessj = 0xf6be; 45841 t.dotlessjstrokehook = 0x0284; 45842 t.dotmath = 0x22c5; 45843 t.dottedcircle = 0x25cc; 45844 t.doubleyodpatah = 0xfb1f; 45845 t.doubleyodpatahhebrew = 0xfb1f; 45846 t.downtackbelowcmb = 0x031e; 45847 t.downtackmod = 0x02d5; 45848 t.dparen = 0x249f; 45849 t.dsuperior = 0xf6eb; 45850 t.dtail = 0x0256; 45851 t.dtopbar = 0x018c; 45852 t.duhiragana = 0x3065; 45853 t.dukatakana = 0x30c5; 45854 t.dz = 0x01f3; 45855 t.dzaltone = 0x02a3; 45856 t.dzcaron = 0x01c6; 45857 t.dzcurl = 0x02a5; 45858 t.dzeabkhasiancyrillic = 0x04e1; 45859 t.dzecyrillic = 0x0455; 45860 t.dzhecyrillic = 0x045f; 45861 t.e = 0x0065; 45862 t.eacute = 0x00e9; 45863 t.earth = 0x2641; 45864 t.ebengali = 0x098f; 45865 t.ebopomofo = 0x311c; 45866 t.ebreve = 0x0115; 45867 t.ecandradeva = 0x090d; 45868 t.ecandragujarati = 0x0a8d; 45869 t.ecandravowelsigndeva = 0x0945; 45870 t.ecandravowelsigngujarati = 0x0ac5; 45871 t.ecaron = 0x011b; 45872 t.ecedillabreve = 0x1e1d; 45873 t.echarmenian = 0x0565; 45874 t.echyiwnarmenian = 0x0587; 45875 t.ecircle = 0x24d4; 45876 t.ecircumflex = 0x00ea; 45877 t.ecircumflexacute = 0x1ebf; 45878 t.ecircumflexbelow = 0x1e19; 45879 t.ecircumflexdotbelow = 0x1ec7; 45880 t.ecircumflexgrave = 0x1ec1; 45881 t.ecircumflexhookabove = 0x1ec3; 45882 t.ecircumflextilde = 0x1ec5; 45883 t.ecyrillic = 0x0454; 45884 t.edblgrave = 0x0205; 45885 t.edeva = 0x090f; 45886 t.edieresis = 0x00eb; 45887 t.edot = 0x0117; 45888 t.edotaccent = 0x0117; 45889 t.edotbelow = 0x1eb9; 45890 t.eegurmukhi = 0x0a0f; 45891 t.eematragurmukhi = 0x0a47; 45892 t.efcyrillic = 0x0444; 45893 t.egrave = 0x00e8; 45894 t.egujarati = 0x0a8f; 45895 t.eharmenian = 0x0567; 45896 t.ehbopomofo = 0x311d; 45897 t.ehiragana = 0x3048; 45898 t.ehookabove = 0x1ebb; 45899 t.eibopomofo = 0x311f; 45900 t.eight = 0x0038; 45901 t.eightarabic = 0x0668; 45902 t.eightbengali = 0x09ee; 45903 t.eightcircle = 0x2467; 45904 t.eightcircleinversesansserif = 0x2791; 45905 t.eightdeva = 0x096e; 45906 t.eighteencircle = 0x2471; 45907 t.eighteenparen = 0x2485; 45908 t.eighteenperiod = 0x2499; 45909 t.eightgujarati = 0x0aee; 45910 t.eightgurmukhi = 0x0a6e; 45911 t.eighthackarabic = 0x0668; 45912 t.eighthangzhou = 0x3028; 45913 t.eighthnotebeamed = 0x266b; 45914 t.eightideographicparen = 0x3227; 45915 t.eightinferior = 0x2088; 45916 t.eightmonospace = 0xff18; 45917 t.eightoldstyle = 0xf738; 45918 t.eightparen = 0x247b; 45919 t.eightperiod = 0x248f; 45920 t.eightpersian = 0x06f8; 45921 t.eightroman = 0x2177; 45922 t.eightsuperior = 0x2078; 45923 t.eightthai = 0x0e58; 45924 t.einvertedbreve = 0x0207; 45925 t.eiotifiedcyrillic = 0x0465; 45926 t.ekatakana = 0x30a8; 45927 t.ekatakanahalfwidth = 0xff74; 45928 t.ekonkargurmukhi = 0x0a74; 45929 t.ekorean = 0x3154; 45930 t.elcyrillic = 0x043b; 45931 t.element = 0x2208; 45932 t.elevencircle = 0x246a; 45933 t.elevenparen = 0x247e; 45934 t.elevenperiod = 0x2492; 45935 t.elevenroman = 0x217a; 45936 t.ellipsis = 0x2026; 45937 t.ellipsisvertical = 0x22ee; 45938 t.emacron = 0x0113; 45939 t.emacronacute = 0x1e17; 45940 t.emacrongrave = 0x1e15; 45941 t.emcyrillic = 0x043c; 45942 t.emdash = 0x2014; 45943 t.emdashvertical = 0xfe31; 45944 t.emonospace = 0xff45; 45945 t.emphasismarkarmenian = 0x055b; 45946 t.emptyset = 0x2205; 45947 t.enbopomofo = 0x3123; 45948 t.encyrillic = 0x043d; 45949 t.endash = 0x2013; 45950 t.endashvertical = 0xfe32; 45951 t.endescendercyrillic = 0x04a3; 45952 t.eng = 0x014b; 45953 t.engbopomofo = 0x3125; 45954 t.enghecyrillic = 0x04a5; 45955 t.enhookcyrillic = 0x04c8; 45956 t.enspace = 0x2002; 45957 t.eogonek = 0x0119; 45958 t.eokorean = 0x3153; 45959 t.eopen = 0x025b; 45960 t.eopenclosed = 0x029a; 45961 t.eopenreversed = 0x025c; 45962 t.eopenreversedclosed = 0x025e; 45963 t.eopenreversedhook = 0x025d; 45964 t.eparen = 0x24a0; 45965 t.epsilon = 0x03b5; 45966 t.epsilontonos = 0x03ad; 45967 t.equal = 0x003d; 45968 t.equalmonospace = 0xff1d; 45969 t.equalsmall = 0xfe66; 45970 t.equalsuperior = 0x207c; 45971 t.equivalence = 0x2261; 45972 t.erbopomofo = 0x3126; 45973 t.ercyrillic = 0x0440; 45974 t.ereversed = 0x0258; 45975 t.ereversedcyrillic = 0x044d; 45976 t.escyrillic = 0x0441; 45977 t.esdescendercyrillic = 0x04ab; 45978 t.esh = 0x0283; 45979 t.eshcurl = 0x0286; 45980 t.eshortdeva = 0x090e; 45981 t.eshortvowelsigndeva = 0x0946; 45982 t.eshreversedloop = 0x01aa; 45983 t.eshsquatreversed = 0x0285; 45984 t.esmallhiragana = 0x3047; 45985 t.esmallkatakana = 0x30a7; 45986 t.esmallkatakanahalfwidth = 0xff6a; 45987 t.estimated = 0x212e; 45988 t.esuperior = 0xf6ec; 45989 t.eta = 0x03b7; 45990 t.etarmenian = 0x0568; 45991 t.etatonos = 0x03ae; 45992 t.eth = 0x00f0; 45993 t.etilde = 0x1ebd; 45994 t.etildebelow = 0x1e1b; 45995 t.etnahtafoukhhebrew = 0x0591; 45996 t.etnahtafoukhlefthebrew = 0x0591; 45997 t.etnahtahebrew = 0x0591; 45998 t.etnahtalefthebrew = 0x0591; 45999 t.eturned = 0x01dd; 46000 t.eukorean = 0x3161; 46001 t.euro = 0x20ac; 46002 t.evowelsignbengali = 0x09c7; 46003 t.evowelsigndeva = 0x0947; 46004 t.evowelsigngujarati = 0x0ac7; 46005 t.exclam = 0x0021; 46006 t.exclamarmenian = 0x055c; 46007 t.exclamdbl = 0x203c; 46008 t.exclamdown = 0x00a1; 46009 t.exclamdownsmall = 0xf7a1; 46010 t.exclammonospace = 0xff01; 46011 t.exclamsmall = 0xf721; 46012 t.existential = 0x2203; 46013 t.ezh = 0x0292; 46014 t.ezhcaron = 0x01ef; 46015 t.ezhcurl = 0x0293; 46016 t.ezhreversed = 0x01b9; 46017 t.ezhtail = 0x01ba; 46018 t.f = 0x0066; 46019 t.fadeva = 0x095e; 46020 t.fagurmukhi = 0x0a5e; 46021 t.fahrenheit = 0x2109; 46022 t.fathaarabic = 0x064e; 46023 t.fathalowarabic = 0x064e; 46024 t.fathatanarabic = 0x064b; 46025 t.fbopomofo = 0x3108; 46026 t.fcircle = 0x24d5; 46027 t.fdotaccent = 0x1e1f; 46028 t.feharabic = 0x0641; 46029 t.feharmenian = 0x0586; 46030 t.fehfinalarabic = 0xfed2; 46031 t.fehinitialarabic = 0xfed3; 46032 t.fehmedialarabic = 0xfed4; 46033 t.feicoptic = 0x03e5; 46034 t.female = 0x2640; 46035 t.ff = 0xfb00; 46036 t.f_f = 0xfb00; 46037 t.ffi = 0xfb03; 46038 t.ffl = 0xfb04; 46039 t.fi = 0xfb01; 46040 t.fifteencircle = 0x246e; 46041 t.fifteenparen = 0x2482; 46042 t.fifteenperiod = 0x2496; 46043 t.figuredash = 0x2012; 46044 t.filledbox = 0x25a0; 46045 t.filledrect = 0x25ac; 46046 t.finalkaf = 0x05da; 46047 t.finalkafdagesh = 0xfb3a; 46048 t.finalkafdageshhebrew = 0xfb3a; 46049 t.finalkafhebrew = 0x05da; 46050 t.finalmem = 0x05dd; 46051 t.finalmemhebrew = 0x05dd; 46052 t.finalnun = 0x05df; 46053 t.finalnunhebrew = 0x05df; 46054 t.finalpe = 0x05e3; 46055 t.finalpehebrew = 0x05e3; 46056 t.finaltsadi = 0x05e5; 46057 t.finaltsadihebrew = 0x05e5; 46058 t.firsttonechinese = 0x02c9; 46059 t.fisheye = 0x25c9; 46060 t.fitacyrillic = 0x0473; 46061 t.five = 0x0035; 46062 t.fivearabic = 0x0665; 46063 t.fivebengali = 0x09eb; 46064 t.fivecircle = 0x2464; 46065 t.fivecircleinversesansserif = 0x278e; 46066 t.fivedeva = 0x096b; 46067 t.fiveeighths = 0x215d; 46068 t.fivegujarati = 0x0aeb; 46069 t.fivegurmukhi = 0x0a6b; 46070 t.fivehackarabic = 0x0665; 46071 t.fivehangzhou = 0x3025; 46072 t.fiveideographicparen = 0x3224; 46073 t.fiveinferior = 0x2085; 46074 t.fivemonospace = 0xff15; 46075 t.fiveoldstyle = 0xf735; 46076 t.fiveparen = 0x2478; 46077 t.fiveperiod = 0x248c; 46078 t.fivepersian = 0x06f5; 46079 t.fiveroman = 0x2174; 46080 t.fivesuperior = 0x2075; 46081 t.fivethai = 0x0e55; 46082 t.fl = 0xfb02; 46083 t.florin = 0x0192; 46084 t.fmonospace = 0xff46; 46085 t.fmsquare = 0x3399; 46086 t.fofanthai = 0x0e1f; 46087 t.fofathai = 0x0e1d; 46088 t.fongmanthai = 0x0e4f; 46089 t.forall = 0x2200; 46090 t.four = 0x0034; 46091 t.fourarabic = 0x0664; 46092 t.fourbengali = 0x09ea;
46093 t.fourcircle = 0x2463; 46094 t.fourcircleinversesansserif = 0x278d; 46095 t.fourdeva = 0x096a; 46096 t.fourgujarati = 0x0aea; 46097 t.fourgurmukhi = 0x0a6a; 46098 t.fourhackarabic = 0x0664; 46099 t.fourhangzhou = 0x3024; 46100 t.fourideographicparen = 0x3223; 46101 t.fourinferior = 0x2084; 46102 t.fourmonospace = 0xff14; 46103 t.fournumeratorbengali = 0x09f7; 46104 t.fouroldstyle = 0xf734; 46105 t.fourparen = 0x2477; 46106 t.fourperiod = 0x248b; 46107 t.fourpersian = 0x06f4; 46108 t.fourroman = 0x2173; 46109 t.foursuperior = 0x2074; 46110 t.fourteencircle = 0x246d; 46111 t.fourteenparen = 0x2481; 46112 t.fourteenperiod = 0x2495; 46113 t.fourthai = 0x0e54; 46114 t.fourthtonechinese = 0x02cb; 46115 t.fparen = 0x24a1; 46116 t.fraction = 0x2044; 46117 t.franc = 0x20a3; 46118 t.g = 0x0067; 46119 t.gabengali = 0x0997; 46120 t.gacute = 0x01f5; 46121 t.gadeva = 0x0917; 46122 t.gafarabic = 0x06af; 46123 t.gaffinalarabic = 0xfb93; 46124 t.gafinitialarabic = 0xfb94; 46125 t.gafmedialarabic = 0xfb95; 46126 t.gagujarati = 0x0a97; 46127 t.gagurmukhi = 0x0a17; 46128 t.gahiragana = 0x304c; 46129 t.gakatakana = 0x30ac; 46130 t.gamma = 0x03b3; 46131 t.gammalatinsmall = 0x0263; 46132 t.gammasuperior = 0x02e0; 46133 t.gangiacoptic = 0x03eb; 46134 t.gbopomofo = 0x310d; 46135 t.gbreve = 0x011f; 46136 t.gcaron = 0x01e7; 46137 t.gcedilla = 0x0123; 46138 t.gcircle = 0x24d6; 46139 t.gcircumflex = 0x011d; 46140 t.gcommaaccent = 0x0123; 46141 t.gdot = 0x0121; 46142 t.gdotaccent = 0x0121; 46143 t.gecyrillic = 0x0433; 46144 t.gehiragana = 0x3052; 46145 t.gekatakana = 0x30b2; 46146 t.geometricallyequal = 0x2251; 46147 t.gereshaccenthebrew = 0x059c; 46148 t.gereshhebrew = 0x05f3; 46149 t.gereshmuqdamhebrew = 0x059d; 46150 t.germandbls = 0x00df; 46151 t.gershayimaccenthebrew = 0x059e; 46152 t.gershayimhebrew = 0x05f4; 46153 t.getamark = 0x3013; 46154 t.ghabengali = 0x0998; 46155 t.ghadarmenian = 0x0572; 46156 t.ghadeva = 0x0918; 46157 t.ghagujarati = 0x0a98; 46158 t.ghagurmukhi = 0x0a18; 46159 t.ghainarabic = 0x063a; 46160 t.ghainfinalarabic = 0xfece; 46161 t.ghaininitialarabic = 0xfecf; 46162 t.ghainmedialarabic = 0xfed0; 46163 t.ghemiddlehookcyrillic = 0x0495; 46164 t.ghestrokecyrillic = 0x0493; 46165 t.gheupturncyrillic = 0x0491; 46166 t.ghhadeva = 0x095a; 46167 t.ghhagurmukhi = 0x0a5a; 46168 t.ghook = 0x0260; 46169 t.ghzsquare = 0x3393; 46170 t.gihiragana = 0x304e; 46171 t.gikatakana = 0x30ae; 46172 t.gimarmenian = 0x0563; 46173 t.gimel = 0x05d2; 46174 t.gimeldagesh = 0xfb32; 46175 t.gimeldageshhebrew = 0xfb32; 46176 t.gimelhebrew = 0x05d2; 46177 t.gjecyrillic = 0x0453; 46178 t.glottalinvertedstroke = 0x01be; 46179 t.glottalstop = 0x0294; 46180 t.glottalstopinverted = 0x0296; 46181 t.glottalstopmod = 0x02c0; 46182 t.glottalstopreversed = 0x0295; 46183 t.glottalstopreversedmod = 0x02c1; 46184 t.glottalstopreversedsuperior = 0x02e4; 46185 t.glottalstopstroke = 0x02a1; 46186 t.glottalstopstrokereversed = 0x02a2; 46187 t.gmacron = 0x1e21; 46188 t.gmonospace = 0xff47; 46189 t.gohiragana = 0x3054; 46190 t.gokatakana = 0x30b4; 46191 t.gparen = 0x24a2; 46192 t.gpasquare = 0x33ac; 46193 t.gradient = 0x2207; 46194 t.grave = 0x0060; 46195 t.gravebelowcmb = 0x0316; 46196 t.gravecmb = 0x0300; 46197 t.gravecomb = 0x0300; 46198 t.gravedeva = 0x0953; 46199 t.gravelowmod = 0x02ce; 46200 t.gravemonospace = 0xff40; 46201 t.gravetonecmb = 0x0340; 46202 t.greater = 0x003e; 46203 t.greaterequal = 0x2265; 46204 t.greaterequalorless = 0x22db; 46205 t.greatermonospace = 0xff1e; 46206 t.greaterorequivalent = 0x2273; 46207 t.greaterorless = 0x2277; 46208 t.greateroverequal = 0x2267; 46209 t.greatersmall = 0xfe65; 46210 t.gscript = 0x0261; 46211 t.gstroke = 0x01e5; 46212 t.guhiragana = 0x3050; 46213 t.guillemotleft = 0x00ab; 46214 t.guillemotright = 0x00bb; 46215 t.guilsinglleft = 0x2039; 46216 t.guilsinglright = 0x203a; 46217 t.gukatakana = 0x30b0; 46218 t.guramusquare = 0x3318; 46219 t.gysquare = 0x33c9; 46220 t.h = 0x0068; 46221 t.haabkhasiancyrillic = 0x04a9; 46222 t.haaltonearabic = 0x06c1; 46223 t.habengali = 0x09b9; 46224 t.hadescendercyrillic = 0x04b3; 46225 t.hadeva = 0x0939; 46226 t.hagujarati = 0x0ab9; 46227 t.hagurmukhi = 0x0a39; 46228 t.haharabic = 0x062d; 46229 t.hahfinalarabic = 0xfea2; 46230 t.hahinitialarabic = 0xfea3; 46231 t.hahiragana = 0x306f; 46232 t.hahmedialarabic = 0xfea4; 46233 t.haitusquare = 0x332a; 46234 t.hakatakana = 0x30cf; 46235 t.hakatakanahalfwidth = 0xff8a; 46236 t.halantgurmukhi = 0x0a4d; 46237 t.hamzaarabic = 0x0621; 46238 t.hamzalowarabic = 0x0621; 46239 t.hangulfiller = 0x3164; 46240 t.hardsigncyrillic = 0x044a; 46241 t.harpoonleftbarbup = 0x21bc; 46242 t.harpoonrightbarbup = 0x21c0; 46243 t.hasquare = 0x33ca; 46244 t.hatafpatah = 0x05b2; 46245 t.hatafpatah16 = 0x05b2; 46246 t.hatafpatah23 = 0x05b2; 46247 t.hatafpatah2f = 0x05b2; 46248 t.hatafpatahhebrew = 0x05b2; 46249 t.hatafpatahnarrowhebrew = 0x05b2; 46250 t.hatafpatahquarterhebrew = 0x05b2; 46251 t.hatafpatahwidehebrew = 0x05b2; 46252 t.hatafqamats = 0x05b3; 46253 t.hatafqamats1b = 0x05b3; 46254 t.hatafqamats28 = 0x05b3; 46255 t.hatafqamats34 = 0x05b3; 46256 t.hatafqamatshebrew = 0x05b3; 46257 t.hatafqamatsnarrowhebrew = 0x05b3; 46258 t.hatafqamatsquarterhebrew = 0x05b3; 46259 t.hatafqamatswidehebrew = 0x05b3; 46260 t.hatafsegol = 0x05b1; 46261 t.hatafsegol17 = 0x05b1; 46262 t.hatafsegol24 = 0x05b1; 46263 t.hatafsegol30 = 0x05b1; 46264 t.hatafsegolhebrew = 0x05b1; 46265 t.hatafsegolnarrowhebrew = 0x05b1; 46266 t.hatafsegolquarterhebrew = 0x05b1; 46267 t.hatafsegolwidehebrew = 0x05b1; 46268 t.hbar = 0x0127; 46269 t.hbopomofo = 0x310f; 46270 t.hbrevebelow = 0x1e2b; 46271 t.hcedilla = 0x1e29; 46272 t.hcircle = 0x24d7; 46273 t.hcircumflex = 0x0125; 46274 t.hdieresis = 0x1e27; 46275 t.hdotaccent = 0x1e23; 46276 t.hdotbelow = 0x1e25; 46277 t.he = 0x05d4; 46278 t.heart = 0x2665; 46279 t.heartsuitblack = 0x2665; 46280 t.heartsuitwhite = 0x2661; 46281 t.hedagesh = 0xfb34; 46282 t.hedageshhebrew = 0xfb34; 46283 t.hehaltonearabic = 0x06c1; 46284 t.heharabic = 0x0647; 46285 t.hehebrew = 0x05d4; 46286 t.hehfinalaltonearabic = 0xfba7; 46287 t.hehfinalalttwoarabic = 0xfeea; 46288 t.hehfinalarabic = 0xfeea; 46289 t.hehhamzaabovefinalarabic = 0xfba5; 46290 t.hehhamzaaboveisolatedarabic = 0xfba4; 46291 t.hehinitialaltonearabic = 0xfba8; 46292 t.hehinitialarabic = 0xfeeb; 46293 t.hehiragana = 0x3078; 46294 t.hehmedialaltonearabic = 0xfba9; 46295 t.hehmedialarabic = 0xfeec; 46296 t.heiseierasquare = 0x337b; 46297 t.hekatakana = 0x30d8; 46298 t.hekatakanahalfwidth = 0xff8d; 46299 t.hekutaarusquare = 0x3336; 46300 t.henghook = 0x0267; 46301 t.herutusquare = 0x3339; 46302 t.het = 0x05d7; 46303 t.hethebrew = 0x05d7; 46304 t.hhook = 0x0266;
46305 t.hhooksuperior = 0x02b1; 46306 t.hieuhacirclekorean = 0x327b; 46307 t.hieuhaparenkorean = 0x321b; 46308 t.hieuhcirclekorean = 0x326d; 46309 t.hieuhkorean = 0x314e; 46310 t.hieuhparenkorean = 0x320d; 46311 t.hihiragana = 0x3072; 46312 t.hikatakana = 0x30d2; 46313 t.hikatakanahalfwidth = 0xff8b; 46314 t.hiriq = 0x05b4; 46315 t.hiriq14 = 0x05b4; 46316 t.hiriq21 = 0x05b4; 46317 t.hiriq2d = 0x05b4; 46318 t.hiriqhebrew = 0x05b4; 46319 t.hiriqnarrowhebrew = 0x05b4; 46320 t.hiriqquarterhebrew = 0x05b4; 46321 t.hiriqwidehebrew = 0x05b4; 46322 t.hlinebelow = 0x1e96; 46323 t.hmonospace = 0xff48; 46324 t.hoarmenian = 0x0570; 46325 t.hohipthai = 0x0e2b; 46326 t.hohiragana = 0x307b; 46327 t.hokatakana = 0x30db; 46328 t.hokatakanahalfwidth = 0xff8e; 46329 t.holam = 0x05b9; 46330 t.holam19 = 0x05b9; 46331 t.holam26 = 0x05b9; 46332 t.holam32 = 0x05b9; 46333 t.holamhebrew = 0x05b9; 46334 t.holamnarrowhebrew = 0x05b9; 46335 t.holamquarterhebrew = 0x05b9; 46336 t.holamwidehebrew = 0x05b9; 46337 t.honokhukthai = 0x0e2e; 46338 t.hookabovecomb = 0x0309; 46339 t.hookcmb = 0x0309; 46340 t.hookpalatalizedbelowcmb = 0x0321; 46341 t.hookretroflexbelowcmb = 0x0322; 46342 t.hoonsquare = 0x3342; 46343 t.horicoptic = 0x03e9; 46344 t.horizontalbar = 0x2015; 46345 t.horncmb = 0x031b; 46346 t.hotsprings = 0x2668; 46347 t.house = 0x2302; 46348 t.hparen = 0x24a3; 46349 t.hsuperior = 0x02b0; 46350 t.hturned = 0x0265; 46351 t.huhiragana = 0x3075; 46352 t.huiitosquare = 0x3333; 46353 t.hukatakana = 0x30d5; 46354 t.hukatakanahalfwidth = 0xff8c; 46355 t.hungarumlaut = 0x02dd; 46356 t.hungarumlautcmb = 0x030b; 46357 t.hv = 0x0195; 46358 t.hyphen = 0x002d; 46359 t.hypheninferior = 0xf6e5; 46360 t.hyphenmonospace = 0xff0d; 46361 t.hyphensmall = 0xfe63; 46362 t.hyphensuperior = 0xf6e6; 46363 t.hyphentwo = 0x2010; 46364 t.i = 0x0069; 46365 t.iacute = 0x00ed; 46366 t.iacyrillic = 0x044f; 46367 t.ibengali = 0x0987; 46368 t.ibopomofo = 0x3127; 46369 t.ibreve = 0x012d; 46370 t.icaron = 0x01d0; 46371 t.icircle = 0x24d8; 46372 t.icircumflex = 0x00ee; 46373 t.icyrillic = 0x0456; 46374 t.idblgrave = 0x0209; 46375 t.ideographearthcircle = 0x328f; 46376 t.ideographfirecircle = 0x328b; 46377 t.ideographicallianceparen = 0x323f; 46378 t.ideographiccallparen = 0x323a; 46379 t.ideographiccentrecircle = 0x32a5; 46380 t.ideographicclose = 0x3006; 46381 t.ideographiccomma = 0x3001; 46382 t.ideographiccommaleft = 0xff64; 46383 t.ideographiccongratulationparen = 0x3237; 46384 t.ideographiccorrectcircle = 0x32a3; 46385 t.ideographicearthparen = 0x322f; 46386 t.ideographicenterpriseparen = 0x323d; 46387 t.ideographicexcellentcircle = 0x329d; 46388 t.ideographicfestivalparen = 0x3240; 46389 t.ideographicfinancialcircle = 0x3296; 46390 t.ideographicfinancialparen = 0x3236; 46391 t.ideographicfireparen = 0x322b; 46392 t.ideographichaveparen = 0x3232; 46393 t.ideographichighcircle = 0x32a4; 46394 t.ideographiciterationmark = 0x3005; 46395 t.ideographiclaborcircle = 0x3298; 46396 t.ideographiclaborparen = 0x3238; 46397 t.ideographicleftcircle = 0x32a7; 46398 t.ideographiclowcircle = 0x32a6; 46399 t.ideographicmedicinecircle = 0x32a9; 46400 t.ideographicmetalparen = 0x322e; 46401 t.ideographicmoonparen = 0x322a; 46402 t.ideographicnameparen = 0x3234; 46403 t.ideographicperiod = 0x3002; 46404 t.ideographicprintcircle = 0x329e; 46405 t.ideographicreachparen = 0x3243; 46406 t.ideographicrepresentparen = 0x3239; 46407 t.ideographicresourceparen = 0x323e; 46408 t.ideographicrightcircle = 0x32a8; 46409 t.ideographicsecretcircle = 0x3299; 46410 t.ideographicselfparen = 0x3242; 46411 t.ideographicsocietyparen = 0x3233; 46412 t.ideographicspace = 0x3000; 46413 t.ideographicspecialparen = 0x3235; 46414 t.ideographicstockparen = 0x3231; 46415 t.ideographicstudyparen = 0x323b; 46416 t.ideographicsunparen = 0x3230; 46417 t.ideographicsuperviseparen = 0x323c; 46418 t.ideographicwaterparen = 0x322c; 46419 t.ideographicwoodparen = 0x322d; 46420 t.ideographiczero = 0x3007; 46421 t.ideographmetalcircle = 0x328e; 46422 t.ideographmooncircle = 0x328a; 46423 t.ideographnamecircle = 0x3294; 46424 t.ideographsuncircle = 0x3290; 46425 t.ideographwatercircle = 0x328c; 46426 t.ideographwoodcircle = 0x328d; 46427 t.ideva = 0x0907; 46428 t.idieresis = 0x00ef; 46429 t.idieresisacute = 0x1e2f; 46430 t.idieresiscyrillic = 0x04e5; 46431 t.idotbelow = 0x1ecb; 46432 t.iebrevecyrillic = 0x04d7; 46433 t.iecyrillic = 0x0435; 46434 t.ieungacirclekorean = 0x3275; 46435 t.ieungaparenkorean = 0x3215; 46436 t.ieungcirclekorean = 0x3267; 46437 t.ieungkorean = 0x3147; 46438 t.ieungparenkorean = 0x3207; 46439 t.igrave = 0x00ec; 46440 t.igujarati = 0x0a87; 46441 t.igurmukhi = 0x0a07; 46442 t.ihiragana = 0x3044; 46443 t.ihookabove = 0x1ec9; 46444 t.iibengali = 0x0988; 46445 t.iicyrillic = 0x0438; 46446 t.iideva = 0x0908; 46447 t.iigujarati = 0x0a88; 46448 t.iigurmukhi = 0x0a08; 46449 t.iimatragurmukhi = 0x0a40; 46450 t.iinvertedbreve = 0x020b; 46451 t.iishortcyrillic = 0x0439; 46452 t.iivowelsignbengali = 0x09c0; 46453 t.iivowelsigndeva = 0x0940; 46454 t.iivowelsigngujarati = 0x0ac0; 46455 t.ij = 0x0133; 46456 t.ikatakana = 0x30a4; 46457 t.ikatakanahalfwidth = 0xff72; 46458 t.ikorean = 0x3163; 46459 t.ilde = 0x02dc; 46460 t.iluyhebrew = 0x05ac; 46461 t.imacron = 0x012b; 46462 t.imacroncyrillic = 0x04e3; 46463 t.imageorapproximatelyequal = 0x2253; 46464 t.imatragurmukhi = 0x0a3f; 46465 t.imonospace = 0xff49; 46466 t.increment = 0x2206; 46467 t.infinity = 0x221e; 46468 t.iniarmenian = 0x056b; 46469 t.integral = 0x222b; 46470 t.integralbottom = 0x2321; 46471 t.integralbt = 0x2321; 46472 t.integralex = 0xf8f5; 46473 t.integraltop = 0x2320; 46474 t.integraltp = 0x2320; 46475 t.intersection = 0x2229; 46476 t.intisquare = 0x3305; 46477 t.invbullet = 0x25d8; 46478 t.invcircle = 0x25d9; 46479 t.invsmileface = 0x263b; 46480 t.iocyrillic = 0x0451; 46481 t.iogonek = 0x012f; 46482 t.iota = 0x03b9; 46483 t.iotadieresis = 0x03ca; 46484 t.iotadieresistonos = 0x0390; 46485 t.iotalatin = 0x0269; 46486 t.iotatonos = 0x03af; 46487 t.iparen = 0x24a4; 46488 t.irigurmukhi = 0x0a72; 46489 t.ismallhiragana = 0x3043; 46490 t.ismallkatakana = 0x30a3; 46491 t.ismallkatakanahalfwidth = 0xff68; 46492 t.issharbengali = 0x09fa; 46493 t.istroke = 0x0268; 46494 t.isuperior = 0xf6ed; 46495 t.iterationhiragana = 0x309d; 46496 t.iterationkatakana = 0x30fd; 46497 t.itilde = 0x0129; 46498 t.itildebelow = 0x1e2d;
46499 t.iubopomofo = 0x3129; 46500 t.iucyrillic = 0x044e; 46501 t.ivowelsignbengali = 0x09bf; 46502 t.ivowelsigndeva = 0x093f; 46503 t.ivowelsigngujarati = 0x0abf; 46504 t.izhitsacyrillic = 0x0475; 46505 t.izhitsadblgravecyrillic = 0x0477; 46506 t.j = 0x006a; 46507 t.jaarmenian = 0x0571; 46508 t.jabengali = 0x099c; 46509 t.jadeva = 0x091c; 46510 t.jagujarati = 0x0a9c; 46511 t.jagurmukhi = 0x0a1c; 46512 t.jbopomofo = 0x3110; 46513 t.jcaron = 0x01f0; 46514 t.jcircle = 0x24d9; 46515 t.jcircumflex = 0x0135; 46516 t.jcrossedtail = 0x029d; 46517 t.jdotlessstroke = 0x025f; 46518 t.jecyrillic = 0x0458; 46519 t.jeemarabic = 0x062c; 46520 t.jeemfinalarabic = 0xfe9e; 46521 t.jeeminitialarabic = 0xfe9f; 46522 t.jeemmedialarabic = 0xfea0; 46523 t.jeharabic = 0x0698; 46524 t.jehfinalarabic = 0xfb8b; 46525 t.jhabengali = 0x099d; 46526 t.jhadeva = 0x091d; 46527 t.jhagujarati = 0x0a9d; 46528 t.jhagurmukhi = 0x0a1d; 46529 t.jheharmenian = 0x057b; 46530 t.jis = 0x3004; 46531 t.jmonospace = 0xff4a; 46532 t.jparen = 0x24a5; 46533 t.jsuperior = 0x02b2; 46534 t.k = 0x006b; 46535 t.kabashkircyrillic = 0x04a1; 46536 t.kabengali = 0x0995; 46537 t.kacute = 0x1e31; 46538 t.kacyrillic = 0x043a; 46539 t.kadescendercyrillic = 0x049b; 46540 t.kadeva = 0x0915; 46541 t.kaf = 0x05db; 46542 t.kafarabic = 0x0643; 46543 t.kafdagesh = 0xfb3b; 46544 t.kafdageshhebrew = 0xfb3b; 46545 t.kaffinalarabic = 0xfeda; 46546 t.kafhebrew = 0x05db; 46547 t.kafinitialarabic = 0xfedb; 46548 t.kafmedialarabic = 0xfedc; 46549 t.kafrafehebrew = 0xfb4d; 46550 t.kagujarati = 0x0a95; 46551 t.kagurmukhi = 0x0a15; 46552 t.kahiragana = 0x304b; 46553 t.kahookcyrillic = 0x04c4; 46554 t.kakatakana = 0x30ab; 46555 t.kakatakanahalfwidth = 0xff76; 46556 t.kappa = 0x03ba; 46557 t.kappasymbolgreek = 0x03f0; 46558 t.kapyeounmieumkorean = 0x3171; 46559 t.kapyeounphieuphkorean = 0x3184; 46560 t.kapyeounpieupkorean = 0x3178; 46561 t.kapyeounssangpieupkorean = 0x3179; 46562 t.karoriisquare = 0x330d; 46563 t.kashidaautoarabic = 0x0640; 46564 t.kashidaautonosidebearingarabic = 0x0640; 46565 t.kasmallkatakana = 0x30f5; 46566 t.kasquare = 0x3384; 46567 t.kasraarabic = 0x0650; 46568 t.kasratanarabic = 0x064d; 46569 t.kastrokecyrillic = 0x049f; 46570 t.katahiraprolongmarkhalfwidth = 0xff70; 46571 t.kaverticalstrokecyrillic = 0x049d; 46572 t.kbopomofo = 0x310e; 46573 t.kcalsquare = 0x3389; 46574 t.kcaron = 0x01e9; 46575 t.kcedilla = 0x0137; 46576 t.kcircle = 0x24da; 46577 t.kcommaaccent = 0x0137; 46578 t.kdotbelow = 0x1e33; 46579 t.keharmenian = 0x0584; 46580 t.kehiragana = 0x3051; 46581 t.kekatakana = 0x30b1; 46582 t.kekatakanahalfwidth = 0xff79; 46583 t.kenarmenian = 0x056f; 46584 t.kesmallkatakana = 0x30f6; 46585 t.kgreenlandic = 0x0138; 46586 t.khabengali = 0x0996; 46587 t.khacyrillic = 0x0445; 46588 t.khadeva = 0x0916; 46589 t.khagujarati = 0x0a96; 46590 t.khagurmukhi = 0x0a16; 46591 t.khaharabic = 0x062e; 46592 t.khahfinalarabic = 0xfea6; 46593 t.khahinitialarabic = 0xfea7; 46594 t.khahmedialarabic = 0xfea8; 46595 t.kheicoptic = 0x03e7; 46596 t.khhadeva = 0x0959; 46597 t.khhagurmukhi = 0x0a59; 46598 t.khieukhacirclekorean = 0x3278; 46599 t.khieukhaparenkorean = 0x3218; 46600 t.khieukhcirclekorean = 0x326a; 46601 t.khieukhkorean = 0x314b; 46602 t.khieukhparenkorean = 0x320a; 46603 t.khokhaithai = 0x0e02; 46604 t.khokhonthai = 0x0e05; 46605 t.khokhuatthai = 0x0e03; 46606 t.khokhwaithai = 0x0e04; 46607 t.khomutthai = 0x0e5b; 46608 t.khook = 0x0199; 46609 t.khorakhangthai = 0x0e06; 46610 t.khzsquare = 0x3391; 46611 t.kihiragana = 0x304d; 46612 t.kikatakana = 0x30ad; 46613 t.kikatakanahalfwidth = 0xff77; 46614 t.kiroguramusquare = 0x3315; 46615 t.kiromeetorusquare = 0x3316; 46616 t.kirosquare = 0x3314; 46617 t.kiyeokacirclekorean = 0x326e; 46618 t.kiyeokaparenkorean = 0x320e; 46619 t.kiyeokcirclekorean = 0x3260; 46620 t.kiyeokkorean = 0x3131; 46621 t.kiyeokparenkorean = 0x3200; 46622 t.kiyeoksioskorean = 0x3133; 46623 t.kjecyrillic = 0x045c; 46624 t.klinebelow = 0x1e35; 46625 t.klsquare = 0x3398; 46626 t.kmcubedsquare = 0x33a6; 46627 t.kmonospace = 0xff4b; 46628 t.kmsquaredsquare = 0x33a2; 46629 t.kohiragana = 0x3053; 46630 t.kohmsquare = 0x33c0; 46631 t.kokaithai = 0x0e01; 46632 t.kokatakana = 0x30b3; 46633 t.kokatakanahalfwidth = 0xff7a; 46634 t.kooposquare = 0x331e; 46635 t.koppacyrillic = 0x0481; 46636 t.koreanstandardsymbol = 0x327f; 46637 t.koroniscmb = 0x0343; 46638 t.kparen = 0x24a6; 46639 t.kpasquare = 0x33aa; 46640 t.ksicyrillic = 0x046f; 46641 t.ktsquare = 0x33cf; 46642 t.kturned = 0x029e; 46643 t.kuhiragana = 0x304f; 46644 t.kukatakana = 0x30af; 46645 t.kukatakanahalfwidth = 0xff78; 46646 t.kvsquare = 0x33b8; 46647 t.kwsquare = 0x33be; 46648 t.l = 0x006c; 46649 t.labengali = 0x09b2; 46650 t.lacute = 0x013a; 46651 t.ladeva = 0x0932; 46652 t.lagujarati = 0x0ab2; 46653 t.lagurmukhi = 0x0a32; 46654 t.lakkhangyaothai = 0x0e45; 46655 t.lamaleffinalarabic = 0xfefc; 46656 t.lamalefhamzaabovefinalarabic = 0xfef8; 46657 t.lamalefhamzaaboveisolatedarabic = 0xfef7; 46658 t.lamalefhamzabelowfinalarabic = 0xfefa; 46659 t.lamalefhamzabelowisolatedarabic = 0xfef9; 46660 t.lamalefisolatedarabic = 0xfefb; 46661 t.lamalefmaddaabovefinalarabic = 0xfef6; 46662 t.lamalefmaddaaboveisolatedarabic = 0xfef5; 46663 t.lamarabic = 0x0644; 46664 t.lambda = 0x03bb; 46665 t.lambdastroke = 0x019b; 46666 t.lamed = 0x05dc; 46667 t.lameddagesh = 0xfb3c; 46668 t.lameddageshhebrew = 0xfb3c; 46669 t.lamedhebrew = 0x05dc; 46670 t.lamfinalarabic = 0xfede; 46671 t.lamhahinitialarabic = 0xfcca; 46672 t.laminitialarabic = 0xfedf; 46673 t.lamjeeminitialarabic = 0xfcc9; 46674 t.lamkhahinitialarabic = 0xfccb; 46675 t.lamlamhehisolatedarabic = 0xfdf2; 46676 t.lammedialarabic = 0xfee0; 46677 t.lammeemhahinitialarabic = 0xfd88; 46678 t.lammeeminitialarabic = 0xfccc; 46679 t.largecircle = 0x25ef; 46680 t.lbar = 0x019a; 46681 t.lbelt = 0x026c; 46682 t.lbopomofo = 0x310c; 46683 t.lcaron = 0x013e; 46684 t.lcedilla = 0x013c; 46685 t.lcircle = 0x24db; 46686 t.lcircumflexbelow = 0x1e3d; 46687 t.lcommaaccent = 0x013c; 46688 t.ldot = 0x0140; 46689 t.ldotaccent = 0x0140; 46690 t.ldotbelow = 0x1e37; 46691 t.ldotbelowmacron = 0x1e39; 46692 t.leftangleabovecmb = 0x031a; 46693 t.lefttackbelowcmb = 0x0318; 46694 t.less = 0x003c; 46695 t.lessequal = 0x2264; 46696 t.lessequalorgreater = 0x22da; 46697 t.lessmonospace = 0xff1c; 46698 t.lessorequivalent = 0x2272; 46699 t.lessorgreater = 0x2276; 46700 t.lessoverequal = 0x2266; 46701 t.lesssmall = 0xfe64; 46702 t.lezh = 0x026e; 46703 t.lfblock = 0x258c; 46704 t.lhookretroflex = 0x026d; 46705 t.lira = 0x20a4; 46706 t.liwnarmenian = 0x056c; 46707 t.lj = 0x01c9; 46708 t.ljecyrillic = 0x0459;
46709 t.ll = 0xf6c0; 46710 t.lladeva = 0x0933; 46711 t.llagujarati = 0x0ab3; 46712 t.llinebelow = 0x1e3b; 46713 t.llladeva = 0x0934; 46714 t.llvocalicbengali = 0x09e1; 46715 t.llvocalicdeva = 0x0961; 46716 t.llvocalicvowelsignbengali = 0x09e3; 46717 t.llvocalicvowelsigndeva = 0x0963; 46718 t.lmiddletilde = 0x026b; 46719 t.lmonospace = 0xff4c; 46720 t.lmsquare = 0x33d0; 46721 t.lochulathai = 0x0e2c; 46722 t.logicaland = 0x2227; 46723 t.logicalnot = 0x00ac; 46724 t.logicalnotreversed = 0x2310; 46725 t.logicalor = 0x2228; 46726 t.lolingthai = 0x0e25; 46727 t.longs = 0x017f; 46728 t.lowlinecenterline = 0xfe4e; 46729 t.lowlinecmb = 0x0332; 46730 t.lowlinedashed = 0xfe4d; 46731 t.lozenge = 0x25ca; 46732 t.lparen = 0x24a7; 46733 t.lslash = 0x0142; 46734 t.lsquare = 0x2113; 46735 t.lsuperior = 0xf6ee; 46736 t.ltshade = 0x2591; 46737 t.luthai = 0x0e26; 46738 t.lvocalicbengali = 0x098c; 46739 t.lvocalicdeva = 0x090c; 46740 t.lvocalicvowelsignbengali = 0x09e2; 46741 t.lvocalicvowelsigndeva = 0x0962; 46742 t.lxsquare = 0x33d3; 46743 t.m = 0x006d; 46744 t.mabengali = 0x09ae; 46745 t.macron = 0x00af; 46746 t.macronbelowcmb = 0x0331; 46747 t.macroncmb = 0x0304; 46748 t.macronlowmod = 0x02cd; 46749 t.macronmonospace = 0xffe3; 46750 t.macute = 0x1e3f; 46751 t.madeva = 0x092e; 46752 t.magujarati = 0x0aae; 46753 t.magurmukhi = 0x0a2e; 46754 t.mahapakhhebrew = 0x05a4; 46755 t.mahapakhlefthebrew = 0x05a4; 46756 t.mahiragana = 0x307e; 46757 t.maichattawalowleftthai = 0xf895; 46758 t.maichattawalowrightthai = 0xf894; 46759 t.maichattawathai = 0x0e4b; 46760 t.maichattawaupperleftthai = 0xf893; 46761 t.maieklowleftthai = 0xf88c; 46762 t.maieklowrightthai = 0xf88b; 46763 t.maiekthai = 0x0e48; 46764 t.maiekupperleftthai = 0xf88a; 46765 t.maihanakatleftthai = 0xf884; 46766 t.maihanakatthai = 0x0e31; 46767 t.maitaikhuleftthai = 0xf889; 46768 t.maitaikhuthai = 0x0e47; 46769 t.maitholowleftthai = 0xf88f; 46770 t.maitholowrightthai = 0xf88e; 46771 t.maithothai = 0x0e49; 46772 t.maithoupperleftthai = 0xf88d; 46773 t.maitrilowleftthai = 0xf892; 46774 t.maitrilowrightthai = 0xf891; 46775 t.maitrithai = 0x0e4a; 46776 t.maitriupperleftthai = 0xf890; 46777 t.maiyamokthai = 0x0e46; 46778 t.makatakana = 0x30de; 46779 t.makatakanahalfwidth = 0xff8f; 46780 t.male = 0x2642; 46781 t.mansyonsquare = 0x3347; 46782 t.maqafhebrew = 0x05be; 46783 t.mars = 0x2642; 46784 t.masoracirclehebrew = 0x05af; 46785 t.masquare = 0x3383; 46786 t.mbopomofo = 0x3107; 46787 t.mbsquare = 0x33d4; 46788 t.mcircle = 0x24dc; 46789 t.mcubedsquare = 0x33a5; 46790 t.mdotaccent = 0x1e41; 46791 t.mdotbelow = 0x1e43; 46792 t.meemarabic = 0x0645; 46793 t.meemfinalarabic = 0xfee2; 46794 t.meeminitialarabic = 0xfee3; 46795 t.meemmedialarabic = 0xfee4; 46796 t.meemmeeminitialarabic = 0xfcd1; 46797 t.meemmeemisolatedarabic = 0xfc48; 46798 t.meetorusquare = 0x334d; 46799 t.mehiragana = 0x3081; 46800 t.meizierasquare = 0x337e; 46801 t.mekatakana = 0x30e1; 46802 t.mekatakanahalfwidth = 0xff92; 46803 t.mem = 0x05de; 46804 t.memdagesh = 0xfb3e; 46805 t.memdageshhebrew = 0xfb3e; 46806 t.memhebrew = 0x05de; 46807 t.menarmenian = 0x0574; 46808 t.merkhahebrew = 0x05a5; 46809 t.merkhakefulahebrew = 0x05a6; 46810 t.merkhakefulalefthebrew = 0x05a6; 46811 t.merkhalefthebrew = 0x05a5; 46812 t.mhook = 0x0271; 46813 t.mhzsquare = 0x3392; 46814 t.middledotkatakanahalfwidth = 0xff65; 46815 t.middot = 0x00b7; 46816 t.mieumacirclekorean = 0x3272; 46817 t.mieumaparenkorean = 0x3212; 46818 t.mieumcirclekorean = 0x3264; 46819 t.mieumkorean = 0x3141; 46820 t.mieumpansioskorean = 0x3170; 46821 t.mieumparenkorean = 0x3204; 46822 t.mieumpieupkorean = 0x316e; 46823 t.mieumsioskorean = 0x316f; 46824 t.mihiragana = 0x307f; 46825 t.mikatakana = 0x30df; 46826 t.mikatakanahalfwidth = 0xff90; 46827 t.minus = 0x2212; 46828 t.minusbelowcmb = 0x0320; 46829 t.minuscircle = 0x2296; 46830 t.minusmod = 0x02d7; 46831 t.minusplus = 0x2213; 46832 t.minute = 0x2032; 46833 t.miribaarusquare = 0x334a; 46834 t.mirisquare = 0x3349; 46835 t.mlonglegturned = 0x0270; 46836 t.mlsquare = 0x3396; 46837 t.mmcubedsquare = 0x33a3; 46838 t.mmonospace = 0xff4d; 46839 t.mmsquaredsquare = 0x339f; 46840 t.mohiragana = 0x3082; 46841 t.mohmsquare = 0x33c1; 46842 t.mokatakana = 0x30e2; 46843 t.mokatakanahalfwidth = 0xff93; 46844 t.molsquare = 0x33d6; 46845 t.momathai = 0x0e21; 46846 t.moverssquare = 0x33a7; 46847 t.moverssquaredsquare = 0x33a8; 46848 t.mparen = 0x24a8; 46849 t.mpasquare = 0x33ab; 46850 t.mssquare = 0x33b3; 46851 t.msuperior = 0xf6ef; 46852 t.mturned = 0x026f; 46853 t.mu = 0x00b5; 46854 t.mu1 = 0x00b5; 46855 t.muasquare = 0x3382; 46856 t.muchgreater = 0x226b; 46857 t.muchless = 0x226a; 46858 t.mufsquare = 0x338c; 46859 t.mugreek = 0x03bc; 46860 t.mugsquare = 0x338d; 46861 t.muhiragana = 0x3080; 46862 t.mukatakana = 0x30e0; 46863 t.mukatakanahalfwidth = 0xff91; 46864 t.mulsquare = 0x3395; 46865 t.multiply = 0x00d7; 46866 t.mumsquare = 0x339b; 46867 t.munahhebrew = 0x05a3;
46868 t.munahlefthebrew = 0x05a3; 46869 t.musicalnote = 0x266a; 46870 t.musicalnotedbl = 0x266b; 46871 t.musicflatsign = 0x266d; 46872 t.musicsharpsign = 0x266f; 46873 t.mussquare = 0x33b2; 46874 t.muvsquare = 0x33b6; 46875 t.muwsquare = 0x33bc; 46876 t.mvmegasquare = 0x33b9; 46877 t.mvsquare = 0x33b7; 46878 t.mwmegasquare = 0x33bf; 46879 t.mwsquare = 0x33bd; 46880 t.n = 0x006e; 46881 t.nabengali = 0x09a8; 46882 t.nabla = 0x2207; 46883 t.nacute = 0x0144; 46884 t.nadeva = 0x0928; 46885 t.nagujarati = 0x0aa8; 46886 t.nagurmukhi = 0x0a28; 46887 t.nahiragana = 0x306a; 46888 t.nakatakana = 0x30ca; 46889 t.nakatakanahalfwidth = 0xff85; 46890 t.napostrophe = 0x0149; 46891 t.nasquare = 0x3381; 46892 t.nbopomofo = 0x310b; 46893 t.nbspace = 0x00a0; 46894 t.ncaron = 0x0148; 46895 t.ncedilla = 0x0146; 46896 t.ncircle = 0x24dd; 46897 t.ncircumflexbelow = 0x1e4b; 46898 t.ncommaaccent = 0x0146; 46899 t.ndotaccent = 0x1e45; 46900 t.ndotbelow = 0x1e47; 46901 t.nehiragana = 0x306d; 46902 t.nekatakana = 0x30cd; 46903 t.nekatakanahalfwidth = 0xff88; 46904 t.newsheqelsign = 0x20aa; 46905 t.nfsquare = 0x338b; 46906 t.ngabengali = 0x0999; 46907 t.ngadeva = 0x0919; 46908 t.ngagujarati = 0x0a99; 46909 t.ngagurmukhi = 0x0a19; 46910 t.ngonguthai = 0x0e07; 46911 t.nhiragana = 0x3093; 46912 t.nhookleft = 0x0272; 46913 t.nhookretroflex = 0x0273; 46914 t.nieunacirclekorean = 0x326f; 46915 t.nieunaparenkorean = 0x320f; 46916 t.nieuncieuckorean = 0x3135; 46917 t.nieuncirclekorean = 0x3261; 46918 t.nieunhieuhkorean = 0x3136; 46919 t.nieunkorean = 0x3134; 46920 t.nieunpansioskorean = 0x3168; 46921 t.nieunparenkorean = 0x3201; 46922 t.nieunsioskorean = 0x3167; 46923 t.nieuntikeutkorean = 0x3166; 46924 t.nihiragana = 0x306b; 46925 t.nikatakana = 0x30cb; 46926 t.nikatakanahalfwidth = 0xff86; 46927 t.nikhahitleftthai = 0xf899; 46928 t.nikhahitthai = 0x0e4d; 46929 t.nine = 0x0039; 46930 t.ninearabic = 0x0669; 46931 t.ninebengali = 0x09ef; 46932 t.ninecircle = 0x2468; 46933 t.ninecircleinversesansserif = 0x2792; 46934 t.ninedeva = 0x096f; 46935 t.ninegujarati = 0x0aef; 46936 t.ninegurmukhi = 0x0a6f; 46937 t.ninehackarabic = 0x0669; 46938 t.ninehangzhou = 0x3029; 46939 t.nineideographicparen = 0x3228; 46940 t.nineinferior = 0x2089; 46941 t.ninemonospace = 0xff19; 46942 t.nineoldstyle = 0xf739; 46943 t.nineparen = 0x247c; 46944 t.nineperiod = 0x2490; 46945 t.ninepersian = 0x06f9; 46946 t.nineroman = 0x2178; 46947 t.ninesuperior = 0x2079; 46948 t.nineteencircle = 0x2472; 46949 t.nineteenparen = 0x2486; 46950 t.nineteenperiod = 0x249a; 46951 t.ninethai = 0x0e59; 46952 t.nj = 0x01cc; 46953 t.njecyrillic = 0x045a; 46954 t.nkatakana = 0x30f3; 46955 t.nkatakanahalfwidth = 0xff9d; 46956 t.nlegrightlong = 0x019e; 46957 t.nlinebelow = 0x1e49; 46958 t.nmonospace = 0xff4e; 46959 t.nmsquare = 0x339a; 46960 t.nnabengali = 0x09a3; 46961 t.nnadeva = 0x0923; 46962 t.nnagujarati = 0x0aa3; 46963 t.nnagurmukhi = 0x0a23; 46964 t.nnnadeva = 0x0929; 46965 t.nohiragana = 0x306e; 46966 t.nokatakana = 0x30ce; 46967 t.nokatakanahalfwidth = 0xff89; 46968 t.nonbreakingspace = 0x00a0; 46969 t.nonenthai = 0x0e13; 46970 t.nonuthai = 0x0e19; 46971 t.noonarabic = 0x0646; 46972 t.noonfinalarabic = 0xfee6; 46973 t.noonghunnaarabic = 0x06ba; 46974 t.noonghunnafinalarabic = 0xfb9f; 46975 t.nooninitialarabic = 0xfee7; 46976 t.noonjeeminitialarabic = 0xfcd2; 46977 t.noonjeemisolatedarabic = 0xfc4b; 46978 t.noonmedialarabic = 0xfee8; 46979 t.noonmeeminitialarabic = 0xfcd5; 46980 t.noonmeemisolatedarabic = 0xfc4e; 46981 t.noonnoonfinalarabic = 0xfc8d; 46982 t.notcontains = 0x220c; 46983 t.notelement = 0x2209; 46984 t.notelementof = 0x2209; 46985 t.notequal = 0x2260; 46986 t.notgreater = 0x226f; 46987 t.notgreaternorequal = 0x2271; 46988 t.notgreaternorless = 0x2279; 46989 t.notidentical = 0x2262; 46990 t.notless = 0x226e; 46991 t.notlessnorequal = 0x2270; 46992 t.notparallel = 0x2226; 46993 t.notprecedes = 0x2280; 46994 t.notsubset = 0x2284; 46995 t.notsucceeds = 0x2281; 46996 t.notsuperset = 0x2285; 46997 t.nowarmenian = 0x0576; 46998 t.nparen = 0x24a9; 46999 t.nssquare = 0x33b1; 47000 t.nsuperior = 0x207f; 47001 t.ntilde = 0x00f1; 47002 t.nu = 0x03bd; 47003 t.nuhiragana = 0x306c; 47004 t.nukatakana = 0x30cc; 47005 t.nukatakanahalfwidth = 0xff87; 47006 t.nuktabengali = 0x09bc; 47007 t.nuktadeva = 0x093c; 47008 t.nuktagujarati = 0x0abc; 47009 t.nuktagurmukhi = 0x0a3c; 47010 t.numbersign = 0x0023; 47011 t.numbersignmonospace = 0xff03; 47012 t.numbersignsmall = 0xfe5f; 47013 t.numeralsigngreek = 0x0374; 47014 t.numeralsignlowergreek = 0x0375; 47015 t.numero = 0x2116; 47016 t.nun = 0x05e0; 47017 t.nundagesh = 0xfb40; 47018 t.nundageshhebrew = 0xfb40; 47019 t.nunhebrew = 0x05e0; 47020 t.nvsquare = 0x33b5; 47021 t.nwsquare = 0x33bb; 47022 t.nyabengali = 0x099e; 47023 t.nyadeva = 0x091e; 47024 t.nyagujarati = 0x0a9e; 47025 t.nyagurmukhi = 0x0a1e; 47026 t.o = 0x006f; 47027 t.oacute = 0x00f3; 47028 t.oangthai = 0x0e2d; 47029 t.obarred = 0x0275; 47030 t.obarredcyrillic = 0x04e9; 47031 t.obarreddieresiscyrillic = 0x04eb; 47032 t.obengali = 0x0993; 47033 t.obopomofo = 0x311b; 47034 t.obreve = 0x014f; 47035 t.ocandradeva = 0x0911; 47036 t.ocandragujarati = 0x0a91; 47037 t.ocandravowelsigndeva = 0x0949; 47038 t.ocandravowelsigngujarati = 0x0ac9; 47039 t.ocaron = 0x01d2; 47040 t.ocircle = 0x24de; 47041 t.ocircumflex = 0x00f4; 47042 t.ocircumflexacute = 0x1ed1; 47043 t.ocircumflexdotbelow = 0x1ed9;
47044 t.ocircumflexgrave = 0x1ed3; 47045 t.ocircumflexhookabove = 0x1ed5; 47046 t.ocircumflextilde = 0x1ed7; 47047 t.ocyrillic = 0x043e; 47048 t.odblacute = 0x0151; 47049 t.odblgrave = 0x020d; 47050 t.odeva = 0x0913; 47051 t.odieresis = 0x00f6; 47052 t.odieresiscyrillic = 0x04e7; 47053 t.odotbelow = 0x1ecd; 47054 t.oe = 0x0153; 47055 t.oekorean = 0x315a; 47056 t.ogonek = 0x02db; 47057 t.ogonekcmb = 0x0328; 47058 t.ograve = 0x00f2; 47059 t.ogujarati = 0x0a93; 47060 t.oharmenian = 0x0585; 47061 t.ohiragana = 0x304a; 47062 t.ohookabove = 0x1ecf; 47063 t.ohorn = 0x01a1; 47064 t.ohornacute = 0x1edb; 47065 t.ohorndotbelow = 0x1ee3; 47066 t.ohorngrave = 0x1edd; 47067 t.ohornhookabove = 0x1edf; 47068 t.ohorntilde = 0x1ee1; 47069 t.ohungarumlaut = 0x0151; 47070 t.oi = 0x01a3; 47071 t.oinvertedbreve = 0x020f; 47072 t.okatakana = 0x30aa; 47073 t.okatakanahalfwidth = 0xff75; 47074 t.okorean = 0x3157; 47075 t.olehebrew = 0x05ab; 47076 t.omacron = 0x014d; 47077 t.omacronacute = 0x1e53; 47078 t.omacrongrave = 0x1e51; 47079 t.omdeva = 0x0950; 47080 t.omega = 0x03c9; 47081 t.omega1 = 0x03d6; 47082 t.omegacyrillic = 0x0461; 47083 t.omegalatinclosed = 0x0277; 47084 t.omegaroundcyrillic = 0x047b; 47085 t.omegatitlocyrillic = 0x047d; 47086 t.omegatonos = 0x03ce; 47087 t.omgujarati = 0x0ad0; 47088 t.omicron = 0x03bf; 47089 t.omicrontonos = 0x03cc; 47090 t.omonospace = 0xff4f; 47091 t.one = 0x0031; 47092 t.onearabic = 0x0661; 47093 t.onebengali = 0x09e7; 47094 t.onecircle = 0x2460; 47095 t.onecircleinversesansserif = 0x278a; 47096 t.onedeva = 0x0967; 47097 t.onedotenleader = 0x2024; 47098 t.oneeighth = 0x215b; 47099 t.onefitted = 0xf6dc; 47100 t.onegujarati = 0x0ae7; 47101 t.onegurmukhi = 0x0a67; 47102 t.onehackarabic = 0x0661; 47103 t.onehalf = 0x00bd; 47104 t.onehangzhou = 0x3021; 47105 t.oneideographicparen = 0x3220; 47106 t.oneinferior = 0x2081; 47107 t.onemonospace = 0xff11; 47108 t.onenumeratorbengali = 0x09f4; 47109 t.oneoldstyle = 0xf731; 47110 t.oneparen = 0x2474; 47111 t.oneperiod = 0x2488; 47112 t.onepersian = 0x06f1; 47113 t.onequarter = 0x00bc; 47114 t.oneroman = 0x2170; 47115 t.onesuperior = 0x00b9; 47116 t.onethai = 0x0e51; 47117 t.onethird = 0x2153; 47118 t.oogonek = 0x01eb; 47119 t.oogonekmacron = 0x01ed; 47120 t.oogurmukhi = 0x0a13; 47121 t.oomatragurmukhi = 0x0a4b; 47122 t.oopen = 0x0254; 47123 t.oparen = 0x24aa; 47124 t.openbullet = 0x25e6; 47125 t.option = 0x2325; 47126 t.ordfeminine = 0x00aa; 47127 t.ordmasculine = 0x00ba; 47128 t.orthogonal = 0x221f; 47129 t.oshortdeva = 0x0912; 47130 t.oshortvowelsigndeva = 0x094a; 47131 t.oslash = 0x00f8; 47132 t.oslashacute = 0x01ff; 47133 t.osmallhiragana = 0x3049;
47134 t.osmallkatakana = 0x30a9; 47135 t.osmallkatakanahalfwidth = 0xff6b; 47136 t.ostrokeacute = 0x01ff; 47137 t.osuperior = 0xf6f0; 47138 t.otcyrillic = 0x047f; 47139 t.otilde = 0x00f5; 47140 t.otildeacute = 0x1e4d; 47141 t.otildedieresis = 0x1e4f; 47142 t.oubopomofo = 0x3121; 47143 t.overline = 0x203e; 47144 t.overlinecenterline = 0xfe4a; 47145 t.overlinecmb = 0x0305; 47146 t.overlinedashed = 0xfe49; 47147 t.overlinedblwavy = 0xfe4c; 47148 t.overlinewavy = 0xfe4b; 47149 t.overscore = 0x00af; 47150 t.ovowelsignbengali = 0x09cb; 47151 t.ovowelsigndeva = 0x094b; 47152 t.ovowelsigngujarati = 0x0acb; 47153 t.p = 0x0070; 47154 t.paampssquare = 0x3380; 47155 t.paasentosquare = 0x332b; 47156 t.pabengali = 0x09aa; 47157 t.pacute = 0x1e55; 47158 t.padeva = 0x092a; 47159 t.pagedown = 0x21df; 47160 t.pageup = 0x21de; 47161 t.pagujarati = 0x0aaa; 47162 t.pagurmukhi = 0x0a2a; 47163 t.pahiragana = 0x3071; 47164 t.paiyannoithai = 0x0e2f; 47165 t.pakatakana = 0x30d1; 47166 t.palatalizationcyrilliccmb = 0x0484; 47167 t.palochkacyrillic = 0x04c0; 47168 t.pansioskorean = 0x317f; 47169 t.paragraph = 0x00b6; 47170 t.parallel = 0x2225; 47171 t.parenleft = 0x0028; 47172 t.parenleftaltonearabic = 0xfd3e; 47173 t.parenleftbt = 0xf8ed; 47174 t.parenleftex = 0xf8ec; 47175 t.parenleftinferior = 0x208d; 47176 t.parenleftmonospace = 0xff08; 47177 t.parenleftsmall = 0xfe59; 47178 t.parenleftsuperior = 0x207d; 47179 t.parenlefttp = 0xf8eb; 47180 t.parenleftvertical = 0xfe35; 47181 t.parenright = 0x0029; 47182 t.parenrightaltonearabic = 0xfd3f; 47183 t.parenrightbt = 0xf8f8; 47184 t.parenrightex = 0xf8f7; 47185 t.parenrightinferior = 0x208e; 47186 t.parenrightmonospace = 0xff09; 47187 t.parenrightsmall = 0xfe5a; 47188 t.parenrightsuperior = 0x207e; 47189 t.parenrighttp = 0xf8f6; 47190 t.parenrightvertical = 0xfe36; 47191 t.partialdiff = 0x2202; 47192 t.paseqhebrew = 0x05c0; 47193 t.pashtahebrew = 0x0599; 47194 t.pasquare = 0x33a9; 47195 t.patah = 0x05b7; 47196 t.patah11 = 0x05b7; 47197 t.patah1d = 0x05b7; 47198 t.patah2a = 0x05b7; 47199 t.patahhebrew = 0x05b7; 47200 t.patahnarrowhebrew = 0x05b7; 47201 t.patahquarterhebrew = 0x05b7; 47202 t.patahwidehebrew = 0x05b7; 47203 t.pazerhebrew = 0x05a1; 47204 t.pbopomofo = 0x3106; 47205 t.pcircle = 0x24df; 47206 t.pdotaccent = 0x1e57; 47207 t.pe = 0x05e4; 47208 t.pecyrillic = 0x043f; 47209 t.pedagesh = 0xfb44; 47210 t.pedageshhebrew = 0xfb44; 47211 t.peezisquare = 0x333b; 47212 t.pefinaldageshhebrew = 0xfb43; 47213 t.peharabic = 0x067e; 47214 t.peharmenian = 0x057a; 47215 t.pehebrew = 0x05e4; 47216 t.pehfinalarabic = 0xfb57; 47217 t.pehinitialarabic = 0xfb58; 47218 t.pehiragana = 0x307a; 47219 t.pehmedialarabic = 0xfb59; 47220 t.pekatakana = 0x30da; 47221 t.pemiddlehookcyrillic = 0x04a7; 47222 t.perafehebrew = 0xfb4e; 47223 t.percent = 0x0025; 47224 t.percentarabic = 0x066a; 47225 t.percentmonospace = 0xff05; 47226 t.percentsmall = 0xfe6a; 47227 t.period = 0x002e; 47228 t.periodarmenian = 0x0589; 47229 t.periodcentered = 0x00b7; 47230 t.periodhalfwidth = 0xff61; 47231 t.periodinferior = 0xf6e7; 47232 t.periodmonospace = 0xff0e; 47233 t.periodsmall = 0xfe52; 47234 t.periodsuperior = 0xf6e8; 47235 t.perispomenigreekcmb = 0x0342; 47236 t.perpendicular = 0x22a5; 47237 t.perthousand = 0x2030; 47238 t.peseta = 0x20a7; 47239 t.pfsquare = 0x338a; 47240 t.phabengali = 0x09ab; 47241 t.phadeva = 0x092b; 47242 t.phagujarati = 0x0aab; 47243 t.phagurmukhi = 0x0a2b; 47244 t.phi = 0x03c6; 47245 t.phi1 = 0x03d5; 47246 t.phieuphacirclekorean = 0x327a; 47247 t.phieuphaparenkorean = 0x321a; 47248 t.phieuphcirclekorean = 0x326c; 47249 t.phieuphkorean = 0x314d; 47250 t.phieuphparenkorean = 0x320c; 47251 t.philatin = 0x0278; 47252 t.phinthuthai = 0x0e3a; 47253 t.phisymbolgreek = 0x03d5; 47254 t.phook = 0x01a5; 47255 t.phophanthai = 0x0e1e; 47256 t.phophungthai = 0x0e1c; 47257 t.phosamphaothai = 0x0e20; 47258 t.pi = 0x03c0; 47259 t.pieupacirclekorean = 0x3273; 47260 t.pieupaparenkorean = 0x3213; 47261 t.pieupcieuckorean = 0x3176; 47262 t.pieupcirclekorean = 0x3265; 47263 t.pieupkiyeokkorean = 0x3172; 47264 t.pieupkorean = 0x3142; 47265 t.pieupparenkorean = 0x3205; 47266 t.pieupsioskiyeokkorean = 0x3174; 47267 t.pieupsioskorean = 0x3144; 47268 t.pieupsiostikeutkorean = 0x3175; 47269 t.pieupthieuthkorean = 0x3177; 47270 t.pieuptikeutkorean = 0x3173; 47271 t.pihiragana = 0x3074; 47272 t.pikatakana = 0x30d4; 47273 t.pisymbolgreek = 0x03d6; 47274 t.piwrarmenian = 0x0583; 47275 t.plus = 0x002b; 47276 t.plusbelowcmb = 0x031f; 47277 t.pluscircle = 0x2295; 47278 t.plusminus = 0x00b1; 47279 t.plusmod = 0x02d6; 47280 t.plusmonospace = 0xff0b; 47281 t.plussmall = 0xfe62; 47282 t.plussuperior = 0x207a; 47283 t.pmonospace = 0xff50; 47284 t.pmsquare = 0x33d8; 47285 t.pohiragana = 0x307d; 47286 t.pointingindexdownwhite = 0x261f; 47287 t.pointingindexleftwhite = 0x261c; 47288 t.pointingindexrightwhite = 0x261e; 47289 t.pointingindexupwhite = 0x261d; 47290 t.pokatakana = 0x30dd; 47291 t.poplathai = 0x0e1b; 47292 t.postalmark = 0x3012; 47293 t.postalmarkface = 0x3020; 47294 t.pparen = 0x24ab; 47295 t.precedes = 0x227a; 47296 t.prescription = 0x211e; 47297 t.primemod = 0x02b9; 47298 t.primereversed = 0x2035; 47299 t.product = 0x220f; 47300 t.projective = 0x2305; 47301 t.prolongedkana = 0x30fc; 47302 t.propellor = 0x2318; 47303 t.propersubset = 0x2282; 47304 t.propersuperset = 0x2283; 47305 t.proportion = 0x2237; 47306 t.proportional = 0x221d; 47307 t.psi = 0x03c8; 47308 t.psicyrillic = 0x0471; 47309 t.psilipneumatacyrilliccmb = 0x0486; 47310 t.pssquare = 0x33b0; 47311 t.puhiragana = 0x3077; 47312 t.pukatakana = 0x30d7; 47313 t.pvsquare = 0x33b4; 47314 t.pwsquare = 0x33ba; 47315 t.q = 0x0071; 47316 t.qadeva = 0x0958; 47317 t.qadmahebrew = 0x05a8; 47318 t.qafarabic = 0x0642; 47319 t.qaffinalarabic = 0xfed6; 47320 t.qafinitialarabic = 0xfed7; 47321 t.qafmedialarabic = 0xfed8; 47322 t.qamats = 0x05b8; 47323 t.qamats10 = 0x05b8; 47324 t.qamats1a = 0x05b8; 47325 t.qamats1c = 0x05b8; 47326 t.qamats27 = 0x05b8; 47327 t.qamats29 = 0x05b8; 47328 t.qamats33 = 0x05b8; 47329 t.qamatsde = 0x05b8; 47330 t.qamatshebrew = 0x05b8; 47331 t.qamatsnarrowhebrew = 0x05b8; 47332 t.qamatsqatanhebrew = 0x05b8; 47333 t.qamatsqatannarrowhebrew = 0x05b8; 47334 t.qamatsqatanquarterhebrew = 0x05b8; 47335 t.qamatsqatanwidehebrew = 0x05b8; 47336 t.qamatsquarterhebrew = 0x05b8; 47337 t.qamatswidehebrew = 0x05b8; 47338 t.qarneyparahebrew = 0x059f; 47339 t.qbopomofo = 0x3111; 47340 t.qcircle = 0x24e0; 47341 t.qhook = 0x02a0; 47342 t.qmonospace = 0xff51; 47343 t.qof = 0x05e7; 47344 t.qofdagesh = 0xfb47; 47345 t.qofdageshhebrew = 0xfb47; 47346 t.qofhebrew = 0x05e7; 47347 t.qparen = 0x24ac; 47348 t.quarternote = 0x2669; 47349 t.qubuts = 0x05bb; 47350 t.qubuts18 = 0x05bb; 47351 t.qubuts25 = 0x05bb; 47352 t.qubuts31 = 0x05bb; 47353 t.qubutshebrew = 0x05bb; 47354 t.qubutsnarrowhebrew = 0x05bb; 47355 t.qubutsquarterhebrew = 0x05bb; 47356 t.qubutswidehebrew = 0x05bb; 47357 t.question = 0x003f; 47358 t.questionarabic = 0x061f; 47359 t.questionarmenian = 0x055e; 47360 t.questiondown = 0x00bf; 47361 t.questiondownsmall = 0xf7bf; 47362 t.questiongreek = 0x037e; 47363 t.questionmonospace = 0xff1f; 47364 t.questionsmall = 0xf73f; 47365 t.quotedbl = 0x0022; 47366 t.quotedblbase = 0x201e; 47367 t.quotedblleft = 0x201c; 47368 t.quotedblmonospace = 0xff02; 47369 t.quotedblprime = 0x301e; 47370 t.quotedblprimereversed = 0x301d; 47371 t.quotedblright = 0x201d; 47372 t.quoteleft = 0x2018; 47373 t.quoteleftreversed = 0x201b; 47374 t.quotereversed = 0x201b; 47375 t.quoteright = 0x2019; 47376 t.quoterightn = 0x0149; 47377 t.quotesinglbase = 0x201a; 47378 t.quotesingle = 0x0027; 47379 t.quotesinglemonospace = 0xff07; 47380 t.r = 0x0072; 47381 t.raarmenian = 0x057c; 47382 t.rabengali = 0x09b0; 47383 t.racute = 0x0155; 47384 t.radeva = 0x0930; 47385 t.radical = 0x221a; 47386 t.radicalex = 0xf8e5; 47387 t.radoverssquare = 0x33ae; 47388 t.radoverssquaredsquare = 0x33af; 47389 t.radsquare = 0x33ad; 47390 t.rafe = 0x05bf; 47391 t.rafehebrew = 0x05bf; 47392 t.ragujarati = 0x0ab0; 47393 t.ragurmukhi = 0x0a30; 47394 t.rahiragana = 0x3089; 47395 t.rakatakana = 0x30e9; 47396 t.rakatakanahalfwidth = 0xff97; 47397 t.ralowerdiagonalbengali = 0x09f1; 47398 t.ramiddlediagonalbengali = 0x09f0; 47399 t.ramshorn = 0x0264; 47400 t.ratio = 0x2236; 47401 t.rbopomofo = 0x3116; 47402 t.rcaron = 0x0159; 47403 t.rcedilla = 0x0157; 47404 t.rcircle = 0x24e1; 47405 t.rcommaaccent = 0x0157; 47406 t.rdblgrave = 0x0211; 47407 t.rdotaccent = 0x1e59; 47408 t.rdotbelow = 0x1e5b; 47409 t.rdotbelowmacron = 0x1e5d; 47410 t.referencemark = 0x203b; 47411 t.reflexsubset = 0x2286; 47412 t.reflexsuperset = 0x2287; 47413 t.registered = 0x00ae; 47414 t.registersans = 0xf8e8; 47415 t.registerserif = 0xf6da; 47416 t.reharabic = 0x0631; 47417 t.reharmenian = 0x0580; 47418 t.rehfinalarabic = 0xfeae; 47419 t.rehiragana = 0x308c; 47420 t.rekatakana = 0x30ec; 47421 t.rekatakanahalfwidth = 0xff9a; 47422 t.resh = 0x05e8; 47423 t.reshdageshhebrew = 0xfb48; 47424 t.reshhebrew = 0x05e8; 47425 t.reversedtilde = 0x223d; 47426 t.reviahebrew = 0x0597; 47427 t.reviamugrashhebrew = 0x0597; 47428 t.revlogicalnot = 0x2310;
47429 t.rfishhook = 0x027e; 47430 t.rfishhookreversed = 0x027f; 47431 t.rhabengali = 0x09dd; 47432 t.rhadeva = 0x095d; 47433 t.rho = 0x03c1; 47434 t.rhook = 0x027d; 47435 t.rhookturned = 0x027b; 47436 t.rhookturnedsuperior = 0x02b5; 47437 t.rhosymbolgreek = 0x03f1; 47438 t.rhotichookmod = 0x02de; 47439 t.rieulacirclekorean = 0x3271; 47440 t.rieulaparenkorean = 0x3211; 47441 t.rieulcirclekorean = 0x3263; 47442 t.rieulhieuhkorean = 0x3140; 47443 t.rieulkiyeokkorean = 0x313a; 47444 t.rieulkiyeoksioskorean = 0x3169; 47445 t.rieulkorean = 0x3139; 47446 t.rieulmieumkorean = 0x313b; 47447 t.rieulpansioskorean = 0x316c; 47448 t.rieulparenkorean = 0x3203; 47449 t.rieulphieuphkorean = 0x313f; 47450 t.rieulpieupkorean = 0x313c; 47451 t.rieulpieupsioskorean = 0x316b; 47452 t.rieulsioskorean = 0x313d; 47453 t.rieulthieuthkorean = 0x313e; 47454 t.rieultikeutkorean = 0x316a; 47455 t.rieulyeorinhieuhkorean = 0x316d; 47456 t.rightangle = 0x221f; 47457 t.righttackbelowcmb = 0x0319; 47458 t.righttriangle = 0x22bf; 47459 t.rihiragana = 0x308a; 47460 t.rikatakana = 0x30ea; 47461 t.rikatakanahalfwidth = 0xff98; 47462 t.ring = 0x02da; 47463 t.ringbelowcmb = 0x0325; 47464 t.ringcmb = 0x030a; 47465 t.ringhalfleft = 0x02bf; 47466 t.ringhalfleftarmenian = 0x0559; 47467 t.ringhalfleftbelowcmb = 0x031c; 47468 t.ringhalfleftcentered = 0x02d3; 47469 t.ringhalfright = 0x02be; 47470 t.ringhalfrightbelowcmb = 0x0339; 47471 t.ringhalfrightcentered = 0x02d2; 47472 t.rinvertedbreve = 0x0213; 47473 t.rittorusquare = 0x3351; 47474 t.rlinebelow = 0x1e5f; 47475 t.rlongleg = 0x027c; 47476 t.rlonglegturned = 0x027a; 47477 t.rmonospace = 0xff52; 47478 t.rohiragana = 0x308d; 47479 t.rokatakana = 0x30ed; 47480 t.rokatakanahalfwidth = 0xff9b; 47481 t.roruathai = 0x0e23; 47482 t.rparen = 0x24ad; 47483 t.rrabengali = 0x09dc; 47484 t.rradeva = 0x0931; 47485 t.rragurmukhi = 0x0a5c; 47486 t.rreharabic = 0x0691; 47487 t.rrehfinalarabic = 0xfb8d; 47488 t.rrvocalicbengali = 0x09e0; 47489 t.rrvocalicdeva = 0x0960; 47490 t.rrvocalicgujarati = 0x0ae0; 47491 t.rrvocalicvowelsignbengali = 0x09c4; 47492 t.rrvocalicvowelsigndeva = 0x0944; 47493 t.rrvocalicvowelsigngujarati = 0x0ac4; 47494 t.rsuperior = 0xf6f1; 47495 t.rtblock = 0x2590; 47496 t.rturned = 0x0279; 47497 t.rturnedsuperior = 0x02b4; 47498 t.ruhiragana = 0x308b; 47499 t.rukatakana = 0x30eb; 47500 t.rukatakanahalfwidth = 0xff99; 47501 t.rupeemarkbengali = 0x09f2; 47502 t.rupeesignbengali = 0x09f3; 47503 t.rupiah = 0xf6dd; 47504 t.ruthai = 0x0e24; 47505 t.rvocalicbengali = 0x098b; 47506 t.rvocalicdeva = 0x090b; 47507 t.rvocalicgujarati = 0x0a8b; 47508 t.rvocalicvowelsignbengali = 0x09c3; 47509 t.rvocalicvowelsigndeva = 0x0943; 47510 t.rvocalicvowelsigngujarati = 0x0ac3; 47511 t.s = 0x0073; 47512 t.sabengali = 0x09b8; 47513 t.sacute = 0x015b; 47514 t.sacutedotaccent = 0x1e65; 47515 t.sadarabic = 0x0635; 47516 t.sadeva = 0x0938; 47517 t.sadfinalarabic = 0xfeba; 47518 t.sadinitialarabic = 0xfebb; 47519 t.sadmedialarabic = 0xfebc; 47520 t.sagujarati = 0x0ab8; 47521 t.sagurmukhi = 0x0a38; 47522 t.sahiragana = 0x3055; 47523 t.sakatakana = 0x30b5; 47524 t.sakatakanahalfwidth = 0xff7b; 47525 t.sallallahoualayhewasallamarabic = 0xfdfa; 47526 t.samekh = 0x05e1; 47527 t.samekhdagesh = 0xfb41; 47528 t.samekhdageshhebrew = 0xfb41; 47529 t.samekhhebrew = 0x05e1; 47530 t.saraaathai = 0x0e32; 47531 t.saraaethai = 0x0e41; 47532 t.saraaimaimalaithai = 0x0e44; 47533 t.saraaimaimuanthai = 0x0e43; 47534 t.saraamthai = 0x0e33; 47535 t.saraathai = 0x0e30; 47536 t.saraethai = 0x0e40; 47537 t.saraiileftthai = 0xf886; 47538 t.saraiithai = 0x0e35; 47539 t.saraileftthai = 0xf885; 47540 t.saraithai = 0x0e34; 47541 t.saraothai = 0x0e42; 47542 t.saraueeleftthai = 0xf888; 47543 t.saraueethai = 0x0e37; 47544 t.saraueleftthai = 0xf887; 47545 t.sarauethai = 0x0e36; 47546 t.sarauthai = 0x0e38; 47547 t.sarauuthai = 0x0e39; 47548 t.sbopomofo = 0x3119; 47549 t.scaron = 0x0161; 47550 t.scarondotaccent = 0x1e67; 47551 t.scedilla = 0x015f; 47552 t.schwa = 0x0259; 47553 t.schwacyrillic = 0x04d9; 47554 t.schwadieresiscyrillic = 0x04db; 47555 t.schwahook = 0x025a; 47556 t.scircle = 0x24e2; 47557 t.scircumflex = 0x015d; 47558 t.scommaaccent = 0x0219; 47559 t.sdotaccent = 0x1e61; 47560 t.sdotbelow = 0x1e63; 47561 t.sdotbelowdotaccent = 0x1e69; 47562 t.seagullbelowcmb = 0x033c; 47563 t.second = 0x2033; 47564 t.secondtonechinese = 0x02ca; 47565 t.section = 0x00a7; 47566 t.seenarabic = 0x0633; 47567 t.seenfinalarabic = 0xfeb2; 47568 t.seeninitialarabic = 0xfeb3; 47569 t.seenmedialarabic = 0xfeb4; 47570 t.segol = 0x05b6; 47571 t.segol13 = 0x05b6; 47572 t.segol1f = 0x05b6; 47573 t.segol2c = 0x05b6; 47574 t.segolhebrew = 0x05b6; 47575 t.segolnarrowhebrew = 0x05b6; 47576 t.segolquarterhebrew = 0x05b6; 47577 t.segoltahebrew = 0x0592; 47578 t.segolwidehebrew = 0x05b6; 47579 t.seharmenian = 0x057d; 47580 t.sehiragana = 0x305b; 47581 t.sekatakana = 0x30bb; 47582 t.sekatakanahalfwidth = 0xff7e; 47583 t.semicolon = 0x003b; 47584 t.semicolonarabic = 0x061b; 47585 t.semicolonmonospace = 0xff1b; 47586 t.semicolonsmall = 0xfe54; 47587 t.semivoicedmarkkana = 0x309c; 47588 t.semivoicedmarkkanahalfwidth = 0xff9f; 47589 t.sentisquare = 0x3322; 47590 t.sentosquare = 0x3323; 47591 t.seven = 0x0037; 47592 t.sevenarabic = 0x0667; 47593 t.sevenbengali = 0x09ed; 47594 t.sevencircle = 0x2466; 47595 t.sevencircleinversesansserif = 0x2790; 47596 t.sevendeva = 0x096d; 47597 t.seveneighths = 0x215e; 47598 t.sevengujarati = 0x0aed; 47599 t.sevengurmukhi = 0x0a6d; 47600 t.sevenhackarabic = 0x0667; 47601 t.sevenhangzhou = 0x3027; 47602 t.sevenideographicparen = 0x3226; 47603 t.seveninferior = 0x2087; 47604 t.sevenmonospace = 0xff17; 47605 t.sevenoldstyle = 0xf737; 47606 t.sevenparen = 0x247a; 47607 t.sevenperiod = 0x248e; 47608 t.sevenpersian = 0x06f7; 47609 t.sevenroman = 0x2176; 47610 t.sevensuperior = 0x2077; 47611 t.seventeencircle = 0x2470; 47612 t.seventeenparen = 0x2484; 47613 t.seventeenperiod = 0x2498; 47614 t.seventhai = 0x0e57;
47615 t.sfthyphen = 0x00ad; 47616 t.shaarmenian = 0x0577; 47617 t.shabengali = 0x09b6; 47618 t.shacyrillic = 0x0448; 47619 t.shaddaarabic = 0x0651; 47620 t.shaddadammaarabic = 0xfc61; 47621 t.shaddadammatanarabic = 0xfc5e; 47622 t.shaddafathaarabic = 0xfc60; 47623 t.shaddakasraarabic = 0xfc62; 47624 t.shaddakasratanarabic = 0xfc5f; 47625 t.shade = 0x2592; 47626 t.shadedark = 0x2593; 47627 t.shadelight = 0x2591; 47628 t.shademedium = 0x2592; 47629 t.shadeva = 0x0936; 47630 t.shagujarati = 0x0ab6; 47631 t.shagurmukhi = 0x0a36; 47632 t.shalshelethebrew = 0x0593; 47633 t.shbopomofo = 0x3115; 47634 t.shchacyrillic = 0x0449; 47635 t.sheenarabic = 0x0634; 47636 t.sheenfinalarabic = 0xfeb6; 47637 t.sheeninitialarabic = 0xfeb7; 47638 t.sheenmedialarabic = 0xfeb8; 47639 t.sheicoptic = 0x03e3; 47640 t.sheqel = 0x20aa; 47641 t.sheqelhebrew = 0x20aa; 47642 t.sheva = 0x05b0; 47643 t.sheva115 = 0x05b0; 47644 t.sheva15 = 0x05b0; 47645 t.sheva22 = 0x05b0; 47646 t.sheva2e = 0x05b0; 47647 t.shevahebrew = 0x05b0; 47648 t.shevanarrowhebrew = 0x05b0; 47649 t.shevaquarterhebrew = 0x05b0; 47650 t.shevawidehebrew = 0x05b0; 47651 t.shhacyrillic = 0x04bb; 47652 t.shimacoptic = 0x03ed; 47653 t.shin = 0x05e9; 47654 t.shindagesh = 0xfb49; 47655 t.shindageshhebrew = 0xfb49; 47656 t.shindageshshindot = 0xfb2c; 47657 t.shindageshshindothebrew = 0xfb2c; 47658 t.shindageshsindot = 0xfb2d; 47659 t.shindageshsindothebrew = 0xfb2d; 47660 t.shindothebrew = 0x05c1; 47661 t.shinhebrew = 0x05e9; 47662 t.shinshindot = 0xfb2a; 47663 t.shinshindothebrew = 0xfb2a; 47664 t.shinsindot = 0xfb2b; 47665 t.shinsindothebrew = 0xfb2b; 47666 t.shook = 0x0282; 47667 t.sigma = 0x03c3; 47668 t.sigma1 = 0x03c2; 47669 t.sigmafinal = 0x03c2; 47670 t.sigmalunatesymbolgreek = 0x03f2; 47671 t.sihiragana = 0x3057; 47672 t.sikatakana = 0x30b7; 47673 t.sikatakanahalfwidth = 0xff7c; 47674 t.siluqhebrew = 0x05bd; 47675 t.siluqlefthebrew = 0x05bd; 47676 t.similar = 0x223c; 47677 t.sindothebrew = 0x05c2; 47678 t.siosacirclekorean = 0x3274; 47679 t.siosaparenkorean = 0x3214; 47680 t.sioscieuckorean = 0x317e; 47681 t.sioscirclekorean = 0x3266; 47682 t.sioskiyeokkorean = 0x317a; 47683 t.sioskorean = 0x3145; 47684 t.siosnieunkorean = 0x317b; 47685 t.siosparenkorean = 0x3206; 47686 t.siospieupkorean = 0x317d; 47687 t.siostikeutkorean = 0x317c; 47688 t.six = 0x0036; 47689 t.sixarabic = 0x0666; 47690 t.sixbengali = 0x09ec; 47691 t.sixcircle = 0x2465; 47692 t.sixcircleinversesansserif = 0x278f; 47693 t.sixdeva = 0x096c; 47694 t.sixgujarati = 0x0aec; 47695 t.sixgurmukhi = 0x0a6c; 47696 t.sixhackarabic = 0x0666; 47697 t.sixhangzhou = 0x3026; 47698 t.sixideographicparen = 0x3225; 47699 t.sixinferior = 0x2086; 47700 t.sixmonospace = 0xff16; 47701 t.sixoldstyle = 0xf736; 47702 t.sixparen = 0x2479; 47703 t.sixperiod = 0x248d; 47704 t.sixpersian = 0x06f6; 47705 t.sixroman = 0x2175; 47706 t.sixsuperior = 0x2076; 47707 t.sixteencircle = 0x246f; 47708 t.sixteencurrencydenominatorbengali = 0x09f9; 47709 t.sixteenparen = 0x2483; 47710 t.sixteenperiod = 0x2497; 47711 t.sixthai = 0x0e56; 47712 t.slash = 0x002f; 47713 t.slashmonospace = 0xff0f; 47714 t.slong = 0x017f; 47715 t.slongdotaccent = 0x1e9b; 47716 t.smileface = 0x263a; 47717 t.smonospace = 0xff53; 47718 t.sofpasuqhebrew = 0x05c3; 47719 t.softhyphen = 0x00ad; 47720 t.softsigncyrillic = 0x044c; 47721 t.sohiragana = 0x305d; 47722 t.sokatakana = 0x30bd; 47723 t.sokatakanahalfwidth = 0xff7f; 47724 t.soliduslongoverlaycmb = 0x0338; 47725 t.solidusshortoverlaycmb = 0x0337; 47726 t.sorusithai = 0x0e29; 47727 t.sosalathai = 0x0e28; 47728 t.sosothai = 0x0e0b; 47729 t.sosuathai = 0x0e2a; 47730 t.space = 0x0020; 47731 t.spacehackarabic = 0x0020; 47732 t.spade = 0x2660; 47733 t.spadesuitblack = 0x2660; 47734 t.spadesuitwhite = 0x2664; 47735 t.sparen = 0x24ae; 47736 t.squarebelowcmb = 0x033b; 47737 t.squarecc = 0x33c4; 47738 t.squarecm = 0x339d; 47739 t.squarediagonalcrosshatchfill = 0x25a9; 47740 t.squarehorizontalfill = 0x25a4; 47741 t.squarekg = 0x338f; 47742 t.squarekm = 0x339e; 47743 t.squarekmcapital = 0x33ce; 47744 t.squareln = 0x33d1; 47745 t.squarelog = 0x33d2; 47746 t.squaremg = 0x338e; 47747 t.squaremil = 0x33d5; 47748 t.squaremm = 0x339c; 47749 t.squaremsquared = 0x33a1; 47750 t.squareorthogonalcrosshatchfill = 0x25a6; 47751 t.squareupperlefttolowerrightfill = 0x25a7; 47752 t.squareupperrighttolowerleftfill = 0x25a8; 47753 t.squareverticalfill = 0x25a5; 47754 t.squarewhitewithsmallblack = 0x25a3; 47755 t.srsquare = 0x33db; 47756 t.ssabengali = 0x09b7; 47757 t.ssadeva = 0x0937; 47758 t.ssagujarati = 0x0ab7; 47759 t.ssangcieuckorean = 0x3149; 47760 t.ssanghieuhkorean = 0x3185; 47761 t.ssangieungkorean = 0x3180; 47762 t.ssangkiyeokkorean = 0x3132; 47763 t.ssangnieunkorean = 0x3165; 47764 t.ssangpieupkorean = 0x3143; 47765 t.ssangsioskorean = 0x3146; 47766 t.ssangtikeutkorean = 0x3138; 47767 t.ssuperior = 0xf6f2; 47768 t.sterling = 0x00a3; 47769 t.sterlingmonospace = 0xffe1; 47770 t.strokelongoverlaycmb = 0x0336; 47771 t.strokeshortoverlaycmb = 0x0335; 47772 t.subset = 0x2282; 47773 t.subsetnotequal = 0x228a; 47774 t.subsetorequal = 0x2286; 47775 t.succeeds = 0x227b; 47776 t.suchthat = 0x220b; 47777 t.suhiragana = 0x3059; 47778 t.sukatakana = 0x30b9; 47779 t.sukatakanahalfwidth = 0xff7d; 47780 t.sukunarabic = 0x0652; 47781 t.summation = 0x2211; 47782 t.sun = 0x263c; 47783 t.superset = 0x2283; 47784 t.supersetnotequal = 0x228b; 47785 t.supersetorequal = 0x2287; 47786 t.svsquare = 0x33dc; 47787 t.syouwaerasquare = 0x337c; 47788 t.t = 0x0074; 47789 t.tabengali = 0x09a4; 47790 t.tackdown = 0x22a4; 47791 t.tackleft = 0x22a3; 47792 t.tadeva = 0x0924; 47793 t.tagujarati = 0x0aa4; 47794 t.tagurmukhi = 0x0a24; 47795 t.taharabic = 0x0637; 47796 t.tahfinalarabic = 0xfec2; 47797 t.tahinitialarabic = 0xfec3; 47798 t.tahiragana = 0x305f; 47799 t.tahmedialarabic = 0xfec4; 47800 t.taisyouerasquare = 0x337d; 47801 t.takatakana = 0x30bf; 47802 t.takatakanahalfwidth = 0xff80; 47803 t.tatweelarabic = 0x0640; 47804 t.tau = 0x03c4; 47805 t.tav = 0x05ea; 47806 t.tavdages = 0xfb4a; 47807 t.tavdagesh = 0xfb4a; 47808 t.tavdageshhebrew = 0xfb4a; 47809 t.tavhebrew = 0x05ea; 47810 t.tbar = 0x0167; 47811 t.tbopomofo = 0x310a; 47812 t.tcaron = 0x0165; 47813 t.tccurl = 0x02a8; 47814 t.tcedilla = 0x0163; 47815 t.tcheharabic = 0x0686; 47816 t.tchehfinalarabic = 0xfb7b; 47817 t.tchehinitialarabic = 0xfb7c; 47818 t.tchehmedialarabic = 0xfb7d; 47819 t.tcircle = 0x24e3; 47820 t.tcircumflexbelow = 0x1e71; 47821 t.tcommaaccent = 0x0163; 47822 t.tdieresis = 0x1e97; 47823 t.tdotaccent = 0x1e6b; 47824 t.tdotbelow = 0x1e6d; 47825 t.tecyrillic = 0x0442; 47826 t.tedescendercyrillic = 0x04ad; 47827 t.teharabic = 0x062a; 47828 t.tehfinalarabic = 0xfe96; 47829 t.tehhahinitialarabic = 0xfca2; 47830 t.tehhahisolatedarabic = 0xfc0c; 47831 t.tehinitialarabic = 0xfe97; 47832 t.tehiragana = 0x3066; 47833 t.tehjeeminitialarabic = 0xfca1; 47834 t.tehjeemisolatedarabic = 0xfc0b; 47835 t.tehmarbutaarabic = 0x0629; 47836 t.tehmarbutafinalarabic = 0xfe94; 47837 t.tehmedialarabic = 0xfe98; 47838 t.tehmeeminitialarabic = 0xfca4; 47839 t.tehmeemisolatedarabic = 0xfc0e; 47840 t.tehnoonfinalarabic = 0xfc73; 47841 t.tekatakana = 0x30c6; 47842 t.tekatakanahalfwidth = 0xff83; 47843 t.telephone = 0x2121; 47844 t.telephoneblack = 0x260e; 47845 t.telishagedolahebrew = 0x05a0; 47846 t.telishaqetanahebrew = 0x05a9; 47847 t.tencircle = 0x2469; 47848 t.tenideographicparen = 0x3229; 47849 t.tenparen = 0x247d; 47850 t.tenperiod = 0x2491; 47851 t.tenroman = 0x2179; 47852 t.tesh = 0x02a7; 47853 t.tet = 0x05d8; 47854 t.tetdagesh = 0xfb38; 47855 t.tetdageshhebrew = 0xfb38; 47856 t.tethebrew = 0x05d8; 47857 t.tetsecyrillic = 0x04b5; 47858 t.tevirhebrew = 0x059b; 47859 t.tevirlefthebrew = 0x059b; 47860 t.thabengali = 0x09a5; 47861 t.thadeva = 0x0925; 47862 t.thagujarati = 0x0aa5; 47863 t.thagurmukhi = 0x0a25; 47864 t.thalarabic = 0x0630; 47865 t.thalfinalarabic = 0xfeac; 47866 t.thanthakhatlowleftthai = 0xf898; 47867 t.thanthakhatlowrightthai = 0xf897; 47868 t.thanthakhatthai = 0x0e4c; 47869 t.thanthakhatupperleftthai = 0xf896; 47870 t.theharabic = 0x062b; 47871 t.thehfinalarabic = 0xfe9a; 47872 t.thehinitialarabic = 0xfe9b; 47873 t.thehmedialarabic = 0xfe9c; 47874 t.thereexists = 0x2203; 47875 t.therefore = 0x2234; 47876 t.theta = 0x03b8; 47877 t.theta1 = 0x03d1; 47878 t.thetasymbolgreek = 0x03d1; 47879 t.thieuthacirclekorean = 0x3279; 47880 t.thieuthaparenkorean = 0x3219; 47881 t.thieuthcirclekorean = 0x326b; 47882 t.thieuthkorean = 0x314c; 47883 t.thieuthparenkorean = 0x320b; 47884 t.thirteencircle = 0x246c; 47885 t.thirteenparen = 0x2480; 47886 t.thirteenperiod = 0x2494; 47887 t.thonangmonthothai = 0x0e11; 47888 t.thook = 0x01ad; 47889 t.thophuthaothai = 0x0e12; 47890 t.thorn = 0x00fe; 47891 t.thothahanthai = 0x0e17; 47892 t.thothanthai = 0x0e10; 47893 t.thothongthai = 0x0e18; 47894 t.thothungthai = 0x0e16; 47895 t.thousandcyrillic = 0x0482; 47896 t.thousandsseparatorarabic = 0x066c; 47897 t.thousandsseparatorpersian = 0x066c; 47898 t.three = 0x0033; 47899 t.threearabic = 0x0663; 47900 t.threebengali = 0x09e9; 47901 t.threecircle = 0x2462; 47902 t.threecircleinversesansserif = 0x278c; 47903 t.threedeva = 0x0969; 47904 t.threeeighths = 0x215c; 47905 t.threegujarati = 0x0ae9; 47906 t.threegurmukhi = 0x0a69; 47907 t.threehackarabic = 0x0663; 47908 t.threehangzhou = 0x3023; 47909 t.threeideographicparen = 0x3222; 47910 t.threeinferior = 0x2083; 47911 t.threemonospace = 0xff13; 47912 t.threenumeratorbengali = 0x09f6; 47913 t.threeoldstyle = 0xf733; 47914 t.threeparen = 0x2476; 47915 t.threeperiod = 0x248a; 47916 t.threepersian = 0x06f3; 47917 t.threequarters = 0x00be; 47918 t.threequartersemdash = 0xf6de; 47919 t.threeroman = 0x2172; 47920 t.threesuperior = 0x00b3; 47921 t.threethai = 0x0e53; 47922 t.thzsquare = 0x3394; 47923 t.tihiragana = 0x3061; 47924 t.tikatakana = 0x30c1; 47925 t.tikatakanahalfwidth = 0xff81; 47926 t.tikeutacirclekorean = 0x3270; 47927 t.tikeutaparenkorean = 0x3210; 47928 t.tikeutcirclekorean = 0x3262; 47929 t.tikeutkorean = 0x3137; 47930 t.tikeutparenkorean = 0x3202; 47931 t.tilde = 0x02dc; 47932 t.tildebelowcmb = 0x0330; 47933 t.tildecmb = 0x0303; 47934 t.tildecomb = 0x0303; 47935 t.tildedoublecmb = 0x0360; 47936 t.tildeoperator = 0x223c; 47937 t.tildeoverlaycmb = 0x0334; 47938 t.tildeverticalcmb = 0x033e; 47939 t.timescircle = 0x2297; 47940 t.tipehahebrew = 0x0596; 47941 t.tipehalefthebrew = 0x0596; 47942 t.tippigurmukhi = 0x0a70; 47943 t.titlocyrilliccmb = 0x0483; 47944 t.tiwnarmenian = 0x057f; 47945 t.tlinebelow = 0x1e6f; 47946 t.tmonospace = 0xff54; 47947 t.toarmenian = 0x0569; 47948 t.tohiragana = 0x3068; 47949 t.tokatakana = 0x30c8; 47950 t.tokatakanahalfwidth = 0xff84; 47951 t.tonebarextrahighmod = 0x02e5; 47952 t.tonebarextralowmod = 0x02e9; 47953 t.tonebarhighmod = 0x02e6; 47954 t.tonebarlowmod = 0x02e8; 47955 t.tonebarmidmod = 0x02e7; 47956 t.tonefive = 0x01bd; 47957 t.tonesix = 0x0185; 47958 t.tonetwo = 0x01a8;
47959 t.tonos = 0x0384; 47960 t.tonsquare = 0x3327; 47961 t.topatakthai = 0x0e0f; 47962 t.tortoiseshellbracketleft = 0x3014; 47963 t.tortoiseshellbracketleftsmall = 0xfe5d; 47964 t.tortoiseshellbracketleftvertical = 0xfe39; 47965 t.tortoiseshellbracketright = 0x3015; 47966 t.tortoiseshellbracketrightsmall = 0xfe5e; 47967 t.tortoiseshellbracketrightvertical = 0xfe3a; 47968 t.totaothai = 0x0e15; 47969 t.tpalatalhook = 0x01ab; 47970 t.tparen = 0x24af; 47971 t.trademark = 0x2122; 47972 t.trademarksans = 0xf8ea; 47973 t.trademarkserif = 0xf6db; 47974 t.tretroflexhook = 0x0288; 47975 t.triagdn = 0x25bc; 47976 t.triaglf = 0x25c4; 47977 t.triagrt = 0x25ba; 47978 t.triagup = 0x25b2; 47979 t.ts = 0x02a6; 47980 t.tsadi = 0x05e6; 47981 t.tsadidagesh = 0xfb46; 47982 t.tsadidageshhebrew = 0xfb46; 47983 t.tsadihebrew = 0x05e6; 47984 t.tsecyrillic = 0x0446; 47985 t.tsere = 0x05b5; 47986 t.tsere12 = 0x05b5; 47987 t.tsere1e = 0x05b5; 47988 t.tsere2b = 0x05b5; 47989 t.tserehebrew = 0x05b5; 47990 t.tserenarrowhebrew = 0x05b5; 47991 t.tserequarterhebrew = 0x05b5; 47992 t.tserewidehebrew = 0x05b5; 47993 t.tshecyrillic = 0x045b; 47994 t.tsuperior = 0xf6f3; 47995 t.ttabengali = 0x099f; 47996 t.ttadeva = 0x091f; 47997 t.ttagujarati = 0x0a9f; 47998 t.ttagurmukhi = 0x0a1f; 47999 t.tteharabic = 0x0679; 48000 t.ttehfinalarabic = 0xfb67; 48001 t.ttehinitialarabic = 0xfb68; 48002 t.ttehmedialarabic = 0xfb69; 48003 t.tthabengali = 0x09a0; 48004 t.tthadeva = 0x0920; 48005 t.tthagujarati = 0x0aa0; 48006 t.tthagurmukhi = 0x0a20; 48007 t.tturned = 0x0287; 48008 t.tuhiragana = 0x3064; 48009 t.tukatakana = 0x30c4; 48010 t.tukatakanahalfwidth = 0xff82; 48011 t.tusmallhiragana = 0x3063; 48012 t.tusmallkatakana = 0x30c3; 48013 t.tusmallkatakanahalfwidth = 0xff6f; 48014 t.twelvecircle = 0x246b; 48015 t.twelveparen = 0x247f; 48016 t.twelveperiod = 0x2493; 48017 t.twelveroman = 0x217b; 48018 t.twentycircle = 0x2473; 48019 t.twentyhangzhou = 0x5344; 48020 t.twentyparen = 0x2487; 48021 t.twentyperiod = 0x249b; 48022 t.two = 0x0032; 48023 t.twoarabic = 0x0662; 48024 t.twobengali = 0x09e8; 48025 t.twocircle = 0x2461; 48026 t.twocircleinversesansserif = 0x278b; 48027 t.twodeva = 0x0968; 48028 t.twodotenleader = 0x2025; 48029 t.twodotleader = 0x2025; 48030 t.twodotleadervertical = 0xfe30; 48031 t.twogujarati = 0x0ae8; 48032 t.twogurmukhi = 0x0a68; 48033 t.twohackarabic = 0x0662; 48034 t.twohangzhou = 0x3022; 48035 t.twoideographicparen = 0x3221; 48036 t.twoinferior = 0x2082; 48037 t.twomonospace = 0xff12; 48038 t.twonumeratorbengali = 0x09f5; 48039 t.twooldstyle = 0xf732; 48040 t.twoparen = 0x2475; 48041 t.twoperiod = 0x2489; 48042 t.twopersian = 0x06f2; 48043 t.tworoman = 0x2171; 48044 t.twostroke = 0x01bb; 48045 t.twosuperior = 0x00b2; 48046 t.twothai = 0x0e52; 48047 t.twothirds = 0x2154; 48048 t.u = 0x0075; 48049 t.uacute = 0x00fa; 48050 t.ubar = 0x0289; 48051 t.ubengali = 0x0989; 48052 t.ubopomofo = 0x3128; 48053 t.ubreve = 0x016d; 48054 t.ucaron = 0x01d4; 48055 t.ucircle = 0x24e4; 48056 t.ucircumflex = 0x00fb; 48057 t.ucircumflexbelow = 0x1e77; 48058 t.ucyrillic = 0x0443; 48059 t.udattadeva = 0x0951; 48060 t.udblacute = 0x0171; 48061 t.udblgrave = 0x0215; 48062 t.udeva = 0x0909; 48063 t.udieresis = 0x00fc; 48064 t.udieresisacute = 0x01d8; 48065 t.udieresisbelow = 0x1e73; 48066 t.udieresiscaron = 0x01da; 48067 t.udieresiscyrillic = 0x04f1; 48068 t.udieresisgrave = 0x01dc; 48069 t.udieresismacron = 0x01d6; 48070 t.udotbelow = 0x1ee5; 48071 t.ugrave = 0x00f9; 48072 t.ugujarati = 0x0a89; 48073 t.ugurmukhi = 0x0a09; 48074 t.uhiragana = 0x3046; 48075 t.uhookabove = 0x1ee7; 48076 t.uhorn = 0x01b0; 48077 t.uhornacute = 0x1ee9; 48078 t.uhorndotbelow = 0x1ef1; 48079 t.uhorngrave = 0x1eeb; 48080 t.uhornhookabove = 0x1eed; 48081 t.uhorntilde = 0x1eef; 48082 t.uhungarumlaut = 0x0171; 48083 t.uhungarumlautcyrillic = 0x04f3; 48084 t.uinvertedbreve = 0x0217; 48085 t.ukatakana = 0x30a6; 48086 t.ukatakanahalfwidth = 0xff73; 48087 t.ukcyrillic = 0x0479; 48088 t.ukorean = 0x315c; 48089 t.umacron = 0x016b; 48090 t.umacroncyrillic = 0x04ef; 48091 t.umacrondieresis = 0x1e7b; 48092 t.umatragurmukhi = 0x0a41; 48093 t.umonospace = 0xff55; 48094 t.underscore = 0x005f; 48095 t.underscoredbl = 0x2017; 48096 t.underscoremonospace = 0xff3f; 48097 t.underscorevertical = 0xfe33; 48098 t.underscorewavy = 0xfe4f; 48099 t.union = 0x222a; 48100 t.universal = 0x2200; 48101 t.uogonek = 0x0173; 48102 t.uparen = 0x24b0; 48103 t.upblock = 0x2580; 48104 t.upperdothebrew = 0x05c4; 48105 t.upsilon = 0x03c5; 48106 t.upsilondieresis = 0x03cb; 48107 t.upsilondieresistonos = 0x03b0; 48108 t.upsilonlatin = 0x028a; 48109 t.upsilontonos = 0x03cd; 48110 t.uptackbelowcmb = 0x031d; 48111 t.uptackmod = 0x02d4; 48112 t.uragurmukhi = 0x0a73; 48113 t.uring = 0x016f; 48114 t.ushortcyrillic = 0x045e; 48115 t.usmallhiragana = 0x3045; 48116 t.usmallkatakana = 0x30a5; 48117 t.usmallkatakanahalfwidth = 0xff69; 48118 t.ustraightcyrillic = 0x04af; 48119 t.ustraightstrokecyrillic = 0x04b1; 48120 t.utilde = 0x0169; 48121 t.utildeacute = 0x1e79; 48122 t.utildebelow = 0x1e75; 48123 t.uubengali = 0x098a; 48124 t.uudeva = 0x090a; 48125 t.uugujarati = 0x0a8a; 48126 t.uugurmukhi = 0x0a0a; 48127 t.uumatragurmukhi = 0x0a42; 48128 t.uuvowelsignbengali = 0x09c2; 48129 t.uuvowelsigndeva = 0x0942; 48130 t.uuvowelsigngujarati = 0x0ac2; 48131 t.uvowelsignbengali = 0x09c1; 48132 t.uvowelsigndeva = 0x0941; 48133 t.uvowelsigngujarati = 0x0ac1; 48134 t.v = 0x0076; 48135 t.vadeva = 0x0935; 48136 t.vagujarati = 0x0ab5; 48137 t.vagurmukhi = 0x0a35; 48138 t.vakatakana = 0x30f7; 48139 t.vav = 0x05d5; 48140 t.vavdagesh = 0xfb35; 48141 t.vavdagesh65 = 0xfb35; 48142 t.vavdageshhebrew = 0xfb35; 48143 t.vavhebrew = 0x05d5; 48144 t.vavholam = 0xfb4b; 48145 t.vavholamhebrew = 0xfb4b; 48146 t.vavvavhebrew = 0x05f0; 48147 t.vavyodhebrew = 0x05f1; 48148 t.vcircle = 0x24e5; 48149 t.vdotbelow = 0x1e7f; 48150 t.vecyrillic = 0x0432; 48151 t.veharabic = 0x06a4; 48152 t.vehfinalarabic = 0xfb6b; 48153 t.vehinitialarabic = 0xfb6c; 48154 t.vehmedialarabic = 0xfb6d; 48155 t.vekatakana = 0x30f9; 48156 t.venus = 0x2640; 48157 t.verticalbar = 0x007c; 48158 t.verticallineabovecmb = 0x030d; 48159 t.verticallinebelowcmb = 0x0329; 48160 t.verticallinelowmod = 0x02cc; 48161 t.verticallinemod = 0x02c8; 48162 t.vewarmenian = 0x057e; 48163 t.vhook = 0x028b; 48164 t.vikatakana = 0x30f8; 48165 t.viramabengali = 0x09cd; 48166 t.viramadeva = 0x094d; 48167 t.viramagujarati = 0x0acd; 48168 t.visargabengali = 0x0983; 48169 t.visargadeva = 0x0903; 48170 t.visargagujarati = 0x0a83; 48171 t.vmonospace = 0xff56; 48172 t.voarmenian = 0x0578; 48173 t.voicediterationhiragana = 0x309e; 48174 t.voicediterationkatakana = 0x30fe; 48175 t.voicedmarkkana = 0x309b; 48176 t.voicedmarkkanahalfwidth = 0xff9e; 48177 t.vokatakana = 0x30fa; 48178 t.vparen = 0x24b1; 48179 t.vtilde = 0x1e7d; 48180 t.vturned = 0x028c; 48181 t.vuhiragana = 0x3094; 48182 t.vukatakana = 0x30f4; 48183 t.w = 0x0077; 48184 t.wacute = 0x1e83; 48185 t.waekorean = 0x3159; 48186 t.wahiragana = 0x308f; 48187 t.wakatakana = 0x30ef; 48188 t.wakatakanahalfwidth = 0xff9c; 48189 t.wakorean = 0x3158; 48190 t.wasmallhiragana = 0x308e; 48191 t.wasmallkatakana = 0x30ee; 48192 t.wattosquare = 0x3357; 48193 t.wavedash = 0x301c; 48194 t.wavyunderscorevertical = 0xfe34; 48195 t.wawarabic = 0x0648; 48196 t.wawfinalarabic = 0xfeee; 48197 t.wawhamzaabovearabic = 0x0624; 48198 t.wawhamzaabovefinalarabic = 0xfe86; 48199 t.wbsquare = 0x33dd; 48200 t.wcircle = 0x24e6; 48201 t.wcircumflex = 0x0175; 48202 t.wdieresis = 0x1e85; 48203 t.wdotaccent = 0x1e87; 48204 t.wdotbelow = 0x1e89; 48205 t.wehiragana = 0x3091; 48206 t.weierstrass = 0x2118; 48207 t.wekatakana = 0x30f1; 48208 t.wekorean = 0x315e; 48209 t.weokorean = 0x315d; 48210 t.wgrave = 0x1e81; 48211 t.whitebullet = 0x25e6; 48212 t.whitecircle = 0x25cb; 48213 t.whitecircleinverse = 0x25d9; 48214 t.whitecornerbracketleft = 0x300e; 48215 t.whitecornerbracketleftvertical = 0xfe43; 48216 t.whitecornerbracketright = 0x300f; 48217 t.whitecornerbracketrightvertical = 0xfe44; 48218 t.whitediamond = 0x25c7; 48219 t.whitediamondcontainingblacksmalldiamond = 0x25c8;
48220 t.whitedownpointingsmalltriangle = 0x25bf; 48221 t.whitedownpointingtriangle = 0x25bd; 48222 t.whiteleftpointingsmalltriangle = 0x25c3; 48223 t.whiteleftpointingtriangle = 0x25c1; 48224 t.whitelenticularbracketleft = 0x3016; 48225 t.whitelenticularbracketright = 0x3017; 48226 t.whiterightpointingsmalltriangle = 0x25b9; 48227 t.whiterightpointingtriangle = 0x25b7; 48228 t.whitesmallsquare = 0x25ab; 48229 t.whitesmilingface = 0x263a; 48230 t.whitesquare = 0x25a1; 48231 t.whitestar = 0x2606; 48232 t.whitetelephone = 0x260f; 48233 t.whitetortoiseshellbracketleft = 0x3018; 48234 t.whitetortoiseshellbracketright = 0x3019; 48235 t.whiteuppointingsmalltriangle = 0x25b5; 48236 t.whiteuppointingtriangle = 0x25b3; 48237 t.wihiragana = 0x3090; 48238 t.wikatakana = 0x30f0; 48239 t.wikorean = 0x315f; 48240 t.wmonospace = 0xff57; 48241 t.wohiragana = 0x3092; 48242 t.wokatakana = 0x30f2; 48243 t.wokatakanahalfwidth = 0xff66; 48244 t.won = 0x20a9; 48245 t.wonmonospace = 0xffe6; 48246 t.wowaenthai = 0x0e27; 48247 t.wparen = 0x24b2; 48248 t.wring = 0x1e98; 48249 t.wsuperior = 0x02b7; 48250 t.wturned = 0x028d; 48251 t.wynn = 0x01bf; 48252 t.x = 0x0078; 48253 t.xabovecmb = 0x033d; 48254 t.xbopomofo = 0x3112; 48255 t.xcircle = 0x24e7; 48256 t.xdieresis = 0x1e8d; 48257 t.xdotaccent = 0x1e8b; 48258 t.xeharmenian = 0x056d; 48259 t.xi = 0x03be; 48260 t.xmonospace = 0xff58; 48261 t.xparen = 0x24b3; 48262 t.xsuperior = 0x02e3; 48263 t.y = 0x0079; 48264 t.yaadosquare = 0x334e; 48265 t.yabengali = 0x09af; 48266 t.yacute = 0x00fd; 48267 t.yadeva = 0x092f; 48268 t.yaekorean = 0x3152; 48269 t.yagujarati = 0x0aaf; 48270 t.yagurmukhi = 0x0a2f; 48271 t.yahiragana = 0x3084; 48272 t.yakatakana = 0x30e4; 48273 t.yakatakanahalfwidth = 0xff94; 48274 t.yakorean = 0x3151; 48275 t.yamakkanthai = 0x0e4e; 48276 t.yasmallhiragana = 0x3083; 48277 t.yasmallkatakana = 0x30e3; 48278 t.yasmallkatakanahalfwidth = 0xff6c; 48279 t.yatcyrillic = 0x0463; 48280 t.ycircle = 0x24e8; 48281 t.ycircumflex = 0x0177; 48282 t.ydieresis = 0x00ff; 48283 t.ydotaccent = 0x1e8f; 48284 t.ydotbelow = 0x1ef5; 48285 t.yeharabic = 0x064a; 48286 t.yehbarreearabic = 0x06d2; 48287 t.yehbarreefinalarabic = 0xfbaf; 48288 t.yehfinalarabic = 0xfef2; 48289 t.yehhamzaabovearabic = 0x0626; 48290 t.yehhamzaabovefinalarabic = 0xfe8a; 48291 t.yehhamzaaboveinitialarabic = 0xfe8b; 48292 t.yehhamzaabovemedialarabic = 0xfe8c; 48293 t.yehinitialarabic = 0xfef3; 48294 t.yehmedialarabic = 0xfef4;
48295 t.yehmeeminitialarabic = 0xfcdd; 48296 t.yehmeemisolatedarabic = 0xfc58; 48297 t.yehnoonfinalarabic = 0xfc94; 48298 t.yehthreedotsbelowarabic = 0x06d1; 48299 t.yekorean = 0x3156; 48300 t.yen = 0x00a5; 48301 t.yenmonospace = 0xffe5; 48302 t.yeokorean = 0x3155; 48303 t.yeorinhieuhkorean = 0x3186; 48304 t.yerahbenyomohebrew = 0x05aa; 48305 t.yerahbenyomolefthebrew = 0x05aa; 48306 t.yericyrillic = 0x044b; 48307 t.yerudieresiscyrillic = 0x04f9; 48308 t.yesieungkorean = 0x3181; 48309 t.yesieungpansioskorean = 0x3183; 48310 t.yesieungsioskorean = 0x3182; 48311 t.yetivhebrew = 0x059a; 48312 t.ygrave = 0x1ef3; 48313 t.yhook = 0x01b4; 48314 t.yhookabove = 0x1ef7; 48315 t.yiarmenian = 0x0575; 48316 t.yicyrillic = 0x0457; 48317 t.yikorean = 0x3162; 48318 t.yinyang = 0x262f; 48319 t.yiwnarmenian = 0x0582; 48320 t.ymonospace = 0xff59; 48321 t.yod = 0x05d9; 48322 t.yoddagesh = 0xfb39; 48323 t.yoddageshhebrew = 0xfb39; 48324 t.yodhebrew = 0x05d9; 48325 t.yodyodhebrew = 0x05f2; 48326 t.yodyodpatahhebrew = 0xfb1f; 48327 t.yohiragana = 0x3088; 48328 t.yoikorean = 0x3189; 48329 t.yokatakana = 0x30e8; 48330 t.yokatakanahalfwidth = 0xff96; 48331 t.yokorean = 0x315b; 48332 t.yosmallhiragana = 0x3087; 48333 t.yosmallkatakana = 0x30e7; 48334 t.yosmallkatakanahalfwidth = 0xff6e; 48335 t.yotgreek = 0x03f3; 48336 t.yoyaekorean = 0x3188; 48337 t.yoyakorean = 0x3187; 48338 t.yoyakthai = 0x0e22; 48339 t.yoyingthai = 0x0e0d; 48340 t.yparen = 0x24b4; 48341 t.ypogegrammeni = 0x037a; 48342 t.ypogegrammenigreekcmb = 0x0345; 48343 t.yr = 0x01a6; 48344 t.yring = 0x1e99; 48345 t.ysuperior = 0x02b8; 48346 t.ytilde = 0x1ef9; 48347 t.yturned = 0x028e; 48348 t.yuhiragana = 0x3086; 48349 t.yuikorean = 0x318c; 48350 t.yukatakana = 0x30e6; 48351 t.yukatakanahalfwidth = 0xff95; 48352 t.yukorean = 0x3160; 48353 t.yusbigcyrillic = 0x046b; 48354 t.yusbigiotifiedcyrillic = 0x046d; 48355 t.yuslittlecyrillic = 0x0467; 48356 t.yuslittleiotifiedcyrillic = 0x0469; 48357 t.yusmallhiragana = 0x3085; 48358 t.yusmallkatakana = 0x30e5; 48359 t.yusmallkatakanahalfwidth = 0xff6d; 48360 t.yuyekorean = 0x318b; 48361 t.yuyeokorean = 0x318a; 48362 t.yyabengali = 0x09df; 48363 t.yyadeva = 0x095f; 48364 t.z = 0x007a; 48365 t.zaarmenian = 0x0566; 48366 t.zacute = 0x017a; 48367 t.zadeva = 0x095b; 48368 t.zagurmukhi = 0x0a5b; 48369 t.zaharabic = 0x0638; 48370 t.zahfinalarabic = 0xfec6; 48371 t.zahinitialarabic = 0xfec7; 48372 t.zahiragana = 0x3056;
48373 t.zahmedialarabic = 0xfec8; 48374 t.zainarabic = 0x0632; 48375 t.zainfinalarabic = 0xfeb0; 48376 t.zakatakana = 0x30b6; 48377 t.zaqefgadolhebrew = 0x0595; 48378 t.zaqefqatanhebrew = 0x0594; 48379 t.zarqahebrew = 0x0598; 48380 t.zayin = 0x05d6; 48381 t.zayindagesh = 0xfb36; 48382 t.zayindageshhebrew = 0xfb36; 48383 t.zayinhebrew = 0x05d6; 48384 t.zbopomofo = 0x3117; 48385 t.zcaron = 0x017e; 48386 t.zcircle = 0x24e9; 48387 t.zcircumflex = 0x1e91; 48388 t.zcurl = 0x0291; 48389 t.zdot = 0x017c; 48390 t.zdotaccent = 0x017c; 48391 t.zdotbelow = 0x1e93; 48392 t.zecyrillic = 0x0437; 48393 t.zedescendercyrillic = 0x0499; 48394 t.zedieresiscyrillic = 0x04df; 48395 t.zehiragana = 0x305c; 48396 t.zekatakana = 0x30bc; 48397 t.zero = 0x0030; 48398 t.zeroarabic = 0x0660; 48399 t.zerobengali = 0x09e6; 48400 t.zerodeva = 0x0966; 48401 t.zerogujarati = 0x0ae6; 48402 t.zerogurmukhi = 0x0a66; 48403 t.zerohackarabic = 0x0660; 48404 t.zeroinferior = 0x2080; 48405 t.zeromonospace = 0xff10; 48406 t.zerooldstyle = 0xf730; 48407 t.zeropersian = 0x06f0; 48408 t.zerosuperior = 0x2070; 48409 t.zerothai = 0x0e50; 48410 t.zerowidthjoiner = 0xfeff; 48411 t.zerowidthnonjoiner = 0x200c; 48412 t.zerowidthspace = 0x200b; 48413 t.zeta = 0x03b6; 48414 t.zhbopomofo = 0x3113; 48415 t.zhearmenian = 0x056a; 48416 t.zhebrevecyrillic = 0x04c2; 48417 t.zhecyrillic = 0x0436; 48418 t.zhedescendercyrillic = 0x0497; 48419 t.zhedieresiscyrillic = 0x04dd; 48420 t.zihiragana = 0x3058; 48421 t.zikatakana = 0x30b8; 48422 t.zinorhebrew = 0x05ae; 48423 t.zlinebelow = 0x1e95; 48424 t.zmonospace = 0xff5a; 48425 t.zohiragana = 0x305e; 48426 t.zokatakana = 0x30be; 48427 t.zparen = 0x24b5; 48428 t.zretroflexhook = 0x0290; 48429 t.zstroke = 0x01b6; 48430 t.zuhiragana = 0x305a; 48431 t.zukatakana = 0x30ba; 48432 t[".notdef"] = 0x0000; 48433 t.angbracketleftbig = 0x2329; 48434 t.angbracketleftBig = 0x2329; 48435 t.angbracketleftbigg = 0x2329; 48436 t.angbracketleftBigg = 0x2329; 48437 t.angbracketrightBig = 0x232a; 48438 t.angbracketrightbig = 0x232a; 48439 t.angbracketrightBigg = 0x232a; 48440 t.angbracketrightbigg = 0x232a; 48441 t.arrowhookleft = 0x21aa; 48442 t.arrowhookright = 0x21a9; 48443 t.arrowlefttophalf = 0x21bc; 48444 t.arrowleftbothalf = 0x21bd; 48445 t.arrownortheast = 0x2197; 48446 t.arrownorthwest = 0x2196; 48447 t.arrowrighttophalf = 0x21c0; 48448 t.arrowrightbothalf = 0x21c1; 48449 t.arrowsoutheast = 0x2198; 48450 t.arrowsouthwest = 0x2199; 48451 t.backslashbig = 0x2216; 48452 t.backslashBig = 0x2216; 48453 t.backslashBigg = 0x2216; 48454 t.backslashbigg = 0x2216; 48455 t.bardbl = 0x2016; 48456 t.bracehtipdownleft = 0xfe37; 48457 t.bracehtipdownright = 0xfe37; 48458 t.bracehtipupleft = 0xfe38; 48459 t.bracehtipupright = 0xfe38; 48460 t.braceleftBig = 0x007b; 48461 t.braceleftbig = 0x007b; 48462 t.braceleftbigg = 0x007b; 48463 t.braceleftBigg = 0x007b; 48464 t.bracerightBig = 0x007d; 48465 t.bracerightbig = 0x007d; 48466 t.bracerightbigg = 0x007d; 48467 t.bracerightBigg = 0x007d; 48468 t.bracketleftbig = 0x005b; 48469 t.bracketleftBig = 0x005b; 48470 t.bracketleftbigg = 0x005b; 48471 t.bracketleftBigg = 0x005b; 48472 t.bracketrightBig = 0x005d; 48473 t.bracketrightbig = 0x005d; 48474 t.bracketrightbigg = 0x005d; 48475 t.bracketrightBigg = 0x005d; 48476 t.ceilingleftbig = 0x2308; 48477 t.ceilingleftBig = 0x2308; 48478 t.ceilingleftBigg = 0x2308; 48479 t.ceilingleftbigg = 0x2308; 48480 t.ceilingrightbig = 0x2309; 48481 t.ceilingrightBig = 0x2309; 48482 t.ceilingrightbigg = 0x2309; 48483 t.ceilingrightBigg = 0x2309; 48484 t.circledotdisplay = 0x2299; 48485 t.circledottext = 0x2299; 48486 t.circlemultiplydisplay = 0x2297; 48487 t.circlemultiplytext = 0x2297; 48488 t.circleplusdisplay = 0x2295; 48489 t.circleplustext = 0x2295; 48490 t.contintegraldisplay = 0x222e; 48491 t.contintegraltext = 0x222e; 48492 t.coproductdisplay = 0x2210; 48493 t.coproducttext = 0x2210; 48494 t.floorleftBig = 0x230a; 48495 t.floorleftbig = 0x230a; 48496 t.floorleftbigg = 0x230a; 48497 t.floorleftBigg = 0x230a; 48498 t.floorrightbig = 0x230b; 48499 t.floorrightBig = 0x230b; 48500 t.floorrightBigg = 0x230b; 48501 t.floorrightbigg = 0x230b; 48502 t.hatwide = 0x0302; 48503 t.hatwider = 0x0302; 48504 t.hatwidest = 0x0302; 48505 t.intercal = 0x1d40; 48506 t.integraldisplay = 0x222b; 48507 t.integraltext = 0x222b; 48508 t.intersectiondisplay = 0x22c2; 48509 t.intersectiontext = 0x22c2; 48510 t.logicalanddisplay = 0x2227; 48511 t.logicalandtext = 0x2227; 48512 t.logicalordisplay = 0x2228; 48513 t.logicalortext = 0x2228; 48514 t.parenleftBig = 0x0028; 48515 t.parenleftbig = 0x0028; 48516 t.parenleftBigg = 0x0028; 48517 t.parenleftbigg = 0x0028; 48518 t.parenrightBig = 0x0029; 48519 t.parenrightbig = 0x0029; 48520 t.parenrightBigg = 0x0029; 48521 t.parenrightbigg = 0x0029; 48522 t.prime = 0x2032; 48523 t.productdisplay = 0x220f; 48524 t.producttext = 0x220f; 48525 t.radicalbig = 0x221a; 48526 t.radicalBig = 0x221a; 48527 t.radicalBigg = 0x221a; 48528 t.radicalbigg = 0x221a; 48529 t.radicalbt = 0x221a; 48530 t.radicaltp = 0x221a; 48531 t.radicalvertex = 0x221a; 48532 t.slashbig = 0x002f; 48533 t.slashBig = 0x002f; 48534 t.slashBigg = 0x002f; 48535 t.slashbigg = 0x002f; 48536 t.summationdisplay = 0x2211; 48537 t.summationtext = 0x2211; 48538 t.tildewide = 0x02dc; 48539 t.tildewider = 0x02dc; 48540 t.tildewidest = 0x02dc; 48541 t.uniondisplay = 0x22c3; 48542 t.unionmultidisplay = 0x228e; 48543 t.unionmultitext = 0x228e; 48544 t.unionsqdisplay = 0x2294; 48545 t.unionsqtext = 0x2294; 48546 t.uniontext = 0x22c3; 48547 t.vextenddouble = 0x2225; 48548 t.vextendsingle = 0x2223; 48549}); 48550var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { 48551 t.space = 0x0020; 48552 t.a1 = 0x2701; 48553 t.a2 = 0x2702; 48554 t.a202 = 0x2703; 48555 t.a3 = 0x2704; 48556 t.a4 = 0x260e; 48557 t.a5 = 0x2706; 48558 t.a119 = 0x2707; 48559 t.a118 = 0x2708; 48560 t.a117 = 0x2709; 48561 t.a11 = 0x261b; 48562 t.a12 = 0x261e; 48563 t.a13 = 0x270c; 48564 t.a14 = 0x270d; 48565 t.a15 = 0x270e; 48566 t.a16 = 0x270f; 48567 t.a105 = 0x2710; 48568 t.a17 = 0x2711; 48569 t.a18 = 0x2712; 48570 t.a19 = 0x2713; 48571 t.a20 = 0x2714; 48572 t.a21 = 0x2715; 48573 t.a22 = 0x2716; 48574 t.a23 = 0x2717; 48575 t.a24 = 0x2718; 48576 t.a25 = 0x2719; 48577 t.a26 = 0x271a; 48578 t.a27 = 0x271b; 48579 t.a28 = 0x271c; 48580 t.a6 = 0x271d; 48581 t.a7 = 0x271e; 48582 t.a8 = 0x271f; 48583 t.a9 = 0x2720; 48584 t.a10 = 0x2721; 48585 t.a29 = 0x2722; 48586 t.a30 = 0x2723; 48587 t.a31 = 0x2724; 48588 t.a32 = 0x2725; 48589 t.a33 = 0x2726; 48590 t.a34 = 0x2727; 48591 t.a35 = 0x2605; 48592 t.a36 = 0x2729; 48593 t.a37 = 0x272a; 48594 t.a38 = 0x272b; 48595 t.a39 = 0x272c; 48596 t.a40 = 0x272d; 48597 t.a41 = 0x272e; 48598 t.a42 = 0x272f; 48599 t.a43 = 0x2730; 48600 t.a44 = 0x2731; 48601 t.a45 = 0x2732; 48602 t.a46 = 0x2733; 48603 t.a47 = 0x2734; 48604 t.a48 = 0x2735; 48605 t.a49 = 0x2736; 48606 t.a50 = 0x2737; 48607 t.a51 = 0x2738; 48608 t.a52 = 0x2739; 48609 t.a53 = 0x273a; 48610 t.a54 = 0x273b; 48611 t.a55 = 0x273c; 48612 t.a56 = 0x273d; 48613 t.a57 = 0x273e; 48614 t.a58 = 0x273f; 48615 t.a59 = 0x2740; 48616 t.a60 = 0x2741; 48617 t.a61 = 0x2742; 48618 t.a62 = 0x2743; 48619 t.a63 = 0x2744; 48620 t.a64 = 0x2745; 48621 t.a65 = 0x2746; 48622 t.a66 = 0x2747; 48623 t.a67 = 0x2748; 48624 t.a68 = 0x2749; 48625 t.a69 = 0x274a; 48626 t.a70 = 0x274b; 48627 t.a71 = 0x25cf; 48628 t.a72 = 0x274d; 48629 t.a73 = 0x25a0; 48630 t.a74 = 0x274f; 48631 t.a203 = 0x2750; 48632 t.a75 = 0x2751; 48633 t.a204 = 0x2752; 48634 t.a76 = 0x25b2; 48635 t.a77 = 0x25bc; 48636 t.a78 = 0x25c6; 48637 t.a79 = 0x2756; 48638 t.a81 = 0x25d7; 48639 t.a82 = 0x2758; 48640 t.a83 = 0x2759; 48641 t.a84 = 0x275a; 48642 t.a97 = 0x275b; 48643 t.a98 = 0x275c; 48644 t.a99 = 0x275d; 48645 t.a100 = 0x275e; 48646 t.a101 = 0x2761; 48647 t.a102 = 0x2762; 48648 t.a103 = 0x2763; 48649 t.a104 = 0x2764; 48650 t.a106 = 0x2765; 48651 t.a107 = 0x2766; 48652 t.a108 = 0x2767; 48653 t.a112 = 0x2663; 48654 t.a111 = 0x2666; 48655 t.a110 = 0x2665; 48656 t.a109 = 0x2660; 48657 t.a120 = 0x2460; 48658 t.a121 = 0x2461; 48659 t.a122 = 0x2462; 48660 t.a123 = 0x2463; 48661 t.a124 = 0x2464; 48662 t.a125 = 0x2465; 48663 t.a126 = 0x2466; 48664 t.a127 = 0x2467; 48665 t.a128 = 0x2468; 48666 t.a129 = 0x2469; 48667 t.a130 = 0x2776; 48668 t.a131 = 0x2777; 48669 t.a132 = 0x2778; 48670 t.a133 = 0x2779; 48671 t.a134 = 0x277a; 48672 t.a135 = 0x277b; 48673 t.a136 = 0x277c; 48674 t.a137 = 0x277d; 48675 t.a138 = 0x277e; 48676 t.a139 = 0x277f; 48677 t.a140 = 0x2780; 48678 t.a141 = 0x2781; 48679 t.a142 = 0x2782; 48680 t.a143 = 0x2783; 48681 t.a144 = 0x2784; 48682 t.a145 = 0x2785; 48683 t.a146 = 0x2786; 48684 t.a147 = 0x2787; 48685 t.a148 = 0x2788; 48686 t.a149 = 0x2789; 48687 t.a150 = 0x278a; 48688 t.a151 = 0x278b; 48689 t.a152 = 0x278c; 48690 t.a153 = 0x278d; 48691 t.a154 = 0x278e; 48692 t.a155 = 0x278f; 48693 t.a156 = 0x2790; 48694 t.a157 = 0x2791; 48695 t.a158 = 0x2792; 48696 t.a159 = 0x2793; 48697 t.a160 = 0x2794; 48698 t.a161 = 0x2192; 48699 t.a163 = 0x2194; 48700 t.a164 = 0x2195; 48701 t.a196 = 0x2798; 48702 t.a165 = 0x2799; 48703 t.a192 = 0x279a; 48704 t.a166 = 0x279b; 48705 t.a167 = 0x279c; 48706 t.a168 = 0x279d; 48707 t.a169 = 0x279e; 48708 t.a170 = 0x279f; 48709 t.a171 = 0x27a0; 48710 t.a172 = 0x27a1; 48711 t.a173 = 0x27a2; 48712 t.a162 = 0x27a3; 48713 t.a174 = 0x27a4; 48714 t.a175 = 0x27a5; 48715 t.a176 = 0x27a6; 48716 t.a177 = 0x27a7; 48717 t.a178 = 0x27a8; 48718 t.a179 = 0x27a9; 48719 t.a193 = 0x27aa; 48720 t.a180 = 0x27ab; 48721 t.a199 = 0x27ac; 48722 t.a181 = 0x27ad; 48723 t.a200 = 0x27ae; 48724 t.a182 = 0x27af; 48725 t.a201 = 0x27b1; 48726 t.a183 = 0x27b2; 48727 t.a184 = 0x27b3; 48728 t.a197 = 0x27b4; 48729 t.a185 = 0x27b5; 48730 t.a194 = 0x27b6; 48731 t.a198 = 0x27b7; 48732 t.a186 = 0x27b8; 48733 t.a195 = 0x27b9; 48734 t.a187 = 0x27ba; 48735 t.a188 = 0x27bb; 48736 t.a189 = 0x27bc; 48737 t.a190 = 0x27bd; 48738 t.a191 = 0x27be; 48739 t.a89 = 0x2768; 48740 t.a90 = 0x2769; 48741 t.a93 = 0x276a; 48742 t.a94 = 0x276b; 48743 t.a91 = 0x276c; 48744 t.a92 = 0x276d; 48745 t.a205 = 0x276e; 48746 t.a85 = 0x276f; 48747 t.a206 = 0x2770; 48748 t.a86 = 0x2771; 48749 t.a87 = 0x2772; 48750 t.a88 = 0x2773; 48751 t.a95 = 0x2774; 48752 t.a96 = 0x2775;
48753 t[".notdef"] = 0x0000; 48754}); 48755exports.getGlyphsUnicode = getGlyphsUnicode; 48756exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; 48757 48758/***/ }), 48759/* 34 */ 48760/***/ (function(module, exports, __w_pdfjs_require__) { 48761 48762"use strict"; 48763 48764 48765Object.defineProperty(exports, "__esModule", { 48766 value: true 48767}); 48768exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0; 48769 48770var _core_utils = __w_pdfjs_require__(8); 48771 48772const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 48773 t.ArialNarrow = "Helvetica"; 48774 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 48775 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 48776 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 48777 t.ArialBlack = "Helvetica"; 48778 t["ArialBlack-Bold"] = "Helvetica-Bold"; 48779 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 48780 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 48781 t["Arial-Black"] = "Helvetica"; 48782 t["Arial-Black-Bold"] = "Helvetica-Bold"; 48783 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 48784 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 48785 t.Arial = "Helvetica"; 48786 t["Arial-Bold"] = "Helvetica-Bold"; 48787 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 48788 t["Arial-Italic"] = "Helvetica-Oblique"; 48789 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 48790 t["Arial-BoldMT"] = "Helvetica-Bold"; 48791 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 48792 t.ArialMT = "Helvetica"; 48793 t["Courier-Bold"] = "Courier-Bold"; 48794 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 48795 t["Courier-Italic"] = "Courier-Oblique"; 48796 t.CourierNew = "Courier"; 48797 t["CourierNew-Bold"] = "Courier-Bold"; 48798 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 48799 t["CourierNew-Italic"] = "Courier-Oblique"; 48800 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 48801 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 48802 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 48803 t.CourierNewPSMT = "Courier"; 48804 t.Helvetica = "Helvetica"; 48805 t["Helvetica-Bold"] = "Helvetica-Bold"; 48806 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 48807 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 48808 t["Helvetica-Italic"] = "Helvetica-Oblique"; 48809 t["Helvetica-Oblique"] = "Helvetica-Oblique"; 48810 t["Symbol-Bold"] = "Symbol"; 48811 t["Symbol-BoldItalic"] = "Symbol"; 48812 t["Symbol-Italic"] = "Symbol"; 48813 t.TimesNewRoman = "Times-Roman"; 48814 t["TimesNewRoman-Bold"] = "Times-Bold"; 48815 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 48816 t["TimesNewRoman-Italic"] = "Times-Italic"; 48817 t.TimesNewRomanPS = "Times-Roman"; 48818 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 48819 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 48820 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 48821 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 48822 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 48823 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 48824 t.TimesNewRomanPSMT = "Times-Roman"; 48825 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 48826 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 48827 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 48828}); 48829exports.getStdFontMap = getStdFontMap; 48830const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 48831 t.Calibri = "Helvetica"; 48832 t["Calibri-Bold"] = "Helvetica-Bold"; 48833 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 48834 t["Calibri-Italic"] = "Helvetica-Oblique"; 48835 t.CenturyGothic = "Helvetica"; 48836 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 48837 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 48838 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 48839 t.ComicSansMS = "Comic Sans MS"; 48840 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 48841 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 48842 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; 48843 t.LucidaConsole = "Courier"; 48844 t["LucidaConsole-Bold"] = "Courier-Bold"; 48845 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 48846 t["LucidaConsole-Italic"] = "Courier-Oblique"; 48847 t["LucidaSans-Demi"] = "Helvetica-Bold"; 48848 t["MS-Gothic"] = "MS Gothic"; 48849 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 48850 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 48851 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 48852 t["MS-Mincho"] = "MS Mincho"; 48853 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 48854 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 48855 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 48856 t["MS-PGothic"] = "MS PGothic"; 48857 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 48858 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 48859 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 48860 t["MS-PMincho"] = "MS PMincho"; 48861 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 48862 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 48863 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 48864 t.NuptialScript = "Times-Italic"; 48865 t.SegoeUISymbol = "Helvetica"; 48866 t.Wingdings = "ZapfDingbats"; 48867 t["Wingdings-Regular"] = "ZapfDingbats"; 48868}); 48869exports.getNonStdFontMap = getNonStdFontMap; 48870const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 48871 t["Adobe Jenson"] = true; 48872 t["Adobe Text"] = true; 48873 t.Albertus = true;
48874 t.Aldus = true; 48875 t.Alexandria = true; 48876 t.Algerian = true; 48877 t["American Typewriter"] = true; 48878 t.Antiqua = true; 48879 t.Apex = true; 48880 t.Arno = true; 48881 t.Aster = true; 48882 t.Aurora = true; 48883 t.Baskerville = true; 48884 t.Bell = true; 48885 t.Bembo = true; 48886 t["Bembo Schoolbook"] = true; 48887 t.Benguiat = true; 48888 t["Berkeley Old Style"] = true; 48889 t["Bernhard Modern"] = true; 48890 t["Berthold City"] = true; 48891 t.Bodoni = true; 48892 t["Bauer Bodoni"] = true; 48893 t["Book Antiqua"] = true; 48894 t.Bookman = true; 48895 t["Bordeaux Roman"] = true; 48896 t["Californian FB"] = true; 48897 t.Calisto = true; 48898 t.Calvert = true; 48899 t.Capitals = true; 48900 t.Cambria = true; 48901 t.Cartier = true; 48902 t.Caslon = true; 48903 t.Catull = true; 48904 t.Centaur = true; 48905 t["Century Old Style"] = true; 48906 t["Century Schoolbook"] = true; 48907 t.Chaparral = true; 48908 t["Charis SIL"] = true; 48909 t.Cheltenham = true; 48910 t["Cholla Slab"] = true; 48911 t.Clarendon = true; 48912 t.Clearface = true; 48913 t.Cochin = true; 48914 t.Colonna = true; 48915 t["Computer Modern"] = true; 48916 t["Concrete Roman"] = true; 48917 t.Constantia = true; 48918 t["Cooper Black"] = true; 48919 t.Corona = true; 48920 t.Ecotype = true; 48921 t.Egyptienne = true; 48922 t.Elephant = true; 48923 t.Excelsior = true; 48924 t.Fairfield = true; 48925 t["FF Scala"] = true; 48926 t.Folkard = true; 48927 t.Footlight = true; 48928 t.FreeSerif = true; 48929 t["Friz Quadrata"] = true; 48930 t.Garamond = true; 48931 t.Gentium = true; 48932 t.Georgia = true; 48933 t.Gloucester = true; 48934 t["Goudy Old Style"] = true; 48935 t["Goudy Schoolbook"] = true; 48936 t["Goudy Pro Font"] = true; 48937 t.Granjon = true; 48938 t["Guardian Egyptian"] = true; 48939 t.Heather = true; 48940 t.Hercules = true; 48941 t["High Tower Text"] = true; 48942 t.Hiroshige = true; 48943 t["Hoefler Text"] = true; 48944 t["Humana Serif"] = true; 48945 t.Imprint = true; 48946 t["Ionic No. 5"] = true; 48947 t.Janson = true; 48948 t.Joanna = true; 48949 t.Korinna = true; 48950 t.Lexicon = true; 48951 t["Liberation Serif"] = true; 48952 t["Linux Libertine"] = true; 48953 t.Literaturnaya = true; 48954 t.Lucida = true; 48955 t["Lucida Bright"] = true; 48956 t.Melior = true; 48957 t.Memphis = true; 48958 t.Miller = true; 48959 t.Minion = true; 48960 t.Modern = true; 48961 t["Mona Lisa"] = true; 48962 t["Mrs Eaves"] = true; 48963 t["MS Serif"] = true; 48964 t["Museo Slab"] = true; 48965 t["New York"] = true; 48966 t["Nimbus Roman"] = true; 48967 t["NPS Rawlinson Roadway"] = true; 48968 t.NuptialScript = true; 48969 t.Palatino = true; 48970 t.Perpetua = true; 48971 t.Plantin = true; 48972 t["Plantin Schoolbook"] = true; 48973 t.Playbill = true; 48974 t["Poor Richard"] = true; 48975 t["Rawlinson Roadway"] = true; 48976 t.Renault = true; 48977 t.Requiem = true; 48978 t.Rockwell = true; 48979 t.Roman = true; 48980 t["Rotis Serif"] = true; 48981 t.Sabon = true; 48982 t.Scala = true; 48983 t.Seagull = true; 48984 t.Sistina = true; 48985 t.Souvenir = true; 48986 t.STIX = true; 48987 t["Stone Informal"] = true; 48988 t["Stone Serif"] = true; 48989 t.Sylfaen = true; 48990 t.Times = true; 48991 t.Trajan = true; 48992 t["Trinité"] = true; 48993 t["Trump Mediaeval"] = true; 48994 t.Utopia = true; 48995 t["Vale Type"] = true; 48996 t["Bitstream Vera"] = true; 48997 t["Vera Serif"] = true; 48998 t.Versailles = true; 48999 t.Wanted = true; 49000 t.Weiss = true; 49001 t["Wide Latin"] = true; 49002 t.Windsor = true; 49003 t.XITS = true; 49004}); 49005exports.getSerifFonts = getSerifFonts; 49006const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 49007 t.Dingbats = true; 49008 t.Symbol = true; 49009 t.ZapfDingbats = true; 49010}); 49011exports.getSymbolsFonts = getSymbolsFonts; 49012const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 49013 t[2] = 10; 49014 t[3] = 32; 49015 t[4] = 33; 49016 t[5] = 34; 49017 t[6] = 35; 49018 t[7] = 36; 49019 t[8] = 37; 49020 t[9] = 38; 49021 t[10] = 39; 49022 t[11] = 40; 49023 t[12] = 41; 49024 t[13] = 42; 49025 t[14] = 43; 49026 t[15] = 44; 49027 t[16] = 45; 49028 t[17] = 46; 49029 t[18] = 47; 49030 t[19] = 48; 49031 t[20] = 49; 49032 t[21] = 50; 49033 t[22] = 51; 49034 t[23] = 52; 49035 t[24] = 53; 49036 t[25] = 54; 49037 t[26] = 55; 49038 t[27] = 56; 49039 t[28] = 57; 49040 t[29] = 58; 49041 t[30] = 894; 49042 t[31] = 60; 49043 t[32] = 61; 49044 t[33] = 62; 49045 t[34] = 63; 49046 t[35] = 64; 49047 t[36] = 65; 49048 t[37] = 66; 49049 t[38] = 67; 49050 t[39] = 68; 49051 t[40] = 69; 49052 t[41] = 70; 49053 t[42] = 71; 49054 t[43] = 72; 49055 t[44] = 73; 49056 t[45] = 74; 49057 t[46] = 75; 49058 t[47] = 76; 49059 t[48] = 77; 49060 t[49] = 78; 49061 t[50] = 79; 49062 t[51] = 80; 49063 t[52] = 81; 49064 t[53] = 82; 49065 t[54] = 83; 49066 t[55] = 84; 49067 t[56] = 85; 49068 t[57] = 86; 49069 t[58] = 87; 49070 t[59] = 88; 49071 t[60] = 89; 49072 t[61] = 90; 49073 t[62] = 91; 49074 t[63] = 92; 49075 t[64] = 93; 49076 t[65] = 94; 49077 t[66] = 95; 49078 t[67] = 96; 49079 t[68] = 97; 49080 t[69] = 98; 49081 t[70] = 99; 49082 t[71] = 100; 49083 t[72] = 101; 49084 t[73] = 102; 49085 t[74] = 103; 49086 t[75] = 104; 49087 t[76] = 105; 49088 t[77] = 106; 49089 t[78] = 107; 49090 t[79] = 108; 49091 t[80] = 109; 49092 t[81] = 110; 49093 t[82] = 111; 49094 t[83] = 112; 49095 t[84] = 113; 49096 t[85] = 114; 49097 t[86] = 115; 49098 t[87] = 116; 49099 t[88] = 117; 49100 t[89] = 118; 49101 t[90] = 119; 49102 t[91] = 120; 49103 t[92] = 121;
49104 t[93] = 122; 49105 t[94] = 123; 49106 t[95] = 124; 49107 t[96] = 125; 49108 t[97] = 126; 49109 t[98] = 196; 49110 t[99] = 197; 49111 t[100] = 199; 49112 t[101] = 201; 49113 t[102] = 209; 49114 t[103] = 214; 49115 t[104] = 220; 49116 t[105] = 225; 49117 t[106] = 224; 49118 t[107] = 226; 49119 t[108] = 228; 49120 t[109] = 227; 49121 t[110] = 229; 49122 t[111] = 231; 49123 t[112] = 233; 49124 t[113] = 232; 49125 t[114] = 234; 49126 t[115] = 235; 49127 t[116] = 237; 49128 t[117] = 236; 49129 t[118] = 238; 49130 t[119] = 239; 49131 t[120] = 241; 49132 t[121] = 243; 49133 t[122] = 242; 49134 t[123] = 244; 49135 t[124] = 246; 49136 t[125] = 245; 49137 t[126] = 250; 49138 t[127] = 249; 49139 t[128] = 251; 49140 t[129] = 252; 49141 t[130] = 8224; 49142 t[131] = 176; 49143 t[132] = 162; 49144 t[133] = 163; 49145 t[134] = 167; 49146 t[135] = 8226; 49147 t[136] = 182; 49148 t[137] = 223; 49149 t[138] = 174; 49150 t[139] = 169; 49151 t[140] = 8482; 49152 t[141] = 180; 49153 t[142] = 168; 49154 t[143] = 8800; 49155 t[144] = 198; 49156 t[145] = 216; 49157 t[146] = 8734; 49158 t[147] = 177; 49159 t[148] = 8804; 49160 t[149] = 8805; 49161 t[150] = 165; 49162 t[151] = 181; 49163 t[152] = 8706; 49164 t[153] = 8721; 49165 t[154] = 8719; 49166 t[156] = 8747; 49167 t[157] = 170; 49168 t[158] = 186; 49169 t[159] = 8486; 49170 t[160] = 230; 49171 t[161] = 248; 49172 t[162] = 191; 49173 t[163] = 161; 49174 t[164] = 172; 49175 t[165] = 8730; 49176 t[166] = 402; 49177 t[167] = 8776; 49178 t[168] = 8710; 49179 t[169] = 171; 49180 t[170] = 187; 49181 t[171] = 8230; 49182 t[210] = 218; 49183 t[223] = 711; 49184 t[224] = 321; 49185 t[225] = 322; 49186 t[227] = 353; 49187 t[229] = 382; 49188 t[234] = 253; 49189 t[252] = 263; 49190 t[253] = 268; 49191 t[254] = 269; 49192 t[258] = 258; 49193 t[260] = 260; 49194 t[261] = 261; 49195 t[265] = 280; 49196 t[266] = 281; 49197 t[268] = 283; 49198 t[269] = 313; 49199 t[275] = 323; 49200 t[276] = 324; 49201 t[278] = 328; 49202 t[284] = 345; 49203 t[285] = 346; 49204 t[286] = 347; 49205 t[292] = 367; 49206 t[295] = 377; 49207 t[296] = 378; 49208 t[298] = 380; 49209 t[305] = 963; 49210 t[306] = 964; 49211 t[307] = 966; 49212 t[308] = 8215; 49213 t[309] = 8252; 49214 t[310] = 8319; 49215 t[311] = 8359; 49216 t[312] = 8592; 49217 t[313] = 8593; 49218 t[337] = 9552; 49219 t[493] = 1039; 49220 t[494] = 1040; 49221 t[705] = 1524; 49222 t[706] = 8362; 49223 t[710] = 64288; 49224 t[711] = 64298; 49225 t[759] = 1617; 49226 t[761] = 1776; 49227 t[763] = 1778; 49228 t[775] = 1652; 49229 t[777] = 1764; 49230 t[778] = 1780; 49231 t[779] = 1781; 49232 t[780] = 1782; 49233 t[782] = 771; 49234 t[783] = 64726; 49235 t[786] = 8363; 49236 t[788] = 8532; 49237 t[790] = 768; 49238 t[791] = 769; 49239 t[792] = 768; 49240 t[795] = 803; 49241 t[797] = 64336; 49242 t[798] = 64337; 49243 t[799] = 64342; 49244 t[800] = 64343; 49245 t[801] = 64344; 49246 t[802] = 64345; 49247 t[803] = 64362; 49248 t[804] = 64363; 49249 t[805] = 64364; 49250 t[2424] = 7821; 49251 t[2425] = 7822; 49252 t[2426] = 7823; 49253 t[2427] = 7824; 49254 t[2428] = 7825; 49255 t[2429] = 7826; 49256 t[2430] = 7827; 49257 t[2433] = 7682; 49258 t[2678] = 8045; 49259 t[2679] = 8046; 49260 t[2830] = 1552; 49261 t[2838] = 686; 49262 t[2840] = 751; 49263 t[2842] = 753; 49264 t[2843] = 754; 49265 t[2844] = 755; 49266 t[2846] = 757; 49267 t[2856] = 767; 49268 t[2857] = 848; 49269 t[2858] = 849; 49270 t[2862] = 853; 49271 t[2863] = 854; 49272 t[2864] = 855; 49273 t[2865] = 861; 49274 t[2866] = 862; 49275 t[2906] = 7460; 49276 t[2908] = 7462; 49277 t[2909] = 7463; 49278 t[2910] = 7464; 49279 t[2912] = 7466; 49280 t[2913] = 7467; 49281 t[2914] = 7468; 49282 t[2916] = 7470; 49283 t[2917] = 7471; 49284 t[2918] = 7472; 49285 t[2920] = 7474; 49286 t[2921] = 7475; 49287 t[2922] = 7476; 49288 t[2924] = 7478; 49289 t[2925] = 7479; 49290 t[2926] = 7480; 49291 t[2928] = 7482; 49292 t[2929] = 7483; 49293 t[2930] = 7484; 49294 t[2932] = 7486; 49295 t[2933] = 7487; 49296 t[2934] = 7488; 49297 t[2936] = 7490; 49298 t[2937] = 7491; 49299 t[2938] = 7492; 49300 t[2940] = 7494; 49301 t[2941] = 7495; 49302 t[2942] = 7496; 49303 t[2944] = 7498; 49304 t[2946] = 7500; 49305 t[2948] = 7502; 49306 t[2950] = 7504; 49307 t[2951] = 7505; 49308 t[2952] = 7506; 49309 t[2954] = 7508; 49310 t[2955] = 7509; 49311 t[2956] = 7510; 49312 t[2958] = 7512; 49313 t[2959] = 7513; 49314 t[2960] = 7514; 49315 t[2962] = 7516; 49316 t[2963] = 7517; 49317 t[2964] = 7518; 49318 t[2966] = 7520; 49319 t[2967] = 7521; 49320 t[2968] = 7522; 49321 t[2970] = 7524; 49322 t[2971] = 7525; 49323 t[2972] = 7526; 49324 t[2974] = 7528; 49325 t[2975] = 7529; 49326 t[2976] = 7530; 49327 t[2978] = 1537; 49328 t[2979] = 1538; 49329 t[2980] = 1539; 49330 t[2982] = 1549; 49331 t[2983] = 1551; 49332 t[2984] = 1552; 49333 t[2986] = 1554; 49334 t[2987] = 1555; 49335 t[2988] = 1556; 49336 t[2990] = 1623; 49337 t[2991] = 1624; 49338 t[2995] = 1775; 49339 t[2999] = 1791; 49340 t[3002] = 64290; 49341 t[3003] = 64291; 49342 t[3004] = 64292; 49343 t[3006] = 64294; 49344 t[3007] = 64295; 49345 t[3008] = 64296; 49346 t[3011] = 1900; 49347 t[3014] = 8223; 49348 t[3015] = 8244; 49349 t[3017] = 7532; 49350 t[3018] = 7533; 49351 t[3019] = 7534; 49352 t[3075] = 7590; 49353 t[3076] = 7591; 49354 t[3079] = 7594; 49355 t[3080] = 7595; 49356 t[3083] = 7598; 49357 t[3084] = 7599; 49358 t[3087] = 7602; 49359 t[3088] = 7603; 49360 t[3091] = 7606; 49361 t[3092] = 7607; 49362 t[3095] = 7610; 49363 t[3096] = 7611; 49364 t[3099] = 7614; 49365 t[3100] = 7615; 49366 t[3103] = 7618; 49367 t[3104] = 7619; 49368 t[3107] = 8337; 49369 t[3108] = 8338; 49370 t[3116] = 1884; 49371 t[3119] = 1885; 49372 t[3120] = 1885; 49373 t[3123] = 1886; 49374 t[3124] = 1886; 49375 t[3127] = 1887; 49376 t[3128] = 1887; 49377 t[3131] = 1888; 49378 t[3132] = 1888; 49379 t[3135] = 1889; 49380 t[3136] = 1889; 49381 t[3139] = 1890; 49382 t[3140] = 1890; 49383 t[3143] = 1891; 49384 t[3144] = 1891; 49385 t[3147] = 1892; 49386 t[3148] = 1892; 49387 t[3153] = 580; 49388 t[3154] = 581; 49389 t[3157] = 584; 49390 t[3158] = 585; 49391 t[3161] = 588; 49392 t[3162] = 589; 49393 t[3165] = 891; 49394 t[3166] = 892; 49395 t[3169] = 1274; 49396 t[3170] = 1275; 49397 t[3173] = 1278; 49398 t[3174] = 1279; 49399 t[3181] = 7622; 49400 t[3182] = 7623; 49401 t[3282] = 11799; 49402 t[3316] = 578; 49403 t[3379] = 42785; 49404 t[3393] = 1159; 49405 t[3416] = 8377; 49406}); 49407exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 49408const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { 49409 t[227] = 322; 49410 t[264] = 261; 49411 t[291] = 346; 49412}); 49413exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 49414const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { 49415 t[1] = 32; 49416 t[4] = 65; 49417 t[17] = 66; 49418 t[18] = 67; 49419 t[24] = 68; 49420 t[28] = 69; 49421 t[38] = 70; 49422 t[39] = 71; 49423 t[44] = 72; 49424 t[47] = 73; 49425 t[58] = 74; 49426 t[60] = 75; 49427 t[62] = 76; 49428 t[68] = 77; 49429 t[69] = 78; 49430 t[75] = 79; 49431 t[87] = 80; 49432 t[89] = 81; 49433 t[90] = 82; 49434 t[94] = 83; 49435 t[100] = 84; 49436 t[104] = 85; 49437 t[115] = 86; 49438 t[116] = 87; 49439 t[121] = 88; 49440 t[122] = 89; 49441 t[127] = 90; 49442 t[258] = 97; 49443 t[268] = 261; 49444 t[271] = 98; 49445 t[272] = 99; 49446 t[273] = 263; 49447 t[282] = 100; 49448 t[286] = 101; 49449 t[295] = 281; 49450 t[296] = 102; 49451 t[336] = 103; 49452 t[346] = 104; 49453 t[349] = 105; 49454 t[361] = 106; 49455 t[364] = 107; 49456 t[367] = 108; 49457 t[371] = 322; 49458 t[373] = 109; 49459 t[374] = 110; 49460 t[381] = 111; 49461 t[383] = 243; 49462 t[393] = 112; 49463 t[395] = 113; 49464 t[396] = 114; 49465 t[400] = 115;
49466 t[401] = 347; 49467 t[410] = 116; 49468 t[437] = 117; 49469 t[448] = 118; 49470 t[449] = 119; 49471 t[454] = 120; 49472 t[455] = 121; 49473 t[460] = 122; 49474 t[463] = 380; 49475 t[853] = 44; 49476 t[855] = 58; 49477 t[856] = 46; 49478 t[876] = 47; 49479 t[878] = 45; 49480 t[882] = 45; 49481 t[894] = 40; 49482 t[895] = 41; 49483 t[896] = 91; 49484 t[897] = 93; 49485 t[923] = 64; 49486 t[1004] = 48; 49487 t[1005] = 49; 49488 t[1006] = 50; 49489 t[1007] = 51; 49490 t[1008] = 52; 49491 t[1009] = 53; 49492 t[1010] = 54; 49493 t[1011] = 55; 49494 t[1012] = 56; 49495 t[1013] = 57; 49496 t[1081] = 37; 49497 t[1085] = 43; 49498 t[1086] = 45; 49499}); 49500exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; 49501 49502/***/ }), 49503/* 35 */ 49504/***/ (function(module, exports, __w_pdfjs_require__) { 49505 49506var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory; 49507var getSpecialPUASymbols = getLookupTableFactory(function (t) { 49508 t[63721] = 0x00a9; 49509 t[63193] = 0x00a9; 49510 t[63720] = 0x00ae; 49511 t[63194] = 0x00ae; 49512 t[63722] = 0x2122; 49513 t[63195] = 0x2122; 49514 t[63729] = 0x23a7; 49515 t[63730] = 0x23a8; 49516 t[63731] = 0x23a9; 49517 t[63740] = 0x23ab; 49518 t[63741] = 0x23ac; 49519 t[63742] = 0x23ad; 49520 t[63726] = 0x23a1; 49521 t[63727] = 0x23a2; 49522 t[63728] = 0x23a3; 49523 t[63737] = 0x23a4; 49524 t[63738] = 0x23a5; 49525 t[63739] = 0x23a6; 49526 t[63723] = 0x239b; 49527 t[63724] = 0x239c; 49528 t[63725] = 0x239d; 49529 t[63734] = 0x239e; 49530 t[63735] = 0x239f; 49531 t[63736] = 0x23a0; 49532}); 49533function mapSpecialUnicodeValues(code) { 49534 if (code >= 0xfff0 && code <= 0xffff) { 49535 return 0; 49536 } else if (code >= 0xf600 && code <= 0xf8ff) {
49537 return getSpecialPUASymbols()[code] || code; 49538 } else if (code === 0x00ad) { 49539 return 0x002d; 49540 } 49541 return code; 49542} 49543function getUnicodeForGlyph(name, glyphsUnicodeMap) { 49544 var unicode = glyphsUnicodeMap[name]; 49545 if (unicode !== undefined) { 49546 return unicode; 49547 } 49548 if (!name) { 49549 return -1; 49550 } 49551 if (name[0] === "u") { 49552 var nameLen = name.length, hexStr; 49553 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 49554 hexStr = name.substring(3); 49555 } else if (nameLen >= 5 && nameLen <= 7) { 49556 hexStr = name.substring(1); 49557 } else { 49558 return -1; 49559 } 49560 if (hexStr === hexStr.toUpperCase()) { 49561 unicode = parseInt(hexStr, 16); 49562 if (unicode >= 0) { 49563 return unicode; 49564 } 49565 } 49566 } 49567 return -1; 49568} 49569var UnicodeRanges = [ 49570 { 49571 begin: 0x0000, 49572 end: 0x007f 49573 }, 49574 { 49575 begin: 0x0080, 49576 end: 0x00ff 49577 }, 49578 { 49579 begin: 0x0100, 49580 end: 0x017f 49581 }, 49582 { 49583 begin: 0x0180, 49584 end: 0x024f 49585 }, 49586 { 49587 begin: 0x0250, 49588 end: 0x02af 49589 }, 49590 { 49591 begin: 0x02b0, 49592 end: 0x02ff 49593 }, 49594 { 49595 begin: 0x0300, 49596 end: 0x036f 49597 }, 49598 { 49599 begin: 0x0370, 49600 end: 0x03ff 49601 }, 49602 { 49603 begin: 0x2c80, 49604 end: 0x2cff 49605 }, 49606 { 49607 begin: 0x0400, 49608 end: 0x04ff 49609 }, 49610 { 49611 begin: 0x0530, 49612 end: 0x058f 49613 }, 49614 { 49615 begin: 0x0590, 49616 end: 0x05ff 49617 }, 49618 { 49619 begin: 0xa500, 49620 end: 0xa63f 49621 }, 49622 { 49623 begin: 0x0600, 49624 end: 0x06ff 49625 }, 49626 { 49627 begin: 0x07c0, 49628 end: 0x07ff 49629 }, 49630 { 49631 begin: 0x0900, 49632 end: 0x097f 49633 }, 49634 { 49635 begin: 0x0980, 49636 end: 0x09ff 49637 }, 49638 { 49639 begin: 0x0a00, 49640 end: 0x0a7f 49641 }, 49642 { 49643 begin: 0x0a80, 49644 end: 0x0aff 49645 }, 49646 { 49647 begin: 0x0b00, 49648 end: 0x0b7f 49649 }, 49650 { 49651 begin: 0x0b80, 49652 end: 0x0bff 49653 }, 49654 { 49655 begin: 0x0c00, 49656 end: 0x0c7f 49657 }, 49658 { 49659 begin: 0x0c80, 49660 end: 0x0cff 49661 }, 49662 { 49663 begin: 0x0d00, 49664 end: 0x0d7f 49665 }, 49666 { 49667 begin: 0x0e00, 49668 end: 0x0e7f 49669 }, 49670 { 49671 begin: 0x0e80, 49672 end: 0x0eff 49673 }, 49674 { 49675 begin: 0x10a0, 49676 end: 0x10ff 49677 }, 49678 { 49679 begin: 0x1b00, 49680 end: 0x1b7f 49681 }, 49682 { 49683 begin: 0x1100, 49684 end: 0x11ff 49685 }, 49686 { 49687 begin: 0x1e00, 49688 end: 0x1eff 49689 }, 49690 { 49691 begin: 0x1f00, 49692 end: 0x1fff 49693 }, 49694 { 49695 begin: 0x2000, 49696 end: 0x206f 49697 }, 49698 { 49699 begin: 0x2070, 49700 end: 0x209f 49701 }, 49702 { 49703 begin: 0x20a0, 49704 end: 0x20cf 49705 }, 49706 { 49707 begin: 0x20d0, 49708 end: 0x20ff 49709 }, 49710 { 49711 begin: 0x2100, 49712 end: 0x214f 49713 }, 49714 { 49715 begin: 0x2150, 49716 end: 0x218f 49717 }, 49718 { 49719 begin: 0x2190, 49720 end: 0x21ff 49721 }, 49722 { 49723 begin: 0x2200, 49724 end: 0x22ff 49725 }, 49726 { 49727 begin: 0x2300, 49728 end: 0x23ff 49729 }, 49730 { 49731 begin: 0x2400, 49732 end: 0x243f 49733 }, 49734 { 49735 begin: 0x2440, 49736 end: 0x245f 49737 }, 49738 { 49739 begin: 0x2460, 49740 end: 0x24ff 49741 }, 49742 { 49743 begin: 0x2500, 49744 end: 0x257f 49745 }, 49746 { 49747 begin: 0x2580, 49748 end: 0x259f 49749 }, 49750 { 49751 begin: 0x25a0, 49752 end: 0x25ff 49753 }, 49754 { 49755 begin: 0x2600, 49756 end: 0x26ff 49757 }, 49758 { 49759 begin: 0x2700, 49760 end: 0x27bf 49761 }, 49762 { 49763 begin: 0x3000, 49764 end: 0x303f 49765 }, 49766 { 49767 begin: 0x3040, 49768 end: 0x309f 49769 }, 49770 { 49771 begin: 0x30a0, 49772 end: 0x30ff 49773 }, 49774 { 49775 begin: 0x3100, 49776 end: 0x312f 49777 }, 49778 { 49779 begin: 0x3130, 49780 end: 0x318f 49781 }, 49782 { 49783 begin: 0xa840, 49784 end: 0xa87f 49785 }, 49786 { 49787 begin: 0x3200, 49788 end: 0x32ff 49789 }, 49790 { 49791 begin: 0x3300, 49792 end: 0x33ff 49793 }, 49794 { 49795 begin: 0xac00, 49796 end: 0xd7af 49797 }, 49798 { 49799 begin: 0xd800, 49800 end: 0xdfff 49801 }, 49802 { 49803 begin: 0x10900, 49804 end: 0x1091f 49805 }, 49806 { 49807 begin: 0x4e00, 49808 end: 0x9fff 49809 }, 49810 { 49811 begin: 0xe000, 49812 end: 0xf8ff 49813 }, 49814 { 49815 begin: 0x31c0, 49816 end: 0x31ef 49817 }, 49818 { 49819 begin: 0xfb00, 49820 end: 0xfb4f 49821 }, 49822 { 49823 begin: 0xfb50, 49824 end: 0xfdff 49825 }, 49826 { 49827 begin: 0xfe20, 49828 end: 0xfe2f 49829 }, 49830 { 49831 begin: 0xfe10, 49832 end: 0xfe1f 49833 }, 49834 { 49835 begin: 0xfe50, 49836 end: 0xfe6f 49837 }, 49838 { 49839 begin: 0xfe70, 49840 end: 0xfeff 49841 }, 49842 { 49843 begin: 0xff00, 49844 end: 0xffef 49845 }, 49846 { 49847 begin: 0xfff0, 49848 end: 0xffff 49849 }, 49850 { 49851 begin: 0x0f00, 49852 end: 0x0fff 49853 }, 49854 { 49855 begin: 0x0700, 49856 end: 0x074f 49857 }, 49858 { 49859 begin: 0x0780, 49860 end: 0x07bf 49861 }, 49862 { 49863 begin: 0x0d80, 49864 end: 0x0dff 49865 }, 49866 { 49867 begin: 0x1000, 49868 end: 0x109f 49869 }, 49870 { 49871 begin: 0x1200, 49872 end: 0x137f 49873 }, 49874 { 49875 begin: 0x13a0, 49876 end: 0x13ff 49877 }, 49878 { 49879 begin: 0x1400, 49880 end: 0x167f 49881 }, 49882 { 49883 begin: 0x1680, 49884 end: 0x169f 49885 }, 49886 { 49887 begin: 0x16a0, 49888 end: 0x16ff 49889 }, 49890 { 49891 begin: 0x1780, 49892 end: 0x17ff 49893 }, 49894 { 49895 begin: 0x1800, 49896 end: 0x18af 49897 }, 49898 { 49899 begin: 0x2800, 49900 end: 0x28ff 49901 }, 49902 { 49903 begin: 0xa000, 49904 end: 0xa48f 49905 }, 49906 { 49907 begin: 0x1700, 49908 end: 0x171f 49909 }, 49910 { 49911 begin: 0x10300, 49912 end: 0x1032f 49913 }, 49914 { 49915 begin: 0x10330, 49916 end: 0x1034f 49917 }, 49918 { 49919 begin: 0x10400, 49920 end: 0x1044f 49921 }, 49922 { 49923 begin: 0x1d000, 49924 end: 0x1d0ff 49925 }, 49926 { 49927 begin: 0x1d400, 49928 end: 0x1d7ff 49929 }, 49930 { 49931 begin: 0xff000, 49932 end: 0xffffd 49933 }, 49934 { 49935 begin: 0xfe00, 49936 end: 0xfe0f 49937 }, 49938 { 49939 begin: 0xe0000, 49940 end: 0xe007f 49941 }, 49942 { 49943 begin: 0x1900, 49944 end: 0x194f 49945 }, 49946 { 49947 begin: 0x1950, 49948 end: 0x197f 49949 }, 49950 { 49951 begin: 0x1980, 49952 end: 0x19df 49953 }, 49954 { 49955 begin: 0x1a00, 49956 end: 0x1a1f 49957 }, 49958 { 49959 begin: 0x2c00, 49960 end: 0x2c5f 49961 }, 49962 { 49963 begin: 0x2d30, 49964 end: 0x2d7f 49965 }, 49966 { 49967 begin: 0x4dc0, 49968 end: 0x4dff 49969 }, 49970 { 49971 begin: 0xa800, 49972 end: 0xa82f 49973 }, 49974 { 49975 begin: 0x10000, 49976 end: 0x1007f 49977 }, 49978 { 49979 begin: 0x10140, 49980 end: 0x1018f 49981 }, 49982 { 49983 begin: 0x10380, 49984 end: 0x1039f 49985 }, 49986 { 49987 begin: 0x103a0, 49988 end: 0x103df 49989 }, 49990 { 49991 begin: 0x10450, 49992 end: 0x1047f 49993 }, 49994 { 49995 begin: 0x10480, 49996 end: 0x104af 49997 }, 49998 { 49999 begin: 0x10800, 50000 end: 0x1083f 50001 }, 50002 { 50003 begin: 0x10a00, 50004 end: 0x10a5f 50005 }, 50006 { 50007 begin: 0x1d300, 50008 end: 0x1d35f 50009 }, 50010 { 50011 begin: 0x12000, 50012 end: 0x123ff 50013 }, 50014 { 50015 begin: 0x1d360, 50016 end: 0x1d37f 50017 }, 50018 { 50019 begin: 0x1b80, 50020 end: 0x1bbf 50021 }, 50022 { 50023 begin: 0x1c00, 50024 end: 0x1c4f 50025 }, 50026 { 50027 begin: 0x1c50, 50028 end: 0x1c7f 50029 }, 50030 { 50031 begin: 0xa880, 50032 end: 0xa8df 50033 }, 50034 { 50035 begin: 0xa900, 50036 end: 0xa92f 50037 }, 50038 { 50039 begin: 0xa930, 50040 end: 0xa95f 50041 }, 50042 { 50043 begin: 0xaa00, 50044 end: 0xaa5f 50045 }, 50046 { 50047 begin: 0x10190, 50048 end: 0x101cf 50049 }, 50050 { 50051 begin: 0x101d0, 50052 end: 0x101ff 50053 }, 50054 { 50055 begin: 0x102a0, 50056 end: 0x102df 50057 }, 50058 { 50059 begin: 0x1f030, 50060 end: 0x1f09f 50061 } 50062]; 50063function getUnicodeRangeFor(value) { 50064 for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) { 50065 var range = UnicodeRanges[i]; 50066 if (value >= range.begin && value < range.end) { 50067 return i; 50068 } 50069 } 50070 return -1; 50071} 50072function isRTLRangeFor(value) { 50073 var range = UnicodeRanges[13]; 50074 if (value >= range.begin && value < range.end) { 50075 return true; 50076 } 50077 range = UnicodeRanges[11]; 50078 if (value >= range.begin && value < range.end) { 50079 return true; 50080 } 50081 return false;
50082} 50083var getNormalizedUnicodes = getLookupTableFactory(function (t) { 50084 t["\u00A8"] = "\u0020\u0308"; 50085 t["\u00AF"] = "\u0020\u0304"; 50086 t["\u00B4"] = "\u0020\u0301"; 50087 t["\u00B5"] = "\u03BC"; 50088 t["\u00B8"] = "\u0020\u0327"; 50089 t["\u0132"] = "\u0049\u004A"; 50090 t["\u0133"] = "\u0069\u006A"; 50091 t["\u013F"] = "\u004C\u00B7"; 50092 t["\u0140"] = "\u006C\u00B7"; 50093 t["\u0149"] = "\u02BC\u006E"; 50094 t["\u017F"] = "\u0073"; 50095 t["\u01C4"] = "\u0044\u017D"; 50096 t["\u01C5"] = "\u0044\u017E"; 50097 t["\u01C6"] = "\u0064\u017E"; 50098 t["\u01C7"] = "\u004C\u004A"; 50099 t["\u01C8"] = "\u004C\u006A"; 50100 t["\u01C9"] = "\u006C\u006A"; 50101 t["\u01CA"] = "\u004E\u004A"; 50102 t["\u01CB"] = "\u004E\u006A"; 50103 t["\u01CC"] = "\u006E\u006A"; 50104 t["\u01F1"] = "\u0044\u005A"; 50105 t["\u01F2"] = "\u0044\u007A"; 50106 t["\u01F3"] = "\u0064\u007A"; 50107 t["\u02D8"] = "\u0020\u0306"; 50108 t["\u02D9"] = "\u0020\u0307"; 50109 t["\u02DA"] = "\u0020\u030A"; 50110 t["\u02DB"] = "\u0020\u0328"; 50111 t["\u02DC"] = "\u0020\u0303"; 50112 t["\u02DD"] = "\u0020\u030B"; 50113 t["\u037A"] = "\u0020\u0345"; 50114 t["\u0384"] = "\u0020\u0301"; 50115 t["\u03D0"] = "\u03B2"; 50116 t["\u03D1"] = "\u03B8"; 50117 t["\u03D2"] = "\u03A5"; 50118 t["\u03D5"] = "\u03C6"; 50119 t["\u03D6"] = "\u03C0"; 50120 t["\u03F0"] = "\u03BA"; 50121 t["\u03F1"] = "\u03C1"; 50122 t["\u03F2"] = "\u03C2"; 50123 t["\u03F4"] = "\u0398"; 50124 t["\u03F5"] = "\u03B5"; 50125 t["\u03F9"] = "\u03A3"; 50126 t["\u0587"] = "\u0565\u0582"; 50127 t["\u0675"] = "\u0627\u0674"; 50128 t["\u0676"] = "\u0648\u0674"; 50129 t["\u0677"] = "\u06C7\u0674"; 50130 t["\u0678"] = "\u064A\u0674"; 50131 t["\u0E33"] = "\u0E4D\u0E32"; 50132 t["\u0EB3"] = "\u0ECD\u0EB2"; 50133 t["\u0EDC"] = "\u0EAB\u0E99"; 50134 t["\u0EDD"] = "\u0EAB\u0EA1"; 50135 t["\u0F77"] = "\u0FB2\u0F81"; 50136 t["\u0F79"] = "\u0FB3\u0F81"; 50137 t["\u1E9A"] = "\u0061\u02BE"; 50138 t["\u1FBD"] = "\u0020\u0313"; 50139 t["\u1FBF"] = "\u0020\u0313"; 50140 t["\u1FC0"] = "\u0020\u0342"; 50141 t["\u1FFE"] = "\u0020\u0314"; 50142 t["\u2002"] = "\u0020"; 50143 t["\u2003"] = "\u0020"; 50144 t["\u2004"] = "\u0020"; 50145 t["\u2005"] = "\u0020"; 50146 t["\u2006"] = "\u0020"; 50147 t["\u2008"] = "\u0020"; 50148 t["\u2009"] = "\u0020"; 50149 t["\u200A"] = "\u0020"; 50150 t["\u2017"] = "\u0020\u0333"; 50151 t["\u2024"] = "\u002E"; 50152 t["\u2025"] = "\u002E\u002E"; 50153 t["\u2026"] = "\u002E\u002E\u002E"; 50154 t["\u2033"] = "\u2032\u2032"; 50155 t["\u2034"] = "\u2032\u2032\u2032"; 50156 t["\u2036"] = "\u2035\u2035"; 50157 t["\u2037"] = "\u2035\u2035\u2035"; 50158 t["\u203C"] = "\u0021\u0021"; 50159 t["\u203E"] = "\u0020\u0305"; 50160 t["\u2047"] = "\u003F\u003F"; 50161 t["\u2048"] = "\u003F\u0021"; 50162 t["\u2049"] = "\u0021\u003F"; 50163 t["\u2057"] = "\u2032\u2032\u2032\u2032"; 50164 t["\u205F"] = "\u0020"; 50165 t["\u20A8"] = "\u0052\u0073"; 50166 t["\u2100"] = "\u0061\u002F\u0063"; 50167 t["\u2101"] = "\u0061\u002F\u0073"; 50168 t["\u2103"] = "\u00B0\u0043"; 50169 t["\u2105"] = "\u0063\u002F\u006F"; 50170 t["\u2106"] = "\u0063\u002F\u0075"; 50171 t["\u2107"] = "\u0190"; 50172 t["\u2109"] = "\u00B0\u0046"; 50173 t["\u2116"] = "\u004E\u006F"; 50174 t["\u2121"] = "\u0054\u0045\u004C"; 50175 t["\u2135"] = "\u05D0"; 50176 t["\u2136"] = "\u05D1"; 50177 t["\u2137"] = "\u05D2"; 50178 t["\u2138"] = "\u05D3"; 50179 t["\u213B"] = "\u0046\u0041\u0058"; 50180 t["\u2160"] = "\u0049"; 50181 t["\u2161"] = "\u0049\u0049"; 50182 t["\u2162"] = "\u0049\u0049\u0049"; 50183 t["\u2163"] = "\u0049\u0056"; 50184 t["\u2164"] = "\u0056"; 50185 t["\u2165"] = "\u0056\u0049"; 50186 t["\u2166"] = "\u0056\u0049\u0049"; 50187 t["\u2167"] = "\u0056\u0049\u0049\u0049"; 50188 t["\u2168"] = "\u0049\u0058"; 50189 t["\u2169"] = "\u0058"; 50190 t["\u216A"] = "\u0058\u0049"; 50191 t["\u216B"] = "\u0058\u0049\u0049"; 50192 t["\u216C"] = "\u004C"; 50193 t["\u216D"] = "\u0043"; 50194 t["\u216E"] = "\u0044"; 50195 t["\u216F"] = "\u004D"; 50196 t["\u2170"] = "\u0069"; 50197 t["\u2171"] = "\u0069\u0069"; 50198 t["\u2172"] = "\u0069\u0069\u0069"; 50199 t["\u2173"] = "\u0069\u0076"; 50200 t["\u2174"] = "\u0076"; 50201 t["\u2175"] = "\u0076\u0069"; 50202 t["\u2176"] = "\u0076\u0069\u0069"; 50203 t["\u2177"] = "\u0076\u0069\u0069\u0069"; 50204 t["\u2178"] = "\u0069\u0078"; 50205 t["\u2179"] = "\u0078"; 50206 t["\u217A"] = "\u0078\u0069"; 50207 t["\u217B"] = "\u0078\u0069\u0069"; 50208 t["\u217C"] = "\u006C"; 50209 t["\u217D"] = "\u0063"; 50210 t["\u217E"] = "\u0064"; 50211 t["\u217F"] = "\u006D"; 50212 t["\u222C"] = "\u222B\u222B"; 50213 t["\u222D"] = "\u222B\u222B\u222B"; 50214 t["\u222F"] = "\u222E\u222E"; 50215 t["\u2230"] = "\u222E\u222E\u222E"; 50216 t["\u2474"] = "\u0028\u0031\u0029"; 50217 t["\u2475"] = "\u0028\u0032\u0029"; 50218 t["\u2476"] = "\u0028\u0033\u0029"; 50219 t["\u2477"] = "\u0028\u0034\u0029"; 50220 t["\u2478"] = "\u0028\u0035\u0029"; 50221 t["\u2479"] = "\u0028\u0036\u0029"; 50222 t["\u247A"] = "\u0028\u0037\u0029"; 50223 t["\u247B"] = "\u0028\u0038\u0029"; 50224 t["\u247C"] = "\u0028\u0039\u0029"; 50225 t["\u247D"] = "\u0028\u0031\u0030\u0029"; 50226 t["\u247E"] = "\u0028\u0031\u0031\u0029"; 50227 t["\u247F"] = "\u0028\u0031\u0032\u0029"; 50228 t["\u2480"] = "\u0028\u0031\u0033\u0029"; 50229 t["\u2481"] = "\u0028\u0031\u0034\u0029"; 50230 t["\u2482"] = "\u0028\u0031\u0035\u0029"; 50231 t["\u2483"] = "\u0028\u0031\u0036\u0029"; 50232 t["\u2484"] = "\u0028\u0031\u0037\u0029"; 50233 t["\u2485"] = "\u0028\u0031\u0038\u0029"; 50234 t["\u2486"] = "\u0028\u0031\u0039\u0029"; 50235 t["\u2487"] = "\u0028\u0032\u0030\u0029"; 50236 t["\u2488"] = "\u0031\u002E"; 50237 t["\u2489"] = "\u0032\u002E"; 50238 t["\u248A"] = "\u0033\u002E"; 50239 t["\u248B"] = "\u0034\u002E"; 50240 t["\u248C"] = "\u0035\u002E"; 50241 t["\u248D"] = "\u0036\u002E"; 50242 t["\u248E"] = "\u0037\u002E"; 50243 t["\u248F"] = "\u0038\u002E"; 50244 t["\u2490"] = "\u0039\u002E"; 50245 t["\u2491"] = "\u0031\u0030\u002E"; 50246 t["\u2492"] = "\u0031\u0031\u002E"; 50247 t["\u2493"] = "\u0031\u0032\u002E"; 50248 t["\u2494"] = "\u0031\u0033\u002E";
50249 t["\u2495"] = "\u0031\u0034\u002E"; 50250 t["\u2496"] = "\u0031\u0035\u002E"; 50251 t["\u2497"] = "\u0031\u0036\u002E"; 50252 t["\u2498"] = "\u0031\u0037\u002E"; 50253 t["\u2499"] = "\u0031\u0038\u002E"; 50254 t["\u249A"] = "\u0031\u0039\u002E"; 50255 t["\u249B"] = "\u0032\u0030\u002E"; 50256 t["\u249C"] = "\u0028\u0061\u0029"; 50257 t["\u249D"] = "\u0028\u0062\u0029"; 50258 t["\u249E"] = "\u0028\u0063\u0029"; 50259 t["\u249F"] = "\u0028\u0064\u0029"; 50260 t["\u24A0"] = "\u0028\u0065\u0029"; 50261 t["\u24A1"] = "\u0028\u0066\u0029"; 50262 t["\u24A2"] = "\u0028\u0067\u0029"; 50263 t["\u24A3"] = "\u0028\u0068\u0029"; 50264 t["\u24A4"] = "\u0028\u0069\u0029"; 50265 t["\u24A5"] = "\u0028\u006A\u0029"; 50266 t["\u24A6"] = "\u0028\u006B\u0029"; 50267 t["\u24A7"] = "\u0028\u006C\u0029"; 50268 t["\u24A8"] = "\u0028\u006D\u0029"; 50269 t["\u24A9"] = "\u0028\u006E\u0029"; 50270 t["\u24AA"] = "\u0028\u006F\u0029"; 50271 t["\u24AB"] = "\u0028\u0070\u0029"; 50272 t["\u24AC"] = "\u0028\u0071\u0029"; 50273 t["\u24AD"] = "\u0028\u0072\u0029"; 50274 t["\u24AE"] = "\u0028\u0073\u0029"; 50275 t["\u24AF"] = "\u0028\u0074\u0029"; 50276 t["\u24B0"] = "\u0028\u0075\u0029"; 50277 t["\u24B1"] = "\u0028\u0076\u0029"; 50278 t["\u24B2"] = "\u0028\u0077\u0029"; 50279 t["\u24B3"] = "\u0028\u0078\u0029"; 50280 t["\u24B4"] = "\u0028\u0079\u0029"; 50281 t["\u24B5"] = "\u0028\u007A\u0029"; 50282 t["\u2A0C"] = "\u222B\u222B\u222B\u222B"; 50283 t["\u2A74"] = "\u003A\u003A\u003D"; 50284 t["\u2A75"] = "\u003D\u003D"; 50285 t["\u2A76"] = "\u003D\u003D\u003D"; 50286 t["\u2E9F"] = "\u6BCD"; 50287 t["\u2EF3"] = "\u9F9F"; 50288 t["\u2F00"] = "\u4E00"; 50289 t["\u2F01"] = "\u4E28"; 50290 t["\u2F02"] = "\u4E36"; 50291 t["\u2F03"] = "\u4E3F"; 50292 t["\u2F04"] = "\u4E59"; 50293 t["\u2F05"] = "\u4E85"; 50294 t["\u2F06"] = "\u4E8C"; 50295 t["\u2F07"] = "\u4EA0"; 50296 t["\u2F08"] = "\u4EBA"; 50297 t["\u2F09"] = "\u513F"; 50298 t["\u2F0A"] = "\u5165"; 50299 t["\u2F0B"] = "\u516B"; 50300 t["\u2F0C"] = "\u5182"; 50301 t["\u2F0D"] = "\u5196"; 50302 t["\u2F0E"] = "\u51AB"; 50303 t["\u2F0F"] = "\u51E0"; 50304 t["\u2F10"] = "\u51F5"; 50305 t["\u2F11"] = "\u5200"; 50306 t["\u2F12"] = "\u529B"; 50307 t["\u2F13"] = "\u52F9"; 50308 t["\u2F14"] = "\u5315"; 50309 t["\u2F15"] = "\u531A"; 50310 t["\u2F16"] = "\u5338"; 50311 t["\u2F17"] = "\u5341"; 50312 t["\u2F18"] = "\u535C"; 50313 t["\u2F19"] = "\u5369"; 50314 t["\u2F1A"] = "\u5382"; 50315 t["\u2F1B"] = "\u53B6"; 50316 t["\u2F1C"] = "\u53C8"; 50317 t["\u2F1D"] = "\u53E3"; 50318 t["\u2F1E"] = "\u56D7"; 50319 t["\u2F1F"] = "\u571F"; 50320 t["\u2F20"] = "\u58EB"; 50321 t["\u2F21"] = "\u5902"; 50322 t["\u2F22"] = "\u590A"; 50323 t["\u2F23"] = "\u5915"; 50324 t["\u2F24"] = "\u5927"; 50325 t["\u2F25"] = "\u5973"; 50326 t["\u2F26"] = "\u5B50"; 50327 t["\u2F27"] = "\u5B80"; 50328 t["\u2F28"] = "\u5BF8"; 50329 t["\u2F29"] = "\u5C0F"; 50330 t["\u2F2A"] = "\u5C22"; 50331 t["\u2F2B"] = "\u5C38"; 50332 t["\u2F2C"] = "\u5C6E"; 50333 t["\u2F2D"] = "\u5C71"; 50334 t["\u2F2E"] = "\u5DDB"; 50335 t["\u2F2F"] = "\u5DE5"; 50336 t["\u2F30"] = "\u5DF1"; 50337 t["\u2F31"] = "\u5DFE"; 50338 t["\u2F32"] = "\u5E72"; 50339 t["\u2F33"] = "\u5E7A"; 50340 t["\u2F34"] = "\u5E7F"; 50341 t["\u2F35"] = "\u5EF4"; 50342 t["\u2F36"] = "\u5EFE"; 50343 t["\u2F37"] = "\u5F0B"; 50344 t["\u2F38"] = "\u5F13"; 50345 t["\u2F39"] = "\u5F50"; 50346 t["\u2F3A"] = "\u5F61"; 50347 t["\u2F3B"] = "\u5F73"; 50348 t["\u2F3C"] = "\u5FC3";
50349 t["\u2F3D"] = "\u6208"; 50350 t["\u2F3E"] = "\u6236"; 50351 t["\u2F3F"] = "\u624B"; 50352 t["\u2F40"] = "\u652F"; 50353 t["\u2F41"] = "\u6534"; 50354 t["\u2F42"] = "\u6587"; 50355 t["\u2F43"] = "\u6597"; 50356 t["\u2F44"] = "\u65A4"; 50357 t["\u2F45"] = "\u65B9"; 50358 t["\u2F46"] = "\u65E0"; 50359 t["\u2F47"] = "\u65E5"; 50360 t["\u2F48"] = "\u66F0"; 50361 t["\u2F49"] = "\u6708"; 50362 t["\u2F4A"] = "\u6728"; 50363 t["\u2F4B"] = "\u6B20"; 50364 t["\u2F4C"] = "\u6B62"; 50365 t["\u2F4D"] = "\u6B79"; 50366 t["\u2F4E"] = "\u6BB3"; 50367 t["\u2F4F"] = "\u6BCB"; 50368 t["\u2F50"] = "\u6BD4"; 50369 t["\u2F51"] = "\u6BDB"; 50370 t["\u2F52"] = "\u6C0F"; 50371 t["\u2F53"] = "\u6C14"; 50372 t["\u2F54"] = "\u6C34"; 50373 t["\u2F55"] = "\u706B"; 50374 t["\u2F56"] = "\u722A"; 50375 t["\u2F57"] = "\u7236"; 50376 t["\u2F58"] = "\u723B"; 50377 t["\u2F59"] = "\u723F"; 50378 t["\u2F5A"] = "\u7247"; 50379 t["\u2F5B"] = "\u7259"; 50380 t["\u2F5C"] = "\u725B"; 50381 t["\u2F5D"] = "\u72AC"; 50382 t["\u2F5E"] = "\u7384"; 50383 t["\u2F5F"] = "\u7389"; 50384 t["\u2F60"] = "\u74DC"; 50385 t["\u2F61"] = "\u74E6"; 50386 t["\u2F62"] = "\u7518"; 50387 t["\u2F63"] = "\u751F"; 50388 t["\u2F64"] = "\u7528"; 50389 t["\u2F65"] = "\u7530"; 50390 t["\u2F66"] = "\u758B"; 50391 t["\u2F67"] = "\u7592"; 50392 t["\u2F68"] = "\u7676"; 50393 t["\u2F69"] = "\u767D"; 50394 t["\u2F6A"] = "\u76AE"; 50395 t["\u2F6B"] = "\u76BF"; 50396 t["\u2F6C"] = "\u76EE"; 50397 t["\u2F6D"] = "\u77DB"; 50398 t["\u2F6E"] = "\u77E2"; 50399 t["\u2F6F"] = "\u77F3"; 50400 t["\u2F70"] = "\u793A"; 50401 t["\u2F71"] = "\u79B8"; 50402 t["\u2F72"] = "\u79BE"; 50403 t["\u2F73"] = "\u7A74"; 50404 t["\u2F74"] = "\u7ACB"; 50405 t["\u2F75"] = "\u7AF9"; 50406 t["\u2F76"] = "\u7C73"; 50407 t["\u2F77"] = "\u7CF8"; 50408 t["\u2F78"] = "\u7F36"; 50409 t["\u2F79"] = "\u7F51"; 50410 t["\u2F7A"] = "\u7F8A"; 50411 t["\u2F7B"] = "\u7FBD"; 50412 t["\u2F7C"] = "\u8001"; 50413 t["\u2F7D"] = "\u800C"; 50414 t["\u2F7E"] = "\u8012"; 50415 t["\u2F7F"] = "\u8033"; 50416 t["\u2F80"] = "\u807F"; 50417 t["\u2F81"] = "\u8089"; 50418 t["\u2F82"] = "\u81E3"; 50419 t["\u2F83"] = "\u81EA"; 50420 t["\u2F84"] = "\u81F3"; 50421 t["\u2F85"] = "\u81FC"; 50422 t["\u2F86"] = "\u820C"; 50423 t["\u2F87"] = "\u821B"; 50424 t["\u2F88"] = "\u821F"; 50425 t["\u2F89"] = "\u826E"; 50426 t["\u2F8A"] = "\u8272"; 50427 t["\u2F8B"] = "\u8278"; 50428 t["\u2F8C"] = "\u864D"; 50429 t["\u2F8D"] = "\u866B"; 50430 t["\u2F8E"] = "\u8840"; 50431 t["\u2F8F"] = "\u884C"; 50432 t["\u2F90"] = "\u8863"; 50433 t["\u2F91"] = "\u897E"; 50434 t["\u2F92"] = "\u898B"; 50435 t["\u2F93"] = "\u89D2"; 50436 t["\u2F94"] = "\u8A00"; 50437 t["\u2F95"] = "\u8C37"; 50438 t["\u2F96"] = "\u8C46"; 50439 t["\u2F97"] = "\u8C55"; 50440 t["\u2F98"] = "\u8C78"; 50441 t["\u2F99"] = "\u8C9D"; 50442 t["\u2F9A"] = "\u8D64"; 50443 t["\u2F9B"] = "\u8D70"; 50444 t["\u2F9C"] = "\u8DB3"; 50445 t["\u2F9D"] = "\u8EAB"; 50446 t["\u2F9E"] = "\u8ECA"; 50447 t["\u2F9F"] = "\u8F9B"; 50448 t["\u2FA0"] = "\u8FB0"; 50449 t["\u2FA1"] = "\u8FB5"; 50450 t["\u2FA2"] = "\u9091"; 50451 t["\u2FA3"] = "\u9149"; 50452 t["\u2FA4"] = "\u91C6"; 50453 t["\u2FA5"] = "\u91CC"; 50454 t["\u2FA6"] = "\u91D1"; 50455 t["\u2FA7"] = "\u9577"; 50456 t["\u2FA8"] = "\u9580"; 50457 t["\u2FA9"] = "\u961C"; 50458 t["\u2FAA"] = "\u96B6"; 50459 t["\u2FAB"] = "\u96B9"; 50460 t["\u2FAC"] = "\u96E8"; 50461 t["\u2FAD"] = "\u9751"; 50462 t["\u2FAE"] = "\u975E"; 50463 t["\u2FAF"] = "\u9762"; 50464 t["\u2FB0"] = "\u9769"; 50465 t["\u2FB1"] = "\u97CB"; 50466 t["\u2FB2"] = "\u97ED"; 50467 t["\u2FB3"] = "\u97F3"; 50468 t["\u2FB4"] = "\u9801"; 50469 t["\u2FB5"] = "\u98A8"; 50470 t["\u2FB6"] = "\u98DB"; 50471 t["\u2FB7"] = "\u98DF"; 50472 t["\u2FB8"] = "\u9996"; 50473 t["\u2FB9"] = "\u9999"; 50474 t["\u2FBA"] = "\u99AC"; 50475 t["\u2FBB"] = "\u9AA8"; 50476 t["\u2FBC"] = "\u9AD8"; 50477 t["\u2FBD"] = "\u9ADF"; 50478 t["\u2FBE"] = "\u9B25"; 50479 t["\u2FBF"] = "\u9B2F"; 50480 t["\u2FC0"] = "\u9B32"; 50481 t["\u2FC1"] = "\u9B3C"; 50482 t["\u2FC2"] = "\u9B5A"; 50483 t["\u2FC3"] = "\u9CE5"; 50484 t["\u2FC4"] = "\u9E75"; 50485 t["\u2FC5"] = "\u9E7F"; 50486 t["\u2FC6"] = "\u9EA5"; 50487 t["\u2FC7"] = "\u9EBB"; 50488 t["\u2FC8"] = "\u9EC3"; 50489 t["\u2FC9"] = "\u9ECD"; 50490 t["\u2FCA"] = "\u9ED1"; 50491 t["\u2FCB"] = "\u9EF9"; 50492 t["\u2FCC"] = "\u9EFD"; 50493 t["\u2FCD"] = "\u9F0E"; 50494 t["\u2FCE"] = "\u9F13"; 50495 t["\u2FCF"] = "\u9F20"; 50496 t["\u2FD0"] = "\u9F3B"; 50497 t["\u2FD1"] = "\u9F4A"; 50498 t["\u2FD2"] = "\u9F52"; 50499 t["\u2FD3"] = "\u9F8D"; 50500 t["\u2FD4"] = "\u9F9C"; 50501 t["\u2FD5"] = "\u9FA0"; 50502 t["\u3036"] = "\u3012"; 50503 t["\u3038"] = "\u5341"; 50504 t["\u3039"] = "\u5344"; 50505 t["\u303A"] = "\u5345"; 50506 t["\u309B"] = "\u0020\u3099"; 50507 t["\u309C"] = "\u0020\u309A"; 50508 t["\u3131"] = "\u1100"; 50509 t["\u3132"] = "\u1101"; 50510 t["\u3133"] = "\u11AA"; 50511 t["\u3134"] = "\u1102"; 50512 t["\u3135"] = "\u11AC"; 50513 t["\u3136"] = "\u11AD"; 50514 t["\u3137"] = "\u1103"; 50515 t["\u3138"] = "\u1104"; 50516 t["\u3139"] = "\u1105"; 50517 t["\u313A"] = "\u11B0"; 50518 t["\u313B"] = "\u11B1"; 50519 t["\u313C"] = "\u11B2"; 50520 t["\u313D"] = "\u11B3"; 50521 t["\u313E"] = "\u11B4"; 50522 t["\u313F"] = "\u11B5"; 50523 t["\u3140"] = "\u111A"; 50524 t["\u3141"] = "\u1106"; 50525 t["\u3142"] = "\u1107"; 50526 t["\u3143"] = "\u1108"; 50527 t["\u3144"] = "\u1121"; 50528 t["\u3145"] = "\u1109"; 50529 t["\u3146"] = "\u110A"; 50530 t["\u3147"] = "\u110B"; 50531 t["\u3148"] = "\u110C"; 50532 t["\u3149"] = "\u110D"; 50533 t["\u314A"] = "\u110E"; 50534 t["\u314B"] = "\u110F"; 50535 t["\u314C"] = "\u1110"; 50536 t["\u314D"] = "\u1111"; 50537 t["\u314E"] = "\u1112"; 50538 t["\u314F"] = "\u1161"; 50539 t["\u3150"] = "\u1162";
50540 t["\u3151"] = "\u1163"; 50541 t["\u3152"] = "\u1164"; 50542 t["\u3153"] = "\u1165"; 50543 t["\u3154"] = "\u1166"; 50544 t["\u3155"] = "\u1167"; 50545 t["\u3156"] = "\u1168"; 50546 t["\u3157"] = "\u1169"; 50547 t["\u3158"] = "\u116A"; 50548 t["\u3159"] = "\u116B"; 50549 t["\u315A"] = "\u116C"; 50550 t["\u315B"] = "\u116D"; 50551 t["\u315C"] = "\u116E"; 50552 t["\u315D"] = "\u116F"; 50553 t["\u315E"] = "\u1170"; 50554 t["\u315F"] = "\u1171"; 50555 t["\u3160"] = "\u1172"; 50556 t["\u3161"] = "\u1173"; 50557 t["\u3162"] = "\u1174"; 50558 t["\u3163"] = "\u1175"; 50559 t["\u3164"] = "\u1160"; 50560 t["\u3165"] = "\u1114"; 50561 t["\u3166"] = "\u1115"; 50562 t["\u3167"] = "\u11C7"; 50563 t["\u3168"] = "\u11C8"; 50564 t["\u3169"] = "\u11CC"; 50565 t["\u316A"] = "\u11CE"; 50566 t["\u316B"] = "\u11D3"; 50567 t["\u316C"] = "\u11D7"; 50568 t["\u316D"] = "\u11D9"; 50569 t["\u316E"] = "\u111C"; 50570 t["\u316F"] = "\u11DD"; 50571 t["\u3170"] = "\u11DF"; 50572 t["\u3171"] = "\u111D"; 50573 t["\u3172"] = "\u111E"; 50574 t["\u3173"] = "\u1120"; 50575 t["\u3174"] = "\u1122"; 50576 t["\u3175"] = "\u1123"; 50577 t["\u3176"] = "\u1127"; 50578 t["\u3177"] = "\u1129"; 50579 t["\u3178"] = "\u112B"; 50580 t["\u3179"] = "\u112C"; 50581 t["\u317A"] = "\u112D"; 50582 t["\u317B"] = "\u112E"; 50583 t["\u317C"] = "\u112F"; 50584 t["\u317D"] = "\u1132"; 50585 t["\u317E"] = "\u1136"; 50586 t["\u317F"] = "\u1140"; 50587 t["\u3180"] = "\u1147"; 50588 t["\u3181"] = "\u114C"; 50589 t["\u3182"] = "\u11F1"; 50590 t["\u3183"] = "\u11F2"; 50591 t["\u3184"] = "\u1157"; 50592 t["\u3185"] = "\u1158"; 50593 t["\u3186"] = "\u1159"; 50594 t["\u3187"] = "\u1184"; 50595 t["\u3188"] = "\u1185"; 50596 t["\u3189"] = "\u1188"; 50597 t["\u318A"] = "\u1191"; 50598 t["\u318B"] = "\u1192"; 50599 t["\u318C"] = "\u1194"; 50600 t["\u318D"] = "\u119E"; 50601 t["\u318E"] = "\u11A1"; 50602 t["\u3200"] = "\u0028\u1100\u0029"; 50603 t["\u3201"] = "\u0028\u1102\u0029"; 50604 t["\u3202"] = "\u0028\u1103\u0029"; 50605 t["\u3203"] = "\u0028\u1105\u0029"; 50606 t["\u3204"] = "\u0028\u1106\u0029"; 50607 t["\u3205"] = "\u0028\u1107\u0029"; 50608 t["\u3206"] = "\u0028\u1109\u0029"; 50609 t["\u3207"] = "\u0028\u110B\u0029"; 50610 t["\u3208"] = "\u0028\u110C\u0029"; 50611 t["\u3209"] = "\u0028\u110E\u0029"; 50612 t["\u320A"] = "\u0028\u110F\u0029"; 50613 t["\u320B"] = "\u0028\u1110\u0029"; 50614 t["\u320C"] = "\u0028\u1111\u0029"; 50615 t["\u320D"] = "\u0028\u1112\u0029"; 50616 t["\u320E"] = "\u0028\u1100\u1161\u0029"; 50617 t["\u320F"] = "\u0028\u1102\u1161\u0029"; 50618 t["\u3210"] = "\u0028\u1103\u1161\u0029"; 50619 t["\u3211"] = "\u0028\u1105\u1161\u0029"; 50620 t["\u3212"] = "\u0028\u1106\u1161\u0029"; 50621 t["\u3213"] = "\u0028\u1107\u1161\u0029"; 50622 t["\u3214"] = "\u0028\u1109\u1161\u0029"; 50623 t["\u3215"] = "\u0028\u110B\u1161\u0029"; 50624 t["\u3216"] = "\u0028\u110C\u1161\u0029"; 50625 t["\u3217"] = "\u0028\u110E\u1161\u0029"; 50626 t["\u3218"] = "\u0028\u110F\u1161\u0029"; 50627 t["\u3219"] = "\u0028\u1110\u1161\u0029"; 50628 t["\u321A"] = "\u0028\u1111\u1161\u0029"; 50629 t["\u321B"] = "\u0028\u1112\u1161\u0029"; 50630 t["\u321C"] = "\u0028\u110C\u116E\u0029"; 50631 t["\u321D"] = "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029"; 50632 t["\u321E"] = "\u0028\u110B\u1169\u1112\u116E\u0029"; 50633 t["\u3220"] = "\u0028\u4E00\u0029"; 50634 t["\u3221"] = "\u0028\u4E8C\u0029"; 50635 t["\u3222"] = "\u0028\u4E09\u0029"; 50636 t["\u3223"] = "\u0028\u56DB\u0029"; 50637 t["\u3224"] = "\u0028\u4E94\u0029"; 50638 t["\u3225"] = "\u0028\u516D\u0029"; 50639 t["\u3226"] = "\u0028\u4E03\u0029"; 50640 t["\u3227"] = "\u0028\u516B\u0029"; 50641 t["\u3228"] = "\u0028\u4E5D\u0029"; 50642 t["\u3229"] = "\u0028\u5341\u0029"; 50643 t["\u322A"] = "\u0028\u6708\u0029"; 50644 t["\u322B"] = "\u0028\u706B\u0029"; 50645 t["\u322C"] = "\u0028\u6C34\u0029"; 50646 t["\u322D"] = "\u0028\u6728\u0029"; 50647 t["\u322E"] = "\u0028\u91D1\u0029"; 50648 t["\u322F"] = "\u0028\u571F\u0029"; 50649 t["\u3230"] = "\u0028\u65E5\u0029"; 50650 t["\u3231"] = "\u0028\u682A\u0029"; 50651 t["\u3232"] = "\u0028\u6709\u0029"; 50652 t["\u3233"] = "\u0028\u793E\u0029"; 50653 t["\u3234"] = "\u0028\u540D\u0029"; 50654 t["\u3235"] = "\u0028\u7279\u0029"; 50655 t["\u3236"] = "\u0028\u8CA1\u0029"; 50656 t["\u3237"] = "\u0028\u795D\u0029"; 50657 t["\u3238"] = "\u0028\u52B4\u0029"; 50658 t["\u3239"] = "\u0028\u4EE3\u0029"; 50659 t["\u323A"] = "\u0028\u547C\u0029"; 50660 t["\u323B"] = "\u0028\u5B66\u0029"; 50661 t["\u323C"] = "\u0028\u76E3\u0029"; 50662 t["\u323D"] = "\u0028\u4F01\u0029"; 50663 t["\u323E"] = "\u0028\u8CC7\u0029"; 50664 t["\u323F"] = "\u0028\u5354\u0029"; 50665 t["\u3240"] = "\u0028\u796D\u0029"; 50666 t["\u3241"] = "\u0028\u4F11\u0029"; 50667 t["\u3242"] = "\u0028\u81EA\u0029"; 50668 t["\u3243"] = "\u0028\u81F3\u0029"; 50669 t["\u32C0"] = "\u0031\u6708";
50670 t["\u32C1"] = "\u0032\u6708"; 50671 t["\u32C2"] = "\u0033\u6708"; 50672 t["\u32C3"] = "\u0034\u6708"; 50673 t["\u32C4"] = "\u0035\u6708"; 50674 t["\u32C5"] = "\u0036\u6708"; 50675 t["\u32C6"] = "\u0037\u6708"; 50676 t["\u32C7"] = "\u0038\u6708"; 50677 t["\u32C8"] = "\u0039\u6708"; 50678 t["\u32C9"] = "\u0031\u0030\u6708"; 50679 t["\u32CA"] = "\u0031\u0031\u6708"; 50680 t["\u32CB"] = "\u0031\u0032\u6708"; 50681 t["\u3358"] = "\u0030\u70B9"; 50682 t["\u3359"] = "\u0031\u70B9"; 50683 t["\u335A"] = "\u0032\u70B9"; 50684 t["\u335B"] = "\u0033\u70B9"; 50685 t["\u335C"] = "\u0034\u70B9"; 50686 t["\u335D"] = "\u0035\u70B9"; 50687 t["\u335E"] = "\u0036\u70B9"; 50688 t["\u335F"] = "\u0037\u70B9"; 50689 t["\u3360"] = "\u0038\u70B9"; 50690 t["\u3361"] = "\u0039\u70B9"; 50691 t["\u3362"] = "\u0031\u0030\u70B9"; 50692 t["\u3363"] = "\u0031\u0031\u70B9"; 50693 t["\u3364"] = "\u0031\u0032\u70B9"; 50694 t["\u3365"] = "\u0031\u0033\u70B9"; 50695 t["\u3366"] = "\u0031\u0034\u70B9"; 50696 t["\u3367"] = "\u0031\u0035\u70B9"; 50697 t["\u3368"] = "\u0031\u0036\u70B9"; 50698 t["\u3369"] = "\u0031\u0037\u70B9"; 50699 t["\u336A"] = "\u0031\u0038\u70B9"; 50700 t["\u336B"] = "\u0031\u0039\u70B9"; 50701 t["\u336C"] = "\u0032\u0030\u70B9"; 50702 t["\u336D"] = "\u0032\u0031\u70B9"; 50703 t["\u336E"] = "\u0032\u0032\u70B9"; 50704 t["\u336F"] = "\u0032\u0033\u70B9"; 50705 t["\u3370"] = "\u0032\u0034\u70B9"; 50706 t["\u33E0"] = "\u0031\u65E5"; 50707 t["\u33E1"] = "\u0032\u65E5"; 50708 t["\u33E2"] = "\u0033\u65E5"; 50709 t["\u33E3"] = "\u0034\u65E5"; 50710 t["\u33E4"] = "\u0035\u65E5"; 50711 t["\u33E5"] = "\u0036\u65E5"; 50712 t["\u33E6"] = "\u0037\u65E5"; 50713 t["\u33E7"] = "\u0038\u65E5"; 50714 t["\u33E8"] = "\u0039\u65E5"; 50715 t["\u33E9"] = "\u0031\u0030\u65E5"; 50716 t["\u33EA"] = "\u0031\u0031\u65E5"; 50717 t["\u33EB"] = "\u0031\u0032\u65E5"; 50718 t["\u33EC"] = "\u0031\u0033\u65E5"; 50719 t["\u33ED"] = "\u0031\u0034\u65E5"; 50720 t["\u33EE"] = "\u0031\u0035\u65E5"; 50721 t["\u33EF"] = "\u0031\u0036\u65E5"; 50722 t["\u33F0"] = "\u0031\u0037\u65E5"; 50723 t["\u33F1"] = "\u0031\u0038\u65E5"; 50724 t["\u33F2"] = "\u0031\u0039\u65E5"; 50725 t["\u33F3"] = "\u0032\u0030\u65E5"; 50726 t["\u33F4"] = "\u0032\u0031\u65E5"; 50727 t["\u33F5"] = "\u0032\u0032\u65E5"; 50728 t["\u33F6"] = "\u0032\u0033\u65E5"; 50729 t["\u33F7"] = "\u0032\u0034\u65E5"; 50730 t["\u33F8"] = "\u0032\u0035\u65E5"; 50731 t["\u33F9"] = "\u0032\u0036\u65E5"; 50732 t["\u33FA"] = "\u0032\u0037\u65E5"; 50733 t["\u33FB"] = "\u0032\u0038\u65E5"; 50734 t["\u33FC"] = "\u0032\u0039\u65E5"; 50735 t["\u33FD"] = "\u0033\u0030\u65E5"; 50736 t["\u33FE"] = "\u0033\u0031\u65E5"; 50737 t["\uFB00"] = "\u0066\u0066"; 50738 t["\uFB01"] = "\u0066\u0069"; 50739 t["\uFB02"] = "\u0066\u006C"; 50740 t["\uFB03"] = "\u0066\u0066\u0069"; 50741 t["\uFB04"] = "\u0066\u0066\u006C"; 50742 t["\uFB05"] = "\u017F\u0074"; 50743 t["\uFB06"] = "\u0073\u0074"; 50744 t["\uFB13"] = "\u0574\u0576"; 50745 t["\uFB14"] = "\u0574\u0565"; 50746 t["\uFB15"] = "\u0574\u056B"; 50747 t["\uFB16"] = "\u057E\u0576"; 50748 t["\uFB17"] = "\u0574\u056D"; 50749 t["\uFB4F"] = "\u05D0\u05DC"; 50750 t["\uFB50"] = "\u0671"; 50751 t["\uFB51"] = "\u0671"; 50752 t["\uFB52"] = "\u067B";
50753 t["\uFB53"] = "\u067B"; 50754 t["\uFB54"] = "\u067B"; 50755 t["\uFB55"] = "\u067B"; 50756 t["\uFB56"] = "\u067E"; 50757 t["\uFB57"] = "\u067E"; 50758 t["\uFB58"] = "\u067E"; 50759 t["\uFB59"] = "\u067E"; 50760 t["\uFB5A"] = "\u0680"; 50761 t["\uFB5B"] = "\u0680"; 50762 t["\uFB5C"] = "\u0680"; 50763 t["\uFB5D"] = "\u0680"; 50764 t["\uFB5E"] = "\u067A"; 50765 t["\uFB5F"] = "\u067A"; 50766 t["\uFB60"] = "\u067A"; 50767 t["\uFB61"] = "\u067A"; 50768 t["\uFB62"] = "\u067F"; 50769 t["\uFB63"] = "\u067F"; 50770 t["\uFB64"] = "\u067F"; 50771 t["\uFB65"] = "\u067F"; 50772 t["\uFB66"] = "\u0679"; 50773 t["\uFB67"] = "\u0679"; 50774 t["\uFB68"] = "\u0679"; 50775 t["\uFB69"] = "\u0679"; 50776 t["\uFB6A"] = "\u06A4"; 50777 t["\uFB6B"] = "\u06A4"; 50778 t["\uFB6C"] = "\u06A4"; 50779 t["\uFB6D"] = "\u06A4"; 50780 t["\uFB6E"] = "\u06A6"; 50781 t["\uFB6F"] = "\u06A6"; 50782 t["\uFB70"] = "\u06A6"; 50783 t["\uFB71"] = "\u06A6"; 50784 t["\uFB72"] = "\u0684"; 50785 t["\uFB73"] = "\u0684"; 50786 t["\uFB74"] = "\u0684"; 50787 t["\uFB75"] = "\u0684"; 50788 t["\uFB76"] = "\u0683"; 50789 t["\uFB77"] = "\u0683"; 50790 t["\uFB78"] = "\u0683"; 50791 t["\uFB79"] = "\u0683"; 50792 t["\uFB7A"] = "\u0686"; 50793 t["\uFB7B"] = "\u0686"; 50794 t["\uFB7C"] = "\u0686"; 50795 t["\uFB7D"] = "\u0686"; 50796 t["\uFB7E"] = "\u0687"; 50797 t["\uFB7F"] = "\u0687"; 50798 t["\uFB80"] = "\u0687"; 50799 t["\uFB81"] = "\u0687"; 50800 t["\uFB82"] = "\u068D"; 50801 t["\uFB83"] = "\u068D"; 50802 t["\uFB84"] = "\u068C"; 50803 t["\uFB85"] = "\u068C"; 50804 t["\uFB86"] = "\u068E"; 50805 t["\uFB87"] = "\u068E"; 50806 t["\uFB88"] = "\u0688"; 50807 t["\uFB89"] = "\u0688"; 50808 t["\uFB8A"] = "\u0698"; 50809 t["\uFB8B"] = "\u0698"; 50810 t["\uFB8C"] = "\u0691"; 50811 t["\uFB8D"] = "\u0691"; 50812 t["\uFB8E"] = "\u06A9"; 50813 t["\uFB8F"] = "\u06A9"; 50814 t["\uFB90"] = "\u06A9"; 50815 t["\uFB91"] = "\u06A9"; 50816 t["\uFB92"] = "\u06AF"; 50817 t["\uFB93"] = "\u06AF"; 50818 t["\uFB94"] = "\u06AF"; 50819 t["\uFB95"] = "\u06AF"; 50820 t["\uFB96"] = "\u06B3"; 50821 t["\uFB97"] = "\u06B3"; 50822 t["\uFB98"] = "\u06B3"; 50823 t["\uFB99"] = "\u06B3"; 50824 t["\uFB9A"] = "\u06B1"; 50825 t["\uFB9B"] = "\u06B1"; 50826 t["\uFB9C"] = "\u06B1"; 50827 t["\uFB9D"] = "\u06B1"; 50828 t["\uFB9E"] = "\u06BA"; 50829 t["\uFB9F"] = "\u06BA"; 50830 t["\uFBA0"] = "\u06BB"; 50831 t["\uFBA1"] = "\u06BB"; 50832 t["\uFBA2"] = "\u06BB"; 50833 t["\uFBA3"] = "\u06BB"; 50834 t["\uFBA4"] = "\u06C0"; 50835 t["\uFBA5"] = "\u06C0"; 50836 t["\uFBA6"] = "\u06C1"; 50837 t["\uFBA7"] = "\u06C1"; 50838 t["\uFBA8"] = "\u06C1"; 50839 t["\uFBA9"] = "\u06C1"; 50840 t["\uFBAA"] = "\u06BE"; 50841 t["\uFBAB"] = "\u06BE"; 50842 t["\uFBAC"] = "\u06BE"; 50843 t["\uFBAD"] = "\u06BE"; 50844 t["\uFBAE"] = "\u06D2"; 50845 t["\uFBAF"] = "\u06D2"; 50846 t["\uFBB0"] = "\u06D3"; 50847 t["\uFBB1"] = "\u06D3"; 50848 t["\uFBD3"] = "\u06AD"; 50849 t["\uFBD4"] = "\u06AD"; 50850 t["\uFBD5"] = "\u06AD"; 50851 t["\uFBD6"] = "\u06AD"; 50852 t["\uFBD7"] = "\u06C7"; 50853 t["\uFBD8"] = "\u06C7"; 50854 t["\uFBD9"] = "\u06C6"; 50855 t["\uFBDA"] = "\u06C6"; 50856 t["\uFBDB"] = "\u06C8"; 50857 t["\uFBDC"] = "\u06C8"; 50858 t["\uFBDD"] = "\u0677"; 50859 t["\uFBDE"] = "\u06CB"; 50860 t["\uFBDF"] = "\u06CB"; 50861 t["\uFBE0"] = "\u06C5"; 50862 t["\uFBE1"] = "\u06C5"; 50863 t["\uFBE2"] = "\u06C9"; 50864 t["\uFBE3"] = "\u06C9"; 50865 t["\uFBE4"] = "\u06D0"; 50866 t["\uFBE5"] = "\u06D0"; 50867 t["\uFBE6"] = "\u06D0"; 50868 t["\uFBE7"] = "\u06D0"; 50869 t["\uFBE8"] = "\u0649"; 50870 t["\uFBE9"] = "\u0649"; 50871 t["\uFBEA"] = "\u0626\u0627"; 50872 t["\uFBEB"] = "\u0626\u0627"; 50873 t["\uFBEC"] = "\u0626\u06D5"; 50874 t["\uFBED"] = "\u0626\u06D5"; 50875 t["\uFBEE"] = "\u0626\u0648"; 50876 t["\uFBEF"] = "\u0626\u0648"; 50877 t["\uFBF0"] = "\u0626\u06C7"; 50878 t["\uFBF1"] = "\u0626\u06C7"; 50879 t["\uFBF2"] = "\u0626\u06C6"; 50880 t["\uFBF3"] = "\u0626\u06C6"; 50881 t["\uFBF4"] = "\u0626\u06C8"; 50882 t["\uFBF5"] = "\u0626\u06C8"; 50883 t["\uFBF6"] = "\u0626\u06D0"; 50884 t["\uFBF7"] = "\u0626\u06D0"; 50885 t["\uFBF8"] = "\u0626\u06D0"; 50886 t["\uFBF9"] = "\u0626\u0649"; 50887 t["\uFBFA"] = "\u0626\u0649"; 50888 t["\uFBFB"] = "\u0626\u0649"; 50889 t["\uFBFC"] = "\u06CC"; 50890 t["\uFBFD"] = "\u06CC"; 50891 t["\uFBFE"] = "\u06CC"; 50892 t["\uFBFF"] = "\u06CC"; 50893 t["\uFC00"] = "\u0626\u062C"; 50894 t["\uFC01"] = "\u0626\u062D"; 50895 t["\uFC02"] = "\u0626\u0645"; 50896 t["\uFC03"] = "\u0626\u0649"; 50897 t["\uFC04"] = "\u0626\u064A"; 50898 t["\uFC05"] = "\u0628\u062C"; 50899 t["\uFC06"] = "\u0628\u062D"; 50900 t["\uFC07"] = "\u0628\u062E"; 50901 t["\uFC08"] = "\u0628\u0645"; 50902 t["\uFC09"] = "\u0628\u0649"; 50903 t["\uFC0A"] = "\u0628\u064A"; 50904 t["\uFC0B"] = "\u062A\u062C"; 50905 t["\uFC0C"] = "\u062A\u062D"; 50906 t["\uFC0D"] = "\u062A\u062E"; 50907 t["\uFC0E"] = "\u062A\u0645"; 50908 t["\uFC0F"] = "\u062A\u0649"; 50909 t["\uFC10"] = "\u062A\u064A"; 50910 t["\uFC11"] = "\u062B\u062C"; 50911 t["\uFC12"] = "\u062B\u0645"; 50912 t["\uFC13"] = "\u062B\u0649"; 50913 t["\uFC14"] = "\u062B\u064A"; 50914 t["\uFC15"] = "\u062C\u062D"; 50915 t["\uFC16"] = "\u062C\u0645"; 50916 t["\uFC17"] = "\u062D\u062C"; 50917 t["\uFC18"] = "\u062D\u0645"; 50918 t["\uFC19"] = "\u062E\u062C"; 50919 t["\uFC1A"] = "\u062E\u062D"; 50920 t["\uFC1B"] = "\u062E\u0645";
50921 t["\uFC1C"] = "\u0633\u062C"; 50922 t["\uFC1D"] = "\u0633\u062D"; 50923 t["\uFC1E"] = "\u0633\u062E"; 50924 t["\uFC1F"] = "\u0633\u0645"; 50925 t["\uFC20"] = "\u0635\u062D"; 50926 t["\uFC21"] = "\u0635\u0645"; 50927 t["\uFC22"] = "\u0636\u062C"; 50928 t["\uFC23"] = "\u0636\u062D"; 50929 t["\uFC24"] = "\u0636\u062E"; 50930 t["\uFC25"] = "\u0636\u0645"; 50931 t["\uFC26"] = "\u0637\u062D"; 50932 t["\uFC27"] = "\u0637\u0645"; 50933 t["\uFC28"] = "\u0638\u0645"; 50934 t["\uFC29"] = "\u0639\u062C"; 50935 t["\uFC2A"] = "\u0639\u0645"; 50936 t["\uFC2B"] = "\u063A\u062C"; 50937 t["\uFC2C"] = "\u063A\u0645"; 50938 t["\uFC2D"] = "\u0641\u062C"; 50939 t["\uFC2E"] = "\u0641\u062D"; 50940 t["\uFC2F"] = "\u0641\u062E"; 50941 t["\uFC30"] = "\u0641\u0645"; 50942 t["\uFC31"] = "\u0641\u0649"; 50943 t["\uFC32"] = "\u0641\u064A"; 50944 t["\uFC33"] = "\u0642\u062D"; 50945 t["\uFC34"] = "\u0642\u0645"; 50946 t["\uFC35"] = "\u0642\u0649"; 50947 t["\uFC36"] = "\u0642\u064A"; 50948 t["\uFC37"] = "\u0643\u0627"; 50949 t["\uFC38"] = "\u0643\u062C"; 50950 t["\uFC39"] = "\u0643\u062D"; 50951 t["\uFC3A"] = "\u0643\u062E"; 50952 t["\uFC3B"] = "\u0643\u0644"; 50953 t["\uFC3C"] = "\u0643\u0645"; 50954 t["\uFC3D"] = "\u0643\u0649"; 50955 t["\uFC3E"] = "\u0643\u064A"; 50956 t["\uFC3F"] = "\u0644\u062C"; 50957 t["\uFC40"] = "\u0644\u062D"; 50958 t["\uFC41"] = "\u0644\u062E"; 50959 t["\uFC42"] = "\u0644\u0645"; 50960 t["\uFC43"] = "\u0644\u0649"; 50961 t["\uFC44"] = "\u0644\u064A"; 50962 t["\uFC45"] = "\u0645\u062C"; 50963 t["\uFC46"] = "\u0645\u062D"; 50964 t["\uFC47"] = "\u0645\u062E"; 50965 t["\uFC48"] = "\u0645\u0645"; 50966 t["\uFC49"] = "\u0645\u0649"; 50967 t["\uFC4A"] = "\u0645\u064A"; 50968 t["\uFC4B"] = "\u0646\u062C"; 50969 t["\uFC4C"] = "\u0646\u062D"; 50970 t["\uFC4D"] = "\u0646\u062E"; 50971 t["\uFC4E"] = "\u0646\u0645"; 50972 t["\uFC4F"] = "\u0646\u0649"; 50973 t["\uFC50"] = "\u0646\u064A"; 50974 t["\uFC51"] = "\u0647\u062C"; 50975 t["\uFC52"] = "\u0647\u0645"; 50976 t["\uFC53"] = "\u0647\u0649"; 50977 t["\uFC54"] = "\u0647\u064A"; 50978 t["\uFC55"] = "\u064A\u062C"; 50979 t["\uFC56"] = "\u064A\u062D"; 50980 t["\uFC57"] = "\u064A\u062E"; 50981 t["\uFC58"] = "\u064A\u0645"; 50982 t["\uFC59"] = "\u064A\u0649"; 50983 t["\uFC5A"] = "\u064A\u064A"; 50984 t["\uFC5B"] = "\u0630\u0670"; 50985 t["\uFC5C"] = "\u0631\u0670"; 50986 t["\uFC5D"] = "\u0649\u0670"; 50987 t["\uFC5E"] = "\u0020\u064C\u0651"; 50988 t["\uFC5F"] = "\u0020\u064D\u0651"; 50989 t["\uFC60"] = "\u0020\u064E\u0651"; 50990 t["\uFC61"] = "\u0020\u064F\u0651"; 50991 t["\uFC62"] = "\u0020\u0650\u0651"; 50992 t["\uFC63"] = "\u0020\u0651\u0670"; 50993 t["\uFC64"] = "\u0626\u0631"; 50994 t["\uFC65"] = "\u0626\u0632"; 50995 t["\uFC66"] = "\u0626\u0645"; 50996 t["\uFC67"] = "\u0626\u0646"; 50997 t["\uFC68"] = "\u0626\u0649"; 50998 t["\uFC69"] = "\u0626\u064A"; 50999 t["\uFC6A"] = "\u0628\u0631"; 51000 t["\uFC6B"] = "\u0628\u0632"; 51001 t["\uFC6C"] = "\u0628\u0645"; 51002 t["\uFC6D"] = "\u0628\u0646"; 51003 t["\uFC6E"] = "\u0628\u0649"; 51004 t["\uFC6F"] = "\u0628\u064A"; 51005 t["\uFC70"] = "\u062A\u0631"; 51006 t["\uFC71"] = "\u062A\u0632"; 51007 t["\uFC72"] = "\u062A\u0645"; 51008 t["\uFC73"] = "\u062A\u0646"; 51009 t["\uFC74"] = "\u062A\u0649"; 51010 t["\uFC75"] = "\u062A\u064A"; 51011 t["\uFC76"] = "\u062B\u0631"; 51012 t["\uFC77"] = "\u062B\u0632"; 51013 t["\uFC78"] = "\u062B\u0645"; 51014 t["\uFC79"] = "\u062B\u0646"; 51015 t["\uFC7A"] = "\u062B\u0649"; 51016 t["\uFC7B"] = "\u062B\u064A"; 51017 t["\uFC7C"] = "\u0641\u0649"; 51018 t["\uFC7D"] = "\u0641\u064A"; 51019 t["\uFC7E"] = "\u0642\u0649"; 51020 t["\uFC7F"] = "\u0642\u064A"; 51021 t["\uFC80"] = "\u0643\u0627"; 51022 t["\uFC81"] = "\u0643\u0644"; 51023 t["\uFC82"] = "\u0643\u0645"; 51024 t["\uFC83"] = "\u0643\u0649"; 51025 t["\uFC84"] = "\u0643\u064A"; 51026 t["\uFC85"] = "\u0644\u0645"; 51027 t["\uFC86"] = "\u0644\u0649"; 51028 t["\uFC87"] = "\u0644\u064A"; 51029 t["\uFC88"] = "\u0645\u0627"; 51030 t["\uFC89"] = "\u0645\u0645"; 51031 t["\uFC8A"] = "\u0646\u0631"; 51032 t["\uFC8B"] = "\u0646\u0632"; 51033 t["\uFC8C"] = "\u0646\u0645"; 51034 t["\uFC8D"] = "\u0646\u0646"; 51035 t["\uFC8E"] = "\u0646\u0649"; 51036 t["\uFC8F"] = "\u0646\u064A"; 51037 t["\uFC90"] = "\u0649\u0670"; 51038 t["\uFC91"] = "\u064A\u0631"; 51039 t["\uFC92"] = "\u064A\u0632"; 51040 t["\uFC93"] = "\u064A\u0645"; 51041 t["\uFC94"] = "\u064A\u0646"; 51042 t["\uFC95"] = "\u064A\u0649"; 51043 t["\uFC96"] = "\u064A\u064A"; 51044 t["\uFC97"] = "\u0626\u062C"; 51045 t["\uFC98"] = "\u0626\u062D"; 51046 t["\uFC99"] = "\u0626\u062E"; 51047 t["\uFC9A"] = "\u0626\u0645"; 51048 t["\uFC9B"] = "\u0626\u0647"; 51049 t["\uFC9C"] = "\u0628\u062C"; 51050 t["\uFC9D"] = "\u0628\u062D"; 51051 t["\uFC9E"] = "\u0628\u062E"; 51052 t["\uFC9F"] = "\u0628\u0645"; 51053 t["\uFCA0"] = "\u0628\u0647"; 51054 t["\uFCA1"] = "\u062A\u062C"; 51055 t["\uFCA2"] = "\u062A\u062D"; 51056 t["\uFCA3"] = "\u062A\u062E"; 51057 t["\uFCA4"] = "\u062A\u0645"; 51058 t["\uFCA5"] = "\u062A\u0647"; 51059 t["\uFCA6"] = "\u062B\u0645"; 51060 t["\uFCA7"] = "\u062C\u062D"; 51061 t["\uFCA8"] = "\u062C\u0645"; 51062 t["\uFCA9"] = "\u062D\u062C"; 51063 t["\uFCAA"] = "\u062D\u0645"; 51064 t["\uFCAB"] = "\u062E\u062C"; 51065 t["\uFCAC"] = "\u062E\u0645";
51066 t["\uFCAD"] = "\u0633\u062C"; 51067 t["\uFCAE"] = "\u0633\u062D"; 51068 t["\uFCAF"] = "\u0633\u062E"; 51069 t["\uFCB0"] = "\u0633\u0645"; 51070 t["\uFCB1"] = "\u0635\u062D"; 51071 t["\uFCB2"] = "\u0635\u062E"; 51072 t["\uFCB3"] = "\u0635\u0645"; 51073 t["\uFCB4"] = "\u0636\u062C"; 51074 t["\uFCB5"] = "\u0636\u062D"; 51075 t["\uFCB6"] = "\u0636\u062E"; 51076 t["\uFCB7"] = "\u0636\u0645"; 51077 t["\uFCB8"] = "\u0637\u062D"; 51078 t["\uFCB9"] = "\u0638\u0645"; 51079 t["\uFCBA"] = "\u0639\u062C"; 51080 t["\uFCBB"] = "\u0639\u0645"; 51081 t["\uFCBC"] = "\u063A\u062C"; 51082 t["\uFCBD"] = "\u063A\u0645"; 51083 t["\uFCBE"] = "\u0641\u062C"; 51084 t["\uFCBF"] = "\u0641\u062D"; 51085 t["\uFCC0"] = "\u0641\u062E"; 51086 t["\uFCC1"] = "\u0641\u0645"; 51087 t["\uFCC2"] = "\u0642\u062D"; 51088 t["\uFCC3"] = "\u0642\u0645"; 51089 t["\uFCC4"] = "\u0643\u062C"; 51090 t["\uFCC5"] = "\u0643\u062D"; 51091 t["\uFCC6"] = "\u0643\u062E"; 51092 t["\uFCC7"] = "\u0643\u0644"; 51093 t["\uFCC8"] = "\u0643\u0645"; 51094 t["\uFCC9"] = "\u0644\u062C"; 51095 t["\uFCCA"] = "\u0644\u062D"; 51096 t["\uFCCB"] = "\u0644\u062E"; 51097 t["\uFCCC"] = "\u0644\u0645"; 51098 t["\uFCCD"] = "\u0644\u0647"; 51099 t["\uFCCE"] = "\u0645\u062C"; 51100 t["\uFCCF"] = "\u0645\u062D"; 51101 t["\uFCD0"] = "\u0645\u062E"; 51102 t["\uFCD1"] = "\u0645\u0645"; 51103 t["\uFCD2"] = "\u0646\u062C"; 51104 t["\uFCD3"] = "\u0646\u062D"; 51105 t["\uFCD4"] = "\u0646\u062E"; 51106 t["\uFCD5"] = "\u0646\u0645"; 51107 t["\uFCD6"] = "\u0646\u0647"; 51108 t["\uFCD7"] = "\u0647\u062C"; 51109 t["\uFCD8"] = "\u0647\u0645"; 51110 t["\uFCD9"] = "\u0647\u0670"; 51111 t["\uFCDA"] = "\u064A\u062C"; 51112 t["\uFCDB"] = "\u064A\u062D"; 51113 t["\uFCDC"] = "\u064A\u062E"; 51114 t["\uFCDD"] = "\u064A\u0645"; 51115 t["\uFCDE"] = "\u064A\u0647"; 51116 t["\uFCDF"] = "\u0626\u0645"; 51117 t["\uFCE0"] = "\u0626\u0647"; 51118 t["\uFCE1"] = "\u0628\u0645"; 51119 t["\uFCE2"] = "\u0628\u0647"; 51120 t["\uFCE3"] = "\u062A\u0645"; 51121 t["\uFCE4"] = "\u062A\u0647"; 51122 t["\uFCE5"] = "\u062B\u0645"; 51123 t["\uFCE6"] = "\u062B\u0647"; 51124 t["\uFCE7"] = "\u0633\u0645"; 51125 t["\uFCE8"] = "\u0633\u0647"; 51126 t["\uFCE9"] = "\u0634\u0645"; 51127 t["\uFCEA"] = "\u0634\u0647"; 51128 t["\uFCEB"] = "\u0643\u0644"; 51129 t["\uFCEC"] = "\u0643\u0645"; 51130 t["\uFCED"] = "\u0644\u0645"; 51131 t["\uFCEE"] = "\u0646\u0645"; 51132 t["\uFCEF"] = "\u0646\u0647"; 51133 t["\uFCF0"] = "\u064A\u0645"; 51134 t["\uFCF1"] = "\u064A\u0647"; 51135 t["\uFCF2"] = "\u0640\u064E\u0651"; 51136 t["\uFCF3"] = "\u0640\u064F\u0651"; 51137 t["\uFCF4"] = "\u0640\u0650\u0651"; 51138 t["\uFCF5"] = "\u0637\u0649"; 51139 t["\uFCF6"] = "\u0637\u064A"; 51140 t["\uFCF7"] = "\u0639\u0649"; 51141 t["\uFCF8"] = "\u0639\u064A"; 51142 t["\uFCF9"] = "\u063A\u0649"; 51143 t["\uFCFA"] = "\u063A\u064A"; 51144 t["\uFCFB"] = "\u0633\u0649"; 51145 t["\uFCFC"] = "\u0633\u064A"; 51146 t["\uFCFD"] = "\u0634\u0649"; 51147 t["\uFCFE"] = "\u0634\u064A"; 51148 t["\uFCFF"] = "\u062D\u0649"; 51149 t["\uFD00"] = "\u062D\u064A"; 51150 t["\uFD01"] = "\u062C\u0649"; 51151 t["\uFD02"] = "\u062C\u064A"; 51152 t["\uFD03"] = "\u062E\u0649"; 51153 t["\uFD04"] = "\u062E\u064A"; 51154 t["\uFD05"] = "\u0635\u0649"; 51155 t["\uFD06"] = "\u0635\u064A"; 51156 t["\uFD07"] = "\u0636\u0649"; 51157 t["\uFD08"] = "\u0636\u064A"; 51158 t["\uFD09"] = "\u0634\u062C"; 51159 t["\uFD0A"] = "\u0634\u062D"; 51160 t["\uFD0B"] = "\u0634\u062E"; 51161 t["\uFD0C"] = "\u0634\u0645"; 51162 t["\uFD0D"] = "\u0634\u0631"; 51163 t["\uFD0E"] = "\u0633\u0631"; 51164 t["\uFD0F"] = "\u0635\u0631"; 51165 t["\uFD10"] = "\u0636\u0631"; 51166 t["\uFD11"] = "\u0637\u0649"; 51167 t["\uFD12"] = "\u0637\u064A"; 51168 t["\uFD13"] = "\u0639\u0649"; 51169 t["\uFD14"] = "\u0639\u064A"; 51170 t["\uFD15"] = "\u063A\u0649"; 51171 t["\uFD16"] = "\u063A\u064A"; 51172 t["\uFD17"] = "\u0633\u0649"; 51173 t["\uFD18"] = "\u0633\u064A"; 51174 t["\uFD19"] = "\u0634\u0649"; 51175 t["\uFD1A"] = "\u0634\u064A"; 51176 t["\uFD1B"] = "\u062D\u0649"; 51177 t["\uFD1C"] = "\u062D\u064A"; 51178 t["\uFD1D"] = "\u062C\u0649"; 51179 t["\uFD1E"] = "\u062C\u064A"; 51180 t["\uFD1F"] = "\u062E\u0649"; 51181 t["\uFD20"] = "\u062E\u064A"; 51182 t["\uFD21"] = "\u0635\u0649"; 51183 t["\uFD22"] = "\u0635\u064A"; 51184 t["\uFD23"] = "\u0636\u0649"; 51185 t["\uFD24"] = "\u0636\u064A"; 51186 t["\uFD25"] = "\u0634\u062C"; 51187 t["\uFD26"] = "\u0634\u062D"; 51188 t["\uFD27"] = "\u0634\u062E"; 51189 t["\uFD28"] = "\u0634\u0645"; 51190 t["\uFD29"] = "\u0634\u0631"; 51191 t["\uFD2A"] = "\u0633\u0631"; 51192 t["\uFD2B"] = "\u0635\u0631"; 51193 t["\uFD2C"] = "\u0636\u0631"; 51194 t["\uFD2D"] = "\u0634\u062C"; 51195 t["\uFD2E"] = "\u0634\u062D"; 51196 t["\uFD2F"] = "\u0634\u062E"; 51197 t["\uFD30"] = "\u0634\u0645"; 51198 t["\uFD31"] = "\u0633\u0647"; 51199 t["\uFD32"] = "\u0634\u0647"; 51200 t["\uFD33"] = "\u0637\u0645";
51201 t["\uFD34"] = "\u0633\u062C"; 51202 t["\uFD35"] = "\u0633\u062D"; 51203 t["\uFD36"] = "\u0633\u062E"; 51204 t["\uFD37"] = "\u0634\u062C"; 51205 t["\uFD38"] = "\u0634\u062D"; 51206 t["\uFD39"] = "\u0634\u062E"; 51207 t["\uFD3A"] = "\u0637\u0645"; 51208 t["\uFD3B"] = "\u0638\u0645"; 51209 t["\uFD3C"] = "\u0627\u064B"; 51210 t["\uFD3D"] = "\u0627\u064B"; 51211 t["\uFD50"] = "\u062A\u062C\u0645"; 51212 t["\uFD51"] = "\u062A\u062D\u062C"; 51213 t["\uFD52"] = "\u062A\u062D\u062C"; 51214 t["\uFD53"] = "\u062A\u062D\u0645"; 51215 t["\uFD54"] = "\u062A\u062E\u0645"; 51216 t["\uFD55"] = "\u062A\u0645\u062C"; 51217 t["\uFD56"] = "\u062A\u0645\u062D"; 51218 t["\uFD57"] = "\u062A\u0645\u062E"; 51219 t["\uFD58"] = "\u062C\u0645\u062D"; 51220 t["\uFD59"] = "\u062C\u0645\u062D"; 51221 t["\uFD5A"] = "\u062D\u0645\u064A"; 51222 t["\uFD5B"] = "\u062D\u0645\u0649"; 51223 t["\uFD5C"] = "\u0633\u062D\u062C"; 51224 t["\uFD5D"] = "\u0633\u062C\u062D"; 51225 t["\uFD5E"] = "\u0633\u062C\u0649"; 51226 t["\uFD5F"] = "\u0633\u0645\u062D"; 51227 t["\uFD60"] = "\u0633\u0645\u062D"; 51228 t["\uFD61"] = "\u0633\u0645\u062C"; 51229 t["\uFD62"] = "\u0633\u0645\u0645"; 51230 t["\uFD63"] = "\u0633\u0645\u0645"; 51231 t["\uFD64"] = "\u0635\u062D\u062D"; 51232 t["\uFD65"] = "\u0635\u062D\u062D"; 51233 t["\uFD66"] = "\u0635\u0645\u0645"; 51234 t["\uFD67"] = "\u0634\u062D\u0645"; 51235 t["\uFD68"] = "\u0634\u062D\u0645"; 51236 t["\uFD69"] = "\u0634\u062C\u064A"; 51237 t["\uFD6A"] = "\u0634\u0645\u062E"; 51238 t["\uFD6B"] = "\u0634\u0645\u062E"; 51239 t["\uFD6C"] = "\u0634\u0645\u0645"; 51240 t["\uFD6D"] = "\u0634\u0645\u0645"; 51241 t["\uFD6E"] = "\u0636\u062D\u0649"; 51242 t["\uFD6F"] = "\u0636\u062E\u0645"; 51243 t["\uFD70"] = "\u0636\u062E\u0645"; 51244 t["\uFD71"] = "\u0637\u0645\u062D"; 51245 t["\uFD72"] = "\u0637\u0645\u062D"; 51246 t["\uFD73"] = "\u0637\u0645\u0645"; 51247 t["\uFD74"] = "\u0637\u0645\u064A"; 51248 t["\uFD75"] = "\u0639\u062C\u0645"; 51249 t["\uFD76"] = "\u0639\u0645\u0645"; 51250 t["\uFD77"] = "\u0639\u0645\u0645"; 51251 t["\uFD78"] = "\u0639\u0645\u0649"; 51252 t["\uFD79"] = "\u063A\u0645\u0645"; 51253 t["\uFD7A"] = "\u063A\u0645\u064A"; 51254 t["\uFD7B"] = "\u063A\u0645\u0649"; 51255 t["\uFD7C"] = "\u0641\u062E\u0645"; 51256 t["\uFD7D"] = "\u0641\u062E\u0645"; 51257 t["\uFD7E"] = "\u0642\u0645\u062D"; 51258 t["\uFD7F"] = "\u0642\u0645\u0645"; 51259 t["\uFD80"] = "\u0644\u062D\u0645"; 51260 t["\uFD81"] = "\u0644\u062D\u064A"; 51261 t["\uFD82"] = "\u0644\u062D\u0649"; 51262 t["\uFD83"] = "\u0644\u062C\u062C"; 51263 t["\uFD84"] = "\u0644\u062C\u062C"; 51264 t["\uFD85"] = "\u0644\u062E\u0645"; 51265 t["\uFD86"] = "\u0644\u062E\u0645"; 51266 t["\uFD87"] = "\u0644\u0645\u062D"; 51267 t["\uFD88"] = "\u0644\u0645\u062D"; 51268 t["\uFD89"] = "\u0645\u062D\u062C"; 51269 t["\uFD8A"] = "\u0645\u062D\u0645"; 51270 t["\uFD8B"] = "\u0645\u062D\u064A"; 51271 t["\uFD8C"] = "\u0645\u062C\u062D"; 51272 t["\uFD8D"] = "\u0645\u062C\u0645"; 51273 t["\uFD8E"] = "\u0645\u062E\u062C"; 51274 t["\uFD8F"] = "\u0645\u062E\u0645"; 51275 t["\uFD92"] = "\u0645\u062C\u062E"; 51276 t["\uFD93"] = "\u0647\u0645\u062C"; 51277 t["\uFD94"] = "\u0647\u0645\u0645"; 51278 t["\uFD95"] = "\u0646\u062D\u0645"; 51279 t["\uFD96"] = "\u0646\u062D\u0649"; 51280 t["\uFD97"] = "\u0646\u062C\u0645"; 51281 t["\uFD98"] = "\u0646\u062C\u0645"; 51282 t["\uFD99"] = "\u0646\u062C\u0649"; 51283 t["\uFD9A"] = "\u0646\u0645\u064A"; 51284 t["\uFD9B"] = "\u0646\u0645\u0649"; 51285 t["\uFD9C"] = "\u064A\u0645\u0645"; 51286 t["\uFD9D"] = "\u064A\u0645\u0645"; 51287 t["\uFD9E"] = "\u0628\u062E\u064A"; 51288 t["\uFD9F"] = "\u062A\u062C\u064A"; 51289 t["\uFDA0"] = "\u062A\u062C\u0649"; 51290 t["\uFDA1"] = "\u062A\u062E\u064A"; 51291 t["\uFDA2"] = "\u062A\u062E\u0649"; 51292 t["\uFDA3"] = "\u062A\u0645\u064A"; 51293 t["\uFDA4"] = "\u062A\u0645\u0649"; 51294 t["\uFDA5"] = "\u062C\u0645\u064A"; 51295 t["\uFDA6"] = "\u062C\u062D\u0649"; 51296 t["\uFDA7"] = "\u062C\u0645\u0649"; 51297 t["\uFDA8"] = "\u0633\u062E\u0649"; 51298 t["\uFDA9"] = "\u0635\u062D\u064A"; 51299 t["\uFDAA"] = "\u0634\u062D\u064A"; 51300 t["\uFDAB"] = "\u0636\u062D\u064A"; 51301 t["\uFDAC"] = "\u0644\u062C\u064A"; 51302 t["\uFDAD"] = "\u0644\u0645\u064A"; 51303 t["\uFDAE"] = "\u064A\u062D\u064A"; 51304 t["\uFDAF"] = "\u064A\u062C\u064A"; 51305 t["\uFDB0"] = "\u064A\u0645\u064A"; 51306 t["\uFDB1"] = "\u0645\u0645\u064A"; 51307 t["\uFDB2"] = "\u0642\u0645\u064A"; 51308 t["\uFDB3"] = "\u0646\u062D\u064A"; 51309 t["\uFDB4"] = "\u0642\u0645\u062D"; 51310 t["\uFDB5"] = "\u0644\u062D\u0645"; 51311 t["\uFDB6"] = "\u0639\u0645\u064A"; 51312 t["\uFDB7"] = "\u0643\u0645\u064A"; 51313 t["\uFDB8"] = "\u0646\u062C\u062D"; 51314 t["\uFDB9"] = "\u0645\u062E\u064A"; 51315 t["\uFDBA"] = "\u0644\u062C\u0645"; 51316 t["\uFDBB"] = "\u0643\u0645\u0645"; 51317 t["\uFDBC"] = "\u0644\u062C\u0645"; 51318 t["\uFDBD"] = "\u0646\u062C\u062D"; 51319 t["\uFDBE"] = "\u062C\u062D\u064A"; 51320 t["\uFDBF"] = "\u062D\u062C\u064A"; 51321 t["\uFDC0"] = "\u0645\u062C\u064A"; 51322 t["\uFDC1"] = "\u0641\u0645\u064A"; 51323 t["\uFDC2"] = "\u0628\u062D\u064A"; 51324 t["\uFDC3"] = "\u0643\u0645\u0645"; 51325 t["\uFDC4"] = "\u0639\u062C\u0645"; 51326 t["\uFDC5"] = "\u0635\u0645\u0645"; 51327 t["\uFDC6"] = "\u0633\u062E\u064A"; 51328 t["\uFDC7"] = "\u0646\u062C\u064A"; 51329 t["\uFE49"] = "\u203E"; 51330 t["\uFE4A"] = "\u203E"; 51331 t["\uFE4B"] = "\u203E"; 51332 t["\uFE4C"] = "\u203E"; 51333 t["\uFE4D"] = "\u005F"; 51334 t["\uFE4E"] = "\u005F"; 51335 t["\uFE4F"] = "\u005F"; 51336 t["\uFE80"] = "\u0621"; 51337 t["\uFE81"] = "\u0622"; 51338 t["\uFE82"] = "\u0622"; 51339 t["\uFE83"] = "\u0623"; 51340 t["\uFE84"] = "\u0623"; 51341 t["\uFE85"] = "\u0624"; 51342 t["\uFE86"] = "\u0624"; 51343 t["\uFE87"] = "\u0625"; 51344 t["\uFE88"] = "\u0625"; 51345 t["\uFE89"] = "\u0626"; 51346 t["\uFE8A"] = "\u0626"; 51347 t["\uFE8B"] = "\u0626"; 51348 t["\uFE8C"] = "\u0626"; 51349 t["\uFE8D"] = "\u0627"; 51350 t["\uFE8E"] = "\u0627"; 51351 t["\uFE8F"] = "\u0628"; 51352 t["\uFE90"] = "\u0628"; 51353 t["\uFE91"] = "\u0628"; 51354 t["\uFE92"] = "\u0628"; 51355 t["\uFE93"] = "\u0629"; 51356 t["\uFE94"] = "\u0629"; 51357 t["\uFE95"] = "\u062A"; 51358 t["\uFE96"] = "\u062A"; 51359 t["\uFE97"] = "\u062A"; 51360 t["\uFE98"] = "\u062A"; 51361 t["\uFE99"] = "\u062B"; 51362 t["\uFE9A"] = "\u062B"; 51363 t["\uFE9B"] = "\u062B"; 51364 t["\uFE9C"] = "\u062B"; 51365 t["\uFE9D"] = "\u062C"; 51366 t["\uFE9E"] = "\u062C"; 51367 t["\uFE9F"] = "\u062C"; 51368 t["\uFEA0"] = "\u062C"; 51369 t["\uFEA1"] = "\u062D"; 51370 t["\uFEA2"] = "\u062D"; 51371 t["\uFEA3"] = "\u062D"; 51372 t["\uFEA4"] = "\u062D"; 51373 t["\uFEA5"] = "\u062E"; 51374 t["\uFEA6"] = "\u062E"; 51375 t["\uFEA7"] = "\u062E"; 51376 t["\uFEA8"] = "\u062E"; 51377 t["\uFEA9"] = "\u062F"; 51378 t["\uFEAA"] = "\u062F"; 51379 t["\uFEAB"] = "\u0630"; 51380 t["\uFEAC"] = "\u0630";
51381 t["\uFEAD"] = "\u0631"; 51382 t["\uFEAE"] = "\u0631"; 51383 t["\uFEAF"] = "\u0632"; 51384 t["\uFEB0"] = "\u0632"; 51385 t["\uFEB1"] = "\u0633"; 51386 t["\uFEB2"] = "\u0633"; 51387 t["\uFEB3"] = "\u0633"; 51388 t["\uFEB4"] = "\u0633"; 51389 t["\uFEB5"] = "\u0634"; 51390 t["\uFEB6"] = "\u0634"; 51391 t["\uFEB7"] = "\u0634"; 51392 t["\uFEB8"] = "\u0634"; 51393 t["\uFEB9"] = "\u0635"; 51394 t["\uFEBA"] = "\u0635"; 51395 t["\uFEBB"] = "\u0635"; 51396 t["\uFEBC"] = "\u0635"; 51397 t["\uFEBD"] = "\u0636"; 51398 t["\uFEBE"] = "\u0636"; 51399 t["\uFEBF"] = "\u0636"; 51400 t["\uFEC0"] = "\u0636"; 51401 t["\uFEC1"] = "\u0637"; 51402 t["\uFEC2"] = "\u0637"; 51403 t["\uFEC3"] = "\u0637"; 51404 t["\uFEC4"] = "\u0637"; 51405 t["\uFEC5"] = "\u0638"; 51406 t["\uFEC6"] = "\u0638"; 51407 t["\uFEC7"] = "\u0638"; 51408 t["\uFEC8"] = "\u0638"; 51409 t["\uFEC9"] = "\u0639"; 51410 t["\uFECA"] = "\u0639"; 51411 t["\uFECB"] = "\u0639"; 51412 t["\uFECC"] = "\u0639"; 51413 t["\uFECD"] = "\u063A"; 51414 t["\uFECE"] = "\u063A"; 51415 t["\uFECF"] = "\u063A"; 51416 t["\uFED0"] = "\u063A"; 51417 t["\uFED1"] = "\u0641"; 51418 t["\uFED2"] = "\u0641"; 51419 t["\uFED3"] = "\u0641"; 51420 t["\uFED4"] = "\u0641"; 51421 t["\uFED5"] = "\u0642"; 51422 t["\uFED6"] = "\u0642"; 51423 t["\uFED7"] = "\u0642"; 51424 t["\uFED8"] = "\u0642"; 51425 t["\uFED9"] = "\u0643"; 51426 t["\uFEDA"] = "\u0643"; 51427 t["\uFEDB"] = "\u0643"; 51428 t["\uFEDC"] = "\u0643"; 51429 t["\uFEDD"] = "\u0644"; 51430 t["\uFEDE"] = "\u0644"; 51431 t["\uFEDF"] = "\u0644"; 51432 t["\uFEE0"] = "\u0644"; 51433 t["\uFEE1"] = "\u0645"; 51434 t["\uFEE2"] = "\u0645"; 51435 t["\uFEE3"] = "\u0645"; 51436 t["\uFEE4"] = "\u0645"; 51437 t["\uFEE5"] = "\u0646"; 51438 t["\uFEE6"] = "\u0646"; 51439 t["\uFEE7"] = "\u0646"; 51440 t["\uFEE8"] = "\u0646"; 51441 t["\uFEE9"] = "\u0647"; 51442 t["\uFEEA"] = "\u0647"; 51443 t["\uFEEB"] = "\u0647"; 51444 t["\uFEEC"] = "\u0647"; 51445 t["\uFEED"] = "\u0648"; 51446 t["\uFEEE"] = "\u0648"; 51447 t["\uFEEF"] = "\u0649"; 51448 t["\uFEF0"] = "\u0649"; 51449 t["\uFEF1"] = "\u064A"; 51450 t["\uFEF2"] = "\u064A"; 51451 t["\uFEF3"] = "\u064A"; 51452 t["\uFEF4"] = "\u064A"; 51453 t["\uFEF5"] = "\u0644\u0622"; 51454 t["\uFEF6"] = "\u0644\u0622"; 51455 t["\uFEF7"] = "\u0644\u0623"; 51456 t["\uFEF8"] = "\u0644\u0623"; 51457 t["\uFEF9"] = "\u0644\u0625"; 51458 t["\uFEFA"] = "\u0644\u0625"; 51459 t["\uFEFB"] = "\u0644\u0627"; 51460 t["\uFEFC"] = "\u0644\u0627"; 51461}); 51462function reverseIfRtl(chars) { 51463 var charsLength = chars.length; 51464 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { 51465 return chars; 51466 } 51467 var s = ""; 51468 for (var ii = charsLength - 1; ii >= 0; ii--) { 51469 s += chars[ii]; 51470 } 51471 return s; 51472} 51473exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues; 51474exports.reverseIfRtl = reverseIfRtl; 51475exports.getUnicodeRangeFor = getUnicodeRangeFor; 51476exports.getNormalizedUnicodes = getNormalizedUnicodes; 51477exports.getUnicodeForGlyph = getUnicodeForGlyph; 51478 51479/***/ }), 51480/* 36 */ 51481/***/ (function(module, exports, __w_pdfjs_require__) { 51482 51483"use strict"; 51484 51485 51486Object.defineProperty(exports, "__esModule", { 51487 value: true 51488}); 51489exports.FontRendererFactory = void 0; 51490 51491var _util = __w_pdfjs_require__(2); 51492 51493var _cff_parser = __w_pdfjs_require__(30); 51494 51495var _glyphlist = __w_pdfjs_require__(33); 51496 51497var _encodings = __w_pdfjs_require__(32); 51498 51499var _stream = __w_pdfjs_require__(12); 51500 51501var FontRendererFactory = function FontRendererFactoryClosure() { 51502 function getLong(data, offset) { 51503 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 51504 } 51505 51506 function getUshort(data, offset) { 51507 return data[offset] << 8 | data[offset + 1]; 51508 } 51509 51510 function getSubroutineBias(subrs) { 51511 const numSubrs = subrs.length; 51512 let bias = 32768; 51513 51514 if (numSubrs < 1240) { 51515 bias = 107; 51516 } else if (numSubrs < 33900) { 51517 bias = 1131; 51518 } 51519 51520 return bias; 51521 } 51522 51523 function parseCmap(data, start, end) { 51524 var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16); 51525 var format = getUshort(data, start + offset); 51526 var ranges, p, i; 51527 51528 if (format === 4) { 51529 getUshort(data, start + offset + 2); 51530 var segCount = getUshort(data, start + offset + 6) >> 1; 51531 p = start + offset + 14; 51532 ranges = []; 51533 51534 for (i = 0; i < segCount; i++, p += 2) { 51535 ranges[i] = { 51536 end: getUshort(data, p) 51537 }; 51538 } 51539 51540 p += 2; 51541 51542 for (i = 0; i < segCount; i++, p += 2) { 51543 ranges[i].start = getUshort(data, p); 51544 } 51545 51546 for (i = 0; i < segCount; i++, p += 2) { 51547 ranges[i].idDelta = getUshort(data, p); 51548 } 51549 51550 for (i = 0; i < segCount; i++, p += 2) { 51551 var idOffset = getUshort(data, p); 51552 51553 if (idOffset === 0) { 51554 continue; 51555 } 51556 51557 ranges[i].ids = []; 51558 51559 for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 51560 ranges[i].ids[j] = getUshort(data, p + idOffset); 51561 idOffset += 2; 51562 } 51563 } 51564 51565 return ranges; 51566 } else if (format === 12) { 51567 getLong(data, start + offset + 4); 51568 var groups = getLong(data, start + offset + 12); 51569 p = start + offset + 16; 51570 ranges = []; 51571 51572 for (i = 0; i < groups; i++) { 51573 ranges.push({ 51574 start: getLong(data, p), 51575 end: getLong(data, p + 4), 51576 idDelta: getLong(data, p + 8) - getLong(data, p) 51577 }); 51578 p += 12; 51579 } 51580 51581 return ranges; 51582 } 51583 51584 throw new _util.FormatError(`unsupported cmap: ${format}`); 51585 } 51586 51587 function parseCff(data, start, end, seacAnalysisEnabled) { 51588 var properties = {}; 51589 var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end
51589- start), properties, seacAnalysisEnabled); 51590 var cff = parser.parse(); 51591 return { 51592 glyphs: cff.charStrings.objects, 51593 subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, 51594 gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects, 51595 isCFFCIDFont: cff.isCIDFont, 51596 fdSelect: cff.fdSelect, 51597 fdArray: cff.fdArray 51598 }; 51599 } 51600 51601 function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 51602 var itemSize, itemDecode; 51603 51604 if (isGlyphLocationsLong) { 51605 itemSize = 4; 51606 51607 itemDecode = function fontItemDecodeLong(data, offset) { 51608 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 51609 }; 51610 } else { 51611 itemSize = 2; 51612 51613 itemDecode = function fontItemDecode(data, offset) { 51614 return data[offset] << 9 | data[offset + 1] << 1; 51615 }; 51616 } 51617 51618 var glyphs = []; 51619 var startOffset = itemDecode(loca, 0); 51620 51621 for (var j = itemSize; j < loca.length; j += itemSize) { 51622 var endOffset = itemDecode(loca, j); 51623 glyphs.push(glyf.subarray(startOffset, endOffset)); 51624 startOffset = endOffset; 51625 } 51626 51627 return glyphs; 51628 } 51629 51630 function lookupCmap(ranges, unicode) { 51631 var code = unicode.codePointAt(0), 51632 gid = 0; 51633 var l = 0, 51634 r = ranges.length - 1; 51635 51636 while (l < r) { 51637 var c = l + r + 1 >> 1; 51638 51639 if (code < ranges[c].start) { 51640 r = c - 1; 51641 } else { 51642 l = c; 51643 } 51644 } 51645 51646 if (ranges[l].start <= code && code <= ranges[l].end) { 51647 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 51648 } 51649 51650 return { 51651 charCode: code, 51652 glyphId: gid 51653 }; 51654 } 51655 51656 function compileGlyf(code, cmds, font) { 51657 function moveTo(x, y) { 51658 cmds.push({ 51659 cmd: "moveTo", 51660 args: [x, y] 51661 }); 51662 } 51663 51664 function lineTo(x, y) { 51665 cmds.push({ 51666 cmd: "lineTo", 51667 args: [x, y] 51668 }); 51669 } 51670 51671 function quadraticCurveTo(xa, ya, x, y) { 51672 cmds.push({ 51673 cmd: "quadraticCurveTo", 51674 args: [xa, ya, x, y] 51675 }); 51676 } 51677 51678 var i = 0; 51679 var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16; 51680 var flags; 51681 var x = 0, 51682 y = 0; 51683 i += 10; 51684 51685 if (numberOfContours < 0) { 51686 do { 51687 flags = code[i] << 8 | code[i + 1]; 51688 var glyphIndex = code[i + 2] << 8 | code[i + 3]; 51689 i += 4; 51690 var arg1, arg2; 51691 51692 if (flags & 0x01) { 51693 arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16; 51694 arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16; 51695 i += 4; 51696 } else { 51697 arg1 = code[i++]; 51698 arg2 = code[i++]; 51699 } 51700 51701 if (flags & 0x02) { 51702 x = arg1; 51703 y = arg2; 51704 } else { 51705 x = 0; 51706 y = 0; 51707 } 51708 51709 var scaleX = 1, 51710 scaleY = 1, 51711 scale01 = 0, 51712 scale10 = 0; 51713 51714 if (flags & 0x08) { 51715 scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 51716 i += 2; 51717 } else if (flags & 0x40) { 51718 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 51719 scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 51720 i += 4; 51721 } else if (flags & 0x80) { 51722 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 51723 scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 51724 scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824; 51725 scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824; 51726 i += 8; 51727 } 51728 51729 var subglyph = font.glyphs[glyphIndex]; 51730 51731 if (subglyph) { 51732 cmds.push({ 51733 cmd: "save" 51734 }); 51735 cmds.push({ 51736 cmd: "transform", 51737 args: [scaleX, scale01, scale10, scaleY, x, y] 51738 }); 51739 compileGlyf(subglyph, cmds, font); 51740 cmds.push({ 51741 cmd: "restore" 51742 }); 51743 } 51744 } while (flags & 0x20); 51745 } else { 51746 var endPtsOfContours = []; 51747 var j, jj; 51748 51749 for (j = 0; j < numberOfContours; j++) { 51750 endPtsOfContours.push(code[i] << 8 | code[i + 1]); 51751 i += 2; 51752 } 51753 51754 var instructionLength = code[i] << 8 | code[i + 1]; 51755 i += 2 + instructionLength; 51756 var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1; 51757 var points = []; 51758 51759 while (points.length < numberOfPoints) { 51760 flags = code[i++]; 51761 var repeat = 1; 51762 51763 if (flags & 0x08) { 51764 repeat += code[i++]; 51765 } 51766 51767 while (repeat-- > 0) { 51768 points.push({ 51769 flags 51770 }); 51771 } 51772 } 51773 51774 for (j = 0; j < numberOfPoints; j++) { 51775 switch (points[j].flags & 0x12) { 51776 case 0x00: 51777 x += (code[i] << 24 | code[i + 1] << 16) >> 16; 51778 i += 2; 51779 break; 51780 51781 case 0x02: 51782 x -= code[i++]; 51783 break; 51784 51785 case 0x12: 51786 x += code[i++]; 51787 break; 51788 } 51789 51790 points[j].x = x; 51791 } 51792 51793 for (j = 0; j < numberOfPoints; j++) { 51794 switch (points[j].flags & 0x24) { 51795 case 0x00: 51796 y += (code[i] << 24 | code[i + 1] << 16) >> 16; 51797 i += 2; 51798 break; 51799 51800 case 0x04: 51801 y -= code[i++]; 51802 break; 51803 51804 case 0x24: 51805 y += code[i++]; 51806 break; 51807 } 51808 51809 points[j].y = y; 51810 } 51811 51812 var startPoint = 0; 51813 51814 for (i = 0; i < numberOfContours; i++) { 51815 var endPoint = endPtsOfContours[i]; 51816 var contour = points.slice(startPoint, endPoint + 1); 51817 51818 if (contour[0].flags & 1) { 51819 contour.push(contour[0]); 51820 } else if (contour[contour.length - 1].flags & 1) { 51821 contour.unshift(contour[contour.length - 1]); 51822 } else { 51823 var p = { 51824 flags: 1, 51825 x: (contour[0].x + contour[contour.length - 1].x) / 2, 51826 y: (contour[0].y + contour[contour.length - 1].y) / 2 51827 }; 51828 contour.unshift(p); 51829 contour.push(p); 51830 } 51831 51832 moveTo(contour[0].x, contour[0].y); 51833 51834 for (j = 1, jj = contour.length; j < jj; j++) { 51835 if (contour[j].flags & 1) { 51836 lineTo(contour[j].x, contour[j].y); 51837 } else if (contour[j + 1].flags & 1) { 51838 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 51839 j++; 51840 } else { 51841 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 51842 } 51843 } 51844 51845 startPoint = endPoint + 1; 51846 } 51847 } 51848 } 51849 51850 function compileCharString(charStringCode, cmds, font, glyphId) { 51851 function moveTo(x, y) { 51852 cmds.push({ 51853 cmd: "moveTo", 51854 args: [x, y] 51855 }); 51856 } 51857 51858 function lineTo(x, y) { 51859 cmds.push({ 51860 cmd: "lineTo", 51861 args: [x, y] 51862 }); 51863 } 51864 51865 function bezierCurveTo(x1, y1, x2, y2, x, y) { 51866 cmds.push({ 51867 cmd: "bezierCurveTo", 51868 args: [x1, y1, x2, y2, x, y] 51869 }); 51870 } 51871 51872 var stack = []; 51873 var x = 0, 51874 y = 0; 51875 var stems = 0; 51876 51877 function parse(code) { 51878 var i = 0; 51879 51880 while (i < code.length) { 51881 var stackClean = false;
vendor: 10,857 bytes, lines 51882-52268
51882 var v = code[i++]; 51883 var xa, xb, ya, yb, y1, y2, y3, n, subrCode; 51884 51885 switch (v) { 51886 case 1: 51887 stems += stack.length >> 1; 51888 stackClean = true; 51889 break; 51890 51891 case 3: 51892 stems += stack.length >> 1; 51893 stackClean = true; 51894 break; 51895 51896 case 4: 51897 y += stack.pop(); 51898 moveTo(x, y); 51899 stackClean = true; 51900 break; 51901 51902 case 5: 51903 while (stack.length > 0) { 51904 x += stack.shift(); 51905 y += stack.shift(); 51906 lineTo(x, y); 51907 } 51908 51909 break; 51910 51911 case 6: 51912 while (stack.length > 0) { 51913 x += stack.shift(); 51914 lineTo(x, y); 51915 51916 if (stack.length === 0) { 51917 break; 51918 } 51919 51920 y += stack.shift(); 51921 lineTo(x, y); 51922 } 51923 51924 break; 51925 51926 case 7: 51927 while (stack.length > 0) { 51928 y += stack.shift(); 51929 lineTo(x, y); 51930 51931 if (stack.length === 0) { 51932 break; 51933 } 51934 51935 x += stack.shift(); 51936 lineTo(x, y); 51937 } 51938 51939 break; 51940 51941 case 8: 51942 while (stack.length > 0) { 51943 xa = x + stack.shift(); 51944 ya = y + stack.shift(); 51945 xb = xa + stack.shift(); 51946 yb = ya + stack.shift(); 51947 x = xb + stack.shift(); 51948 y = yb + stack.shift(); 51949 bezierCurveTo(xa, ya, xb, yb, x, y); 51950 } 51951 51952 break; 51953 51954 case 10: 51955 n = stack.pop(); 51956 subrCode = null; 51957 51958 if (font.isCFFCIDFont) { 51959 const fdIndex = font.fdSelect.getFDIndex(glyphId); 51960 51961 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 51962 const fontDict = font.fdArray[fdIndex]; 51963 let subrs; 51964 51965 if (fontDict.privateDict && fontDict.privateDict.subrsIndex) { 51966 subrs = fontDict.privateDict.subrsIndex.objects; 51967 } 51968 51969 if (subrs) { 51970 n += getSubroutineBias(subrs); 51971 subrCode = subrs[n]; 51972 } 51973 } else { 51974 (0, _util.warn)("Invalid fd index for glyph index."); 51975 } 51976 } else { 51977 subrCode = font.subrs[n + font.subrsBias]; 51978 } 51979 51980 if (subrCode) { 51981 parse(subrCode); 51982 } 51983 51984 break; 51985 51986 case 11: 51987 return; 51988 51989 case 12: 51990 v = code[i++]; 51991 51992 switch (v) { 51993 case 34: 51994 xa = x + stack.shift(); 51995 xb = xa + stack.shift(); 51996 y1 = y + stack.shift(); 51997 x = xb + stack.shift(); 51998 bezierCurveTo(xa, y, xb, y1, x, y1); 51999 xa = x + stack.shift(); 52000 xb = xa + stack.shift(); 52001 x = xb + stack.shift(); 52002 bezierCurveTo(xa, y1, xb, y, x, y); 52003 break; 52004 52005 case 35: 52006 xa = x + stack.shift(); 52007 ya = y + stack.shift(); 52008 xb = xa + stack.shift(); 52009 yb = ya + stack.shift(); 52010 x = xb + stack.shift(); 52011 y = yb + stack.shift(); 52012 bezierCurveTo(xa, ya, xb, yb, x, y); 52013 xa = x + stack.shift(); 52014 ya = y + stack.shift(); 52015 xb = xa + stack.shift(); 52016 yb = ya + stack.shift(); 52017 x = xb + stack.shift(); 52018 y = yb + stack.shift(); 52019 bezierCurveTo(xa, ya, xb, yb, x, y); 52020 stack.pop(); 52021 break; 52022 52023 case 36: 52024 xa = x + stack.shift(); 52025 y1 = y + stack.shift(); 52026 xb = xa + stack.shift(); 52027 y2 = y1 + stack.shift(); 52028 x = xb + stack.shift(); 52029 bezierCurveTo(xa, y1, xb, y2, x, y2); 52030 xa = x + stack.shift(); 52031 xb = xa + stack.shift(); 52032 y3 = y2 + stack.shift(); 52033 x = xb + stack.shift(); 52034 bezierCurveTo(xa, y2, xb, y3, x, y); 52035 break; 52036 52037 case 37: 52038 var x0 = x, 52039 y0 = y; 52040 xa = x + stack.shift(); 52041 ya = y + stack.shift(); 52042 xb = xa + stack.shift(); 52043 yb = ya + stack.shift(); 52044 x = xb + stack.shift(); 52045 y = yb + stack.shift(); 52046 bezierCurveTo(xa, ya, xb, yb, x, y); 52047 xa = x + stack.shift(); 52048 ya = y + stack.shift(); 52049 xb = xa + stack.shift(); 52050 yb = ya + stack.shift(); 52051 x = xb; 52052 y = yb; 52053 52054 if (Math.abs(x - x0) > Math.abs(y - y0)) { 52055 x += stack.shift(); 52056 } else { 52057 y += stack.shift(); 52058 } 52059 52060 bezierCurveTo(xa, ya, xb, yb, x, y); 52061 break; 52062 52063 default: 52064 throw new _util.FormatError(`unknown operator: 12 ${v}`); 52065 } 52066 52067 break; 52068 52069 case 14: 52070 if (stack.length >= 4) { 52071 var achar = stack.pop(); 52072 var bchar = stack.pop(); 52073 y = stack.pop(); 52074 x = stack.pop(); 52075 cmds.push({ 52076 cmd: "save" 52077 }); 52078 cmds.push({ 52079 cmd: "translate", 52080 args: [x, y] 52081 }); 52082 var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); 52083 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 52084 cmds.push({ 52085 cmd: "restore" 52086 }); 52087 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); 52088 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 52089 } 52090 52091 return; 52092 52093 case 18: 52094 stems += stack.length >> 1; 52095 stackClean = true; 52096 break; 52097 52098 case 19: 52099 stems += stack.length >> 1; 52100 i += stems + 7 >> 3; 52101 stackClean = true; 52102 break; 52103 52104 case 20: 52105 stems += stack.length >> 1; 52106 i += stems + 7 >> 3; 52107 stackClean = true; 52108 break; 52109 52110 case 21: 52111 y += stack.pop(); 52112 x += stack.pop(); 52113 moveTo(x, y); 52114 stackClean = true; 52115 break; 52116 52117 case 22: 52118 x += stack.pop(); 52119 moveTo(x, y); 52120 stackClean = true; 52121 break; 52122 52123 case 23: 52124 stems += stack.length >> 1; 52125 stackClean = true; 52126 break; 52127 52128 case 24: 52129 while (stack.length > 2) { 52130 xa = x + stack.shift(); 52131 ya = y + stack.shift(); 52132 xb = xa + stack.shift(); 52133 yb = ya + stack.shift(); 52134 x = xb + stack.shift(); 52135 y = yb + stack.shift(); 52136 bezierCurveTo(xa, ya, xb, yb, x, y); 52137 } 52138 52139 x += stack.shift(); 52140 y += stack.shift(); 52141 lineTo(x, y); 52142 break; 52143 52144 case 25: 52145 while (stack.length > 6) { 52146 x += stack.shift(); 52147 y += stack.shift(); 52148 lineTo(x, y); 52149 } 52150 52151 xa = x + stack.shift(); 52152 ya = y + stack.shift(); 52153 xb = xa + stack.shift(); 52154 yb = ya + stack.shift(); 52155 x = xb + stack.shift(); 52156 y = yb + stack.shift(); 52157 bezierCurveTo(xa, ya, xb, yb, x, y); 52158 break; 52159 52160 case 26: 52161 if (stack.length % 2) { 52162 x += stack.shift(); 52163 } 52164 52165 while (stack.length > 0) { 52166 xa = x; 52167 ya = y + stack.shift(); 52168 xb = xa + stack.shift(); 52169 yb = ya + stack.shift(); 52170 x = xb; 52171 y = yb + stack.shift(); 52172 bezierCurveTo(xa, ya, xb, yb, x, y); 52173 } 52174 52175 break; 52176 52177 case 27: 52178 if (stack.length % 2) { 52179 y += stack.shift(); 52180 } 52181 52182 while (stack.length > 0) { 52183 xa = x + stack.shift(); 52184 ya = y; 52185 xb = xa + stack.shift(); 52186 yb = ya + stack.shift(); 52187 x = xb + stack.shift(); 52188 y = yb; 52189 bezierCurveTo(xa, ya, xb, yb, x, y); 52190 } 52191 52192 break; 52193 52194 case 28: 52195 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 52196 i += 2; 52197 break; 52198 52199 case 29: 52200 n = stack.pop() + font.gsubrsBias; 52201 subrCode = font.gsubrs[n]; 52202 52203 if (subrCode) { 52204 parse(subrCode); 52205 } 52206 52207 break; 52208 52209 case 30: 52210 while (stack.length > 0) { 52211 xa = x; 52212 ya = y + stack.shift(); 52213 xb = xa + stack.shift(); 52214 yb = ya + stack.shift(); 52215 x = xb + stack.shift(); 52216 y = yb + (stack.length === 1 ? stack.shift() : 0); 52217 bezierCurveTo(xa, ya, xb, yb, x, y); 52218 52219 if (stack.length === 0) { 52220 break; 52221 } 52222 52223 xa = x + stack.shift(); 52224 ya = y; 52225 xb = xa + stack.shift(); 52226 yb = ya + stack.shift(); 52227 y = yb + stack.shift(); 52228 x = xb + (stack.length === 1 ? stack.shift() : 0); 52229 bezierCurveTo(xa, ya, xb, yb, x, y); 52230 } 52231 52232 break; 52233 52234 case 31: 52235 while (stack.length > 0) { 52236 xa = x + stack.shift(); 52237 ya = y; 52238 xb = xa + stack.shift(); 52239 yb = ya + stack.shift(); 52240 y = yb + stack.shift(); 52241 x = xb + (stack.length === 1 ? stack.shift() : 0); 52242 bezierCurveTo(xa, ya, xb, yb, x, y); 52243 52244 if (stack.length === 0) { 52245 break; 52246 } 52247 52248 xa = x; 52249 ya = y + stack.shift(); 52250 xb = xa + stack.shift(); 52251 yb = ya + stack.shift(); 52252 x = xb + stack.shift(); 52253 y = yb + (stack.length === 1 ? stack.shift() : 0); 52254 bezierCurveTo(xa, ya, xb, yb, x, y); 52255 } 52256 52257 break; 52258 52259 default: 52260 if (v < 32) { 52261 throw new _util.FormatError(`unknown operator: ${v}`); 52262 } 52263 52264 if (v < 247) { 52265 stack.push(v - 139); 52266 } else if (v < 251) { 52267 stack.push((v - 247) * 256 + code[i++] + 108); 52268 } else if (v < 255) {
52269 stack.push(-(v - 251) * 256 - code[i++] - 108); 52270 } else { 52271 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 52272 i += 4; 52273 } 52274 52275 break; 52276 } 52277 52278 if (stackClean) { 52279 stack.length = 0; 52280 } 52281 } 52282 } 52283 52284 parse(charStringCode); 52285 } 52286 52287 const NOOP = []; 52288 52289 class CompiledFont { 52290 constructor(fontMatrix) { 52291 if (this.constructor === CompiledFont) { 52292 (0, _util.unreachable)("Cannot initialize CompiledFont."); 52293 } 52294 52295 this.fontMatrix = fontMatrix; 52296 this.compiledGlyphs = Object.create(null); 52297 this.compiledCharCodeToGlyphId = Object.create(null); 52298 } 52299 52300 getPathJs(unicode) { 52301 const cmap = lookupCmap(this.cmap, unicode); 52302 let fn = this.compiledGlyphs[cmap.glyphId]; 52303 52304 if (!fn) { 52305 fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId); 52306 this.compiledGlyphs[cmap.glyphId] = fn; 52307 } 52308 52309 if (this.compiledCharCodeToGlyphId[cmap.charCo
52309de] === undefined) { 52310 this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId; 52311 } 52312 52313 return fn; 52314 } 52315 52316 compileGlyph(code, glyphId) { 52317 if (!code || code.length === 0 || code[0] === 14) { 52318 return NOOP; 52319 } 52320 52321 let fontMatrix = this.fontMatrix; 52322 52323 if (this.isCFFCIDFont) { 52324 const fdIndex = this.fdSelect.getFDIndex(glyphId); 52325 52326 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 52327 const fontDict = this.fdArray[fdIndex]; 52328 fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX; 52329 } else { 52330 (0, _util.warn)("Invalid fd index for glyph index."); 52331 } 52332 } 52333 52334 const cmds = []; 52335 cmds.push({ 52336 cmd: "save" 52337 }); 52338 cmds.push({ 52339 cmd: "transform", 52340 args: fontMatrix.slice() 52341 }); 52342 cmds.push({ 52343 cmd: "scale", 52344 args: ["size", "-size"] 52345 }); 52346 this.compileGlyphImpl(code, cmds, glyphId); 52347 cmds.push({ 52348 cmd: "restore" 52349 }); 52350 return cmds; 52351 } 52352 52353 compileGlyphImpl() { 52354 (0, _util.unreachable)("Children classes should implement this."); 52355 } 52356 52357 hasBuiltPath(unicode) { 52358 const cmap = lookupCmap(this.cmap, unicode); 52359 return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCo
52359de] !== undefined; 52360 } 52361 52362 } 52363 52364 class TrueTypeCompiled extends CompiledFont { 52365 constructor(glyphs, cmap, fontMatrix) { 52366 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 52367 this.glyphs = glyphs; 52368 this.cmap = cmap; 52369 } 52370 52371 compileGlyphImpl(code, cmds) { 52372 compileGlyf(code, cmds, this); 52373 } 52374 52375 } 52376 52377 class Type2Compiled extends CompiledFont { 52378 constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { 52379 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 52380 this.glyphs = cffInfo.glyphs; 52381 this.gsubrs = cffInfo.gsubrs || []; 52382 this.subrs = cffInfo.subrs || []; 52383 this.cmap = cmap; 52384 this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); 52385 this.gsubrsBias = getSubroutineBias(this.gsubrs); 52386 this.subrsBias = getSubroutineBias(this.subrs); 52387 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 52388 this.fdSelect = cffInfo.fdSelect; 52389 this.fdArray = cffInfo.fdArray; 52390 } 52391 52392 compileGlyphImpl(code, cmds, glyphId) { 52393 compileCharString(code, cmds, this, glyphId); 52394 } 52395 52396 } 52397 52398 return { 52399 create: function FontRendererFactory_create(font, seacAnalysisEnabled) { 52400 var data = new Uint8Array(font.data); 52401 var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 52402 var numTables = getUshort(data, 4); 52403 52404 for (var i = 0, p = 12; i < numTables; i++, p += 16) { 52405 var tag = (0, _util.bytesToString)(data.subarray(p, p + 4)); 52406 var offset = getLong(data, p + 8); 52407 var length = getLong(data, p + 12); 52408 52409 switch (tag) { 52410 case "cmap": 52411 cmap = parseCmap(data, offset, offset + length); 52412 break; 52413 52414 case "glyf": 52415 glyf = data.subarray(offset, offset + length); 52416 break; 52417 52418 case "loca": 52419 loca = data.subarray(offset, offset + length); 52420 break; 52421 52422 case "head": 52423 unitsPerEm = getUshort(data, offset + 18); 52424 indexToLocFormat = getUshort(data, offset + 50); 52425 break; 52426 52427 case "CFF ": 52428 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 52429 break; 52430 } 52431 } 52432 52433 if (glyf) { 52434 var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 52435 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 52436 } 52437 52438 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 52439 } 52440 }; 52441}(); 52442 52443exports.FontRendererFactory = FontRendererFactory; 52444 52445/***/ }), 52446/* 37 */ 52447/***/ (function(module, exports, __w_pdfjs_require__) { 52448 52449"use strict"; 52450 52451 52452Object.defineProperty(exports, "__esModule", { 52453 value: true 52454}); 52455exports.Type1Parser = void 0; 52456 52457var _encodings = __w_pdfjs_require__(32); 52458 52459var _core_utils = __w_pdfjs_require__(8); 52460 52461var _stream = __w_pdfjs_require__(12); 52462 52463var _util = __w_pdfjs_require__(2); 52464 52465var HINTING_ENABLED = false; 52466 52467var Type1CharString = function Type1CharStringClosure() { 52468 var COMMAND_MAP = { 52469 hstem: [1], 52470 vstem: [3], 52471 vmoveto: [4], 52472 rlineto: [5], 52473 hlineto: [6], 52474 vlineto: [7], 52475 rrcurveto: [8], 52476 callsubr: [10], 52477 flex: [12, 35], 52478 drop: [12, 18], 52479 endchar: [14], 52480 rmoveto: [21], 52481 hmoveto: [22], 52482 vhcurveto: [30], 52483 hvcurveto: [31] 52484 }; 52485 52486 function Type1CharString() { 52487 this.width = 0; 52488 this.lsb = 0; 52489 this.flexing = false; 52490 this.output = []; 52491 this.stack = []; 52492 } 52493 52494 Type1CharString.prototype = { 52495 convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) { 52496 var count = encoded.length; 52497 var error = false; 52498 var wx, sbx, subrNumber; 52499 52500 for (var i = 0; i < count; i++) { 52501 var value = encoded[i]; 52502 52503 if (value < 32) { 52504 if (value === 12) { 52505 value = (value << 8) + encoded[++i]; 52506 } 52507 52508 switch (value) { 52509 case 1: 52510 if (!HINTING_ENABLED) { 52511 this.stack = []; 52512 break; 52513 } 52514 52515 error = this.executeCommand(2, COMMAND_MAP.hstem); 52516 break; 52517 52518 case 3: 52519 if (!HINTING_ENABLED) { 52520 this.stack = []; 52521 break; 52522 } 52523 52524 error = this.executeCommand(2, COMMAND_MAP.vstem); 52525 break; 52526 52527 case 4: 52528 if (this.flexing) { 52529 if (this.stack.length < 1) { 52530 error = true; 52531 break; 52532 } 52533 52534 var dy = this.stack.pop(); 52535 this.stack.push(0, dy); 52536 break; 52537 } 52538 52539 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 52540 break; 52541 52542 case 5: 52543 error = this.executeCommand(2, COMMAND_MAP.rlineto); 52544 break; 52545 52546 case 6: 52547 error = this.executeCommand(1, COMMAND_MAP.hlineto); 52548 break; 52549 52550 case 7: 52551 error = this.executeCommand(1, COMMAND_MAP.vlineto); 52552 break; 52553 52554 case 8: 52555 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 52556 break; 52557 52558 case 9: 52559 this.stack = []; 52560 break; 52561 52562 case 10: 52563 if (this.stack.length < 1) { 52564 error = true; 52565 break; 52566 } 52567 52568 subrNumber = this.stack.pop(); 52569 52570 if (!subrs[subrNumber]) { 52571 error = true; 52572 break; 52573 } 52574 52575 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 52576 break; 52577 52578 case 11: 52579 return error; 52580 52581 case 13: 52582 if (this.stack.length < 2) { 52583 error = true; 52584 break; 52585 } 52586 52587 wx = this.stack.pop(); 52588 sbx = this.stack.pop(); 52589 this.lsb = sbx; 52590 this.width = wx; 52591 this.stack.push(wx, sbx); 52592 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 52593 break; 52594 52595 case 14: 52596 this.output.push(COMMAND_MAP.endchar[0]); 52597 break; 52598 52599 case 21: 52600 if (this.flexing) { 52601 break; 52602 } 52603 52604 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 52605 break; 52606 52607 case 22: 52608 if (this.flexing) { 52609 this.stack.push(0); 52610 break; 52611 } 52612 52613 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 52614 break; 52615 52616 case 30: 52617 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 52618 break; 52619 52620 case 31: 52621 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 52622 break; 52623 52624 case (12 << 8) + 0: 52625 this.stack = []; 52626 break; 52627 52628 case (12 << 8) + 1: 52629 if (!HINTING_ENABLED) { 52630 this.stack = []; 52631 break; 52632 } 52633 52634 error = this.executeCommand(2, COMMAND_MAP.vstem); 52635 break; 52636 52637 case (12 << 8) + 2: 52638 if (!HINTING_ENABLED) { 52639 this.stack = []; 52640 break; 52641 } 52642 52643 error = this.executeCommand(2, COMMAND_MAP.hstem); 52644 break; 52645 52646 case (12 << 8) + 6: 52647 if (seacAnalysisEnabled) { 52648 this.seac = this.stack.splice(-4, 4); 52649 error = this.executeCommand(0, COMMAND_MAP.endchar); 52650 } else { 52651 error = this.executeCommand(4, COMMAND_MAP.endchar); 52652 } 52653 52654 break; 52655 52656 case (12 << 8) + 7: 52657 if (this.stack.length < 4) { 52658 error = true; 52659 break; 52660 } 52661 52662 this.stack.pop(); 52663 wx = this.stack.pop(); 52664 var sby = this.stack.pop(); 52665 sbx = this.stack.pop(); 52666 this.lsb = sbx; 52667 this.width = wx; 52668 this.stack.push(wx, sbx, sby); 52669 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 52670 break; 52671 52672 case (12 << 8) + 12: 52673 if (this.stack.length < 2) { 52674 error = true; 52675 break; 52676 } 52677 52678 var num2 = this.stack.pop(); 52679 var num1 = this.stack.pop(); 52680 this.stack.push(num1 / num2); 52681 break; 52682 52683 case (12 << 8) + 16: 52684 if (this.stack.length < 2) { 52685 error = true; 52686 break; 52687 } 52688 52689 subrNumber = this.stack.pop(); 52690 var numArgs = this.stack.pop(); 52691 52692 if (subrNumber === 0 && numArgs === 3) { 52693 var flexArgs = this.stack.splice(this.stack.length - 17, 17); 52694 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]); 52695 error = this.executeCommand(13, COMMAND_MAP.flex, true); 52696 this.flexing = false;
52697 this.stack.push(flexArgs[15], flexArgs[16]); 52698 } else if (subrNumber === 1 && numArgs === 0) { 52699 this.flexing = true; 52700 } 52701 52702 break; 52703 52704 case (12 << 8) + 17: 52705 break; 52706 52707 case (12 << 8) + 33: 52708 this.stack = []; 52709 break; 52710 52711 default: 52712 (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"'); 52713 break; 52714 } 52715 52716 if (error) { 52717 break; 52718 } 52719 52720 continue; 52721 } else if (value <= 246) { 52722 value = value - 139; 52723 } else if (value <= 250) { 52724 value = (value - 247) * 256 + encoded[++i] + 108; 52725 } else if (value <= 254) { 52726 value = -((value - 251) * 256) - encoded[++i] - 108; 52727 } else { 52728 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 52729 } 52730 52731 this.stack.push(value); 52732 } 52733 52734 return error; 52735 }, 52736 52737 executeCommand(howManyArgs, command, keepStack) { 52738 var stackLength = this.stack.length; 52739 52740 if (howManyArgs > stackLength) { 52741 return true; 52742 } 52743 52744 var start = stackLength - howManyArgs; 52745 52746 for (var i = start; i < stackLength; i++) { 52747 var value = this.stack[i]; 52748 52749 if (Number.isInteger(value)) { 52750 this.output.push(28, value >> 8 & 0xff, value & 0xff); 52751 } else { 52752 value = 65536 * value | 0; 52753 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 52754 } 52755 } 52756 52757 this.output.push.apply(this.output, command); 52758 52759 if (keepStack) { 52760 this.stack.splice(start, howManyArgs); 52761 } else { 52762 this.stack.length = 0; 52763 } 52764 52765 return false; 52766 } 52767 52768 }; 52769 return Type1CharString; 52770}(); 52771 52772var Type1Parser = function Type1ParserClosure() { 52773 var EEXEC_ENCRYPT_KEY = 55665; 52774 var CHAR_STRS_ENCRYPT_KEY = 4330; 52775 52776 function isHexDigit(code) { 52777 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 52778 } 52779 52780 function decrypt(data, key, discardNumber) { 52781 if (discardNumber >= data.length) { 52782 return new Uint8Array(0); 52783 } 52784 52785 var r = key | 0, 52786 c1 = 52845, 52787 c2 = 22719, 52788 i, 52789 j; 52790 52791 for (i = 0; i < discardNumber; i++) { 52792 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 52793 } 52794 52795 var count = data.length - discardNumber; 52796 var decrypted = new Uint8Array(count); 52797 52798 for (i = discardNumber, j = 0; j < count; i++, j++) { 52799 var value = data[i]; 52800 decrypted[j] = value ^ r >> 8; 52801 r = (value + r) * c1 + c2 & (1 << 16) - 1; 52802 } 52803 52804 return decrypted; 52805 } 52806 52807 function decryptAscii(data, key, discardNumber) { 52808 var r = key | 0, 52809 c1 = 52845, 52810 c2 = 22719; 52811 var count = data.length, 52812 maybeLength = count >>> 1; 52813 var decrypted = new Uint8Array(maybeLength); 52814 var i, j; 52815 52816 for (i = 0, j = 0; i < count; i++) { 52817 var digit1 = data[i]; 52818 52819 if (!isHexDigit(digit1)) { 52820 continue; 52821 } 52822 52823 i++; 52824 var digit2; 52825 52826 while (i < count && !isHexDigit(digit2 = data[i])) { 52827 i++; 52828 } 52829 52830 if (i < count) { 52831 var value = parseInt(String.fromCharCode(digit1, digit2), 16); 52832 decrypted[j++] = value ^ r >> 8; 52833 r = (value + r) * c1 + c2 & (1 << 16) - 1; 52834 } 52835 } 52836 52837 return decrypted.slice(discardNumber, j); 52838 } 52839 52840 function isSpecial(c) { 52841 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 52842 } 52843 52844 function Type1Parser(stream, encrypted, seacAnalysisEnabled) { 52845 if (encrypted) { 52846 var data = stream.getBytes(); 52847 var isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7])); 52848 stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 52849 } 52850 52851 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 52852 this.stream = stream; 52853 this.nextChar(); 52854 } 52855 52856 Type1Parser.prototype = { 52857 readNumberArray: function Type1Parser_readNumberArray() { 52858 this.getToken(); 52859 var array = []; 52860 52861 while (true) { 52862 var token = this.getToken(); 52863 52864 if (token === null || token === "]" || token === "}") { 52865 break; 52866 } 52867 52868 array.push(parseFloat(token || 0)); 52869 } 52870 52871 return array; 52872 }, 52873 readNumber: function Type1Parser_readNumber() { 52874 var token = this.getToken(); 52875 return parseFloat(token || 0); 52876 }, 52877 readInt: function Type1Parser_readInt() { 52878 var token = this.getToken(); 52879 return parseInt(token || 0, 10) | 0; 52880 }, 52881 readBoolean: function Type1Parser_readBoolean() { 52882 var token = this.getToken(); 52883 return token === "true" ? 1 : 0; 52884 }, 52885 nextChar: function Type1_nextChar() { 52886 return this.currentChar = this.stream.getByte(); 52887 }, 52888 getToken: function Type1Parser_getToken() { 52889 var comment = false;
52890 var ch = this.currentChar; 52891 52892 while (true) { 52893 if (ch === -1) { 52894 return null; 52895 } 52896 52897 if (comment) { 52898 if (ch === 0x0a || ch === 0x0d) { 52899 comment = false; 52900 } 52901 } else if (ch === 0x25) { 52902 comment = true; 52903 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 52904 break; 52905 } 52906 52907 ch = this.nextChar(); 52908 } 52909 52910 if (isSpecial(ch)) { 52911 this.nextChar(); 52912 return String.fromCharCode(ch); 52913 } 52914 52915 var token = ""; 52916 52917 do { 52918 token += String.fromCharCode(ch); 52919 ch = this.nextChar(); 52920 } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch)); 52921 52922 return token; 52923 }, 52924 readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) { 52925 if (lenIV === -1) { 52926 return bytes; 52927 } 52928 52929 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 52930 }, 52931 extractFontProgram: function Type1Parser_extractFontProgram(properties) { 52932 var stream = this.stream; 52933 var subrs = [], 52934 charstrings = []; 52935 var privateData = Object.create(null); 52936 privateData.lenIV = 4; 52937 var program = { 52938 subrs: [], 52939 charstrings: [], 52940 properties: { 52941 privateData 52942 } 52943 }; 52944 var token, length, data, lenIV, encoded; 52945 52946 while ((token = this.getToken()) !== null) { 52947 if (token !== "/") { 52948 continue; 52949 } 52950 52951 token = this.getToken(); 52952 52953 switch (token) { 52954 case "CharStrings": 52955 this.getToken(); 52956 this.getToken(); 52957 this.getToken(); 52958 this.getToken(); 52959 52960 while (true) { 52961 token = this.getToken(); 52962 52963 if (token === null || token === "end") { 52964 break; 52965 } 52966 52967 if (token !== "/") { 52968 continue; 52969 } 52970 52971 var glyph = this.getToken(); 52972 length = this.readInt(); 52973 this.getToken(); 52974 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 52975 lenIV = program.properties.privateData.lenIV; 52976 encoded = this.readCharStrings(data, lenIV); 52977 this.nextChar(); 52978 token = this.getToken(); 52979 52980 if (token === "noaccess") { 52981 this.getToken(); 52982 } 52983 52984 charstrings.push({ 52985 glyph, 52986 encoded 52987 }); 52988 } 52989 52990 break; 52991 52992 case "Subrs": 52993 this.readInt(); 52994 this.getToken(); 52995 52996 while (this.getToken() === "dup") { 52997 const index = this.readInt(); 52998 length = this.readInt(); 52999 this.getToken(); 53000 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 53001 lenIV = program.properties.privateData.lenIV; 53002 encoded = this.readCharStrings(data, lenIV); 53003 this.nextChar(); 53004 token = this.getToken(); 53005 53006 if (token === "noaccess") { 53007 this.getToken(); 53008 } 53009 53010 subrs[index] = encoded; 53011 } 53012 53013 break; 53014 53015 case "BlueValues": 53016 case "OtherBlues": 53017 case "FamilyBlues": 53018 case "FamilyOtherBlues": 53019 var blueArray = this.readNumberArray(); 53020 53021 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 53022 program.properties.privateData[token] = blueArray; 53023 } 53024 53025 break; 53026 53027 case "StemSnapH": 53028 case "StemSnapV": 53029 program.properties.privateData[token] = this.readNumberArray(); 53030 break; 53031 53032 case "StdHW": 53033 case "StdVW": 53034 program.properties.privateData[token] = this.readNumberArray()[0]; 53035 break; 53036 53037 case "BlueShift": 53038 case "lenIV": 53039 case "BlueFuzz": 53040 case "BlueScale": 53041 case "LanguageGroup": 53042 case "ExpansionFactor": 53043 program.properties.privateData[token] = this.readNumber(); 53044 break; 53045 53046 case "ForceBold": 53047 program.properties.privateData[token] = this.readBoolean(); 53048 break; 53049 } 53050 } 53051 53052 for (var i = 0; i < charstrings.length; i++) { 53053 glyph = charstrings[i].glyph; 53054 encoded = charstrings[i].encoded; 53055 var charString = new Type1CharString(); 53056 var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 53057 var output = charString.output; 53058 53059 if (error) { 53060 output = [14]; 53061 } 53062 53063 const charStringObject = { 53064 glyphName: glyph, 53065 charstring: output, 53066 width: charString.width, 53067 lsb: charString.lsb, 53068 seac: charString.seac 53069 }; 53070 53071 if (glyph === ".notdef") { 53072 program.charstrings.unshift(charStringObject); 53073 } else { 53074 program.charstrings.push(charStringObject); 53075 } 53076 53077 if (properties.builtInEncoding) { 53078 const index = properties.builtInEncoding.indexOf(glyph); 53079 53080 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 53081 properties.widths[index] = charString.width; 53082 } 53083 } 53084 } 53085 53086 return program; 53087 }, 53088 extractFontHeader: function Type1Parser_extractFontHeader(properties) { 53089 var token; 53090 53091 while ((token = this.getToken()) !== null) { 53092 if (token !== "/") { 53093 continue; 53094 } 53095 53096 token = this.getToken(); 53097 53098 switch (token) { 53099 case "FontMatrix": 53100 var matrix = this.readNumberArray(); 53101 properties.fontMatrix = matrix; 53102 break; 53103 53104 case "Encoding": 53105 var encodingArg = this.getToken(); 53106 var encoding; 53107 53108 if (!/^\d+$/.test(encodingArg)) { 53109 encoding = (0, _encodings.getEncoding)(encodingArg); 53110 } else { 53111 encoding = []; 53112 var size = parseInt(encodingArg, 10) | 0; 53113 this.getToken(); 53114 53115 for (var j = 0; j < size; j++) { 53116 token = this.getToken(); 53117 53118 while (token !== "dup" && token !== "def") { 53119 token = this.getToken(); 53120 53121 if (token === null) { 53122 return; 53123 } 53124 } 53125 53126 if (token === "def") { 53127 break; 53128 } 53129 53130 var index = this.readInt(); 53131 this.getToken(); 53132 var glyph = this.getToken(); 53133 encoding[index] = glyph; 53134 this.getToken(); 53135 } 53136 } 53137 53138 properties.builtInEncoding = encoding; 53139 break; 53140 53141 case "FontBBox": 53142 var fontBBox = this.readNumberArray(); 53143 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 53144 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 53145 properties.ascentScaled = true; 53146 break; 53147 } 53148 } 53149 } 53150 }; 53151 return Type1Parser; 53152}(); 53153 53154exports.Type1Parser = Type1Parser; 53155 53156/***/ }), 53157/* 38 */ 53158/***/ (function(module, exports, __w_pdfjs_require__) { 53159 53160"use strict"; 53161 53162 53163Object.defineProperty(exports, "__esModule", { 53164 value: true 53165}); 53166exports.getTilingPatternIR = getTilingPatternIR; 53167exports.Pattern = void 0; 53168 53169var _util = __w_pdfjs_require__(2); 53170 53171var _colorspace = __w_pdfjs_require__(23); 53172 53173var _primitives = __w_pdfjs_require__(5); 53174 53175var _core_utils = __w_pdfjs_require__(8); 53176 53177var ShadingType = { 53178 FUNCTION_BASED: 1, 53179 AXIAL: 2, 53180 RADIAL: 3, 53181 FREE_FORM_MESH: 4, 53182 LATTICE_FORM_MESH: 5, 53183 COONS_PATCH_MESH: 6, 53184 TENSOR_PATCH_MESH: 7 53185}; 53186 53187var Pattern = function PatternClosure() { 53188 function Pattern() { 53189 (0, _util.unreachable)("should not call Pattern constructor"); 53190 } 53191 53192 Pattern.prototype = { 53193 getPattern: function Pattern_getPattern(ctx) { 53194 (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`); 53195 } 53196 }; 53197 53198 Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) { 53199 var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading; 53200 var type = dict.get("ShadingType"); 53201 53202 try { 53203 switch (type) { 53204 case ShadingType.AXIAL: 53205 case ShadingType.RADIAL: 53206 return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory); 53207 53208 case ShadingType.FREE_FORM_MESH: 53209 case ShadingType.LATTICE_FORM_MESH: 53210 case ShadingType.COONS_PATCH_MESH: 53211 case ShadingType.TENSOR_PATCH_MESH: 53212 return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory); 53213 53214 default: 53215 throw new _util.FormatError("Unsupported ShadingType: " + type); 53216 } 53217 } catch (ex) { 53218 if (ex instanceof _core_utils.MissingDataException) { 53219 throw ex; 53220 } 53221 53222 handler.send("UnsupportedFeature", { 53223 featureId: _util.UNSUPPORTED_FEATURES.shadingPattern 53224 }); 53225 (0, _util.warn)(ex); 53226 return new Shadings.Dummy(); 53227 } 53228 }; 53229 53230 return Pattern; 53231}(); 53232 53233exports.Pattern = Pattern; 53234var Shadings = {}; 53235Shadings.SMALL_NUMBER = 1e-6; 53236 53237Shadings.RadialAxial = function RadialAxialClosure() { 53238 function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) { 53239 this.matrix = matrix; 53240 this.coordsArr = dict.getArray("Coords"); 53241 this.shadingType = dict.get("ShadingType"); 53242 this.type = "Pattern"; 53243 var cs = dict.get("ColorSpace", "CS"); 53244 cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory); 53245 this.cs = cs; 53246 const bbox = dict.getArray("BBox"); 53247 53248 if (Array.isArray(bbox) && bbox.length === 4) { 53249 this.bbox = _util.Util.normalizeRect(bbox); 53250 } else { 53251 this.bbox = null; 53252 } 53253 53254 var t0 = 0.0, 53255 t1 = 1.0; 53256 53257 if (dict.has("Domain")) { 53258 var domainArr = dict.getArray("Domain"); 53259 t0 = domainArr[0]; 53260 t1 = domainArr[1]; 53261 } 53262 53263 var extendStart = false, 53264 extendEnd = false;
53265 53266 if (dict.has("Extend")) { 53267 var extendArr = dict.getArray("Extend"); 53268 extendStart = extendArr[0]; 53269 extendEnd = extendArr[1]; 53270 } 53271 53272 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 53273 var x1 = this.coordsArr[0]; 53274 var y1 = this.coordsArr[1]; 53275 var r1 = this.coordsArr[2]; 53276 var x2 = this.coordsArr[3]; 53277 var y2 = this.coordsArr[4]; 53278 var r2 = this.coordsArr[5]; 53279 var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 53280 53281 if (r1 <= r2 + distance && r2 <= r1 + distance) { 53282 (0, _util.warn)("Unsupported radial gradient."); 53283 } 53284 } 53285 53286 this.extendStart = extendStart; 53287 this.extendEnd = extendEnd; 53288 var fnObj = dict.get("Function"); 53289 var fn = pdfFunctionFactory.createFromArray(fnObj); 53290 const NUMBER_OF_SAMPLES = 10; 53291 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 53292 var colorStops = this.colorStops = []; 53293 53294 if (t0 >= t1 || step <= 0) { 53295 (0, _util.info)("Bad shading domain."); 53296 return; 53297 } 53298 53299 var color = new Float32Array(cs.numComps), 53300 ratio = new Float32Array(1); 53301 var rgbColor; 53302 53303 for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) { 53304 ratio[0] = t0 + i * step; 53305 fn(ratio, 0, color, 0); 53306 rgbColor = cs.getRgb(color, 0); 53307 53308 var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 53309 53310 colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]); 53311 } 53312 53313 var background = "transparent"; 53314
53315 if (dict.has("Background")) { 53316 rgbColor = cs.getRgb(dict.get("Background"), 0); 53317 background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 53318 } 53319 53320 if (!extendStart) { 53321 colorStops.unshift([0, background]); 53322 colorStops[1][0] += Shadings.SMALL_NUMBER; 53323 } 53324 53325 if (!extendEnd) { 53326 colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER; 53327 colorStops.push([1, background]); 53328 } 53329 53330 this.colorStops = colorStops; 53331 } 53332 53333 RadialAxial.prototype = { 53334 getIR: function RadialAxial_getIR() { 53335 var coordsArr = this.coordsArr; 53336 var shadingType = this.shadingType; 53337 var type, p0, p1, r0, r1; 53338 53339 if (shadingType === ShadingType.AXIAL) { 53340 p0 = [coordsArr[0], coordsArr[1]]; 53341 p1 = [coordsArr[2], coordsArr[3]]; 53342 r0 = null; 53343 r1 = null; 53344 type = "axial"; 53345 } else if (shadingType === ShadingType.RADIAL) { 53346 p0 = [coordsArr[0], coordsArr[1]]; 53347 p1 = [coordsArr[3], coordsArr[4]]; 53348 r0 = coordsArr[2]; 53349 r1 = coordsArr[5]; 53350 type = "radial"; 53351 } else { 53352 (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`); 53353 } 53354 53355 var matrix = this.matrix; 53356 53357 if (matrix) { 53358 p0 = _util.Util.applyTransform(p0, matrix); 53359 p1 = _util.Util.applyTransform(p1, matrix); 53360 53361 if (shadingType === ShadingType.RADIAL) { 53362 var scale = _util.Util.singularValueDecompose2dScale(matrix); 53363 53364 r0 *= scale[0]; 53365 r1 *= scale[1]; 53366 } 53367 } 53368 53369 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 53370 } 53371 }; 53372 return RadialAxial; 53373}(); 53374 53375Shadings.Mesh = function MeshClosure() { 53376 function MeshStreamReader(stream, context) { 53377 this.stream = stream; 53378 this.context = context; 53379 this.buffer = 0; 53380 this.bufferLength = 0; 53381 var numComps = context.numComps; 53382 this.tmpCompsBuf = new Float32Array(numComps); 53383 var csNumComps = context.colorSpace.numComps; 53384 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 53385 } 53386 53387 MeshStreamReader.prototype = { 53388 get hasData() { 53389 if (this.stream.end) { 53390 return this.stream.pos < this.stream.end; 53391 } 53392 53393 if (this.bufferLength > 0) { 53394 return true; 53395 } 53396 53397 var nextByte = this.stream.getByte(); 53398 53399 if (nextByte < 0) { 53400 return false; 53401 } 53402 53403 this.buffer = nextByte; 53404 this.bufferLength = 8; 53405 return true; 53406 }, 53407 53408 readBits: function MeshStreamReader_readBits(n) { 53409 var buffer = this.buffer; 53410 var bufferLength = this.bufferLength; 53411 53412 if (n === 32) { 53413 if (bufferLength === 0) { 53414 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 53415 } 53416 53417 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 53418 var nextByte = this.stream.getByte(); 53419 this.buffer = nextByte & (1 << bufferLength) - 1; 53420 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 53421 } 53422 53423 if (n === 8 && bufferLength === 0) { 53424 return this.stream.getByte(); 53425 } 53426 53427 while (bufferLength < n) { 53428 buffer = buffer << 8 | this.stream.getByte(); 53429 bufferLength += 8; 53430 } 53431 53432 bufferLength -= n; 53433 this.bufferLength = bufferLength; 53434 this.buffer = buffer & (1 << bufferLength) - 1; 53435 return buffer >> bufferLength; 53436 }, 53437 align: function MeshStreamReader_align() { 53438 this.buffer = 0; 53439 this.bufferLength = 0; 53440 }, 53441 readFlag: function MeshStreamReader_readFlag() { 53442 return this.readBits(this.context.bitsPerFlag); 53443 }, 53444 readCoordinate: function MeshStreamReader_readCoordinate() { 53445 var bitsPerCoordinate = this.context.bitsPerCoordinate; 53446 var xi = this.readBits(bitsPerCoordinate); 53447 var yi = this.readBits(bitsPerCoordinate); 53448 var decode = this.context.decode; 53449 var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 53450 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 53451 }, 53452 readComponents: function MeshStreamReader_readComponents() { 53453 var numComps = this.context.numComps; 53454 var bitsPerComponent = this.context.bitsPerComponent; 53455 var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 53456 var decode = this.context.decode; 53457 var components = this.tmpCompsBuf; 53458 53459 for (var i = 0, j = 4; i < numComps; i++, j += 2) { 53460 var ci = this.readBits(bitsPerComponent); 53461 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 53462 } 53463 53464 var color = this.tmpCsCompsBuf; 53465 53466 if (this.context.colorFn) { 53467 this.context.colorFn(components, 0, color, 0); 53468 } 53469 53470 return this.context.colorSpace.getRgb(color, 0); 53471 } 53472 }; 53473 53474 function decodeType4Shading(mesh, reader) { 53475 var coords = mesh.coords; 53476 var colors = mesh.colors; 53477 var operators = []; 53478 var ps = []; 53479 var verticesLeft = 0; 53480 53481 while (reader.hasData) { 53482 var f = reader.readFlag(); 53483 var coord = reader.readCoordinate(); 53484 var color = reader.readComponents(); 53485 53486 if (verticesLeft === 0) { 53487 if (!(0 <= f && f <= 2)) { 53488 throw new _util.FormatError("Unknown type4 flag"); 53489 } 53490 53491 switch (f) { 53492 case 0: 53493 verticesLeft = 3; 53494 break; 53495 53496 case 1: 53497 ps.push(ps[ps.length - 2], ps[ps.length - 1]); 53498 verticesLeft = 1; 53499 break; 53500 53501 case 2: 53502 ps.push(ps[ps.length - 3], ps[ps.length - 1]); 53503 verticesLeft = 1; 53504 break; 53505 } 53506 53507 operators.push(f); 53508 } 53509 53510 ps.push(coords.length); 53511 coords.push(coord); 53512 colors.push(color); 53513 verticesLeft--; 53514 reader.align(); 53515 } 53516 53517 mesh.figures.push({ 53518 type: "triangles", 53519 coords: new Int32Array(ps), 53520 colors: new Int32Array(ps) 53521 }); 53522 } 53523 53524 function decodeType5Shading(mesh, reader, verticesPerRow) { 53525 var coords = mesh.coords; 53526 var colors = mesh.colors; 53527 var ps = []; 53528 53529 while (reader.hasData) { 53530 var coord = reader.readCoordinate(); 53531 var color = reader.readComponents(); 53532 ps.push(coords.length); 53533 coords.push(coord); 53534 colors.push(color); 53535 } 53536 53537 mesh.figures.push({ 53538 type: "lattice", 53539 coords: new Int32Array(ps), 53540 colors: new Int32Array(ps), 53541 verticesPerRow 53542 }); 53543 } 53544 53545 var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; 53546 var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; 53547 var TRIANGLE_DENSITY = 20; 53548 53549 var getB = function getBClosure() { 53550 function buildB(count) { 53551 var lut = []; 53552 53553 for (var i = 0; i <= count; i++) { 53554 var t = i / count, 53555 t_ = 1 - t; 53556 lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t])); 53557 } 53558 53559 return lut; 53560 } 53561 53562 var cache = []; 53563 return function getB(count) { 53564 if (!cache[count]) { 53565 cache[count] = buildB(count); 53566 } 53567 53568 return cache[count]; 53569 }; 53570 }(); 53571 53572 function buildFigureFromPatch(mesh, index) { 53573 var figure = mesh.figures[index]; 53574 (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure"); 53575 var coords = mesh.coords, 53576 colors = mesh.colors; 53577 var pi = figure.coords; 53578 var ci = figure.colors; 53579 var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 53580 var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 53581 var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 53582 var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 53583 var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0])); 53584 splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 53585 var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1])); 53586 splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 53587 var verticesPerRow = splitXBy + 1; 53588 var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 53589 var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 53590 var k = 0; 53591 var cl = new Uint8Array(3), 53592 cr = new Uint8Array(3); 53593 var c0 = colors[ci[0]], 53594 c1 = colors[ci[1]], 53595 c2 = colors[ci[2]], 53596 c3 = colors[ci[3]]; 53597 var bRow = getB(splitYBy), 53598 bCol = getB(splitXBy); 53599 53600 for (var row = 0; row <= splitYBy; row++) { 53601 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 53602 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 53603 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 53604 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 53605 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 53606 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 53607 53608 for (var col = 0; col <= splitXBy; col++, k++) { 53609 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 53610 continue; 53611 } 53612 53613 var x = 0, 53614 y = 0; 53615 var q = 0; 53616 53617 for (var i = 0; i <= 3; i++) { 53618 for (var j = 0; j <= 3; j++, q++) { 53619 var m = bRow[row][i] * bCol[col][j]; 53620 x += coords[pi[q]][0] * m; 53621 y += coords[pi[q]][1] * m; 53622 } 53623 } 53624 53625 figureCoords[k] = coords.length; 53626 coords.push([x, y]); 53627 figureColors[k] = colors.length; 53628 var newColor = new Uint8Array(3); 53629 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 53630 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 53631 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 53632 colors.push(newColor); 53633 } 53634 } 53635 53636 figureCoords[0] = pi[0]; 53637 figureColors[0] = ci[0]; 53638 figureCoords[splitXBy] = pi[3];
vendor: 5,678 bytes, lines 53639-53814
53639 figureColors[splitXBy] = ci[1]; 53640 figureCoords[verticesPerRow * splitYBy] = pi[12]; 53641 figureColors[verticesPerRow * splitYBy] = ci[2]; 53642 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 53643 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 53644 mesh.figures[index] = { 53645 type: "lattice", 53646 coords: figureCoords, 53647 colors: figureColors, 53648 verticesPerRow 53649 }; 53650 } 53651 53652 function decodeType6Shading(mesh, reader) { 53653 var coords = mesh.coords; 53654 var colors = mesh.colors; 53655 var ps = new Int32Array(16); 53656 var cs = new Int32Array(4); 53657 53658 while (reader.hasData) { 53659 var f = reader.readFlag(); 53660 53661 if (!(0 <= f && f <= 3)) { 53662 throw new _util.FormatError("Unknown type6 flag"); 53663 } 53664 53665 var i, ii; 53666 var pi = coords.length; 53667 53668 for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 53669 coords.push(reader.readCoordinate()); 53670 } 53671 53672 var ci = colors.length; 53673 53674 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 53675 colors.push(reader.readComponents()); 53676 } 53677 53678 var tmp1, tmp2, tmp3, tmp4; 53679 53680 switch (f) { 53681 case 0: 53682 ps[12] = pi + 3; 53683 ps[13] = pi + 4; 53684 ps[14] = pi + 5; 53685 ps[15] = pi + 6; 53686 ps[8] = pi + 2; 53687 ps[11] = pi + 7; 53688 ps[4] = pi + 1; 53689 ps[7] = pi + 8; 53690 ps[0] = pi; 53691 ps[1] = pi + 11; 53692 ps[2] = pi + 10; 53693 ps[3] = pi + 9; 53694 cs[2] = ci + 1; 53695 cs[3] = ci + 2; 53696 cs[0] = ci; 53697 cs[1] = ci + 3; 53698 break; 53699 53700 case 1: 53701 tmp1 = ps[12]; 53702 tmp2 = ps[13]; 53703 tmp3 = ps[14]; 53704 tmp4 = ps[15]; 53705 ps[12] = tmp4; 53706 ps[13] = pi + 0; 53707 ps[14] = pi + 1; 53708 ps[15] = pi + 2; 53709 ps[8] = tmp3; 53710 ps[11] = pi + 3; 53711 ps[4] = tmp2; 53712 ps[7] = pi + 4; 53713 ps[0] = tmp1; 53714 ps[1] = pi + 7; 53715 ps[2] = pi + 6; 53716 ps[3] = pi + 5; 53717 tmp1 = cs[2]; 53718 tmp2 = cs[3]; 53719 cs[2] = tmp2; 53720 cs[3] = ci; 53721 cs[0] = tmp1; 53722 cs[1] = ci + 1; 53723 break; 53724 53725 case 2: 53726 tmp1 = ps[15]; 53727 tmp2 = ps[11]; 53728 ps[12] = ps[3]; 53729 ps[13] = pi + 0; 53730 ps[14] = pi + 1; 53731 ps[15] = pi + 2; 53732 ps[8] = ps[7]; 53733 ps[11] = pi + 3; 53734 ps[4] = tmp2; 53735 ps[7] = pi + 4; 53736 ps[0] = tmp1; 53737 ps[1] = pi + 7; 53738 ps[2] = pi + 6; 53739 ps[3] = pi + 5; 53740 tmp1 = cs[3]; 53741 cs[2] = cs[1]; 53742 cs[3] = ci; 53743 cs[0] = tmp1; 53744 cs[1] = ci + 1; 53745 break; 53746 53747 case 3: 53748 ps[12] = ps[0]; 53749 ps[13] = pi + 0; 53750 ps[14] = pi + 1; 53751 ps[15] = pi + 2; 53752 ps[8] = ps[1]; 53753 ps[11] = pi + 3; 53754 ps[4] = ps[2]; 53755 ps[7] = pi + 4; 53756 ps[0] = ps[3]; 53757 ps[1] = pi + 7; 53758 ps[2] = pi + 6; 53759 ps[3] = pi + 5; 53760 cs[2] = cs[0]; 53761 cs[3] = ci; 53762 cs[0] = cs[1]; 53763 cs[1] = ci + 1; 53764 break; 53765 } 53766 53767 ps[5] = coords.length; 53768 coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]); 53769 ps[6] = coords.length; 53770 coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]); 53771 ps[9] = coords.length; 53772 coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]); 53773 ps[10] = coords.length; 53774 coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]); 53775 mesh.figures.push({ 53776 type: "patch", 53777 coords: new Int32Array(ps), 53778 colors: new Int32Array(cs) 53779 }); 53780 } 53781 } 53782 53783 function decodeType7Shading(mesh, reader) { 53784 var coords = mesh.coords; 53785 var colors = mesh.colors; 53786 var ps = new Int32Array(16); 53787 var cs = new Int32Array(4); 53788 53789 while (reader.hasData) { 53790 var f = reader.readFlag(); 53791 53792 if (!(0 <= f && f <= 3)) { 53793 throw new _util.FormatError("Unknown type7 flag"); 53794 } 53795 53796 var i, ii; 53797 var pi = coords.length; 53798 53799 for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 53800 coords.push(reader.readCoordinate()); 53801 } 53802 53803 var ci = colors.length; 53804 53805 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 53806 colors.push(reader.readComponents()); 53807 } 53808 53809 var tmp1, tmp2, tmp3, tmp4; 53810 53811 switch (f) { 53812 case 0: 53813 ps[12] = pi + 3; 53814 ps[13] = pi + 4;
53815 ps[14] = pi + 5; 53816 ps[15] = pi + 6; 53817 ps[8] = pi + 2; 53818 ps[9] = pi + 13; 53819 ps[10] = pi + 14; 53820 ps[11] = pi + 7; 53821 ps[4] = pi + 1; 53822 ps[5] = pi + 12; 53823 ps[6] = pi + 15; 53824 ps[7] = pi + 8; 53825 ps[0] = pi; 53826 ps[1] = pi + 11; 53827 ps[2] = pi + 10; 53828 ps[3] = pi + 9; 53829 cs[2] = ci + 1; 53830 cs[3] = ci + 2; 53831 cs[0] = ci; 53832 cs[1] = ci + 3; 53833 break; 53834 53835 case 1: 53836 tmp1 = ps[12]; 53837 tmp2 = ps[13]; 53838 tmp3 = ps[14]; 53839 tmp4 = ps[15]; 53840 ps[12] = tmp4; 53841 ps[13] = pi + 0; 53842 ps[14] = pi + 1; 53843 ps[15] = pi + 2; 53844 ps[8] = tmp3; 53845 ps[9] = pi + 9; 53846 ps[10] = pi + 10; 53847 ps[11] = pi + 3; 53848 ps[4] = tmp2; 53849 ps[5] = pi + 8; 53850 ps[6] = pi + 11; 53851 ps[7] = pi + 4; 53852 ps[0] = tmp1; 53853 ps[1] = pi + 7; 53854 ps[2] = pi + 6; 53855 ps[3] = pi + 5; 53856 tmp1 = cs[2]; 53857 tmp2 = cs[3]; 53858 cs[2] = tmp2; 53859 cs[3] = ci; 53860 cs[0] = tmp1; 53861 cs[1] = ci + 1; 53862 break; 53863 53864 case 2: 53865 tmp1 = ps[15]; 53866 tmp2 = ps[11]; 53867 ps[12] = ps[3]; 53868 ps[13] = pi + 0; 53869 ps[14] = pi + 1; 53870 ps[15] = pi + 2; 53871 ps[8] = ps[7]; 53872 ps[9] = pi + 9; 53873 ps[10] = pi + 10; 53874 ps[11] = pi + 3; 53875 ps[4] = tmp2; 53876 ps[5] = pi + 8; 53877 ps[6] = pi + 11; 53878 ps[7] = pi + 4; 53879 ps[0] = tmp1; 53880 ps[1] = pi + 7; 53881 ps[2] = pi + 6; 53882 ps[3] = pi + 5; 53883 tmp1 = cs[3]; 53884 cs[2] = cs[1]; 53885 cs[3] = ci; 53886 cs[0] = tmp1; 53887 cs[1] = ci + 1; 53888 break; 53889 53890 case 3: 53891 ps[12] = ps[0]; 53892 ps[13] = pi + 0; 53893 ps[14] = pi + 1; 53894 ps[15] = pi + 2; 53895 ps[8] = ps[1]; 53896 ps[9] = pi + 9; 53897 ps[10] = pi + 10; 53898 ps[11] = pi + 3; 53899 ps[4] = ps[2]; 53900 ps[5] = pi + 8; 53901 ps[6] = pi + 11; 53902 ps[7] = pi + 4; 53903 ps[0] = ps[3]; 53904 ps[1] = pi + 7; 53905 ps[2] = pi + 6; 53906 ps[3] = pi + 5; 53907 cs[2] = cs[0]; 53908 cs[3] = ci; 53909 cs[0] = cs[1]; 53910 cs[1] = ci + 1; 53911 break; 53912 } 53913 53914 mesh.figures.push({ 53915 type: "patch", 53916 coords: new Int32Array(ps), 53917 colors: new Int32Array(cs) 53918 }); 53919 } 53920 } 53921 53922 function updateBounds(mesh) { 53923 var minX = mesh.coords[0][0], 53924 minY = mesh.coords[0][1], 53925 maxX = minX, 53926 maxY = minY; 53927 53928 for (var i = 1, ii = mesh.coords.length; i < ii; i++) { 53929 var x = mesh.coords[i][0], 53930 y = mesh.coords[i][1]; 53931 minX = minX > x ? x : minX; 53932 minY = minY > y ? y : minY; 53933 maxX = maxX < x ? x : maxX; 53934 maxY = maxY < y ? y : maxY; 53935 } 53936 53937 mesh.bounds = [minX, minY, maxX, maxY]; 53938 } 53939 53940 function packData(mesh) { 53941 var i, ii, j, jj; 53942 var coords = mesh.coords; 53943 var coordsPacked = new Float32Array(coords.length * 2); 53944 53945 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 53946 var xy = coords[i]; 53947 coordsPacked[j++] = xy[0]; 53948 coordsPacked[j++] = xy[1]; 53949 } 53950 53951 mesh.coords = coordsPacked; 53952 var colors = mesh.colors; 53953 var colorsPacked = new Uint8Array(colors.length * 3); 53954 53955 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 53956 var c = colors[i]; 53957 colorsPacked[j++] = c[0]; 53958 colorsPacked[j++] = c[1]; 53959 colorsPacked[j++] = c[2]; 53960 } 53961 53962 mesh.colors = colorsPacked; 53963 var figures = mesh.figures; 53964 53965 for (i = 0, ii = figures.length; i < ii; i++) { 53966 var figure = figures[i], 53967 ps = figure.coords, 53968 cs = figure.colors; 53969 53970 for (j = 0, jj = ps.length; j < jj; j++) { 53971 ps[j] *= 2; 53972 cs[j] *= 3; 53973 } 53974 } 53975 } 53976 53977 function Mesh(stream, matrix, xref, res, pdfFunctionFactory) { 53978 if (!(0, _primitives.isStream)(stream)) { 53979 throw new _util.FormatError("Mesh data is not a stream"); 53980 } 53981 53982 var dict = stream.dict; 53983 this.matrix = matrix; 53984 this.shadingType = dict.get("ShadingType"); 53985 this.type = "Pattern"; 53986 const bbox = dict.getArray("BBox"); 53987 53988 if (Array.isArray(bbox) && bbox.length === 4) { 53989 this.bbox = _util.Util.normalizeRect(bbox); 53990 } else { 53991 this.bbox = null; 53992 } 53993 53994 var cs = dict.get("ColorSpace", "CS"); 53995 cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory); 53996 this.cs = cs;
53997 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 53998 var fnObj = dict.get("Function"); 53999 var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; 54000 this.coords = []; 54001 this.colors = []; 54002 this.figures = []; 54003 var decodeContext = { 54004 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 54005 bitsPerComponent: dict.get("BitsPerComponent"), 54006 bitsPerFlag: dict.get("BitsPerFlag"), 54007 decode: dict.getArray("Decode"), 54008 colorFn: fn, 54009 colorSpace: cs, 54010 numComps: fn ? 1 : cs.numComps 54011 }; 54012 var reader = new MeshStreamReader(stream, decodeContext); 54013 var patchMesh = false; 54014 54015 switch (this.shadingType) { 54016 case ShadingType.FREE_FORM_MESH: 54017 decodeType4Shading(this, reader); 54018 break; 54019 54020 case ShadingType.LATTICE_FORM_MESH: 54021 var verticesPerRow = dict.get("VerticesPerRow") | 0; 54022 54023 if (verticesPerRow < 2) { 54024 throw new _util.FormatError("Invalid VerticesPerRow"); 54025 } 54026 54027 decodeType5Shading(this, reader, verticesPerRow); 54028 break; 54029 54030 case ShadingType.COONS_PATCH_MESH: 54031 decodeType6Shading(this, reader); 54032 patchMesh = true; 54033 break; 54034 54035 case ShadingType.TENSOR_PATCH_MESH: 54036 decodeType7Shading(this, reader); 54037 patchMesh = true; 54038 break; 54039 54040 default: 54041 (0, _util.unreachable)("Unsupported mesh type."); 54042 break; 54043 } 54044 54045 if (patchMesh) { 54046 updateBounds(this); 54047 54048 for (var i = 0, ii = this.figures.length; i < ii; i++) { 54049 buildFigureFromPatch(this, i); 54050 } 54051 } 54052 54053 updateBounds(this); 54054 packData(this); 54055 } 54056 54057 Mesh.prototype = { 54058 getIR: function Mesh_getIR() { 54059 return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background]; 54060 } 54061 }; 54062 return Mesh; 54063}(); 54064 54065Shadings.Dummy = function DummyClosure() { 54066 function Dummy() { 54067 this.type = "Pattern"; 54068 } 54069 54070 Dummy.prototype = { 54071 getIR: function Dummy_getIR() { 54072 return ["Dummy"]; 54073 } 54074 }; 54075 return Dummy; 54076}(); 54077 54078function getTilingPatternIR(operatorList, dict, args) { 54079 const matrix = dict.getArray("Matrix"); 54080 54081 const bbox = _util.Util.normalizeRect(dict.getArray("BBox")); 54082 54083 const xstep = dict.get("XStep"); 54084 const ystep = dict.get("YStep"); 54085 const paintType = dict.get("PaintType"); 54086 const tilingType = dict.get("TilingType"); 54087 54088 if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 54089 throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`); 54090 } 54091 54092 return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; 54093} 54094 54095/***/ }), 54096/* 39 */ 54097/***/ (function(module, exports, __w_pdfjs_require__) { 54098 54099"use strict"; 54100 54101 54102Object.defineProperty(exports, "__esModule", { 54103 value: true 54104}); 54105exports.bidi = bidi; 54106 54107var _util = __w_pdfjs_require__(2); 54108 54109var baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"]; 54110var arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"]; 54111 54112function isOdd(i) { 54113 return (i & 1) !== 0; 54114} 54115 54116function isEven(i) { 54117 return (i & 1) === 0; 54118} 54119 54120function findUnequal(arr, start, value) { 54121 for (var j = start, jj = arr.length; j < jj; ++j) { 54122 if (arr[j] !== value) { 54123 return j; 54124 } 54125 } 54126 54127 return j; 54128} 54129 54130function setValues(arr, start, end, value) { 54131 for (var j = start; j < end; ++j) { 54132 arr[j] = value; 54133 } 54134} 54135 54136function reverseValues(arr, start, end) { 54137 for (var i = start, j = end - 1; i < j; ++i, --j) { 54138 var temp = arr[i]; 54139 arr[i] = arr[j]; 54140 arr[j] = temp; 54141 } 54142} 54143 54144function createBidiText(str, isLTR, vertical = false) { 54145 let dir = "ltr"; 54146 54147 if (vertical) { 54148 dir = "ttb"; 54149 } else if (!isLTR) { 54150 dir = "rtl";
54151 } 54152 54153 return { 54154 str, 54155 dir 54156 }; 54157} 54158 54159var chars = []; 54160var types = []; 54161 54162function bidi(str, startLevel, vertical) { 54163 var isLTR = true; 54164 var strLength = str.length; 54165 54166 if (strLength === 0 || vertical) { 54167 return createBidiText(str, isLTR, vertical); 54168 } 54169 54170 chars.length = strLength; 54171 types.length = strLength; 54172 var numBidi = 0; 54173 var i, ii; 54174 54175 for (i = 0; i < strLength; ++i) { 54176 chars[i] = str.charAt(i); 54177 var charCode = str.charCodeAt(i); 54178 var charType = "L"; 54179 54180 if (charCode <= 0x00ff) { 54181 charType = baseTypes[charCode]; 54182 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 54183 charType = "R"; 54184 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 54185 charType = arabicTypes[charCode & 0xff]; 54186 54187 if (!charType) { 54188 (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16)); 54189 } 54190 } else if (0x0700 <= charCode && charCode <= 0x08ac) { 54191 charType = "AL"; 54192 } 54193 54194 if (charType === "R" || charType === "AL" || charType === "AN") { 54195 numBidi++; 54196 } 54197 54198 types[i] = charType; 54199 } 54200 54201 if (numBidi === 0) { 54202 isLTR = true; 54203 return createBidiText(str, isLTR); 54204 } 54205 54206 if (startLevel === -1) { 54207 if (numBidi / strLength < 0.3) { 54208 isLTR = true; 54209 startLevel = 0; 54210 } else { 54211 isLTR = false; 54212 startLevel = 1; 54213 } 54214 } 54215 54216 var levels = []; 54217 54218 for (i = 0; i < strLength; ++i) { 54219 levels[i] = startLevel; 54220 } 54221 54222 var e = isOdd(startLevel) ? "R" : "L"; 54223 var sor = e; 54224 var eor = sor; 54225 var lastType = sor; 54226 54227 for (i = 0; i < strLength; ++i) { 54228 if (types[i] === "NSM") { 54229 types[i] = lastType; 54230 } else { 54231 lastType = types[i]; 54232 } 54233 } 54234 54235 lastType = sor; 54236 var t; 54237 54238 for (i = 0; i < strLength; ++i) { 54239 t = types[i]; 54240 54241 if (t === "EN") { 54242 types[i] = lastType === "AL" ? "AN" : "EN"; 54243 } else if (t === "R" || t === "L" || t === "AL") { 54244 lastType = t; 54245 } 54246 } 54247 54248 for (i = 0; i < strLength; ++i) { 54249 t = types[i]; 54250 54251 if (t === "AL") { 54252 types[i] = "R"; 54253 } 54254 } 54255 54256 for (i = 1; i < strLength - 1; ++i) { 54257 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 54258 types[i] = "EN"; 54259 } 54260 54261 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 54262 types[i] = types[i - 1]; 54263 } 54264 } 54265 54266 for (i = 0; i < strLength; ++i) { 54267 if (types[i] === "EN") { 54268 var j; 54269 54270 for (j = i - 1; j >= 0; --j) { 54271 if (types[j] !== "ET") { 54272 break; 54273 } 54274 54275 types[j] = "EN"; 54276 } 54277 54278 for (j = i + 1; j < strLength; ++j) { 54279 if (types[j] !== "ET") { 54280 break; 54281 } 54282 54283 types[j] = "EN"; 54284 } 54285 } 54286 } 54287 54288 for (i = 0; i < strLength; ++i) { 54289 t = types[i]; 54290 54291 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 54292 types[i] = "ON"; 54293 } 54294 } 54295 54296 lastType = sor; 54297 54298 for (i = 0; i < strLength; ++i) { 54299 t = types[i]; 54300 54301 if (t === "EN") { 54302 types[i] = lastType === "L" ? "L" : "EN"; 54303 } else if (t === "R" || t === "L") { 54304 lastType = t; 54305 } 54306 } 54307 54308 for (i = 0; i < strLength; ++i) { 54309 if (types[i] === "ON") { 54310 var end = findUnequal(types, i + 1, "ON"); 54311 var before = sor; 54312 54313 if (i > 0) { 54314 before = types[i - 1]; 54315 } 54316 54317 var after = eor; 54318 54319 if (end + 1 < strLength) { 54320 after = types[end + 1]; 54321 } 54322 54323 if (before !== "L") { 54324 before = "R"; 54325 } 54326 54327 if (after !== "L") { 54328 after = "R"; 54329 } 54330 54331 if (before === after) { 54332 setValues(types, i, end, before); 54333 } 54334 54335 i = end - 1; 54336 } 54337 } 54338 54339 for (i = 0; i < strLength; ++i) { 54340 if (types[i] === "ON") { 54341 types[i] = e; 54342 } 54343 } 54344 54345 for (i = 0; i < strLength; ++i) { 54346 t = types[i]; 54347 54348 if (isEven(levels[i])) { 54349 if (t === "R") { 54350 levels[i] += 1; 54351 } else if (t === "AN" || t === "EN") { 54352 levels[i] += 2; 54353 } 54354 } else { 54355 if (t === "L" || t === "AN" || t === "EN") { 54356 levels[i] += 1; 54357 } 54358 } 54359 } 54360 54361 var highestLevel = -1; 54362 var lowestOddLevel = 99; 54363 var level; 54364 54365 for (i = 0, ii = levels.length; i < ii; ++i) { 54366 level = levels[i]; 54367 54368 if (highestLevel < level) {
54369 highestLevel = level; 54370 } 54371 54372 if (lowestOddLevel > level && isOdd(level)) { 54373 lowestOddLevel = level; 54374 } 54375 } 54376 54377 for (level = highestLevel; level >= lowestOddLevel; --level) { 54378 var start = -1; 54379 54380 for (i = 0, ii = levels.length; i < ii; ++i) { 54381 if (levels[i] < level) { 54382 if (start >= 0) { 54383 reverseValues(chars, start, i); 54384 start = -1; 54385 } 54386 } else if (start < 0) { 54387 start = i; 54388 } 54389 } 54390 54391 if (start >= 0) { 54392 reverseValues(chars, start, levels.length); 54393 } 54394 } 54395 54396 for (i = 0, ii = chars.length; i < ii; ++i) { 54397 var ch = chars[i]; 54398 54399 if (ch === "<" || ch === ">") { 54400 chars[i] = ""; 54401 } 54402 } 54403 54404 return createBidiText(chars.join(""), isLTR); 54405} 54406 54407/***/ }), 54408/* 40 */ 54409/***/ (function(module, exports, __w_pdfjs_require__) { 54410 54411"use strict"; 54412 54413 54414Object.defineProperty(exports, "__esModule", { 54415 value: true 54416}); 54417exports.getMetrics = void 0; 54418 54419var _core_utils = __w_pdfjs_require__(8); 54420 54421var
vendor: 60,469 bytes, lines 54421-57359
54421 getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 54422 t.Courier = 600; 54423 t["Courier-Bold"] = 600; 54424 t["Courier-BoldOblique"] = 600; 54425 t["Courier-Oblique"] = 600; 54426 t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) { 54427 t.space = 278; 54428 t.exclam = 278; 54429 t.quotedbl = 355; 54430 t.numbersign = 556; 54431 t.dollar = 556; 54432 t.percent = 889; 54433 t.ampersand = 667; 54434 t.quoteright = 222; 54435 t.parenleft = 333; 54436 t.parenright = 333; 54437 t.asterisk = 389; 54438 t.plus = 584; 54439 t.comma = 278; 54440 t.hyphen = 333; 54441 t.period = 278; 54442 t.slash = 278; 54443 t.zero = 556; 54444 t.one = 556; 54445 t.two = 556; 54446 t.three = 556; 54447 t.four = 556; 54448 t.five = 556; 54449 t.six = 556; 54450 t.seven = 556; 54451 t.eight = 556; 54452 t.nine = 556; 54453 t.colon = 278; 54454 t.semicolon = 278; 54455 t.less = 584; 54456 t.equal = 584; 54457 t.greater = 584; 54458 t.question = 556; 54459 t.at = 1015; 54460 t.A = 667; 54461 t.B = 667; 54462 t.C = 722; 54463 t.D = 722; 54464 t.E = 667; 54465 t.F = 611; 54466 t.G = 778; 54467 t.H = 722; 54468 t.I = 278; 54469 t.J = 500; 54470 t.K = 667; 54471 t.L = 556; 54472 t.M = 833; 54473 t.N = 722; 54474 t.O = 778; 54475 t.P = 667; 54476 t.Q = 778; 54477 t.R = 722; 54478 t.S = 667; 54479 t.T = 611; 54480 t.U = 722; 54481 t.V = 667; 54482 t.W = 944; 54483 t.X = 667; 54484 t.Y = 667; 54485 t.Z = 611; 54486 t.bracketleft = 278; 54487 t.backslash = 278; 54488 t.bracketright = 278; 54489 t.asciicircum = 469; 54490 t.underscore = 556; 54491 t.quoteleft = 222; 54492 t.a = 556; 54493 t.b = 556; 54494 t.c = 500; 54495 t.d = 556; 54496 t.e = 556; 54497 t.f = 278; 54498 t.g = 556; 54499 t.h = 556; 54500 t.i = 222; 54501 t.j = 222; 54502 t.k = 500; 54503 t.l = 222; 54504 t.m = 833; 54505 t.n = 556; 54506 t.o = 556; 54507 t.p = 556; 54508 t.q = 556; 54509 t.r = 333; 54510 t.s = 500; 54511 t.t = 278; 54512 t.u = 556; 54513 t.v = 500; 54514 t.w = 722; 54515 t.x = 500; 54516 t.y = 500; 54517 t.z = 500; 54518 t.braceleft = 334; 54519 t.bar = 260; 54520 t.braceright = 334; 54521 t.asciitilde = 584; 54522 t.exclamdown = 333; 54523 t.cent = 556; 54524 t.sterling = 556; 54525 t.fraction = 167; 54526 t.yen = 556; 54527 t.florin = 556; 54528 t.section = 556; 54529 t.currency = 556; 54530 t.quotesingle = 191; 54531 t.quotedblleft = 333; 54532 t.guillemotleft = 556; 54533 t.guilsinglleft = 333; 54534 t.guilsinglright = 333; 54535 t.fi = 500; 54536 t.fl = 500; 54537 t.endash = 556; 54538 t.dagger = 556; 54539 t.daggerdbl = 556; 54540 t.periodcentered = 278; 54541 t.paragraph = 537; 54542 t.bullet = 350; 54543 t.quotesinglbase = 222; 54544 t.quotedblbase = 333; 54545 t.quotedblright = 333; 54546 t.guillemotright = 556; 54547 t.ellipsis = 1000; 54548 t.perthousand = 1000; 54549 t.questiondown = 611; 54550 t.grave = 333; 54551 t.acute = 333; 54552 t.circumflex = 333; 54553 t.tilde = 333; 54554 t.macron = 333; 54555 t.breve = 333; 54556 t.dotaccent = 333; 54557 t.dieresis = 333; 54558 t.ring = 333; 54559 t.cedilla = 333; 54560 t.hungarumlaut = 333; 54561 t.ogonek = 333; 54562 t.caron = 333; 54563 t.emdash = 1000; 54564 t.AE = 1000; 54565 t.ordfeminine = 370; 54566 t.Lslash = 556; 54567 t.Oslash = 778; 54568 t.OE = 1000; 54569 t.ordmasculine = 365; 54570 t.ae = 889; 54571 t.dotlessi = 278; 54572 t.lslash = 222; 54573 t.oslash = 611; 54574 t.oe = 944; 54575 t.germandbls = 611; 54576 t.Idieresis = 278; 54577 t.eacute = 556; 54578 t.abreve = 556; 54579 t.uhungarumlaut = 556; 54580 t.ecaron = 556; 54581 t.Ydieresis = 667; 54582 t.divide = 584; 54583 t.Yacute = 667; 54584 t.Acircumflex = 667; 54585 t.aacute = 556; 54586 t.Ucircumflex = 722; 54587 t.yacute = 500; 54588 t.scommaaccent = 500; 54589 t.ecircumflex = 556; 54590 t.Uring = 722; 54591 t.Udieresis = 722; 54592 t.aogonek = 556; 54593 t.Uacute = 722; 54594 t.uogonek = 556; 54595 t.Edieresis = 667; 54596 t.Dcroat = 722; 54597 t.commaaccent = 250; 54598 t.copyright = 737; 54599 t.Emacron = 667; 54600 t.ccaron = 500; 54601 t.aring = 556; 54602 t.Ncommaaccent = 722; 54603 t.lacute = 222; 54604 t.agrave = 556; 54605 t.Tcommaaccent = 611; 54606 t.Cacute = 722; 54607 t.atilde = 556; 54608 t.Edotaccent = 667; 54609 t.scaron = 500; 54610 t.scedilla = 500; 54611 t.iacute = 278; 54612 t.lozenge = 471; 54613 t.Rcaron = 722; 54614 t.Gcommaaccent = 778; 54615 t.ucircumflex = 556; 54616 t.acircumflex = 556; 54617 t.Amacron = 667; 54618 t.rcaron = 333; 54619 t.ccedilla = 500; 54620 t.Zdotaccent = 611; 54621 t.Thorn = 667; 54622 t.Omacron = 778; 54623 t.Racute = 722; 54624 t.Sacute = 667; 54625 t.dcaron = 643; 54626 t.Umacron = 722; 54627 t.uring = 556; 54628 t.threesuperior = 333; 54629 t.Ograve = 778; 54630 t.Agrave = 667; 54631 t.Abreve = 667; 54632 t.multiply = 584; 54633 t.uacute = 556; 54634 t.Tcaron = 611; 54635 t.partialdiff = 476; 54636 t.ydieresis = 500; 54637 t.Nacute = 722; 54638 t.icircumflex = 278; 54639 t.Ecircumflex = 667; 54640 t.adieresis = 556; 54641 t.edieresis = 556; 54642 t.cacute = 500; 54643 t.nacute = 556; 54644 t.umacron = 556; 54645 t.Ncaron = 722; 54646 t.Iacute = 278; 54647 t.plusminus = 584; 54648 t.brokenbar = 260; 54649 t.registered = 737; 54650 t.Gbreve = 778; 54651 t.Idotaccent = 278; 54652 t.summation = 600; 54653 t.Egrave = 667; 54654 t.racute = 333; 54655 t.omacron = 556; 54656 t.Zacute = 611; 54657 t.Zcaron = 611; 54658 t.greaterequal = 549; 54659 t.Eth = 722; 54660 t.Ccedilla = 722; 54661 t.lcommaaccent = 222; 54662 t.tcaron = 317; 54663 t.eogonek = 556; 54664 t.Uogonek = 722; 54665 t.Aacute = 667; 54666 t.Adieresis = 667; 54667 t.egrave = 556; 54668 t.zacute = 500; 54669 t.iogonek = 222; 54670 t.Oacute = 778; 54671 t.oacute = 556; 54672 t.amacron = 556; 54673 t.sacute = 500; 54674 t.idieresis = 278; 54675 t.Ocircumflex = 778; 54676 t.Ugrave = 722; 54677 t.Delta = 612; 54678 t.thorn = 556; 54679 t.twosuperior = 333; 54680 t.Odieresis = 778; 54681 t.mu = 556; 54682 t.igrave = 278; 54683 t.ohungarumlaut = 556; 54684 t.Eogonek = 667; 54685 t.dcroat = 556; 54686 t.threequarters = 834; 54687 t.Scedilla = 667; 54688 t.lcaron = 299; 54689 t.Kcommaaccent = 667; 54690 t.Lacute = 556; 54691 t.trademark = 1000; 54692 t.edotaccent = 556; 54693 t.Igrave = 278; 54694 t.Imacron = 278; 54695 t.Lcaron = 556; 54696 t.onehalf = 834; 54697 t.lessequal = 549; 54698 t.ocircumflex = 556; 54699 t.ntilde = 556; 54700 t.Uhungarumlaut = 722; 54701 t.Eacute = 667; 54702 t.emacron = 556; 54703 t.gbreve = 556; 54704 t.onequarter = 834; 54705 t.Scaron = 667; 54706 t.Scommaaccent = 667; 54707 t.Ohungarumlaut = 778; 54708 t.degree = 400; 54709 t.ograve = 556; 54710 t.Ccaron = 722; 54711 t.ugrave = 556; 54712 t.radical = 453; 54713 t.Dcaron = 722; 54714 t.rcommaaccent = 333; 54715 t.Ntilde = 722; 54716 t.otilde = 556; 54717 t.Rcommaaccent = 722; 54718 t.Lcommaaccent = 556; 54719 t.Atilde = 667; 54720 t.Aogonek = 667; 54721 t.Aring = 667; 54722 t.Otilde = 778; 54723 t.zdotaccent = 500; 54724 t.Ecaron = 667; 54725 t.Iogonek = 278; 54726 t.kcommaaccent = 500; 54727 t.minus = 584; 54728 t.Icircumflex = 278; 54729 t.ncaron = 556; 54730 t.tcommaaccent = 278; 54731 t.logicalnot = 584; 54732 t.odieresis = 556; 54733 t.udieresis = 556; 54734 t.notequal = 549; 54735 t.gcommaaccent = 556; 54736 t.eth = 556; 54737 t.zcaron = 500; 54738 t.ncommaaccent = 556; 54739 t.onesuperior = 333; 54740 t.imacron = 278; 54741 t.Euro = 556; 54742 }); 54743 t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 54744 t.space = 278; 54745 t.exclam = 333; 54746 t.quotedbl = 474; 54747 t.numbersign = 556; 54748 t.dollar = 556; 54749 t.percent = 889; 54750 t.ampersand = 722; 54751 t.quoteright = 278; 54752 t.parenleft = 333; 54753 t.parenright = 333; 54754 t.asterisk = 389; 54755 t.plus = 584; 54756 t.comma = 278; 54757 t.hyphen = 333; 54758 t.period = 278; 54759 t.slash = 278; 54760 t.zero = 556; 54761 t.one = 556; 54762 t.two = 556; 54763 t.three = 556; 54764 t.four = 556; 54765 t.five = 556; 54766 t.six = 556; 54767 t.seven = 556; 54768 t.eight = 556; 54769 t.nine = 556; 54770 t.colon = 333; 54771 t.semicolon = 333; 54772 t.less = 584; 54773 t.equal = 584; 54774 t.greater = 584; 54775 t.question = 611; 54776 t.at = 975; 54777 t.A = 722; 54778 t.B = 722; 54779 t.C = 722; 54780 t.D = 722; 54781 t.E = 667; 54782 t.F = 611; 54783 t.G = 778; 54784 t.H = 722; 54785 t.I = 278; 54786 t.J = 556; 54787 t.K = 722; 54788 t.L = 611; 54789 t.M = 833; 54790 t.N = 722; 54791 t.O = 778; 54792 t.P = 667; 54793 t.Q = 778; 54794 t.R = 722; 54795 t.S = 667; 54796 t.T = 611; 54797 t.U = 722; 54798 t.V = 667; 54799 t.W = 944; 54800 t.X = 667; 54801 t.Y = 667; 54802 t.Z = 611; 54803 t.bracketleft = 333; 54804 t.backslash = 278; 54805 t.bracketright = 333; 54806 t.asciicircum = 584; 54807 t.underscore = 556; 54808 t.quoteleft = 278; 54809 t.a = 556; 54810 t.b = 611; 54811 t.c = 556; 54812 t.d = 611; 54813 t.e = 556; 54814 t.f = 333; 54815 t.g = 611; 54816 t.h = 611; 54817 t.i = 278; 54818 t.j = 278; 54819 t.k = 556; 54820 t.l = 278; 54821 t.m = 889; 54822 t.n = 611; 54823 t.o = 611; 54824 t.p = 611; 54825 t.q = 611; 54826 t.r = 389; 54827 t.s = 556; 54828 t.t = 333; 54829 t.u = 611; 54830 t.v = 556; 54831 t.w = 778; 54832 t.x = 556; 54833 t.y = 556; 54834 t.z = 500; 54835 t.braceleft = 389; 54836 t.bar = 280; 54837 t.braceright = 389; 54838 t.asciitilde = 584; 54839 t.exclamdown = 333; 54840 t.cent = 556; 54841 t.sterling = 556; 54842 t.fraction = 167; 54843 t.yen = 556; 54844 t.florin = 556; 54845 t.section = 556; 54846 t.currency = 556; 54847 t.quotesingle = 238; 54848 t.quotedblleft = 500; 54849 t.guillemotleft = 556; 54850 t.guilsinglleft = 333; 54851 t.guilsinglright = 333; 54852 t.fi = 611; 54853 t.fl = 611; 54854 t.endash = 556; 54855 t.dagger = 556; 54856 t.daggerdbl = 556; 54857 t.periodcentered = 278; 54858 t.paragraph = 556; 54859 t.bullet = 350; 54860 t.quotesinglbase = 278; 54861 t.quotedblbase = 500; 54862 t.quotedblright = 500; 54863 t.guillemotright = 556; 54864 t.ellipsis = 1000; 54865 t.perthousand = 1000; 54866 t.questiondown = 611; 54867 t.grave = 333; 54868 t.acute = 333; 54869 t.circumflex = 333; 54870 t.tilde = 333; 54871 t.macron = 333; 54872 t.breve = 333; 54873 t.dotaccent = 333; 54874 t.dieresis = 333; 54875 t.ring = 333; 54876 t.cedilla = 333; 54877 t.hungarumlaut = 333; 54878 t.ogonek = 333; 54879 t.caron = 333; 54880 t.emdash = 1000; 54881 t.AE = 1000; 54882 t.ordfeminine = 370; 54883 t.Lslash = 611; 54884 t.Oslash = 778; 54885 t.OE = 1000; 54886 t.ordmasculine = 365; 54887 t.ae = 889; 54888 t.dotlessi = 278; 54889 t.lslash = 278; 54890 t.oslash = 611; 54891 t.oe = 944; 54892 t.germandbls = 611; 54893 t.Idieresis = 278; 54894 t.eacute = 556; 54895 t.abreve = 556; 54896 t.uhungarumlaut = 611; 54897 t.ecaron = 556; 54898 t.Ydieresis = 667; 54899 t.divide = 584; 54900 t.Yacute = 667; 54901 t.Acircumflex = 722; 54902 t.aacute = 556; 54903 t.Ucircumflex = 722; 54904 t.yacute = 556; 54905 t.scommaaccent = 556; 54906 t.ecircumflex = 556; 54907 t.Uring = 722; 54908 t.Udieresis = 722; 54909 t.aogonek = 556; 54910 t.Uacute = 722; 54911 t.uogonek = 611; 54912 t.Edieresis = 667; 54913 t.Dcroat = 722; 54914 t.commaaccent = 250; 54915 t.copyright = 737; 54916 t.Emacron = 667; 54917 t.ccaron = 556; 54918 t.aring = 556; 54919 t.Ncommaaccent = 722; 54920 t.lacute = 278; 54921 t.agrave = 556; 54922 t.Tcommaaccent = 611; 54923 t.Cacute = 722; 54924 t.atilde = 556; 54925 t.Edotaccent = 667; 54926 t.scaron = 556; 54927 t.scedilla = 556; 54928 t.iacute = 278; 54929 t.lozenge = 494; 54930 t.Rcaron = 722; 54931 t.Gcommaaccent = 778; 54932 t.ucircumflex = 611; 54933 t.acircumflex = 556; 54934 t.Amacron = 722; 54935 t.rcaron = 389; 54936 t.ccedilla = 556; 54937 t.Zdotaccent = 611; 54938 t.Thorn = 667; 54939 t.Omacron = 778; 54940 t.Racute = 722; 54941 t.Sacute = 667; 54942 t.dcaron = 743; 54943 t.Umacron = 722; 54944 t.uring = 611; 54945 t.threesuperior = 333; 54946 t.Ograve = 778; 54947 t.Agrave = 722; 54948 t.Abreve = 722; 54949 t.multiply = 584; 54950 t.uacute = 611; 54951 t.Tcaron = 611; 54952 t.partialdiff = 494; 54953 t.ydieresis = 556; 54954 t.Nacute = 722; 54955 t.icircumflex = 278; 54956 t.Ecircumflex = 667; 54957 t.adieresis = 556; 54958 t.edieresis = 556; 54959 t.cacute = 556; 54960 t.nacute = 611; 54961 t.umacron = 611; 54962 t.Ncaron = 722; 54963 t.Iacute = 278; 54964 t.plusminus = 584; 54965 t.brokenbar = 280; 54966 t.registered = 737; 54967 t.Gbreve = 778; 54968 t.Idotaccent = 278; 54969 t.summation = 600; 54970 t.Egrave = 667; 54971 t.racute = 389; 54972 t.omacron = 611; 54973 t.Zacute = 611; 54974 t.Zcaron = 611; 54975 t.greaterequal = 549; 54976 t.Eth = 722; 54977 t.Ccedilla = 722; 54978 t.lcommaaccent = 278; 54979 t.tcaron = 389; 54980 t.eogonek = 556; 54981 t.Uogonek = 722; 54982 t.Aacute = 722; 54983 t.Adieresis = 722; 54984 t.egrave = 556; 54985 t.zacute = 500; 54986 t.iogonek = 278; 54987 t.Oacute = 778; 54988 t.oacute = 611; 54989 t.amacron = 556; 54990 t.sacute = 556; 54991 t.idieresis = 278; 54992 t.Ocircumflex = 778; 54993 t.Ugrave = 722; 54994 t.Delta = 612; 54995 t.thorn = 611; 54996 t.twosuperior = 333; 54997 t.Odieresis = 778; 54998 t.mu = 611; 54999 t.igrave = 278; 55000 t.ohungarumlaut = 611; 55001 t.Eogonek = 667; 55002 t.dcroat = 611; 55003 t.threequarters = 834; 55004 t.Scedilla = 667; 55005 t.lcaron = 400; 55006 t.Kcommaaccent = 722; 55007 t.Lacute = 611; 55008 t.trademark = 1000; 55009 t.edotaccent = 556; 55010 t.Igrave = 278; 55011 t.Imacron = 278; 55012 t.Lcaron = 611; 55013 t.onehalf = 834; 55014 t.lessequal = 549; 55015 t.ocircumflex = 611; 55016 t.ntilde = 611; 55017 t.Uhungarumlaut = 722; 55018 t.Eacute = 667; 55019 t.emacron = 556; 55020 t.gbreve = 611; 55021 t.onequarter = 834; 55022 t.Scaron = 667; 55023 t.Scommaaccent = 667; 55024 t.Ohungarumlaut = 778; 55025 t.degree = 400; 55026 t.ograve = 611; 55027 t.Ccaron = 722; 55028 t.ugrave = 611; 55029 t.radical = 549; 55030 t.Dcaron = 722; 55031 t.rcommaaccent = 389; 55032 t.Ntilde = 722; 55033 t.otilde = 611; 55034 t.Rcommaaccent = 722; 55035 t.Lcommaaccent = 611; 55036 t.Atilde = 722; 55037 t.Aogonek = 722; 55038 t.Aring = 722; 55039 t.Otilde = 778; 55040 t.zdotaccent = 500; 55041 t.Ecaron = 667; 55042 t.Iogonek = 278; 55043 t.kcommaaccent = 556; 55044 t.minus = 584; 55045 t.Icircumflex = 278; 55046 t.ncaron = 611; 55047 t.tcommaaccent = 333; 55048 t.logicalnot = 584; 55049 t.odieresis = 611; 55050 t.udieresis = 611; 55051 t.notequal = 549; 55052 t.gcommaaccent = 611; 55053 t.eth = 611; 55054 t.zcaron = 500; 55055 t.ncommaaccent = 611; 55056 t.onesuperior = 333; 55057 t.imacron = 278; 55058 t.Euro = 556; 55059 }); 55060 t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 55061 t.space = 278; 55062 t.exclam = 333; 55063 t.quotedbl = 474; 55064 t.numbersign = 556; 55065 t.dollar = 556; 55066 t.percent = 889; 55067 t.ampersand = 722; 55068 t.quoteright = 278; 55069 t.parenleft = 333; 55070 t.parenright = 333; 55071 t.asterisk = 389; 55072 t.plus = 584; 55073 t.comma = 278; 55074 t.hyphen = 333; 55075 t.period = 278; 55076 t.slash = 278; 55077 t.zero = 556; 55078 t.one = 556; 55079 t.two = 556; 55080 t.three = 556; 55081 t.four = 556; 55082 t.five = 556; 55083 t.six = 556; 55084 t.seven = 556; 55085 t.eight = 556; 55086 t.nine = 556; 55087 t.colon = 333; 55088 t.semicolon = 333; 55089 t.less = 584; 55090 t.equal = 584; 55091 t.greater = 584; 55092 t.question = 611; 55093 t.at = 975; 55094 t.A = 722; 55095 t.B = 722; 55096 t.C = 722; 55097 t.D = 722; 55098 t.E = 667; 55099 t.F = 611; 55100 t.G = 778; 55101 t.H = 722; 55102 t.I = 278; 55103 t.J = 556; 55104 t.K = 722; 55105 t.L = 611; 55106 t.M = 833; 55107 t.N = 722; 55108 t.O = 778; 55109 t.P = 667; 55110 t.Q = 778; 55111 t.R = 722; 55112 t.S = 667; 55113 t.T = 611; 55114 t.U = 722; 55115 t.V = 667; 55116 t.W = 944; 55117 t.X = 667; 55118 t.Y = 667; 55119 t.Z = 611; 55120 t.bracketleft = 333; 55121 t.backslash = 278; 55122 t.bracketright = 333; 55123 t.asciicircum = 584; 55124 t.underscore = 556; 55125 t.quoteleft = 278; 55126 t.a = 556; 55127 t.b = 611; 55128 t.c = 556; 55129 t.d = 611; 55130 t.e = 556; 55131 t.f = 333; 55132 t.g = 611; 55133 t.h = 611; 55134 t.i = 278; 55135 t.j = 278; 55136 t.k = 556; 55137 t.l = 278; 55138 t.m = 889; 55139 t.n = 611; 55140 t.o = 611; 55141 t.p = 611; 55142 t.q = 611; 55143 t.r = 389; 55144 t.s = 556; 55145 t.t = 333; 55146 t.u = 611; 55147 t.v = 556; 55148 t.w = 778; 55149 t.x = 556; 55150 t.y = 556; 55151 t.z = 500; 55152 t.braceleft = 389; 55153 t.bar = 280; 55154 t.braceright = 389; 55155 t.asciitilde = 584; 55156 t.exclamdown = 333; 55157 t.cent = 556; 55158 t.sterling = 556; 55159 t.fraction = 167; 55160 t.yen = 556; 55161 t.florin = 556; 55162 t.section = 556; 55163 t.currency = 556; 55164 t.quotesingle = 238; 55165 t.quotedblleft = 500; 55166 t.guillemotleft = 556; 55167 t.guilsinglleft = 333; 55168 t.guilsinglright = 333; 55169 t.fi = 611; 55170 t.fl = 611; 55171 t.endash = 556; 55172 t.dagger = 556; 55173 t.daggerdbl = 556; 55174 t.periodcentered = 278; 55175 t.paragraph = 556; 55176 t.bullet = 350; 55177 t.quotesinglbase = 278; 55178 t.quotedblbase = 500; 55179 t.quotedblright = 500; 55180 t.guillemotright = 556; 55181 t.ellipsis = 1000; 55182 t.perthousand = 1000; 55183 t.questiondown = 611; 55184 t.grave = 333; 55185 t.acute = 333; 55186 t.circumflex = 333; 55187 t.tilde = 333; 55188 t.macron = 333; 55189 t.breve = 333; 55190 t.dotaccent = 333; 55191 t.dieresis = 333; 55192 t.ring = 333; 55193 t.cedilla = 333; 55194 t.hungarumlaut = 333; 55195 t.ogonek = 333; 55196 t.caron = 333; 55197 t.emdash = 1000; 55198 t.AE = 1000; 55199 t.ordfeminine = 370; 55200 t.Lslash = 611; 55201 t.Oslash = 778; 55202 t.OE = 1000; 55203 t.ordmasculine = 365; 55204 t.ae = 889; 55205 t.dotlessi = 278; 55206 t.lslash = 278; 55207 t.oslash = 611; 55208 t.oe = 944; 55209 t.germandbls = 611; 55210 t.Idieresis = 278; 55211 t.eacute = 556; 55212 t.abreve = 556; 55213 t.uhungarumlaut = 611; 55214 t.ecaron = 556; 55215 t.Ydieresis = 667; 55216 t.divide = 584; 55217 t.Yacute = 667; 55218 t.Acircumflex = 722; 55219 t.aacute = 556; 55220 t.Ucircumflex = 722; 55221 t.yacute = 556; 55222 t.scommaaccent = 556; 55223 t.ecircumflex = 556; 55224 t.Uring = 722; 55225 t.Udieresis = 722; 55226 t.aogonek = 556; 55227 t.Uacute = 722; 55228 t.uogonek = 611; 55229 t.Edieresis = 667; 55230 t.Dcroat = 722; 55231 t.commaaccent = 250; 55232 t.copyright = 737; 55233 t.Emacron = 667; 55234 t.ccaron = 556; 55235 t.aring = 556; 55236 t.Ncommaaccent = 722; 55237 t.lacute = 278; 55238 t.agrave = 556; 55239 t.Tcommaaccent = 611; 55240 t.Cacute = 722; 55241 t.atilde = 556; 55242 t.Edotaccent = 667; 55243 t.scaron = 556; 55244 t.scedilla = 556; 55245 t.iacute = 278; 55246 t.lozenge = 494; 55247 t.Rcaron = 722; 55248 t.Gcommaaccent = 778; 55249 t.ucircumflex = 611; 55250 t.acircumflex = 556; 55251 t.Amacron = 722; 55252 t.rcaron = 389; 55253 t.ccedilla = 556; 55254 t.Zdotaccent = 611; 55255 t.Thorn = 667; 55256 t.Omacron = 778; 55257 t.Racute = 722; 55258 t.Sacute = 667; 55259 t.dcaron = 743; 55260 t.Umacron = 722; 55261 t.uring = 611; 55262 t.threesuperior = 333; 55263 t.Ograve = 778; 55264 t.Agrave = 722; 55265 t.Abreve = 722; 55266 t.multiply = 584; 55267 t.uacute = 611; 55268 t.Tcaron = 611; 55269 t.partialdiff = 494; 55270 t.ydieresis = 556; 55271 t.Nacute = 722; 55272 t.icircumflex = 278; 55273 t.Ecircumflex = 667; 55274 t.adieresis = 556; 55275 t.edieresis = 556; 55276 t.cacute = 556; 55277 t.nacute = 611; 55278 t.umacron = 611; 55279 t.Ncaron = 722; 55280 t.Iacute = 278; 55281 t.plusminus = 584; 55282 t.brokenbar = 280; 55283 t.registered = 737; 55284 t.Gbreve = 778; 55285 t.Idotaccent = 278; 55286 t.summation = 600; 55287 t.Egrave = 667; 55288 t.racute = 389; 55289 t.omacron = 611; 55290 t.Zacute = 611; 55291 t.Zcaron = 611; 55292 t.greaterequal = 549; 55293 t.Eth = 722; 55294 t.Ccedilla = 722; 55295 t.lcommaaccent = 278; 55296 t.tcaron = 389; 55297 t.eogonek = 556; 55298 t.Uogonek = 722; 55299 t.Aacute = 722; 55300 t.Adieresis = 722; 55301 t.egrave = 556; 55302 t.zacute = 500; 55303 t.iogonek = 278; 55304 t.Oacute = 778; 55305 t.oacute = 611; 55306 t.amacron = 556; 55307 t.sacute = 556; 55308 t.idieresis = 278; 55309 t.Ocircumflex = 778; 55310 t.Ugrave = 722; 55311 t.Delta = 612; 55312 t.thorn = 611; 55313 t.twosuperior = 333; 55314 t.Odieresis = 778; 55315 t.mu = 611; 55316 t.igrave = 278; 55317 t.ohungarumlaut = 611; 55318 t.Eogonek = 667; 55319 t.dcroat = 611; 55320 t.threequarters = 834; 55321 t.Scedilla = 667; 55322 t.lcaron = 400; 55323 t.Kcommaaccent = 722; 55324 t.Lacute = 611; 55325 t.trademark = 1000; 55326 t.edotaccent = 556; 55327 t.Igrave = 278; 55328 t.Imacron = 278; 55329 t.Lcaron = 611; 55330 t.onehalf = 834; 55331 t.lessequal = 549; 55332 t.ocircumflex = 611; 55333 t.ntilde = 611; 55334 t.Uhungarumlaut = 722; 55335 t.Eacute = 667; 55336 t.emacron = 556; 55337 t.gbreve = 611; 55338 t.onequarter = 834; 55339 t.Scaron = 667; 55340 t.Scommaaccent = 667; 55341 t.Ohungarumlaut = 778; 55342 t.degree = 400; 55343 t.ograve = 611; 55344 t.Ccaron = 722; 55345 t.ugrave = 611; 55346 t.radical = 549; 55347 t.Dcaron = 722; 55348 t.rcommaaccent = 389; 55349 t.Ntilde = 722; 55350 t.otilde = 611; 55351 t.Rcommaaccent = 722; 55352 t.Lcommaaccent = 611; 55353 t.Atilde = 722; 55354 t.Aogonek = 722; 55355 t.Aring = 722; 55356 t.Otilde = 778; 55357 t.zdotaccent = 500; 55358 t.Ecaron = 667; 55359 t.Iogonek = 278; 55360 t.kcommaaccent = 556; 55361 t.minus = 584; 55362 t.Icircumflex = 278; 55363 t.ncaron = 611; 55364 t.tcommaaccent = 333; 55365 t.logicalnot = 584; 55366 t.odieresis = 611; 55367 t.udieresis = 611; 55368 t.notequal = 549; 55369 t.gcommaaccent = 611; 55370 t.eth = 611; 55371 t.zcaron = 500; 55372 t.ncommaaccent = 611; 55373 t.onesuperior = 333; 55374 t.imacron = 278; 55375 t.Euro = 556; 55376 }); 55377 t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 55378 t.space = 278; 55379 t.exclam = 278; 55380 t.quotedbl = 355; 55381 t.numbersign = 556; 55382 t.dollar = 556; 55383 t.percent = 889; 55384 t.ampersand = 667; 55385 t.quoteright = 222; 55386 t.parenleft = 333; 55387 t.parenright = 333; 55388 t.asterisk = 389; 55389 t.plus = 584; 55390 t.comma = 278; 55391 t.hyphen = 333; 55392 t.period = 278; 55393 t.slash = 278; 55394 t.zero = 556; 55395 t.one = 556; 55396 t.two = 556; 55397 t.three = 556; 55398 t.four = 556; 55399 t.five = 556; 55400 t.six = 556; 55401 t.seven = 556; 55402 t.eight = 556; 55403 t.nine = 556; 55404 t.colon = 278; 55405 t.semicolon = 278; 55406 t.less = 584; 55407 t.equal = 584; 55408 t.greater = 584; 55409 t.question = 556; 55410 t.at = 1015; 55411 t.A = 667; 55412 t.B = 667; 55413 t.C = 722; 55414 t.D = 722; 55415 t.E = 667; 55416 t.F = 611; 55417 t.G = 778; 55418 t.H = 722; 55419 t.I = 278; 55420 t.J = 500; 55421 t.K = 667; 55422 t.L = 556; 55423 t.M = 833; 55424 t.N = 722; 55425 t.O = 778; 55426 t.P = 667; 55427 t.Q = 778; 55428 t.R = 722; 55429 t.S = 667; 55430 t.T = 611; 55431 t.U = 722; 55432 t.V = 667; 55433 t.W = 944; 55434 t.X = 667; 55435 t.Y = 667; 55436 t.Z = 611; 55437 t.bracketleft = 278; 55438 t.backslash = 278; 55439 t.bracketright = 278; 55440 t.asciicircum = 469; 55441 t.underscore = 556; 55442 t.quoteleft = 222; 55443 t.a = 556; 55444 t.b = 556; 55445 t.c = 500; 55446 t.d = 556; 55447 t.e = 556; 55448 t.f = 278; 55449 t.g = 556; 55450 t.h = 556; 55451 t.i = 222; 55452 t.j = 222; 55453 t.k = 500; 55454 t.l = 222; 55455 t.m = 833; 55456 t.n = 556; 55457 t.o = 556; 55458 t.p = 556; 55459 t.q = 556; 55460 t.r = 333; 55461 t.s = 500; 55462 t.t = 278; 55463 t.u = 556; 55464 t.v = 500; 55465 t.w = 722; 55466 t.x = 500; 55467 t.y = 500; 55468 t.z = 500; 55469 t.braceleft = 334; 55470 t.bar = 260; 55471 t.braceright = 334; 55472 t.asciitilde = 584; 55473 t.exclamdown = 333; 55474 t.cent = 556; 55475 t.sterling = 556; 55476 t.fraction = 167; 55477 t.yen = 556; 55478 t.florin = 556; 55479 t.section = 556; 55480 t.currency = 556; 55481 t.quotesingle = 191; 55482 t.quotedblleft = 333; 55483 t.guillemotleft = 556; 55484 t.guilsinglleft = 333; 55485 t.guilsinglright = 333; 55486 t.fi = 500; 55487 t.fl = 500; 55488 t.endash = 556; 55489 t.dagger = 556; 55490 t.daggerdbl = 556; 55491 t.periodcentered = 278; 55492 t.paragraph = 537; 55493 t.bullet = 350; 55494 t.quotesinglbase = 222; 55495 t.quotedblbase = 333; 55496 t.quotedblright = 333; 55497 t.guillemotright = 556; 55498 t.ellipsis = 1000; 55499 t.perthousand = 1000; 55500 t.questiondown = 611; 55501 t.grave = 333; 55502 t.acute = 333; 55503 t.circumflex = 333; 55504 t.tilde = 333; 55505 t.macron = 333; 55506 t.breve = 333; 55507 t.dotaccent = 333; 55508 t.dieresis = 333; 55509 t.ring = 333; 55510 t.cedilla = 333; 55511 t.hungarumlaut = 333; 55512 t.ogonek = 333; 55513 t.caron = 333; 55514 t.emdash = 1000; 55515 t.AE = 1000; 55516 t.ordfeminine = 370; 55517 t.Lslash = 556; 55518 t.Oslash = 778; 55519 t.OE = 1000; 55520 t.ordmasculine = 365; 55521 t.ae = 889; 55522 t.dotlessi = 278; 55523 t.lslash = 222; 55524 t.oslash = 611; 55525 t.oe = 944; 55526 t.germandbls = 611; 55527 t.Idieresis = 278; 55528 t.eacute = 556; 55529 t.abreve = 556; 55530 t.uhungarumlaut = 556; 55531 t.ecaron = 556; 55532 t.Ydieresis = 667; 55533 t.divide = 584; 55534 t.Yacute = 667; 55535 t.Acircumflex = 667; 55536 t.aacute = 556; 55537 t.Ucircumflex = 722; 55538 t.yacute = 500; 55539 t.scommaaccent = 500; 55540 t.ecircumflex = 556; 55541 t.Uring = 722; 55542 t.Udieresis = 722; 55543 t.aogonek = 556; 55544 t.Uacute = 722; 55545 t.uogonek = 556; 55546 t.Edieresis = 667; 55547 t.Dcroat = 722; 55548 t.commaaccent = 250; 55549 t.copyright = 737; 55550 t.Emacron = 667; 55551 t.ccaron = 500; 55552 t.aring = 556; 55553 t.Ncommaaccent = 722; 55554 t.lacute = 222; 55555 t.agrave = 556; 55556 t.Tcommaaccent = 611; 55557 t.Cacute = 722; 55558 t.atilde = 556; 55559 t.Edotaccent = 667; 55560 t.scaron = 500; 55561 t.scedilla = 500; 55562 t.iacute = 278; 55563 t.lozenge = 471; 55564 t.Rcaron = 722; 55565 t.Gcommaaccent = 778; 55566 t.ucircumflex = 556; 55567 t.acircumflex = 556; 55568 t.Amacron = 667; 55569 t.rcaron = 333; 55570 t.ccedilla = 500; 55571 t.Zdotaccent = 611; 55572 t.Thorn = 667; 55573 t.Omacron = 778; 55574 t.Racute = 722; 55575 t.Sacute = 667; 55576 t.dcaron = 643; 55577 t.Umacron = 722; 55578 t.uring = 556; 55579 t.threesuperior = 333; 55580 t.Ograve = 778; 55581 t.Agrave = 667; 55582 t.Abreve = 667; 55583 t.multiply = 584; 55584 t.uacute = 556; 55585 t.Tcaron = 611; 55586 t.partialdiff = 476; 55587 t.ydieresis = 500; 55588 t.Nacute = 722; 55589 t.icircumflex = 278; 55590 t.Ecircumflex = 667; 55591 t.adieresis = 556; 55592 t.edieresis = 556; 55593 t.cacute = 500; 55594 t.nacute = 556; 55595 t.umacron = 556; 55596 t.Ncaron = 722; 55597 t.Iacute = 278; 55598 t.plusminus = 584; 55599 t.brokenbar = 260; 55600 t.registered = 737; 55601 t.Gbreve = 778; 55602 t.Idotaccent = 278; 55603 t.summation = 600; 55604 t.Egrave = 667; 55605 t.racute = 333; 55606 t.omacron = 556; 55607 t.Zacute = 611; 55608 t.Zcaron = 611; 55609 t.greaterequal = 549; 55610 t.Eth = 722; 55611 t.Ccedilla = 722; 55612 t.lcommaaccent = 222; 55613 t.tcaron = 317; 55614 t.eogonek = 556; 55615 t.Uogonek = 722; 55616 t.Aacute = 667; 55617 t.Adieresis = 667; 55618 t.egrave = 556; 55619 t.zacute = 500; 55620 t.iogonek = 222; 55621 t.Oacute = 778; 55622 t.oacute = 556; 55623 t.amacron = 556; 55624 t.sacute = 500; 55625 t.idieresis = 278; 55626 t.Ocircumflex = 778; 55627 t.Ugrave = 722; 55628 t.Delta = 612; 55629 t.thorn = 556; 55630 t.twosuperior = 333; 55631 t.Odieresis = 778; 55632 t.mu = 556; 55633 t.igrave = 278; 55634 t.ohungarumlaut = 556; 55635 t.Eogonek = 667; 55636 t.dcroat = 556; 55637 t.threequarters = 834; 55638 t.Scedilla = 667; 55639 t.lcaron = 299; 55640 t.Kcommaaccent = 667; 55641 t.Lacute = 556; 55642 t.trademark = 1000; 55643 t.edotaccent = 556; 55644 t.Igrave = 278; 55645 t.Imacron = 278; 55646 t.Lcaron = 556; 55647 t.onehalf = 834; 55648 t.lessequal = 549; 55649 t.ocircumflex = 556; 55650 t.ntilde = 556; 55651 t.Uhungarumlaut = 722; 55652 t.Eacute = 667; 55653 t.emacron = 556; 55654 t.gbreve = 556; 55655 t.onequarter = 834; 55656 t.Scaron = 667; 55657 t.Scommaaccent = 667; 55658 t.Ohungarumlaut = 778; 55659 t.degree = 400; 55660 t.ograve = 556; 55661 t.Ccaron = 722; 55662 t.ugrave = 556; 55663 t.radical = 453; 55664 t.Dcaron = 722; 55665 t.rcommaaccent = 333; 55666 t.Ntilde = 722; 55667 t.otilde = 556; 55668 t.Rcommaaccent = 722; 55669 t.Lcommaaccent = 556; 55670 t.Atilde = 667; 55671 t.Aogonek = 667; 55672 t.Aring = 667; 55673 t.Otilde = 778; 55674 t.zdotaccent = 500; 55675 t.Ecaron = 667; 55676 t.Iogonek = 278; 55677 t.kcommaaccent = 500; 55678 t.minus = 584; 55679 t.Icircumflex = 278; 55680 t.ncaron = 556; 55681 t.tcommaaccent = 278; 55682 t.logicalnot = 584; 55683 t.odieresis = 556; 55684 t.udieresis = 556; 55685 t.notequal = 549; 55686 t.gcommaaccent = 556; 55687 t.eth = 556; 55688 t.zcaron = 500; 55689 t.ncommaaccent = 556; 55690 t.onesuperior = 333; 55691 t.imacron = 278; 55692 t.Euro = 556; 55693 }); 55694 t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) { 55695 t.space = 250; 55696 t.exclam = 333; 55697 t.universal = 713; 55698 t.numbersign = 500; 55699 t.existential = 549; 55700 t.percent = 833; 55701 t.ampersand = 778; 55702 t.suchthat = 439; 55703 t.parenleft = 333; 55704 t.parenright = 333; 55705 t.asteriskmath = 500; 55706 t.plus = 549; 55707 t.comma = 250; 55708 t.minus = 549; 55709 t.period = 250; 55710 t.slash = 278; 55711 t.zero = 500; 55712 t.one = 500; 55713 t.two = 500; 55714 t.three = 500; 55715 t.four = 500; 55716 t.five = 500; 55717 t.six = 500; 55718 t.seven = 500; 55719 t.eight = 500; 55720 t.nine = 500; 55721 t.colon = 278; 55722 t.semicolon = 278; 55723 t.less = 549; 55724 t.equal = 549; 55725 t.greater = 549; 55726 t.question = 444; 55727 t.congruent = 549; 55728 t.Alpha = 722; 55729 t.Beta = 667; 55730 t.Chi = 722; 55731 t.Delta = 612; 55732 t.Epsilon = 611; 55733 t.Phi = 763; 55734 t.Gamma = 603; 55735 t.Eta = 722; 55736 t.Iota = 333; 55737 t.theta1 = 631; 55738 t.Kappa = 722; 55739 t.Lambda = 686; 55740 t.Mu = 889; 55741 t.Nu = 722; 55742 t.Omicron = 722; 55743 t.Pi = 768; 55744 t.Theta = 741; 55745 t.Rho = 556; 55746 t.Sigma = 592; 55747 t.Tau = 611; 55748 t.Upsilon = 690; 55749 t.sigma1 = 439; 55750 t.Omega = 768; 55751 t.Xi = 645; 55752 t.Psi = 795; 55753 t.Zeta = 611; 55754 t.bracketleft = 333; 55755 t.therefore = 863; 55756 t.bracketright = 333; 55757 t.perpendicular = 658; 55758 t.underscore = 500; 55759 t.radicalex = 500; 55760 t.alpha = 631; 55761 t.beta = 549; 55762 t.chi = 549; 55763 t.delta = 494; 55764 t.epsilon = 439; 55765 t.phi = 521; 55766 t.gamma = 411; 55767 t.eta = 603; 55768 t.iota = 329; 55769 t.phi1 = 603; 55770 t.kappa = 549; 55771 t.lambda = 549; 55772 t.mu = 576; 55773 t.nu = 521; 55774 t.omicron = 549; 55775 t.pi = 549; 55776 t.theta = 521; 55777 t.rho = 549; 55778 t.sigma = 603; 55779 t.tau = 439; 55780 t.upsilon = 576; 55781 t.omega1 = 713; 55782 t.omega = 686; 55783 t.xi = 493; 55784 t.psi = 686; 55785 t.zeta = 494; 55786 t.braceleft = 480; 55787 t.bar = 200; 55788 t.braceright = 480; 55789 t.similar = 549; 55790 t.Euro = 750; 55791 t.Upsilon1 = 620; 55792 t.minute = 247; 55793 t.lessequal = 549; 55794 t.fraction = 167; 55795 t.infinity = 713; 55796 t.florin = 500; 55797 t.club = 753; 55798 t.diamond = 753; 55799 t.heart = 753; 55800 t.spade = 753; 55801 t.arrowboth = 1042; 55802 t.arrowleft = 987; 55803 t.arrowup = 603; 55804 t.arrowright = 987; 55805 t.arrowdown = 603; 55806 t.degree = 400; 55807 t.plusminus = 549; 55808 t.second = 411; 55809 t.greaterequal = 549; 55810 t.multiply = 549; 55811 t.proportional = 713; 55812 t.partialdiff = 494; 55813 t.bullet = 460; 55814 t.divide = 549; 55815 t.notequal = 549; 55816 t.equivalence = 549; 55817 t.approxequal = 549; 55818 t.ellipsis = 1000; 55819 t.arrowvertex = 603; 55820 t.arrowhorizex = 1000; 55821 t.carriagereturn = 658; 55822 t.aleph = 823; 55823 t.Ifraktur = 686; 55824 t.Rfraktur = 795; 55825 t.weierstrass = 987; 55826 t.circlemultiply = 768; 55827 t.circleplus = 768; 55828 t.emptyset = 823; 55829 t.intersection = 768; 55830 t.union = 768; 55831 t.propersuperset = 713; 55832 t.reflexsuperset = 713; 55833 t.notsubset = 713; 55834 t.propersubset = 713; 55835 t.reflexsubset = 713; 55836 t.element = 713; 55837 t.notelement = 713; 55838 t.angle = 768; 55839 t.gradient = 713; 55840 t.registerserif = 790; 55841 t.copyrightserif = 790; 55842 t.trademarkserif = 890; 55843 t.product = 823; 55844 t.radical = 549; 55845 t.dotmath = 250; 55846 t.logicalnot = 713; 55847 t.logicaland = 603; 55848 t.logicalor = 603; 55849 t.arrowdblboth = 1042; 55850 t.arrowdblleft = 987; 55851 t.arrowdblup = 603; 55852 t.arrowdblright = 987; 55853 t.arrowdbldown = 603; 55854 t.lozenge = 494; 55855 t.angleleft = 329; 55856 t.registersans = 790; 55857 t.copyrightsans = 790; 55858 t.trademarksans = 786; 55859 t.summation = 713; 55860 t.parenlefttp = 384; 55861 t.parenleftex = 384; 55862 t.parenleftbt = 384; 55863 t.bracketlefttp = 384; 55864 t.bracketleftex = 384; 55865 t.bracketleftbt = 384; 55866 t.bracelefttp = 494; 55867 t.braceleftmid = 494; 55868 t.braceleftbt = 494; 55869 t.braceex = 494; 55870 t.angleright = 329; 55871 t.integral = 274; 55872 t.integraltp = 686; 55873 t.integralex = 686; 55874 t.integralbt = 686; 55875 t.parenrighttp = 384; 55876 t.parenrightex = 384; 55877 t.parenrightbt = 384; 55878 t.bracketrighttp = 384; 55879 t.bracketrightex = 384; 55880 t.bracketrightbt = 384; 55881 t.bracerighttp = 494; 55882 t.bracerightmid = 494; 55883 t.bracerightbt = 494; 55884 t.apple = 790; 55885 }); 55886 t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) { 55887 t.space = 250; 55888 t.exclam = 333; 55889 t.quotedbl = 408; 55890 t.numbersign = 500; 55891 t.dollar = 500; 55892 t.percent = 833; 55893 t.ampersand = 778; 55894 t.quoteright = 333; 55895 t.parenleft = 333; 55896 t.parenright = 333; 55897 t.asterisk = 500; 55898 t.plus = 564; 55899 t.comma = 250; 55900 t.hyphen = 333; 55901 t.period = 250; 55902 t.slash = 278; 55903 t.zero = 500; 55904 t.one = 500; 55905 t.two = 500; 55906 t.three = 500; 55907 t.four = 500; 55908 t.five = 500; 55909 t.six = 500; 55910 t.seven = 500; 55911 t.eight = 500; 55912 t.nine = 500; 55913 t.colon = 278; 55914 t.semicolon = 278; 55915 t.less = 564; 55916 t.equal = 564; 55917 t.greater = 564; 55918 t.question = 444; 55919 t.at = 921; 55920 t.A = 722; 55921 t.B = 667; 55922 t.C = 667; 55923 t.D = 722; 55924 t.E = 611; 55925 t.F = 556; 55926 t.G = 722; 55927 t.H = 722; 55928 t.I = 333; 55929 t.J = 389; 55930 t.K = 722; 55931 t.L = 611; 55932 t.M = 889; 55933 t.N = 722; 55934 t.O = 722; 55935 t.P = 556; 55936 t.Q = 722; 55937 t.R = 667; 55938 t.S = 556; 55939 t.T = 611; 55940 t.U = 722; 55941 t.V = 722; 55942 t.W = 944; 55943 t.X = 722; 55944 t.Y = 722; 55945 t.Z = 611; 55946 t.bracketleft = 333; 55947 t.backslash = 278; 55948 t.bracketright = 333; 55949 t.asciicircum = 469; 55950 t.underscore = 500; 55951 t.quoteleft = 333; 55952 t.a = 444; 55953 t.b = 500; 55954 t.c = 444; 55955 t.d = 500; 55956 t.e = 444; 55957 t.f = 333; 55958 t.g = 500; 55959 t.h = 500; 55960 t.i = 278; 55961 t.j = 278; 55962 t.k = 500; 55963 t.l = 278; 55964 t.m = 778; 55965 t.n = 500; 55966 t.o = 500; 55967 t.p = 500; 55968 t.q = 500; 55969 t.r = 333; 55970 t.s = 389; 55971 t.t = 278; 55972 t.u = 500; 55973 t.v = 500; 55974 t.w = 722; 55975 t.x = 500; 55976 t.y = 500; 55977 t.z = 444; 55978 t.braceleft = 480; 55979 t.bar = 200; 55980 t.braceright = 480; 55981 t.asciitilde = 541; 55982 t.exclamdown = 333; 55983 t.cent = 500; 55984 t.sterling = 500; 55985 t.fraction = 167; 55986 t.yen = 500; 55987 t.florin = 500; 55988 t.section = 500; 55989 t.currency = 500; 55990 t.quotesingle = 180; 55991 t.quotedblleft = 444; 55992 t.guillemotleft = 500; 55993 t.guilsinglleft = 333; 55994 t.guilsinglright = 333; 55995 t.fi = 556; 55996 t.fl = 556; 55997 t.endash = 500; 55998 t.dagger = 500; 55999 t.daggerdbl = 500; 56000 t.periodcentered = 250; 56001 t.paragraph = 453; 56002 t.bullet = 350; 56003 t.quotesinglbase = 333; 56004 t.quotedblbase = 444; 56005 t.quotedblright = 444; 56006 t.guillemotright = 500; 56007 t.ellipsis = 1000; 56008 t.perthousand = 1000; 56009 t.questiondown = 444; 56010 t.grave = 333; 56011 t.acute = 333; 56012 t.circumflex = 333; 56013 t.tilde = 333; 56014 t.macron = 333; 56015 t.breve = 333; 56016 t.dotaccent = 333; 56017 t.dieresis = 333; 56018 t.ring = 333; 56019 t.cedilla = 333; 56020 t.hungarumlaut = 333; 56021 t.ogonek = 333; 56022 t.caron = 333; 56023 t.emdash = 1000; 56024 t.AE = 889; 56025 t.ordfeminine = 276; 56026 t.Lslash = 611; 56027 t.Oslash = 722; 56028 t.OE = 889; 56029 t.ordmasculine = 310; 56030 t.ae = 667; 56031 t.dotlessi = 278; 56032 t.lslash = 278; 56033 t.oslash = 500; 56034 t.oe = 722; 56035 t.germandbls = 500; 56036 t.Idieresis = 333; 56037 t.eacute = 444; 56038 t.abreve = 444; 56039 t.uhungarumlaut = 500; 56040 t.ecaron = 444; 56041 t.Ydieresis = 722; 56042 t.divide = 564; 56043 t.Yacute = 722; 56044 t.Acircumflex = 722; 56045 t.aacute = 444; 56046 t.Ucircumflex = 722; 56047 t.yacute = 500; 56048 t.scommaaccent = 389; 56049 t.ecircumflex = 444; 56050 t.Uring = 722; 56051 t.Udieresis = 722; 56052 t.aogonek = 444; 56053 t.Uacute = 722; 56054 t.uogonek = 500; 56055 t.Edieresis = 611; 56056 t.Dcroat = 722; 56057 t.commaaccent = 250; 56058 t.copyright = 760; 56059 t.Emacron = 611; 56060 t.ccaron = 444; 56061 t.aring = 444; 56062 t.Ncommaaccent = 722; 56063 t.lacute = 278; 56064 t.agrave = 444; 56065 t.Tcommaaccent = 611; 56066 t.Cacute = 667; 56067 t.atilde = 444; 56068 t.Edotaccent = 611; 56069 t.scaron = 389; 56070 t.scedilla = 389; 56071 t.iacute = 278; 56072 t.lozenge = 471; 56073 t.Rcaron = 667; 56074 t.Gcommaaccent = 722; 56075 t.ucircumflex = 500; 56076 t.acircumflex = 444; 56077 t.Amacron = 722; 56078 t.rcaron = 333; 56079 t.ccedilla = 444; 56080 t.Zdotaccent = 611; 56081 t.Thorn = 556; 56082 t.Omacron = 722; 56083 t.Racute = 667; 56084 t.Sacute = 556; 56085 t.dcaron = 588; 56086 t.Umacron = 722; 56087 t.uring = 500; 56088 t.threesuperior = 300; 56089 t.Ograve = 722; 56090 t.Agrave = 722; 56091 t.Abreve = 722; 56092 t.multiply = 564; 56093 t.uacute = 500; 56094 t.Tcaron = 611; 56095 t.partialdiff = 476; 56096 t.ydieresis = 500; 56097 t.Nacute = 722; 56098 t.icircumflex = 278; 56099 t.Ecircumflex = 611; 56100 t.adieresis = 444; 56101 t.edieresis = 444; 56102 t.cacute = 444; 56103 t.nacute = 500; 56104 t.umacron = 500; 56105 t.Ncaron = 722; 56106 t.Iacute = 333; 56107 t.plusminus = 564; 56108 t.brokenbar = 200; 56109 t.registered = 760; 56110 t.Gbreve = 722; 56111 t.Idotaccent = 333; 56112 t.summation = 600; 56113 t.Egrave = 611; 56114 t.racute = 333; 56115 t.omacron = 500; 56116 t.Zacute = 611; 56117 t.Zcaron = 611; 56118 t.greaterequal = 549; 56119 t.Eth = 722; 56120 t.Ccedilla = 667; 56121 t.lcommaaccent = 278; 56122 t.tcaron = 326; 56123 t.eogonek = 444; 56124 t.Uogonek = 722; 56125 t.Aacute = 722; 56126 t.Adieresis = 722; 56127 t.egrave = 444; 56128 t.zacute = 444; 56129 t.iogonek = 278; 56130 t.Oacute = 722; 56131 t.oacute = 500; 56132 t.amacron = 444; 56133 t.sacute = 389; 56134 t.idieresis = 278; 56135 t.Ocircumflex = 722; 56136 t.Ugrave = 722; 56137 t.Delta = 612; 56138 t.thorn = 500; 56139 t.twosuperior = 300; 56140 t.Odieresis = 722; 56141 t.mu = 500; 56142 t.igrave = 278; 56143 t.ohungarumlaut = 500; 56144 t.Eogonek = 611; 56145 t.dcroat = 500; 56146 t.threequarters = 750; 56147 t.Scedilla = 556; 56148 t.lcaron = 344; 56149 t.Kcommaaccent = 722; 56150 t.Lacute = 611; 56151 t.trademark = 980; 56152 t.edotaccent = 444; 56153 t.Igrave = 333; 56154 t.Imacron = 333; 56155 t.Lcaron = 611; 56156 t.onehalf = 750; 56157 t.lessequal = 549; 56158 t.ocircumflex = 500; 56159 t.ntilde = 500; 56160 t.Uhungarumlaut = 722; 56161 t.Eacute = 611; 56162 t.emacron = 444; 56163 t.gbreve = 500; 56164 t.onequarter = 750; 56165 t.Scaron = 556; 56166 t.Scommaaccent = 556; 56167 t.Ohungarumlaut = 722; 56168 t.degree = 400; 56169 t.ograve = 500; 56170 t.Ccaron = 667; 56171 t.ugrave = 500; 56172 t.radical = 453; 56173 t.Dcaron = 722; 56174 t.rcommaaccent = 333; 56175 t.Ntilde = 722; 56176 t.otilde = 500; 56177 t.Rcommaaccent = 667; 56178 t.Lcommaaccent = 611; 56179 t.Atilde = 722; 56180 t.Aogonek = 722; 56181 t.Aring = 722; 56182 t.Otilde = 722; 56183 t.zdotaccent = 444; 56184 t.Ecaron = 611; 56185 t.Iogonek = 333; 56186 t.kcommaaccent = 500; 56187 t.minus = 564; 56188 t.Icircumflex = 333; 56189 t.ncaron = 500; 56190 t.tcommaaccent = 278; 56191 t.logicalnot = 564; 56192 t.odieresis = 500; 56193 t.udieresis = 500; 56194 t.notequal = 549; 56195 t.gcommaaccent = 500; 56196 t.eth = 500; 56197 t.zcaron = 444; 56198 t.ncommaaccent = 500; 56199 t.onesuperior = 300; 56200 t.imacron = 278; 56201 t.Euro = 500; 56202 }); 56203 t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 56204 t.space = 250; 56205 t.exclam = 333; 56206 t.quotedbl = 555; 56207 t.numbersign = 500; 56208 t.dollar = 500; 56209 t.percent = 1000; 56210 t.ampersand = 833; 56211 t.quoteright = 333; 56212 t.parenleft = 333; 56213 t.parenright = 333; 56214 t.asterisk = 500; 56215 t.plus = 570; 56216 t.comma = 250; 56217 t.hyphen = 333; 56218 t.period = 250; 56219 t.slash = 278; 56220 t.zero = 500; 56221 t.one = 500; 56222 t.two = 500; 56223 t.three = 500; 56224 t.four = 500; 56225 t.five = 500; 56226 t.six = 500; 56227 t.seven = 500; 56228 t.eight = 500; 56229 t.nine = 500; 56230 t.colon = 333; 56231 t.semicolon = 333; 56232 t.less = 570; 56233 t.equal = 570; 56234 t.greater = 570; 56235 t.question = 500; 56236 t.at = 930; 56237 t.A = 722; 56238 t.B = 667; 56239 t.C = 722; 56240 t.D = 722; 56241 t.E = 667; 56242 t.F = 611; 56243 t.G = 778; 56244 t.H = 778; 56245 t.I = 389; 56246 t.J = 500; 56247 t.K = 778; 56248 t.L = 667; 56249 t.M = 944; 56250 t.N = 722; 56251 t.O = 778; 56252 t.P = 611; 56253 t.Q = 778; 56254 t.R = 722; 56255 t.S = 556; 56256 t.T = 667; 56257 t.U = 722; 56258 t.V = 722; 56259 t.W = 1000; 56260 t.X = 722; 56261 t.Y = 722; 56262 t.Z = 667; 56263 t.bracketleft = 333; 56264 t.backslash = 278; 56265 t.bracketright = 333; 56266 t.asciicircum = 581; 56267 t.underscore = 500; 56268 t.quoteleft = 333; 56269 t.a = 500; 56270 t.b = 556; 56271 t.c = 444; 56272 t.d = 556; 56273 t.e = 444; 56274 t.f = 333; 56275 t.g = 500; 56276 t.h = 556; 56277 t.i = 278; 56278 t.j = 333; 56279 t.k = 556; 56280 t.l = 278; 56281 t.m = 833; 56282 t.n = 556; 56283 t.o = 500; 56284 t.p = 556; 56285 t.q = 556; 56286 t.r = 444; 56287 t.s = 389; 56288 t.t = 333; 56289 t.u = 556; 56290 t.v = 500; 56291 t.w = 722; 56292 t.x = 500; 56293 t.y = 500; 56294 t.z = 444; 56295 t.braceleft = 394; 56296 t.bar = 220; 56297 t.braceright = 394; 56298 t.asciitilde = 520; 56299 t.exclamdown = 333; 56300 t.cent = 500; 56301 t.sterling = 500; 56302 t.fraction = 167; 56303 t.yen = 500; 56304 t.florin = 500; 56305 t.section = 500; 56306 t.currency = 500; 56307 t.quotesingle = 278; 56308 t.quotedblleft = 500; 56309 t.guillemotleft = 500; 56310 t.guilsinglleft = 333; 56311 t.guilsinglright = 333; 56312 t.fi = 556; 56313 t.fl = 556; 56314 t.endash = 500; 56315 t.dagger = 500; 56316 t.daggerdbl = 500; 56317 t.periodcentered = 250; 56318 t.paragraph = 540; 56319 t.bullet = 350; 56320 t.quotesinglbase = 333; 56321 t.quotedblbase = 500; 56322 t.quotedblright = 500; 56323 t.guillemotright = 500; 56324 t.ellipsis = 1000; 56325 t.perthousand = 1000; 56326 t.questiondown = 500; 56327 t.grave = 333; 56328 t.acute = 333; 56329 t.circumflex = 333; 56330 t.tilde = 333; 56331 t.macron = 333; 56332 t.breve = 333; 56333 t.dotaccent = 333; 56334 t.dieresis = 333; 56335 t.ring = 333; 56336 t.cedilla = 333; 56337 t.hungarumlaut = 333; 56338 t.ogonek = 333; 56339 t.caron = 333; 56340 t.emdash = 1000; 56341 t.AE = 1000; 56342 t.ordfeminine = 300; 56343 t.Lslash = 667; 56344 t.Oslash = 778; 56345 t.OE = 1000; 56346 t.ordmasculine = 330; 56347 t.ae = 722; 56348 t.dotlessi = 278; 56349 t.lslash = 278; 56350 t.oslash = 500; 56351 t.oe = 722; 56352 t.germandbls = 556; 56353 t.Idieresis = 389; 56354 t.eacute = 444; 56355 t.abreve = 500; 56356 t.uhungarumlaut = 556; 56357 t.ecaron = 444; 56358 t.Ydieresis = 722; 56359 t.divide = 570; 56360 t.Yacute = 722; 56361 t.Acircumflex = 722; 56362 t.aacute = 500; 56363 t.Ucircumflex = 722; 56364 t.yacute = 500; 56365 t.scommaaccent = 389; 56366 t.ecircumflex = 444; 56367 t.Uring = 722; 56368 t.Udieresis = 722; 56369 t.aogonek = 500; 56370 t.Uacute = 722; 56371 t.uogonek = 556; 56372 t.Edieresis = 667; 56373 t.Dcroat = 722; 56374 t.commaaccent = 250; 56375 t.copyright = 747; 56376 t.Emacron = 667; 56377 t.ccaron = 444; 56378 t.aring = 500; 56379 t.Ncommaaccent = 722; 56380 t.lacute = 278; 56381 t.agrave = 500; 56382 t.Tcommaaccent = 667; 56383 t.Cacute = 722; 56384 t.atilde = 500; 56385 t.Edotaccent = 667; 56386 t.scaron = 389; 56387 t.scedilla = 389; 56388 t.iacute = 278; 56389 t.lozenge = 494; 56390 t.Rcaron = 722; 56391 t.Gcommaaccent = 778; 56392 t.ucircumflex = 556; 56393 t.acircumflex = 500; 56394 t.Amacron = 722; 56395 t.rcaron = 444; 56396 t.ccedilla = 444; 56397 t.Zdotaccent = 667; 56398 t.Thorn = 611; 56399 t.Omacron = 778; 56400 t.Racute = 722; 56401 t.Sacute = 556; 56402 t.dcaron = 672; 56403 t.Umacron = 722; 56404 t.uring = 556; 56405 t.threesuperior = 300; 56406 t.Ograve = 778; 56407 t.Agrave = 722; 56408 t.Abreve = 722; 56409 t.multiply = 570; 56410 t.uacute = 556; 56411 t.Tcaron = 667; 56412 t.partialdiff = 494; 56413 t.ydieresis = 500; 56414 t.Nacute = 722; 56415 t.icircumflex = 278; 56416 t.Ecircumflex = 667; 56417 t.adieresis = 500; 56418 t.edieresis = 444; 56419 t.cacute = 444; 56420 t.nacute = 556; 56421 t.umacron = 556; 56422 t.Ncaron = 722; 56423 t.Iacute = 389; 56424 t.plusminus = 570; 56425 t.brokenbar = 220; 56426 t.registered = 747; 56427 t.Gbreve = 778; 56428 t.Idotaccent = 389; 56429 t.summation = 600; 56430 t.Egrave = 667; 56431 t.racute = 444; 56432 t.omacron = 500; 56433 t.Zacute = 667; 56434 t.Zcaron = 667; 56435 t.greaterequal = 549; 56436 t.Eth = 722; 56437 t.Ccedilla = 722; 56438 t.lcommaaccent = 278; 56439 t.tcaron = 416; 56440 t.eogonek = 444; 56441 t.Uogonek = 722; 56442 t.Aacute = 722; 56443 t.Adieresis = 722; 56444 t.egrave = 444; 56445 t.zacute = 444; 56446 t.iogonek = 278; 56447 t.Oacute = 778; 56448 t.oacute = 500; 56449 t.amacron = 500; 56450 t.sacute = 389; 56451 t.idieresis = 278; 56452 t.Ocircumflex = 778; 56453 t.Ugrave = 722; 56454 t.Delta = 612; 56455 t.thorn = 556; 56456 t.twosuperior = 300; 56457 t.Odieresis = 778; 56458 t.mu = 556; 56459 t.igrave = 278; 56460 t.ohungarumlaut = 500; 56461 t.Eogonek = 667; 56462 t.dcroat = 556; 56463 t.threequarters = 750; 56464 t.Scedilla = 556; 56465 t.lcaron = 394; 56466 t.Kcommaaccent = 778; 56467 t.Lacute = 667; 56468 t.trademark = 1000; 56469 t.edotaccent = 444; 56470 t.Igrave = 389; 56471 t.Imacron = 389; 56472 t.Lcaron = 667; 56473 t.onehalf = 750; 56474 t.lessequal = 549; 56475 t.ocircumflex = 500; 56476 t.ntilde = 556; 56477 t.Uhungarumlaut = 722; 56478 t.Eacute = 667; 56479 t.emacron = 444; 56480 t.gbreve = 500; 56481 t.onequarter = 750; 56482 t.Scaron = 556; 56483 t.Scommaaccent = 556; 56484 t.Ohungarumlaut = 778; 56485 t.degree = 400; 56486 t.ograve = 500; 56487 t.Ccaron = 722; 56488 t.ugrave = 556; 56489 t.radical = 549; 56490 t.Dcaron = 722; 56491 t.rcommaaccent = 444; 56492 t.Ntilde = 722; 56493 t.otilde = 500; 56494 t.Rcommaaccent = 722; 56495 t.Lcommaaccent = 667; 56496 t.Atilde = 722; 56497 t.Aogonek = 722; 56498 t.Aring = 722; 56499 t.Otilde = 778; 56500 t.zdotaccent = 444; 56501 t.Ecaron = 667; 56502 t.Iogonek = 389; 56503 t.kcommaaccent = 556; 56504 t.minus = 570; 56505 t.Icircumflex = 389; 56506 t.ncaron = 556; 56507 t.tcommaaccent = 333; 56508 t.logicalnot = 570; 56509 t.odieresis = 500; 56510 t.udieresis = 556; 56511 t.notequal = 549; 56512 t.gcommaaccent = 500; 56513 t.eth = 500; 56514 t.zcaron = 444; 56515 t.ncommaaccent = 556; 56516 t.onesuperior = 300; 56517 t.imacron = 278; 56518 t.Euro = 500; 56519 }); 56520 t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 56521 t.space = 250; 56522 t.exclam = 389; 56523 t.quotedbl = 555; 56524 t.numbersign = 500; 56525 t.dollar = 500; 56526 t.percent = 833; 56527 t.ampersand = 778; 56528 t.quoteright = 333; 56529 t.parenleft = 333; 56530 t.parenright = 333; 56531 t.asterisk = 500; 56532 t.plus = 570; 56533 t.comma = 250; 56534 t.hyphen = 333; 56535 t.period = 250; 56536 t.slash = 278; 56537 t.zero = 500; 56538 t.one = 500; 56539 t.two = 500; 56540 t.three = 500; 56541 t.four = 500; 56542 t.five = 500; 56543 t.six = 500; 56544 t.seven = 500; 56545 t.eight = 500; 56546 t.nine = 500; 56547 t.colon = 333; 56548 t.semicolon = 333; 56549 t.less = 570; 56550 t.equal = 570; 56551 t.greater = 570; 56552 t.question = 500; 56553 t.at = 832; 56554 t.A = 667; 56555 t.B = 667; 56556 t.C = 667; 56557 t.D = 722; 56558 t.E = 667; 56559 t.F = 667; 56560 t.G = 722; 56561 t.H = 778; 56562 t.I = 389; 56563 t.J = 500; 56564 t.K = 667; 56565 t.L = 611; 56566 t.M = 889; 56567 t.N = 722; 56568 t.O = 722; 56569 t.P = 611; 56570 t.Q = 722; 56571 t.R = 667; 56572 t.S = 556; 56573 t.T = 611; 56574 t.U = 722; 56575 t.V = 667; 56576 t.W = 889; 56577 t.X = 667; 56578 t.Y = 611; 56579 t.Z = 611; 56580 t.bracketleft = 333; 56581 t.backslash = 278; 56582 t.bracketright = 333; 56583 t.asciicircum = 570; 56584 t.underscore = 500; 56585 t.quoteleft = 333; 56586 t.a = 500; 56587 t.b = 500; 56588 t.c = 444; 56589 t.d = 500; 56590 t.e = 444; 56591 t.f = 333; 56592 t.g = 500; 56593 t.h = 556; 56594 t.i = 278; 56595 t.j = 278; 56596 t.k = 500; 56597 t.l = 278; 56598 t.m = 778; 56599 t.n = 556; 56600 t.o = 500; 56601 t.p = 500; 56602 t.q = 500; 56603 t.r = 389; 56604 t.s = 389; 56605 t.t = 278; 56606 t.u = 556; 56607 t.v = 444; 56608 t.w = 667; 56609 t.x = 500; 56610 t.y = 444; 56611 t.z = 389; 56612 t.braceleft = 348; 56613 t.bar = 220; 56614 t.braceright = 348; 56615 t.asciitilde = 570; 56616 t.exclamdown = 389; 56617 t.cent = 500; 56618 t.sterling = 500; 56619 t.fraction = 167; 56620 t.yen = 500; 56621 t.florin = 500; 56622 t.section = 500; 56623 t.currency = 500; 56624 t.quotesingle = 278; 56625 t.quotedblleft = 500; 56626 t.guillemotleft = 500; 56627 t.guilsinglleft = 333; 56628 t.guilsinglright = 333; 56629 t.fi = 556; 56630 t.fl = 556; 56631 t.endash = 500; 56632 t.dagger = 500; 56633 t.daggerdbl = 500; 56634 t.periodcentered = 250; 56635 t.paragraph = 500; 56636 t.bullet = 350; 56637 t.quotesinglbase = 333; 56638 t.quotedblbase = 500; 56639 t.quotedblright = 500; 56640 t.guillemotright = 500; 56641 t.ellipsis = 1000; 56642 t.perthousand = 1000; 56643 t.questiondown = 500; 56644 t.grave = 333; 56645 t.acute = 333; 56646 t.circumflex = 333; 56647 t.tilde = 333; 56648 t.macron = 333; 56649 t.breve = 333; 56650 t.dotaccent = 333; 56651 t.dieresis = 333; 56652 t.ring = 333; 56653 t.cedilla = 333; 56654 t.hungarumlaut = 333; 56655 t.ogonek = 333; 56656 t.caron = 333; 56657 t.emdash = 1000; 56658 t.AE = 944; 56659 t.ordfeminine = 266; 56660 t.Lslash = 611; 56661 t.Oslash = 722; 56662 t.OE = 944; 56663 t.ordmasculine = 300; 56664 t.ae = 722; 56665 t.dotlessi = 278; 56666 t.lslash = 278; 56667 t.oslash = 500; 56668 t.oe = 722; 56669 t.germandbls = 500; 56670 t.Idieresis = 389; 56671 t.eacute = 444; 56672 t.abreve = 500; 56673 t.uhungarumlaut = 556; 56674 t.ecaron = 444; 56675 t.Ydieresis = 611; 56676 t.divide = 570; 56677 t.Yacute = 611; 56678 t.Acircumflex = 667; 56679 t.aacute = 500; 56680 t.Ucircumflex = 722; 56681 t.yacute = 444; 56682 t.scommaaccent = 389; 56683 t.ecircumflex = 444; 56684 t.Uring = 722; 56685 t.Udieresis = 722; 56686 t.aogonek = 500; 56687 t.Uacute = 722; 56688 t.uogonek = 556; 56689 t.Edieresis = 667; 56690 t.Dcroat = 722; 56691 t.commaaccent = 250; 56692 t.copyright = 747; 56693 t.Emacron = 667; 56694 t.ccaron = 444; 56695 t.aring = 500; 56696 t.Ncommaaccent = 722; 56697 t.lacute = 278; 56698 t.agrave = 500; 56699 t.Tcommaaccent = 611; 56700 t.Cacute = 667; 56701 t.atilde = 500; 56702 t.Edotaccent = 667; 56703 t.scaron = 389; 56704 t.scedilla = 389; 56705 t.iacute = 278; 56706 t.lozenge = 494; 56707 t.Rcaron = 667; 56708 t.Gcommaaccent = 722; 56709 t.ucircumflex = 556; 56710 t.acircumflex = 500; 56711 t.Amacron = 667; 56712 t.rcaron = 389; 56713 t.ccedilla = 444; 56714 t.Zdotaccent = 611; 56715 t.Thorn = 611; 56716 t.Omacron = 722; 56717 t.Racute = 667; 56718 t.Sacute = 556; 56719 t.dcaron = 608; 56720 t.Umacron = 722; 56721 t.uring = 556; 56722 t.threesuperior = 300; 56723 t.Ograve = 722; 56724 t.Agrave = 667; 56725 t.Abreve = 667; 56726 t.multiply = 570; 56727 t.uacute = 556; 56728 t.Tcaron = 611; 56729 t.partialdiff = 494; 56730 t.ydieresis = 444; 56731 t.Nacute = 722; 56732 t.icircumflex = 278; 56733 t.Ecircumflex = 667; 56734 t.adieresis = 500; 56735 t.edieresis = 444; 56736 t.cacute = 444; 56737 t.nacute = 556; 56738 t.umacron = 556; 56739 t.Ncaron = 722; 56740 t.Iacute = 389; 56741 t.plusminus = 570; 56742 t.brokenbar = 220; 56743 t.registered = 747; 56744 t.Gbreve = 722; 56745 t.Idotaccent = 389; 56746 t.summation = 600; 56747 t.Egrave = 667; 56748 t.racute = 389; 56749 t.omacron = 500; 56750 t.Zacute = 611; 56751 t.Zcaron = 611; 56752 t.greaterequal = 549; 56753 t.Eth = 722; 56754 t.Ccedilla = 667; 56755 t.lcommaaccent = 278; 56756 t.tcaron = 366; 56757 t.eogonek = 444; 56758 t.Uogonek = 722; 56759 t.Aacute = 667; 56760 t.Adieresis = 667; 56761 t.egrave = 444; 56762 t.zacute = 389; 56763 t.iogonek = 278; 56764 t.Oacute = 722; 56765 t.oacute = 500; 56766 t.amacron = 500; 56767 t.sacute = 389; 56768 t.idieresis = 278; 56769 t.Ocircumflex = 722; 56770 t.Ugrave = 722; 56771 t.Delta = 612; 56772 t.thorn = 500; 56773 t.twosuperior = 300; 56774 t.Odieresis = 722; 56775 t.mu = 576; 56776 t.igrave = 278; 56777 t.ohungarumlaut = 500; 56778 t.Eogonek = 667; 56779 t.dcroat = 500; 56780 t.threequarters = 750; 56781 t.Scedilla = 556; 56782 t.lcaron = 382; 56783 t.Kcommaaccent = 667; 56784 t.Lacute = 611; 56785 t.trademark = 1000; 56786 t.edotaccent = 444; 56787 t.Igrave = 389; 56788 t.Imacron = 389; 56789 t.Lcaron = 611; 56790 t.onehalf = 750; 56791 t.lessequal = 549; 56792 t.ocircumflex = 500; 56793 t.ntilde = 556; 56794 t.Uhungarumlaut = 722; 56795 t.Eacute = 667; 56796 t.emacron = 444; 56797 t.gbreve = 500; 56798 t.onequarter = 750; 56799 t.Scaron = 556; 56800 t.Scommaaccent = 556; 56801 t.Ohungarumlaut = 722; 56802 t.degree = 400; 56803 t.ograve = 500; 56804 t.Ccaron = 667; 56805 t.ugrave = 556; 56806 t.radical = 549; 56807 t.Dcaron = 722; 56808 t.rcommaaccent = 389; 56809 t.Ntilde = 722; 56810 t.otilde = 500; 56811 t.Rcommaaccent = 667; 56812 t.Lcommaaccent = 611; 56813 t.Atilde = 667; 56814 t.Aogonek = 667; 56815 t.Aring = 667; 56816 t.Otilde = 722; 56817 t.zdotaccent = 389; 56818 t.Ecaron = 667; 56819 t.Iogonek = 389; 56820 t.kcommaaccent = 500; 56821 t.minus = 606; 56822 t.Icircumflex = 389; 56823 t.ncaron = 556; 56824 t.tcommaaccent = 278; 56825 t.logicalnot = 606; 56826 t.odieresis = 500; 56827 t.udieresis = 556; 56828 t.notequal = 549; 56829 t.gcommaaccent = 500; 56830 t.eth = 500; 56831 t.zcaron = 389; 56832 t.ncommaaccent = 556; 56833 t.onesuperior = 300; 56834 t.imacron = 278; 56835 t.Euro = 500; 56836 }); 56837 t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 56838 t.space = 250; 56839 t.exclam = 333; 56840 t.quotedbl = 420; 56841 t.numbersign = 500; 56842 t.dollar = 500; 56843 t.percent = 833; 56844 t.ampersand = 778; 56845 t.quoteright = 333; 56846 t.parenleft = 333; 56847 t.parenright = 333; 56848 t.asterisk = 500; 56849 t.plus = 675; 56850 t.comma = 250; 56851 t.hyphen = 333; 56852 t.period = 250; 56853 t.slash = 278; 56854 t.zero = 500; 56855 t.one = 500; 56856 t.two = 500; 56857 t.three = 500; 56858 t.four = 500; 56859 t.five = 500; 56860 t.six = 500; 56861 t.seven = 500; 56862 t.eight = 500; 56863 t.nine = 500; 56864 t.colon = 333; 56865 t.semicolon = 333; 56866 t.less = 675; 56867 t.equal = 675; 56868 t.greater = 675; 56869 t.question = 500; 56870 t.at = 920; 56871 t.A = 611; 56872 t.B = 611; 56873 t.C = 667; 56874 t.D = 722; 56875 t.E = 611; 56876 t.F = 611; 56877 t.G = 722; 56878 t.H = 722; 56879 t.I = 333; 56880 t.J = 444; 56881 t.K = 667; 56882 t.L = 556; 56883 t.M = 833; 56884 t.N = 667; 56885 t.O = 722; 56886 t.P = 611; 56887 t.Q = 722; 56888 t.R = 611; 56889 t.S = 500; 56890 t.T = 556; 56891 t.U = 722; 56892 t.V = 611; 56893 t.W = 833; 56894 t.X = 611; 56895 t.Y = 556; 56896 t.Z = 556; 56897 t.bracketleft = 389; 56898 t.backslash = 278; 56899 t.bracketright = 389; 56900 t.asciicircum = 422; 56901 t.underscore = 500; 56902 t.quoteleft = 333; 56903 t.a = 500; 56904 t.b = 500; 56905 t.c = 444; 56906 t.d = 500; 56907 t.e = 444; 56908 t.f = 278; 56909 t.g = 500; 56910 t.h = 500; 56911 t.i = 278; 56912 t.j = 278; 56913 t.k = 444; 56914 t.l = 278; 56915 t.m = 722; 56916 t.n = 500; 56917 t.o = 500; 56918 t.p = 500; 56919 t.q = 500; 56920 t.r = 389; 56921 t.s = 389; 56922 t.t = 278; 56923 t.u = 500; 56924 t.v = 444; 56925 t.w = 667; 56926 t.x = 444; 56927 t.y = 444; 56928 t.z = 389; 56929 t.braceleft = 400; 56930 t.bar = 275; 56931 t.braceright = 400; 56932 t.asciitilde = 541; 56933 t.exclamdown = 389; 56934 t.cent = 500; 56935 t.sterling = 500; 56936 t.fraction = 167; 56937 t.yen = 500; 56938 t.florin = 500; 56939 t.section = 500; 56940 t.currency = 500; 56941 t.quotesingle = 214; 56942 t.quotedblleft = 556; 56943 t.guillemotleft = 500; 56944 t.guilsinglleft = 333; 56945 t.guilsinglright = 333; 56946 t.fi = 500; 56947 t.fl = 500; 56948 t.endash = 500; 56949 t.dagger = 500; 56950 t.daggerdbl = 500; 56951 t.periodcentered = 250; 56952 t.paragraph = 523; 56953 t.bullet = 350; 56954 t.quotesinglbase = 333; 56955 t.quotedblbase = 556; 56956 t.quotedblright = 556; 56957 t.guillemotright = 500; 56958 t.ellipsis = 889; 56959 t.perthousand = 1000; 56960 t.questiondown = 500; 56961 t.grave = 333; 56962 t.acute = 333; 56963 t.circumflex = 333; 56964 t.tilde = 333; 56965 t.macron = 333; 56966 t.breve = 333; 56967 t.dotaccent = 333; 56968 t.dieresis = 333; 56969 t.ring = 333; 56970 t.cedilla = 333; 56971 t.hungarumlaut = 333; 56972 t.ogonek = 333; 56973 t.caron = 333; 56974 t.emdash = 889; 56975 t.AE = 889; 56976 t.ordfeminine = 276; 56977 t.Lslash = 556; 56978 t.Oslash = 722; 56979 t.OE = 944; 56980 t.ordmasculine = 310; 56981 t.ae = 667; 56982 t.dotlessi = 278; 56983 t.lslash = 278; 56984 t.oslash = 500; 56985 t.oe = 667; 56986 t.germandbls = 500; 56987 t.Idieresis = 333; 56988 t.eacute = 444; 56989 t.abreve = 500; 56990 t.uhungarumlaut = 500; 56991 t.ecaron = 444; 56992 t.Ydieresis = 556; 56993 t.divide = 675; 56994 t.Yacute = 556; 56995 t.Acircumflex = 611; 56996 t.aacute = 500; 56997 t.Ucircumflex = 722; 56998 t.yacute = 444; 56999 t.scommaaccent = 389; 57000 t.ecircumflex = 444; 57001 t.Uring = 722; 57002 t.Udieresis = 722; 57003 t.aogonek = 500; 57004 t.Uacute = 722; 57005 t.uogonek = 500; 57006 t.Edieresis = 611; 57007 t.Dcroat = 722; 57008 t.commaaccent = 250; 57009 t.copyright = 760; 57010 t.Emacron = 611; 57011 t.ccaron = 444; 57012 t.aring = 500; 57013 t.Ncommaaccent = 667; 57014 t.lacute = 278; 57015 t.agrave = 500; 57016 t.Tcommaaccent = 556; 57017 t.Cacute = 667; 57018 t.atilde = 500; 57019 t.Edotaccent = 611; 57020 t.scaron = 389; 57021 t.scedilla = 389; 57022 t.iacute = 278; 57023 t.lozenge = 471; 57024 t.Rcaron = 611; 57025 t.Gcommaaccent = 722; 57026 t.ucircumflex = 500; 57027 t.acircumflex = 500; 57028 t.Amacron = 611; 57029 t.rcaron = 389; 57030 t.ccedilla = 444; 57031 t.Zdotaccent = 556; 57032 t.Thorn = 611; 57033 t.Omacron = 722; 57034 t.Racute = 611; 57035 t.Sacute = 500; 57036 t.dcaron = 544; 57037 t.Umacron = 722; 57038 t.uring = 500; 57039 t.threesuperior = 300; 57040 t.Ograve = 722; 57041 t.Agrave = 611; 57042 t.Abreve = 611; 57043 t.multiply = 675; 57044 t.uacute = 500; 57045 t.Tcaron = 556; 57046 t.partialdiff = 476; 57047 t.ydieresis = 444; 57048 t.Nacute = 667; 57049 t.icircumflex = 278; 57050 t.Ecircumflex = 611; 57051 t.adieresis = 500; 57052 t.edieresis = 444; 57053 t.cacute = 444; 57054 t.nacute = 500; 57055 t.umacron = 500; 57056 t.Ncaron = 667; 57057 t.Iacute = 333; 57058 t.plusminus = 675; 57059 t.brokenbar = 275; 57060 t.registered = 760; 57061 t.Gbreve = 722; 57062 t.Idotaccent = 333; 57063 t.summation = 600; 57064 t.Egrave = 611; 57065 t.racute = 389; 57066 t.omacron = 500; 57067 t.Zacute = 556; 57068 t.Zcaron = 556; 57069 t.greaterequal = 549; 57070 t.Eth = 722; 57071 t.Ccedilla = 667; 57072 t.lcommaaccent = 278; 57073 t.tcaron = 300; 57074 t.eogonek = 444; 57075 t.Uogonek = 722; 57076 t.Aacute = 611; 57077 t.Adieresis = 611; 57078 t.egrave = 444; 57079 t.zacute = 389; 57080 t.iogonek = 278; 57081 t.Oacute = 722; 57082 t.oacute = 500; 57083 t.amacron = 500; 57084 t.sacute = 389; 57085 t.idieresis = 278; 57086 t.Ocircumflex = 722; 57087 t.Ugrave = 722; 57088 t.Delta = 612; 57089 t.thorn = 500; 57090 t.twosuperior = 300; 57091 t.Odieresis = 722; 57092 t.mu = 500; 57093 t.igrave = 278; 57094 t.ohungarumlaut = 500; 57095 t.Eogonek = 611; 57096 t.dcroat = 500; 57097 t.threequarters = 750; 57098 t.Scedilla = 500; 57099 t.lcaron = 300; 57100 t.Kcommaaccent = 667; 57101 t.Lacute = 556; 57102 t.trademark = 980; 57103 t.edotaccent = 444; 57104 t.Igrave = 333; 57105 t.Imacron = 333; 57106 t.Lcaron = 611; 57107 t.onehalf = 750; 57108 t.lessequal = 549; 57109 t.ocircumflex = 500; 57110 t.ntilde = 500; 57111 t.Uhungarumlaut = 722; 57112 t.Eacute = 611; 57113 t.emacron = 444; 57114 t.gbreve = 500; 57115 t.onequarter = 750; 57116 t.Scaron = 500; 57117 t.Scommaaccent = 500; 57118 t.Ohungarumlaut = 722; 57119 t.degree = 400; 57120 t.ograve = 500; 57121 t.Ccaron = 667; 57122 t.ugrave = 500; 57123 t.radical = 453; 57124 t.Dcaron = 722; 57125 t.rcommaaccent = 389; 57126 t.Ntilde = 667; 57127 t.otilde = 500; 57128 t.Rcommaaccent = 611; 57129 t.Lcommaaccent = 556; 57130 t.Atilde = 611; 57131 t.Aogonek = 611; 57132 t.Aring = 611; 57133 t.Otilde = 722; 57134 t.zdotaccent = 389; 57135 t.Ecaron = 611; 57136 t.Iogonek = 333; 57137 t.kcommaaccent = 444; 57138 t.minus = 675; 57139 t.Icircumflex = 333; 57140 t.ncaron = 500; 57141 t.tcommaaccent = 278; 57142 t.logicalnot = 675; 57143 t.odieresis = 500; 57144 t.udieresis = 500; 57145 t.notequal = 549; 57146 t.gcommaaccent = 500; 57147 t.eth = 500; 57148 t.zcaron = 389; 57149 t.ncommaaccent = 500; 57150 t.onesuperior = 300; 57151 t.imacron = 278; 57152 t.Euro = 500; 57153 }); 57154 t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) { 57155 t.space = 278; 57156 t.a1 = 974; 57157 t.a2 = 961; 57158 t.a202 = 974; 57159 t.a3 = 980; 57160 t.a4 = 719; 57161 t.a5 = 789; 57162 t.a119 = 790; 57163 t.a118 = 791; 57164 t.a117 = 690; 57165 t.a11 = 960; 57166 t.a12 = 939; 57167 t.a13 = 549; 57168 t.a14 = 855; 57169 t.a15 = 911; 57170 t.a16 = 933; 57171 t.a105 = 911; 57172 t.a17 = 945; 57173 t.a18 = 974; 57174 t.a19 = 755; 57175 t.a20 = 846; 57176 t.a21 = 762; 57177 t.a22 = 761; 57178 t.a23 = 571; 57179 t.a24 = 677; 57180 t.a25 = 763; 57181 t.a26 = 760; 57182 t.a27 = 759; 57183 t.a28 = 754; 57184 t.a6 = 494; 57185 t.a7 = 552; 57186 t.a8 = 537; 57187 t.a9 = 577; 57188 t.a10 = 692; 57189 t.a29 = 786; 57190 t.a30 = 788; 57191 t.a31 = 788; 57192 t.a32 = 790; 57193 t.a33 = 793; 57194 t.a34 = 794; 57195 t.a35 = 816; 57196 t.a36 = 823; 57197 t.a37 = 789; 57198 t.a38 = 841; 57199 t.a39 = 823; 57200 t.a40 = 833; 57201 t.a41 = 816; 57202 t.a42 = 831; 57203 t.a43 = 923; 57204 t.a44 = 744; 57205 t.a45 = 723; 57206 t.a46 = 749; 57207 t.a47 = 790; 57208 t.a48 = 792; 57209 t.a49 = 695; 57210 t.a50 = 776; 57211 t.a51 = 768; 57212 t.a52 = 792; 57213 t.a53 = 759; 57214 t.a54 = 707; 57215 t.a55 = 708; 57216 t.a56 = 682; 57217 t.a57 = 701; 57218 t.a58 = 826; 57219 t.a59 = 815; 57220 t.a60 = 789; 57221 t.a61 = 789; 57222 t.a62 = 707; 57223 t.a63 = 687; 57224 t.a64 = 696; 57225 t.a65 = 689; 57226 t.a66 = 786; 57227 t.a67 = 787; 57228 t.a68 = 713; 57229 t.a69 = 791; 57230 t.a70 = 785; 57231 t.a71 = 791; 57232 t.a72 = 873; 57233 t.a73 = 761; 57234 t.a74 = 762; 57235 t.a203 = 762; 57236 t.a75 = 759; 57237 t.a204 = 759; 57238 t.a76 = 892; 57239 t.a77 = 892; 57240 t.a78 = 788; 57241 t.a79 = 784; 57242 t.a81 = 438; 57243 t.a82 = 138; 57244 t.a83 = 277; 57245 t.a84 = 415; 57246 t.a97 = 392; 57247 t.a98 = 392; 57248 t.a99 = 668; 57249 t.a100 = 668; 57250 t.a89 = 390; 57251 t.a90 = 390; 57252 t.a93 = 317; 57253 t.a94 = 317; 57254 t.a91 = 276; 57255 t.a92 = 276; 57256 t.a205 = 509; 57257 t.a85 = 509; 57258 t.a206 = 410; 57259 t.a86 = 410; 57260 t.a87 = 234; 57261 t.a88 = 234; 57262 t.a95 = 334; 57263 t.a96 = 334; 57264 t.a101 = 732; 57265 t.a102 = 544; 57266 t.a103 = 544; 57267 t.a104 = 910; 57268 t.a106 = 667; 57269 t.a107 = 760; 57270 t.a108 = 760; 57271 t.a112 = 776; 57272 t.a111 = 595; 57273 t.a110 = 694; 57274 t.a109 = 626; 57275 t.a120 = 788; 57276 t.a121 = 788; 57277 t.a122 = 788; 57278 t.a123 = 788; 57279 t.a124 = 788; 57280 t.a125 = 788; 57281 t.a126 = 788; 57282 t.a127 = 788; 57283 t.a128 = 788; 57284 t.a129 = 788; 57285 t.a130 = 788; 57286 t.a131 = 788; 57287 t.a132 = 788; 57288 t.a133 = 788; 57289 t.a134 = 788; 57290 t.a135 = 788; 57291 t.a136 = 788; 57292 t.a137 = 788; 57293 t.a138 = 788; 57294 t.a139 = 788; 57295 t.a140 = 788; 57296 t.a141 = 788; 57297 t.a142 = 788; 57298 t.a143 = 788; 57299 t.a144 = 788; 57300 t.a145 = 788; 57301 t.a146 = 788; 57302 t.a147 = 788; 57303 t.a148 = 788; 57304 t.a149 = 788; 57305 t.a150 = 788; 57306 t.a151 = 788; 57307 t.a152 = 788; 57308 t.a153 = 788; 57309 t.a154 = 788; 57310 t.a155 = 788; 57311 t.a156 = 788; 57312 t.a157 = 788; 57313 t.a158 = 788; 57314 t.a159 = 788; 57315 t.a160 = 894; 57316 t.a161 = 838; 57317 t.a163 = 1016; 57318 t.a164 = 458; 57319 t.a196 = 748; 57320 t.a165 = 924; 57321 t.a192 = 748; 57322 t.a166 = 918; 57323 t.a167 = 927; 57324 t.a168 = 928; 57325 t.a169 = 928; 57326 t.a170 = 834; 57327 t.a171 = 873; 57328 t.a172 = 828; 57329 t.a173 = 924; 57330 t.a162 = 924; 57331 t.a174 = 917; 57332 t.a175 = 930; 57333 t.a176 = 931; 57334 t.a177 = 463; 57335 t.a178 = 883; 57336 t.a179 = 836; 57337 t.a193 = 836; 57338 t.a180 = 867; 57339 t.a199 = 867; 57340 t.a181 = 696; 57341 t.a200 = 696; 57342 t.a182 = 874; 57343 t.a201 = 874; 57344 t.a183 = 760; 57345 t.a184 = 946; 57346 t.a197 = 771; 57347 t.a185 = 865; 57348 t.a194 = 771; 57349 t.a198 = 888; 57350 t.a186 = 967; 57351 t.a195 = 888; 57352 t.a187 = 831; 57353 t.a188 = 873; 57354 t.a189 = 927; 57355 t.a190 = 970; 57356 t.a191 = 918; 57357 }); 57358}); 57359exports.getMetrics = getMetrics;
57360 57361/***/ }), 57362/* 41 */ 57363/***/ (function(module, exports, __w_pdfjs_require__) { 57364 57365"use strict"; 57366 57367 57368Object.defineProperty(exports, "__esModule", { 57369 value: true 57370}); 57371exports.isPDFFunction = isPDFFunction; 57372exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0; 57373 57374var _util = __w_pdfjs_require__(2); 57375 57376var _primitives = __w_pdfjs_require__(5); 57377 57378var _ps_parser = __w_pdfjs_require__(42); 57379 57380class PDFFunctionFactory { 57381 constructor({ 57382 xref, 57383 isEvalSupported = true 57384 }) { 57385 this.xref = xref; 57386 this.isEvalSupported = isEvalSupported !== false; 57387 } 57388 57389 create(fn) { 57390 return PDFFunction.parse({ 57391 xref: this.xref, 57392 isEvalSupported: this.isEvalSupported, 57393 fn 57394 }); 57395 } 57396 57397 createFromArray(fnObj) { 57398 return PDFFunction.parseArray({ 57399 xref: this.xref, 57400 isEvalSupported: this.isEvalSupported, 57401 fnObj 57402 }); 57403 } 57404 57405} 57406 57407exports.PDFFunctionFactory = PDFFunctionFactory; 57408 57409function toNumberArray(arr) { 57410 if (!Array.isArray(arr)) { 57411 return null; 57412 } 57413 57414 const length = arr.length; 57415 57416 for (let i = 0; i < length; i++) { 57417 if (typeof arr[i] !== "number") { 57418 const result = new Array(length); 57419 57420 for (let j = 0; j < length; j++) { 57421 result[j] = +arr[j]; 57422 } 57423 57424 return result; 57425 } 57426 } 57427 57428 return arr; 57429} 57430 57431var PDFFunction = function PDFFunctionClosure() { 57432 const CONSTRUCT_SAMPLED = 0; 57433 const CONSTRUCT_INTERPOLATED = 2; 57434 const CONSTRUCT_STICHED = 3; 57435 const CONSTRUCT_POSTSCRIPT = 4; 57436 return { 57437 getSampleArray(size, outputSize, bps, stream) { 57438 var i, ii; 57439 var length = 1; 57440 57441 for (i = 0, ii = size.length; i < ii; i++) { 57442 length *= size[i]; 57443 } 57444 57445 length *= outputSize; 57446 var array = new Array(length); 57447 var codeSize = 0; 57448 var codeBuf = 0; 57449 var sampleMul = 1.0 / (2.0 ** bps - 1); 57450 var strBytes = stream.getBytes((length * bps + 7) / 8); 57451 var strIdx = 0; 57452 57453 for (i = 0; i < length; i++) { 57454 while (codeSize < bps) { 57455 codeBuf <<= 8; 57456 codeBuf |= strBytes[strIdx++]; 57457 codeSize += 8; 57458 } 57459 57460 codeSize -= bps; 57461 array[i] = (codeBuf >> codeSize) * sampleMul; 57462 codeBuf &= (1 << codeSize) - 1; 57463 } 57464 57465 return array; 57466 }, 57467 57468 getIR({ 57469 xref, 57470 isEvalSupported, 57471 fn 57472 }) { 57473 var dict = fn.dict; 57474 57475 if (!dict) { 57476 dict = fn; 57477 } 57478 57479 var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript]; 57480 var typeNum = dict.get("FunctionType"); 57481 var typeFn = types[typeNum]; 57482 57483 if (!typeFn) { 57484 throw new _util.FormatError("Unknown type of function"); 57485 } 57486 57487 return typeFn.call(this, { 57488 xref, 57489 isEvalSupported, 57490 fn, 57491 dict 57492 }); 57493 }, 57494 57495 fromIR({ 57496 xref, 57497 isEvalSupported, 57498 IR 57499 }) { 57500 var type = IR[0]; 57501 57502 switch (type) { 57503 case CONSTRUCT_SAMPLED: 57504 return this.constructSampledFromIR({ 57505 xref, 57506 isEvalSupported, 57507 IR 57508 }); 57509 57510 case CONSTRUCT_INTERPOLATED: 57511 return this.constructInterpolatedFromIR({ 57512 xref, 57513 isEvalSupported, 57514 IR 57515 }); 57516 57517 case CONSTRUCT_STICHED: 57518 return this.constructStichedFromIR({ 57519 xref, 57520 isEvalSupported, 57521 IR 57522 }); 57523 57524 default: 57525 return this.constructPostScriptFromIR({ 57526 xref, 57527 isEvalSupported, 57528 IR 57529 }); 57530 } 57531 }, 57532 57533 parse({ 57534 xref, 57535 isEvalSupported, 57536 fn 57537 }) { 57538 const IR = this.getIR({ 57539 xref, 57540 isEvalSupported, 57541 fn 57542 }); 57543 return this.fromIR({ 57544 xref, 57545 isEvalSupported, 57546 IR 57547 }); 57548 }, 57549 57550 parseArray({ 57551 xref, 57552 isEvalSupported, 57553 fnObj 57554 }) { 57555 if (!Array.isArray(fnObj)) { 57556 return this.parse({ 57557 xref, 57558 isEvalSupported, 57559 fn: fnObj 57560 }); 57561 } 57562 57563 var fnArray = []; 57564 57565 for (var j = 0, jj = fnObj.length; j < jj; j++) { 57566 fnArray.push(this.parse({ 57567 xref, 57568 isEvalSupported, 57569 fn: xref.fetchIfRef(fnObj[j]) 57570 })); 57571 } 57572
57573 return function (src, srcOffset, dest, destOffset) { 57574 for (var i = 0, ii = fnArray.length; i < ii; i++) { 57575 fnArray[i](src, srcOffset, dest, destOffset + i); 57576 } 57577 }; 57578 }, 57579 57580 constructSampled({ 57581 xref, 57582 isEvalSupported, 57583 fn, 57584 dict 57585 }) { 57586 function toMultiArray(arr) { 57587 var inputLength = arr.length; 57588 var out = []; 57589 var index = 0; 57590 57591 for (var i = 0; i < inputLength; i += 2) { 57592 out[index] = [arr[i], arr[i + 1]]; 57593 ++index; 57594 } 57595 57596 return out; 57597 } 57598 57599 var domain = toNumberArray(dict.getArray("Domain")); 57600 var range = toNumberArray(dict.getArray("Range")); 57601 57602 if (!domain || !range) { 57603 throw new _util.FormatError("No domain or range"); 57604 } 57605 57606 var inputSize = domain.length / 2; 57607 var outputSize = range.length / 2; 57608 domain = toMultiArray(domain); 57609 range = toMultiArray(range); 57610 var size = toNumberArray(dict.getArray("Size")); 57611 var bps = dict.get("BitsPerSample"); 57612 var order = dict.get("Order") || 1; 57613 57614 if (order !== 1) { 57615 (0, _util.info)("No support for cubic spline interpolation: " + order); 57616 } 57617 57618 var encode = toNumberArray(dict.getArray("Encode")); 57619 57620 if (!encode) { 57621 encode = []; 57622 57623 for (var i = 0; i < inputSize; ++i) { 57624 encode.push([0, size[i] - 1]); 57625 } 57626 } else { 57627 encode = toMultiArray(encode); 57628 } 57629 57630 var decode = toNumberArray(dict.getArray("Decode")); 57631 57632 if (!decode) { 57633 decode = range; 57634 } else { 57635 decode = toMultiArray(decode); 57636 } 57637 57638 var samples = this.getSampleArray(size, outputSize, bps, fn); 57639 return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range]; 57640 }, 57641 57642 constructSampledFromIR({ 57643 xref, 57644 isEvalSupported, 57645 IR 57646 }) { 57647 function interpolate(x, xmin, xmax, ymin, ymax) { 57648 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 57649 } 57650 57651 return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) { 57652 var m = IR[1]; 57653 var domain = IR[2]; 57654 var encode = IR[3]; 57655 var decode = IR[4]; 57656 var samples = IR[5]; 57657 var size = IR[6]; 57658 var n = IR[7]; 57659 var range = IR[9]; 57660 var cubeVertices = 1 << m; 57661 var cubeN = new Float64Array(cubeVertices); 57662 var cubeVertex = new Uint32Array(cubeVertices); 57663 var i, j; 57664 57665 for (j = 0; j < cubeVertices; j++) { 57666 cubeN[j] = 1; 57667 } 57668 57669 var k = n, 57670 pos = 1; 57671 57672 for (i = 0; i < m; ++i) { 57673 var domain_2i = domain[i][0]; 57674 var domain_2i_1 = domain[i][1]; 57675 var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 57676 var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 57677 var size_i = size[i]; 57678 e = Math.min(Math.max(e, 0), size_i - 1); 57679 var e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 57680 var n0 = e0 + 1 - e; 57681 var n1 = e - e0; 57682 var offset0 = e0 * k; 57683 var offset1 = offset0 + k; 57684 57685 for (j = 0; j < cubeVertices; j++) { 57686 if (j & pos) { 57687 cubeN[j] *= n1; 57688 cubeVertex[j] += offset1; 57689 } else { 57690 cubeN[j] *= n0; 57691 cubeVertex[j] += offset0; 57692 } 57693 } 57694 57695 k *= size_i; 57696 pos <<= 1; 57697 } 57698 57699 for (j = 0; j < n; ++j) { 57700 var rj = 0; 57701 57702 for (i = 0; i < cubeVertices; i++) { 57703 rj += samples[cubeVertex[i] + j] * cubeN[i]; 57704 } 57705 57706 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 57707 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 57708 } 57709 }; 57710 }, 57711 57712 constructInterpolated({ 57713 xref, 57714 isEvalSupported, 57715 fn, 57716 dict 57717 }) { 57718 var c0 = toNumberArray(dict.getArray("C0")) || [0]; 57719 var c1 = toNumberArray(dict.getArray("C1")) || [1]; 57720 var n = dict.get("N"); 57721 var length = c0.length; 57722 var diff = []; 57723 57724 for (var i = 0; i < length; ++i) { 57725 diff.push(c1[i] - c0[i]); 57726 } 57727 57728 return [CONSTRUCT_INTERPOLATED, c0, diff, n]; 57729 }, 57730 57731 constructInterpolatedFromIR({ 57732 xref, 57733 isEvalSupported, 57734 IR 57735 }) { 57736 var c0 = IR[1]; 57737 var diff = IR[2]; 57738 var n = IR[3]; 57739 var length = diff.length; 57740 return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOff
57740set) { 57741 var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 57742 57743 for (var j = 0; j < length; ++j) { 57744 dest[destOffset + j] = c0[j] + x * diff[j]; 57745 } 57746 }; 57747 }, 57748 57749 constructStiched({ 57750 xref, 57751 isEvalSupported, 57752 fn, 57753 dict 57754 }) { 57755 var domain = toNumberArray(dict.getArray("Domain")); 57756 57757 if (!domain) { 57758 throw new _util.FormatError("No domain"); 57759 } 57760 57761 var inputSize = domain.length / 2; 57762 57763 if (inputSize !== 1) { 57764 throw new _util.FormatError("Bad domain for stiched function"); 57765 } 57766 57767 var fnRefs = dict.get("Functions"); 57768 var fns = []; 57769 57770 for (var i = 0, ii = fnRefs.length; i < ii; ++i) { 57771 fns.push(this.parse({ 57772 xref, 57773 isEvalSupported, 57774 fn: xref.fetchIfRef(fnRefs[i]) 57775 })); 57776 } 57777 57778 var bounds = toNumberArray(dict.getArray("Bounds")); 57779 var encode = toNumberArray(dict.getArray("Encode")); 57780 return [CONSTRUCT_STICHED, domain, bounds, encode, fns]; 57781 }, 57782 57783 constructStichedFromIR({ 57784 xref, 57785 isEvalSupported, 57786 IR 57787 }) { 57788 var domain = IR[1]; 57789 var bounds = IR[2]; 57790 var encode = IR[3]; 57791 var fns = IR[4]; 57792 var tmpBuf = new Float32Array(1); 57793 return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) { 57794 var clip = function constructStichedFromIRClip(v, min, max) { 57795 if (v > max) { 57796 v = max; 57797 } else if (v < min) { 57798 v = min; 57799 } 57800 57801 return v; 57802 }; 57803 57804 var v = clip(src[srcOffset], domain[0], domain[1]); 57805 57806 for (var i = 0, ii = bounds.length; i < ii; ++i) { 57807 if (v < bounds[i]) { 57808 break; 57809 } 57810 } 57811 57812 var dmin = domain[0]; 57813 57814 if (i > 0) { 57815 dmin = bounds[i - 1]; 57816 } 57817 57818 var dmax = domain[1]; 57819 57820 if (i < bounds.length) { 57821 dmax = bounds[i]; 57822 } 57823 57824 var rmin = encode[2 * i]; 57825 var rmax = encode[2 * i + 1]; 57826 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 57827 fns[i](tmpBuf, 0, dest, destOffset); 57828 }; 57829 }, 57830 57831 constructPostScript({ 57832 xref, 57833 isEvalSupported, 57834 fn, 57835 dict 57836 }) { 57837 var domain = toNumberArray(dict.getArray("Domain")); 57838 var range = toNumberArray(dict.getArray("Range")); 57839 57840 if (!domain) { 57841 throw new _util.FormatError("No domain."); 57842 } 57843 57844 if (!range) { 57845 throw new _util.FormatError("No range."); 57846 } 57847 57848 var lexer = new _ps_parser.PostScriptLexer(fn); 57849 var parser = new _ps_parser.PostScriptParser(lexer); 57850 var code = parser.parse(); 57851 return [CONSTRUCT_POSTSCRIPT, domain, range, code]; 57852 }, 57853 57854 constructPostScriptFromIR({ 57855 xref, 57856 isEvalSupported, 57857 IR 57858 }) { 57859 var domain = IR[1]; 57860 var range = IR[2]; 57861 var code = IR[3]; 57862 57863 if (isEvalSupported && _util.IsEvalSupportedCached.value) { 57864 const compiled = new PostScriptCompiler().compile(code, domain, range); 57865 57866 if (compiled) { 57867 return new Function("src", "srcOffset", "dest", "destOffset", compiled); 57868 } 57869 } 57870 57871 (0, _util.info)("Unable to compile PS function"); 57872 var numOutputs = range.length >> 1; 57873 var numInputs = domain.length >> 1; 57874 var evaluator = new PostScriptEvaluator(code); 57875 var cache = Object.create(null); 57876 var MAX_CACHE_SIZE = 2048 * 4; 57877 var cache_available = MAX_CACHE_SIZE; 57878 var tmpBuf = new Float32Array(numInputs); 57879 return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) { 57880 var i, value; 57881 var key = ""; 57882 var input = tmpBuf; 57883 57884 for (i = 0; i < numInputs; i++) { 57885 value = src[srcOffset + i]; 57886 input[i] = value; 57887 key += value + "_"; 57888 } 57889 57890 var cachedValue = cache[key]; 57891 57892 if (cachedValue !== undefined) { 57893 dest.set(cachedValue, destOffset); 57894 return; 57895 } 57896 57897 var output = new Float32Array(numOutputs); 57898 var stack = evaluator.execute(input); 57899 var stackIndex = stack.length - numOutputs; 57900 57901 for (i = 0; i < numOutputs; i++) { 57902 value = stack[stackIndex + i]; 57903 var bound = range[i * 2]; 57904 57905 if (value < bound) { 57906 value = bound; 57907 } else { 57908 bound = range[i * 2 + 1]; 57909 57910 if (value > bound) { 57911 value = bound; 57912 } 57913 } 57914 57915 output[i] = value; 57916 } 57917 57918 if (cache_available > 0) { 57919 cache_available--; 57920 cache[key] = output; 57921 } 57922
57923 dest.set(output, destOffset); 57924 }; 57925 } 57926 57927 }; 57928}(); 57929 57930function isPDFFunction(v) { 57931 var fnDict; 57932 57933 if (typeof v !== "object") { 57934 return false; 57935 } else if ((0, _primitives.isDict)(v)) { 57936 fnDict = v; 57937 } else if ((0, _primitives.isStream)(v)) { 57938 fnDict = v.dict; 57939 } else { 57940 return false; 57941 } 57942 57943 return fnDict.has("FunctionType"); 57944} 57945 57946var PostScriptStack = function PostScriptStackClosure() { 57947 var MAX_STACK_SIZE = 100; 57948 57949 function PostScriptStack(initialStack) { 57950 this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); 57951 } 57952 57953 PostScriptStack.prototype = { 57954 push: function PostScriptStack_push(value) { 57955 if (this.stack.length >= MAX_STACK_SIZE) { 57956 throw new Error("PostScript function stack overflow."); 57957 } 57958 57959 this.stack.push(value); 57960 }, 57961 pop: function PostScriptStack_pop() { 57962 if (this.stack.length <= 0) { 57963 throw new Error("PostScript function stack underflow."); 57964 } 57965 57966 return this.stack.pop(); 57967 }, 57968 copy: function PostScriptStack_copy(n) { 57969 if (this.stack.length + n >= MAX_STACK_SIZE) { 57970 throw new Error("PostScript function stack overflow."); 57971 } 57972 57973 var stack = this.stack; 57974 57975 for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 57976 stack.push(stack[i]); 57977 } 57978 }, 57979 index: function PostScriptStack_index(n) { 57980 this.push(this.stack[this.stack.length - n - 1]); 57981 }, 57982 roll: function PostScriptStack_roll(n, p) { 57983 var stack = this.stack; 57984 var l = stack.length - n; 57985 var r = stack.length - 1, 57986 c = l + (p - Math.floor(p / n) * n), 57987 i, 57988 j, 57989 t; 57990 57991 for (i = l, j = r; i < j; i++, j--) { 57992 t = stack[i]; 57993 stack[i] = stack[j]; 57994 stack[j] = t; 57995 } 57996 57997 for (i = l, j = c - 1; i < j; i++, j--) { 57998 t = stack[i]; 57999 stack[i] = stack[j]; 58000 stack[j] = t; 58001 } 58002 58003 for (i = c, j = r; i < j; i++, j--) { 58004 t = stack[i]; 58005 stack[i] = stack[j]; 58006 stack[j] = t; 58007 } 58008 } 58009 }; 58010 return PostScriptStack; 58011}(); 58012 58013var PostScriptEvaluator = function PostScriptEvaluatorClosure() { 58014 function PostScriptEvaluator(operators) { 58015 this.operators = operators; 58016 } 58017 58018 PostScriptEvaluator.prototype = { 58019 execute: function PostScriptEvaluator_execute(initialStack) { 58020 var stack = new PostScriptStack(initialStack); 58021 var counter = 0; 58022 var operators = this.operators; 58023 var length = operators.length; 58024 var operator, a, b; 58025 58026 while (counter < length) { 58027 operator = operators[counter++]; 58028 58029 if (typeof operator === "number") { 58030 stack.push(operator); 58031 continue; 58032 } 58033 58034 switch (operator) { 58035 case "jz": 58036 b = stack.pop(); 58037 a = stack.pop(); 58038 58039 if (!a) { 58040 counter = b; 58041 } 58042 58043 break; 58044 58045 case "j": 58046 a = stack.pop(); 58047 counter = a; 58048 break; 58049 58050 case "abs": 58051 a = stack.pop(); 58052 stack.push(Math.abs(a)); 58053 break; 58054 58055 case "add": 58056 b = stack.pop(); 58057 a = stack.pop(); 58058 stack.push(a + b); 58059 break; 58060 58061 case "and": 58062 b = stack.pop(); 58063 a = stack.pop(); 58064 58065 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 58066 stack.push(a && b); 58067 } else { 58068 stack.push(a & b); 58069 } 58070 58071 break; 58072 58073 case "atan": 58074 a = stack.pop(); 58075 stack.push(Math.atan(a)); 58076 break; 58077 58078 case "bitshift": 58079 b = stack.pop(); 58080 a = stack.pop(); 58081 58082 if (a > 0) { 58083 stack.push(a << b); 58084 } else { 58085 stack.push(a >> b); 58086 } 58087 58088 break; 58089 58090 case "ceiling": 58091 a = stack.pop(); 58092 stack.push(Math.ceil(a)); 58093 break; 58094 58095 case "copy": 58096 a = stack.pop(); 58097 stack.copy(a); 58098 break; 58099 58100 case "cos": 58101 a = stack.pop(); 58102 stack.push(Math.cos(a)); 58103 break; 58104 58105 case "cvi": 58106 a = stack.pop() | 0; 58107 stack.push(a); 58108 break; 58109 58110 case "cvr": 58111 break; 58112 58113 case "div": 58114 b = stack.pop(); 58115 a = stack.pop(); 58116 stack.push(a / b); 58117 break; 58118 58119 case "dup": 58120 stack.copy(1); 58121 break; 58122 58123 case "eq": 58124 b = stack.pop(); 58125 a = stack.pop(); 58126 stack.push(a === b); 58127 break; 58128 58129 case "exch": 58130 stack.roll(2, 1); 58131 break; 58132 58133 case "exp": 58134 b = stack.pop(); 58135 a = stack.pop(); 58136 stack.push(a ** b); 58137 break; 58138 58139 case "false": 58140 stack.push(false); 58141 break; 58142 58143 case "floor": 58144 a = stack.pop(); 58145 stack.push(Math.floor(a)); 58146 break; 58147 58148 case "ge": 58149 b = stack.pop(); 58150 a = stack.pop(); 58151 stack.push(a >= b); 58152 break; 58153 58154 case "gt": 58155 b = stack.pop(); 58156 a = stack.pop(); 58157 stack.push(a > b); 58158 break; 58159 58160 case "idiv": 58161 b = stack.pop(); 58162 a = stack.pop(); 58163 stack.push(a / b | 0); 58164 break; 58165 58166 case "index": 58167 a = stack.pop(); 58168 stack.index(a); 58169 break; 58170 58171 case "le": 58172 b = stack.pop(); 58173 a = stack.pop(); 58174 stack.push(a <= b); 58175 break; 58176 58177 case "ln": 58178 a = stack.pop(); 58179 stack.push(Math.log(a)); 58180 break; 58181 58182 case "log": 58183 a = stack.pop(); 58184 stack.push(Math.log(a) / Math.LN10); 58185 break; 58186 58187 case "lt": 58188 b = stack.pop(); 58189 a = stack.pop(); 58190 stack.push(a < b); 58191 break; 58192 58193 case "mod": 58194 b = stack.pop(); 58195 a = stack.pop(); 58196 stack.push(a % b); 58197 break; 58198 58199 case "mul": 58200 b = stack.pop(); 58201 a = stack.pop(); 58202 stack.push(a * b); 58203 break; 58204 58205 case "ne": 58206 b = stack.pop(); 58207 a = stack.pop(); 58208 stack.push(a !== b); 58209 break; 58210 58211 case "neg": 58212 a = stack.pop(); 58213 stack.push(-a); 58214 break; 58215 58216 case "not": 58217 a = stack.pop(); 58218 58219 if ((0, _util.isBool)(a)) { 58220 stack.push(!a); 58221 } else { 58222 stack.push(~a); 58223 } 58224 58225 break; 58226 58227 case "or": 58228 b = stack.pop(); 58229 a = stack.pop(); 58230 58231 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 58232 stack.push(a || b); 58233 } else { 58234 stack.push(a | b); 58235 } 58236 58237 break; 58238 58239 case "pop": 58240 stack.pop(); 58241 break; 58242 58243 case "roll": 58244 b = stack.pop(); 58245 a = stack.pop(); 58246 stack.roll(a, b); 58247 break; 58248 58249 case "round": 58250 a = stack.pop(); 58251 stack.push(Math.round(a)); 58252 break; 58253 58254 case "sin": 58255 a = stack.pop(); 58256 stack.push(Math.sin(a)); 58257 break; 58258 58259 case "sqrt": 58260 a = stack.pop(); 58261 stack.push(Math.sqrt(a)); 58262 break; 58263 58264 case "sub": 58265 b = stack.pop(); 58266 a = stack.pop(); 58267 stack.push(a - b); 58268 break; 58269 58270 case "true": 58271 stack.push(true); 58272 break; 58273 58274 case "truncate": 58275 a = stack.pop(); 58276 a = a < 0 ? Math.ceil(a) : Math.floor(a); 58277 stack.push(a); 58278 break; 58279 58280 case "xor": 58281 b = stack.pop(); 58282 a = stack.pop(); 58283 58284 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 58285 stack.push(a !== b); 58286 } else { 58287 stack.push(a ^ b); 58288 } 58289 58290 break; 58291 58292 default: 58293 throw new _util.FormatError(`Unknown operator ${operator}`); 58294 } 58295 } 58296 58297 return stack.stack; 58298 } 58299 }; 58300 return PostScriptEvaluator; 58301}(); 58302 58303exports.PostScriptEvaluator = PostScriptEvaluator; 58304 58305var PostScriptCompiler = function PostScriptCompilerClosure() { 58306 function AstNode(type) { 58307 this.type = type; 58308 } 58309 58310 AstNode.prototype.visit = function (visitor) { 58311 (0, _util.unreachable)("abstract method"); 58312 }; 58313 58314 function AstArgument(index, min, max) { 58315 AstNode.call(this, "args"); 58316 this.index = index; 58317 this.min = min; 58318 this.max = max; 58319 } 58320 58321 AstArgument.prototype = Object.create(AstNode.prototype); 58322 58323 AstArgument.prototype.visit = function (visitor) { 58324 visitor.visitArgument(this); 58325 }; 58326 58327 function AstLiteral(number) { 58328 AstNode.call(this, "literal"); 58329 this.number = number; 58330 this.min = number; 58331 this.max = number; 58332 } 58333 58334 AstLiteral.prototype = Object.create(AstNode.prototype); 58335 58336 AstLiteral.prototype.visit = function (visitor) { 58337 visitor.visitLiteral(this); 58338 }; 58339 58340 function AstBinaryOperation(op, arg1, arg2, min, max) { 58341 AstNode.call(this, "binary"); 58342 this.op = op; 58343 this.arg1 = arg1; 58344 this.arg2 = arg2; 58345 this.min = min; 58346 this.max = max; 58347 } 58348 58349 AstBinaryOperation.prototype = Object.create(AstNode.prototype); 58350 58351 AstBinaryOperation.prototype.visit = function (visitor) { 58352 visitor.visitBinaryOperation(this); 58353 }; 58354 58355 function AstMin(arg, max) { 58356 AstNode.call(this, "max"); 58357 this.arg = arg; 58358 this.min = arg.min; 58359 this.max = max; 58360 } 58361 58362 AstMin.prototype = Object.create(AstNode.prototype); 58363 58364 AstMin.prototype.visit = function (visitor) { 58365 visitor.visitMin(this); 58366 }; 58367 58368 function AstVariable(index, min, max) { 58369 AstNode.call(this, "var"); 58370 this.index = index; 58371 this.min = min; 58372 this.max = max; 58373 } 58374 58375 AstVariable.prototype = Object.create(AstNode.prototype); 58376 58377 AstVariable.prototype.visit = function (visitor) { 58378 visitor.visitVariable(this); 58379 }; 58380 58381 function AstVariableDefinition(variable, arg) { 58382 AstNode.call(this, "definition"); 58383 this.variable = variable; 58384 this.arg = arg; 58385 } 58386 58387 AstVariableDefinition.prototype = Object.create(AstNode.prototype); 58388 58389 AstVariableDefinition.prototype.visit = function (visitor) { 58390 visitor.visitVariableDefinition(this); 58391 }; 58392 58393 function ExpressionBuilderVisitor() { 58394 this.parts = []; 58395 } 58396 58397 ExpressionBuilderVisitor.prototype = { 58398 visitArgument(arg) { 58399 this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))"); 58400 }, 58401 58402 visitVariable(variable) {
vendor: 5,511 bytes, lines 58403-58618
58403 this.parts.push("v", variable.index); 58404 }, 58405 58406 visitLiteral(literal) { 58407 this.parts.push(literal.number); 58408 }, 58409 58410 visitBinaryOperation(operation) { 58411 this.parts.push("("); 58412 operation.arg1.visit(this); 58413 this.parts.push(" ", operation.op, " "); 58414 operation.arg2.visit(this); 58415 this.parts.push(")"); 58416 }, 58417 58418 visitVariableDefinition(definition) { 58419 this.parts.push("var "); 58420 definition.variable.visit(this); 58421 this.parts.push(" = "); 58422 definition.arg.visit(this); 58423 this.parts.push(";"); 58424 }, 58425 58426 visitMin(max) { 58427 this.parts.push("Math.min("); 58428 max.arg.visit(this); 58429 this.parts.push(", ", max.max, ")"); 58430 }, 58431 58432 toString() { 58433 return this.parts.join(""); 58434 } 58435 58436 }; 58437 58438 function buildAddOperation(num1, num2) { 58439 if (num2.type === "literal" && num2.number === 0) { 58440 return num1; 58441 } 58442 58443 if (num1.type === "literal" && num1.number === 0) { 58444 return num2; 58445 } 58446 58447 if (num2.type === "literal" && num1.type === "literal") { 58448 return new AstLiteral(num1.number + num2.number); 58449 } 58450 58451 return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max); 58452 } 58453 58454 function buildMulOperation(num1, num2) { 58455 if (num2.type === "literal") { 58456 if (num2.number === 0) { 58457 return new AstLiteral(0); 58458 } else if (num2.number === 1) { 58459 return num1; 58460 } else if (num1.type === "literal") { 58461 return new AstLiteral(num1.number * num2.number); 58462 } 58463 } 58464 58465 if (num1.type === "literal") { 58466 if (num1.number === 0) { 58467 return new AstLiteral(0); 58468 } else if (num1.number === 1) { 58469 return num2; 58470 } 58471 } 58472 58473 var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 58474 var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 58475 return new AstBinaryOperation("*", num1, num2, min, max); 58476 } 58477 58478 function buildSubOperation(num1, num2) { 58479 if (num2.type === "literal") { 58480 if (num2.number === 0) { 58481 return num1; 58482 } else if (num1.type === "literal") { 58483 return new AstLiteral(num1.number - num2.number); 58484 } 58485 } 58486 58487 if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) { 58488 return num2.arg2; 58489 } 58490 58491 return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min); 58492 } 58493 58494 function buildMinOperation(num1, max) { 58495 if (num1.min >= max) { 58496 return new AstLiteral(max); 58497 } else if (num1.max <= max) { 58498 return num1; 58499 } 58500 58501 return new AstMin(num1, max); 58502 } 58503 58504 function PostScriptCompiler() {} 58505 58506 PostScriptCompiler.prototype = { 58507 compile: function PostScriptCompiler_compile(code, domain, range) { 58508 var stack = []; 58509 var instructions = []; 58510 var inputSize = domain.length >> 1, 58511 outputSize = range.length >> 1; 58512 var lastRegister = 0; 58513 var n, j; 58514 var num1, num2, ast1, ast2, tmpVar, item; 58515 58516 for (let i = 0; i < inputSize; i++) { 58517 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 58518 } 58519 58520 for (let i = 0, ii = code.length; i < ii; i++) { 58521 item = code[i]; 58522 58523 if (typeof item === "number") { 58524 stack.push(new AstLiteral(item)); 58525 continue; 58526 } 58527 58528 switch (item) { 58529 case "add": 58530 if (stack.length < 2) { 58531 return null; 58532 } 58533 58534 num2 = stack.pop(); 58535 num1 = stack.pop(); 58536 stack.push(buildAddOperation(num1, num2)); 58537 break; 58538 58539 case "cvr": 58540 if (stack.length < 1) { 58541 return null; 58542 } 58543 58544 break; 58545 58546 case "mul": 58547 if (stack.length < 2) { 58548 return null; 58549 } 58550 58551 num2 = stack.pop(); 58552 num1 = stack.pop(); 58553 stack.push(buildMulOperation(num1, num2)); 58554 break; 58555 58556 case "sub": 58557 if (stack.length < 2) { 58558 return null; 58559 } 58560 58561 num2 = stack.pop(); 58562 num1 = stack.pop(); 58563 stack.push(buildSubOperation(num1, num2)); 58564 break; 58565 58566 case "exch": 58567 if (stack.length < 2) { 58568 return null; 58569 } 58570 58571 ast1 = stack.pop(); 58572 ast2 = stack.pop(); 58573 stack.push(ast1, ast2); 58574 break; 58575 58576 case "pop": 58577 if (stack.length < 1) { 58578 return null; 58579 } 58580 58581 stack.pop(); 58582 break; 58583 58584 case "index": 58585 if (stack.length < 1) { 58586 return null; 58587 } 58588 58589 num1 = stack.pop(); 58590 58591 if (num1.type !== "literal") { 58592 return null; 58593 } 58594 58595 n = num1.number; 58596 58597 if (n < 0 || !Number.isInteger(n) || stack.length < n) { 58598 return null; 58599 } 58600 58601 ast1 = stack[stack.length - n - 1]; 58602 58603 if (ast1.type === "literal" || ast1.type === "var") { 58604 stack.push(ast1); 58605 break; 58606 } 58607 58608 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 58609 stack[stack.length - n - 1] = tmpVar; 58610 stack.push(tmpVar); 58611 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 58612 break; 58613 58614 case "dup": 58615 if (stack.length < 1) { 58616 return null; 58617 } 58618
58619 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]) { 58620 num1 = stack.pop(); 58621 stack.push(buildMinOperation(num1, code[i + 1])); 58622 i += 6; 58623 break; 58624 } 58625 58626 ast1 = stack[stack.length - 1]; 58627 58628 if (ast1.type === "literal" || ast1.type === "var") { 58629 stack.push(ast1); 58630 break; 58631 } 58632 58633 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 58634 stack[stack.length - 1] = tmpVar; 58635 stack.push(tmpVar); 58636 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 58637 break; 58638 58639 case "roll": 58640 if (stack.length < 2) { 58641 return null; 58642 } 58643 58644 num2 = stack.pop(); 58645 num1 = stack.pop(); 58646 58647 if (num2.type !== "literal" || num1.type !== "literal") { 58648 return null; 58649 } 58650 58651 j = num2.number; 58652 n = num1.number; 58653 58654 if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) { 58655 return null; 58656 } 58657 58658 j = (j % n + n) % n; 58659 58660 if (j === 0) { 58661 break; 58662 } 58663 58664 Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j)); 58665 break; 58666 58667 default: 58668 return null; 58669 } 58670 } 58671 58672 if (stack.length !== outputSize) { 58673 return null; 58674 } 58675 58676 var result = []; 58677 instructions.forEach(function (instruction) { 58678 var statementBuilder = new ExpressionBuilderVisitor(); 58679 instruction.visit(statementBuilder); 58680 result.push(statementBuilder.toString()); 58681 }); 58682 stack.forEach(function (expr, i) { 58683 var statementBuilder = new ExpressionBuilderVisitor(); 58684 expr.visit(statementBuilder); 58685 var min = range[i * 2], 58686 max = range[i * 2 + 1]; 58687 var out = [statementBuilder.toString()]; 58688 58689 if (min > expr.min) { 58690 out.unshift("Math.max(", min, ", "); 58691 out.push(")"); 58692 } 58693 58694 if (max < expr.max) { 58695 out.unshift("Math.min(", max, ", "); 58696 out.push(")"); 58697 } 58698 58699 out.unshift("dest[destOffset + ", i, "] = "); 58700 out.push(";"); 58701 result.push(out.join("")); 58702 }); 58703 return result.join("\n"); 58704 } 58705 }; 58706 return PostScriptCompiler; 58707}(); 58708 58709exports.PostScriptCompiler = PostScriptCompiler; 58710 58711/***/ }), 58712/* 42 */ 58713/***/ (function(module, exports, __w_pdfjs_require__) { 58714 58715"use strict"; 58716 58717 58718Object.defineProperty(exports, "__esModule", { 58719 value: true 58720}); 58721exports.PostScriptParser = exports.PostScriptLexer = void 0; 58722 58723var _util = __w_pdfjs_require__(2); 58724 58725var _primitives = __w_pdfjs_require__(5); 58726 58727var _core_utils = __w_pdfjs_require__(8); 58728 58729class PostScriptParser { 58730 constructor(lexer) { 58731 this.lexer = lexer; 58732 this.operators = []; 58733 this.token = null; 58734 this.prev = null; 58735 } 58736 58737 nextToken() { 58738 this.prev = this.token; 58739 this.token = this.lexer.getToken(); 58740 } 58741 58742 accept(type) { 58743 if (this.token.type === type) { 58744 this.nextToken(); 58745 return true; 58746 } 58747 58748 return false; 58749 } 58750 58751 expect(type) { 58752 if (this.accept(type)) { 58753 return true; 58754 } 58755 58756 throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`); 58757 } 58758 58759 parse() { 58760 this.nextToken(); 58761 this.expect(PostScriptTokenTypes.LBRACE); 58762 this.parseBlock(); 58763 this.expect(PostScriptTokenTypes.RBRACE); 58764 return this.operators; 58765 } 58766 58767 parseBlock() { 58768 while (true) { 58769 if (this.accept(PostScriptTokenTypes.NUMBER)) { 58770 this.operators.push(this.prev.value); 58771 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 58772 this.operators.push(this.prev.value); 58773 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 58774 this.parseCondition(); 58775 } else { 58776 return; 58777 } 58778 } 58779 } 58780 58781 parseCondition() { 58782 const conditionLocation = this.operators.length; 58783 this.operators.push(null, null); 58784 this.parseBlock(); 58785 this.expect(PostScriptTokenTypes.RBRACE); 58786 58787 if (this.accept(PostScriptTokenTypes.IF)) { 58788 this.operators[conditionLocation] = this.operators.length; 58789 this.operators[conditionLocation + 1] = "jz"; 58790 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 58791 const jumpLocation = this.operators.length; 58792 this.operators.push(null, null); 58793 const endOfTrue = this.operators.length; 58794 this.parseBlock(); 58795 this.expect(PostScriptTokenTypes.RBRACE); 58796 this.expect(PostScriptTokenTypes.IFELSE); 58797 this.operators[jumpLocation] = this.operators.length; 58798 this.operators[jumpLocation + 1] = "j"; 58799 this.operators[conditionLocation] = endOfTrue; 58800 this.operators[conditionLocation + 1] = "jz"; 58801 } else { 58802 throw new _util.FormatError("PS Function: error parsing conditional."); 58803 } 58804 } 58805 58806} 58807 58808exports.PostScriptParser = PostScriptParser; 58809const PostScriptTokenTypes = { 58810 LBRACE: 0, 58811 RBRACE: 1, 58812 NUMBER: 2, 58813 OPERATOR: 3, 58814 IF: 4, 58815 IFELSE: 5 58816}; 58817 58818const PostScriptToken = function PostScriptTokenClosure() { 58819 const opCache = Object.create(null); 58820 58821 class PostScriptToken { 58822 constructor(type, value) { 58823 this.type = type; 58824 this.value = value; 58825 } 58826 58827 static getOperator(op) { 58828 const opValue = opCache[op]; 58829 58830 if (opValue) { 58831 return opValue; 58832 } 58833 58834 return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 58835 } 58836 58837 static get LBRACE() { 58838 return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); 58839 } 58840 58841 static get RBRACE() { 58842 return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); 58843 } 58844 58845 static get IF() { 58846 return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); 58847 } 58848 58849 static get IFELSE() { 58850 return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); 58851 } 58852 58853 } 58854 58855 return PostScriptToken; 58856}(); 58857 58858class PostScriptLexer { 58859 constructor(stream) { 58860 this.stream = stream; 58861 this.nextChar(); 58862 this.strBuf = []; 58863 } 58864 58865 nextChar() { 58866 return this.currentChar = this.stream.getByte(); 58867 } 58868 58869 getToken() {
vendor: 1,424 bytes, lines 58870-58938
58870 let comment = false; 58871 let ch = this.currentChar; 58872 58873 while (true) { 58874 if (ch < 0) { 58875 return _primitives.EOF; 58876 } 58877 58878 if (comment) { 58879 if (ch === 0x0a || ch === 0x0d) { 58880 comment = false; 58881 } 58882 } else if (ch === 0x25) { 58883 comment = true; 58884 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 58885 break; 58886 } 58887 58888 ch = this.nextChar(); 58889 } 58890 58891 switch (ch | 0) { 58892 case 0x30: 58893 case 0x31: 58894 case 0x32: 58895 case 0x33: 58896 case 0x34: 58897 case 0x35: 58898 case 0x36: 58899 case 0x37: 58900 case 0x38: 58901 case 0x39: 58902 case 0x2b: 58903 case 0x2d: 58904 case 0x2e: 58905 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 58906 58907 case 0x7b: 58908 this.nextChar(); 58909 return PostScriptToken.LBRACE; 58910 58911 case 0x7d: 58912 this.nextChar(); 58913 return PostScriptToken.RBRACE; 58914 } 58915 58916 const strBuf = this.strBuf; 58917 strBuf.length = 0; 58918 strBuf[0] = String.fromCharCode(ch); 58919 58920 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) { 58921 strBuf.push(String.fromCharCode(ch)); 58922 } 58923 58924 const str = strBuf.join(""); 58925 58926 switch (str.toLowerCase()) { 58927 case "if": 58928 return PostScriptToken.IF; 58929 58930 case "ifelse": 58931 return PostScriptToken.IFELSE; 58932 58933 default: 58934 return PostScriptToken.getOperator(str); 58935 } 58936 } 58937 58938 getNumber() {
58939 let ch = this.currentChar; 58940 const strBuf = this.strBuf; 58941 strBuf.length = 0; 58942 strBuf[0] = String.fromCharCode(ch); 58943 58944 while ((ch = this.nextChar()) >= 0) { 58945 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) { 58946 strBuf.push(String.fromCharCode(ch)); 58947 } else { 58948 break; 58949 } 58950 } 58951 58952 const value = parseFloat(strBuf.join("")); 58953 58954 if (isNaN(value)) { 58955 throw new _util.FormatError(`Invalid floating point number: ${value}`); 58956 } 58957 58958 return value; 58959 } 58960 58961} 58962 58963exports.PostScriptLexer = PostScriptLexer; 58964 58965/***/ }), 58966/* 43 */ 58967/***/ (function(module, exports, __w_pdfjs_require__) { 58968 58969"use strict"; 58970 58971 58972Object.defineProperty(exports, "__esModule", { 58973 value: true 58974}); 58975exports.MurmurHash3_64 = void 0; 58976 58977var _util = __w_pdfjs_require__(2); 58978 58979const SEED = 0xc3d2e1f0; 58980const MASK_HIGH = 0xffff0000; 58981const MASK_LOW = 0xffff; 58982 58983class MurmurHash3_64 { 58984 constructor(seed) { 58985 this.h1 = seed ? seed & 0xffffffff : SEED; 58986 this.h2 = seed ? seed & 0xffffffff : SEED; 58987 } 58988 58989 update(input) { 58990 let data, length; 58991 58992 if ((0, _util.isString)(input)) { 58993 data = new Uint8Array(input.length * 2); 58994 length = 0; 58995 58996 for (let i = 0, ii = input.length; i < ii; i++) { 58997 const code = input.charCodeAt(i); 58998 58999 if (code <= 0xff) { 59000 data[length++] = code; 59001 } else { 59002 data[length++] = code >>> 8; 59003 data[length++] = code & 0xff; 59004 } 59005 } 59006 } else if ((0, _util.isArrayBuffer)(input)) { 59007 data = input; 59008 length = data.byteLength; 59009 } else { 59010 throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array."); 59011 } 59012 59013 const blockCounts = length >> 2; 59014 const tailLength = length - blockCounts * 4; 59015 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 59016 let k1 = 0, 59017 k2 = 0; 59018 let h1 = this.h1, 59019 h2 = this.h2; 59020 const C1 = 0xcc9e2d51, 59021 C2 = 0x1b873593; 59022 const C1_LOW = C1 & MASK_LOW, 59023 C2_LOW = C2 & MASK_LOW; 59024 59025 for (let i = 0; i < blockCounts; i++) { 59026 if (i & 1) { 59027 k1 = dataUint32[i]; 59028 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 59029 k1 = k1 << 15 | k1 >>> 17; 59030 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 59031 h1 ^= k1; 59032 h1 = h1 << 13 | h1 >>> 19; 59033 h1 = h1 * 5 + 0xe6546b64; 59034 } else { 59035 k2 = dataUint32[i]; 59036 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 59037 k2 = k2 << 15 | k2 >>> 17; 59038 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 59039 h2 ^= k2; 59040 h2 = h2 << 13 | h2 >>> 19; 59041 h2 = h2 * 5 + 0xe6546b64; 59042 } 59043 } 59044 59045 k1 = 0; 59046 59047 switch (tailLength) { 59048 case 3: 59049 k1 ^= data[blockCounts * 4 + 2] << 16; 59050 59051 case 2: 59052 k1 ^= data[blockCounts * 4 + 1] << 8; 59053 59054 case 1: 59055 k1 ^= data[blockCounts * 4]; 59056 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 59057 k1 = k1 << 15 | k1 >>> 17; 59058 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 59059 59060 if (blockCounts & 1) { 59061 h1 ^= k1; 59062 } else { 59063 h2 ^= k1; 59064 } 59065 59066 } 59067 59068 this.h1 = h1; 59069 this.h2 = h2; 59070 } 59071 59072 hexdigest() { 59073 let h1 = this.h1, 59074 h2 = this.h2; 59075 h1 ^= h2 >>> 1; 59076 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 59077 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 59078 h1 ^= h2 >>> 1; 59079 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 59080 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 59081 h1 ^= h2 >>> 1; 59082 const hex1 = (h1 >>> 0).toString(16), 59083 hex2 = (h2 >>> 0).toString(16); 59084 return hex1.padStart(8, "0") + hex2.padStart(8, "0"); 59085 } 59086 59087} 59088 59089exports.MurmurHash3_64 = MurmurHash3_64; 59090 59091/***/ }), 59092/* 44 */ 59093/***/ (function(module, exports, __w_pdfjs_require__) { 59094 59095"use strict"; 59096 59097 59098Object.defineProperty(exports, "__esModule", { 59099 value: true 59100}); 59101exports.PDFImage = void 0; 59102 59103var _util = __w_pdfjs_require__(2); 59104 59105var _primitives = __w_pdfjs_require__(5); 59106 59107var _colorspace = __w_pdfjs_require__(23); 59108 59109var _stream = __w_pdfjs_require__(12); 59110 59111var _jpeg_stream = __w_pdfjs_require__(18); 59112 59113var _jpx = __w_pdfjs_require__(21); 59114 59115var PDFImage = function PDFImageClosure() { 59116 function decodeAndClamp(value, addend, coefficient, max) { 59117 value = addend + value * coefficient; 59118 59119 if (value < 0) { 59120 value = 0; 59121 } else if (value > max) { 59122 value = max; 59123 } 59124 59125 return value; 59126 } 59127 59128 function resizeImageMask(src, bpc, w1, h1, w2, h2) { 59129 var length = w2 * h2; 59130 let dest; 59131 59132 if (bpc <= 8) { 59133 dest = new Uint8Array(length); 59134 } else if (bpc <= 16) { 59135 dest = new Uint16Array(length); 59136 } else { 59137 dest = new Uint32Array(length); 59138 } 59139 59140 var xRatio = w1 / w2; 59141 var yRatio = h1 / h2; 59142 var i, 59143 j, 59144 py, 59145 newIndex = 0, 59146 oldIndex; 59147 var xScaled = new Uint16Array(w2); 59148 var w1Scanline = w1; 59149 59150 for (i = 0; i < w2; i++) { 59151 xScaled[i] = Math.floor(i * xRatio); 59152 } 59153 59154 for (i = 0; i < h2; i++) { 59155 py = Math.floor(i * yRatio) * w1Scanline; 59156 59157 for (j = 0; j < w2; j++) { 59158 oldIndex = py + xScaled[j]; 59159 dest[newIndex++] = src[oldIndex]; 59160 } 59161 } 59162 59163 return dest; 59164 } 59165 59166 function PDFImage({ 59167 xref, 59168 res, 59169 image, 59170 isInline = false, 59171 smask = null, 59172 mask = null, 59173 isMask = false, 59174 pdfFunctionFactory 59175 }) { 59176 this.image = image; 59177 var dict = image.dict; 59178 const filter = dict.get("Filter"); 59179 59180 if ((0, _primitives.isName)(filter)) { 59181 switch (filter.name) { 59182 case "JPXDecode": 59183 var jpxImage = new _jpx.JpxImage();
59184 jpxImage.parseImageProperties(image.stream); 59185 image.stream.reset(); 59186 image.width = jpxImage.width; 59187 image.height = jpxImage.height; 59188 image.bitsPerComponent = jpxImage.bitsPerComponent; 59189 image.numComps = jpxImage.componentsCount; 59190 break; 59191 59192 case "JBIG2Decode": 59193 image.bitsPerComponent = 1; 59194 image.numComps = 1; 59195 break; 59196 } 59197 } 59198 59199 let width = dict.get("Width", "W"); 59200 let height = dict.get("Height", "H"); 59201 59202 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 59203 (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 59204 width = image.width; 59205 height = image.height; 59206 } 59207 59208 if (width < 1 || height < 1) { 59209 throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`); 59210 } 59211 59212 this.width = width; 59213 this.height = height; 59214 this.interpolate = dict.get("Interpolate", "I") || false; 59215 this.imageMask = dict.get("ImageMask", "IM") || false; 59216 this.matte = dict.get("Matte") || false; 59217 var bitsPerComponent = image.bitsPerComponent; 59218 59219 if (!bitsPerComponent) { 59220 bitsPerComponent = dict.get("BitsPerComponent", "BPC"); 59221 59222 if (!bitsPerComponent) { 59223 if (this.imageMask) { 59224 bitsPerComponent = 1; 59225 } else { 59226 throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`); 59227 } 59228 } 59229 } 59230 59231 this.bpc = bitsPerComponent; 59232 59233 if (!this.imageMask) { 59234 var colorSpace = dict.get("ColorSpace", "CS"); 59235 59236 if (!colorSpace) { 59237 (0, _util.info)("JPX images (which do not require color spaces)"); 59238 59239 switch (image.numComps) { 59240 case 1: 59241 colorSpace = _primitives.Name.get("DeviceGray"); 59242 break; 59243 59244 case 3: 59245 colorSpace = _primitives.Name.get("DeviceRGB"); 59246 break; 59247 59248 case 4: 59249 colorSpace = _primitives.Name.get("DeviceCMYK"); 59250 break; 59251 59252 default: 59253 throw new Error(`JPX images with ${image.numComps} ` + "color components not supported."); 59254 } 59255 } 59256 59257 const resources = isInline ? res : null; 59258 this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory); 59259 this.numComps = this.colorSpace.numComps; 59260 } 59261 59262 this.decode = dict.getArray("Decode", "D"); 59263 this.needsDecode = false; 59264 59265 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) { 59266 this.needsDecode = true; 59267 var max = (1 << bitsPerComponent) - 1; 59268 this.decodeCoefficients = []; 59269 this.decodeAddends = []; 59270 const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed"; 59271 59272 for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 59273 var dmin = this.decode[i]; 59274 var dmax = this.decode[i + 1]; 59275 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 59276 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 59277 } 59278 } 59279 59280 if (smask) { 59281 this.smask = new PDFImage({ 59282 xref, 59283 res, 59284 image: smask, 59285 isInline, 59286 pdfFunctionFactory 59287 }); 59288 } else if (mask) { 59289 if ((0, _primitives.isStream)(mask)) { 59290 var maskDict = mask.dict, 59291 imageMask = maskDict.get("ImageMask", "IM"); 59292 59293 if (!imageMask) { 59294 (0, _util.warn)("Ignoring /Mask in image without /ImageMask."); 59295 } else { 59296 this.mask = new PDFImage({ 59297 xref, 59298 res, 59299 image: mask, 59300 isInline, 59301 isMask: true, 59302 pdfFunctionFactory 59303 }); 59304 } 59305 } else { 59306 this.mask = mask; 59307 } 59308 } 59309 } 59310 59311 PDFImage.buildImage = function ({ 59312 xref, 59313 res, 59314 image, 59315 isInline = false, 59316 pdfFunctionFactory 59317 }) { 59318 const imageData = image; 59319 let smaskData = null; 59320 let maskData = null; 59321 const smask = image.dict.get("SMask"); 59322 const mask = image.dict.get("Mask"); 59323 59324 if (smask) { 59325 smaskData = smask; 59326 } else if (mask) { 59327 if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) { 59328 maskData = mask; 59329 } else { 59330 (0, _util.warn)("Unsupported mask format."); 59331 } 59332 } 59333 59334 return Promise.resolve(new PDFImage({ 59335 xref, 59336 res, 59337 image: imageData, 59338 isInline, 59339 smask: smaskData, 59340 mask: maskData, 59341 pdfFunctionFactory 59342 })); 59343 }; 59344 59345 PDFImage.createMask = function ({ 59346 imgArray, 59347 width, 59348 height, 59349 imageIsFromDecodeStream, 59350 inverseDecode 59351 }) { 59352 var computedLength = (width + 7 >> 3) * height; 59353 var actualLength = imgArray.byteLength; 59354 var haveFullData = computedLength === actualLength; 59355 var data, i; 59356 59357 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 59358 data = imgArray; 59359 } else if (!inverseDecode) { 59360 data = new Uint8ClampedArray(actualLength); 59361 data.set(imgArray); 59362 } else { 59363 data = new Uint8ClampedArray(computedLength); 59364 data.set(imgArray); 59365 59366 for (i = actualLength; i < computedLength; i++) { 59367 data[i] = 0xff; 59368 } 59369 } 59370 59371 if (inverseDecode) { 59372 for (i = 0; i < actualLength; i++) { 59373 data[i] ^= 0xff; 59374 } 59375 } 59376 59377 return { 59378 data, 59379 width, 59380 height 59381 }; 59382 }; 59383 59384 PDFImage.prototype = { 59385 get drawWidth() { 59386 return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0); 59387 }, 59388 59389 get drawHeight() { 59390 return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0
59390); 59391 }, 59392 59393 decodeBuffer(buffer) { 59394 var bpc = this.bpc; 59395 var numComps = this.numComps; 59396 var decodeAddends = this.decodeAddends; 59397 var decodeCoefficients = this.decodeCoefficients; 59398 var max = (1 << bpc) - 1; 59399 var i, ii; 59400 59401 if (bpc === 1) { 59402 for (i = 0, ii = buffer.length; i < ii; i++) { 59403 buffer[i] = +!buffer[i]; 59404 } 59405 59406 return; 59407 } 59408 59409 var index = 0; 59410 59411 for (i = 0, ii = this.width * this.height; i < ii; i++) { 59412 for (var j = 0; j < numComps; j++) { 59413 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 59414 index++; 59415 } 59416 } 59417 }, 59418 59419 getComponents(buffer) { 59420 var bpc = this.bpc; 59421 59422 if (bpc === 8) { 59423 return buffer; 59424 } 59425 59426 var width = this.width; 59427 var height = this.height; 59428 var numComps = this.numComps; 59429 var length = width * height * numComps; 59430 var bufferPos = 0; 59431 let output; 59432 59433 if (bpc <= 8) { 59434 output = new Uint8Array(length); 59435 } else if (bpc <= 16) { 59436 output = new Uint16Array(length); 59437 } else { 59438 output = new Uint32Array(length); 59439 } 59440 59441 var rowComps = width * numComps; 59442 var max = (1 << bpc) - 1; 59443 var i = 0, 59444 ii, 59445 buf; 59446 59447 if (bpc === 1) { 59448 var mask, loop1End, loop2End; 59449 59450 for (var j = 0; j < height; j++) { 59451 loop1End = i + (rowComps & ~7); 59452 loop2End = i + rowComps; 59453 59454 while (i < loop1End) { 59455 buf = buffer[bufferPos++]; 59456 output[i] = buf >> 7 & 1; 59457 output[i + 1] = buf >> 6 & 1; 59458 output[i + 2] = buf >> 5 & 1; 59459 output[i + 3] = buf >> 4 & 1; 59460 output[i + 4] = buf >> 3 & 1; 59461 output[i + 5] = buf >> 2 & 1; 59462 output[i + 6] = buf >> 1 & 1; 59463 output[i + 7] = buf & 1; 59464 i += 8; 59465 } 59466 59467 if (i < loop2End) { 59468 buf = buffer[bufferPos++]; 59469 mask = 128; 59470 59471 while (i < loop2End) { 59472 output[i++] = +!!(buf & mask); 59473 mask >>= 1; 59474 } 59475 } 59476 } 59477 } else { 59478 var bits = 0; 59479 buf = 0; 59480 59481 for (i = 0, ii = length; i < ii; ++i) { 59482 if (i % rowComps === 0) { 59483 buf = 0; 59484 bits = 0; 59485 } 59486 59487 while (bits < bpc) { 59488 buf = buf << 8 | buffer[bufferPos++]; 59489 bits += 8; 59490 } 59491 59492 var remainingBits = bits - bpc; 59493 let value = buf >> remainingBits; 59494 59495 if (value < 0) { 59496 value = 0; 59497 } else if (value > max) { 59498 value = max; 59499 } 59500 59501 output[i] = value; 59502 buf = buf & (1 << remainingBits) - 1; 59503 bits = remainingBits; 59504 } 59505 } 59506 59507 return output; 59508 }, 59509 59510 fillOpacity(rgbaBuf, width, height, actualHeight, image) { 59511 var smask = this.smask; 59512 var mask = this.mask; 59513 var alphaBuf, sw, sh, i, ii, j; 59514 59515 if (smask) { 59516 sw = smask.width; 59517 sh = smask.height; 59518 alphaBuf = new Uint8ClampedArray(sw * sh); 59519 smask.fillGrayBuffer(alphaBuf); 59520 59521 if (sw !== width || sh !== height) { 59522 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 59523 } 59524 } else if (mask) { 59525 if (mask instanceof PDFImage) { 59526 sw = mask.width; 59527 sh = mask.height; 59528 alphaBuf = new Uint8ClampedArray(sw * sh); 59529 mask.numComps = 1; 59530 mask.fillGrayBuffer(alphaBuf); 59531 59532 for (i = 0, ii = sw * sh; i < ii; ++i) { 59533 alphaBuf[i] = 255 - alphaBuf[i]; 59534 } 59535 59536 if (sw !== width || sh !== height) { 59537 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 59538 } 59539 } else if (Array.isArray(mask)) { 59540 alphaBuf = new Uint8ClampedArray(width * height); 59541 var numComps = this.numComps; 59542 59543 for (i = 0, ii = width * height; i < ii; ++i) { 59544 var opacity = 0; 59545 var imageOffset = i * numComps; 59546 59547 for (j = 0; j < numComps; ++j) { 59548 var color = image[imageOffset + j]; 59549 var maskOffset = j * 2; 59550 59551 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 59552 opacity = 255; 59553 break; 59554 } 59555 } 59556 59557 alphaBuf[i] = opacity; 59558 } 59559 } else { 59560 throw new _util.FormatError("Unknown mask format."); 59561 } 59562 } 59563 59564 if (alphaBuf) { 59565 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 59566 rgbaBuf[j] = alphaBuf[i]; 59567 } 59568 } else { 59569 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 59570 rgbaBuf[j] = 255; 59571 } 59572 } 59573 }, 59574 59575 undoPreblend(buffer, width, height) { 59576 var matte = this.smask && this.smask.matte; 59577 59578 if (!matte) { 59579 return; 59580 } 59581 59582 var matteRgb = this.colorSpace.getRgb(matte, 0); 59583 var matteR = matteRgb[0]; 59584 var matteG = matteRgb[1]; 59585 var matteB = matteRgb[2]; 59586 var length = width * height * 4; 59587 59588 for (var i = 0; i < length; i += 4) { 59589 var alpha = buffer[i + 3]; 59590 59591 if (alpha === 0) { 59592 buffer[i] = 255; 59593 buffer[i + 1] = 255; 59594 buffer[i + 2] = 255; 59595 continue; 59596 } 59597 59598 var k = 255 / alpha; 59599 buffer[i] = (buffer[i] - matteR) * k + matteR; 59600 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 59601 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 59602 } 59603 }, 59604 59605 createImageData(forceRGBA = false) { 59606 var drawWidth = this.drawWidth; 59607 var drawHeight = this.drawHeight; 59608 var imgData = { 59609 width: drawWidth, 59610 height: drawHeight, 59611 kind: 0, 59612 data: null 59613 }; 59614 var numComps = this.numComps; 59615 var originalWidth = this.width; 59616 var originalHeight = this.height; 59617 var bpc = this.bpc; 59618 var rowBytes = originalWidth * numComps * bpc + 7 >> 3; 59619 var imgArray; 59620 59621 if (!forceRGBA) { 59622 var kind; 59623 59624 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 59625 kind = _util.ImageKind.GRAYSCALE_1BPP; 59626 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 59627 kind = _util.ImageKind.RGB_24BPP; 59628 } 59629 59630 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 59631 imgData.kind = kind; 59632 imgArray = this.getImageBytes(originalHeight * rowBytes); 59633 59634 if (this.image instanceof _stream.DecodeStream) { 59635 imgData.data = imgArray; 59636 } else { 59637 var newArray = new Uint8ClampedArray(imgArray.length); 59638 newArray.set(imgArray); 59639 imgData.data = newArray; 59640 } 59641 59642 if (this.needsDecode) { 59643 (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 59644 var buffer = imgData.data; 59645 59646 for (var i = 0, ii = buffer.length; i < ii; i++) { 59647 buffer[i] ^= 0xff; 59648 } 59649 } 59650 59651 return imgData; 59652 } 59653 59654 if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) { 59655 let imageLength = originalHeight * rowBytes; 59656 59657 switch (this.colorSpace.name) { 59658 case "DeviceGray": 59659 imageLength *= 3; 59660 59661 case "DeviceRGB": 59662 case "DeviceCMYK": 59663 imgData.kind = _util.ImageKind.RGB_24BPP; 59664 imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true); 59665 return imgData; 59666 } 59667 } 59668 } 59669 59670 imgArray = this.getImageBytes(originalHeight * rowBytes); 59671 var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 59672 var comps = this.getComponents(imgArray); 59673 var alpha01, maybeUndoPreblend; 59674 59675 if (!forceRGBA && !this.smask && !this.mask) { 59676 imgData.kind = _util.ImageKind.RGB_24BPP; 59677 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 59678 alpha01 = 0; 59679 maybeUndoPreblend = false;
59680 } else { 59681 imgData.kind = _util.ImageKind.RGBA_32BPP; 59682 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 59683 alpha01 = 1; 59684 maybeUndoPreblend = true; 59685 this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps); 59686 } 59687 59688 if (this.needsDecode) { 59689 this.decodeBuffer(comps); 59690 } 59691 59692 this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 59693 59694 if (maybeUndoPreblend) { 59695 this.undoPreblend(imgData.data, drawWidth, actualHeight); 59696 } 59697 59698 return imgData; 59699 }, 59700 59701 fillGrayBuffer(buffer) { 59702 var numComps = this.numComps; 59703 59704 if (numComps !== 1) { 59705 throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`); 59706 } 59707 59708 var width = this.width; 59709 var height = this.height; 59710 var bpc = this.bpc; 59711 var rowBytes = width * numComps * bpc + 7 >> 3; 59712 var imgArray = this.getImageBytes(height * rowBytes); 59713 var comps = this.getComponents(imgArray); 59714 var i, length; 59715 59716 if (bpc === 1) { 59717 length = width * height; 59718 59719 if (this.needsDecode) { 59720 for (i = 0; i < length; ++i) { 59721 buffer[i] = comps[i] - 1 & 255; 59722 } 59723 } else { 59724 for (i = 0; i < length; ++i) { 59725 buffer[i] = -comps[i] & 255; 59726 } 59727 } 59728 59729 return; 59730 } 59731 59732 if (this.needsDecode) { 59733 this.decodeBuffer(comps); 59734 } 59735 59736 length = width * height; 59737 var scale = 255 / ((1 << bpc) - 1); 59738 59739 for (i = 0; i < length; ++i) { 59740 buffer[i] = scale * comps[i]; 59741 } 59742 }, 59743 59744 getImageBytes(length, drawWidth, drawHeight, forceRGB = false) { 59745 this.image.reset(); 59746 this.image.drawWidth = drawWidth || this.width; 59747 this.image.drawHeight = drawHeight || this.height; 59748 this.image.forceRGB = !!forceRGB; 59749 return this.image.getBytes(length, true); 59750 } 59751 59752 }; 59753 return PDFImage; 59754}(); 59755 59756exports.PDFImage = PDFImage; 59757 59758/***/ }), 59759/* 45 */ 59760/***/ (function(module, exports, __w_pdfjs_require__) { 59761 59762"use strict"; 59763 59764 59765Object.defineProperty(exports, "__esModule", { 59766 value: true 59767}); 59768exports.MessageHandler = void 0; 59769 59770var _util = __w_pdfjs_require__(2); 59771 59772const CallbackKind = { 59773 UNKNOWN: 0, 59774 DATA: 1, 59775 ERROR: 2 59776}; 59777const StreamKind = { 59778 UNKNOWN: 0, 59779 CANCEL: 1, 59780 CANCEL_COMPLETE: 2, 59781 CLOSE: 3, 59782 ENQUEUE: 4, 59783 ERROR: 5, 59784 PULL: 6, 59785 PULL_COMPLETE: 7, 59786 START_COMPLETE: 8 59787}; 59788 59789function wrapReason(reason) { 59790 if (typeof reason !== "object" || reason === null) { 59791 return reason; 59792 } 59793 59794 switch (reason.name) { 59795 case "AbortException": 59796 return new _util.AbortException(reason.message); 59797 59798 case "MissingPDFException": 59799 return new _util.MissingPDFException(reason.message); 59800 59801 case "UnexpectedResponseException": 59802 return new _util.UnexpectedResponseException(reason.message, reason.status); 59803 59804 case "UnknownErrorException": 59805 return new _util.UnknownErrorException(reason.message, reason.details); 59806 59807 default: 59808 return new _util.UnknownErrorException(reason.message, reason.toString()); 59809 } 59810} 59811 59812class MessageHandler { 59813 constructor(sourceName, targetName, comObj) { 59814 this.sourceName = sourceName; 59815 this.targetName = targetName; 59816 this.comObj = comObj; 59817 this.callbackId = 1; 59818 this.streamId = 1; 59819 this.postMessageTransfers = true; 59820 this.streamSinks = Object.create(null); 59821 this.streamControllers = Object.create(null); 59822 this.callbackCapabilities = Object.create(null); 59823 this.actionHandler = Object.create(null); 59824 59825 this._onComObjOnMessage = event => { 59826 const data = event.data; 59827 59828 if (data.targetName !== this.sourceName) { 59829 return; 59830 } 59831 59832 if (data.stream) { 59833 this._processStreamMessage(data); 59834 59835 return; 59836 } 59837 59838 if (data.callback) { 59839 const callbackId = data.callbackId; 59840 const capability = this.callbackCapabilities[callbackId]; 59841 59842 if (!capability) { 59843 throw new Error(`Cannot resolve callback ${callbackId}`); 59844 } 59845 59846 delete this.callbackCapabilities[callbackId]; 59847 59848 if (data.callback === CallbackKind.DATA) { 59849 capability.resolve(data.data); 59850 } else if (data.callback === CallbackKind.ERROR) { 59851 capability.reject(wrapReason(data.reason)); 59852 } else { 59853 throw new Error("Unexpected callback case"); 59854 } 59855 59856 return; 59857 } 59858 59859 const action = this.actionHandler[data.action]; 59860 59861 if (!action) { 59862 throw new Error(`Unknown action from worker: ${data.action}`); 59863 } 59864 59865 if (data.callbackId) { 59866 const cbSourceName = this.sourceName; 59867 const cbTargetName = data.sourceName; 59868 new Promise(function (resolve) { 59869 resolve(action(data.data)); 59870 }).then(function (result) { 59871 comObj.postMessage({ 59872 sourceName: cbSourceName, 59873 targetName: cbTargetName, 59874 callback: CallbackKind.DATA, 59875 callbackId: data.callbackId, 59876 data: result 59877 }); 59878 }, function (reason) { 59879 comObj.postMessage({ 59880 sourceName: cbSourceName, 59881 targetName: cbTargetName, 59882 callback: CallbackKind.ERROR, 59883 callbackId: data.callbackId, 59884 reason: wrapReason(reason) 59885 }); 59886 }); 59887 return; 59888 } 59889 59890 if (data.streamId) { 59891 this._createStreamSink(data); 59892 59893 return; 59894 } 59895 59896 action(data.data); 59897 }; 59898 59899 comObj.addEventListener("message", this._onComObjOnMessage); 59900 } 59901 59902 on(actionName, handler) { 59903 const ah = this.actionHandler; 59904 59905 if (ah[actionName]) { 59906 throw new Error(`There is already an actionName called "${actionName}"`); 59907 } 59908 59909 ah[actionName] = handler; 59910 } 59911 59912 send(actionName, data, transfers) { 59913 this._postMessage({ 59914 sourceName: this.sourceName, 59915 targetName: this.targetName, 59916 action: actionName, 59917 data 59918 }, transfers); 59919 } 59920
59921 sendWithPromise(actionName, data, transfers) { 59922 const callbackId = this.callbackId++; 59923 const capability = (0, _util.createPromiseCapability)(); 59924 this.callbackCapabilities[callbackId] = capability; 59925 59926 try { 59927 this._postMessage({ 59928 sourceName: this.sourceName, 59929 targetName: this.targetName, 59930 action: actionName, 59931 callbackId, 59932 data 59933 }, transfers); 59934 } catch (ex) { 59935 capability.reject(ex); 59936 } 59937 59938 return capability.promise; 59939 } 59940 59941 sendWithStream(actionName, data, queueingStrategy, transfers) { 59942 const streamId = this.streamId++; 59943 const sourceName = this.sourceName; 59944 const targetName = this.targetName; 59945 const comObj = this.comObj; 59946 return new ReadableStream({ 59947 start: controller => { 59948 const startCapability = (0, _util.createPromiseCapability)(); 59949 this.streamControllers[streamId] = { 59950 controller, 59951 startCall: startCapability, 59952 pullCall: null, 59953 cancelCall: null, 59954 isClosed: false 59955 }; 59956 59957 this._postMessage({ 59958 sourceName, 59959 targetName, 59960 action: actionName, 59961 streamId, 59962 data, 59963 desiredSize: controller.desiredSize 59964 }, transfers); 59965 59966 return startCapability.promise; 59967 }, 59968 pull: controller => { 59969 const pullCapability = (0, _util.createPromiseCapability)(); 59970 this.streamControllers[streamId].pullCall = pullCapability; 59971 comObj.postMessage({ 59972 sourceName, 59973 targetName, 59974 stream: StreamKind.PULL, 59975 streamId, 59976 desiredSize: controller.desiredSize 59977 }); 59978 return pullCapability.promise; 59979 }, 59980 cancel: reason => { 59981 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 59982 const cancelCapability = (0, _util.createPromiseCapability)(); 59983 this.streamControllers[streamId].cancelCall = cancelCapability; 59984 this.streamControllers[streamId].isClosed = true; 59985 comObj.postMessage({ 59986 sourceName, 59987 targetName, 59988 stream: StreamKind.CANCEL, 59989 streamId, 59990 reason: wrapReason(reason) 59991 }); 59992 return cancelCapability.promise; 59993 } 59994 }, queueingStrategy); 59995 } 59996 59997 _createStreamSink(data) { 59998 const self = this; 59999 const action = this.actionHandler[data.action]; 60000 const streamId = data.streamId; 60001 const sourceName = this.sourceName; 60002 const targetName = data.sourceName; 60003 const comObj = this.comObj; 60004 const streamSink = { 60005 enqueue(chunk, size = 1, transfers) { 60006 if (this.isCancelled) { 60007 return; 60008 } 60009 60010 const lastDesiredSize = this.desiredSize; 60011 this.desiredSize -= size; 60012 60013 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 60014 this.sinkCapability = (0, _util.createPromiseCapability)(); 60015 this.ready = this.sinkCapability.promise; 60016 } 60017 60018 self._postMessage({ 60019 sourceName, 60020 targetName, 60021 stream: StreamKind.ENQUEUE, 60022 streamId, 60023 chunk 60024 }, transfers); 60025 }, 60026 60027 close() { 60028 if (this.isCancelled) { 60029 return; 60030 } 60031 60032 this.isCancelled = true; 60033 comObj.postMessage({ 60034 sourceName, 60035 targetName, 60036 stream: StreamKind.CLOSE, 60037 streamId 60038 }); 60039 delete self.streamSinks[streamId]; 60040 }, 60041 60042 error(reason) { 60043 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 60044 60045 if (this.isCancelled) { 60046 return; 60047 } 60048 60049 this.isCancelled = true; 60050 comObj.postMessage({ 60051 sourceName, 60052 targetName, 60053 stream: StreamKind.ERROR, 60054 streamId, 60055 reason: wrapReason(reason) 60056 }); 60057 }, 60058 60059 sinkCapability: (0, _util.createPromiseCapability)(), 60060 onPull: null, 60061 onCancel: null, 60062 isCancelled: false, 60063 desiredSize: data.desiredSize, 60064 ready: null 60065 }; 60066 streamSink.sinkCapability.resolve(); 60067 streamSink.ready = streamSink.sinkCapability.promise; 60068 this.streamSinks[streamId] = streamSink; 60069 new Promise(function (resolve) { 60070 resolve(action(data.data, streamSink)); 60071 }).then(function () { 60072 comObj.postMessage({ 60073 sourceName, 60074 targetName, 60075 stream: StreamKind.START_COMPLETE, 60076 streamId, 60077 success: true 60078 }); 60079 }, function (reason) { 60080 comObj.postMessage({ 60081 sourceName, 60082 targetName, 60083 stream: StreamKind.START_COMPLETE, 60084 streamId, 60085 reason: wrapReason(reason) 60086 }); 60087 }); 60088 } 60089 60090 _processStreamMessage(data) { 60091 const streamId = data.streamId; 60092 const sourceName = this.sourceName; 60093 const targetName = data.sourceName; 60094 const comObj = this.comObj; 60095 60096 switch (data.stream) { 60097 case StreamKind.START_COMPLETE: 60098 if (data.success) { 60099 this.streamControllers[streamId].startCall.resolve(); 60100 } else { 60101 this.streamControllers[streamId].startCall.reject(wrapReason(data.reason)); 60102 } 60103 60104 break; 60105 60106 case StreamKind.PULL_COMPLETE: 60107 if (data.success) { 60108 this.streamControllers[streamId].pullCall.resolve(); 60109 } else { 60110 this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason)); 60111 } 60112 60113 break; 60114 60115 case StreamKind.PULL: 60116 if (!this.streamSinks[streamId]) { 60117 comObj.postMessage({ 60118 sourceName, 60119 targetName, 60120 stream: StreamKind.PULL_COMPLETE, 60121 streamId, 60122 success: true 60123 }); 60124 break; 60125 } 60126 60127 if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) { 60128 this.streamSinks[streamId].sinkCapability.resolve(); 60129 } 60130 60131 this.streamSinks[streamId].desiredSize = data.desiredSize; 60132 const { 60133 onPull 60134 } = this.streamSinks[data.streamId]; 60135 new Promise(function (resolve) { 60136 resolve(onPull && onPull()); 60137 }).then(function () { 60138 comObj.postMessage({ 60139 sourceName, 60140 targetName, 60141 stream: StreamKind.PULL_COMPLETE, 60142 streamId, 60143 success: true 60144 }); 60145 }, function (reason) { 60146 comObj.postMessage({ 60147 sourceName, 60148 targetName, 60149 stream: StreamKind.PULL_COMPLETE, 60150 streamId, 60151 reason: wrapReason(reason) 60152 }); 60153 }); 60154 break; 60155 60156 case StreamKind.ENQUEUE: 60157 (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller"); 60158 60159 if (this.streamControllers[streamId].isClosed) { 60160 break; 60161 } 60162 60163 this.streamControllers[streamId].controller.enqueue(data.chunk); 60164 break; 60165 60166 case StreamKind.CLOSE: 60167 (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller"); 60168 60169 if (this.streamControllers[streamId].isClosed) { 60170 break; 60171 } 60172 60173 this.streamControllers[streamId].isClosed = true; 60174 this.streamControllers[streamId].controller.close(); 60175 60176 this._deleteStreamController(streamId); 60177 60178 break; 60179 60180 case StreamKind.ERROR: 60181 (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller"); 60182 this.streamControllers[streamId].controller.error(wrapReason(data.reason)); 60183 60184 this._deleteStreamController(streamId); 60185 60186 break; 60187 60188 case StreamKind.CANCEL_COMPLETE: 60189 if (data.success) { 60190 this.streamControllers[streamId].cancelCall.resolve(); 60191 } else { 60192 this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason)); 60193 } 60194 60195 this._deleteStreamController(streamId); 60196 60197 break; 60198 60199 case StreamKind.CANCEL: 60200 if (!this.streamSinks[streamId]) { 60201 break; 60202 } 60203 60204 const { 60205 onCancel 60206 } = this.streamSinks[data.streamId]; 60207 new Promise(function (resolve) { 60208 resolve(onCancel && onCancel(wrapReason(data.reason))); 60209 }).then(function () { 60210 comObj.postMessage({ 60211 sourceName, 60212 targetName, 60213 stream: StreamKind.CANCEL_COMPLETE, 60214 streamId, 60215 success: true 60216 }); 60217 }, function (reason) { 60218 comObj.postMessage({ 60219 sourceName, 60220 targetName, 60221 stream: StreamKind.CANCEL_COMPLETE, 60222 streamId, 60223 reason: wrapReason(reason) 60224 }); 60225 }); 60226 this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason)); 60227 this.streamSinks[streamId].isCancelled = true; 60228 delete this.streamSinks[streamId]; 60229 break; 60230 60231 default: 60232 throw new Error("Unexpected stream case"); 60233 } 60234 } 60235 60236 async _deleteStreamController(streamId) { 60237 await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) { 60238 return capability && capability.promise; 60239 })); 60240 delete this.streamControllers[streamId]; 60241 } 60242 60243 _postMessage(message, transfers) { 60244 if (transfers && this.postMessageTransfers) { 60245 this.comObj.postMessage(message, transfers); 60246 } else { 60247 this.comObj.postMessage(message); 60248 } 60249 } 60250 60251 destroy() { 60252 this.comObj.removeEventListener("message", this._onComObjOnMessage); 60253 } 60254 60255} 60256 60257exports.MessageHandler = MessageHandler; 60258 60259/***/ }), 60260/* 46 */ 60261/***/ (function(module, exports, __w_pdfjs_require__) { 60262 60263"use strict"; 60264 60265 60266Object.defineProperty(exports, "__esModule", { 60267 value: true 60268}); 60269exports.PDFWorkerStream = void 0; 60270 60271var _util = __w_pdfjs_require__(2); 60272 60273class PDFWorkerStream { 60274 constructor(msgHandler) { 60275 this._msgHandler = msgHandler; 60276 this._contentLength = null; 60277 this._fullRequestReader = null; 60278 this._rangeRequestReaders = []; 60279 } 60280 60281 getFullReader() { 60282 (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once."); 60283 this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); 60284 return this._fullRequestReader; 60285 } 60286 60287 getRangeReader(begin, end) { 60288 const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); 60289 60290 this._rangeRequestReaders.push(reader); 60291 60292 return reader; 60293 } 60294 60295 cancelAllRequests(reason) { 60296 if (this._fullRequestReader) { 60297 this._fullRequestReader.cancel(reason); 60298 } 60299 60300 const readers = this._rangeRequestReaders.slice(0); 60301
60302 readers.forEach(function (reader) { 60303 reader.cancel(reason); 60304 }); 60305 } 60306 60307} 60308 60309exports.PDFWorkerStream = PDFWorkerStream; 60310 60311class PDFWorkerStreamReader { 60312 constructor(msgHandler) { 60313 this._msgHandler = msgHandler; 60314 this.onProgress = null; 60315 this._contentLength = null; 60316 this._isRangeSupported = false; 60317 this._isStreamingSupported = false; 60318 60319 const readableStream = this._msgHandler.sendWithStream("GetReader"); 60320 60321 this._reader = readableStream.getReader(); 60322 this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 60323 this._isStreamingSupported = data.isStreamingSupported; 60324 this._isRangeSupported = data.isRangeSupported; 60325 this._contentLength = data.contentLength; 60326 }); 60327 } 60328 60329 get headersReady() { 60330 return this._headersReady; 60331 } 60332 60333 get contentLength() { 60334 return this._contentLength; 60335 } 60336 60337 get isStreamingSupported() { 60338 return this._isStreamingSupported; 60339 } 60340 60341 get isRangeSupported() { 60342 return this._isRangeSupported; 60343 } 60344 60345 async read() { 60346 const { 60347 value, 60348 done 60349 } = await this._reader.read(); 60350 60351 if (done) { 60352 return { 60353 value: undefined, 60354 done: true 60355 }; 60356 } 60357 60358 return { 60359 value: value.buffer, 60360 done: false 60361 }; 60362 } 60363 60364 cancel(reason) { 60365 this._reader.cancel(reason); 60366 } 60367 60368} 60369 60370class PDFWorkerStreamRangeReader { 60371 constructor(begin, end, msgHandler) { 60372 this._msgHandler = msgHandler; 60373 this.onProgress = null; 60374 60375 const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { 60376 begin, 60377 end 60378 }); 60379 60380 this._reader = readableStream.getReader(); 60381 } 60382 60383 get isStreamingSupported() { 60384 return false; 60385 } 60386 60387 async read() { 60388 const { 60389 value, 60390 done 60391 } = await this._reader.read(); 60392 60393 if (done) { 60394 return { 60395 value: undefined, 60396 done: true 60397 }; 60398 } 60399 60400 return { 60401 value: value.buffer, 60402 done: false 60403 }; 60404 } 60405 60406 cancel(reason) { 60407 this._reader.cancel(reason); 60408 } 60409 60410} 60411 60412/***/ }) 60413/******/ ]); 60414}); 60415//# sourceMappingURL=pdf.worker.js.map; 60416/* 60417 * Shared cookie helpers and acquisition-UTM tracking for BaT theme and landing-page contexts. 60418 * 60419 * Loaded by the main WordPress theme and by page-seller-lp.php / page-buyer-lp.php 60420 * so the isolated landing-page templates can reuse the same behavior without loading 60421 * the full `01-general.js` theme bundle. 60422 * 60423 * Expects `BaT_Theme` to be initialized with at least: 60424 * - BaT_Theme.cookieDomain (from bat_get_cookie_domain(); may include a leading dot) 60425 * - BaT_Theme.loggedIn 60426 * - BaT_Theme.utmTtl (optional, defaults to 60) 60427 * - BaT_Theme.utmFields (optional, defaults to []) 60428 */ 60429 60430/* global BaT_Theme */ 60431/* eslint-disable no-unused-vars */ 60432 60433// phpcs:disable WordPressVIPMinimum.JS.Window.VarAssignment,WordPressVIPMinimum.JS.Window.location 60434 60435(function () { 60436 'use strict'; 60437 60438 if (!window.BaT_Theme) { 60439 return; 60440 } 60441 60442 if (!BaT_Theme.getCookie) { 60443 BaT_Theme.getCookie = function (cookieName) { 60444 var index, 60445 parts = document.cookie.split(';'), 60446 value = ''; 60447 60448 for (index = 0; index < parts.length; index++) { 60449 value = parts[index].trim(); 60450 60451 if (value.indexOf(cookieName) === 0 && '=' === value.substring(cookieName.length, cookieName.length + 1)) { 60452 return value.substring(cookieName.length + 1); 60453 } 60454 } 60455 60456 return null; 60457 }; 60458 } 60459 60460 BaT_Theme.getSharedCookieDomain = function () { 60461 var sharedCookieDomain = String(BaT_Theme.cookieDomain || '').trim().toLowerCase().replace(/^\./, ''), 60462 hostname = window.location.hostname ? window.location.hostname.toLowerCase() : ''; 60463 60464 return sharedCookieDomain && (hostname === sharedCookieDomain || hostname.endsWith(`.${sharedCookieDomain}`)) 60465 ? sharedCookieDomain 60466 : ''; 60467 }; 60468 60469 BaT_Theme.setCookieWithAttributes = function (cookieName, cookieValue, options) { 60470 var settings = options || {}, 60471 cookie = cookieName + '=' + cookieValue, 60472 expires = settings.expires; 60473 60474 if (expires) { 60475 cookie += '; expires=' + (expires instanceof Date ? expires.toUTCString() : expires); 60476 } 60477 60478 cookie += '; path=' + (settings.path || '/'); 60479 60480 if (settings.domain) { 60481 cookie += '; domain=' + settings.domain; 60482 } 60483 60484 cookie += '; SameSite=' + (settings.sameSite || 'Lax'); 60485 60486 if (settings.secure) { 60487 cookie += '; Secure'; 60488 } 60489 60490 document.cookie = cookie; 60491 }; 60492 60493 BaT_Theme.clearSharedDomainCookie = function (cookieName) { 60494 var domain = BaT_Theme.getSharedCookieDomain(), 60495 options = { 60496 expires: new Date(0), 60497 sameSite: 'Lax', 60498 secure: window.location.protocol === 'https:', 60499 }; 60500 60501 BaT_Theme.setCookieWithAttributes(cookieName, '', options); 60502 60503 if (domain) { 60504 options.domain = domain; 60505 BaT_Theme.setCookieWithAttributes(cookieName, '', options); 60506 } 60507 }; 60508 60509 BaT_Theme.setSharedDomainCookie = function (cookieName, cookieValue, expiresDate) { 60510 var domain = BaT_Theme.getSharedCookieDomain(), 60511 options = { 60512 expires: expiresDate, 60513 sameSite: 'Lax', 60514 secure: window.location.protocol === 'https:', 60515 }; 60516 60517 if (domain) { 60518 BaT_Theme.setCookieWithAttributes(cookieName, '', { 60519 expires: new Date(0), 60520 sameSite: 'Lax', 60521 secure: window.location.protocol === 'https:', 60522 }); 60523 options.domain = domain; 60524 } 60525 60526 BaT_Theme.setCookieWithAttributes(cookieName, cookieValue, options); 60527 }; 60528 60529 // --- Acquisition UTM tracking --- 60530 60531 (function () { 60532 try { 60533 var STORAGE_KEY = 'bat_acq_utm'; 60534 var COOKIE_NAME = 'bat_acq_utm'; 60535 60536 if ('yes' === BaT_Theme.loggedIn) { 60537 try { 60538 window.localStorage.removeItem(STORAGE_KEY); 60539 } catch (e) {} 60540 BaT_Theme.clearSharedDomainCookie(COOKIE_NAME); 60541 } else { 60542 var TTL_DAYS = BaT_Theme.utmTtl || 60; 60543 60544 function parseUtmFromUrl() { 60545 var params = new URLSearchParams(window.location.search || ''); 60546 var obj = {}; 60547 var utmFields = BaT_Theme.utmFields || []; 60548 var pattern = Array.isArray(utmFields) && utmFields.length > 0 ? utmFields.join('|') : '^utm_'; 60549 var regex = new RegExp(pattern, 'i');
60550 params.forEach(function (value, key) { 60551 if (regex.test(key) && value) { 60552 obj[key.toLowerCase()] = value; 60553 } 60554 }); 60555 return obj; 60556 } 60557 60558 function getStored(raw) { 60559 try { 60560 if (!raw) { 60561 return null; 60562 } 60563 var data = JSON.parse(raw); 60564 if (!data || !data.exp || data.exp < Date.now()) { 60565 return null; 60566 } 60567 return data; 60568 } catch (e) { 60569 return null; 60570 } 60571 } 60572 60573 function getStoredTimestamp(data) { 60574 var timestamp = parseInt(data && data.ts, 10); 60575 60576 return isNaN(timestamp) ? Date.now() : timestamp; 60577 } 60578 60579 function getStoredFromCookie() { 60580 try { 60581 var index, 60582 parts = document.cookie.split(';'), 60583 payload = null, 60584 stored = null, 60585 value = ''; 60586 60587 for (index = 0; index < parts.length; index++) { 60588 value = parts[index].trim(); 60589 60590 if (value.indexOf(COOKIE_NAME) === 0 && '=' === value.substring(COOKIE_NAME.length, COOKIE_NAME.length + 1)) { 60591 try { 60592 payload = getStored(atob(value.substring(COOKIE_NAME.length + 1))); 60593 stored = getOldestStored(stored, payload); 60594 } catch (e) {} 60595 } 60596 } 60597 60598 return stored; 60599 } catch (e) { 60600 return null; 60601 } 60602 } 60603 60604 function getStoredFromLocalStorage() { 60605 try { 60606 return getStored(window.localStorage.getItem(STORAGE_KEY)); 60607 } catch (e) { 60608 return null; 60609 } 60610 } 60611 60612 function getOldestStored(cookieStored, localStored) { 60613 if (cookieStored && localStored) { 60614 return getStoredTimestamp(cookieStored) <= getStoredTimestamp(localStored) ? cookieStored : localStored; 60615 } 60616 60617 return cookieStored || localStored; 60618 } 60619 60620 function syncStored(data) { 60621 if (!data) { 60622 return; 60623 } 60624 60625 try { 60626 window.localStorage.setItem(STORAGE_KEY, JSON.stringify(data)); 60627 } catch (e) {} 60628 60629 setCookieFromStored(data); 60630 } 60631 60632 function setStored(utm) { 60633 if (!utm) { 60634 return; 60635 } 60636 var nowTime = Date.now(); 60637 var expTime = nowTime + TTL_DAYS * 24 * 60 * 60 * 1000; 60638 var data = { 60639 utm: utm, 60640 ts: nowTime, 60641 exp: expTime, 60642 }; 60643 60644 try { 60645 window.localStorage.setItem(STORAGE_KEY, JSON.stringify(data)); 60646 } catch (e) {} 60647 60648 setCookieFromStored(data); 60649 } 60650 60651 function setCookieFromStored(data) { 60652 try { 60653 if (!data || !data.exp) { 60654 return; 60655 } 60656 60657 var cookieTime = new Date(data.exp); 60658 BaT_Theme.setSharedDomainCookie(COOKIE_NAME, btoa(JSON.stringify(data)), cookieTime); 60659 } catch (e) {} 60660 } 60661 60662 function capture() { 60663 var cookieStored = getStoredFromCookie(); 60664 var localStored = getStoredFromLocalStorage(); 60665 var stored = getOldestStored(cookieStored, localStored); 60666 60667 if (stored) { 60668 syncStored(stored); 60669 return; 60670 } 60671 60672 var dataFromUrl = parseUtmFromUrl();
60673 if (Object.keys(dataFromUrl).length > 0) { 60674 setStored(dataFromUrl); 60675 } 60676 } 60677 60678 capture(); 60679 } 60680 } catch (e) {} 60681 })(); 60682 60683 // phpcs:enable WordPressVIPMinimum.JS.Window.VarAssignment,WordPressVIPMinimum.JS.Window.location 60684})(); 60685; 60686/* 60687 * jQuery throttle / debounce - v1.1 - 3/7/2010 60688 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 60689 * 60690 * Copyright (c) 2010 "Cowboy" Ben Alman 60691 * Dual licensed under the MIT and GPL licenses. 60692 * http://benalman.com/about/license/ 60693 */ 60694(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); 60695 60696var CommentsListViewModel = function(id) { 60697 var self = this, 60698 pusher = 'undefined' !== typeof BAT_WEBSERVICES_PUSHER ? BAT_WEBSERVICES_PUSHER : false, 60699 audio = { 60700 bid: new Howl({ src: [BAT_VMS.bidAudioUrl] }), 60701 comment: new Howl({ src: [BAT_VMS.commentAudioUrl] }), 60702 }; 60703 60704 self.id = ko.observable(id); 60705 60706 self.order = ko.observable(BAT_VMS.commentOrder); 60707 60708 self.comments = ko.observableArray(); 60709 self.comments.extend({ rateLimit: { timeout: 50, method: "notifyWhenChangesStop" } }); 60710 60711 self.date = ko.observable(new Date()); 60712 60713 setInterval(function() { self.date(new Date()); }, 1000); 60714 60715 self.isLoggedIn = 0 !== parseInt(BAT_VMS.userId) && !isNaN(parseInt(BAT_VMS.userId)); 60716 self.isLoggedOut = !self.isLoggedIn; 60717 60718 self.isOrderAsc = ko.computed(function() { return 'asc' === self.order(); }); 60719 self.isOrderDesc = ko.computed(function() { return 'desc' === self.order(); }); 60720 60721 self.commentFormViewModel = new CommentFormViewModel(); 60722 60723 self.template = function(comment) { 60724 return 'comment-type-' + comment.type(); 60725 }; 60726 60727 self.addComment = function(data, enableAudio) { 60728 if(parseInt(data.post) === parseInt(self.id())) { 60729 var existing = ko.utils.arrayFirst(self.comments(), function(comment) { return data.id == comment.id(); }), 60730 comment = new CommentViewModel(data); 60731 60732 if(existing) { 60733 existing.update(data); 60734 } else { 60735 self.comments.push(comment); 60736 60737 if(true === enableAudio) { 60738 if('bat-bid' === data.type && 'on' === BAT_VMS.bidAudioStatus && audio.bid) { 60739 audio.bid.play(); 60740 } 60741 60742 if(('' === data.type || 'comment' === data.type) && 'on' === BAT_VMS.commentAudioStatus && audio.comment) { 60743 if(!data.hasPendingVideos || parseInt(BAT_VMS.userId) === parseInt(data.authorId)) { 60744 audio.comment.play(); 60745 } 60746 } 60747 } 60748 60749 if(pusher && data.channels) { 60750 for(var i = 0; i < data.channels.length; i++) { 60751 pusher.subscribe(data.channels[i]); 60752 } 60753 } 60754 60755 if(!self.disableSorting) { 60756 self.sortComments(); 60757 } 60758 } 60759 } 60760 }; 60761 60762 self.getCommentsByAuthor = function(authorId) { 60763 return ko.utils.arrayFilter(self.comments(), function(comment) { 60764 return authorId === parseInt(comment.authorId()); 60765 }); 60766 } 60767 60768 self.getCommentById = function(commentId) { 60769 return ko.utils.arrayFirst(self.comments(), function(comment) { 60770 return commentId === parseInt(comment.id()); 60771 }); 60772 }; 60773 60774 self.removeCommentById = function(commentId) { 60775 var existing = self.getCommentById(commentId); 60776 60777 if(existing) { 60778 self.comments.remove(existing); 60779 } 60780 }; 60781 60782 self.disableSorting = false; 60783 self.sortComments = function() { 60784 self.comments.sort(function(comment1, comment2) { 60785 if(self.isOrderDesc()) { 60786 return comment1.date() < comment2.date() ? 1 : -1; 60787 } else if(self.isOrderAsc()) { 60788 return comment1.date() > comment2.date() ? 1 : -1; 60789 } 60790 }); 60791 }; 60792 60793 self.slideInActive = true; 60794 self.slideInActivePrevious = self.slideInActive; 60795 60796 // Animate 60797 self.slideInComment = function(element, index, data) { 60798 if(false === self.slideInActive) { return; } 60799 60800 jQuery(element) 60801 .hide() 60802 .css('opacity', 0) 60803 .slideDown(); 60804 jQuery(element).animate({opacity: 1}); 60805 }; 60806 60807 self.loadCommentsText = ko.observable(BAT_VMS.messageLoadMoreComments); 60808 self.loadCommentsActive = ko.observable(true); 60809 self.loadComments = function() { 60810 if(self.loadCommentsActive()) { 60811 self.loadCommentsActive(false); 60812 60813 self.slideInActivePrevious = self.slideInActive; 60814 self.slideInActive = false;
60815 60816 BAT_VMS.loadCommentsIncrementally(parseInt(BAT_VMS.incrementalLoadCount), true); 60817 } 60818 }; 60819}; 60820 60821BAT_VMS.currentTimestampObservable = ko.observable(Math.floor(Date.now() / 1000)); 60822setInterval(function() { 60823 BAT_VMS.currentTimestampObservable(Math.floor(Date.now() / 1000)); 60824}, 1000); 60825 60826BAT_VMS.commentsInitialLoad = parseInt(BAT_VMS.commentsInitialLoad); 60827BAT_VMS.commentsLoadingInterval = 1000; 60828BAT_VMS.lastCommentLoadedIndex = 'desc' === BAT_VMS.commentOrder ? BAT_VMS.comments.length - 1 : 0; 60829BAT_VMS.lastCommentLoaded = false; 60830 60831BAT_VMS.loadCommentsIncrementally = function(increment, immediately) { 60832 if(!BAT_VMS.lastCommentLoaded) { 60833 var $loading = jQuery('#comments-loading'); 60834 60835 $loading.show(); 60836 60837 BAT_VMS.CLVM.slideInActive = false; 60838 60839 var loader = (function() { 60840 var indexStart = BAT_VMS.lastCommentLoadedIndex, 60841 indexAdjustment = ('desc' === BAT_VMS.commentOrder ? -1 : 1), 60842 indexEnd, 60843 index; 60844 60845 // Calculate indexEnd, excluding bids 60846 var commentsEncountered = 0; 60847 60848 if('desc' === BAT_VMS.commentOrder) { 60849 for (indexEnd = indexStart; indexEnd > -1 && commentsEncountered < increment; indexEnd += indexAdjustment) { 60850 var comment = BAT_VMS.comments[indexEnd]; 60851 60852 if ('comment' === comment.type) { 60853 commentsEncountered += 1; 60854 } 60855 } 60856 } else { 60857 for (indexEnd = indexStart; indexEnd < BAT_VMS.comments.length && commentsEncountered < increment; indexEnd += indexAdjustment) { 60858 var comment = BAT_VMS.comments[indexEnd]; 60859 60860 if('comment' === comment.type) { 60861 commentsEncountered += 1; 60862 } 60863 } 60864 } 60865 60866 BAT_VMS.CLVM.disableSorting = true; 60867 for (index = indexStart; 'desc' === BAT_VMS.commentOrder ? (index > indexEnd) : (index < indexEnd); index += indexAdjustment) { 60868 BAT_VMS.CLVM.addComment(BAT_VMS.comments[index]); 60869 } 60870 60871 BAT_VMS.CLVM.disableSorting = false; 60872 BAT_VMS.CLVM.sortComments(); 60873 60874 if(('desc' === BAT_VMS.commentOrder && -1 == indexEnd) || ('asc' === BAT_VMS.commentOrder && (indexEnd) === BAT_VMS.comments.length)) { 60875 BAT_VMS.lastCommentLoaded = true; 60876 } else { 60877 BAT_VMS.lastCommentLoadedIndex = indexEnd; 60878 } 60879 60880 setTimeout(function() { 60881 // Hide the loading indicator 60882 $loading.hide(); 60883 60884 // Restore the ability to load more comments, if necessary 60885 BAT_VMS.CLVM.loadCommentsActive(false === BAT_VMS.lastCommentLoaded); 60886 60887 // Restore the previous slide in active setting 60888 BAT_VMS.CLVM.slideInActive = BAT_VMS.CLVM.slideInActivePrevious; 60889 }, 150); 60890 }); 60891 60892 if(immediately) { 60893 loader(); 60894 } else { 60895 setTimeout(loader, 100); 60896 } 60897 } 60898}; 60899 60900jQuery(document).ready(function($) { 60901 // Comment rating 60902 if('function' === typeof ckratingKarma) { 60903 var ckratingKarmaOld = ckratingKarma; 60904 60905 ckratingKarma = function(id, action, callback) { 60906 $.get( 60907 BaT_Theme.commentRatingUri, 60908 { 60909 caction: action, 60910 nonce: BaT_Theme.commentRatingUriNonce, 60911 id: id, 60912 path: true, 60913 imgIndex: false 60914 }, 60915 function(data, status) { 60916 var parts = data.split('|'), 60917 partsAction = parts[0], 60918 partsId = parts[1], 60919 partsRating = parts[2], 60920 partsTotal = parts[5]; 60921 60922 if('redirect' === partsAction) { 60923 window.location.assign(partsId); 60924 } 60925 60926 if('function' === typeof callback) { 60927 callback(partsId, partsRating, partsTotal); 60928 } 60929 } 60930 ); 60931 }; 60932 } 60933 60934 var $comments = $('#comments'); 60935 60936 // Submit the form via CTRL/CMD + ENTER 60937 $('#comment').on('keydown', function(event) { 60938 var $comment = $(this); 60939 60940 if((event.ctrlKey || event.metaKey) && event.which === 13) { 60941 $comment.parents('form').submit(); 60942 } 60943 }); 60944 60945 if($comments.length > 0) { 60946 $('#comments-javascript-warning').hide(); 60947 60948 BAT_VMS.CLVM = new CommentsListViewModel($comments.data('id')); 60949 60950 var isScrollToComment = location.hash.indexOf('#comment-') >= 0, 60951 showAdditionalComments = true, 60952 currentCommentIndex = null, 60953 showCommentsCount = BAT_VMS.commentsInitialLoad; 60954 60955 if (isScrollToComment) { 60956 var commentId = location.hash.replace("#comment-", ""); 60957 BAT_VMS.comments.slice().reverse().forEach(function(comment, index) { 60958 if ((index <= BAT_VMS.commentsInitialLoad) && (comment.id == commentId)) { 60959 showAdditionalComments = false;
60960 } else if (comment.id == commentId) { 60961 currentCommentIndex = index; 60962 if (currentCommentIndex + 5 <= parseInt(BAT_VMS.lastCommentLoadedIndex)) { 60963 showCommentsCount = currentCommentIndex + 6 ; 60964 } else { 60965 showCommentsCount = parseInt(BAT_VMS.lastCommentLoadedIndex) + 1; 60966 } 60967 } 60968 }); 60969 } 60970 60971 BAT_VMS.loadCommentsIncrementally(showCommentsCount, true); 60972 60973 ko.applyBindings(BAT_VMS.CLVM, $comments.get(0)); 60974 60975 $('#comments-javascript-enabled').show(); 60976 60977 if (isScrollToComment) { 60978 var determineStickyHeaderHeightTimeout = null; 60979 var determineStickyHeaderHeight = () => new Promise((resolve) => { 60980 clearTimeout(determineStickyHeaderHeightTimeout); 60981 if (!$('.listing-sticky-fixed').length) { 60982 determineStickyHeaderHeightTimeout = setTimeout(function () { 60983 resolve(determineStickyHeaderHeight()); 60984 }, 100); 60985 } else { 60986 resolve($('.listing-sticky-fixed').height()); 60987 } 60988 }); 60989 60990 // Disable default scroll to anchor 60991 setTimeout(function() { 60992 window.scrollTo(0, 0); 60993 }, 1); 60994 60995 if (window.scrollY < 200) { 60996 // Scrolling to determine the height of the sticky header 60997 $('html, body').animate({ 60998 scrollTop: 200 60999 }, 1, function () { 61000 determineStickyHeaderHeight().then(function(result) { 61001 // Scroll to comment 61002 var comment = $(location.hash); 61003 61004 if(comment.length > 0) { 61005 $('html, body').animate({ 61006 scrollTop: $(location.hash).offset().top - result 61007 }, 500); 61008 } 61009 }); 61010 }); 61011 } else { 61012 determineStickyHeaderHeight().then(function(result) { 61013 // Scroll to comment 61014 var comment = $(location.hash); 61015 61016 if(comment.length > 0) { 61017 $('html, body').animate({ 61018 scrollTop: $(location.hash).offset().top - result 61019 }, 500); 61020 } 61021 }); 61022 } 61023 } 61024 61025 setTimeout(function() { 61026 var singleCommentMatches = document.location.hash.match(/#comment-(\d+)/); 61027 61028 if(singleCommentMatches && singleCommentMatches[1]) { 61029 var $comments = $('#comments'), 61030 $comment = $('#comment-' + singleCommentMatches[1]); 61031 61032 if($comment.size()) { 61033 $('html,body').scrollTop($comment.offset().top); 61034 } else { 61035 $('html,body').scrollTop($comments.offset().top); 61036 } 61037 61038 return; 61039 } 61040 61041 var commentPhotoUpload = document.location.hash.match(/#comment-upload/); 61042 61043 if(commentPhotoUpload) { 61044 var $commentTextArea = $('#comment'), 61045 $addPhotosButton = $('.bat-comment-photos-launch a'); 61046 61047 if(!$addPhotosButton.is(':visible')) { 61048 return; 61049 } 61050 61051 $('html,body').scrollTop($commentTextArea.offset().top); 61052 $addPhotosButton.click(); 61053 $commentTextArea.focus(); 61054 } 61055 61056 var commentForm = document.location.hash.match(/#comment-form/); 61057 61058 if (commentForm) { 61059 var $commentTextArea = $('#comment'); 61060 61061 $('html,body').scrollTop($commentTextArea.offset().top - 160); 61062 $commentTextArea.focus(); 61063 } 61064 }, 10); 61065 } 61066}); 61067 61068// Photo uploader 61069(function($) { 61070 var ItemPhotoUploaderViewModel = function(params) { 61071 var self = this; 61072 61073 self.itemId = params.itemId; 61074 61075 // isUploadPending is true any time the uploader is working 61076 self.isUploadPending = params.isUploadPending || ko.observable(false); 61077 61078 // onUploadsSuccessful(attachmentIds) is called when the uploader finishes processing with at least once successful upload. 61079 // This function can be called multiple times if a user batches another set of photos after a first set has completed. 61080 self.onUploadsSuccessful = params.onUploadsSuccessful || function(attachmentIds){}; 61081 61082 // onUploadsFailed() is called when the uploader finishes processing with 0 successful uploads. 61083 // If at least one upload succeeded, onUploadsSuccessful(attachmentIds) will be called instead. 61084 // This function can be called multiple times if a user batches another set of photo afster a first set has completed. 61085 self.onUploadsFailed = params.onUploadsFailed || function(){}; 61086 61087 self.uploadUrl = BaT_Listings_Submission.urlUploadPrefix + self.itemId + '/' + 61088 '?temp_id=' + BaT_Listings_Submission.uploadTempId + 61089 '&nonce=' + BaT_Listings_Submission.urlUploadNonce + 61090 '&field=gallery'; 61091 }; 61092 61093 ItemPhotoUploaderViewModel.prototype.koDescendantsComplete = function(node) { 61094 var self = this, 61095 dropTarget = node.querySelector('.bat-listings-listings-gallery-dropper'), 61096 form = node.querySelector('.bat-listings-listings-form-listings-photos'); 61097 61098 if (null === dropTarget) { 61099 return; 61100 } 61101 61102 self.uploader = BaT_Listings_Submission.setupUploader(dropTarget, form); 61103 61104 var anyUploadSuccessful = false, 61105 successfulAttachmentIds = []; 61106 61107 self.uploader.bind('FilesAdded', function(_uploader, files) { 61108 self.isUploadPending(true); 61109 61110 // The shared BaT_Listings_Submission.setupUploader() no longer auto-starts the 61111 // uploader on FilesAdded; the main listing form and the comment gallery start it 61112 // via their own form-submit handlers. The dashboard checklist photo uploader is 61113 // rendered inside a Knockout modal (not a <form>) and has no such trigger, so we 61114 // start the upload here as soon as files are queued. 61115 _uploader.start(); 61116 }); 61117 61118 self.uploader.bind('bat.FileUploadedSuccessfully', function(_uploader, attachmentId) { 61119 anyUploadSuccessful = true; 61120 61121 if(successfulAttachmentIds.indexOf(attachmentId) === -1) { 61122 successfulAttachmentIds.push(attachmentId); 61123 } 61124 }); 61125 61126 self.uploader.bind('UploadComplete', function(_uploader, files) { 61127 self.isUploadPending(false); 61128 61129 if(anyUploadSuccessful) { 61130 self.onUploadsSuccessful(successfulAttachmentIds); 61131 } else { 61132 self.onUploadsFailed(); 61133 } 61134 }); 61135 } 61136
61137 $(document).ready(function() { 61138 if($('#item-photo-uploader-template').length === 0) { 61139 return; 61140 } 61141 61142 ko.components.register('item-photo-uploader', { 61143 template: { element: 'item-photo-uploader-template' }, 61144 viewModel: ItemPhotoUploaderViewModel, 61145 }); 61146 }); 61147})(jQuery); 61148 61149// Dashboard view models 61150(function($) { 61151 var _ = window.lodash; 61152 61153 var ItemBaseViewModel = function(params) { 61154 var self = this; 61155 61156 self.item = params.item; 61157 self.itemId = self.item.id; 61158 61159 // Visibility management 61160 61161 self.visible = ko.observable(false); 61162 61163 self.layoutComplete = function(node) { 61164 node.addEventListener('bat-section-visible', function(event) { 61165 self.visible(true); 61166 }); 61167 61168 node.addEventListener('bat-section-hidden', function(event) { 61169 self.visible(false); 61170 }); 61171 }; 61172 61173 // Mobile tab management 61174 61175 self.activeTab = ko.observable(''); 61176 self.activeTab('messages'); 61177 61178 self.setActiveTab = function(tabName) { 61179 self.activeTab(tabName); 61180 }; 61181 61182 // Message management 61183 61184 self.messages = ko.observableArray(self.item.messages.map(function(message) { 61185 return new MessageViewModel(message); 61186 })); 61187 61188 self.newMessageCount = ko.pureComputed(function() { 61189 return self.messages().filter(function(message) { 61190 return message.direction() === 'sent' && !message.isViewed(); 61191 }).length; 61192 }); 61193 61194 ko.when(function() { 61195 return self.visible() && self.activeTab() === 'messages' && self.newMessageCount() > 0; 61196 }, function() { 61197 var viewedMessageIds = []; 61198
61199 self.messages().forEach(function(message) { 61200 if(!message.isViewed()) { 61201 viewedMessageIds.push(message.id()); 61202 } 61203 61204 message.isViewed(true); 61205 }); 61206 61207 $.post( 61208 BAT_VMS.ajaxUrl, 61209 { 61210 action: BAT_VMS.markMessagesViewed, 61211 itemId: self.itemId, 61212 messageIds: viewedMessageIds, 61213 nonce: BAT_VMS.markMessagesViewedNonce, 61214 }, 61215 'json' 61216 ); 61217 }); 61218 }; 61219 61220 var ItemWithChecklistViewModel = function(params) { 61221 var self = this; 61222 61223 // Checklist management 61224 61225 self.checklistItems = ko.observableArray(self.item.checklist.map(function(checklistItem) { 61226 return new ChecklistItemViewModel(checklistItem); 61227 })); 61228 61229 self.checklistEnabled = ko.pureComputed(function() { 61230 return self.checklistItems().length > 0; 61231 }); 61232 61233 // Checklist modal management 61234 61235 self.selectedChecklistItemRequired = ko.observable(0); 61236 self.selectedChecklistItemOptional = ko.observable(0); 61237 61238 self.openChecklistModal = function(data, event) { 61239 var $checklistItem = $(event.target).closest('li'), 61240 checklistIndex = $checklistItem.data('index'), 61241 isRequired = !!$checklistItem.data('is-required'); 61242 61243 if(isRequired) { 61244 self.selectedChecklistItemRequired(checklistIndex); 61245 var modalId = '#modal-checklist-required-' + self.itemId + ' .checklist-modal'; 61246 } else { 61247 self.selectedChecklistItemOptional(checklistIndex); 61248 var modalId = '#modal-checklist-optional-' + self.itemId + ' .checklist-modal'; 61249 } 61250 61251 BAT.modal.show(modalId); 61252 }; 61253 61254 // Checklist tab management 61255 61256 if (self.checklistEnabled()) { 61257 self.activeTab('checklist'); 61258 } 61259 61260 self.setActiveTab = function(tabName) { 61261 if(tabName === 'checklist' && !self.checklistEnabled()) { 61262 tabName = 'messages'; 61263 } 61264 61265 self.activeTab(tabName); 61266 }; 61267 }; 61268 61269 var ItemActiveViewModel = function(params) { 61270 // Inherit from ItemBaseViewModel and ItemWithChecklistViewModel 61271 ItemBaseViewModel.call(this, params); 61272 ItemWithChecklistViewModel.call(this, params); 61273 61274 var self = this; 61275 61276 var parentLayoutComplete = self.layoutComplete; 61277 self.layoutComplete = function(node) { 61278 parentLayoutComplete(node); 61279 61280 $(node).find('[data-countdown]').each(function(index, element) { 61281 BaT_Theme.startListingCountdowns(element.parentNode); 61282 }); 61283 }; 61284 61285 // Checklist management 61286 61287 self.checklistRequiredTodoCount = ko.pureComputed(function() { 61288 return self.checklistItems().filter(function(checklistItem) { 61289 return checklistItem.isRequired() === true && checklistItem.wasEverComplete() === false; 61290 }).length; 61291 }); 61292 61293 // Notification bubbles 61294 61295 self.notificationCount = ko.pureComputed(function() { 61296 return self.checklistRequiredTodoCount() + self.newMessageCount(); 61297 }); 61298 61299 BAT_VMS.DVM.notificationCounters.push(self.notificationCount); 61300 }; 61301 61302 var ItemActiveOfferViewModel = function(params) { 61303 // Inherit from ItemBaseViewModel 61304 ItemBaseViewModel.call(this, params); 61305 }; 61306 61307 var ItemPendingViewModel = function(params) { 61308 // Inherit from ItemBaseViewModel and ItemWithChecklistViewModel 61309 ItemBaseViewModel.call(this, params); 61310 ItemWithChecklistViewModel.call(this, params); 61311 61312 var self = this; 61313 61314 // Checklist management 61315 61316 self.checklistRequiredTodoCount = ko.pureComputed(function() { 61317 return self.checklistItems().filter(function(checklistItem) { 61318 return checklistItem.isRequired() === true && checklistItem.wasEverComplete() === false; 61319 }).length; 61320 }); 61321 61322 // Status management 61323 61324 var statusData = self.item.status; 61325 61326 self.statusTitle = ko.observable(statusData['title']); 61327 self.statusSubtext = ko.observable(statusData['subtext']); 61328 self.statusActions = ko.observableArray(statusData['actions']); 61329 61330 self.statuses = ko.pureComputed(function() { 61331 var statuses = []; 61332 61333 if (self.newMessageCount() > 0) { 61334 statuses.push(BAT_VMS.dashboardStatusMessaged); 61335 } 61336 61337 if(self.checklistRequiredTodoCount() > 0) { 61338 statuses.push(BAT_VMS.dashboardStatusCompleteChecklist); 61339 } 61340 61341 if(statusData['statuses'].length > 0) { 61342 statuses = statuses.concat(statusData['statuses']); 61343 } 61344 61345 return statuses; 61346 }); 61347 61348 self.statusShort = ko.pureComputed(function() { 61349 var statusShort = statusData['status_short']; 61350 61351 if (self.newMessageCount() > 0) { 61352 statusShort = BAT_VMS.dashboardStatusMessagedShort; 61353 } else if(self.checklistRequiredTodoCount() > 0) { 61354 statusShort = BAT_VMS.dashboardStatusCompleteChecklistShort; 61355 } 61356 61357 return statusShort; 61358 }); 61359 61360 // Notification bubbles 61361 61362 self.notificationCount = ko.pureComputed(function() { 61363 return self.checklistRequiredTodoCount() + self.newMessageCount() + self.statusActions().length; 61364 }); 61365 61366 BAT_VMS.DVM.notificationCounters.push(self.notificationCount); 61367 }; 61368 61369 var ItemCompleteViewModel = function(params) { 61370 // Inherit from ItemBaseViewModel 61371 ItemBaseViewModel.call(this, params); 61372 61373 var self = this; 61374 61375 self.notificationCount = ko.pureComputed(function() { 61376 return self.newMessageCount(); 61377 }); 61378 61379 BAT_VMS.DVM.notificationCounters.push(self.notificationCount); 61380 }; 61381 61382 var ItemIncompleteViewModel = function(params) { 61383 var self = this; 61384 61385 self.item = params.item; 61386 }; 61387 61388 var ChecklistViewModel = function(params) { 61389 var self = this; 61390 61391 self.itemId = params.itemId; 61392 self.checklistItems = params.checklistItems; 61393 self.openChecklistModal = params.openChecklistModal; 61394 self.selectedChecklistItemRequired = params.selectedChecklistItemRequired; 61395 self.selectedChecklistItemOptional = params.selectedChecklistItemOptional; 61396 61397 self.checklistItemsRequired = ko.pureComputed(function() { 61398 return self.checklistItems().filter(function(checklistItem) { 61399 return checklistItem.isRequired() === true; 61400 }); 61401 }); 61402 61403 self.checklistItemsOptional = ko.pureComputed(function() { 61404 return self.checklistItems().filter(function(checklistItem) { 61405 return checklistItem.isRequired() === false; 61406 }); 61407 }); 61408 61409 self.hasChecklistItemsRequired = ko.pureComputed(function() { 61410 return 0 !== self.checklistItemsRequired().length; 61411 }); 61412 61413 self.hasChecklistItemsOptional = ko.pureComputed(function() { 61414 return 0 !== self.checklistItemsOptional().length; 61415 }); 61416 61417 self.isRequiredChecklistItemsComplete = ko.pureComputed(function() { 61418 return self.checklistItemsRequired().filter(function(checklistItem) { 61419 return checklistItem.wasEverComplete(); 61420 }).length === self.checklistItemsRequired().length; 61421 }); 61422 61423 self.editChecklistModal = function(checklistItem, event) { 61424 checklistItem.isComplete(false); 61425 self.openChecklistModal(checklistItem, event); 61426 }; 61427 }; 61428 61429 var ChecklistModalViewModel = function(params) { 61430 var self = this; 61431 61432 self.itemId = params.itemId; 61433 self.checklistItems = params.checklistItems; 61434 self.selectedIndex = params.selectedIndex; 61435 61436 self.selectedChecklistItem = ko.pureComputed(function() { 61437 var selectedIndex = self.selectedIndex(), 61438 checklistItems = self.checklistItems(); 61439 return checklistItems.length > selectedIndex ? checklistItems[selectedIndex] : false;
61440 }); 61441 61442 self.checklistItemCount = ko.pureComputed(function() { 61443 return self.checklistItems().length; 61444 }); 61445 61446 self.isAllItemsComplete = ko.pureComputed(function() { 61447 return self.checklistItems().filter(function(checklistItem) { 61448 return checklistItem.isComplete(); 61449 }).length === self.checklistItemCount(); 61450 }); 61451 61452 self.componentForChecklistItem = function(checklistItem) { 61453 return 'item-checklist-input-' + checklistItem.inputType(); 61454 }; 61455 61456 self.moveToNextItem = function(item, event) { 61457 self.selectedIndex((self.selectedIndex() + 1) % self.checklistItemCount()); 61458 }; 61459 61460 self.moveToPreviousItem = function(item, event) { 61461 self.selectedIndex((self.selectedIndex() - 1 + self.checklistItemCount()) % self.checklistItemCount()); 61462 }; 61463 61464 self.exitModal = function(item, event) { 61465 BAT.modal.hide(); 61466 }; 61467 }; 61468 61469 var ChecklistInputBase = function(params) { 61470 var self = this; 61471 61472 self.itemId = params.itemId; 61473 self.checklistItem = params.checklistItem; 61474 self.index = params.index; 61475 self.checklistItemCount = params.checklistItemCount; 61476 61477 self.titlePrefix = ko.pureComputed(function() { 61478 return (self.index() + 1) + ' / ' + self.checklistItemCount(); 61479 }); 61480 61481 self.sendChecklistResponse = function(checklistItemResponse) { 61482 self.checklistItem.isComplete(true); 61483 61484 $.post({ 61485 url: BAT_VMS.ajaxUrl, 61486 data: { 61487 action: BAT_VMS.checklistItemComplete, 61488 nonce: BAT_VMS.checklistItemCompleteNonce, 61489 itemId: self.itemId, 61490 checklistItemId: self.checklistItem.id(), 61491 checklistItemResponse: checklistItemResponse, 61492 }, 61493 success: function (response, status, xhr, $form) { 61494 if(response.success) { 61495 // Do nothing 61496 } 61497 }, 61498 }); 61499 }; 61500 }; 61501 61502 var ChecklistInputConfirmationButton = function(params) { 61503 ChecklistInputBase.call(this, params); 61504 61505 var self = this; 61506 61507 self.submit = function(data, event) { 61508 self.sendChecklistResponse('checked'); 61509 }; 61510 }; 61511 61512 var ChecklistInputLinks = function(params) { 61513 ChecklistInputBase.call(this, params); 61514 61515 var self = this; 61516 61517 var checklistItemResponse = self.checklistItem.response(); 61518 if(checklistItemResponse) { 61519 self.links = ko.observableArray(checklistItemResponse.map(function(link) { 61520 return ko.observable(link); 61521 })); 61522 } else { 61523 self.links = ko.observableArray([ko.observable('')]); 61524 } 61525 61526 self.addLink = function(data, event) { 61527 self.links.push(ko.observable('')); 61528 }; 61529 61530 self.removeLink = function(data, event) { 61531 var linkIndex = $(event.target).closest('.link').data('link-index'); 61532 self.links.splice(linkIndex, 1); 61533 }; 61534 61535 self.submit = function(form) { 61536 // Remove empty links 61537 self.links.remove(function(link) { 61538 return link().trim().length === 0; 61539 }); 61540 61541 links = ko.mapping.toJS(self.links); 61542 self.sendChecklistResponse(links); 61543 }; 61544 }; 61545 61546 var ChecklistInputPhotoUpload = function(params) { 61547 ChecklistInputBase.call(this, params); 61548 61549 var self = this; 61550 61551 self.uploadedImageIds = self.checklistItem.response() ? self.checklistItem.response() : []; 61552 self.isUploadPending = ko.observable(false); 61553 self.isSuccessfulUpload = ko.observable(false); 61554 self.isWaitingToSubmit = ko.observable(false); 61555 61556 self.onUploadsSuccessful = function(attachmentIds) { 61557 self.uploadedImageIds = _.union(self.uploadedImageIds, attachmentIds); 61558 61559 self.isSuccessfulUpload(true); 61560 61561 if(self.isWaitingToSubmit()) { 61562 self.submit(); 61563 } 61564 }; 61565 61566 self.onUploadsFailed = function() { 61567 self.isSuccessfulUpload(false); 61568 self.isWaitingToSubmit(false); 61569 }; 61570 61571 self.submit = function() { 61572 if(!self.isUploadPending() && self.isSuccessfulUpload()) { 61573 // Successfully finished upload, submit images 61574 self.isWaitingToSubmit(false); 61575 self.sendChecklistResponse(self.uploadedImageIds); 61576 } else if(!self.isUploadPending() && !self.isSuccessfulUpload()) { 61577 // No images to send 61578 self.isWaitingToSubmit(false); 61579 } else if(self.isUploadPending()) { 61580 // Wait for images to finish uploading 61581 self.isWaitingToSubmit(true); 61582 } 61583 } 61584 }; 61585 61586 var ChecklistInputTextbox = function(params) { 61587 ChecklistInputBase.call(this, params); 61588 61589 var self = this; 61590 61591 self.submit = function(form) { 61592 self.sendChecklistResponse(self.checklistItem.response()); 61593 }; 61594 }; 61595 61596 var ExamplePhotosViewModel = function(params) { 61597 var self = this; 61598 61599 self.itemId = params.itemId; 61600 self.examplePhotoUrls = params.examplePhotoUrls; 61601 }; 61602 61603 ExamplePhotosViewModel.prototype.koDescendantsComplete = function(node) { 61604 var self = this, 61605 swiperElement = node.querySelector('.swiper-container'), 61606 paginationElement = node.querySelector('.swiper-pagination'); 61607 61608 self.swiper = new Swiper(swiperElement, { 61609 centeredSlides: true, 61610 slideToClickedSlide: true, 61611 threshold: 10, 61612 watchOverflow: true, 61613 observer: true, 61614 observeParents: true, 61615 preloadImages: true, 61616 slidesPerView: 1.4, 61617 spaceBetween: 20, 61618 pagination: { 61619 el: paginationElement, 61620 clickable: true, 61621 }, 61622 breakpoints: {
61623 480: { // Width <= 480px 61624 slidesPerView: 1.4, 61625 spaceBetween: 10, 61626 }, 61627 }, 61628 }); 61629 }; 61630 61631 var ChecklistItemViewModel = function(checklistItem) { 61632 // Map all data in message from checklist item into observables on this object 61633 ko.mapping.fromJS(checklistItem, {}, this); 61634 61635 var self = this; 61636 61637 self.isEditableType = ko.pureComputed(function() { 61638 return 'confirmation-button' !== self.inputType(); 61639 }); 61640 61641 self.edit = function() { 61642 self.isComplete(false); 61643 }; 61644 61645 self.wasEverComplete = ko.observable(self.isComplete()); 61646 self.isComplete.subscribe(function(isComplete) { 61647 if(isComplete) { 61648 self.wasEverComplete(true); 61649 } 61650 }); 61651 61652 self.examplePhotoUrls = ko.pureComputed(function() { 61653 if (self.additional && typeof self.additional === 'object' && self.additional['example-photo-urls']) { 61654 return self.additional['example-photo-urls'](); 61655 } else { 61656 return []; 61657 } 61658 }); 61659 61660 self.previousPhotoUrls = ko.pureComputed(function() { 61661 if (self.additional && typeof self.additional === 'object' && self.additional['previous-photo-urls']) { 61662 return self.additional['previous-photo-urls'](); 61663 } else { 61664 return []; 61665 } 61666 }); 61667 61668 self.confirmationButtonText = ko.pureComputed(function() { 61669 var currentLocale = BaT_Theme.locale.substr(0, 2), 61670 keyLocalized = 'en' === currentLocale ? 'confirmation-text' : 'confirmation-text-' + currentLocale; 61671 61672 if (self.additional && typeof self.additional === 'object' && self.additional[keyLocalized]) { 61673 return self.additional[keyLocalized](); 61674 } else { 61675 return ''; 61676 } 61677 }); 61678 }; 61679 61680 var MessagesViewModel = function(params) { 61681 var self = this; 61682 61683 self.itemId = params.itemId; 61684 self.messages = params.messages; 61685 61686 /// Message sending 61687 61688 self.sendMessageContent = ko.observable(''); 61689 self.isSendingMessage = ko.observable(false); 61690 self.sendMessageError = ko.observable(''); 61691 61692 self.sendMessage = function(data, event) { 61693 if(self.isSendingMessage()) { 61694 return; 61695 } 61696 61697 var $form = $(event.target).closest('form'), 61698 formData = $form.serializeArray(); 61699 61700 self.isSendingMessage(true); 61701 self.sendMessageError(''); 61702 61703 $.post({ 61704 url: $form.attr('action'), 61705 data: formData, 61706 success: function (response, status, xhr, $form) { 61707 self.isSendingMessage(false); 61708 61709 if(response.success) { 61710 var messageViewModel = new MessageViewModel(response.data.message) 61711 self.messages.unshift(messageViewModel); 61712 self.sendMessageContent(''); 61713 } else { 61714 self.sendMessageError(response.data.error); 61715 } 61716 }, 61717 }); 61718 }; 61719 61720 self.showSentMessageElement = function(element) { 61721 $(element).hide().slideDown(); 61722 }; 61723 61724 /// Message viewing 61725 61726 var lastHighlightedMessageIndex = _.findLastIndex(self.messages(), function(message) { 61727 return message.isHighlighted(); 61728 }); 61729 self.visibleMessages = ko.observable(Math.max(2, lastHighlightedMessageIndex + 1)); 61730 61731 self.showMoreMessages = function() { 61732 self.visibleMessages(Math.min(self.visibleMessages() + 3, self.messages().length)); 61733 }; 61734 }; 61735 61736 var MessageViewModel = function(message) { 61737 // Map all data in message into observables on this object 61738 ko.mapping.fromJS(message, {}, this); 61739 61740 var self = this; 61741 61742 // Unwrap initial 'isViewed' value into visual property 'isHighlighted' so that the highlight can be removed 61743 // with a delay after viewing 61744 self.isHighlighted = ko.observable(!self.isViewed()); 61745 61746 self.contentWithHtmlEntitiesDecoded = ko.pureComputed(function() { 61747 var domContent = new DOMParser().parseFromString(self.content(), 'text/html'); 61748 return domContent.documentElement.textContent; 61749 }); 61750 61751 self.isViewed.subscribe(function(isViewed) { 61752 setTimeout(function() { 61753 self.isHighlighted(!isViewed); 61754 }, 2000); 61755 }); 61756 }; 61757 61758 var DashboardViewModel = function(dashboardData) { 61759 var self = this; 61760 61761 self.itemsActive = ko.observableArray(dashboardData.itemsActive); 61762 self.itemsPending = ko.observableArray(dashboardData.itemsPending); 61763 self.itemsComplete = ko.observableArray(dashboardData.itemsComplete); 61764 self.itemsIncomplete = ko.observableArray(dashboardData.itemsIncomplete); 61765 self.itemsActiveOffer = ko.observableArray(dashboardData.itemsActiveOffer); 61766 61767 self.notificationCounters = ko.observableArray([]); 61768 self.notificationCount = ko.pureComputed(function() { 61769 var count = 0; 61770
61771 self.notificationCounters().forEach(function(notificationCounter) { 61772 count += notificationCounter(); 61773 }); 61774 61775 return count; 61776 }); 61777 61778 self.notificationCount.subscribe(function(notificationCount) { 61779 // Update menubar notification counts to match live updates on page 61780 61781 if(notificationCount === 0) { 61782 $('.site-header-notification-indicator').hide().text(0); 61783 } else { 61784 $('.site-header-notification-indicator').show().text(notificationCount); 61785 } 61786 }, this, 'spectate'); 61787 61788 self.isAnyContent = ko.pureComputed(function() { 61789 return self.itemsActive().length 61790 + self.itemsPending().length 61791 + self.itemsComplete().length 61792 + self.itemsIncomplete().length 61793 + self.itemsActiveOffer().length 61794 > 0; 61795 }); 61796 61797 self.isLoaded = ko.observable(false); 61798 61799 self.layoutComplete = function() { 61800 self.isLoaded(true); 61801 61802 // Handle deeplinks to specific listing modules on page 61803 var anchor = document.location.hash.substring(1), 61804 $deeplinkedElement = $('[data-deeplink="' + anchor + '"]'); 61805 61806 if($deeplinkedElement.length > 0) { 61807 var $deeplinkPath = $deeplinkedElement.add($deeplinkedElement.parents('[data-deeplink]')), 61808 $deeplinkPathTopDown = $($deeplinkPath.get().reverse()); 61809 61810 $deeplinkPathTopDown.click(); 61811 61812 setTimeout(function() { 61813 // Wait for Knockout layout to finish, then scroll to first visible anchor in the deeplink path 61814 var $visibleAnchor = $deeplinkPath.filter(':visible').first(); 61815 61816 if($visibleAnchor.length > 0) { 61817 $([document.documentElement, document.body]).animate({ 61818 scrollTop: $visibleAnchor.offset().top 61819 }, 1000); 61820 } 61821 }, 1000); 61822 } 61823 }; 61824 } 61825 61826 $(document).ready(function() { 61827 if($('.dashboard').length === 0) { 61828 return; 61829 } 61830 61831 // Register components 61832 61833 ko.components.register('item-active', { 61834 template: { element: 'item-active-template' }, 61835 viewModel: ItemActiveViewModel, 61836 }); 61837 61838 ko.components.register('item-active-offers', { 61839 template: { element: 'item-active-offer-template' }, 61840 viewModel: ItemActiveOfferViewModel, 61841 }); 61842 61843 ko.components.register('item-pending', { 61844 template: { element: 'item-pending-template' }, 61845 viewModel: ItemPendingViewModel, 61846 }); 61847 61848 ko.components.register('item-complete', { 61849 template: { element: 'item-complete-template' }, 61850 viewModel: ItemCompleteViewModel, 61851 }); 61852 61853 ko.components.register('item-incomplete', { 61854 template: { element: 'item-incomplete-template' }, 61855 viewModel: ItemIncompleteViewModel, 61856 }); 61857 61858 ko.components.register('item-checklist', { 61859 template: { element: 'item-checklist-template' }, 61860 viewModel: ChecklistViewModel, 61861 }); 61862 61863 ko.components.register('item-checklist-modal', { 61864 template: { element: 'item-checklist-modal-template' }, 61865 viewModel: ChecklistModalViewModel, 61866 }); 61867 61868 ko.components.register('item-checklist-input-confirmation-button', { 61869 template: { element: 'item-checklist-input-confirmation-button-template' }, 61870 viewModel: ChecklistInputConfirmationButton, 61871 }); 61872 61873 ko.components.register('item-checklist-input-links', { 61874 template: { element: 'item-checklist-input-links-template' }, 61875 viewModel: ChecklistInputLinks, 61876 }); 61877 61878 ko.components.register('item-checklist-input-photo-upload', { 61879 template: { element: 'item-checklist-input-photo-upload-template' }, 61880 viewModel: ChecklistInputPhotoUpload, 61881 }); 61882 61883 ko.components.register('item-checklist-input-textbox', { 61884 template: { element: 'item-checklist-input-textbox-template' }, 61885 viewModel: ChecklistInputTextbox, 61886 }); 61887 61888 ko.components.register('item-example-photos', { 61889 template: { element: 'item-example-photos-template' }, 61890 viewModel: ExamplePhotosViewModel, 61891 }); 61892 61893 ko.components.register('item-messages', { 61894 template: { element: 'item-messages-template' }, 61895 viewModel: MessagesViewModel, 61896 }); 61897 61898 // Initialize Knockout 61899 61900 var dashboardViewModel = new DashboardViewModel(BAT_DASHBOARD_DATA); 61901 BAT_VMS.DVM = dashboardViewModel; 61902 61903 ko.applyBindings(BAT_VMS.DVM, document.querySelector('.dashboard')); 61904 }); 61905})(jQuery); 61906 61907// Utility view models 61908(function($) { 61909 // SortMobileViewModel - Mobile dropdown <select> replacement 61910 61911 var SortMobileViewModel = function(params) { 61912 var self = this; 61913 61914 self.value = params.value; 61915 self.options = ko.observableArray(params.options); 61916 61917 self.text = ko.pureComputed(function() { 61918 var value = self.value(), 61919 selectedSort = self.options().find(function(_) { return _.value === value; }); 61920 61921 return selectedSort ? selectedSort.text : ''; 61922 }); 61923 }; 61924 61925 ko.components.register('sort-mobile', { 61926 template: { element: 'tmpl-sort-mobile' }, 61927 viewModel: SortMobileViewModel, 61928 }); 61929})(jQuery); 61930; 61931(function() { 61932 window.galleries = window.galleries || {}; 61933 61934 var galleryElements = document.querySelectorAll('[data-gallery-items]'); 61935 61936 var processingEl = document.getElementById('bat-gallery-processing'); 61937 var placeholderCount = processingEl ? parseInt(processingEl.getAttribute('data-gallery-placeholders') || '0', 10) : 0; 61938 var placeholderUrl = processingEl ? (processingEl.getAttribute('data-placeholder-url') || '') : ''; 61939 61940 for(var i = 0; i < galleryElements.length; i++) { 61941 var galleryElement = galleryElements[i], 61942 galleryItems = JSON.parse(galleryElement.getAttribute('data-gallery-items')), 61943 galleryNamed = galleryElement.hasAttribute('data-gallery-named') ? galleryElement.getAttribute('data-gallery-named') : false, 61944 galleryLimit = galleryElement.hasAttribute('data-gallery-limit') ? JSON.parse(galleryElement.getAttribute('data-gallery-limit')) : 0, 61945 galleryLimitMobile = galleryElement.hasAttribute('data-gallery-limit-mobile') ? JSON.parse(galleryElement.getAttribute('data-gallery-limit-mobile')) : 0, 61946 galleryShown = galleryElement.hasAttribute('data-gallery-shown') ? JSON.parse(galleryElement.getAttribute('data-gallery-shown')) : true; 61947 61948 if (placeholderUrl && placeholderCount > 0) { 61949 for (var p = 0; p < placeholderCount; p++) { 61950 galleryItems.push({ 61951 id: -1 - p, 61952 title: 'Processing\u2026', 61953 small: { url: placeholderUrl, height: 300, width: 400 }, 61954 large: { url: placeholderUrl, height: 300, width: 400 }, 61955 }); 61956 } 61957 } 61958 61959 var galleryViewModel = new GalleryViewModel(galleryItems, galleryLimit, galleryLimitMobile, galleryShown); 61960 61961 if(galleryNamed) { 61962 window.galleries[galleryNamed] = galleryViewModel; 61963 } 61964 61965 ko.applyBindings(galleryViewModel, galleryElement); 61966 } 61967}()); 61968 61969BAT_WEBSERVICES_PUSHER.bind(true, 'gallery-new-images', function(data) { 61970 var galleryKey = 'item_' + data.post_id.toString(); 61971 61972 if(window.galleries && window.galleries.hasOwnProperty(galleryKey)) { 61973 var gallery = window.galleries[galleryKey]; 61974 61975 for(var i = 0; i < data.images.length; i++) { 61976 gallery.add(data.images[i]); 61977 } 61978 } 61979}); 61980 61981BAT_WEBSERVICES_PUSHER.bind(true, 'gallery-remove-images', function(data) { 61982 var galleryKey = 'item_' + data.post_id.toString(); 61983 61984 if(window.galleries && window.galleries.hasOwnProperty(galleryKey)) { 61985 var gallery = window.galleries[galleryKey]; 61986 61987 gallery.removeIds(data.images); 61988 } 61989}); 61990 61991// Play and focus video from email 61992const getIdentifier = (url) => { 61993 const parts = url.split('#identifier='); 61994 return parts.at(-1); 61995}; 61996 61997document.addEventListener("DOMContentLoaded", () => { 61998 //phpcs:ignore WordPressVIPMinimum.JS.Window.location 61999 let identifier = getIdentifier(window.location.href), 62000 videoThumbnail = document.querySelector('img[thumbnail_anch
62000or_id="'+ identifier +'"]'); 62001 62002 if(!isNaN(identifier)) { 62003 setTimeout( () => { 62004 videoThumbnail.scrollIntoView({ 62005 block: 'center' 62006 }); 62007 videoThumbnail.click(); 62008 },1000); 62009 } 62010}); 62011; 62012jQuery(document).ready(function ($) { 62013 // Login with 2FA 62014 (function () { 62015 // General section 62016 var $authUserLogin = $('#auth-user-login, #auth-user-password-reset'); 62017 62018 if (0 === $authUserLogin.length) { 62019 return; 62020 } 62021 62022 var loginAction = 'authenticate'; 62023 var mfaType = ''; 62024 var mfaPhone = ''; 62025 var mfaEmail = ''; 62026 var userLoggedIn = false; 62027 62028 var $inputUsername = $authUserLogin.find('#bat_login_username'); 62029 var $inputPassword = $authUserLogin.find('#bat_login_password'); 62030 var $btnLoginFormSubmit = $authUserLogin.find('#bat_login_submit'); 62031 var $loginAlerts = $authUserLogin.find('#login-alerts'); 62032 var $loginErrors = $authUserLogin.find('#login-errors'); 62033 62034 var $verificationCodeInput = $authUserLogin.find('.input-verification-code input'); 62035 var $btnMFACancel = $authUserLogin.find('#bat-mfa-cancel'); 62036 var $mfaErrors = $authUserLogin.find('#mfa-errors'); 62037 62038 var $currentLoginView = $authUserLogin.find('#login-' + loginAction); 62039 62040 var $errorTemplate = $('<label class="label-auth-error"></label>'); 62041 var $alertTemplate = $('<label class="label-auth-alert"></label>'); 62042 62043 var isSubmissionAuthIframe = function () { 62044 const urlParams = new URLSearchParams(window.location.search); // phpcs:ignore WordPressVIPMinimum.JS.Window.location 62045 62046 return '1' === urlParams.get('submission_auth'); 62047 }; 62048 62049 var notifyParentSubmissionAuthAction = function (authAction) { 62050 if (!isSubmissionAuthIframe() || !window.parent || window.parent === window || !window.parent.postMessage) { 62051 return; 62052 } 62053 62054 window.parent.postMessage({ submissionAuthAction: authAction }, '*'); 62055 }; 62056 62057 var notifyParentSubmissionAuthCompleted = function () { 62058 if (!isSubmissionAuthIframe() || !window.parent || window.parent === window) { 62059 return; 62060 } 62061 62062 if (window.parent.postMessage) { 62063 window.parent.postMessage({ submissionAuthCompleted: true }, '*'); 62064 } 62065 62066 if (window.parent.BaT_Theme && 'function' === typeof window.parent.BaT_Theme.trackSubmissionAuthCompleted) { 62067 window.parent.BaT_Theme.trackSubmissionAuthCompleted(); 62068 } 62069 }; 62070 62071 var notifyParentLoggedIn = function (data) { 62072 if (!$authUserLogin.find('#bat_login_modal').length || !window.parent || window.parent === window || !window.parent.postMessage) { 62073 return false; 62074 } 62075 62076 window.parent.postMessage({ 62077 loggedIn: true, 62078 redirect: data.redirect || '' 62079 }, '*'); 62080 62081 return true; 62082 }; 62083 62084 var redirectParentAfterSubmissionAuth = function (redirectUrl) { 62085 if (!redirectUrl) { 62086 return; 62087 } 62088 62089 window.top.shouldWarnAboutLosingUnsavedChanges = false; 62090 62091 // Brief delay so GTM can record submission_auth_completed before navigation. 62092 window.setTimeout(function () { 62093 window.top.location.href = redirectUrl; 62094 }, isSubmissionAuthIframe() ? 300 : 0); 62095 }; 62096 62097 var updateViews = function () { 62098 $currentLoginView = $authUserLogin.find('#login-' + loginAction); 62099 62100 $('.login-ui-element-app, .login-ui-element-sms, .login-ui-element-email').hide(); 62101 $('.login-ui-element-' + mfaType).show(); 62102 $('.login-ui-element-sms span').text(`(â¢â¢â¢â¢ ${mfaPhone.slice(-4)})`); 62103 $('.login-ui-element-email span').text(mfaEmail); 62104 62105 $authUserLogin 62106 .find( 62107 '#login-authenticate, #login-mfa-verify', 62108 '#login-success' 62109 ) 62110 .hide(); 62111 $currentLoginView.show(); 62112 $currentLoginView.find('input').first().focus(); 62113 }; 62114 62115 var getGeneralPostPayload = function () { 62116 var payload = { 62117 captcha: $authUserLogin 62118 .find('#auth-user-login-recaptcha') 62119 .val(), 62120 nonce: $authUserLogin.find('#bat_login_nonce').val(), 62121 }; 62122 62123 if ($authUserLogin.find('#bat_login_modal').length) { 62124 payload.bat_login_modal = $authUserLogin 62125 .find('#bat_login_modal') 62126 .val(); 62127 } 62128 62129 if ($authUserLogin.find('#bat_login_interim_login').length) { 62130 payload.bat_login_interim_login = $authUserLogin 62131 .find('#bat_login_interim_login') 62132 .val(); 62133 } 62134 62135 if ($authUserLogin.find('#bat_login_redirect').length) { 62136 payload.bat_login_redirect = $authUserLogin 62137 .find('#bat_login_redirect') 62138 .val(); 62139 } 62140 62141 if ($authUserLogin.find('#bat_login_comment_content').length) { 62142 payload.bat_login_comment_content = $authUserLogin 62143 .find('#bat_login_comment_content') 62144 .val(); 62145 } 62146 62147 if ($authUserLogin.find('#bat_login_comment_post').length) { 62148 payload.bat_login_comment_post = $authUserLogin 62149 .find('#bat_login_comment_post') 62150 .val(); 62151 } 62152 62153 if ($authUserLogin.find('#bat_login_user_migrated').length) { 62154 payload.bat_login_user_migrated = $authUserLogin 62155 .find('#bat_login_user_migrated') 62156 .val(); 62157 } 62158 62159 return payload; 62160 }; 62161 62162 var onLogIn = function (data) { 62163 userLoggedIn = true; 62164 $btnLoginFormSubmit.prop('disabled', true); 62165 62166 notifyParentSubmissionAuthCompleted(); 62167 62168 if (undefined !== data.interim_login_success_url) { 62169 broadcastAuthRestored(); 62170 document.location.href = data.interim_login_success_url; 62171 return; 62172 } 62173 62174 if (undefined !== data.redirect) { 62175 if (data.redirect_modal) { 62176 document.location.href = data.redirect; 62177 } else if (notifyParentLoggedIn(data)) { 62178 return; 62179 } else { 62180 redirectParentAfterSubmissionAuth(data.redirect); 62181 } 62182 } else if (notifyParentLoggedIn(data)) { 62183 return; 62184 } else { 62185 jQuery.magnificPopup.close(); 62186 } 62187 }; 62188 62189 // Authentication section 62190 var setLoginCtrlsDisabledState = function (state) { 62191 $inputPassword.prop('disabled', state); 62192 $btnLoginFormSubmit.prop('disabled', state); 62193 }; 62194 62195 var showLoginErrors = function (data) { 62196 data = data || {}; 62197 data.alerts = data.alerts || []; 62198 data.errors = data.errors || []; 62199 62200 removeLoginErrors(); 62201 62202 $.each(data.alerts, function (inputKey, alert) { 62203 var $labelAlert = $alertTemplate.clone().html(alert); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 62204 $loginAlerts.append($labelAlert); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62205 }); 62206 62207 if (data.errors.length) { 62208 $.each(data.errors, function (inputKey, inputError) { 62209 var $labelError = $errorTemplate.clone().html(inputError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 62210 $loginErrors.append($labelError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62211 }); 62212 62213 setLoginCtrlsDisabledState(false); 62214 62215 if (data.username_error) { 62216 $inputUsername.addClass('bat-input-error').focus(); 62217 } 62218 62219 if (data.password_error) { 62220 $inputPassword.addClass('bat-input-error').focus(); 62221 } 62222 } 62223 }; 62224 62225 var showGenericLoginError = function () { 62226 showLoginErrors({ 62227 alerts: [], 62228 errors: [BaT_Theme.textError || 'Something went wrong. Please try again.'] 62229 }); 62230 }; 62231 62232 var broadcastAuthRestored = function () { 62233 var authRestoredChannel = null; 62234 62235 if ('function' !== typeof window.BroadcastChannel) { 62236 return; 62237 } 62238 62239 authRestoredChannel = new window.BroadcastChannel('bat-auth-restored'); 62240 authRestoredChannel.postMessage({ type: 'auth-restored' }); 62241 authRestoredChannel.close(); 62242 }; 62243 62244 var removeLoginErrors = function (data) { 62245 $loginAlerts.html(''); 62246 $loginErrors.html(''); 62247 $inputUsername.removeClass('bat-input-error'); 62248 $inputPassword.removeClass('bat-input-error'); 62249 }; 62250 62251 var submitLoginForm = function () { 62252 if (true === $btnLoginFormSubmit.prop('disabled')) { 62253 return; 62254 } 62255 62256 notifyParentSubmissionAuthAction('login_selected'); 62257 62258 setLoginCtrlsDisabledState(true); 62259 removeLoginErrors(); 62260 62261 BaT_Theme.getRecaptchaToken(function (token) { 62262 $authUserLogin.find('#auth-user-login-recaptcha').val(token); 62263 postLoginForm(); 62264 }); 62265 }; 62266 62267 var postLoginForm = function () {
62268 const urlParams = new URLSearchParams(window.location.search); // phpcs:ignore WordPressVIPMinimum.JS.Window.location 62269 const inAppBrowserSetup = urlParams.has('username') && urlParams.has('setup') && urlParams.get('setup') === 'mobile'; 62270 const username = inAppBrowserSetup ? urlParams.get('username') : $inputUsername.val(); 62271 var formData = { 62272 login_action: 'authenticate', 62273 login_username: username, 62274 login_password: $inputPassword.val(), 62275 }; 62276 62277 var generalData = getGeneralPostPayload(); 62278 jQuery.post({ 62279 url: BaT_Theme.ajaxUrlUserLogin, 62280 data: Object.assign(formData, generalData), 62281 dataType: 'json' 62282 }).done(function(data) { 62283 if (!data || 'object' !== typeof data) { 62284 showGenericLoginError(); 62285 62286 return; 62287 } 62288 62289 if (data.success) { 62290 if (undefined !== data.mfa_type) { 62291 loginAction = 'mfa-verify'; 62292 mfaType = data.mfa_type; 62293 mfaPhone = data.mfa_phone ? data.mfa_phone : ''; 62294 mfaEmail = data.mfa_email ? data.mfa_email : ''; 62295 $authUserLogin.find('#bat_login_user_migrated').val(data.user_migrated); 62296 startMFAResendCountdown(); 62297 updateViews(); 62298 } else { 62299 onLogIn(data); 62300 } 62301 } else if (data.data && (data.data.errors || data.data.alerts)) { 62302 if ('mfa-verify' === loginAction) { // Resend MFA SMS Code Error 62303 showMFAErrors(data.data); 62304 startMFAResendCountdown(); 62305 } else { 62306 showLoginErrors(data.data); 62307 } 62308 } else if (data.data && undefined !== data.data.weak_password) { 62309 window.top.location.href = data.data.reset_password_url; 62310 } else { 62311 showGenericLoginError(); 62312 } 62313 }) 62314 .fail(function (jqXHR, textStatus, errorThrown) { 62315 showGenericLoginError(); 62316 }) 62317 .always(function () { 62318 setLoginCtrlsDisabledState(userLoggedIn); 62319 }); 62320 }; 62321 62322 $inputUsername.focus(); 62323 62324 $authUserLogin 62325 .find('#bat_login_username, #bat_login_password') 62326 .on('input', function () { 62327 removeLoginErrors(); 62328 let inactive = 62329 '' === $authUserLogin.find('#bat_login_username').val() || 62330 '' === $authUserLogin.find('#bat_login_password').val(); 62331 $btnLoginFormSubmit.prop('disabled', inactive); 62332 }); 62333 62334 $authUserLogin 62335 .find('#bat_login_username, #bat_login_password') 62336 .on('keydown', function (event) { 62337 if (13 === (event.which ? event.which : event.keyCode)) { 62338 event.preventDefault(); 62339 submitLoginForm(); 62340 } 62341 }); 62342 62343 $btnLoginFormSubmit.on('click', function (event) { 62344 event.preventDefault(); 62345 submitLoginForm(); 62346 }); 62347 62348 $btnMFACancel.on('click', function (e) { 62349 e.preventDefault(); 62350 $verificationCodeInput.each(function () { 62351 $(this).val(''); 62352 }); 62353 removeMFAErrors(); 62354 }); 62355 62356 // MFA Section 62357 var setMFACtrlsDisabledState = function (state) { 62358 $verificationCodeInput.prop('disabled', state); 62359 }; 62360 62361 var inputGetVerificationCode = function () { 62362 var verificationCode = ''; 62363 62364 $verificationCodeInput.each(function (index, element) { 62365 verificationCode += $(element).val(); 62366 }); 62367 62368 return verificationCode; 62369 }; 62370 62371 $verificationCodeInput.on({ 62372 input: function (event) { 62373 if (this.value) { 62374 $verificationCodeInput 62375 .eq($verificationCodeInput.index(this) + 1) 62376 .focus(); 62377 } 62378 62379 removeMFAErrors(); 62380 62381 if (6 === inputGetVerificationCode().length) { 62382 submitMFAForm(); 62383 } 62384 }, 62385 62386 keydown: function (event) { 62387 var i = $verificationCodeInput.index(this); 62388 62389 if (8 === event.which && !this.value && i) { 62390 $verificationCodeInput.eq(i - 1).focus(); 62391 } 62392 }, 62393 62394 paste: function (e) { 62395 var pastedData = e.originalEvent.clipboardData.getData('text'); 62396 var pastedChars = pastedData.split(''); 62397 var curIndex = $verificationCodeInput.index(this); 62398 62399 for (var i = 0; i < pastedChars.length; i++) { 62400 var char = pastedChars[i]; 62401 $verificationCodeInput
62402 .eq(curIndex + i) 62403 .val(char) 62404 .focus(); 62405 } 62406 setTimeout(inputGetVerificationCode, 0); 62407 62408 if (6 === inputGetVerificationCode().length) { 62409 submitMFAForm(); 62410 } 62411 }, 62412 }); 62413 62414 var showMFAErrors = function (data) { 62415 data = data || {}; 62416 data.errors = data.errors || []; 62417 62418 removeMFAErrors(); 62419 62420 $.each(data.errors, function (inputKey, inputError) { 62421 var $labelError = $errorTemplate.clone().html(inputError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 62422 $mfaErrors.append($labelError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62423 }); 62424 62425 setMFACtrlsDisabledState(false); 62426 62427 if (data.errors) { 62428 $verificationCodeInput.addClass('bat-input-error').focus(); 62429 } 62430 }; 62431 62432 var removeMFAErrors = function (data) { 62433 $mfaErrors.html(''); 62434 $verificationCodeInput.removeClass('bat-input-error'); 62435 }; 62436 62437 var submitMFAForm = function () { 62438 setMFACtrlsDisabledState(true); 62439 removeMFAErrors(); 62440 62441 BaT_Theme.getRecaptchaToken(function (token) { 62442 $authUserLogin.find('#auth-user-login-recaptcha').val(token); 62443 postMFAForm(); 62444 }); 62445 }; 62446 62447 var postMFAForm = function () { 62448 var formData = { 62449 login_action: 'mfa_verify_code', 62450 mfa_verification_code: inputGetVerificationCode(), 62451 }; 62452 62453 var generalData = getGeneralPostPayload(); 62454 62455 jQuery.post({ 62456 url: BaT_Theme.ajaxUrlUserLogin, 62457 data: Object.assign(formData, generalData), 62458 dataType: 'json', 62459 }) 62460 .done(function (data) { 62461 if (!data || 'object' !== typeof data) { 62462 showMFAErrors({ 62463 errors: [BaT_Theme.textError || 'Something went wrong. Please try again.'] 62464 }); 62465 62466 return; 62467 } 62468 62469 if (data.success) { 62470 onLogIn(data); 62471 } else if (data.data && data.data.errors) { 62472 showMFAErrors(data.data); 62473 } else { 62474 showMFAErrors({ 62475 errors: [BaT_Theme.textError || 'Something went wrong. Please try again.'] 62476 }); 62477 } 62478 }) 62479 .fail(function () { 62480 showMFAErrors({ 62481 errors: [BaT_Theme.textError || 'Something went wrong. Please try again.'] 62482 }); 62483 }) 62484 .always(function () { 62485 setMFACtrlsDisabledState(userLoggedIn); 62486 }); 62487 }; 62488 62489 // Resend Code Countdown 62490 var countdownStartTime = 0; 62491 var countdownInterval = 0; 62492 var countdownMaxTime = parseInt(BaT_Theme.mfaResendCodeAllowedInterval); 62493 var $labelCountdown = $authUserLogin.find('#login-mfa-resend-countdown'); 62494 var $btnResendCode = $authUserLogin.find('#btn-login-resend-mfa-code'); 62495 62496 $labelCountdown.append($(`<svg id="resend-countdown-spinner" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg" aria-label="Loading"><circle cx="7" cy="7" r="5.775" stroke="#E7E7E7" stroke-width="2.45" fill="none"/><circle cx="7" cy="7" r="5.775" stroke="#555555" stroke-width="2.45" fill="none" stroke-linecap="round" stroke-dasharray="36.285395" stroke-dashoffset="36.285395"><animate id="fillAnim" attributeName="stroke-dashoffset" values="36.285395;0;36.285395" keyTimes="0;0.9;1" dur="${1.2 * countdownMaxTime}s" repeatCount="indefinite" /></circle></svg>`)); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62497 var $resendCountdownSpinner = $authUserLogin.find('#resend-countdown-spinner'); 62498 62499 var startMFAResendCountdown = function () { 62500 if ('sms' !== mfaType && 'email' !== mfaType) { 62501 return; 62502 } 62503 62504 $btnResendCode.hide(); 62505 $labelCountdown.show(); 62506 countdownStartTime = Date.now(); 62507 $resendCountdownSpinner.get(0).setCurrentTime(0); 62508 62509 clearInterval(countdownInterval); 62510 countdownInterval = setInterval(function () { 62511 var timeLeft = countdownMaxTime - Math.floor((Date.now() - countdownStartTime) / 1000); 62512 62513 if (0 >= timeLeft) { 62514 clearInterval(countdownInterval); 62515 62516 $labelCountdown.hide(); 62517 $btnResendCode.show(); 62518 } 62519 62520 }, 1000); 62521 }; 62522 62523 var stopMFAResendCountdown = function () { 62524 clearInterval(countdownInterval); 62525 $labelCountdown.hide(); 62526 $btnResendCode.hide(); 62527 }; 62528 62529 $btnResendCode.on('click', function () { 62530 removeMFAErrors(); 62531 stopMFAResendCountdown(); 62532 submitLoginForm(); 62533 }); 62534 62535 $btnLoginFormSubmit.prop('disabled', '' === $authUserLogin.find('#bat_login_username').val() || '' === $authUserLogin.find('#bat_login_password').val()); 62536 })(); 62537 62538 // Reset password and login after reset. 62539 (function () { 62540 var $authUserPasswordReset = $('#auth-user-password-reset'); 62541 62542 if (0 === $authUserPasswordReset.length) { 62543 return; 62544 } 62545 62546 var $inputUsername = $authUserPasswordReset.find('#bat-listings-users-login'); 62547 var $inputPassword = $authUserPasswordReset.find('#bat-listings-users-password'); 62548 var $inputPasswordConfirm = $authUserPasswordReset.find('#bat-listings-users-confirm-password'); 62549 var $inputPasswordToken = $authUserPasswordReset.find('#bat-listings-users-token'); 62550 var $inputRedirect = $authUserPasswordReset.find('#bat-listings-users-redirect'); 62551 var $btnPasswordResetFormSubmit = $authUserPasswordReset.find('#bat_password_reset_submit'); 62552 var $passwordResetErrors = $authUserPasswordReset.find('#password-reset-errors'); 62553 62554 var $errorTemplate = $('<label class="label-auth-error"></label>'); 62555 62556 var redirectToLoginPage = function () { 62557 let loginURL = new URL(BaT_Theme.loginUrl); 62558 let redirect = $authUserPasswordReset.find('#bat_login_redirect').val(); 62559 62560 if (redirect) { 62561 loginURL.searchParams.set('redirect', redirect); 62562 loginURL.searchParams.set('passwordreset', $inputUsername.val()); 62563 } 62564 62565 window.top.location.href = loginURL.href; 62566 }; 62567 62568 var setResetPasswordCtrlsDisabledState = function (state) { 62569 $inputPassword.prop('disabled', state); 62570 $inputPasswordConfirm.prop('disabled', state); 62571 $btnPasswordResetFormSubmit.prop('disabled', state); 62572 }; 62573 62574 var showResetPassworErrors = function (data) { 62575 removeResetPassworErrors(); 62576 62577 if (data.errors.length) { 62578 $.each(data.errors, function (inputKey, inputError) { 62579 var $labelError = $errorTemplate.clone().html(inputError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 62580 $passwordResetErrors.append($labelError); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62581 }); 62582 62583 setResetPasswordCtrlsDisabledState(false); 62584 } 62585 }; 62586 62587 var removeResetPassworErrors = function () { 62588 $passwordResetErrors.html(''); 62589 }; 62590 62591 $authUserPasswordReset.find('#bat-listings-users-password, #bat-listings-users-confirm-password').on('input', function () { 62592 removeResetPassworErrors(); 62593 }); 62594 62595 var getGeneralPostPayload = function () { 62596 var payload = { 62597 captcha: $authUserPasswordReset 62598 .find('#auth-user-login-recaptcha') 62599 .val(), 62600 nonce: $authUserPasswordReset.find('#bat_reset_password_nonce').val(), 62601 }; 62602 62603 if ($authUserPasswordReset.find('#bat_login_redirect').length) { 62604 payload.bat_login_redirect = $authUserPasswordReset 62605 .find('#bat_login_redirect') 62606 .val(); 62607 } 62608 62609 return payload; 62610 }; 62611 62612 $btnPasswordResetFormSubmit.on('click', function () { 62613 postPasswordResetForm(); 62614 }); 62615 62616 var postPasswordResetForm = function () { 62617 setResetPasswordCtrlsDisabledState(true); 62618 62619 var formData = { 62620 'login': $inputUsername.val(), 62621 'login_new_password': $inputPassword.val(), 62622 'login_new_password_confirm': $inputPasswordConfirm.val(), 62623 'token': $inputPasswordToken.val(), 62624 'redirect': $inputRedirect.val(), 62625 }; 62626 62627 var generalData = getGeneralPostPayload(); 62628 62629 jQuery.post({ 62630 url: BaT_Theme.ajaxUrlResetPassword, 62631 data: Object.assign(formData, generalData), 62632 dataType: 'json' 62633 }).done(function(data) { 62634 if (data.success) { 62635 redirectToLoginPage(); 62636 } else if (data.data.errors) { 62637 showResetPassworErrors(data.data); 62638 } 62639 }).fail(function() { 62640 showResetPassworErrors({'errors': [BaT_Theme.textError]}); 62641 }); 62642 } 62643 })(); 62644 62645 // Forgot password 62646 $('#bat-fp-form').on('submit', function (e) { 62647 var $form = $(this); 62648 var $input = $form.find('input[name="bat-listings-users[g
62648-recaptcha-response]"]'); 62649 62650 if (!$input.val()) { 62651 e.preventDefault(); 62652 62653 BaT_Theme.getRecaptchaToken(() => $form.submit(), $input); 62654 } else { 62655 $('#bat-fp-form-submit').prop('disabled', true); 62656 } 62657 }); 62658 62659 $('#bat-listings-users-username').on('input', function () { 62660 let inactive = '' === $('#bat-listings-users-username').val(); 62661 $('#bat-fp-form-submit').prop('disabled', inactive); 62662 }); 62663 62664 $('#bat-fp-form-submit').prop('disabled', '' === $('#bat-listings-users-username').val()); 62665 62666 // Registration 62667 (function () { 62668 var $form = $('.bat-listings-users-form-register-payment'); 62669 62670 if (0 === $form.length) { 62671 return; 62672 } 62673 62674 var $emailField = $form.find('#bat-listings-users-email'); 62675 var $loginField = $form.find('#bat-listings-users-username'); 62676 var $passwordField = $form.find('#bat-listings-users-password'); 62677 var $countryOfResidenceField = $form.find('#bat-listings-users-country-of-residence-select'); 62678 var $tocField = $form.find('input[name="bat-listings-users[tos]"]'); 62679 var $submitButton = $form.find('#registration-submit'); 62680 62681 var emailRequest = null; 62682 var loginRequest = null; 62683 62684 var $checkboxRegisterForBidding = $form.find('#checkbox-register-for-bidding'); 62685 var $billingForm = $('.registration-section-billing-info #registration-section-billing-form'); 62686 var handleBatPaymentOptionChange = function() { 62687 if($checkboxRegisterForBidding.is(':checked')) { 62688 $form.addClass('bat-listings-form-stripe-v3-setup-card-without-payment'); 62689 $billingForm.show(); 62690 $billingForm.find('.control-group-input-optional-required').find('input, select').attr('required', true); 62691 } else { 62692 $form.removeClass('bat-listings-form-stripe-v3-setup-card-without-payment'); 62693 $billingForm.hide(); 62694 $billingForm.find('.control-group-input-optional-required').find('input, select').attr('required', false); 62695 62696 $('.registration-section-billing-info #referral_descriptor').hide(); 62697 $('#bat-listings-users-referral_source').val(''); 62698 } 62699 } 62700 62701 $checkboxRegisterForBidding.on('click', handleBatPaymentOptionChange); 62702 handleBatPaymentOptionChange(); 62703 62704 function validateEmail(skipEmailRequest = false) { 62705 var $warning = $form.find('#error-email-exists'); 62706 var email = $.trim($emailField.val()); 62707 62708 if (null !== emailRequest) { 62709 emailRequest.abort(); 62710 emailRequest = null; 62711 } 62712 62713 $form.data('bat_email_exists', false); 62714 $warning.hide(); 62715 62716 validateForm(); 62717 62718 if (-1 === email.indexOf('@') || false !== skipEmailRequest) { 62719 return; 62720 } 62721 62722 emailRequest = $.post( 62723 BaT_Theme.ajaxUrlEmailExists, 62724 { 62725 email: email, 62726 }, 62727 function (data, status) { 62728 if (data.exists) { 62729 BaT_Theme.openLoginModal(data.value); 62730 62731 $form.data('bat_email_exists', true); 62732 $warning.show(); 62733 } 62734 62735 validateForm(); 62736 }, 62737 'json' 62738 ); 62739 } 62740 62741 function validateUsername(skipLoginRequest = false) { 62742 var $warning = $form.find('#error-username-exists'); 62743 var login = $.trim($loginField.val()); 62744 62745 if (null !== loginRequest) { 62746 loginRequest.abort(); 62747 loginRequest = null; 62748 } 62749 62750 $form.data('bat_username_exists', false); 62751 $warning.hide(); 62752 62753 validateForm(); 62754 62755 if (3 > login.length || false !== skipLoginRequest) { 62756 return; 62757 } 62758 62759 loginRequest = $.post( 62760 BaT_Theme.ajaxUrlUserLoginExists, 62761 { 62762 login: login, 62763 }, 62764 function (data, status) { 62765 if (data.exists) { 62766 $form.data('bat_username_exists', true); 62767 $warning.show(); 62768 } 62769 62770 validateForm(); 62771 loginRequest = null; 62772 }, 62773 'json' 62774 ); 62775 } 62776 62777 function checkUsernameEmailMatch() { 62778 var $warning = $form.find('#warning-email-username-match'); 62779 var email = $.trim($emailField.val()); 62780 var login = $.trim($loginField.val()); 62781 62782 $warning.hide(); 62783 62784 if (email && login) { 62785 var emailPrefix = email.substring(0, email.indexOf('@')); 62786 $warning.toggle(emailPrefix === login); 62787 } 62788 } 62789 62790 function validateForm () { 62791 let formValid = false === ((0 < $passwordField.length && false === $passwordField.hasClass('password-valid')) 62792 || (0 < $emailField.length && !($.trim($emailField.val()))) 62793 || (0 < $loginField.length && !($.trim($loginField.val()))) 62794 || $form.data('bat_email_exists') 62795 || $form.data('bat_username_exists') 62796 || !($countryOfResidenceField.val()) 62797 || false === $tocField.is(':checked')); 62798 62799 $submitButton.prop('disabled', false === formValid); 62800 } 62801 62802 $emailField.on('change', lodash.debounce(function () { 62803 validateEmail(); 62804 }, 500)); 62805 62806 $emailField.on('input', lodash.debounce(function () { 62807 checkUsernameEmailMatch(); 62808 validateEmail(true); 62809 }, 300)); 62810 62811 $loginField.on('change', lodash.debounce(function () { 62812 validateUsername(); 62813 }, 500)); 62814 62815 $loginField.on('input', lodash.debounce(function () { 62816 checkUsernameEmailMatch(); 62817 validateUsername(true); 62818 }, 300)); 62819 62820 $passwordField.on('input', function (event) { 62821 $(this).removeClass('control-group-error'); 62822 }); 62823 62824 $(document).on('click', '.login-modal-button-cancel', function (event) { 62825 event.preventDefault(); 62826 62827 $.magnificPopup.close(); 62828 }); 62829 62830 $passwordField.on('password-validation', function () { 62831 validateForm(); 62832 }); 62833 62834 $('#bat-listings-users-country-of-residence-select, input[name="bat-listings-users[tos]"]').on('change', function () { 62835 validateForm(); 62836 }); 62837 62838 $form.on( 62839 'submit', 62840 function (event) { 62841 if ($form.data('bat_email_exists')) { 62842 event.preventDefault(); 62843 event.stopImmediatePropagation(); 62844 62845 $emailField 62846 .focus() 62847 .siblings('label.control-group-error') 62848 .fadeIn(100) 62849 .fadeOut(100) 62850 .fadeIn(100) 62851 .fadeOut(100) 62852 .fadeIn(100); 62853 62854 return; 62855 } 62856 62857 if ($form.data('bat_username_exists')) { 62858 event.preventDefault(); 62859 event.stopImmediatePropagation(); 62860 62861 $loginField 62862 .focus() 62863 .siblings('label.control-group-error') 62864 .fadeIn(100) 62865 .fadeOut(100) 62866 .fadeIn(100) 62867 .fadeOut(100) 62868 .fadeIn(100); 62869 62870 return; 62871 } 62872 62873 if (null !== loginRequest) { 62874 loginRequest.abort(); 62875 } 62876 } 62877 ); 62878 62879 var $modal = $('#login-modal-container'), 62880 $message = $modal.find('.login-modal-email-message'); 62881 62882 $message.data('default', $message.text()); 62883 62884 validateForm(); 62885 })(); 62886 62887 // Setup 2FA 62888 (function () { 62889 var $verificationMethodMFA = $('#verification-method-mfa'); 62890 var $setupMFA = $('#setup-mfa'); 62891 62892 if (0 === $setupMFA.length || 0 === $verificationMethodMFA.length) { 62893 return; 62894 } 62895 62896 var mfaSMSAvailable = ['US', 'CA'].includes(BaT_Theme.userCountryOfResidence); 62897 62898 if (false === mfaSMSAvailable) { 62899 $setupMFA.find('#setup-mfa-sms').remove(); 62900 } 62901 62902 var setupFlow = $setupMFA.find('#setup-mfa-flow').val(); 62903 var redirectOnSuccess = $setupMFA.find('#setup-mfa-redirect').val(); 62904 62905 var mfaType = mfaSMSAvailable ? 'sms' : 'app'; 62906 var verificationMethod = null; 62907 var mfaAction = 'start'; 62908 var resendMfaSetupCodeInterval = null; // Ensure this variable is accessible globally 62909 62910 var $currentMFAView = $setupMFA.find('#setup-mfa-' + mfaType); 62911 var $errorLabels = $setupMFA.find('.label-mfa-error'); 62912 62913 var mfaAppSecret = ''; 62914 var codeVerificationInProgress = false;
62915 62916 var updateViews = function () { 62917 $errorLabels.text(''); 62918 if ('success' === mfaAction) { 62919 $setupMFA.find('#setup-mfa-sms, #setup-mfa-app, #setup-mfa-email').remove(); 62920 $currentMFAView = $setupMFA.find('#setup-mfa-success'); 62921 $currentMFAView.show(); 62922 return; 62923 } 62924 62925 $currentMFAView = $setupMFA.find('#setup-mfa-' + mfaType); 62926 62927 $setupMFA.find('#setup-mfa-sms, #setup-mfa-app, #setup-mfa-email').hide(); 62928 $setupMFA.find('.setup-mfa-start, .setup-mfa-verify').hide(); 62929 62930 $setupMFA.find('.input-verification-code input').val(''); 62931 $currentMFAView.show(); 62932 $currentMFAView.find('.setup-mfa-' + mfaAction).show(); 62933 62934 if (!$verificationMethodMFA.is(':visible')) { 62935 $('html, body').animate({ 62936 scrollTop: $currentMFAView.offset().top - 50 // 50px offset from top 62937 }, 'fast'); 62938 } 62939 62940 if('start' === mfaAction && 'app' === mfaType) { 62941 requestMFAcode(); 62942 return; 62943 } 62944 }; 62945 62946 var disableCtrls = function () { 62947 $setupMFA 62948 .find('.input-verification-code input') 62949 .prop('disabled', 'disabled'); 62950 62951 $currentMFAView 62952 .find('.nav-buttons-wrp .button') 62953 .prop('disabled', 'disabled') 62954 .addClass('btn-disabled'); 62955 }; 62956 62957 var enableCtrls = function () { 62958 $setupMFA 62959 .find('.input-verification-code input') 62960 .prop('disabled', ''); 62961 62962 $currentMFAView 62963 .find('.nav-buttons-wrp .button') 62964 .prop('disabled', '') 62965 .removeClass('btn-disabled'); 62966 }; 62967 62968 var inputGetVerificationCode = function () { 62969 var verificationCode = ''; 62970 62971 $inputs = $currentMFAView.find('.input-verification-code input'); 62972 62973 $inputs.each(function (index, element) { 62974 verificationCode += $(element).val(); 62975 }); 62976 62977 return verificationCode; 62978 }; 62979 62980 var onVerificationCodeInput = function () { 62981 $errorLabels.text(''); 62982 62983 if (6 === inputGetVerificationCode().length) { 62984 verifyMFAcode(inputGetVerificationCode()); 62985 } 62986 }; 62987 62988 var startCountdown = function () { 62989 var countdown = BaT_Theme.mfaResendCodeAllowedInterval; 62990 var $resendButton = $currentMFAView.find('.btn-resend-mfa-code'); 62991 62992 $resendButton.text(BaT_Theme.textResendMfaCodeLabel); 62993 $resendButton.append($(`<svg id="resend-countdown-spinner" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg" aria-label="Loading"><circle cx="7" cy="7" r="5.775" stroke="#E7E7E7" stroke-width="2.45" fill="none"/><circle cx="7" cy="7" r="5.775" stroke="#555555" stroke-width="2.45" fill="none" stroke-linecap="round" stroke-dasharray="36.285395" stroke-dashoffset="36.285395"><animate id="fillAnim" attributeName="stroke-dashoffset" values="36.285395;0;36.285395" keyTimes="0;0.9;1" dur="${1.2 * countdown}s" repeatCount="indefinite" /></circle></svg>`)); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append 62994 62995 $resendButton.addClass('btn-disabled'); 62996 62997 clearInterval(resendMfaSetupCodeInterval); // Clear any previous interval 62998 resendMfaSetupCodeInterval = setInterval(function () { 62999 countdown -= 1; 63000 63001 if (countdown <= 0) { 63002 clearInterval(resendMfaSetupCodeInterval); 63003 $resendButton.text(BaT_Theme.textResendMfaCode); 63004 $resendButton.removeClass('btn-disabled'); 63005 } 63006 }, 1000); 63007 }; 63008 63009 // Stop interval when navigating away 63010 $(window).on('beforeunload', function () { 63011 clearInterval(resendMfaSetupCodeInterval); 63012 }); 63013 63014 var requestMFAcode = function (isResendRequest) { 63015 BaT_Theme.getRecaptchaToken(function (token) { 63016 $setupMFA.find('#setup-mfa-recaptcha').val(token); 63017 postRequestMFAcode(isResendRequest); 63018 }); 63019 } 63020 63021 var postRequestMFAcode = function (isResendRequest) { 63022 var mfaPhone = 'sms' === mfaType ? $setupMFA.find('#mfa-phone-input').val() : ''; 63023 $setupMFA.find('#label-phone-number span').text(`**** **** ${mfaPhone.slice(-4)}`); 63024 63025 // Check local storage for mfaPhone timestamp 63026 var lastRequestTime = localStorage.getItem(mfaPhone); 63027 63028 if (lastRequestTime) { 63029 var elapsedTime = Math.floor(Date.now() - parseInt(lastRequestTime, 10) / 1000); 63030 63031 if (elapsedTime < BaT_Theme.mfaResendCodeAllowedInterval) { 63032 // 30 seconds 63033 mfaAction = 'verify'; 63034 updateViews(); 63035 return; 63036 } 63037 } 63038 63039 disableCtrls(); 63040 $errorLabels.text(''); 63041 63042 jQuery 63043 .post({ 63044 url: BaT_Theme.ajaxUrlMFASetup, 63045 data: { 63046 mfaType: mfaType, 63047 mfaAction: 'reguest_code', 63048 mfaPhone: mfaPhone, 63049 captcha: $setupMFA.find('#setup-mfa-recaptcha').val(),
63050 resendRequest: isResendRequest 63051 }, 63052 dataType: 'json', 63053 }) 63054 .done(function (data) { 63055 if (data.success) { 63056 $setupMFA.find('#mfa-app-qr-code-svg').html(''); 63057 if ('app' === mfaType) { 63058 $setupMFA 63059 .find('#mfa-app-qr-code-svg') 63060 .html(data.qr_code); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 63061 mfaAppSecret = data.secret; 63062 var splitSecret = mfaAppSecret.replace(/(.{4})/g, '$1 ').trim(); 63063 $setupMFA.find('#mfa-app-secret-key-container').text(splitSecret); 63064 if('start' === mfaAction) { 63065 return; 63066 } 63067 } 63068 63069 mfaAction = 'verify'; 63070 updateViews(); 63071 startCountdown(); // Start countdown after successful request 63072 63073 // Store current timestamp in local storage 63074 localStorage.setItem(mfaPhone, Date.now().toString()); 63075 } else if (data.data.message) { 63076 $errorLabels.text(data.data.message); 63077 } else { 63078 $errorLabels.text(BaT_Theme.textError); 63079 } 63080 }) 63081 .fail(function () { 63082 $errorLabels.text(BaT_Theme.textError); 63083 }) 63084 .always(function () { 63085 enableCtrls(); 63086 }); 63087 }; 63088 63089 var verifyMFAcode = function (verificationCode) { 63090 BaT_Theme.getRecaptchaToken(function (token) { 63091 $setupMFA.find('#setup-mfa-recaptcha').val(token); 63092 postVerifyMFAcode(verificationCode); 63093 }); 63094 } 63095 63096 var postVerifyMFAcode = function (verificationCode) { 63097 if (codeVerificationInProgress) { 63098 return; 63099 } 63100 63101 $errorLabels.text(''); 63102 var isSMS = 'sms' === mfaType; 63103 var mfaPhone = isSMS ? $setupMFA.find('#mfa-phone-input').val() : ''; 63104 jQuery 63105 .post({ 63106 url: BaT_Theme.ajaxUrlMFASetup, 63107 data: { 63108 mfaType: mfaType, 63109 mfaAction: 'verify_code', 63110 verificationCode: verificationCode, 63111 captcha: $setupMFA.find('#setup-mfa-recaptcha').val(), 63112 mfaPhone: mfaPhone, 63113 }, 63114 dataType: 'json', 63115 beforeSend: function () { 63116 codeVerificationInProgress = true; 63117 disableCtrls(); 63118 } 63119 }) 63120 .done(function (data) { 63121 if (data.success) { 63122 if (setupFlow && redirectOnSuccess) { 63123 window.location.href = redirectOnSuccess; // phpcs:ignore WordPressVIPMinimum.JS.Window.location 63124 return; 63125 } 63126 63127 mfaAction = 'success'; 63128 localStorage.removeItem(mfaPhone); // Remove mfaPhone from local storage 63129 updateViews(); 63130 63131 // Redirect to mobile app if setup initiated from there 63132 setTimeout(() => { 63133 const isSetupInitiatedByApp = BaT_Theme.getCookie('setup_mobile') === 'true'; 63134 var urlParams = new URLSearchParams(window.location.search); // phpcs:ignore WordPressVIPMinimum.JS.Window.location 63135 if (isSetupInitiatedByApp && !urlParams.has('f')) { 63136 const redirectUrl = `batmobile://multifactor_setup_completed?refresh_token=${encodeURIComponent(data.refresh_token)}`; 63137 BaT_Theme.setCookie('setup_mobile', 'false', 1/3600); // Clear the cookie after use 63138 window.location.href = redirectUrl; // phpcs:ignore WordPressVIPMinimum.JS.Window.location 63139 } 63140 }, 500); 63141 } else if (data.data.message) { 63142 $errorLabels.text(data.data.message); 63143 } else { 63144 $errorLabels.text(BaT_Theme.textError); 63145 } 63146 }) 63147 .fail(function () { 63148 $errorLabels.text(BaT_Theme.textError); 63149 }) 63150 .always(function () { 63151 enableCtrls(); 63152 codeVerificationInProgress = false;
63153 }); 63154 }; 63155 63156 var $termsCheckbox = $('#mfa-sms-terms-checkbox'); 63157 63158 $termsCheckbox.on('change', function () { 63159 validatePhoneNumber(); 63160 }); 63161 63162 $verificationMethodMFA.find('.verification-method').on('change', function () { 63163 verificationMethod = $(this).val(); 63164 mfaType = verificationMethod; 63165 $verificationMethodMFA.find('#btn-verification-method-continue').removeClass('btn-disabled'); 63166 }); 63167 63168 $verificationMethodMFA.find('#btn-verification-method-continue').on('click', function () { 63169 if ($(this).hasClass('btn-disabled')) { 63170 return; 63171 } 63172 mfaAction = 'start'; 63173 $verificationMethodMFA.hide(); 63174 $setupMFA.show(); 63175 updateViews(); 63176 }); 63177 63178 $setupMFA.find('.back-to-verification-method').on('click', function () { 63179 if ($(this).hasClass('btn-disabled')) { 63180 return; 63181 } 63182 $setupMFA.hide(); 63183 $verificationMethodMFA.show(); 63184 verificationMethod = null; 63185 $verificationMethodMFA.find('.verification-method').prop('checked', false); 63186 $verificationMethodMFA.find('#btn-verification-method-continue').addClass('btn-disabled'); 63187 }); 63188 63189 $setupMFA 63190 .find('#btn-mfa-sms-continue, #btn-mfa-app-continue, #btn-mfa-email-continue, .btn-resend-mfa-code') 63191 .on('click', function () { 63192 //if for some reason, the continue button is clicked before the phone number is validated, we will validate it here 63193 if('sms' === mfaType && !validatePhoneNumber()) { 63194 return; 63195 } 63196 63197 if ($(this).hasClass('btn-disabled')) { 63198 return; 63199 } 63200 63201 if('app' === mfaType && 'start' === mfaAction) { 63202 mfaAction = 'verify'; 63203 updateViews(); 63204 return; 63205 } 63206 63207 const isResendRequest = $(this).hasClass('btn-resend-mfa-code'); 63208 requestMFAcode(isResendRequest); 63209 }); 63210 63211 $setupMFA 63212 .find('#btn-cant-scan-qr-code') 63213 .on('click', function () { 63214 if ($(this).hasClass('btn-disabled')) { 63215 return; 63216 } 63217 $setupMFA.find('#mfa-app-enter-manually').show(); 63218 $setupMFA.find('#mfa-form-scan-qr-code').hide(); 63219 return; 63220 }); 63221 63222 $setupMFA 63223 .find('#back-to-qr-code') 63224 .on('click', function () { 63225 if ($(this).hasClass('btn-disabled')) { 63226 return; 63227 } 63228 $setupMFA.find('#mfa-app-enter-manually').hide(); 63229 $setupMFA.find('#mfa-form-scan-qr-code').show(); 63230 return; 63231 }); 63232 63233 63234 var formatPhoneInputWithCursor = function ($input) { 63235 const input = $input.get(0); 63236 const rawValue = $input.val(); 63237 63238 // Save the current cursor position 63239 const selectionStart = input.selectionStart; 63240 63241 const formatter = new libphonenumber.AsYouType('US'); 63242 const formatted = formatter.input(rawValue); 63243 63244 $input.val(formatted); 63245 63246 const digitsBeforeCursor = rawValue.slice(0, selectionStart).replace(/[^\d]/g, '').length; 63247 63248 // Find position in formatted string that corresponds to digitsBeforeCursor digits 63249 let digitCount = 0; 63250 let newCursorPos = 0; 63251 for (; newCursorPos < formatted.length; newCursorPos++) { 63252 if (/\d/.test(formatted[newCursorPos])) { 63253 digitCount++; 63254 } 63255 if (digitCount >= digitsBeforeCursor) { 63256 newCursorPos++; // Place cursor just after the last counted digit 63257 break; 63258 } 63259 } 63260 63261 // Set cursor position (fallback to end) 63262 input.setSelectionRange(newCursorPos || formatted.length, newCursorPos || formatted.length); 63263 } 63264 63265 $setupMFA.find('#mfa-phone-input').each(function () { 63266 formatPhoneInputWithCursor($(this)); 63267 }); 63268 63269 $setupMFA.find('#mfa-phone-input').on('input', function () { 63270 $errorLabels.text(''); 63271 formatPhoneInputWithCursor($(this)); 63272 const valid = validatePhoneNumber(); 63273 $(this).toggleClass('invalid-phone-number', !valid); 63274 }); 63275
63276 var validatePhoneNumber = function () { 63277 const rawPhone = $setupMFA.find('#mfa-phone-input').val(); 63278 var phoneValid = true; 63279 63280 if (!/^\+?1?[\d\s\-()]*$/.test(rawPhone)) { 63281 $errorLabels.text('Invalid phone number. Please try again.'); 63282 phoneValid = false; 63283 } else { 63284 let digitsOnly = rawPhone.replace(/\D/g, ''); 63285 63286 if (digitsOnly.length !== 10) { 63287 $errorLabels.text('Invalid phone number. Please try again.'); 63288 phoneValid = false; 63289 } 63290 } 63291 63292 const isChecked = $termsCheckbox.is(':checked'); 63293 $setupMFA.find('#btn-mfa-sms-continue').toggleClass('btn-disabled', !phoneValid || !isChecked); 63294 return phoneValid; 63295 } 63296 63297 $setupMFA.find('.btn-mfa-back').on('click', function () { 63298 if ($(this).hasClass('btn-disabled')) { 63299 return; 63300 } 63301 63302 mfaAction = 'start'; 63303 updateViews(); 63304 }); 63305 63306 $verificationMethodMFA.find('#btn-verification-method-continue').on('keydown', function (event) { 63307 if (13 === (event.which ? event.which : event.keyCode)) { 63308 $(this).trigger('click'); 63309 } 63310 }); 63311 63312 $setupMFA 63313 .find('.button') 63314 .on('keydown', function (event) { 63315 if (13 === (event.which ? event.which : event.keyCode)) { 63316 $(this).trigger('click'); 63317 } 63318 }); 63319 63320 const handleCopyButtonClick = function(textElementId, type) { 63321 var itemElement = $setupMFA.find(textElementId); 63322 var itemText = type === 'key' ? mfaAppSecret : itemElement.text(); 63323 63324 if (navigator.clipboard && navigator.clipboard.writeText) { 63325 navigator.clipboard.writeText(itemText); 63326 } else { 63327 var tempInput = document.createElement('textarea'); 63328 tempInput.value = itemText; 63329 document.body.appendChild(tempInput); 63330 tempInput.select(); 63331 try { 63332 document.execCommand('copy'); 63333 } catch (err) {} 63334 document.body.removeChild(tempInput); 63335 } 63336 63337 $setupMFA.find('#copy-'+ type + '-button-copy').hide(); 63338 $setupMFA.find('#copy-'+ type + '-button-copied').show(); 63339 63340 setTimeout(function() { 63341 $setupMFA.find('#copy-'+ type + '-button-copied').fadeOut(1000); 63342 }, 1000); 63343 setTimeout(function() { 63344 $setupMFA.find('#copy-'+ type + '-button-copy').fadeIn(1000); 63345 }, 2000); 63346 63347 } 63348 63349 $setupMFA.find('#copy-key-button').on('click', function(){ 63350 handleCopyButtonClick('#mfa-app-secret-key-container', 'key'); 63351 }); 63352 63353 $setupMFA.find('#copy-name-button').on('click', function(){ 63354 handleCopyButtonClick('#mfa-app-code-name', 'name'); 63355 }); 63356 63357 var $verificationCodeInput = $setupMFA.find( 63358 '.input-verification-code input' 63359 ); 63360 $verificationCodeInput.on({ 63361 input: function (event) { 63362 if (this.value) { 63363 $verificationCodeInput 63364 .eq($verificationCodeInput.index(this) + 1) 63365 .focus(); 63366 } 63367 63368 onVerificationCodeInput(); 63369 }, 63370 63371 keydown: function (event) { 63372 var i = $verificationCodeInput.index(this); 63373 63374 if (8 === event.which && !this.value && i) { 63375 $verificationCodeInput.eq(i - 1).focus(); 63376 } 63377 }, 63378 63379 paste: function (e) { 63380 var pastedData = e.originalEvent.clipboardData.getData('text'); 63381 var pastedChars = pastedData.split(''); 63382 var curIndex = $verificationCodeInput.index(this); 63383 63384 for (var i = 0; i < pastedChars.length; i++) { 63385 var char = pastedChars[i]; 63386 $verificationCodeInput
63387 .eq(curIndex + i) 63388 .val(char) 63389 .focus(); 63390 } 63391 onVerificationCodeInput(); 63392 }, 63393 }); 63394 63395 updateViews(); 63396 })(); 63397}); 63398; 63399jQuery(document).ready(function ($) { 63400 63401 BaT_Theme.updateCurrentAuctionsFooter = function (found, total) { 63402 if (found < total) { 63403 $('#auctions_filtered_message_more_count').text(total - found); 63404 $('#auctions_filtered_message_none').toggle(found === 0); 63405 $('#auctions_filtered_message_more').show(); 63406 $('#auctions-footer-current hr').show(); 63407 } else { 63408 $('#auctions_filtered_message_none').hide(); 63409 $('#auctions_filtered_message_more').hide(); 63410 $('#auctions-footer-current hr').hide(); 63411 } 63412 } 63413 63414 // All live auctions 63415 if (document.getElementById('auctions-current-container')) { 63416 var AuctionsCurrentToolbarVM = new ListingsToolbarViewModel('live-auctions'); 63417 if (document.getElementById('auctions-current-toolbar')) { 63418 ko.applyBindings(AuctionsCurrentToolbarVM, document.getElementById('auctions-current-toolbar')); 63419 } 63420 63421 var AuctionsCurrentVM = new AuctionsCurrentViewModel(AuctionsCurrentToolbarVM); 63422 ko.applyBindings(AuctionsCurrentVM, document.getElementById('auctions-current-container')); 63423 63424 if ('undefined' !== typeof(auctionsCurrentInitialData)) { 63425 AuctionsCurrentToolbarVM.loadInitialData(auctionsCurrentInitialData); 63426 AuctionsCurrentVM.loadInitialData(auctionsCurrentInitialData); 63427 } 63428 } 63429 63430 // Live no reserve auctions 63431 if (document.getElementById('auctions-no-reserve-container')) { 63432 var AuctionsNoReserveToolbarVM = new ListingsToolbarViewModel('no-reserve'); 63433 if (document.getElementById('auctions-no-reserve-current-toolbar')) { 63434 ko.applyBindings(AuctionsNoReserveToolbarVM, document.getElementById('auctions-no-reserve-current-toolbar')); 63435 } 63436 63437 var AuctionsNoReserveVM = new AuctionsCurrentViewModel(AuctionsNoReserveToolbarVM); 63438 ko.applyBindings(AuctionsNoReserveVM, document.getElementById('auctions-no-reserve-container')); 63439 63440 if ('undefined' !== typeof(auctionsNoReserveCurrentInitialData)) { 63441 AuctionsNoReserveToolbarVM.loadInitialData(auctionsNoReserveCurrentInitialData); 63442 AuctionsNoReserveVM.loadInitialData(auctionsNoReserveCurrentInitialData); 63443 } 63444 } 63445 63446 if (document.getElementById('auctions-completed-container')) { 63447 var AuctionsCompletedToolbarVM = new ListingsCompletedToolbarViewModel('completed'); 63448 ko.applyBindings(AuctionsCompletedToolbarVM, document.getElementById('auctions-completed-toolbar')); 63449 63450 var AuctionsCompletedVM = new AuctionsCompletedViewModel(AuctionsCompletedToolbarVM); 63451 ko.applyBindings(AuctionsCompletedVM, document.getElementById('auctions-completed-container')); 63452 63453 if ('undefined' !== typeof(auctionsCompletedInitialData)) { 63454 AuctionsCompletedToolbarVM.loadInitialData(auctionsCompletedInitialData); 63455 AuctionsCompletedVM.loadInitialData(auctionsCompletedInitialData); 63456 } 63457 } 63458 63459 (function () { 63460 function resetFilters(){ 63461 if (document.getElementById("auctions-current-toolbar")) { 63462 document.getElementById("auctions-current-toolbar").scrollIntoView(); 63463 } 63464 63465 if ('undefined' !== typeof AuctionsCurrentVM) { 63466 AuctionsCurrentVM.toolbarVM.resetFilters(); 63467 } 63468 63469 if (document.getElementById("auctions-no-reserve-current-toolbar")) { 63470 document.getElementById("auctions-no-reserve-current-toolbar").scrollIntoView(); 63471 } 63472 63473 if ('undefined' !== typeof AuctionsNoReserveVM) { 63474 AuctionsNoReserveVM.toolbarVM.resetFilters(); 63475 } 63476 } 63477 63478 $(document).on('click', '.listings-toolbar-clear-all', function (event) { 63479 event.preventDefault(); 63480 resetFilters(); 63481 }); 63482 63483 $(document).find('.listings-toolbar-clear-all').on('keypress', (event) => {
63484 const keyCode = (event.which ? event.which : event.keyCode); 63485 if ( keyCode === 13) { 63486 resetFilters(); 63487 } 63488 }); 63489 }()); 63490 63491 let pathName = document.location.pathname; 63492 let sessionKey = "scrollPosition_" + pathName; 63493 let paths = ["/auctions/", "/no-reserve/"]; 63494 63495 if (paths.includes(pathName) && $(document).width() > 768 && !$(document.body).hasClass('touch-device')) { 63496 $(window).on('beforeunload', function () { 63497 let scrollPosition = $(document).scrollTop(); 63498 sessionStorage.setItem(sessionKey, scrollPosition.toString()); 63499 }); 63500 63501 if (sessionStorage[sessionKey]) { 63502 let storedPosition = parseInt(sessionStorage.getItem(sessionKey)); 63503 function scroll() { 63504 window.scroll(0, storedPosition); 63505 if (storedPosition !== parseInt($(document).scrollTop())) { 63506 requestAnimationFrame(scroll); 63507 } 63508 } 63509 requestAnimationFrame(scroll); 63510 } 63511 } 63512 63513}); 63514; 63515jQuery(document).ready(function ($) { 63516 // section and view model of said section where the sort by dropdown is located 63517 var searchResultsSection = document.getElementById('search-results-section'); 63518 var searchResultListings = document.getElementById('search-result-live-listings'); 63519 var SearchSortbyFilterVM = new SearchSortbyFilterModel(); 63520 63521 if (searchResultsSection) { 63522 ko.applyBindings(SearchSortbyFilterVM, searchResultsSection); 63523 } 63524 63525 // view model that takes care of adding and filtering the search results grid items 63526 var SearchLiveGridModelVM = new SearchLiveGridModel(SearchSortbyFilterVM); 63527 if(searchResultListings) { 63528 ko.applyBindings(SearchLiveGridModelVM, searchResultListings); 63529 } 63530 63531 // add search result items from php json encoded array 63532 // defined in themes/bringatrailer/misc/search-form.php:75 63533 var items = typeof searchResultItems !== 'undefined' ? searchResultItems : false; 63534 if (items) { 63535 SearchLiveGridModelVM.addItemsBulk(items); 63536 } 63537 63538 // show/hide dropdown logic on click 63539 $(searchResultsSection).find('.dropdown-title').on('click', function () { 63540 var activeClass = 'active'; 63541 var dropdown = jQuery(this).parent(); 63542 var active = dropdown.hasClass(activeClass); 63543 63544 jQuery('.toolbar-dropdown').removeClass(activeClass); 63545 if (!active) dropdown.addClass(activeClass); 63546 }); 63547}); 63548; 63549(function() { 63550 var videoGalleryElement = document.querySelector('#bat_listing_page_video_gallery'); 63551 63552 if(videoGalleryElement) { 63553 videoGalleryItems = JSON.parse(videoGalleryElement.getAttribute('data-video-gallery-items')), 63554 videoGalleryViewModel = new VideoGalleryViewModel(videoGalleryItems); 63555 63556 ko.applyBindings(videoGalleryViewModel, videoGalleryElement); 63557 } 63558 63559 BAT_WEBSERVICES_PUSHER.bind(true, 'gallery-new-videos', function(data) { 63560 if(data.videos) { 63561 data.videos.forEach(function(videoData) { 63562 if(videoData.processingStatus === 'completed') { 63563 videoGalleryViewModel.add(videoData); 63564 } 63565 }); 63566 } 63567 }); 63568 63569 BAT_WEBSERVICES_PUSHER.bind(true, 'gallery-remove-videos', function(data) { 63570 if(data.videos) { 63571 data.videos.forEach(function(videoIdentifier) { 63572 videoGalleryViewModel.remove(videoIdentifier); 63573 }); 63574 } 63575 }); 63576}()); 63577;
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.