0byt3m1n1
Path:
C:
/
Program Files
/
RStudio
/
resources
/
app
/
resources
/
pdfjs
/
web
/
[
Home
]
File: viewer.js
var DEFAULT_URL="compressed.tracemonkey-pldi-09.pdf",DEFAULT_SCALE_DELTA=1.1,MIN_SCALE=0.25,MAX_SCALE=10,SCALE_SELECT_CONTAINER_PADDING=8,SCALE_SELECT_PADDING=22,PAGE_NUMBER_LOADING_INDICATOR="visiblePageIsLoading",DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT=5E3;function configure(b){b.imageResourcesPath="./images/";b.workerSrc="../build/pdf.worker.js";b.cMapUrl="../web/cmaps/";b.cMapPacked=!0} var mozL10n=document.mozL10n||document.webL10n,CSS_UNITS=96/72,DEFAULT_SCALE_VALUE="auto",DEFAULT_SCALE=1,UNKNOWN_SCALE=0,MAX_AUTO_SCALE=1.25,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5;function getFileName(b){var a=b.indexOf("#"),c=b.indexOf("?"),a=Math.min(0<a?a:b.length,0<c?c:b.length);return b.substring(b.lastIndexOf("/",a)+1,a)} function getOutputScale(b){b=(window.devicePixelRatio||1)/(b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1);return{sx:b,sy:b,scaled:1!==b}} function scrollIntoView(b,a,c){var g=b.offsetParent;if(g){for(var c=c||!1,d=b.offsetTop+b.clientTop,b=b.offsetLeft+b.clientLeft;g.clientHeight===g.scrollHeight||c&&"hidden"===getComputedStyle(g).overflow;)if(g.dataset._scaleY&&(d/=g.dataset._scaleY,b/=g.dataset._scaleX),d+=g.offsetTop,b+=g.offsetLeft,g=g.offsetParent,!g)return;a&&(void 0!==a.top&&(d+=a.top),void 0!==a.left&&(b+=a.left,g.scrollLeft=b));g.scrollTop=d}else console.error("offsetParent is not set -- cannot scroll")} function watchScroll(b,a){var c=function(){d||(d=window.requestAnimationFrame(function(){d=null;var c=b.scrollTop,f=g.lastY;c!==f&&(g.down=c>f);g.lastY=c;a(g)}))},g={down:!0,lastY:b.scrollTop,_eventHandler:c},d=null;b.addEventListener("scroll",c,!0);return g}function parseQueryString(b){for(var b=b.split("&"),a={},c=0,g=b.length;c<g;++c){var d=b[c].split("="),e=d[0].toLowerCase(),d=1<d.length?d[1]:null;a[decodeURIComponent(e)]=decodeURIComponent(d)}return a} function binarySearchFirstItem(b,a){var c=0,g=b.length-1;if(0===b.length||!a(b[g]))return b.length;if(a(b[c]))return c;for(;c<g;){var d=c+g>>1;a(b[d])?g=d:c=d+1}return c}function approximateFraction(b){if(Math.floor(b)===b)return[b,1];var a=1/b;if(8<a)return[1,8];if(Math.floor(a)===a)return[1,a];for(var a=1<b?a:b,c=0,g=1,d=1,e=1;;){var f=c+d,h=g+e;if(8<h)break;a<=f/h?(d=f,e=h):(c=f,g=h)}return a-c/g<d/e-a?a===b?[c,g]:[g,c]:a===b?[d,e]:[e,d]} function roundToDivide(b,a){var c=b%a;return 0===c?b:Math.round(b-c+a)} function getVisibleElements(b,a,c){function g(a){a=a.div;return a.offsetTop+a.clientTop+a.clientHeight>d}for(var d=b.scrollTop,e=d+b.clientHeight,f=b.scrollLeft,h=f+b.clientWidth,b=[],i,j,k,l,n,o=0===a.length?0:binarySearchFirstItem(a,g),p=a.length;o<p;o++){i=a[o];j=i.div;k=j.offsetTop+j.clientTop;l=j.clientHeight;if(k>e)break;n=j.offsetLeft+j.clientLeft;j=j.clientWidth;n+j<f||n>h||(j=Math.max(0,d-k)+Math.max(0,k+l-e),l=100*(l-j)/l|0,b.push({id:i.id,x:n,y:k,view:i,percent:l}))}a=b[0];e=b[b.length- 1];c&&b.sort(function(a,c){var b=a.percent-c.percent;return 0.001<Math.abs(b)?-b:a.id-c.id});return{first:a,last:e,views:b}}function noContextMenuHandler(b){b.preventDefault()}function getPDFFileNameFromURL(b){var a=/[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i,b=/^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(b);if(b=a.exec(b[1])||a.exec(b[2])||a.exec(b[3]))if(b=b[0],-1!==b.indexOf("%"))try{b=a.exec(decodeURIComponent(b))[0]}catch(c){}return b||"document.pdf"} var ProgressBar=function(){function b(a,c){this.visible=!0;this.div=document.querySelector(a+" .progress");this.bar=this.div.parentNode;this.height=c.height||100;this.width=c.width||100;this.units=c.units||"%";this.div.style.height=this.height+this.units;this.percent=0}b.prototype={updateBar:function(){this._indeterminate?(this.div.classList.add("indeterminate"),this.div.style.width=this.width+this.units):(this.div.classList.remove("indeterminate"),this.div.style.width=this.width*this._percent/100+ this.units)},get percent(){return this._percent},set percent(a){this._indeterminate=isNaN(a);this._percent=Math.min(Math.max(a,0),100);this.updateBar()},setWidth:function(a){a&&(a=a.parentNode.offsetWidth-a.offsetWidth,0<a&&this.bar.setAttribute("style","width: calc(100% - "+a+"px);"))},hide:function(){this.visible&&(this.visible=!1,this.bar.classList.add("hidden"),document.body.classList.remove("loadingInProgress"))},show:function(){this.visible||(this.visible=!0,document.body.classList.add("loadingInProgress"), this.bar.classList.remove("hidden"))}};return b}(),DEFAULT_PREFERENCES={showPreviousViewOnLoad:!0,defaultZoomValue:"",sidebarViewOnLoad:0,enableHandToolOnLoad:!1,enableWebGL:!1,pdfBugEnabled:!1,disableRange:!1,disableStream:!1,disableAutoFetch:!1,disableFontFace:!1,disableTextLayer:!1,useOnlyCssZoom:!1,externalLinkTarget:0},SidebarView={NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3},Preferences={prefs:Object.create(DEFAULT_PREFERENCES),isInitializedPromiseResolved:!1,initializedPromise:null,initialize:function(){return this.initializedPromise= this._readFromStorage(DEFAULT_PREFERENCES).then(function(b){this.isInitializedPromiseResolved=!0;b&&(this.prefs=b)}.bind(this))},_writeToStorage:function(){return Promise.resolve()},_readFromStorage:function(){return Promise.resolve()},reset:function(){return this.initializedPromise.then(function(){this.prefs=Object.create(DEFAULT_PREFERENCES);return this._writeToStorage(DEFAULT_PREFERENCES)}.bind(this))},reload:function(){return this.initializedPromise.then(function(){this._readFromStorage(DEFAULT_PREFERENCES).then(function(b){b&& (this.prefs=b)}.bind(this))}.bind(this))},set:function(b,a){return this.initializedPromise.then(function(){if(void 0===DEFAULT_PREFERENCES[b])throw Error("preferencesSet: '"+b+"' is undefined.");if(void 0===a)throw Error("preferencesSet: no value is specified.");var c=typeof a,g=typeof DEFAULT_PREFERENCES[b];if(c!==g)if("number"===c&&"string"===g)a=a.toString();else throw Error("Preferences_set: '"+a+"' is a \""+c+'", expected "'+g+'".');else if("number"===c&&(a|0)!==a)throw Error("Preferences_set: '"+ a+'\' must be an "integer".');this.prefs[b]=a;return this._writeToStorage(this.prefs)}.bind(this))},get:function(b){return this.initializedPromise.then(function(){var a=DEFAULT_PREFERENCES[b];if(void 0===a)throw Error("preferencesGet: '"+b+"' is undefined.");var c=this.prefs[b];return void 0!==c?c:a}.bind(this))},_writeToStorage:function(b){return new Promise(function(a){localStorage.setItem("pdfjs.preferences",JSON.stringify(b));a()})},_readFromStorage:function(){return new Promise(function(b){var a= JSON.parse(localStorage.getItem("pdfjs.preferences"));b(a)})}}; (function(){function b(a){var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!1,!1,"custom");window.dispatchEvent(c)}function a(){if(d)if(g(),++e<d.length){var b=d[e];"function"===typeof b.mozPrintCallback?b.mozPrintCallback({context:b.getContext("2d"),abort:c,done:a}):a()}else g(),f.call(window),setTimeout(c,20)}function c(){d&&(d=null,g(),b("afterprint"))}function g(){var a=document.getElementById("mozPrintCallback-shim");if(d&&d.length){var b=Math.round(100*e/d.length),g=a.querySelector("progress"), f=a.querySelector(".relative-progress");g.value=b;f.textContent=b+"%";a.removeAttribute("hidden");a.onclick=c}else a.setAttribute("hidden","")}if(!("mozPrintCallback"in document.createElement("canvas"))){HTMLCanvasElement.prototype.mozPrintCallback=void 0;var d,e,f=window.print;window.print=function(){if(d)console.warn("Ignored window.print() because of a pending print job.");else try{b("beforeprint")}finally{d=document.querySelectorAll("canvas"),e=-1,a()}};var h=!!document.attachEvent;window.addEventListener("keydown", function(a){80===a.keyCode&&(a.ctrlKey||a.metaKey)&&!a.altKey&&(!a.shiftKey||window.chrome||window.opera)?(window.print(),h||(a.preventDefault(),a.stopImmediatePropagation?a.stopImmediatePropagation():a.stopPropagation())):27===a.keyCode&&d&&c()},!0);h&&document.attachEvent("onkeydown",function(a){a=a||window.event;if(80===a.keyCode&&a.ctrlKey)return a.keyCode=0,!1});if("onbeforeprint"in window){var i=function(a){"custom"!==a.detail&&a.stopImmediatePropagation&&a.stopImmediatePropagation()};window.addEventListener("beforeprint", i,!1);window.addEventListener("afterprint",i,!1)}}})(); var DownloadManager=function(){function b(a,b){var d=document.createElement("a");d.click?(d.href=a,d.target="_parent","download"in d&&(d.download=b),(document.body||document.documentElement).appendChild(d),d.click(),d.parentNode.removeChild(d)):(window.top===window&&a.split("#")[0]===window.location.href.split("#")[0]&&(d=-1===a.indexOf("?")?"?":"&",a=a.replace(/#|$/,d+"$&")),window.open(a,"_parent"))}function a(){}a.prototype={downloadUrl:function(a,g){PDFJS.isValidUrl(a,!0)&&b(a+"#pdfjs.action=download", g)},downloadData:function(a,g,d){if(navigator.msSaveBlob)return navigator.msSaveBlob(new Blob([a],{type:d}),g);a=PDFJS.createObjectURL(a,d);b(a,g)},download:function(a,g,d){URL?navigator.msSaveBlob?navigator.msSaveBlob(a,d)||this.downloadUrl(g,d):(a=URL.createObjectURL(a),b(a,d)):this.downloadUrl(g,d)}};return a}(),DEFAULT_VIEW_HISTORY_CACHE_SIZE=20,ViewHistory=function(){function b(a,c){this.fingerprint=a;this.cacheSize=c||DEFAULT_VIEW_HISTORY_CACHE_SIZE;this.isInitializedPromiseResolved=!1;this.initializedPromise= this._readFromStorage().then(function(a){this.isInitializedPromiseResolved=!0;a=JSON.parse(a||"{}");"files"in a||(a.files=[]);a.files.length>=this.cacheSize&&a.files.shift();for(var c,b=0,f=a.files.length;b<f;b++)if(a.files[b].fingerprint===this.fingerprint){c=b;break}"number"!==typeof c&&(c=a.files.push({fingerprint:this.fingerprint})-1);this.file=a.files[c];this.database=a}.bind(this))}b.prototype={_writeToStorage:function(){return new Promise(function(a){var c=JSON.stringify(this.database);localStorage.setItem("database", c);a()}.bind(this))},_readFromStorage:function(){return new Promise(function(a){a(localStorage.getItem("database"))})},set:function(a,c){if(this.isInitializedPromiseResolved)return this.file[a]=c,this._writeToStorage()},setMultiple:function(a){if(this.isInitializedPromiseResolved){for(var c in a)this.file[c]=a[c];return this._writeToStorage()}},get:function(a,c){return!this.isInitializedPromiseResolved?c:this.file[a]||c}};return b}(),PDFFindBar=function(){function b(a){this.opened=!1;this.bar=a.bar|| null;this.toggleButton=a.toggleButton||null;this.findField=a.findField||null;this.highlightAll=a.highlightAllCheckbox||null;this.caseSensitive=a.caseSensitiveCheckbox||null;this.findMsg=a.findMsg||null;this.findResultsCount=a.findResultsCount||null;this.findStatusIcon=a.findStatusIcon||null;this.findPreviousButton=a.findPreviousButton||null;this.findNextButton=a.findNextButton||null;this.findController=a.findController||null;if(null===this.findController)throw Error("PDFFindBar cannot be used without a PDFFindController instance."); var c=this;this.toggleButton.addEventListener("click",function(){c.toggle()});this.findField.addEventListener("input",function(){c.dispatchEvent("")});this.bar.addEventListener("keydown",function(a){switch(a.keyCode){case 13:a.target===c.findField&&c.dispatchEvent("again",a.shiftKey);break;case 27:c.close()}});this.findPreviousButton.addEventListener("click",function(){c.dispatchEvent("again",!0)});this.findNextButton.addEventListener("click",function(){c.dispatchEvent("again",!1)});this.highlightAll.addEventListener("click", function(){c.dispatchEvent("highlightallchange")});this.caseSensitive.addEventListener("click",function(){c.dispatchEvent("casesensitivitychange")})}b.prototype={dispatchEvent:function(a,c){var b=document.createEvent("CustomEvent");b.initCustomEvent("find"+a,!0,!0,{query:this.findField.value,caseSensitive:this.caseSensitive.checked,highlightAll:this.highlightAll.checked,findPrevious:c});return window.dispatchEvent(b)},updateUIState:function(a,c,b){var d=!1,e="",f="";switch(a){case FindStates.FIND_PENDING:f= "pending";break;case FindStates.FIND_NOTFOUND:e=mozL10n.get("find_not_found",null,"Phrase not found");d=!0;break;case FindStates.FIND_WRAPPED:e=c?mozL10n.get("find_reached_top",null,"Reached top of document, continued from bottom"):mozL10n.get("find_reached_bottom",null,"Reached end of document, continued from top")}d?this.findField.classList.add("notFound"):this.findField.classList.remove("notFound");this.findField.setAttribute("data-status",f);this.findMsg.textContent=e;this.updateResultsCount(b)}, updateResultsCount:function(a){this.findResultsCount&&(a?(this.findResultsCount.textContent=a.toLocaleString(),this.findResultsCount.classList.remove("hidden")):this.findResultsCount.classList.add("hidden"))},open:function(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.bar.classList.remove("hidden"));this.findField.select();this.findField.focus()},close:function(){this.opened&&(this.opened=!1,this.toggleButton.classList.remove("toggled"),this.bar.classList.add("hidden"), this.findController.active=!1)},toggle:function(){this.opened?this.close():this.open()}};return b}(),FindStates={FIND_FOUND:0,FIND_NOTFOUND:1,FIND_WRAPPED:2,FIND_PENDING:3},FIND_SCROLL_OFFSET_TOP=-50,FIND_SCROLL_OFFSET_LEFT=-400,PDFFindController=function(){function b(a){this.startedTextExtraction=!1;this.extractTextPromises=[];this.pendingFindMatches={};this.active=!1;this.pageContents=[];this.pageMatches=[];this.matchCount=0;this.selected={pageIdx:-1,matchIdx:-1};this.offset={pageIdx:null,matchIdx:null}; this.state=this.resumePageIdx=this.pagesToSearch=null;this.dirtyMatch=!1;this.findTimeout=null;this.pdfViewer=a.pdfViewer||null;this.integratedFind=a.integratedFind||!1;this.charactersToNormalize={"\u2018":"'","\u2019":"'","\u201a":"'","\u201b":"'","\u201c":'"',"\u201d":'"',"\u201e":'"',"\u201f":'"',"\u00bc":"1/4","\u00bd":"1/2","\u00be":"3/4"};this.findBar=a.findBar||null;a=Object.keys(this.charactersToNormalize).join("");this.normalizationRegex=RegExp("["+a+"]","g");a=["find","findagain","findhighlightallchange", "findcasesensitivitychange"];this.firstPagePromise=new Promise(function(a){this.resolveFirstPage=a}.bind(this));this.handleEvent=this.handleEvent.bind(this);for(var c=0,b=a.length;c<b;c++)window.addEventListener(a[c],this.handleEvent)}b.prototype={setFindBar:function(a){this.findBar=a},reset:function(){this.startedTextExtraction=!1;this.extractTextPromises=[];this.active=!1},normalize:function(a){var c=this;return a.replace(this.normalizationRegex,function(a){return c.charactersToNormalize[a]})}, calcFindMatch:function(a){var c=this.normalize(this.pageContents[a]),b=this.normalize(this.state.query),d=b.length;if(0!==d){this.state.caseSensitive||(c=c.toLowerCase(),b=b.toLowerCase());for(var e=[],f=-d;;){f=c.indexOf(b,f+d);if(-1===f)break;e.push(f)}this.pageMatches[a]=e;this.updatePage(a);this.resumePageIdx===a&&(this.resumePageIdx=null,this.nextPageMatch());0<e.length&&(this.matchCount+=e.length,this.updateUIResultsCount())}},extractText:function(){function a(b){e.pdfViewer.getPageTextContent(b).then(function(g){for(var g= g.items,d=[],j=0,k=g.length;j<k;j++)d.push(g[j].str);e.pageContents.push(d.join(""));c[b](b);b+1<e.pdfViewer.pagesCount&&a(b+1)})}if(!this.startedTextExtraction){this.startedTextExtraction=!0;this.pageContents=[];for(var c=[],b=this.pdfViewer.pagesCount,d=0;d<b;d++)this.extractTextPromises.push(new Promise(function(a){c.push(a)}));var e=this;a(0)}},handleEvent:function(a){if(null===this.state||"findagain"!==a.type)this.dirtyMatch=!0;this.state=a.detail;this.updateUIState(FindStates.FIND_PENDING); this.firstPagePromise.then(function(){this.extractText();clearTimeout(this.findTimeout);"find"===a.type?this.findTimeout=setTimeout(this.nextMatch.bind(this),250):this.nextMatch()}.bind(this))},updatePage:function(a){this.selected.pageIdx===a&&this.pdfViewer.scrollPageIntoView(a+1);a=this.pdfViewer.getPageView(a);a.textLayer&&a.textLayer.updateMatches()},nextMatch:function(){var a=this.state.findPrevious,c=this.pdfViewer.currentPageNumber-1,b=this.pdfViewer.pagesCount;this.active=!0;if(this.dirtyMatch){this.dirtyMatch= !1;this.selected.pageIdx=this.selected.matchIdx=-1;this.offset.pageIdx=c;this.offset.matchIdx=null;this.hadMatch=!1;this.resumePageIdx=null;this.pageMatches=[];this.matchCount=0;for(var d=this,c=0;c<b;c++)this.updatePage(c),c in this.pendingFindMatches||(this.pendingFindMatches[c]=!0,this.extractTextPromises[c].then(function(a){delete d.pendingFindMatches[a];d.calcFindMatch(a)}))}if(""===this.state.query)this.updateUIState(FindStates.FIND_FOUND);else if(!this.resumePageIdx){c=this.offset;this.pagesToSearch= b;if(null!==c.matchIdx){b=this.pageMatches[c.pageIdx].length;if(!a&&c.matchIdx+1<b||a&&0<c.matchIdx){this.hadMatch=!0;c.matchIdx=a?c.matchIdx-1:c.matchIdx+1;this.updateMatch(!0);return}this.advanceOffsetPage(a)}this.nextPageMatch()}},matchesReady:function(a){var c=this.offset,a=a.length,b=this.state.findPrevious;if(a)return this.hadMatch=!0,c.matchIdx=b?a-1:0,this.updateMatch(!0),!0;this.advanceOffsetPage(b);return c.wrapped&&(c.matchIdx=null,0>this.pagesToSearch)?(this.updateMatch(!1),!0):!1},updateMatchPosition:function(a, c,b,d){this.selected.matchIdx===c&&this.selected.pageIdx===a&&scrollIntoView(b[d],{top:FIND_SCROLL_OFFSET_TOP,left:FIND_SCROLL_OFFSET_LEFT},!0)},nextPageMatch:function(){null!==this.resumePageIdx&&console.error("There can only be one pending page.");do{var a=this.offset.pageIdx,c=this.pageMatches[a];if(!c){this.resumePageIdx=a;break}}while(!this.matchesReady(c))},advanceOffsetPage:function(a){var c=this.offset,b=this.extractTextPromises.length;c.pageIdx=a?c.pageIdx-1:c.pageIdx+1;c.matchIdx=null;this.pagesToSearch--; if(c.pageIdx>=b||0>c.pageIdx)c.pageIdx=a?b-1:0,c.wrapped=!0},updateMatch:function(a){var c=FindStates.FIND_NOTFOUND,b=this.offset.wrapped;this.offset.wrapped=!1;a&&(a=this.selected.pageIdx,this.selected.pageIdx=this.offset.pageIdx,this.selected.matchIdx=this.offset.matchIdx,c=b?FindStates.FIND_WRAPPED:FindStates.FIND_FOUND,-1!==a&&a!==this.selected.pageIdx&&this.updatePage(a));this.updateUIState(c,this.state.findPrevious);-1!==this.selected.pageIdx&&this.updatePage(this.selected.pageIdx)},updateUIResultsCount:function(){if(null=== this.findBar)throw Error("PDFFindController is not initialized with a PDFFindBar instance.");this.findBar.updateResultsCount(this.matchCount)},updateUIState:function(a,c){if(this.integratedFind)FirefoxCom.request("updateFindControlState",{result:a,findPrevious:c});else{if(null===this.findBar)throw Error("PDFFindController is not initialized with a PDFFindBar instance.");this.findBar.updateUIState(a,c,this.matchCount)}}};return b}(),PDFLinkService=function(){function b(){this._pagesRefCache=this.pdfHistory= this.pdfViewer=this.pdfDocument=this.baseUrl=null}b.prototype={setDocument:function(a,c){this.baseUrl=c;this.pdfDocument=a;this._pagesRefCache=Object.create(null)},setViewer:function(a){this.pdfViewer=a},setHistory:function(a){this.pdfHistory=a},get pagesCount(){return this.pdfDocument.numPages},get page(){return this.pdfViewer.currentPageNumber},set page(a){this.pdfViewer.currentPageNumber=a},navigateTo:function(a){var c="",b=this,d=function(f){var e=f instanceof Object?b._pagesRefCache[f.num+" "+ f.gen+" R"]:f+1;e?(e>b.pagesCount&&(e=b.pagesCount),b.pdfViewer.scrollPageIntoView(e,a),b.pdfHistory&&b.pdfHistory.push({dest:a,hash:c,page:e})):b.pdfDocument.getPageIndex(f).then(function(a){b._pagesRefCache[f.num+" "+f.gen+" R"]=a+1;d(f)})},e;"string"===typeof a?(c=a,e=this.pdfDocument.getDestination(a)):e=Promise.resolve(a);e.then(function(c){a=c;c instanceof Array&&d(c[0])})},getDestinationHash:function(a){if("string"===typeof a)return this.getAnchorUrl("#"+escape(a));if(a instanceof Array){var c= a[0];if(c=c instanceof Object?this._pagesRefCache[c.num+" "+c.gen+" R"]:c+1){var c=this.getAnchorUrl("#page="+c),b=a[1];if("object"===typeof b&&"name"in b&&"XYZ"===b.name){var b=a[4]||this.pdfViewer.currentScaleValue,d=parseFloat(b);d&&(b=100*d);c+="&zoom="+b;if(a[2]||a[3])c+=","+(a[2]||0)+","+(a[3]||0)}return c}}return this.getAnchorUrl("")},getAnchorUrl:function(a){return(this.baseUrl||"")+a},setHash:function(a){if(0<=a.indexOf("="))if(a=parseQueryString(a),"nameddest"in a)this.pdfHistory&&this.pdfHistory.updateNextHashParam(a.nameddest), this.navigateTo(a.nameddest);else{var c,b;"page"in a&&(c=a.page|0||1);if("zoom"in a){var d=a.zoom.split(","),e=d[0],f=parseFloat(e);-1===e.indexOf("Fit")?b=[null,{name:"XYZ"},1<d.length?d[1]|0:null,2<d.length?d[2]|0:null,f?f/100:e]:"Fit"===e||"FitB"===e?b=[null,{name:e}]:"FitH"===e||"FitBH"===e||"FitV"===e||"FitBV"===e?b=[null,{name:e},1<d.length?d[1]|0:null]:"FitR"===e?5!==d.length?console.error("PDFLinkService_setHash: Not enough parameters for 'FitR'."):b=[null,{name:e},d[1]|0,d[2]|0,d[3]|0,d[4]| 0]:console.error("PDFLinkService_setHash: '"+e+"' is not a valid zoom value.")}b?this.pdfViewer.scrollPageIntoView(c||this.page,b):c&&(this.page=c);"pagemode"in a&&(c=document.createEvent("CustomEvent"),c.initCustomEvent("pagemode",!0,!0,{mode:a.pagemode}),this.pdfViewer.container.dispatchEvent(c))}else/^\d+$/.test(a)?this.page=a:(this.pdfHistory&&this.pdfHistory.updateNextHashParam(unescape(a)),this.navigateTo(unescape(a)))},executeNamedAction:function(a){switch(a){case "GoBack":this.pdfHistory&& this.pdfHistory.back();break;case "GoForward":this.pdfHistory&&this.pdfHistory.forward();break;case "NextPage":this.page++;break;case "PrevPage":this.page--;break;case "LastPage":this.page=this.pagesCount;break;case "FirstPage":this.page=1}var c=document.createEvent("CustomEvent");c.initCustomEvent("namedaction",!0,!0,{action:a});this.pdfViewer.container.dispatchEvent(c)},cachePageRef:function(a,c){this._pagesRefCache[c.num+" "+c.gen+" R"]=a}};return b}(),PDFHistory=function(){function b(a){this.linkService= a.linkService;this.initialized=!1;this.initialBookmark=this.initialDestination=null}b.prototype={initialize:function(a){function c(){e.previousHash=window.location.hash.slice(1);e._pushToHistory({hash:e.previousHash},!1,!0);e._updatePreviousBookmark()}function b(a,c){function g(){window.removeEventListener("popstate",g);window.addEventListener("popstate",d);e._pushToHistory(a,!1,!0);history.forward()}function d(){window.removeEventListener("popstate",d);e.allowHashChange=!0;e.historyUnlocked=!0;c()} e.historyUnlocked=!1;e.allowHashChange=!1;window.addEventListener("popstate",g);history.back()}function d(){var a=e._getPreviousParams(null,!0);a&&(e._pushToHistory(a,!1,!e.current.dest&&e.current.hash!==e.previousHash),e._updatePreviousBookmark());window.removeEventListener("beforeunload",d,!1)}this.initialized=!0;this.reInitialized=!1;this.historyUnlocked=this.allowHashChange=!0;this.isViewerInPresentationMode=!1;this.previousHash=window.location.hash.substring(1);this.currentBookmark="";this.currentPage= 0;this.updatePreviousBookmark=!1;this.previousBookmark="";this.previousPage=0;this.nextHashParam="";this.fingerprint=a;this.currentUid=this.uid=0;this.current={};a=window.history.state;this._isStateObjectDefined(a)?(a.target.dest?this.initialDestination=a.target.dest:this.initialBookmark=a.target.hash,this.currentUid=a.uid,this.uid=a.uid+1,this.current=a.target):(a&&a.fingerprint&&this.fingerprint!==a.fingerprint&&(this.reInitialized=!0),this._pushOrReplaceState({fingerprint:this.fingerprint},!0)); var e=this;window.addEventListener("popstate",function(a){e.historyUnlocked&&(a.state?e._goTo(a.state):0===e.uid?b(e.previousHash&&e.currentBookmark&&e.previousHash!==e.currentBookmark?{hash:e.currentBookmark,page:e.currentPage}:{page:1},function(){c()}):c())},!1);window.addEventListener("beforeunload",d,!1);window.addEventListener("pageshow",function(){window.addEventListener("beforeunload",d,!1)},!1);window.addEventListener("presentationmodechanged",function(a){e.isViewerInPresentationMode=!!a.detail.active})}, clearHistoryState:function(){this._pushOrReplaceState(null,!0)},_isStateObjectDefined:function(a){return a&&0<=a.uid&&a.fingerprint&&this.fingerprint===a.fingerprint&&a.target&&a.target.hash?!0:!1},_pushOrReplaceState:function(a,c){c?window.history.replaceState(a,"",document.URL):window.history.pushState(a,"",document.URL)},get isHashChangeUnlocked(){return!this.initialized?!0:this.allowHashChange},_updatePreviousBookmark:function(){this.updatePreviousBookmark&&this.currentBookmark&&this.currentPage&& (this.previousBookmark=this.currentBookmark,this.previousPage=this.currentPage,this.updatePreviousBookmark=!1)},updateCurrentBookmark:function(a,c){this.initialized&&(this.currentBookmark=a.substring(1),this.currentPage=c|0,this._updatePreviousBookmark())},updateNextHashParam:function(a){this.initialized&&(this.nextHashParam=a)},push:function(a,c){if(this.initialized&&this.historyUnlocked)if(a.dest&&!a.hash&&(a.hash=this.current.hash&&this.current.dest&&this.current.dest===a.dest?this.current.hash: this.linkService.getDestinationHash(a.dest).split("#")[1]),a.page&&(a.page|=0),c){var b=window.history.state.target;b||(this._pushToHistory(a,!1),this.previousHash=window.location.hash.substring(1));this.updatePreviousBookmark=this.nextHashParam?!1:!0;b&&this._updatePreviousBookmark()}else{if(this.nextHashParam){if(this.nextHashParam===a.hash){this.nextHashParam=null;this.updatePreviousBookmark=!0;return}this.nextHashParam=null}a.hash?this.current.hash?this.current.hash!==a.hash?this._pushToHistory(a, !0):(!this.current.page&&a.page&&this._pushToHistory(a,!1,!0),this.updatePreviousBookmark=!0):this._pushToHistory(a,!0):this.current.page&&a.page&&this.current.page!==a.page&&this._pushToHistory(a,!0)}},_getPreviousParams:function(a,c){if(!this.currentBookmark||!this.currentPage)return null;this.updatePreviousBookmark&&(this.updatePreviousBookmark=!1);if(0<this.uid&&(!this.previousBookmark||!this.previousPage))return null;if(!this.current.dest&&!a||c){if(this.previousBookmark===this.currentBookmark)return null}else if(this.current.page|| a){if(this.previousPage===this.currentPage)return null}else return null;var b={hash:this.currentBookmark,page:this.currentPage};this.isViewerInPresentationMode&&(b.hash=null);return b},_stateObj:function(a){return{fingerprint:this.fingerprint,uid:this.uid,target:a}},_pushToHistory:function(a,c,b){this.initialized&&(!a.hash&&a.page&&(a.hash="page="+a.page),c&&!b&&(c=this._getPreviousParams())&&this._pushToHistory(c,!1,!this.current.dest&&this.current.hash!==this.previousHash),this._pushOrReplaceState(this._stateObj(a), b||0===this.uid),this.currentUid=this.uid++,this.current=a,this.updatePreviousBookmark=!0)},_goTo:function(a){if(this.initialized&&this.historyUnlocked&&this._isStateObjectDefined(a)){if(!this.reInitialized&&a.uid<this.currentUid){var c=this._getPreviousParams(!0);if(c){this._pushToHistory(this.current,!1);this._pushToHistory(c,!1);this.currentUid=a.uid;window.history.back();return}}this.historyUnlocked=!1;a.target.dest?this.linkService.navigateTo(a.target.dest):this.linkService.setHash(a.target.hash); this.currentUid=a.uid;a.uid>this.uid&&(this.uid=a.uid);this.current=a.target;this.updatePreviousBookmark=!0;a=window.location.hash.substring(1);this.previousHash!==a&&(this.allowHashChange=!1);this.previousHash=a;this.historyUnlocked=!0}},back:function(){this.go(-1)},forward:function(){this.go(1)},go:function(a){if(this.initialized&&this.historyUnlocked){var c=window.history.state;-1===a&&c&&0<c.uid?window.history.back():1===a&&c&&c.uid<this.uid-1&&window.history.forward()}}};return b}(),SecondaryToolbar= {opened:!1,previousContainerHeight:null,newContainerHeight:null,initialize:function(b){this.toolbar=b.toolbar;this.buttonContainer=this.toolbar.firstElementChild;this.toggleButton=b.toggleButton;this.presentationModeButton=b.presentationModeButton;this.openFile=b.openFile;this.print=b.print;this.download=b.download;this.viewBookmark=b.viewBookmark;this.firstPage=b.firstPage;this.lastPage=b.lastPage;this.pageRotateCw=b.pageRotateCw;this.pageRotateCcw=b.pageRotateCcw;this.documentPropertiesButton=b.documentPropertiesButton; var b=[{element:this.toggleButton,handler:this.toggle},{element:this.presentationModeButton,handler:this.presentationModeClick},{element:this.openFile,handler:this.openFileClick},{element:this.print,handler:this.printClick},{element:this.download,handler:this.downloadClick},{element:this.viewBookmark,handler:this.viewBookmarkClick},{element:this.firstPage,handler:this.firstPageClick},{element:this.lastPage,handler:this.lastPageClick},{element:this.pageRotateCw,handler:this.pageRotateCwClick},{element:this.pageRotateCcw, handler:this.pageRotateCcwClick},{element:this.documentPropertiesButton,handler:this.documentPropertiesClick}],a;for(a in b){var c=b[a].element;c&&c.addEventListener("click",b[a].handler.bind(this))}},presentationModeClick:function(){PDFViewerApplication.requestPresentationMode();this.close()},openFileClick:function(){document.getElementById("fileInput").click();this.close()},printClick:function(){window.print();this.close()},downloadClick:function(){PDFViewerApplication.download();this.close()}, viewBookmarkClick:function(){this.close()},firstPageClick:function(){PDFViewerApplication.page=1;this.close()},lastPageClick:function(){PDFViewerApplication.pdfDocument&&(PDFViewerApplication.page=PDFViewerApplication.pagesCount);this.close()},pageRotateCwClick:function(){PDFViewerApplication.rotatePages(90)},pageRotateCcwClick:function(){PDFViewerApplication.rotatePages(-90)},documentPropertiesClick:function(){PDFViewerApplication.pdfDocumentProperties.open();this.close()},setMaxHeight:function(b){b&& this.buttonContainer&&(this.newContainerHeight=b.clientHeight,this.previousContainerHeight!==this.newContainerHeight&&(this.buttonContainer.setAttribute("style","max-height: "+(this.newContainerHeight-SCROLLBAR_PADDING)+"px;"),this.previousContainerHeight=this.newContainerHeight))},open:function(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.toolbar.classList.remove("hidden"))},close:function(b){if(this.opened&&(!b||this.toolbar.contains(b)))this.opened=!1,this.toolbar.classList.add("hidden"), this.toggleButton.classList.remove("toggled")},toggle:function(){this.opened?this.close():this.open()}},DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS=1500,DELAY_BEFORE_HIDING_CONTROLS=3E3,ACTIVE_SELECTOR="pdfPresentationMode",CONTROLS_SELECTOR="pdfPresentationModeControls",PDFPresentationMode=function(){function b(a){this.container=a.container;this.viewer=a.viewer||a.container.firstElementChild;this.pdfViewer=a.pdfViewer;this.pdfThumbnailViewer=a.pdfThumbnailViewer||null;a=a.contextMenuItems||null;this.active= !1;this.args=null;this.contextMenuOpen=!1;this.mouseScrollDelta=this.mouseScrollTimeStamp=0;if(a)for(var c=0,b=a.length;c<b;c++){var d=a[c];d.element.addEventListener("click",function(a){this.contextMenuOpen=!1;a()}.bind(this,d.handler))}}b.prototype={request:function(){if(this.switchInProgress||this.active||!this.viewer.hasChildNodes())return!1;this._addFullscreenChangeListeners();this._setSwitchInProgress();this._notifyStateChange();if(this.container.requestFullscreen)this.container.requestFullscreen(); else if(this.container.mozRequestFullScreen)this.container.mozRequestFullScreen();else if(this.container.webkitRequestFullscreen)this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);else if(this.container.msRequestFullscreen)this.container.msRequestFullscreen();else return!1;this.args={page:this.pdfViewer.currentPageNumber,previousScale:this.pdfViewer.currentScaleValue};return!0},mouseScroll:function(a){if(this.active){var c=(new Date).getTime(),b=this.mouseScrollTimeStamp;c>b&&50> c-b||((0<this.mouseScrollDelta&&0>a||0>this.mouseScrollDelta&&0<a)&&this._resetMouseScrollState(),this.mouseScrollDelta+=a,120<=Math.abs(this.mouseScrollDelta)&&(a=0<this.mouseScrollDelta?-1:1,b=this.pdfViewer.currentPageNumber,this._resetMouseScrollState(),1===b&&-1===a||b===this.pdfViewer.pagesCount&&1===a||(this.pdfViewer.currentPageNumber=b+a,this.mouseScrollTimeStamp=c)))}},get isFullscreen(){return!(!document.fullscreenElement&&!document.mozFullScreen&&!document.webkitIsFullScreen&&!document.msFullscreenElement)}, _notifyStateChange:function(){var a=document.createEvent("CustomEvent");a.initCustomEvent("presentationmodechanged",!0,!0,{active:this.active,switchInProgress:!!this.switchInProgress});window.dispatchEvent(a)},_setSwitchInProgress:function(){this.switchInProgress&&clearTimeout(this.switchInProgress);this.switchInProgress=setTimeout(function(){this._removeFullscreenChangeListeners();delete this.switchInProgress;this._notifyStateChange()}.bind(this),DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS)},_resetSwitchInProgress:function(){this.switchInProgress&& (clearTimeout(this.switchInProgress),delete this.switchInProgress)},_enter:function(){this.active=!0;this._resetSwitchInProgress();this._notifyStateChange();this.container.classList.add(ACTIVE_SELECTOR);setTimeout(function(){this.pdfViewer.currentPageNumber=this.args.page;this.pdfViewer.currentScaleValue="page-fit"}.bind(this),0);this._addWindowListeners();this._showControls();this.contextMenuOpen=!1;this.container.setAttribute("contextmenu","viewerContextMenu");window.getSelection().removeAllRanges()}, _exit:function(){var a=this.pdfViewer.currentPageNumber;this.container.classList.remove(ACTIVE_SELECTOR);setTimeout(function(){this.active=!1;this._removeFullscreenChangeListeners();this._notifyStateChange();this.pdfViewer.currentScaleValue=this.args.previousScale;this.pdfViewer.currentPageNumber=a;this.args=null}.bind(this),0);this._removeWindowListeners();this._hideControls();this._resetMouseScrollState();this.container.removeAttribute("contextmenu");this.contextMenuOpen=!1;this.pdfThumbnailViewer&& this.pdfThumbnailViewer.ensureThumbnailVisible(a)},_mouseDown:function(a){if(this.contextMenuOpen)this.contextMenuOpen=!1,a.preventDefault();else if(0===a.button&&(!a.target.href||!a.target.classList.contains("internalLink")))a.preventDefault(),this.pdfViewer.currentPageNumber+=a.shiftKey?-1:1},_contextMenu:function(){this.contextMenuOpen=!0},_showControls:function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(CONTROLS_SELECTOR);this.controlsTimeout=setTimeout(function(){this.container.classList.remove(CONTROLS_SELECTOR); delete this.controlsTimeout}.bind(this),DELAY_BEFORE_HIDING_CONTROLS)},_hideControls:function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout)},_resetMouseScrollState:function(){this.mouseScrollDelta=this.mouseScrollTimeStamp=0},_addWindowListeners:function(){this.showControlsBind=this._showControls.bind(this);this.mouseDownBind=this._mouseDown.bind(this);this.resetMouseScrollStateBind=this._resetMouseScrollState.bind(this); this.contextMenuBind=this._contextMenu.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind)},_removeWindowListeners:function(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("keydown",this.resetMouseScrollStateBind); window.removeEventListener("contextmenu",this.contextMenuBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind},_fullscreenChange:function(){this.isFullscreen?this._enter():this._exit()},_addFullscreenChangeListeners:function(){this.fullscreenChangeBind=this._fullscreenChange.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind);window.addEventListener("mozfullscreenchange",this.fullscreenChangeBind); window.addEventListener("webkitfullscreenchange",this.fullscreenChangeBind);window.addEventListener("MSFullscreenChange",this.fullscreenChangeBind)},_removeFullscreenChangeListeners:function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);window.removeEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.removeEventListener("webkitfullscreenchange",this.fullscreenChangeBind);window.removeEventListener("MSFullscreenChange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}; return b}(),GrabToPan=function(){function b(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._endPan=this._endPan.bind(this);(this.overlay=document.createElement("div")).className= "grab-to-pan-grabbing"}b.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!0)},deactivate:function(){if(this.active&&(this.active=!1,this.element.removeEventListener("mousedown",this._onmousedown,!0),this._endPan(),this.element.classList.remove(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!1)}, toggle:function(){this.active?this.deactivate():this.activate()},ignoreTarget:function(c){return c[a]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(!(0!==a.button||this.ignoreTarget(a.target))){if(a.originalTarget)try{a.originalTarget.tagName}catch(c){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove", this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var b=document.activeElement;b&&!b.contains(a.target)&&b.blur()}},_onmousemove:function(a){this.element.removeEventListener("scroll",this._endPan,!0);var b;if("buttons"in a&&c)b=!(a.buttons|1);else if(d||e)b=0===a.which;b?this._endPan():(b=a.clientX-this.clientXStart, this.element.scrollTop=this.scrollTopStart-(a.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-b,this.overlay.parentNode||document.body.appendChild(this.overlay))},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var a;["webkitM","mozM","msM", "oM","m"].some(function(c){c+="atches";c in document.documentElement&&(a=c);c+="Selector";c in document.documentElement&&(a=c);return a});var c=!document.documentMode||9<document.documentMode,g=window.chrome,d=g&&(g.webstore||g.app),e=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return b}(),HandTool={initialize:function(b){var a=b.toggleHandTool;this.handTool=new GrabToPan({element:b.container,onActiveChanged:function(c){a&&(c?(a.title=mozL10n.get("hand_tool_disable.title", null,"Disable hand tool"),a.firstElementChild.textContent=mozL10n.get("hand_tool_disable_label",null,"Disable hand tool")):(a.title=mozL10n.get("hand_tool_enable.title",null,"Enable hand tool"),a.firstElementChild.textContent=mozL10n.get("hand_tool_enable_label",null,"Enable hand tool")))}});a&&(a.addEventListener("click",this.toggle.bind(this),!1),window.addEventListener("localized",function(){Preferences.get("enableHandToolOnLoad").then(function(a){a&&this.handTool.activate()}.bind(this),function(){})}.bind(this)), window.addEventListener("presentationmodechanged",function(a){a.detail.switchInProgress||(a.detail.active?this.enterPresentationMode():this.exitPresentationMode())}.bind(this)))},toggle:function(){this.handTool.toggle();SecondaryToolbar.close()},enterPresentationMode:function(){this.handTool.active&&(this.wasActive=!0,this.handTool.deactivate())},exitPresentationMode:function(){this.wasActive&&(this.wasActive=null,this.handTool.activate())}},OverlayManager={overlays:{},active:null,register:function(b, a,c){return new Promise(function(g){var d,e;if(!b||!(d=document.getElementById(b))||!(e=d.parentNode))throw Error("Not enough parameters.");if(this.overlays[b])throw Error("The overlay is already registered.");this.overlays[b]={element:d,container:e,callerCloseMethod:a||null,canForceClose:c||!1};g()}.bind(this))},unregister:function(b){return new Promise(function(a){if(this.overlays[b]){if(this.active===b)throw Error("The overlay cannot be removed while it is active.");}else throw Error("The overlay does not exist."); delete this.overlays[b];a()}.bind(this))},open:function(b){return new Promise(function(a){if(this.overlays[b]){if(this.active)if(this.overlays[b].canForceClose)this._closeThroughCaller();else{if(this.active===b)throw Error("The overlay is already active.");throw Error("Another overlay is currently active.");}}else throw Error("The overlay does not exist.");this.active=b;this.overlays[this.active].element.classList.remove("hidden");this.overlays[this.active].container.classList.remove("hidden");window.addEventListener("keydown", this._keyDown);a()}.bind(this))},close:function(b){return new Promise(function(a){if(this.overlays[b])if(this.active){if(this.active!==b)throw Error("Another overlay is currently active.");}else throw Error("The overlay is currently not active.");else throw Error("The overlay does not exist.");this.overlays[this.active].container.classList.add("hidden");this.overlays[this.active].element.classList.add("hidden");this.active=null;window.removeEventListener("keydown",this._keyDown);a()}.bind(this))}, _keyDown:function(b){var a=OverlayManager;a.active&&27===b.keyCode&&(a._closeThroughCaller(),b.preventDefault())},_closeThroughCaller:function(){this.overlays[this.active].callerCloseMethod&&this.overlays[this.active].callerCloseMethod();this.active&&this.close(this.active)}},PasswordPrompt={overlayName:null,updatePassword:null,reason:null,passwordField:null,passwordText:null,passwordSubmit:null,passwordCancel:null,initialize:function(b){this.overlayName=b.overlayName;this.passwordField=b.passwordField; this.passwordText=b.passwordText;this.passwordSubmit=b.passwordSubmit;this.passwordCancel=b.passwordCancel;this.passwordSubmit.addEventListener("click",this.verifyPassword.bind(this));this.passwordCancel.addEventListener("click",this.close.bind(this));this.passwordField.addEventListener("keydown",function(a){13===a.keyCode&&this.verifyPassword()}.bind(this));OverlayManager.register(this.overlayName,this.close.bind(this),!0)},open:function(){OverlayManager.open(this.overlayName).then(function(){this.passwordField.focus(); var b=mozL10n.get("password_label",null,"Enter the password to open this PDF file.");this.reason===PDFJS.PasswordResponses.INCORRECT_PASSWORD&&(b=mozL10n.get("password_invalid",null,"Invalid password. Please try again."));this.passwordText.textContent=b}.bind(this))},close:function(){OverlayManager.close(this.overlayName).then(function(){this.passwordField.value=""}.bind(this))},verifyPassword:function(){var b=this.passwordField.value;if(b&&0<b.length)return this.close(),this.updatePassword(b)}}, PDFDocumentProperties=function(){function b(a){this.fields=a.fields;this.overlayName=a.overlayName;this.rawFileSize=0;this.pdfDocument=this.url=null;a.closeButton&&a.closeButton.addEventListener("click",this.close.bind(this));this.dataAvailablePromise=new Promise(function(a){this.resolveDataAvailable=a}.bind(this));OverlayManager.register(this.overlayName,this.close.bind(this))}b.prototype={open:function(){Promise.all([OverlayManager.open(this.overlayName),this.dataAvailablePromise]).then(function(){this._getProperties()}.bind(this))}, close:function(){OverlayManager.close(this.overlayName)},setFileSize:function(a){0<a&&(this.rawFileSize=a)},setDocumentAndUrl:function(a,c){this.pdfDocument=a;this.url=c;this.resolveDataAvailable()},_getProperties:function(){OverlayManager.active&&(this.pdfDocument.getDownloadInfo().then(function(a){a.length!==this.rawFileSize&&(this.setFileSize(a.length),this._updateUI(this.fields.fileSize,this._parseFileSize()))}.bind(this)),this.pdfDocument.getMetadata().then(function(a){var a={fileName:getPDFFileNameFromURL(this.url), fileSize:this._parseFileSize(),title:a.info.Title,author:a.info.Author,subject:a.info.Subject,keywords:a.info.Keywords,creationDate:this._parseDate(a.info.CreationDate),modificationDate:this._parseDate(a.info.ModDate),creator:a.info.Creator,producer:a.info.Producer,version:a.info.PDFFormatVersion,pageCount:this.pdfDocument.numPages},c;for(c in a)this._updateUI(this.fields[c],a[c])}.bind(this)))},_updateUI:function(a,c){a&&void 0!==c&&""!==c&&(a.textContent=c)},_parseFileSize:function(){var a=this.rawFileSize, c=a/1024;if(c)return 1024>c?mozL10n.get("document_properties_kb",{size_kb:(+c.toPrecision(3)).toLocaleString(),size_b:a.toLocaleString()},"{{size_kb}} KB ({{size_b}} bytes)"):mozL10n.get("document_properties_mb",{size_mb:(+(c/1024).toPrecision(3)).toLocaleString(),size_b:a.toLocaleString()},"{{size_mb}} MB ({{size_b}} bytes)")},_parseDate:function(a){var c=a;if(void 0===c)return"";"D:"===c.substring(0,2)&&(c=c.substring(2));var a=parseInt(c.substring(0,4),10),b=parseInt(c.substring(4,6),10)-1,d=parseInt(c.substring(6, 8),10),e=parseInt(c.substring(8,10),10),f=parseInt(c.substring(10,12),10),h=parseInt(c.substring(12,14),10),i=c.substring(14,15),j=parseInt(c.substring(15,17),10),c=parseInt(c.substring(18,20),10);"-"===i?(e+=j,f+=c):"+"===i&&(e-=j,f-=c);b=new Date(Date.UTC(a,b,d,e,f,h));a=b.toLocaleDateString();b=b.toLocaleTimeString();return mozL10n.get("document_properties_date_string",{date:a,time:b},"{{date}}, {{time}}")}};return b}(),PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},IGNORE_CURRENT_POSITION_ON_ZOOM= !1,DEFAULT_CACHE_SIZE=10,CLEANUP_TIMEOUT=3E4,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},PDFRenderingQueue=function(){function b(){this.idleTimeout=this.highestPriorityPage=this.onIdle=this.pdfThumbnailViewer=this.pdfViewer=null;this.isThumbnailViewEnabled=this.printing=!1}b.prototype={setViewer:function(a){this.pdfViewer=a},setThumbnailViewer:function(a){this.pdfThumbnailViewer=a},isHighestPriority:function(a){return this.highestPriorityPage===a.renderingId},renderHighestPriority:function(a){this.idleTimeout&& (clearTimeout(this.idleTimeout),this.idleTimeout=null);if(!(this.pdfViewer.forceRendering(a)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering())&&!this.printing&&this.onIdle)this.idleTimeout=setTimeout(this.onIdle.bind(this),CLEANUP_TIMEOUT)},getHighestPriority:function(a,c,b){var d=a.views,e=d.length;if(0===e)return!1;for(var f=0;f<e;++f){var h=d[f].view;if(!this.isViewFinished(h))return h}a=b?a.last.id:a.first.id-2;return c[a]&&!this.isViewFinished(c[a])? c[a]:null},isViewFinished:function(a){return a.renderingState===RenderingStates.FINISHED},renderView:function(a){switch(a.renderingState){case RenderingStates.FINISHED:return!1;case RenderingStates.PAUSED:this.highestPriorityPage=a.renderingId;a.resume();break;case RenderingStates.RUNNING:this.highestPriorityPage=a.renderingId;break;case RenderingStates.INITIAL:this.highestPriorityPage=a.renderingId;var c=function(){this.renderHighestPriority()}.bind(this);a.draw().then(c,c)}return!0}};return b}(), TEXT_LAYER_RENDER_DELAY=200,PDFPageView=function(){function b(a){var c=a.container,b=a.id,d=a.scale,e=a.defaultViewport,f=a.renderingQueue,h=a.textLayerFactory,a=a.annotationLayerFactory;this.id=b;this.renderingId="page"+b;this.rotation=0;this.scale=d||DEFAULT_SCALE;this.viewport=e;this.pdfPageRotate=e.rotation;this.hasRestrictedScaling=!1;this.renderingQueue=f;this.textLayerFactory=h;this.annotationLayerFactory=a;this.renderingState=RenderingStates.INITIAL;this.annotationLayer=this.zoomLayer=this.textLayer= this.onAfterDraw=this.onBeforeDraw=this.resume=null;b=document.createElement("div");b.id="pageContainer"+this.id;b.className="page";b.style.width=Math.floor(this.viewport.width)+"px";b.style.height=Math.floor(this.viewport.height)+"px";b.setAttribute("data-page-number",this.id);this.div=b;c.appendChild(b)}b.prototype={setPdfPage:function(a){this.pdfPage=a;this.pdfPageRotate=a.rotate;this.viewport=a.getViewport(this.scale*CSS_UNITS,(this.rotation+this.pdfPageRotate)%360);this.stats=a.stats;this.reset()}, destroy:function(){this.zoomLayer=null;this.reset();this.pdfPage&&this.pdfPage.cleanup()},reset:function(a,c){this.renderTask&&this.renderTask.cancel();this.resume=null;this.renderingState=RenderingStates.INITIAL;var b=this.div;b.style.width=Math.floor(this.viewport.width)+"px";b.style.height=Math.floor(this.viewport.height)+"px";for(var d=b.childNodes,e=a&&this.zoomLayer||null,f=c&&this.annotationLayer&&this.annotationLayer.div||null,h=d.length-1;0<=h;h--){var i=d[h];e===i||f===i||b.removeChild(i)}b.removeAttribute("data-loaded"); f?this.annotationLayer.hide():this.annotationLayer=null;this.canvas&&!e&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas);this.loadingIconDiv=document.createElement("div");this.loadingIconDiv.className="loadingIcon";b.appendChild(this.loadingIconDiv)},update:function(a,c){this.scale=a||this.scale;"undefined"!==typeof c&&(this.rotation=c);this.viewport=this.viewport.clone({scale:this.scale*CSS_UNITS,rotation:(this.rotation+this.pdfPageRotate)%360});var b=!1;if(this.canvas&&0<PDFJS.maxCanvasPixels){var d= this.outputScale;Math.sqrt(PDFJS.maxCanvasPixels/(this.viewport.width*this.viewport.height));(Math.floor(this.viewport.width)*d.sx|0)*(Math.floor(this.viewport.height)*d.sy|0)>PDFJS.maxCanvasPixels&&(b=!0)}if(this.canvas){if(PDFJS.useOnlyCssZoom||this.hasRestrictedScaling&&b){this.cssTransform(this.canvas,!0);b=document.createEvent("CustomEvent");b.initCustomEvent("pagerendered",!0,!0,{pageNumber:this.id,cssTransform:!0});this.div.dispatchEvent(b);return}this.zoomLayer||(this.zoomLayer=this.canvas.parentNode, this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform(this.zoomLayer.firstChild);this.reset(!0,!0)},updatePosition:function(){this.textLayer&&this.textLayer.render(TEXT_LAYER_RENDER_DELAY)},cssTransform:function(a,c){var b=PDFJS.CustomStyle,d=this.viewport.width,e=this.viewport.height,f=this.div;a.style.width=a.parentNode.style.width=f.style.width=Math.floor(d)+"px";a.style.height=a.parentNode.style.height=f.style.height=Math.floor(e)+"px";var f=this.viewport.rotation-a._viewport.rotation, h=Math.abs(f),i=1,j=1;if(90===h||270===h)i=e/d,j=d/e;b.setProp("transform",a,"rotate("+f+"deg) scale("+i+","+j+")");if(this.textLayer){h=this.textLayer.viewport;e=Math.abs(this.viewport.rotation-h.rotation);f=d/h.width;if(90===e||270===e)f=d/h.height;var d=this.textLayer.textLayerDiv,k,l;switch(e){case 0:k=l=0;break;case 90:k=0;l="-"+d.style.height;break;case 180:k="-"+d.style.width;l="-"+d.style.height;break;case 270:k="-"+d.style.width;l=0;break;default:console.error("Bad rotation value.")}b.setProp("transform", d,"rotate("+e+"deg) scale("+f+", "+f+") translate("+k+", "+l+")");b.setProp("transformOrigin",d,"0% 0%")}c&&this.annotationLayer&&this.annotationLayer.render(this.viewport,"display")},get width(){return this.viewport.width},get height(){return this.viewport.height},getPagePoint:function(a,c){return this.viewport.convertToPdfPoint(a,c)},draw:function(){function a(a){q===m.renderTask&&(m.renderTask=null);if("cancelled"===a)p(a);else{m.renderingState=RenderingStates.FINISHED;h&&(m.canvas.removeAttribute("hidden"), h=!1);m.loadingIconDiv&&(d.removeChild(m.loadingIconDiv),delete m.loadingIconDiv);if(m.zoomLayer){var b=m.zoomLayer.firstChild;b.width=0;b.height=0;d.removeChild(m.zoomLayer);m.zoomLayer=null}m.error=a;m.stats=c.stats;if(m.onAfterDraw)m.onAfterDraw();b=document.createEvent("CustomEvent");b.initCustomEvent("pagerendered",!0,!0,{pageNumber:m.id,cssTransform:!1});d.dispatchEvent(b);b=document.createEvent("CustomEvent");b.initCustomEvent("pagerender",!0,!0,{pageNumber:c.pageNumber});d.dispatchEvent(b); a?p(a):o(void 0)}}this.renderingState!==RenderingStates.INITIAL&&console.error("Must be in new state before drawing");this.renderingState=RenderingStates.RUNNING;var c=this.pdfPage,b=this.viewport,d=this.div,e=document.createElement("div");e.style.width=d.style.width;e.style.height=d.style.height;e.classList.add("canvasWrapper");var f=document.createElement("canvas");f.id="page"+this.id;f.setAttribute("hidden","hidden");var h=!0;e.appendChild(f);this.annotationLayer&&this.annotationLayer.div?d.insertBefore(e, this.annotationLayer.div):d.appendChild(e);this.canvas=f;f.mozOpaque=!0;var i=f.getContext("2d",{alpha:!1}),j=getOutputScale(i);this.outputScale=j;if(PDFJS.useOnlyCssZoom){var k=b.clone({scale:CSS_UNITS});j.sx*=k.width/b.width;j.sy*=k.height/b.height;j.scaled=!0}0<PDFJS.maxCanvasPixels&&(k=Math.sqrt(PDFJS.maxCanvasPixels/(b.width*b.height)),j.sx>k||j.sy>k?(j.sx=k,j.sy=k,this.hasRestrictedScaling=j.scaled=!0):this.hasRestrictedScaling=!1);var k=approximateFraction(j.sx),l=approximateFraction(j.sy); f.width=roundToDivide(b.width*j.sx,k[0]);f.height=roundToDivide(b.height*j.sy,l[0]);f.style.width=roundToDivide(b.width,k[1])+"px";f.style.height=roundToDivide(b.height,l[1])+"px";f._viewport=b;var n=b=null;this.textLayerFactory&&(b=document.createElement("div"),b.className="textLayer",b.style.width=e.style.width,b.style.height=e.style.height,this.annotationLayer&&this.annotationLayer.div?d.insertBefore(b,this.annotationLayer.div):d.appendChild(b),n=this.textLayerFactory.createTextLayerBuilder(b, this.id-1,this.viewport));this.textLayer=n;var o,p,e=new Promise(function(a,c){o=a;p=c}),m=this,b=null;this.renderingQueue&&(b=function(a){m.renderingQueue.isHighestPriority(m)?(h&&(m.canvas.removeAttribute("hidden"),h=!1),a()):(m.renderingState=RenderingStates.PAUSED,m.resume=function(){m.renderingState=RenderingStates.RUNNING;a()})});var q=this.renderTask=this.pdfPage.render({canvasContext:i,transform:!j.scaled?null:[j.sx,0,0,j.sy,0,0],viewport:this.viewport});q.onContinue=b;this.renderTask.promise.then(function(){a(null); n&&m.pdfPage.getTextContent({normalizeWhitespace:!0}).then(function(a){n.setTextContent(a);n.render(TEXT_LAYER_RENDER_DELAY)})},function(c){a(c)});this.annotationLayerFactory&&(this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(d,this.pdfPage)),this.annotationLayer.render(this.viewport,"display"));d.setAttribute("data-loaded",!0);if(m.onBeforeDraw)m.onBeforeDraw();return e},beforePrint:function(){var a=PDFJS.CustomStyle,c=this.pdfPage,b=c.getViewport(1), d=document.createElement("canvas");d.width=2*Math.floor(b.width);d.height=2*Math.floor(b.height);d.style.width="200%";d.style.height="200%";a.setProp("transform",d,"scale(0.5, 0.5)");a.setProp("transformOrigin",d,"0% 0%");var a=document.getElementById("printContainer"),e=document.createElement("div");e.style.width=b.width+"pt";e.style.height=b.height+"pt";e.appendChild(d);a.appendChild(e);d.mozPrintCallback=function(a){var e=a.context;e.save();e.fillStyle="rgb(255, 255, 255)";e.fillRect(0,0,d.width, d.height);e.restore();e._transformMatrix=[2,0,0,2,0,0];e.scale(2,2);c.render({canvasContext:e,viewport:b,intent:"print"}).promise.then(function(){a.done()},function(c){console.error(c);"abort"in a?a.abort():a.done()})}}};return b}(),TextLayerBuilder=function(){function b(a){this.textLayerDiv=a.textLayerDiv;this.divContentDone=this.renderingDone=!1;this.pageIdx=a.pageIndex;this.pageNumber=this.pageIdx+1;this.matches=[];this.viewport=a.viewport;this.textDivs=[];this.findController=a.findController|| null;this.textLayerRenderTask=null;this._bindMouse()}b.prototype={_finishRendering:function(){this.renderingDone=!0;var a=document.createElement("div");a.className="endOfContent";this.textLayerDiv.appendChild(a);a=document.createEvent("CustomEvent");a.initCustomEvent("textlayerrendered",!0,!0,{pageNumber:this.pageNumber});this.textLayerDiv.dispatchEvent(a)},render:function(a){if(this.divContentDone&&!this.renderingDone){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask= null);this.textDivs=[];var c=document.createDocumentFragment();this.textLayerRenderTask=PDFJS.renderTextLayer({textContent:this.textContent,container:c,viewport:this.viewport,textDivs:this.textDivs,timeout:a});this.textLayerRenderTask.promise.then(function(){this.textLayerDiv.appendChild(c);this._finishRendering();this.updateMatches()}.bind(this),function(){})}},setTextContent:function(a){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null);this.textContent= a;this.divContentDone=!0},convertMatches:function(a){for(var c=0,b=0,d=this.textContent.items,e=d.length-1,f=null===this.findController?0:this.findController.state.query.length,h=[],i=0,j=a.length;i<j;i++){for(var k=a[i];c!==e&&k>=b+d[c].str.length;)b+=d[c].str.length,c++;c===d.length&&console.error("Could not find a matching mapping");for(var l={begin:{divIdx:c,offset:k-b}},k=k+f;c!==e&&k>b+d[c].str.length;)b+=d[c].str.length,c++;l.end={divIdx:c,offset:k-b};h.push(l)}return h},renderMatches:function(a){function c(a, c){var d=a.divIdx;e[d].textContent="";b(d,0,a.offset,c)}function b(a,c,g,f){var h=e[a],a=d[a].str.substring(c,g),a=document.createTextNode(a);f?(c=document.createElement("span"),c.className=f,c.appendChild(a),h.appendChild(c)):h.appendChild(a)}if(0!==a.length){var d=this.textContent.items,e=this.textDivs,f=null,h=this.pageIdx,i=null===this.findController?!1:h===this.findController.selected.pageIdx,j=null===this.findController?-1:this.findController.selected.matchIdx,k=j,l=k+1;if(null===this.findController? 0:this.findController.state.highlightAll)k=0,l=a.length;else if(!i)return;for(;k<l;k++){var n=a[k],o=n.begin,n=n.end,p=i&&k===j?" selected":"";this.findController&&this.findController.updateMatchPosition(h,k,e,o.divIdx,n.divIdx);!f||o.divIdx!==f.divIdx?(null!==f&&b(f.divIdx,f.offset,void 0),c(o)):b(f.divIdx,f.offset,o.offset);if(o.divIdx===n.divIdx)b(o.divIdx,o.offset,n.offset,"highlight"+p);else{b(o.divIdx,o.offset,void 0,"highlight begin"+p);f=o.divIdx+1;for(o=n.divIdx;f<o;f++)e[f].className="highlight middle"+ p;c(n,"highlight end"+p)}f=n}f&&b(f.divIdx,f.offset,void 0)}},updateMatches:function(){if(this.renderingDone){for(var a=this.matches,c=this.textDivs,b=this.textContent.items,d=-1,e=0,f=a.length;e<f;e++){for(var h=a[e],d=Math.max(d,h.begin.divIdx),i=h.end.divIdx;d<=i;d++){var j=c[d];j.textContent=b[d].str;j.className=""}d=h.end.divIdx+1}null!==this.findController&&this.findController.active&&(this.matches=this.convertMatches(null===this.findController?[]:this.findController.pageMatches[this.pageIdx]|| []),this.renderMatches(this.matches))}},_bindMouse:function(){var a=this.textLayerDiv;a.addEventListener("mousedown",function(c){var b=a.querySelector(".endOfContent");if(b){var d=c.target!==a;if(d=d&&"none"!==window.getComputedStyle(b).getPropertyValue("-moz-user-select"))d=a.getBoundingClientRect(),c=Math.max(0,(c.pageY-d.top)/d.height),b.style.top=(100*c).toFixed(2)+"%";b.classList.add("active")}});a.addEventListener("mouseup",function(){var c=a.querySelector(".endOfContent");c&&(c.style.top="", c.classList.remove("active"))})}};return b}();function DefaultTextLayerFactory(){}DefaultTextLayerFactory.prototype={createTextLayerBuilder:function(b,a,c){return new TextLayerBuilder({textLayerDiv:b,pageIndex:a,viewport:c})}}; var AnnotationLayerBuilder=function(){function b(a){this.pageDiv=a.pageDiv;this.pdfPage=a.pdfPage;this.linkService=a.linkService;this.div=null}b.prototype={render:function(a,c){var b=this,d={intent:void 0===c?"display":c};this.pdfPage.getAnnotations(d).then(function(c){a=a.clone({dontFlip:!0});d={viewport:a,div:b.div,annotations:c,page:b.pdfPage,linkService:b.linkService};b.div?PDFJS.AnnotationLayer.update(d):0!==c.length&&(b.div=document.createElement("div"),b.div.className="annotationLayer",b.pageDiv.appendChild(b.div), d.div=b.div,PDFJS.AnnotationLayer.render(d),"undefined"!==typeof mozL10n&&mozL10n.translate(b.div))})},hide:function(){this.div&&this.div.setAttribute("hidden","true")}};return b}();function DefaultAnnotationLayerFactory(){}DefaultAnnotationLayerFactory.prototype={createAnnotationLayerBuilder:function(b,a){return new AnnotationLayerBuilder({pageDiv:b,pdfPage:a,linkService:new SimpleLinkService})}}; var PDFViewer=function(){function b(a){var b=[];this.push=function(d){var e=b.indexOf(d);0<=e&&b.splice(e,1);b.push(d);b.length>a&&b.shift().destroy()};this.resize=function(d){for(a=d;b.length>a;)b.shift().destroy()}}function a(a){this.container=a.container;this.viewer=a.viewer||a.container.firstElementChild;this.linkService=a.linkService||new SimpleLinkService;this.removePageBorders=a.removePageBorders||!1;(this.defaultRenderingQueue=!a.renderingQueue)?(this.renderingQueue=new PDFRenderingQueue, this.renderingQueue.setViewer(this)):this.renderingQueue=a.renderingQueue;this.scroll=watchScroll(this.container,this._scrollUpdate.bind(this));this.updateInProgress=!1;this.presentationModeState=PresentationModeState.UNKNOWN;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders")}a.prototype={get pagesCount(){return this._pages.length},getPageView:function(a){return this._pages[a]},get currentPageNumber(){return this._currentPageNumber},set currentPageNumber(a){if(this.pdfDocument){var b= document.createEvent("UIEvents");b.initUIEvent("pagechange",!0,!0,window,0);b.updateInProgress=this.updateInProgress;0<a&&a<=this.pagesCount?(b.previousPageNumber=this._currentPageNumber,this._currentPageNumber=a,b.pageNumber=a,this.container.dispatchEvent(b),this.updateInProgress||this.scrollPageIntoView(a)):(b.pageNumber=this._currentPageNumber,b.previousPageNumber=a,this.container.dispatchEvent(b))}else this._currentPageNumber=a},get currentScale(){return this._currentScale!==UNKNOWN_SCALE?this._currentScale: DEFAULT_SCALE},set currentScale(a){if(isNaN(a))throw Error("Invalid numeric scale");this.pdfDocument?this._setScale(a,!1):(this._currentScale=a,this._currentScaleValue=a!==UNKNOWN_SCALE?a.toString():null)},get currentScaleValue(){return this._currentScaleValue},set currentScaleValue(a){this.pdfDocument?this._setScale(a,!1):(this._currentScale=isNaN(a)?UNKNOWN_SCALE:a,this._currentScaleValue=a)},get pagesRotation(){return this._pagesRotation},set pagesRotation(a){this._pagesRotation=a;for(var b=0, d=this._pages.length;b<d;b++){var e=this._pages[b];e.update(e.scale,a)}this._setScale(this._currentScaleValue,!0);this.defaultRenderingQueue&&this.update()},setDocument:function(a){this.pdfDocument&&this._resetView();if(this.pdfDocument=a){var b=a.numPages,d=this,e,f=new Promise(function(a){e=a});this.pagesPromise=f;f.then(function(){var a=document.createEvent("CustomEvent");a.initCustomEvent("pagesloaded",!0,!0,{pagesCount:b});d.container.dispatchEvent(a)});var h=!1,i=null,j=new Promise(function(a){i= a});this.onePageRendered=j;var k=function(a){a.onBeforeDraw=function(){d._buffer.push(this)};a.onAfterDraw=function(){h||(h=!0,i())}};this.firstPagePromise=f=a.getPage(1);return f.then(function(f){for(var h=this.currentScale,f=f.getViewport(h*CSS_UNITS),i=1;i<=b;++i){var p=null;PDFJS.disableTextLayer||(p=this);p=new PDFPageView({container:this.viewer,id:i,scale:h,defaultViewport:f.clone(),renderingQueue:this.renderingQueue,textLayerFactory:p,annotationLayerFactory:this});k(p);this._pages.push(p)}var m= this.linkService;j.then(function(){if(PDFJS.disableAutoFetch)e();else for(var f=b,h=1;h<=b;++h)a.getPage(h).then(function(a,b){var c=d._pages[a-1];c.pdfPage||c.setPdfPage(b);m.cachePageRef(a,b.ref);f--;f||e()}.bind(null,h))});h=document.createEvent("CustomEvent");h.initCustomEvent("pagesinit",!0,!0,null);d.container.dispatchEvent(h);this.defaultRenderingQueue&&this.update();this.findController&&this.findController.resolveFirstPage()}.bind(this))}},_resetView:function(){this._pages=[];this._currentPageNumber= 1;this._currentScale=UNKNOWN_SCALE;this._currentScaleValue=null;this._buffer=new b(DEFAULT_CACHE_SIZE);this._location=null;this._pagesRotation=0;this._pagesRequests=[];for(var a=this.viewer;a.hasChildNodes();)a.removeChild(a.lastChild)},_scrollUpdate:function(){if(0!==this.pagesCount){this.update();for(var a=0,b=this._pages.length;a<b;a++)this._pages[a].updatePosition()}},_setScaleDispatchEvent:function(a,b,d){var e=document.createEvent("UIEvents");e.initUIEvent("scalechange",!0,!0,window,0);e.scale= a;d&&(e.presetValue=b);this.container.dispatchEvent(e)},_setScaleUpdatePages:function(a,b,d,e){this._currentScaleValue=b;var f;f=this._currentScale;f=a===f||1.0E-15>Math.abs(a-f)?!0:!1;if(f)e&&this._setScaleDispatchEvent(a,b,!0);else{f=0;for(var h=this._pages.length;f<h;f++)this._pages[f].update(a);this._currentScale=a;if(!d){var d=this._currentPageNumber,i;this._location&&!IGNORE_CURRENT_POSITION_ON_ZOOM&&!this.isInPresentationMode&&!this.isChangingPresentationMode&&(d=this._location.pageNumber, i=[null,{name:"XYZ"},this._location.left,this._location.top,null]);this.scrollPageIntoView(d,i)}this._setScaleDispatchEvent(a,b,e);this.defaultRenderingQueue&&this.update()}},_setScale:function(a,b){var d=parseFloat(a);if(0<d)this._setScaleUpdatePages(d,a,b,!1);else if(d=this._pages[this._currentPageNumber-1]){var e=(this.container.clientWidth-(this.isInPresentationMode||this.removePageBorders?0:SCROLLBAR_PADDING))/d.width*d.scale,f=(this.container.clientHeight-(this.isInPresentationMode||this.removePageBorders? 0:VERTICAL_PADDING))/d.height*d.scale;switch(a){case "page-actual":d=1;break;case "page-width":d=e;break;case "page-height":d=f;break;case "page-fit":d=Math.min(e,f);break;case "auto":d=d.width>d.height?Math.min(f,e):e;d=Math.min(MAX_AUTO_SCALE,d);break;default:console.error("pdfViewSetScale: '"+a+"' is an unknown zoom value.");return}this._setScaleUpdatePages(d,a,b,!0)}},scrollPageIntoView:function(a,b){if(this.pdfDocument){var d=this._pages[a-1];if(this.isInPresentationMode){if(this._currentPageNumber!== d.id){this.currentPageNumber=d.id;return}b=null;this._setScale(this._currentScaleValue,!0)}if(b){var e=0,f=0,h=0,i=0,j,k;k=0===d.rotation%180?!1:!0;j=(k?d.height:d.width)/d.scale/CSS_UNITS;k=(k?d.width:d.height)/d.scale/CSS_UNITS;var l=0;switch(b[1].name){case "XYZ":e=b[2];f=b[3];l=b[4];e=null!==e?e:0;f=null!==f?f:k;break;case "Fit":case "FitB":l="page-fit";break;case "FitH":case "FitBH":f=b[2];l="page-width";null===f&&this._location&&(e=this._location.left,f=this._location.top);break;case "FitV":case "FitBV":e= b[2];h=j;i=k;l="page-height";break;case "FitR":e=b[2];f=b[3];h=b[4]-e;i=b[5]-f;k=this.removePageBorders?0:VERTICAL_PADDING;j=(this.container.clientWidth-(this.removePageBorders?0:SCROLLBAR_PADDING))/h/CSS_UNITS;k=(this.container.clientHeight-k)/i/CSS_UNITS;l=Math.min(Math.abs(j),Math.abs(k));break;default:return}l&&l!==this._currentScale?this.currentScaleValue=l:this._currentScale===UNKNOWN_SCALE&&(this.currentScaleValue=DEFAULT_SCALE_VALUE);"page-fit"===l&&!b[4]?scrollIntoView(d.div):(f=[d.viewport.convertToViewportPoint(e, f),d.viewport.convertToViewportPoint(e+h,f+i)],e=Math.min(f[0][0],f[1][0]),f=Math.min(f[0][1],f[1][1]),scrollIntoView(d.div,{left:e,top:f}))}else scrollIntoView(d.div)}},_updateLocation:function(a){var b=this._currentScale,d=this._currentScaleValue,b=parseFloat(d)===b?Math.round(1E4*b)/100:d,d=a.id,e;e="#page="+d+("&zoom="+b);var f=this.container,f=this._pages[d-1].getPagePoint(f.scrollLeft-a.x,f.scrollTop-a.y),a=Math.round(f[0]),f=Math.round(f[1]);this._location={pageNumber:d,scale:b,top:f,left:a, pdfOpenParams:e+(","+a+","+f)}},update:function(){var a=this._getVisiblePages(),b=a.views;if(0!==b.length){this.updateInProgress=!0;this._buffer.resize(Math.max(DEFAULT_CACHE_SIZE,2*b.length+1));this.renderingQueue.renderHighestPriority(a);for(var d=this._currentPageNumber,a=a.first,e=0,f=b.length,h=!1;e<f;++e){var i=b[e];if(100>i.percent)break;if(i.id===d){h=!0;break}}h||(d=b[0].id);this.isInPresentationMode||(this.currentPageNumber=d);this._updateLocation(a);this.updateInProgress=!1;b=document.createEvent("UIEvents"); b.initUIEvent("updateviewarea",!0,!0,window,0);b.location=this._location;this.container.dispatchEvent(b)}},containsElement:function(a){return this.container.contains(a)},focus:function(){this.container.focus()},get isInPresentationMode(){return this.presentationModeState===PresentationModeState.FULLSCREEN},get isChangingPresentationMode(){return this.presentationModeState===PresentationModeState.CHANGING},get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth> this.container.clientWidth},_getVisiblePages:function(){if(this.isInPresentationMode){var a=[],b=this._pages[this._currentPageNumber-1];a.push({id:b.id,view:b});return{first:b,last:b,views:a}}return getVisibleElements(this.container,this._pages,!0)},cleanup:function(){for(var a=0,b=this._pages.length;a<b;a++)this._pages[a]&&this._pages[a].renderingState!==RenderingStates.FINISHED&&this._pages[a].reset()},_ensurePdfPageLoaded:function(a){if(a.pdfPage)return Promise.resolve(a.pdfPage);var b=a.id;if(this._pagesRequests[b])return this._pagesRequests[b]; var d=this.pdfDocument.getPage(b).then(function(d){a.setPdfPage(d);this._pagesRequests[b]=null;return d}.bind(this));return this._pagesRequests[b]=d},forceRendering:function(a){var b=this.renderingQueue.getHighestPriority(a||this._getVisiblePages(),this._pages,this.scroll.down);return b?(this._ensurePdfPageLoaded(b).then(function(){this.renderingQueue.renderView(b)}.bind(this)),!0):!1},getPageTextContent:function(a){return this.pdfDocument.getPage(a+1).then(function(a){return a.getTextContent({normalizeWhitespace:!0})})}, createTextLayerBuilder:function(a,b,d){return new TextLayerBuilder({textLayerDiv:a,pageIndex:b,viewport:d,findController:this.isInPresentationMode?null:this.findController})},createAnnotationLayerBuilder:function(a,b){return new AnnotationLayerBuilder({pageDiv:a,pdfPage:b,linkService:this.linkService})},setFindController:function(a){this.findController=a}};return a}(),SimpleLinkService=function(){function b(){}b.prototype={get page(){return 0},set page(a){},navigateTo:function(){},getDestinationHash:function(){return"#"}, getAnchorUrl:function(){return"#"},setHash:function(){},executeNamedAction:function(){},cachePageRef:function(){}};return b}(),THUMBNAIL_SCROLL_MARGIN=-19,THUMBNAIL_WIDTH=98,THUMBNAIL_CANVAS_BORDER_WIDTH=1,PDFThumbnailView=function(){function b(a){var b=a.container,g=a.id,d=a.defaultViewport,e=a.linkService,a=a.renderingQueue;this.id=g;this.renderingId="thumbnail"+g;this.pdfPage=null;this.rotation=0;this.viewport=d;this.pdfPageRotate=d.rotation;this.linkService=e;this.renderingQueue=a;this.hasImage= !1;this.resume=null;this.renderingState=RenderingStates.INITIAL;this.pageWidth=this.viewport.width;this.pageHeight=this.viewport.height;this.pageRatio=this.pageWidth/this.pageHeight;this.canvasWidth=THUMBNAIL_WIDTH;this.canvasHeight=this.canvasWidth/this.pageRatio|0;this.scale=this.canvasWidth/this.pageWidth;d=document.createElement("a");d.href=e.getAnchorUrl("#page="+g);d.title=mozL10n.get("thumb_page_title",{page:g},"Page {{page}}");d.onclick=function(){e.page=g;return!1};a=document.createElement("div"); a.id="thumbnailContainer"+g;a.className="thumbnail";this.div=a;1===g&&a.classList.add("selected");var f=document.createElement("div");f.className="thumbnailSelectionRing";var h=2*THUMBNAIL_CANVAS_BORDER_WIDTH;f.style.width=this.canvasWidth+h+"px";f.style.height=this.canvasHeight+h+"px";this.ring=f;a.appendChild(f);d.appendChild(a);b.appendChild(d)}b.prototype={setPdfPage:function(a){this.pdfPage=a;this.pdfPageRotate=a.rotate;this.viewport=a.getViewport(1,(this.rotation+this.pdfPageRotate)%360);this.reset()}, reset:function(){this.renderTask&&this.renderTask.cancel();this.hasImage=!1;this.resume=null;this.renderingState=RenderingStates.INITIAL;this.pageWidth=this.viewport.width;this.pageHeight=this.viewport.height;this.pageRatio=this.pageWidth/this.pageHeight;this.canvasHeight=this.canvasWidth/this.pageRatio|0;this.scale=this.canvasWidth/this.pageWidth;this.div.removeAttribute("data-loaded");for(var a=this.ring,b=a.childNodes,g=b.length-1;0<=g;g--)a.removeChild(b[g]);b=2*THUMBNAIL_CANVAS_BORDER_WIDTH; a.style.width=this.canvasWidth+b+"px";a.style.height=this.canvasHeight+b+"px";this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas);this.image&&(this.image.removeAttribute("src"),delete this.image)},update:function(a){"undefined"!==typeof a&&(this.rotation=a);this.viewport=this.viewport.clone({scale:1,rotation:(this.rotation+this.pdfPageRotate)%360});this.reset()},_getPageDrawContext:function(a){var b=document.createElement("canvas");this.canvas=b;b.mozOpaque=!0;var g=b.getContext("2d", {alpha:!1}),d=getOutputScale(g);b.width=this.canvasWidth*d.sx|0;b.height=this.canvasHeight*d.sy|0;b.style.width=this.canvasWidth+"px";b.style.height=this.canvasHeight+"px";!a&&d.scaled&&g.scale(d.sx,d.sy);this.image=a=document.createElement("img");a.id=this.renderingId;a.className="thumbnailImage";a.setAttribute("aria-label",mozL10n.get("thumb_page_canvas",{page:this.id},"Thumbnail of Page {{page}}"));a.style.width=b.style.width;a.style.height=b.style.height;return g},_convertCanvasToImage:function(){this.canvas&& (this.image.src=this.canvas.toDataURL(),this.div.setAttribute("data-loaded",!0),this.ring.appendChild(this.image),this.canvas.width=0,this.canvas.height=0,delete this.canvas)},draw:function(){function a(a){i===e.renderTask&&(e.renderTask=null);"cancelled"===a?g(a):(e.renderingState=RenderingStates.FINISHED,e._convertCanvasToImage(),a?g(a):b(void 0))}this.renderingState!==RenderingStates.INITIAL&&console.error("Must be in new state before drawing");if(this.hasImage)return Promise.resolve(void 0);this.hasImage= !0;this.renderingState=RenderingStates.RUNNING;var b,g,d=new Promise(function(a,d){b=a;g=d}),e=this,f=this._getPageDrawContext(),h=this.viewport.clone({scale:this.scale}),i=this.renderTask=this.pdfPage.render({canvasContext:f,viewport:h});i.onContinue=function(a){e.renderingQueue.isHighestPriority(e)?a():(e.renderingState=RenderingStates.PAUSED,e.resume=function(){e.renderingState=RenderingStates.RUNNING;a()})};i.promise.then(function(){a(null)},function(b){a(b)});return d},setImage:function(a){var c= a.canvas;if(!this.hasImage&&c){this.pdfPage||this.setPdfPage(a.pdfPage);this.hasImage=!0;this.renderingState=RenderingStates.FINISHED;var a=this._getPageDrawContext(!0),g=a.canvas;if(c.width<=2*g.width)a.drawImage(c,0,0,c.width,c.height,0,0,g.width,g.height);else{var d=g.width<<3,e=g.height<<3,f;f=d;var h=e,i=b.tempImageCache;i||(i=document.createElement("canvas"),b.tempImageCache=i);i.width=f;i.height=h;i.mozOpaque=!0;var j=i.getContext("2d",{alpha:!1});j.save();j.fillStyle="rgb(255, 255, 255)"; j.fillRect(0,0,f,h);j.restore();f=i;for(h=f.getContext("2d");d>c.width||e>c.height;)d>>=1,e>>=1;for(h.drawImage(c,0,0,c.width,c.height,0,0,d,e);d>2*g.width;)h.drawImage(f,0,0,d,e,0,0,d>>1,e>>1),d>>=1,e>>=1;a.drawImage(f,0,0,d,e,0,0,g.width,g.height)}this._convertCanvasToImage()}}};return b}();PDFThumbnailView.tempImageCache=null; var PDFThumbnailViewer=function(){function b(a){this.container=a.container;this.renderingQueue=a.renderingQueue;this.linkService=a.linkService;this.scroll=watchScroll(this.container,this._scrollUpdated.bind(this));this._resetView()}b.prototype={_scrollUpdated:function(){this.renderingQueue.renderHighestPriority()},getThumbnail:function(a){return this.thumbnails[a]},_getVisibleThumbs:function(){return getVisibleElements(this.container,this.thumbnails)},scrollThumbnailIntoView:function(a){var b=document.querySelector(".thumbnail.selected"); b&&b.classList.remove("selected");(b=document.getElementById("thumbnailContainer"+a))&&b.classList.add("selected");var g=this._getVisibleThumbs(),d=g.views.length;if(0<d){var e=g.first.id,g=1<d?g.last.id:e;(a<=e||a>=g)&&scrollIntoView(b,{top:THUMBNAIL_SCROLL_MARGIN})}},get pagesRotation(){return this._pagesRotation},set pagesRotation(a){this._pagesRotation=a;for(var b=0,g=this.thumbnails.length;b<g;b++)this.thumbnails[b].update(a)},cleanup:function(){var a=PDFThumbnailView.tempImageCache;a&&(a.width= 0,a.height=0);PDFThumbnailView.tempImageCache=null},_resetView:function(){this.thumbnails=[];this._pagesRotation=0;this._pagesRequests=[]},setDocument:function(a){if(this.pdfDocument){for(var b=this.container;b.hasChildNodes();)b.removeChild(b.lastChild);this._resetView()}this.pdfDocument=a;return!a?Promise.resolve():a.getPage(1).then(function(b){for(var c=a.numPages,b=b.getViewport(1),e=1;e<=c;++e)this.thumbnails.push(new PDFThumbnailView({container:this.container,id:e,defaultViewport:b.clone(), linkService:this.linkService,renderingQueue:this.renderingQueue}))}.bind(this))},_ensurePdfPageLoaded:function(a){if(a.pdfPage)return Promise.resolve(a.pdfPage);var b=a.id;if(this._pagesRequests[b])return this._pagesRequests[b];var g=this.pdfDocument.getPage(b).then(function(d){a.setPdfPage(d);this._pagesRequests[b]=null;return d}.bind(this));return this._pagesRequests[b]=g},ensureThumbnailVisible:function(a){scrollIntoView(document.getElementById("thumbnailContainer"+a))},forceRendering:function(){var a= this.renderingQueue.getHighestPriority(this._getVisibleThumbs(),this.thumbnails,this.scroll.down);return a?(this._ensurePdfPageLoaded(a).then(function(){this.renderingQueue.renderView(a)}.bind(this)),!0):!1}};return b}(),PDFOutlineView=function(){function b(a){this.container=a.container;this.outline=a.outline;this.linkService=a.linkService;this.lastToggleIsShow=!0}b.prototype={reset:function(){for(var a=this.container;a.firstChild;)a.removeChild(a.firstChild);this.lastToggleIsShow=!0},_dispatchEvent:function(a){var b= document.createEvent("CustomEvent");b.initCustomEvent("outlineloaded",!0,!0,{outlineCount:a});this.container.dispatchEvent(b)},_bindLink:function(a,b){var g=this.linkService;a.href=g.getDestinationHash(b.dest);a.onclick=function(){g.navigateTo(b.dest);return!1}},_addToggleButton:function(a){var b=document.createElement("div");b.className="outlineItemToggler";b.onclick=function(g){g.stopPropagation();b.classList.toggle("outlineItemsHidden");g.shiftKey&&(g=!b.classList.contains("outlineItemsHidden"), this._toggleOutlineItem(a,g))}.bind(this);a.insertBefore(b,a.firstChild)},_toggleOutlineItem:function(a,b){this.lastToggleIsShow=b;for(var g=a.querySelectorAll(".outlineItemToggler"),d=0,e=g.length;d<e;++d)g[d].classList[b?"remove":"add"]("outlineItemsHidden")},toggleOutlineTree:function(){this._toggleOutlineItem(this.container,!this.lastToggleIsShow)},render:function(){var a=this.outline,b=0;this.reset();if(a){for(var a=document.createDocumentFragment(),g=[{parent:a,items:this.outline}],d=!1;0<g.length;)for(var e= g.shift(),f=0,h=e.items.length;f<h;f++){var i=e.items[f],j=document.createElement("div");j.className="outlineItem";var k=document.createElement("a");this._bindLink(k,i);k.textContent=PDFJS.removeNullCharacters(i.title);j.appendChild(k);0<i.items.length&&(d=!0,this._addToggleButton(j),k=document.createElement("div"),k.className="outlineItems",j.appendChild(k),g.push({parent:k,items:i.items}));e.parent.appendChild(j);b++}d&&this.container.classList.add("outlineWithDeepNesting");this.container.appendChild(a)}this._dispatchEvent(b)}}; return b}(),PDFAttachmentView=function(){function b(a){this.container=a.container;this.attachments=a.attachments;this.downloadManager=a.downloadManager}b.prototype={reset:function(){for(var a=this.container;a.firstChild;)a.removeChild(a.firstChild)},_dispatchEvent:function(a){var b=document.createEvent("CustomEvent");b.initCustomEvent("attachmentsloaded",!0,!0,{attachmentsCount:a});this.container.dispatchEvent(b)},_bindLink:function(a,b,g){a.onclick=function(){this.downloadManager.downloadData(b, g,"");return!1}.bind(this)},render:function(){var a=this.attachments,b=0;this.reset();if(a)for(var g=Object.keys(a).sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())}),b=g.length,d=0;d<b;d++){var e=a[g[d]],f=getFileName(e.filename),h=document.createElement("div");h.className="attachmentsItem";var i=document.createElement("button");this._bindLink(i,e.content,f);i.textContent=PDFJS.removeNullCharacters(f);h.appendChild(i);this.container.appendChild(h)}this._dispatchEvent(b)}}; return b}(),PDFViewerApplication={initialBookmark:document.location.hash.substring(1),initialDestination:null,initialized:!1,fellback:!1,pdfDocument:null,pdfLoadingTask:null,sidebarOpen:!1,printing:!1,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pageRotation:0,isInitialViewSet:!1,animationStartedPromise:null,preferenceSidebarViewOnLoad:SidebarView.NONE,preferencePdfBugEnabled:!1,preferenceShowPreviousViewOnLoad:!0, preferenceDefaultZoomValue:"",isViewerEmbedded:window.parent!==window,url:"",initialize:function(){var b=new PDFRenderingQueue;b.onIdle=this.cleanup.bind(this);this.pdfRenderingQueue=b;var a=new PDFLinkService;this.pdfLinkService=a;var c=document.getElementById("viewerContainer"),g=document.getElementById("viewer");this.pdfViewer=new PDFViewer({container:c,viewer:g,renderingQueue:b,linkService:a});b.setViewer(this.pdfViewer);a.setViewer(this.pdfViewer);var d=document.getElementById("thumbnailView"); this.pdfThumbnailViewer=new PDFThumbnailViewer({container:d,renderingQueue:b,linkService:a});b.setThumbnailViewer(this.pdfThumbnailViewer);Preferences.initialize();this.pdfHistory=new PDFHistory({linkService:a});a.setHistory(this.pdfHistory);this.findController=new PDFFindController({pdfViewer:this.pdfViewer,integratedFind:this.supportsIntegratedFind});this.pdfViewer.setFindController(this.findController);this.findBar=new PDFFindBar({bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"), findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findStatusIcon:document.getElementById("findStatusIcon"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext"),findController:this.findController});this.findController.setFindBar(this.findBar); HandTool.initialize({container:c,toggleHandTool:document.getElementById("toggleHandTool")});this.pdfDocumentProperties=new PDFDocumentProperties({overlayName:"documentPropertiesOverlay",closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"), creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField")}});SecondaryToolbar.initialize({toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"), openFile:document.getElementById("secondaryOpenFile"),print:document.getElementById("secondaryPrint"),download:document.getElementById("secondaryDownload"),viewBookmark:document.getElementById("secondaryViewBookmark"),firstPage:document.getElementById("firstPage"),lastPage:document.getElementById("lastPage"),pageRotateCw:document.getElementById("pageRotateCw"),pageRotateCcw:document.getElementById("pageRotateCcw"),documentPropertiesButton:document.getElementById("documentProperties")});this.supportsFullscreen&& (b=SecondaryToolbar,this.pdfPresentationMode=new PDFPresentationMode({container:c,viewer:g,pdfViewer:this.pdfViewer,pdfThumbnailViewer:this.pdfThumbnailViewer,contextMenuItems:[{element:document.getElementById("contextFirstPage"),handler:b.firstPageClick.bind(b)},{element:document.getElementById("contextLastPage"),handler:b.lastPageClick.bind(b)},{element:document.getElementById("contextPageRotateCw"),handler:b.pageRotateCwClick.bind(b)},{element:document.getElementById("contextPageRotateCcw"),handler:b.pageRotateCcwClick.bind(b)}]})); PasswordPrompt.initialize({overlayName:"passwordOverlay",passwordField:document.getElementById("password"),passwordText:document.getElementById("passwordText"),passwordSubmit:document.getElementById("passwordSubmit"),passwordCancel:document.getElementById("passwordCancel")});var e=this;return Promise.all([Preferences.get("enableWebGL").then(function(a){PDFJS.disableWebGL=!a}),Preferences.get("sidebarViewOnLoad").then(function(a){e.preferenceSidebarViewOnLoad=a}),Preferences.get("pdfBugEnabled").then(function(a){e.preferencePdfBugEnabled= a}),Preferences.get("showPreviousViewOnLoad").then(function(a){e.preferenceShowPreviousViewOnLoad=a}),Preferences.get("defaultZoomValue").then(function(a){e.preferenceDefaultZoomValue=a}),Preferences.get("disableTextLayer").then(function(a){!0!==PDFJS.disableTextLayer&&(PDFJS.disableTextLayer=a)}),Preferences.get("disableRange").then(function(a){!0!==PDFJS.disableRange&&(PDFJS.disableRange=a)}),Preferences.get("disableStream").then(function(a){!0!==PDFJS.disableStream&&(PDFJS.disableStream=a)}),Preferences.get("disableAutoFetch").then(function(a){PDFJS.disableAutoFetch= a}),Preferences.get("disableFontFace").then(function(a){!0!==PDFJS.disableFontFace&&(PDFJS.disableFontFace=a)}),Preferences.get("useOnlyCssZoom").then(function(a){PDFJS.useOnlyCssZoom=a}),Preferences.get("externalLinkTarget").then(function(a){PDFJS.isExternalLinkTargetSet()||(PDFJS.externalLinkTarget=a)})]).catch(function(){}).then(function(){e.isViewerEmbedded&&!PDFJS.isExternalLinkTargetSet()&&(PDFJS.externalLinkTarget=PDFJS.LinkTarget.TOP);e.initialized=!0})},zoomIn:function(b){var a=this.pdfViewer.currentScale; do a=(a*DEFAULT_SCALE_DELTA).toFixed(2),a=Math.ceil(10*a)/10,a=Math.min(MAX_SCALE,a);while(0<--b&&a<MAX_SCALE);this.pdfViewer.currentScaleValue=a},zoomOut:function(b){var a=this.pdfViewer.currentScale;do a=(a/DEFAULT_SCALE_DELTA).toFixed(2),a=Math.floor(10*a)/10,a=Math.max(MIN_SCALE,a);while(0<--b&&a>MIN_SCALE);this.pdfViewer.currentScaleValue=a},get pagesCount(){return this.pdfDocument.numPages},set page(b){this.pdfLinkService.page=b},get page(){return this.pdfLinkService.page},get supportsPrinting(){var b= "mozPrintCallback"in document.createElement("canvas");return PDFJS.shadow(this,"supportsPrinting",b)},get supportsFullscreen(){var b=document.documentElement,b=!(!b.requestFullscreen&&!b.mozRequestFullScreen&&!b.webkitRequestFullScreen&&!b.msRequestFullscreen);if(!1===document.fullscreenEnabled||!1===document.mozFullScreenEnabled||!1===document.webkitFullscreenEnabled||!1===document.msFullscreenEnabled)b=!1;b&&!0===PDFJS.disableFullscreen&&(b=!1);return PDFJS.shadow(this,"supportsFullscreen",b)}, get supportsIntegratedFind(){return PDFJS.shadow(this,"supportsIntegratedFind",!1)},get supportsDocumentFonts(){return PDFJS.shadow(this,"supportsDocumentFonts",!0)},get supportsDocumentColors(){return PDFJS.shadow(this,"supportsDocumentColors",!0)},get loadingBar(){var b=new ProgressBar("#loadingBar",{});return PDFJS.shadow(this,"loadingBar",b)},get supportedMouseWheelZoomModifierKeys(){return PDFJS.shadow(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})},setTitleUsingUrl:function(b){this.url= b;try{this.setTitle(decodeURIComponent(getFileName(b))||b)}catch(a){this.setTitle(b)}},setTitle:function(b){this.isViewerEmbedded||(document.title=b)},close:function(){document.getElementById("errorWrapper").setAttribute("hidden","true");if(!this.pdfLoadingTask)return Promise.resolve();var b=this.pdfLoadingTask.destroy();this.pdfLoadingTask=null;this.pdfDocument&&(this.pdfDocument=null,this.pdfThumbnailViewer.setDocument(null),this.pdfViewer.setDocument(null),this.pdfLinkService.setDocument(null, null));"undefined"!==typeof PDFBug&&PDFBug.cleanup();return b},open:function(b,a){var c=0;if(2<arguments.length||"number"===typeof a)console.warn("Call of open() with obsolete signature."),"number"===typeof a&&(c=a),a=arguments[4]||null,arguments[3]&&"object"===typeof arguments[3]&&(a=Object.create(a),a.range=arguments[3]),"string"===typeof arguments[2]&&(a=Object.create(a),a.password=arguments[2]);if(this.pdfLoadingTask)return this.close().then(function(){Preferences.reload();return this.open(b, a)}.bind(this));var g=Object.create(null);"string"===typeof b?(this.setTitleUsingUrl(b),g.url=b):b&&"byteLength"in b?g.data=b:b.url&&b.originalUrl&&(this.setTitleUsingUrl(b.originalUrl),g.url=b.url);if(a)for(var d in a)g[d]=a[d];var e=this;e.downloadComplete=!1;this.pdfLoadingTask=g=PDFJS.getDocument(g);g.onPassword=function(a,b){PasswordPrompt.updatePassword=a;PasswordPrompt.reason=b;PasswordPrompt.open()};g.onProgress=function(a){e.progress(a.loaded/a.total)};g.onUnsupportedFeature=this.fallback.bind(this); g=g.promise.then(function(a){e.load(a,c)},function(a){var b=a&&a.message,c=mozL10n.get("loading_error",null,"An error occurred while loading the PDF.");a instanceof PDFJS.InvalidPDFException?c=mozL10n.get("invalid_file_error",null,"Invalid or corrupted PDF file."):a instanceof PDFJS.MissingPDFException?c=mozL10n.get("missing_file_error",null,"Missing PDF file."):a instanceof PDFJS.UnexpectedResponseException&&(c=mozL10n.get("unexpected_response_error",null,"Unexpected server response."));e.error(c, {message:b});throw Error(c);});a&&a.length&&PDFViewerApplication.pdfDocumentProperties.setFileSize(a.length);return g},download:function(){function b(){g.downloadUrl(a,c)}var a=this.url.split("#")[0],c=getPDFFileNameFromURL(a),g=new DownloadManager;g.onerror=function(){PDFViewerApplication.error("PDF failed to download.")};this.pdfDocument?this.downloadComplete?this.pdfDocument.getData().then(function(b){b=PDFJS.createBlob(b,"application/pdf");g.download(b,a,c)},b).then(null,b):b():b()},fallback:function(){}, error:function(b,a){var c=mozL10n.get("error_version_info",{version:PDFJS.version||"?",build:PDFJS.build||"?"},"PDF.js v{{version}} (build: {{build}})")+"\n";a&&(c+=mozL10n.get("error_message",{message:a.message},"Message: {{message}}"),a.stack?c+="\n"+mozL10n.get("error_stack",{stack:a.stack},"Stack: {{stack}}"):(a.filename&&(c+="\n"+mozL10n.get("error_file",{file:a.filename},"File: {{file}}")),a.lineNumber&&(c+="\n"+mozL10n.get("error_line",{line:a.lineNumber},"Line: {{line}}"))));var g=document.getElementById("errorWrapper"); g.removeAttribute("hidden");document.getElementById("errorMessage").textContent=b;var d=document.getElementById("errorClose");d.onclick=function(){g.setAttribute("hidden","true")};var e=document.getElementById("errorMoreInfo"),f=document.getElementById("errorShowMore"),h=document.getElementById("errorShowLess");f.onclick=function(){e.removeAttribute("hidden");f.setAttribute("hidden","true");h.removeAttribute("hidden");e.style.height=e.scrollHeight+"px"};h.onclick=function(){e.setAttribute("hidden", "true");f.removeAttribute("hidden");h.setAttribute("hidden","true")};f.oncontextmenu=noContextMenuHandler;h.oncontextmenu=noContextMenuHandler;d.oncontextmenu=noContextMenuHandler;f.removeAttribute("hidden");h.setAttribute("hidden","true");e.value=c},progress:function(b){b=Math.round(100*b);if(b>this.loadingBar.percent||isNaN(b))this.loadingBar.percent=b,PDFJS.disableAutoFetch&&b&&(this.disableAutoFetchLoadingBarTimeout&&(clearTimeout(this.disableAutoFetchLoadingBarTimeout),this.disableAutoFetchLoadingBarTimeout= null),this.loadingBar.show(),this.disableAutoFetchLoadingBarTimeout=setTimeout(function(){this.loadingBar.hide();this.disableAutoFetchLoadingBarTimeout=null}.bind(this),DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT))},load:function(b,a){var c=this,a=a||UNKNOWN_SCALE;this.findController.reset();this.pdfDocument=b;this.pdfDocumentProperties.setDocumentAndUrl(b,this.url);var g=b.getDownloadInfo().then(function(){c.downloadComplete=!0;c.loadingBar.hide()}),d=b.numPages;document.getElementById("numPages").textContent= mozL10n.get("page_of",{pageCount:d},"of {{pageCount}}");document.getElementById("pageNumber").max=d;var d=this.documentFingerprint=b.fingerprint,e=this.store=new ViewHistory(d);this.pdfLinkService.setDocument(b,null);var f=this.pdfViewer;f.currentScale=a;f.setDocument(b);var d=f.firstPagePromise,h=f.pagesPromise,f=f.onePageRendered;this.pageRotation=0;this.isInitialViewSet=!1;this.pdfThumbnailViewer.setDocument(b);d.then(function(){g.then(function(){var a=document.createEvent("CustomEvent");a.initCustomEvent("documentload", !0,!0,{});window.dispatchEvent(a)});c.loadingBar.setWidth(document.getElementById("viewer"));!PDFJS.disableHistory&&!c.isViewerEmbedded&&(c.preferenceShowPreviousViewOnLoad||c.pdfHistory.clearHistoryState(),c.pdfHistory.initialize(c.documentFingerprint),c.pdfHistory.initialDestination?c.initialDestination=c.pdfHistory.initialDestination:c.pdfHistory.initialBookmark&&(c.initialBookmark=c.pdfHistory.initialBookmark));var b=c.initialDestination,d=c.initialBookmark,f=null;e.initializedPromise.then(function(){var b= null;if(c.preferenceShowPreviousViewOnLoad&&e.get("exists",!1))var b=e.get("page","1"),d=c.preferenceDefaultZoomValue||e.get("zoom",DEFAULT_SCALE_VALUE),g=e.get("scrollLeft","0"),h=e.get("scrollTop","0"),b="page="+b+"&zoom="+d+","+g+","+h;else c.preferenceDefaultZoomValue&&(b="page=1&zoom="+c.preferenceDefaultZoomValue);c.setInitialView(b,a);f=b;c.isViewerEmbedded||c.pdfViewer.focus()},function(b){console.error(b);c.setInitialView(null,a)});h.then(function(){!b&&!d&&!f||c.hasEqualPageSizes||(c.initialDestination= b,c.initialBookmark=d,c.pdfViewer.currentScaleValue=c.pdfViewer.currentScaleValue,c.setInitialView(f,a))})});h.then(function(){c.supportsPrinting&&b.getJavaScript().then(function(a){a.length&&(console.warn("Warning: JavaScript is not supported"),c.fallback(PDFJS.UNSUPPORTED_FEATURES.javaScript));for(var b=/\bprint\s*\(/,d=0,e=a.length;d<e;d++){var f=a[d];if(f&&b.test(f)){setTimeout(function(){window.print()});break}}})});Promise.all([h,this.animationStartedPromise]).then(function(){b.getOutline().then(function(a){var b= document.getElementById("outlineView");c.outline=new PDFOutlineView({container:b,outline:a,linkService:c.pdfLinkService});c.outline.render();document.getElementById("viewOutline").disabled=!a;!a&&!b.classList.contains("hidden")&&c.switchSidebarView("thumbs");a&&c.preferenceSidebarViewOnLoad===SidebarView.OUTLINE&&c.switchSidebarView("outline",!0)});b.getAttachments().then(function(a){var b=document.getElementById("attachmentsView");c.attachments=new PDFAttachmentView({container:b,attachments:a,downloadManager:new DownloadManager}); c.attachments.render();document.getElementById("viewAttachments").disabled=!a;!a&&!b.classList.contains("hidden")&&c.switchSidebarView("thumbs");a&&c.preferenceSidebarViewOnLoad===SidebarView.ATTACHMENTS&&c.switchSidebarView("attachments",!0)})});c.preferenceSidebarViewOnLoad===SidebarView.THUMBS&&Promise.all([d,f]).then(function(){c.switchSidebarView("thumbs",!0)});b.getMetadata().then(function(a){var d=a.info,a=a.metadata;c.documentInfo=d;c.metadata=a;console.log("PDF "+b.fingerprint+" ["+d.PDFFormatVersion+ " "+(d.Producer||"-").trim()+" / "+(d.Creator||"-").trim()+"] (PDF.js: "+(PDFJS.version||"-")+(!PDFJS.disableWebGL?" [WebGL]":"")+")");var e;a&&a.has("dc:title")&&(a=a.get("dc:title"),"Untitled"!==a&&(e=a));!e&&d&&d.Title&&(e=d.Title);e&&c.setTitle(e+" - "+document.title);d.IsAcroFormPresent&&(console.warn("Warning: AcroForm/XFA is not supported"),c.fallback(PDFJS.UNSUPPORTED_FEATURES.forms))})},setInitialView:function(b,a){this.isInitialViewSet=!0;document.getElementById("pageNumber").value=this.pdfViewer.currentPageNumber; this.initialDestination?(this.pdfLinkService.navigateTo(this.initialDestination),this.initialDestination=null):this.initialBookmark?(this.pdfLinkService.setHash(this.initialBookmark),this.pdfHistory.push({hash:this.initialBookmark},!0),this.initialBookmark=null):b?this.pdfLinkService.setHash(b):a&&(this.pdfViewer.currentScaleValue=a,this.page=1);this.pdfViewer.currentScaleValue||(this.pdfViewer.currentScaleValue=DEFAULT_SCALE_VALUE)},cleanup:function(){this.pdfDocument&&(this.pdfViewer.cleanup(), this.pdfThumbnailViewer.cleanup(),this.pdfDocument.cleanup())},forceRendering:function(){this.pdfRenderingQueue.printing=this.printing;this.pdfRenderingQueue.isThumbnailViewEnabled=this.sidebarOpen;this.pdfRenderingQueue.renderHighestPriority()},refreshThumbnailViewer:function(){for(var b=this.pdfViewer,a=this.pdfThumbnailViewer,c=b.pagesCount,g=0;g<c;g++){var d=b.getPageView(g);d&&d.renderingState===RenderingStates.FINISHED&&a.getThumbnail(g).setImage(d)}a.scrollThumbnailIntoView(this.page)},switchSidebarView:function(b, a){a&&!this.sidebarOpen&&document.getElementById("sidebarToggle").click();var c=document.getElementById("thumbnailView"),g=document.getElementById("outlineView"),d=document.getElementById("attachmentsView"),e=document.getElementById("viewThumbnail"),f=document.getElementById("viewOutline"),h=document.getElementById("viewAttachments");switch(b){case "thumbs":var i=c.classList.contains("hidden");e.classList.add("toggled");f.classList.remove("toggled");h.classList.remove("toggled");c.classList.remove("hidden"); g.classList.add("hidden");d.classList.add("hidden");this.forceRendering();i&&this.pdfThumbnailViewer.ensureThumbnailVisible(this.page);break;case "outline":if(f.disabled)break;e.classList.remove("toggled");f.classList.add("toggled");h.classList.remove("toggled");c.classList.add("hidden");g.classList.remove("hidden");d.classList.add("hidden");break;case "attachments":if(h.disabled)break;e.classList.remove("toggled");f.classList.remove("toggled");h.classList.add("toggled");c.classList.add("hidden"); g.classList.add("hidden");d.classList.remove("hidden")}},beforePrint:function(){if(this.supportsPrinting){var b=!1,a,c;if(!this.pdfDocument||!this.pagesCount)b=!0;else for(a=0,c=this.pagesCount;a<c;++a)if(!this.pdfViewer.getPageView(a).pdfPage){b=!0;break}if(b)b=mozL10n.get("printing_not_ready",null,"Warning: The PDF is not fully loaded for printing."),window.alert(b);else{this.printing=!0;this.forceRendering();b=document.querySelector("body");b.setAttribute("data-mozPrintCallback",!0);this.hasEqualPageSizes|| console.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");a=this.pdfViewer.getPageView(0).pdfPage.getViewport(1);this.pageStyleSheet.textContent="@supports ((size:A4) and (size:1pt 1pt)) {@page { size: "+a.width+"pt "+a.height+"pt;}#printContainer {height:100%}#printContainer > div {width:100% !important;height:100% !important;}}";b.appendChild(this.pageStyleSheet);for(a=0,c=this.pagesCount;a<c;++a)this.pdfViewer.getPageView(a).beforePrint()}}else this.error(mozL10n.get("printing_not_supported", null,"Warning: Printing is not fully supported by this browser."))},get hasEqualPageSizes(){for(var b=this.pdfViewer.getPageView(0),a=1,c=this.pagesCount;a<c;++a){var g=this.pdfViewer.getPageView(a);if(g.width!==b.width||g.height!==b.height)return!1}return!0},afterPrint:function(){for(var b=document.getElementById("printContainer");b.hasChildNodes();)b.removeChild(b.lastChild);this.pageStyleSheet&&this.pageStyleSheet.parentNode&&(this.pageStyleSheet.parentNode.removeChild(this.pageStyleSheet),this.pageStyleSheet= null);this.printing=!1;this.forceRendering()},rotatePages:function(b){var a=this.page;this.pageRotation=(this.pageRotation+360+b)%360;this.pdfViewer.pagesRotation=this.pageRotation;this.pdfThumbnailViewer.pagesRotation=this.pageRotation;this.forceRendering();this.pdfViewer.scrollPageIntoView(a)},requestPresentationMode:function(){this.pdfPresentationMode&&this.pdfPresentationMode.request()},scrollPresentationMode:function(b){this.pdfPresentationMode&&this.pdfPresentationMode.mouseScroll(b)}}; window.PDFView=PDFViewerApplication;function webViewerLoad(){configure(PDFJS);PDFViewerApplication.initialize().then(webViewerInitialized)} function webViewerInitialized(){var b=document.location.search.substring(1),b=parseQueryString(b),b="file"in b?b.file:DEFAULT_URL,a=document.createElement("input");a.id="fileInput";a.className="fileInput";a.setAttribute("type","file");a.oncontextmenu=noContextMenuHandler;document.body.appendChild(a);!window.File||!window.FileReader||!window.FileList||!window.Blob?(document.getElementById("openFile").setAttribute("hidden","true"),document.getElementById("secondaryOpenFile").setAttribute("hidden","true")): document.getElementById("fileInput").value=null;a=PDFJS.locale||navigator.language;if(PDFViewerApplication.preferencePdfBugEnabled){var c=document.location.hash.substring(1),c=parseQueryString(c);"disableworker"in c&&(PDFJS.disableWorker="true"===c.disableworker);"disablerange"in c&&(PDFJS.disableRange="true"===c.disablerange);"disablestream"in c&&(PDFJS.disableStream="true"===c.disablestream);"disableautofetch"in c&&(PDFJS.disableAutoFetch="true"===c.disableautofetch);"disablefontface"in c&&(PDFJS.disableFontFace= "true"===c.disablefontface);"disablehistory"in c&&(PDFJS.disableHistory="true"===c.disablehistory);"webgl"in c&&(PDFJS.disableWebGL="true"!==c.webgl);"useonlycsszoom"in c&&(PDFJS.useOnlyCssZoom="true"===c.useonlycsszoom);"verbosity"in c&&(PDFJS.verbosity=c.verbosity|0);"ignorecurrentpositiononzoom"in c&&(IGNORE_CURRENT_POSITION_ON_ZOOM="true"===c.ignorecurrentpositiononzoom);"locale"in c&&(a=c.locale);if("textlayer"in c)switch(c.textlayer){case "off":PDFJS.disableTextLayer=!0;break;case "visible":case "shadow":case "hover":document.getElementById("viewer").classList.add("textLayer-"+ c.textlayer)}"pdfbug"in c&&(PDFJS.pdfBug=!0,c=c.pdfbug.split(","),PDFBug.enable(c),PDFBug.init())}mozL10n.setLanguage(a);PDFViewerApplication.supportsPrinting||(document.getElementById("print").classList.add("hidden"),document.getElementById("secondaryPrint").classList.add("hidden"));PDFViewerApplication.supportsFullscreen||(document.getElementById("presentationMode").classList.add("hidden"),document.getElementById("secondaryPresentationMode").classList.add("hidden"));PDFViewerApplication.supportsIntegratedFind&& document.getElementById("viewFind").classList.add("hidden");document.getElementById("scaleSelect").oncontextmenu=noContextMenuHandler;var g=document.getElementById("mainContainer"),d=document.getElementById("outerContainer");g.addEventListener("transitionend",function(a){a.target===g&&(a=document.createEvent("UIEvents"),a.initUIEvent("resize",!1,!1,window,0),window.dispatchEvent(a),d.classList.remove("sidebarMoving"))},!0);document.getElementById("sidebarToggle").addEventListener("click",function(){this.classList.toggle("toggled"); d.classList.add("sidebarMoving");d.classList.toggle("sidebarOpen");PDFViewerApplication.sidebarOpen=d.classList.contains("sidebarOpen");PDFViewerApplication.sidebarOpen&&PDFViewerApplication.refreshThumbnailViewer();PDFViewerApplication.forceRendering()});document.getElementById("viewThumbnail").addEventListener("click",function(){PDFViewerApplication.switchSidebarView("thumbs")});document.getElementById("viewOutline").addEventListener("click",function(){PDFViewerApplication.switchSidebarView("outline")}); document.getElementById("viewOutline").addEventListener("dblclick",function(){PDFViewerApplication.outline.toggleOutlineTree()});document.getElementById("viewAttachments").addEventListener("click",function(){PDFViewerApplication.switchSidebarView("attachments")});document.getElementById("previous").addEventListener("click",function(){PDFViewerApplication.page--});document.getElementById("next").addEventListener("click",function(){PDFViewerApplication.page++});document.getElementById("zoomIn").addEventListener("click", function(){PDFViewerApplication.zoomIn()});document.getElementById("zoomOut").addEventListener("click",function(){PDFViewerApplication.zoomOut()});document.getElementById("pageNumber").addEventListener("click",function(){this.select()});document.getElementById("pageNumber").addEventListener("change",function(){PDFViewerApplication.page=this.value|0;this.value!==(this.value|0).toString()&&(this.value=PDFViewerApplication.page)});document.getElementById("scaleSelect").addEventListener("change",function(){"custom"!== this.value&&(PDFViewerApplication.pdfViewer.currentScaleValue=this.value)});document.getElementById("presentationMode").addEventListener("click",SecondaryToolbar.presentationModeClick.bind(SecondaryToolbar));document.getElementById("openFile").addEventListener("click",SecondaryToolbar.openFileClick.bind(SecondaryToolbar));document.getElementById("print").addEventListener("click",SecondaryToolbar.printClick.bind(SecondaryToolbar));document.getElementById("download").addEventListener("click",SecondaryToolbar.downloadClick.bind(SecondaryToolbar)); if(b&&0===b.lastIndexOf("file:",0)){PDFViewerApplication.setTitleUsingUrl(b);var e=new XMLHttpRequest;e.onload=function(){PDFViewerApplication.open(new Uint8Array(e.response))};try{e.open("GET",b),e.responseType="arraybuffer",e.send()}catch(f){PDFViewerApplication.error(mozL10n.get("loading_error",null,"An error occurred while loading the PDF."),f)}}else b&&PDFViewerApplication.open(b)}document.addEventListener("DOMContentLoaded",webViewerLoad,!0); document.addEventListener("pagerendered",function(b){var b=b.detail.pageNumber,a=b-1,c=PDFViewerApplication.pdfViewer.getPageView(a);PDFViewerApplication.sidebarOpen&&PDFViewerApplication.pdfThumbnailViewer.getThumbnail(a).setImage(c);PDFJS.pdfBug&&Stats.enabled&&c.stats&&Stats.add(b,c.stats);c.error&&PDFViewerApplication.error(mozL10n.get("rendering_error",null,"An error occurred while rendering the page."),c.error);b===PDFViewerApplication.page&&document.getElementById("pageNumber").classList.remove(PAGE_NUMBER_LOADING_INDICATOR)}, !0);document.addEventListener("textlayerrendered",function(b){PDFViewerApplication.pdfViewer.getPageView(b.detail.pageNumber-1)},!0);document.addEventListener("pagemode",function(b){if(PDFViewerApplication.initialized)switch(b=b.detail.mode,b){case "bookmarks":b="outline";case "thumbs":case "attachments":PDFViewerApplication.switchSidebarView(b,!0);break;case "none":PDFViewerApplication.sidebarOpen&&document.getElementById("sidebarToggle").click()}},!0); document.addEventListener("namedaction",function(b){if(PDFViewerApplication.initialized)switch(b.detail.action){case "GoToPage":document.getElementById("pageNumber").focus();break;case "Find":PDFViewerApplication.supportsIntegratedFind||PDFViewerApplication.findBar.toggle()}},!0); window.addEventListener("presentationmodechanged",function(b){var a=b.detail.active;PDFViewerApplication.pdfViewer.presentationModeState=b.detail.switchInProgress?PresentationModeState.CHANGING:a?PresentationModeState.FULLSCREEN:PresentationModeState.NORMAL}); window.addEventListener("updateviewarea",function(b){if(PDFViewerApplication.initialized){var a=b.location;PDFViewerApplication.store.initializedPromise.then(function(){PDFViewerApplication.store.setMultiple({exists:!0,page:a.pageNumber,zoom:a.scale,scrollLeft:a.left,scrollTop:a.top}).catch(function(){})});b=PDFViewerApplication.pdfLinkService.getAnchorUrl(a.pdfOpenParams);document.getElementById("viewBookmark").href=b;document.getElementById("secondaryViewBookmark").href=b;PDFViewerApplication.pdfHistory.updateCurrentBookmark(a.pdfOpenParams, a.pageNumber);b=document.getElementById("pageNumber");PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page-1).renderingState===RenderingStates.FINISHED?b.classList.remove(PAGE_NUMBER_LOADING_INDICATOR):b.classList.add(PAGE_NUMBER_LOADING_INDICATOR)}},!0); window.addEventListener("resize",function(){if(PDFViewerApplication.initialized){var b=PDFViewerApplication.pdfViewer.currentScaleValue;"auto"===b||"page-fit"===b||"page-width"===b?PDFViewerApplication.pdfViewer.currentScaleValue=b:b||(PDFViewerApplication.pdfViewer.currentScaleValue=DEFAULT_SCALE_VALUE);PDFViewerApplication.pdfViewer.update()}SecondaryToolbar.setMaxHeight(document.getElementById("viewerContainer"))}); window.addEventListener("hashchange",function(){if(PDFViewerApplication.pdfHistory.isHashChangeUnlocked){var b=document.location.hash.substring(1);b&&(PDFViewerApplication.isInitialViewSet?PDFViewerApplication.pdfLinkService.setHash(b):PDFViewerApplication.initialBookmark=b)}}); window.addEventListener("change",function(b){if((b=b.target.files)&&0!==b.length){b=b[0];if(!PDFJS.disableCreateObjectURL&&"undefined"!==typeof URL&&URL.createObjectURL)PDFViewerApplication.open(URL.createObjectURL(b));else{var a=new FileReader;a.onload=function(a){a=new Uint8Array(a.target.result);PDFViewerApplication.open(a)};a.readAsArrayBuffer(b)}PDFViewerApplication.setTitleUsingUrl(b.name);document.getElementById("viewBookmark").setAttribute("hidden","true");document.getElementById("secondaryViewBookmark").setAttribute("hidden", "true");document.getElementById("download").setAttribute("hidden","true");document.getElementById("secondaryDownload").setAttribute("hidden","true")}},!0);function selectScaleOption(b){for(var a=document.getElementById("scaleSelect").options,c=!1,g=0,d=a.length;g<d;g++){var e=a[g];e.value!==b?e.selected=!1:c=e.selected=!0}return c} window.addEventListener("localized",function(){document.getElementsByTagName("html")[0].dir=mozL10n.getDirection();PDFViewerApplication.animationStartedPromise.then(function(){var b=document.getElementById("scaleSelectContainer");0===b.clientWidth&&b.setAttribute("style","display: inherit;");if(0<b.clientWidth){var a=document.getElementById("scaleSelect");a.setAttribute("style","min-width: inherit;");var c=a.clientWidth+SCALE_SELECT_CONTAINER_PADDING;a.setAttribute("style","min-width: "+(c+SCALE_SELECT_PADDING)+ "px;");b.setAttribute("style","min-width: "+c+"px; max-width: "+c+"px;")}SecondaryToolbar.setMaxHeight(document.getElementById("viewerContainer"))})},!0); window.addEventListener("scalechange",function(b){document.getElementById("zoomOut").disabled=b.scale===MIN_SCALE;document.getElementById("zoomIn").disabled=b.scale===MAX_SCALE;if(!selectScaleOption(b.presetValue||""+b.scale)){var a=document.getElementById("customScaleOption"),b=Math.round(1E4*b.scale)/100;a.textContent=mozL10n.get("page_scale_percent",{scale:b},"{{scale}}%");a.selected=!0}PDFViewerApplication.initialized&&PDFViewerApplication.pdfViewer.update()},!0); window.addEventListener("pagechange",function(b){var a=b.pageNumber;b.previousPageNumber!==a&&(document.getElementById("pageNumber").value=a,PDFViewerApplication.sidebarOpen&&PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(a));b=PDFViewerApplication.pagesCount;document.getElementById("previous").disabled=1>=a;document.getElementById("next").disabled=a>=b;document.getElementById("firstPage").disabled=1>=a;document.getElementById("lastPage").disabled=a>=b;PDFJS.pdfBug&&Stats.enabled&& (b=PDFViewerApplication.pdfViewer.getPageView(a-1),b.stats&&Stats.add(a,b.stats))},!0); function handleMouseWheel(b){var a="DOMMouseScroll"===b.type?-b.detail:b.wheelDelta/40,c=0>a?"zoomOut":"zoomIn",g=PDFViewerApplication.pdfViewer;if(g.isInPresentationMode)b.preventDefault(),PDFViewerApplication.scrollPresentationMode(40*a);else if(b.ctrlKey||b.metaKey){var d=PDFViewerApplication.supportedMouseWheelZoomModifierKeys;b.ctrlKey&&!d.ctrlKey||b.metaKey&&!d.metaKey||(b.preventDefault(),d=g.currentScale,PDFViewerApplication[c](Math.abs(a)),a=g.currentScale,d!==a&&(a=a/d-1,c=g.container.getBoundingClientRect(), d=b.clientY-c.top,g.container.scrollLeft+=(b.clientX-c.left)*a,g.container.scrollTop+=d*a))}}window.addEventListener("DOMMouseScroll",handleMouseWheel);window.addEventListener("mousewheel",handleMouseWheel);window.addEventListener("click",function(b){SecondaryToolbar.opened&&PDFViewerApplication.pdfViewer.containsElement(b.target)&&SecondaryToolbar.close()},!1); window.addEventListener("keydown",function(b){if(!OverlayManager.active){var a=!1,c=(b.ctrlKey?1:0)|(b.altKey?2:0)|(b.shiftKey?4:0)|(b.metaKey?8:0),g=PDFViewerApplication.pdfViewer,d=g&&g.isInPresentationMode;if(1===c||8===c||5===c||12===c)switch(b.keyCode){case 70:PDFViewerApplication.supportsIntegratedFind||(PDFViewerApplication.findBar.open(),a=!0);break;case 71:PDFViewerApplication.supportsIntegratedFind||(PDFViewerApplication.findBar.dispatchEvent("again",5===c||12===c),a=!0);break;case 61:case 107:case 187:case 171:d|| PDFViewerApplication.zoomIn();a=!0;break;case 173:case 109:case 189:d||PDFViewerApplication.zoomOut();a=!0;break;case 48:case 96:d||(setTimeout(function(){g.currentScaleValue=DEFAULT_SCALE_VALUE}),a=!1)}if(1===c||8===c)switch(b.keyCode){case 83:PDFViewerApplication.download(),a=!0}if(3===c||10===c)switch(b.keyCode){case 80:PDFViewerApplication.requestPresentationMode();a=!0;break;case 71:document.getElementById("pageNumber").select(),a=!0}if(a)b.preventDefault();else{var e=document.activeElement|| document.querySelector(":focus"),f=e&&e.tagName.toUpperCase();if(!(("INPUT"===f||"TEXTAREA"===f||"SELECT"===f)&&27!==b.keyCode)){var h=!1;if(0===c)switch(b.keyCode){case 38:case 33:case 8:if(!d&&"page-fit"!==g.currentScaleValue)break;case 37:if(g.isHorizontalScrollbarEnabled)break;case 75:case 80:PDFViewerApplication.page--;a=!0;break;case 27:SecondaryToolbar.opened&&(SecondaryToolbar.close(),a=!0);!PDFViewerApplication.supportsIntegratedFind&&PDFViewerApplication.findBar.opened&&(PDFViewerApplication.findBar.close(), a=!0);break;case 40:case 34:case 32:if(!d&&"page-fit"!==g.currentScaleValue)break;case 39:if(g.isHorizontalScrollbarEnabled)break;case 74:case 78:PDFViewerApplication.page++;a=!0;break;case 36:if(d||1<PDFViewerApplication.page)PDFViewerApplication.page=1,h=a=!0;break;case 35:if(d||PDFViewerApplication.pdfDocument&&PDFViewerApplication.page<PDFViewerApplication.pagesCount)PDFViewerApplication.page=PDFViewerApplication.pagesCount,h=a=!0;break;case 72:d||HandTool.toggle();break;case 82:PDFViewerApplication.rotatePages(90)}if(4=== c)switch(b.keyCode){case 32:if(!d&&"page-fit"!==g.currentScaleValue)break;PDFViewerApplication.page--;a=!0;break;case 82:PDFViewerApplication.rotatePages(-90)}if(!a&&!d&&(33<=b.keyCode&&40>=b.keyCode||32===b.keyCode&&"BUTTON"!==f))h=!0;if(2===c)switch(b.keyCode){case 37:d&&(PDFViewerApplication.pdfHistory.back(),a=!0);break;case 39:d&&(PDFViewerApplication.pdfHistory.forward(),a=!0)}h&&!g.containsElement(e)&&g.focus();a&&b.preventDefault()}}}});window.addEventListener("beforeprint",function(){PDFViewerApplication.beforePrint()}); window.addEventListener("afterprint",function(){PDFViewerApplication.afterPrint()});(function(){PDFViewerApplication.animationStartedPromise=new Promise(function(b){window.requestAnimationFrame(b)})})();