text: /*!
  *  filename: ej.pdfviewer.min.js
  *  version : 15.1.0.41
  *  Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
  *  Use of this code is subject to the terms of our license.
  *  A copy of the current license can be obtained at any time by e-mailing
  *  licensing@syncfusion.com. Any infringement will be prosecuted under
  *  applicable laws. 
  */
  (function(n){typeof define=="function"&&define.amd?define(["./../common/ej.globalize.min","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.scroller.min","./ej.button.min","./ej.dropdownlist.min","./ej.toolbar.min","./ej.tooltip.min","./ej.waitingpopup.min","./ej.checkbox.min","./ej.editor.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPdfViewer","ej.PdfViewer",{_rootCSS:"e-pdfviewer",_requiresID:!0,element:null,model:null,validTags:["div"],defaults:{serviceUrl:"",hyperlinkOpenState:1,serverActionSettings:{load:"Load",fileUpload:"FileUpload",print:"Load",download:"Download"},documentPath:null,toolbarSettings:{toolbarItem:31,showTooltip:!0},enableHyperlink:!0,pdfService:1,locale:"en-US",pageChange:"",documentLoad:"",beforePrint:"",afterPrint:"",zoomchange:"",bufferStart:"",bufferEnd:"",isResponsive:!0,pageClick:"",allowClientBuffering:!1,documentUnload:""},_isToolbarClick:!1,_curYPos:0,_curXPos:0,_curDown:!1,_pageModel:null,_currentPage:1,_zoomLevel:2,_preZoomVal:1,_fitType:null,_higherZoomIndex:0,_lowerZoomIndex:0,_actionUrl:null,_isDevice:!1,_contextMenu:!1,_zoomVal:1,_currentPageBackup:0,_zoomValBackup:0,_zoomLevelBackup:0,_fitTypeBackup:null,_scrollTop:0,_bgRenderTimer:0,_renderCount:0,_prevDiff:-1,_pointerCount:0,_searchText:null,_selectedIndex:0,_searchPageIndex:0,_isRenderedByPinch:!1,_isPinchLimitReached:!1,_isRerenderCanvasCreated:!1,_isPrinting:!1,_isContainImage:!1,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_isFindboxPresent:!1,_isTextSearch:!1,_isTextHighlighted:!1,_isRequestFired:!1,_isPageScrollHighlight:!1,_isPageScrolledForSearch:!1,_searchAjaxRequestState:null,_isPrevSearch:!1,_isMatchCase:!1,_isPrintHidden:!1,_isNavigationHidden:!1,_isMagnificationHidden:!1,_isDownloadHidden:!1,_isTextSearchHidden:!1,_isZoomCntlHidden:!1,_isDownloadCntlHidden:!1,_isToolbarHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,_isWindowResizing:!1,_ejViewerInstance:null,_isAutoZoom:!1,_ejDropDownInstance:null,_clientx:null,_clienty:null,_curPosX:null,_curPosY:null,_previousBounds:null,_topValue:!1,_clearText:!1,_timers:null,_scrollMove:null,_rangePosition:null,_selectedRanges:null,_longTouch:!1,_ranges:!1,_touchcontextMenu:!1,_selectionNodes:null,_selectionRange:null,_touched:!1,_lockTimer:null,_timer:null,_displaySearch:!1,_isCopyRestrict:!1,_isPrintRestrict:!1,_isTargetPage:!1,_targetPage:0,_isBuffering:!1,_isBufferStart:!1,_pagesGot:null,_isPrintingProcess:!1,_isRequestSuccess:!1,_fileId:null,_isFormFields:!1,_imageObj:null,_isJsondataAvailable:!1,_highestWidth:0,_isAsynchronousDownload:!0,pageCount:0,currentPageNumber:this._currentPage,zoomPercentage:100,fileName:this._pdfFileName,enableTextSelection:!0,isDocumentEdited:!1,_init:function(){var i;if(this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,this._renderViewer(),this._initViewer(),this._createContextMenu(),this._createWaterDropDiv(),this._createTouchContextMenu(),this._ejDropDownInstance=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),this._getPdfService(this.model.pdfService),this.model.serviceUrl){if(i={},i.viewerAction="GetPageModel",i.controlId=this._id,i.pageindex="1",i.isInitialLoading="true",this.model.documentPath){var r=this.model.documentPath,u=r.split("base64,")[1],f=!1,e=!1;u||(this.model.documentPath.indexOf("\\")!=-1||this.model.documentPath.indexOf("/")!=-1?(f=!0,e=!0,this.model.documentPath.toLowerCase().endsWith(".pdf")||(r=this.model.documentPath+".pdf")):i.newFileName=r);i.file=r}i.id=this._createGUID();this._fileId=i.id;this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(i),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}),"_getPageModel")}this._printIframe=document.createElement("iframe")},_getPdfService:function(n){this._pdfService=n==1?t.PdfViewer.PdfService.Local:t.PdfViewer.PdfService.Remote},_initViewer:function(){this._wireEvents();this._initToolbar();this._currentPage=1;var i=this.model.toolbarSettings;i.templateId||(this._showToolbar(!0),this._showPrintButton(i.toolbarItem&t.PdfViewer.ToolbarItems.PrintTools),this._showZoomControl(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showFittoPage(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showPageNavigationControls(i.toolbarItem&t.PdfViewer.ToolbarItems.PageNavigationTools),this._showDownloadButton(i.toolbarItem&t.PdfViewer.ToolbarItems.DownloadTool),this._showTextSearchButton(i.toolbarItem&t.PdfViewer.ToolbarItems.TextSearchTool));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0);this._on(n("#"+this._id+"e-pdf-viewer"),"keydown",this._keyboardShortcutFind)},_unLoad:function(){var i,t;for(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoom"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_search"),i=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i._selectItemByIndex(0),i.disable(),clearTimeout(this._scrollTimer),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;this._renderedCanvasList&&(this._renderedCanvasList.length=0);this._showloadingIndicator(!1);this._showPageLoadingIndicator(!1);this._raiseClientEvent("documentUnload",null)},_destroy:function(){this._isDestroyed=!0;n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0");n("#"+this._id+"_txtpageNo").val(0);clearTimeout(this._scrollTimer);this._unwireEvents();for(var t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;n("#"+this._id+"_pageviewContainer").remove();n("#"+this._id+"_toolbarContainer").remove();n("#"+this._id+"_viewerContainer").remove();n("#"+this._id+"_viewBlockContainer").remove();n("#"+this._id+"_toolbar_zoomSelection_popup_wrapper").remove();n("#"+this._id+"_rptTooltip").remove();n("#"+this._id+"_loadingIndicator_WaitingPopup").remove();n("#"+this._id+"_viewerContainer_WaitingPopup").remove();n("#"+this._id+"_WaitingPopup").remove();n(this.element).find(".e-pdfviewer-viewer").remove();this._renderedCanvasList.length=0;this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var n=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),i=t.buildTag("span.e-pdfviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),r=t.buildTag("span.e-pdfviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});return n.append(i),n.append(r),n},_renderToolBar:function(i){var r,f,e,u,s,h,c,o;this.model.toolbarSettings.templateId?(o=document.getElementById(this.model.toolbarSettings.templateId),i.append(o),o.ejToolbar({enableSeparator:!0,height:o.height(),click:this.model.toolbarSettings.click,isResponsive:!0}),o.css("display","block")):(r=t.buildTag("div.e-pdfviewer-toolbarcontainer .e-pdfviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(f=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(f,"zoomin"),this._appendToolbarItems(f,"zoomout"),this._appendToolbarItems(f,"fitWidth"),this._appendToolbarItems(f,"fitPage"),r.append(f)):(e=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{}),this._appendToolbarItems(e,"gotoprevious"),this._appendToolbarItems(e,"gotonext"),this._appendToolbarItems(e,"gotopage"),r.append(e),u=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_zoomul"}),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"zoom"),this._appendToolbarItems(u,"fitWidth"),this._appendToolbarItems(u,"fitPage"),r.append(u),s=t.buildTag("ul.e-pdfviewer-toolbarul","",{},{id:this._id+"_pdfviewer_searchul"}),this._appendToolbarItems(s,"search"),r.append(s),h=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_downloadul"}),this._appendToolbarItems(h,"download"),r.append(h),c=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_printul"}),this._appendToolbarItems(c,"print"),r.append(c),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:0})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this),isResponsive:!0}),this._toolbar=n("#"+this._id+"_toolbarContainer").data("ejToolbar"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-responsive-toolbar").addClass("e-pdfviewer-responsivesecondarytoolbar"),n("#"+this._id+"_pdfviewer_searchul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_downloadul").removeClass("e-separator"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-toolbarspan"))},_appendToolbarItems:function(n,i){var r,k=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f,e,o,s,h,c,l,a,v,y,u,p,w,b;switch(i){case"print":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"});f=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(f);break;case"download":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_download"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-download","",{},{id:this._id+"_toolbar_download"});r.append(e);break;case"gotofirst":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"});o=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{});r.append(o);break;case"gotolast":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"});s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{});r.append(s);break;case"gotonext":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"});h=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{});r.append(h);break;case"gotoprevious":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{});r.append(c);break;case"gotopage":r=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block"},{});l=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"});a=t.buildTag("span.e-pdfviewer-labelpageno","",{},{});r.append(l);r.append(a);break;case"zoomin":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(v);break;case"zoomout":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"});y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(y);break;case"zoom":r=t.buildTag("div.e-pdfviewer-ejdropdownlist","",{},{id:this._id+"_pdfviewer_toolbar_zoom"});u=t.buildTag("select.e-pdfviewer-tbdiv e-pdfviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"});u.append("<option Selected>Auto<\/option>");u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");r.append(u);break;case"fitWidth":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"});p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"});r.append(p);break;case"fitPage":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"});w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"});r.append(w);break;case"search":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_search"});b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-find","",{},{id:this._id+"_find"});r.append(b)}n.append(r)},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("table.e-pdfviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),u=t.buildTag("tr","",{width:"100%"}),f=t.buildTag("td.e-pdfviewer-viewerblockcontent","",{});return u.append(f),r.append(u),i.append(r),i},_renderViewerContainer:function(n){var r=t.buildTag("div","",{},{id:this._id+"_pdfviewerContainer"});n.append(r);var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-scrollcontainer e-pdfviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),u=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div","",{},{id:this._id+"_pageviewContainer"});return u.append(f),i.append(u),i.append(e),this._isDevice&&this._renderViewerBlockinDevice(i),r.append(i),r},_renderViewer:function(){var u=this.element.height(),f=this.element.width(),n=t.buildTag("div.e-pdfviewer-viewer","",{},{id:this._id+"e-pdf-viewer"}),i,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);u===0&&this.element[0].parentElement.clientHeight!=0&&this.element.height(this.element[0].parentElement.clientHeight);f===0&&this.element[0].parentElement.clientWidth!=0&&this.element.width(this.element[0].parentElement.clientWidth);this.element.append(n);this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),i=this._renderToolTip());r=this._renderViewerContainer(n);r.append(i);this._renderSearchBox()},_renderSearchBox:function(){var r=t.buildTag("div.e-pdfviewer-searchbox e-pdfviewer-arrow","",{},{id:this._id+"_pdfviewer_searchbox"}),i=t.buildTag("ul.e-pdfviewer-toolbarul-search","",{}),c,l;r.append(i);var u=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-inputcontainer","",{},{}),a=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Find : ",{float:"left","padding-top":"1px","margin-right":"5px"},{}),v=t.buildTag("input.e-pdfviewer-searchinput e-pdfviewer-elementalignments ejinputtext","",{width:"150px"},{id:this._id+"_pdfviewer_searchinput"});u.append(a);u.append(v);var f=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-previous","",{float:"left"},{id:this._id+"_pdfviewer_previous_search"}),e=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-next","",{float:"left"},{id:this._id+"_pdfviewer_next_search"}),h=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-close","",{float:"left","margin-left":"4px"},{id:this._id+"_pdfviewer_close_search"}),y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-prevfind","",{},{id:this._id+"_prevfind"});f.append(y);n(f).css({"pointer-events":"none",opacity:"0.6"});n(e).css({"pointer-events":"none",opacity:"0.6"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-nextfind","",{},{id:this._id+"_nextfind"});e.append(c);var o=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-checkboxcontainer","",{float:"left"},{}),s=t.buildTag("input","",{},{type:"checkbox"}),p=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Match case",{float:"left","padding-top":"3px","margin-left":"5px","margin-top":"4px"},{});o.append(s);o.append(p);l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closefind","",{},{id:this._id+"_closefind"});h.append(l);i.append(u);i.append(f);i.append(e);i.append(o);i.append(h);r.ejToolbar({enableSeparator:!1,isResponsive:!1,width:"400px",hide:!0});s.ejCheckBox({cssClass:"e-pdfviewer-match-checkbox",id:this._id+"_search_matchcase",size:t.CheckboxSize.Medium,change:n.proxy(this._matchcase,this)});s.ejCheckBox("disable");n("#"+this._id+"_pdfviewerContainer").append(r)},_setContainerSize:function(){var f=document.getElementById(this._id).clientHeight,i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.css("display").toLowerCase()=="block"&&(i=t.height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r){r=0;var f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),u=this;this._renderPreviousPage=!1;n("#"+this._id+"_viewerContainer").unbind("scroll").on("scroll",function(){u._computeCurrentPage(t)});n("#"+this._id+"_pageviewContainer").mouseup(function(n){u._raiseClientEvent("pageClick",n)});this._scrollTimer=setInterval(function(){u._pageviewscrollchanged(t)},500);u._backgroundPage=1;this._previousZoom=1;u._previousPage=u._currentPage;this._pageLocation=[];this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._textDivs=[];this._textContents=[];this._searchMatches=[];this._searchCollection=[];this._pageLocation[1]=0;this._searchedPages=[];this._canvascount=this._totalPages;this._pointers=[];this._imageObj=[];this._pagesGot=[];this._imageSrcCollection=[];this._designPageCanvas()},_designPageCanvas:function(){var e=5,c=n("#"+this._id+"_pageviewContainer"),h=n("#"+this._id+"_viewerContainer"),v=n("#"+this._id+"_pageviewOuterline"),l=h.width(),y=h.height(),a=this._pageWidth,p=this._pageHeight,o=1,i,s,f,u;for(o=(l-25)/a,o=Math.min(1,o),this._zoomVal=o,i=1;i<=this._totalPages;i++){s=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight)/2:(this.element.width()-this._pageSize[i-1].PageWidth)/2;s<0&&(s=5);f=t.buildTag("div","",{},{id:this._id+"pageDiv_"+i});c.append(f);f.css("position","absolute");f.css("top",this._zoomVal*e);f.css("left",s+"px");this._pageLocation[i]=e;var r=document.createElement("canvas");r.id=this._id+"pagecanvas_"+i;r.className="e-pdfviewer-pageCanvas";this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(r.width=this._zoomVal*this._pageSize[i-1].PageHeight,r.height=this._zoomVal*this._pageSize[i-1].PageWidth,r.style.height=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageHeight+"px"):(r.style.height=this._zoomVal*this._pageSize[i-1].PageHeight+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.height=this._zoomVal*this._pageSize[i-1].PageHeight,r.width=this._zoomVal*this._pageSize[i-1].PageWidth);r.style.backgroundColor="white";f.append(r);u=document.createElement("div");u.id=this._id+"selectioncanvas_"+i;u.className="e-pdfviewer-selectiondiv";u.style.height=r.height+"px";u.style.width=r.width+"px";u.style.position="absolute";u.style.left=0;u.style.top=0;u.style.backgroundColor="transparent";u.style.zIndex="2";f.append(u);n("#"+this._id+"pageDiv_"+i).ejWaitingPopup({showOnInit:!0,appendTo:"#"+this._id+"pageDiv_"+i,target:"#"+this._id+"pageDiv_"+i});n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").appendTo(n("#"+this._id+"pageDiv_"+i)).css({left:"0px",top:"0px","background-color":"#dbdbdb"});e=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?parseFloat(e)+parseFloat(this._pageSize[i-1].PageWidth)+8:parseFloat(e)+parseFloat(this._pageSize[i-1].PageHeight)+8}this._cummulativeHeight=e},_computeCurrentPage:function(){var u=0,i=0,h=document.getElementById(this._id+"_viewerContainer"),r=h.scrollTop,t;this._zoomVal!=1&&(r=r+this._currentPage*(8-this._zoomVal*8));var e=0,f=0,o={currentPageNumber:0};for(t=0;t<this._totalPages;t++){if(this._isDestroyed)return;if(u>r&&r>=0){i=t;var s=parseFloat(u)-parseFloat(r),c=this.element[0].parentElement.clientHeight-s,l=document.getElementById(this._id+"_viewerContainer");this.element[0].parentElement.clientHeight<this._pageSize[t-1].PageHeight*this._zoomVal+this._pageSize[t].PageHeight*this._zoomVal&&parseInt(this._pageLocation[t]*this._zoomVal)<l.scrollTop&&c>s&&(i=parseFloat(i)+1,this._renderPreviousPage=!0);this._renderPreviousPage=!1;break}else u=this._pageSize[t].PageRotation==90||this._pageSize[t].PageRotation==270?parseFloat(u)+parseFloat(this._pageSize[t].PageWidth*this._zoomVal)+8:parseFloat(u)+parseFloat(this._pageSize[t].PageHeight*this._zoomVal)+8;i=r>=0?t+1:1}n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages);e=document.getElementById(this._id+"_txtpageNo").value;n("#"+this._id+"_txtpageNo").val(i);this._updatePageNavigation(i,this._totalPages);f=document.getElementById(this._id+"_txtpageNo").value;o.currentPageNumber=f;this._currentPage=i;this.currentPageNumber=this._currentPage;e!=f&&this._raiseClientEvent("pageChange",o)},_pageviewscrollchanged:function(){var s=0,h=n("#"+this._id+"_viewerContainer").scrollTop(),c,o,f,l,r,e,u;this._isTargetPage&&this.model.allowClientBuffering&&(this._isTargetPage=!1,this._isBuffering=!0,this._targetPage<=this._totalPages&&(this._isBufferStart||(this._raiseClientEvent("bufferStart",this._isBuffering),this._isBufferStart=!0),c={viewerAction:this._viewerAction.getPageModel,pageindex:this._targetPage.toString(),enableOfflineMode:!0,isPageScrolled:"false"},u=this,this._ajaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(c),traditional:!0,success:function(n){var f,e,r,t;if(jsondata=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),jsondata=jsondata.pdf,f=0,e=!1,jsondata){for(t=u._targetPage;t<=u._totalPages;t++)if(r=jsondata[t],r)u._pageContents[parseInt(r.currentpage)]=JSON.stringify(r),u._pageText[parseInt(r.currentpage)]=r.pageContents,u._pagesGot.push(parseInt(r.currentpage)),f++;else{e=!0;break}if(r==i&&!e)for(t=u._targetPage;t<=u._totalPages;t++)u._pagesGot.indexOf(t)&&f++;u._targetPage=f?u._targetPage+f:u._targetPage;u._targetPage>=u._totalPages&&(u._raiseClientEvent("bufferEnd",this._isBuffering),u._isBufferStart=!1);u._isTargetPage=!0;u._isBuffering=!1}},error:function(){}})));h==this._previousPosition&&(s=this._currentPage,this._totalPages&&this._previousPage!=s&&(o=parseInt(s),this._previousPage=s,o>=1&&o<=this._totalPages&&(this._isJsondataAvailable?(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(o)):(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),this._currentPage=o,this._updatePageNavigation(this._currentPage,this._totalPages),this._renderedCanvasList.indexOf(parseInt(this._currentPage))!=-1||this._scrollTriggered&&!this.model.allowClientBuffering||this._pageContents[parseInt(this._currentPage)]||this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))))));this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&this._currentPage<=this._totalPages&&(this._pageContents[parseInt(this._currentPage)]?(e=this._pageContents[parseInt(this._currentPage)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));f=parseInt(this._currentPage)+1;this.model.allowClientBuffering?this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(l=!0,this._isPrintingProcess||(r.isPageScrolled=!1)),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r),l):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages?this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0&&(this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));this._previousPosition=h;u=this;setTimeout(function(){n(".e-pdfviewer-formFields").show();u._selectionRange==null||u._displaySearch||(u._selectionNodes.addRange(u._selectionRange),u._selectionRange=null,u._selectionNodes=null)},5e3)},_doAjaxPostscroll:function(t,i,r,u){var f=this;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,async:!1,success:function(n){var t;typeof n=="object"?f._drawPdfPage(JSON.stringify(n)):f._drawPdfPage(n);f._scrollTriggered=!1;u&&f.model.allowClientBuffering&&(t=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(t.currentpage)),parseInt(t.currentpage)<=f._totalPages&&(f._targetPage=t.currentpage+1,f._isTargetPage=!0))},error:function(n){n.readyState!=0&&alert("Exception"+n.responseText)}})},_drawPdfPage:function(r){var ci=r,h,vt,p,u,g,ot,o,nt,st,a,s,rt,yt,ui,ut,k,f,ft,ti,at,c,e;if(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),h=parseInt(r.currentpage),this._isWindowResizing||this._showPageLoadingIndicator(h,!0),vt=r.imagestream,p=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage)),(this._pageSize[h-1].PageRotation==90||this._pageSize[h-1].PageRotation==270)&&(p.width=this._zoomVal*this._pageSize[h-1].PageWidth,p.height=this._zoomVal*this._pageSize[h-1].PageHeight,p.style.height=this._zoomVal*this._pageSize[h-1].PageHeight+"px",p.style.width=this._zoomVal*this._pageSize[h-1].PageWidth+"px"),p){if(u=p.getContext("2d"),this._pageContents[parseInt(r.currentpage)]=ci,this._pageText[parseInt(r.currentpage)]=r.pageContents,this._imageObj=[],n("#"+this._id+"selectioncanvas_"+h).hasClass("text_container")?this._resizeSelection(r,h,u):this._textSelection(r,h,u),n("#"+this._id+"selectioncanvas_"+h).hasClass("input_container")?this._generateFormFields(r,h):this._createFormFields(r,h),navigator.userAgent.indexOf("Firefox")!=-1)for(g=vt.textelements,ot=0;ot<g.length;ot++)if(o=g[ot],nt=o.textureBrushs,nt){var li=o.texturFields[0].Image,it="data:image/png;base64,"+li,ii=new Image;ii.src=it;this._imageSrcCollection.push(ii.src)}for(this._isTextSearch&&(e=this,setTimeout(function(){e._isPageScrollHighlight=!0;e._isPageScrolledForSearch=!0;e._highlightOtherOccurrences()},100)),st=n("#"+this._id+"selectioncanvas_"+h).children(),k=0;k<st.length;k++)st[k].hasAttribute("href")&&n(st[k]).remove();var w=r.linkannotation,ri=r.annotpagenum,ht=this;if(this.model.enableHyperlink)for(a=0;a<w.length;a++){if(s=document.createElement("a"),s.id="linkdiv_"+a,rt=w[a].AnnotRectangle,s.style.background="transparent",s.style.position="absolute",s.style.left=this._convertPointToPixel(rt.Left*this._zoomVal)+"px",s.style.top=this._convertPointToPixel(rt.Top*this._zoomVal)+"px",s.style.width=this._convertPointToPixel(rt.Width*this._zoomVal)+"px",s.style.height=this._convertPointToPixel(rt.Height*this._zoomVal)+"px",s.style.color="transparent",w[a].URI.indexOf("mailto:")!=-1?(yt=w[a].URI.substring(w[a].URI.indexOf("mailto:"),w[a].URI.length),s.title=yt,s.setAttribute("href",yt)):(s.title=w[a].URI,s.setAttribute("href",w[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(s.target="_self",s.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(s.target="_blank",s.onclick=function(){var n={hyperlink:this.href};ht._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(s.onclick=function(){var n={hyperlink:this.href};return ht._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ri[a]!=i){var ai=this._pageSize[h-1].PageHeight,vi=this._convertPointToPixel(w[a].AnnotLocation),yi=ai-vi,pi=parseFloat(this._pageLocation[ri[a]]*this._zoomVal)+parseFloat(yi*this._zoomVal);s.name=pi;s.onclick=function(){var n=document.getElementById(ht._id+"_viewerContainer");return n.scrollTop=this.name,!1}}ui=document.getElementById(this._id+"selectioncanvas_"+h);ui.appendChild(s)}var v=parseInt(r.currentpage),pt=[],fi=[],wi=[],ei=[],oi=[],bi,b=navigator.userAgent,d,si=0,wt=[],g=vt.textelements;for(ut=0;ut<g.length;ut++){var o=g[ut],bt=o.color,l=o.matrix;l!=null&&(l=l.Elements);var kt=o.brush,y=o.pathValue,ki=o.iscliping,hi=o.restorecanvas,it=o.imagedata,tt=o.fillrule,di=o.isFillandStroke,gi=o.fillcolor,dt=o.strokecolor,gt=o.linewidth,ni=o.linecap,ct=o.linearGradientBrush,nt=o.textureBrushs,lt=o.charID,tr=o.rectvalue;if(y!=null?(y=y.split(";"),lt&&(wt[lt]=y)):y==null&&lt&&(y=wt[lt]),hi==!1&&u.save(),y!=i&&u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),y!=null){for(u.beginPath(),k=0;k<y.length;k++)f=y[k],ft=f[0],ft=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):ft=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):ft=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):ft=="Z"&&u.closePath();ki==!0?(tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(tt)),u.clip()):di==i?kt=="Fill"?(u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,o):bt,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill()):kt=="FillandStroke"?(u.fillStyle=bt,u.fill(),u.strokeStyle=dt,u.stroke()):kt=="Stroke"?(u.strokeStyle=dt,u.lineWidth=gt,u.lineCap=ni,u.stroke()):(u.strokeStyle=bt,u.lineWidth=gt,u.lineCap=ni,u.stroke()):(u.strokeStyle=dt,u.lineWidth=gt,u.lineCap=ni,u.stroke(),u.fillStyle=ct!=i?this._getGradientBrush(ct,u):nt!=i?this._createTextureBrush(nt,u,o):gi,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill())}if(hi&&u.restore(),it!=i)if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1){pt.push(it);fi.push(l);oi.push(g);ei.push(ut);bi=this._zoomVal;this._isContainImage=!0;break}else ti=new Image,ti.src=it,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(ti,0,0,1,1)}if((d=b.indexOf("Firefox"))!=-1||(d=b.indexOf("Chrome"))!=-1||(d=b.indexOf("Safari"))!=-1||(d=b.indexOf("AppleWebKit"))!=-1)for(at=0;at<pt.length;at++)this._imageRendering(g,wi,pt,fi,u,at,oi,ei,wt,p,v,si),si++;if(c=p,e=this,this._pageSize[v-1].PageRotation!=0&&!(it!=i&&b.indexOf("Firefox")!=-1)){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var nr=c.toDataURL(),u=c.getContext("2d"),et=new Image;et.onload=function(){u.clearRect(0,0,c.width,c.height);e._pageSize[v-1].PageRotation==90||e._pageSize[v-1].PageRotation==270?(c.width=e._zoomVal*e._pageSize[v-1].PageHeight,c.height=e._zoomVal*e._pageSize[v-1].PageWidth,c.style.height=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.width=e._zoomVal*e._pageSize[v-1].PageHeight+"px"):(c.width=e._zoomVal*e._pageSize[v-1].PageWidth,c.height=e._zoomVal*e._pageSize[v-1].PageHeight,c.style.width=e._zoomVal*e._pageSize[v-1].PageWidth+"px",c.style.height=e._zoomVal*e._pageSize[v-1].PageHeight+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(e._pageSize[v-1].PageRotation/2*Math.PI/2);u.drawImage(et,-et.width/2,-et.height/2);u.restore()};et.src=nr}return this._showPageLoadingIndicator(h,!1),c}},_convertPointToPixel:function(n){return parseFloat(n)*(96/72)},_getRandomNum:function(){return((1+Math.random())*65536|0).toString(16).substring(1)},_createGUID:function(){return(this._getRandomNum()+this._getRandomNum()+"-"+this._getRandomNum()+"-4"+this._getRandomNum().substr(0,3)+"-"+this._getRandomNum()+this._getRandomNum()+this._getRandomNum()).toLowerCase()},_createFormFields:function(t,i){var f=t.PdfRenderedFields,p=navigator.userAgent,h=this,u,r,l,c,v,s,o,y,e,w,b,k,a;if(f!=null)for(u=0;u<f.length;u++)if(f[u].PageIndex+1==i){if(l=f[u].LineBounds,f[u].Name=="Textbox")r=document.createElement("input"),r.type="text",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="Password")r=document.createElement("input"),r.type="password",e=f[u].BackColor,c=f[u].FontColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].FieldName),v=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",f[u].MaxLength>0&&n(r).attr("maxlength",f[u].MaxLength),f[u].InsertSpaces&&n(r).css("letter-spacing",v),f[u].Text!=""?n(r).val(f[u].Text):n(r).val("");else if(f[u].Name=="RadioButton")r=document.createElement("input"),r.type="radio",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0&&n(r).prop("checked",!0),n(r).val(f[u].Value),n(r).attr("name",f[u].GroupName),n(r).css("cursor","pointer"),p.indexOf("Chrome")!=-1&&n(r).css("-webkit-apperance","none");else if(f[u].Name=="CheckBox")r=document.createElement("input"),r.type="checkbox",n(r).css("border-width",f[u].BorderWidth),f[u].Selected==!0?n(r).prop("checked",!0):p.indexOf("Chrome")!=-1&&n(r).css("-webkit-appearance","none"),n(r).attr("name",f[u].GroupName),e=f[u].BackColor,n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(r).css("cursor","pointer");else if(f[u].Name=="DropDown"){for(r=document.createElement("select"),n(r).css("border-width",f[u].BorderWidth),n(r).attr("name",f[u].Text),f[u].SelectedValue==""&&(o=document.createElement("option"),o.id="dropdownhide",n(o).css("display","none"),o.selected="selected",o.innerHTML="",r.appendChild(o)),s=0;s<f[u].TextList.length;s++)o=document.createElement("option"),o.className="e-dropdownSelect",f[u].SelectedValue==f[u].TextList[s]?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[u].TextList[s],r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}else if(f[u].Name=="ListBox")for(r=document.createElement("select"),n(r).attr("multiple","multiple"),n(r).attr("name",f[u].Text),s=0;s<f[u].TextList.length;s++){for(o=document.createElement("option"),o.className="e-pdfviewer-ListBox",y=0;y<f[u].SelectedList.length;y++)f[u].SelectedList[y]==s&&n(o).prop("selected",!0);o.innerHTML=f[u].TextList[s];r.appendChild(o);e=f[u].BackColor;n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")")}f[u].Font!=null&&((f[u].Font.Bold||f[u].Font.Italic||f[u].Font.Strikeout||f[u].Font.Underline)&&(f[u].Font.Italic&&(r.style.fontStyle="italic"),f[u].Font.Bold&&(r.style.fontWeight="Bold")),n(r).css("font-family",f[u].Font.Name),w=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",n(r).css("font-size",w));r.id=this._id+"input_"+i+"_"+u;r.className="e-pdfviewer-formFields";r.style.margin="0px";r.style.zIndex=1e3;r.style.left=this._convertPointToPixel(l.X*this._zoomVal)+"px";r.style.top=this._convertPointToPixel(l.Y*this._zoomVal)+"px";r.style.width=this._convertPointToPixel(l.Width*this._zoomVal)+"px";r.style.height=this._convertPointToPixel(l.Height*this._zoomVal)+"px";r.style.position="absolute";b=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("input_container");b.appendChild(r);h=this;a=navigator.userAgent.indexOf("Chrome")!=-1;n(r).on("focus",function(t){var r=n(t.target).attr("type"),e=n(t.target)[0].type,i=n(t.target).css("background-color"),u=i.lastIndexOf(","),f=i.slice(0,u+1)+0+")";(r="checkbox"&&a)&&n(t.target).css("-webkit-appearance","");n(t.target).css("background-color",f);k=t.target.style.borderWidth;n(t.target).css("border-width","0");h._isFormFields=!0});n(r).on("blur",function(t){var e=n(t.target).attr("type"),o=n(t.target)[0].type,i,r,u,f;i=a?n(t.target).css("background-color"):t.target.style["background-color"];r=i.lastIndexOf(",");e=="checkbox"&&n(t.target).prop("selected")==!0?(u=i.slice(0,r+1)+0+")",n(t.target).css("background-color",u)):(f=i.slice(0,r+1)+.2+")",n(t.target).css("background-color",f));n(t.target).css("border-width",k);h._isFormFields=!1});n(r).on("change",function(){h.isDocumentEdited=!0});n(r).unbind("click").on("click touchstart",function(t){var u=n(t.target).attr("type"),o=n(t.target)[0].type,e,f,r,i;if(u=="password"||u=="text"){n(t.target).select();i=n(t.target)[0];n(i).on("keypress",function(t){var u=n(i).attr("maxlength"),r;n(i).val().length>u-2&&(r=n(i).val()+String.fromCharCode(t.keyCode),n(i).val(r),n(i).blur())});n(i).on("keyup",function(){var r=n(i).val(),u=h._pageContents[h._currentPage],f=JSON.parse(u),e=f.PdfRenderedFields,t=i.id.split("_"),o=t[t.length-1];h.isDocumentEdited=r!=e[o].Text?!0:!1});n(i).unbind("change").on("change",function(){var t=n(i).val();n(i).val(t)})}if(u=="radio"){for(e=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields:radio"),r=0;r<f.length;r++)n(f[r]).attr("name")==e&&n(f[r]).prop("checked",!1);n(t.target).prop("checked",!0)}else if(u=="checkbox")n(t.target).prop("checked")==!0?(n(t.target).prop("checked",!0),a&&n(t.target).css("-webkit-appearance","")):(n(t.target).prop("checked",!1),a&&n(t.target).css("-webkit-appearance","none"));else if(o=="select-one"){h.isDocumentEdited=!0;i=n(t.target)[0];n(i).unbind("change").on("change",function(t){for(var u=n(t.target)[0],f=u.options[u.selectedIndex].text,r=u.children,i=0;i<r.length;i++)r[i].text==f?n(r[i]).prop("selected",!0):n(r[i]).prop("selected",!1)})}})}},_saveFormFieldsValue:function(){var r={},o={},t,i,u,e,f;if(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("visibility",""),t=n(".e-pdfviewer-formFields"),t!=null)for(i=0;i<t.length;i++)if(t[i].type=="text"||t[i].type=="password")r[t[i].name]=t[i].value;else if(t[i].type=="radio"&&n(t[i]).prop("checked")==!0)r[t[i].name]=t[i].value;else if(t[i].type=="checkbox")r[t[i].name]=n(t[i]).prop("checked")==!0?n(t[i]).prop("checked"):n(t[i]).prop("checked");else if(t[i].type=="select-one")r[t[i].name]=t[i].options[t[i].selectedIndex].text;else if(t[i].type=="select-multiple"){for(u=[],e=n(t[i]).children(),f=0;f<e.length;f++)n(e[f]).prop("selected")==!0&&u.push(e[f].text);u=JSON.stringify(u);r[t[i].name]=u}o.savedFields=JSON.stringify(r);o.Download=this.fileName;this._saveAs("POST",this.model.serviceUrl,JSON.stringify(o))},_saveAs:function(t,i,r){var u=this;n.ajax({type:t,url:i+"/"+this.model.serverActionSettings.download,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,async:this._isAsynchronousDownload,success:function(n){n&&u._save(n)},error:function(){}})},_generateFormFields:function(t,i){var f=t.PdfRenderedFields,r,h,u,c,l,a,s,o,e,v;if(f!=null)for(r=0;r<f.length;r++)if(h=f[r].LineBounds,u=document.getElementById(this._id+"input_"+i+"_"+r),f[r].PageIndex+1==i){if(f[r].Name=="Password"||f[r].Name=="Textbox")e=f[r].BackColor,c=f[r].FontColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("color","rgb("+c.R+","+c.G+","+c.B+")"),n(u).css("border-width",f[r].BorderWidth),l=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",f[r].MaxLength>0&&n(u).attr("maxlength",f[r].MaxLength),f[r].InsertSpaces&&n(u).css("letter-spacing",l),a=n(u).val(),n(u).val(a);else if(f[r].Name=="RadioButton")n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).attr("name",f[r].GroupName),n(u).css("cursor","pointer");else if(f[r].Name=="CheckBox")n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")"),n(u).css("border-width",f[r].BorderWidth),n(u).prop("checked")==!0&&n(u).prop("checked",!0),n(u).css("cursor","pointer");else if(f[r].Name=="DropDown")for(n(u).css("border-width",f[r].BorderWidth),f[r].SelectedValue==""&&(o=n(u).children()[0],o.id="dropdownhide",n(o).css("display","none"),n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=""),s=0;s<f[r].TextList.length;s++)o=n(u).children()[0].id=="dropdownhide"?n(u).children()[s+1]:n(u).children()[s],n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");else if(f[r].Name=="ListBox")for(n(u).attr("multiple","multiple"),s=0;s<f[r].TextList.length;s++)o=n(u).children()[s],n(o).prop("selected")==!0?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[r].TextList[s],e=f[r].BackColor,n(u).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");f[r].Font!=null&&((f[r].Font.Bold||f[r].Font.Italic||f[r].Font.Strikeout||f[r].Font.Underline)&&(f[r].Font.Italic&&(u.style.fontStyle="italic"),f[r].Font.Bold&&(u.style.fontWeight="Bold")),n(u).css("font-family",f[r].Font.Name),v=this._convertPointToPixel(f[r].Font.Height*this._zoomVal)+"px",n(u).css("font-size",v));u.style.margin="0px";u.style.zIndex=1e3;u.style.left=this._convertPointToPixel(h.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(h.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(h.Width*this._zoomVal)+"px";u.style.height=this._convertPointToPixel(h.Height*this._zoomVal)+"px";u.style.position="absolute"}},_textSelection:function(t,i,r){for(var o,p,w,b,a,c,l,k,nt=navigator.userAgent.indexOf("Edge")!=-1,d=document.documentMode||/Edge/.test(navigator.userAgent),g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=t.selection,v=[],y=[],f=0;f<s.length;f++){var h=" ",e=s[f].LineBounds,u=document.createElement("DIV");u.id=this._id+"text_"+i+"_"+f;u.className="e-pdfviewer-textLayer";o=s[f].Line;y.push(s[f].Line.toString());o=o.replace(/</g,"&lt;");o=o.replace(/>/g,"&gt;");d&&!g?u.innerHTML=o:((this._previousBounds==parseInt(e.Y)||this._previousBounds==parseInt(e.Y+1)||this._previousBounds==parseInt(e.Y-1))&&(h=document.getElementById(this._id+"text_"+i+"_"+(f-1)),h.innerHTML!=" "&&(h.innerHTML=h.innerHTML.replace(/(\r\n|\n|\r)/gm,""))),this._previousBounds=parseInt(e.Y),u.innerHTML=o+"\r\n");p=o.replace(/  +/g," ");p!=" "&&(u.style.whiteSpace="pre");u.style.background="transparent";u.style.position="absolute";u.style.left=this._convertPointToPixel(e.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(e.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(e.Width*this._zoomVal)+"px";u.style.color="transparent";u.style.fontSize=this._convertPointToPixel(e.Height*this._zoomVal)+"px";u.style.fontFamily="sans-serif";u.style.whiteSpace="pre";u.style.opacity="0.2";u.style.transformOrigin="0%";r.fontFamily="sans-serif";r.fontSize=u.style.fontSize;r.font=u.style.fontSize+" "+u.style.fontFamily;w=r.measureText(s[f].Line).width;b=parseFloat(u.style.width)/w;u.style.transform="scaleX("+b+")";a=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("text_container");a.appendChild(u);c=a.getBoundingClientRect();l=u.getBoundingClientRect();(l.width+l.left>=c.width+c.left||l.width>c.width)&&(n(u).css("width","auto"),k=u.clientWidth,n(u).css("width",k+"px"));v.push(u)}this._previousBounds=null;this._textDivs[i]=v;this._textContents[i]=y},_resizeSelection:function(t,i,r){for(var e,u,c,l,a,v,y,o=t.selection,f=0;f<o.length;f++)if(e=o[f].LineBounds,u=document.getElementById(this._id+"text_"+i+"_"+f),u){c=o[f].Line;u.style.position="absolute";u.style.left=this._convertPointToPixel(e.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(e.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(e.Width*this._zoomVal)+"px";l=c.replace(/  +/g," ");l!=" "&&(u.style.whiteSpace="pre");u.style.transformOrigin="0%";u.style.opacity="0.2";u.style.fontSize=this._convertPointToPixel(e.Height*this._zoomVal)+"px";r.font=u.style.fontSize+" "+u.style.fontFamily;r.fontSize=u.style.fontSize;a=r.measureText(o[f].Line).width;v=parseFloat(u.style.width)/a;u.style.transform="scaleX("+v+")";var p=document.getElementById(this._id+"selectioncanvas_"+i),s=p.getBoundingClientRect(),h=u.getBoundingClientRect();(h.width+h.left>=s.width+s.left||h.width>s.width)&&(n(u).css("width","auto"),y=u.clientWidth,n(u).css("width",y+"px"))}},_maintainSelection:function(){var n=this._selectionNodes,t=document.createRange(),i,r;n.anchorNode!=null&&(i=n.anchorNode.compareDocumentPosition(n.focusNode),r=!1,(!i&&n.anchorOffset>n.focusOffset||i===Node.DOCUMENT_POSITION_PRECEDING)&&(r=!0),r?(t.setStart(n.focusNode,n.focusOffset),t.setEnd(n.anchorNode,n.anchorOffset)):(t.setStart(n.anchorNode,n.anchorOffset),t.setEnd(n.focusNode,n.focusOffset)),this._selectionRange=t);n.removeAllRanges()},_showPageLoadingIndicator:function(t,i){i?n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","block"):n("#"+this._id+"pageDiv_"+t+"_WaitingPopup").css("display","none")},_imageRendering:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this._zoomVal,p=new Image,v=this,w=navigator.userAgent;w.indexOf("Chrome")==-1&&(p.onload=function(){for(var nt,d,ht,st,e,rt,pt=!1,g=0;g<u.length;g++)if(pt==!1)for(nt=u[g],f.setTransform(nt[0]*y,nt[1]*y,nt[2]*y,nt[3]*y,nt[4]*y,nt[5]*y),t[a]!=i&&f.drawImage(t[a],0,0,1,1),d=s[g],d=d+1,ht=o[g];d<ht.length;){var p=ht[d],ct=p.color,b=p.matrix;b!=null&&(b=b.Elements);var lt=p.brush,k=p.pathValue,kt=p.iscliping,wt=p.restorecanvas,bt=p.imagedata,tt=p.fillrule,dt=p.isFillandStroke,gt=p.fillcolor,at=p.strokecolor,vt=p.linewidth,yt=p.linecap,ft=p.linearGradientBrush,et=p.textureBrushs,ot=p.charID,ti=p.rectvalue;if(k!=null?(k=k.split(";"),ot&&(h[ot]=k)):k==null&&ot&&(k=h[ot]),wt==!1&&f.save(),k!=i&&f.setTransform(b[0]*y,b[1],b[2],b[3]*y,b[4]*y,b[5]*y),k!=null){for(f.beginPath(),st=0;st<k.length;st++)e=k[st],rt=e[0],rt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):rt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):rt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):rt=="Z"&&f.closePath();kt==!0?(tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(tt)),f.clip()):dt==i?lt=="Fill"?(f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):ct,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill()):lt=="FillandStroke"?(f.fillStyle=ct,f.fill(),f.strokeStyle=at,f.stroke()):lt=="Stroke"?(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=ct,f.lineWidth=vt,f.lineCap=yt,f.stroke()):(f.strokeStyle=at,f.lineWidth=vt,f.lineCap=yt,f.stroke(),f.fillStyle=ft!=i?v._getGradientBrush(ft,f):et!=i?v._createTextureBrush(et,f,p):gt,tt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(tt)),f.fill())}if(wt&&f.restore(),bt!=i){pt=!0;r.pop();u.pop();o.pop();s.pop();r.push(bt);u.push(b);o.push(n);s.push(d);g=-1;a++;break}d++}else v._imageRendering(n,t,r,u,f,g,o,s,h,c,l,a),a++;if(d==n.length&&v._pageSize[l-1].PageRotation!=0){var w=document.getElementById(v._id+"pagecanvas_"+l),ni=w.toDataURL(),it=w.getContext("2d"),ut=new Image;ut.onload=function(){it.clearRect(0,0,w.width,w.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(w.width=v._zoomVal*v._pageSize[l-1].PageHeight,w.height=v._zoomVal*v._pageSize[l-1].PageWidth,w.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(w.width=v._zoomVal*v._pageSize[l-1].PageWidth,w.height=v._zoomVal*v._pageSize[l-1].PageHeight,w.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",w.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");it.save();it.translate(w.width/2,w.height/2);it.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);it.drawImage(ut,-ut.width/2,-ut.height/2);it.restore()};ut.src=ni}});p.src=r[e];t.push(p);w.indexOf("Chrome")!=-1&&(p.addEventListener("load",this._imageOnLoad(n,t,r,u,f,e,o,s,h,c,l,a,y)),this._imageObj.push(p))},_imageOnLoad:function(n,t,r,u,f,e,o,s,h,c,l,a,v){for(var d,g,et,ft,y,tt,pt=this,at=!1,k=0;k<u.length;k++)if(at==!1)for(d=u[k],f.setTransform(d[0]*v,d[1]*v,d[2]*v,d[3]*v,d[4]*v,d[5]*v),t[a]!=i&&f.drawImage(t[a],0,0,1,1),g=s[k],g=g+1,et=o[k];g<et.length;){var p=et[g],ot=p.color,w=p.matrix;w!=null&&(w=w.Elements);var st=p.brush,b=p.pathValue,wt=p.iscliping,vt=p.restorecanvas,yt=p.imagedata,nt=p.fillrule,bt=p.isFillandStroke,kt=p.fillcolor,ht=p.strokecolor,ct=p.linewidth,lt=p.linecap,it=p.linearGradientBrush,rt=p.textureBrushs,ut=p.charID,dt=p.rectvalue;if(b!=null?(b=b.split(";"),ut&&(h[ut]=b)):b==null&&ut&&(b=h[ut]),vt==!1&&f.save(),b!=i&&f.setTransform(w[0]*v,w[1],w[2],w[3]*v,w[4]*v,w[5]*v),b!=null){for(f.beginPath(),ft=0;ft<b.length;ft++)y=b[ft],tt=y[0],tt=="M"?(y=y.substring(1,y.length),y=y.split(" "),f.moveTo(y[0],y[1])):tt=="L"?(y=y.substring(1,y.length),y=y.split(" "),f.lineTo(y[0],y[1])):tt=="C"?(y=y.substring(1,y.length),y=y.split(" "),f.bezierCurveTo(y[0],y[1],y[2],y[3],y[4],y[5])):tt=="Z"&&f.closePath();wt==!0?(nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(nt)),f.clip()):bt==i?st=="Fill"?(f.fillStyle=it!=i?this._getGradientBrush(it,f):rt!=i?this._createTextureBrush(rt,f,p):ot,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill()):st=="FillandStroke"?(f.fillStyle=ot,f.fill(),f.strokeStyle=ht,f.stroke()):st=="Stroke"?(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ot,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke(),f.fillStyle=it!=i?this._getGradientBrush(it,f):rt!=i?this._createTextureBrush(rt,f,p):kt,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill())}if(vt&&f.restore(),yt!=i){at=!0;r.pop();u.pop();o.pop();s.pop();r.push(yt);u.push(w);o.push(n);s.push(g);k=-1;a++;break}g++}else pt._imageRendering(n,t,r,u,f,k,o,s,h,c,l,a),a++},_createTextureBrush:function(n,t,i){var e=i.texturFields[0].Image,u=i.texturFields[0].Width,f=i.texturFields[0].Height,o="data:image/png;base64,"+e,r=new Image;navigator.userAgent.indexOf("Firefox")!=-1?(r.src=this._imageSrcCollection[0],this._loadimages(r,u,f,t),this._imageSrcCollection.shift()):(r.src=o,this._loadimages(r,u,f,t))},_loadimages:function(n,t,i,r){var u=document.createElement("canvas"),e=u.getContext("2d"),f;return u.width=t,u.height=i,e.drawImage(n,0,0,n.width,n.height,0,0,u.width,u.height),f=r.createPattern(u,"repeat"),r.fillStyle=f,r.fill(),f},_getGradientBrush:function(n,t){for(var i,s,r=n.Rectangle,f=n.InterpolationColors,h=f.Colors,e=f.Positions,o=t.createLinearGradient(r.X,r.Y,r.Width,r.Height),u=0;u<e.length;u++)i=h[u],i=i.split(","),s=this._rgb2Color(i[0],i[1],i[2]),o.addColorStop(e[u],s);return o},_rgb2Color:function(n,t,i){return"#"+this._byte2Hex(n)+this._byte2Hex(t)+this._byte2Hex(i)},_byte2Hex:function(n){var t="0123456789ABCDEF";return String(t.substr(n>>4&15,1))+t.substr(n&15,1)},_doAjaxPost:function(t,i,r,u){var f=this,e=u;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);this._ajaxRequestState=n.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:r,traditional:!0,success:function(n){var i,r,t,u,s,o;typeof n=="object"&&(n=JSON.stringify(n));i=JSON.parse(n);r=i.pagecount;r==0?f._unLoad():(typeof n=="object"?f[e](JSON.stringify(n)):f[e](n),t=i.filename.split("\\"),u=t.length>1?t[t.length-1]:f._fileName!=""&&f._fileName!=null?f._fileName:null,s={fileName:u},f._raiseClientEvent("documentLoad",null),f.model.allowClientBuffering&&(o=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),f._pagesGot.push(parseInt(o.currentpage))))},error:function(n){if(e!="_clearCurrentServerCache"){if(n.readyState==0)return;alert("Exception"+n.responseText)}}})},_raiseClientEvent:function(i,r){var f=this.model[i],e=[],u;e=r===null?"":r;f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(i=="pageChange"?u={currentPageNumber:parseInt(r.currentPageNumber)}:i=="zoomChange"?u={previousZoomPercentage:r.previousZoomPercentage,currentZoomPercentage:r.currentZoomPercentage}:i=="hyperlinkClick"?u={hyperlink:r.hyperlink}:i=="pageClick"?u={XCoordinate:r.offsetX,YCoordinate:r.offsetY}:i=="bufferStart"?u={isBuffering:!0}:i=="bufferEnd"?u={isBuffering:!1}:i=="documentLoad"&&(u={fileName:r.fileName}),this._trigger(i,u)))},_getPageModel:function(i){this._on(n(window),"resize",this._viewerResize);i&&(this._isJsondataAvailable=!0);(i==""||i==null)&&(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0"));var r;r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d);r&&(this._pageWidth=r.pagewidth,this._pageHeight=r.pageheight,this._imageUrl=r.imageurl,this._pageSize=r.pagesize,this._totalPages=r.pagecount,this.pageCount=this._totalPages,this._pdfFileName=r.filename,this.fileName?this._pdfFileName=this.fileName:this._pdfFileName&&(this.fileName=this._pdfFileName),this._currentPage=r.currentpage,this._restrictionSummary=r.restrictionSummary,this._isRestrictionEnabled(),this._isPrintRestrict?this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"):this._isPrintRestrict||this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_Print"),this.currentPageNumber=this._currentPage,this._isToolbarClick||this._enableToolbarItems(),this._gotoPage(this._currentPage),this._toolbarResizeHandler(),this._setSearchToolbarTop(),this._resizeSearchToolbar(),this._drawPdfPage(i),this._showNavigationIndicator(!1),this._showloadingIndicator(!1))},_isRestrictionEnabled:function(){if(this._restrictionSummary)for(var n=0;n<this._restrictionSummary.length;n++)switch(this._restrictionSummary[n]){case"Print":this._isPrintRestrict=!0;break;case"CopyContent":this._isCopyRestrict=!0;break;default:this._isPrintRestrict=!1;this._isCopyRestrict=!1}},_print:function(){this._abortPrinting=!1;this._isPrintingProcess=!0;this._raiseClientEvent("beforePrint",null);this._showPrintLoadingIndicator(!0);this._setViewerForPrint();this._scrollPageByPage()},_setViewerForPrint:function(){this._isPrinting=!0;this._currentPageBackup=this._currentPage;this._scrollTop=n("#"+this._id+"_viewerContainer").scrollTop();this._zoomValBackup=this._zoomVal;this._zoomLevelBackup=this._zoomLevel;this._zoomVal!=1&&(this._zoomVal=1,this._zoomLevel=2,this._fitTypeBackup=this._fitType,this._zoomContainer(this._zoomVal,!1))},_scrollPageByPage:function(){for(var i,t,r,n=1;n<=this._totalPages;n++)if(this._scrollTriggered=!1,i=this._scrollToPageNo(n),i)break;this._isPrinting=!1;i||(t=navigator.userAgent,t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("Firefox")!=-1?(r=this,setTimeout(function(){r._printPages()},1e3)):this._printPages(),this._raiseClientEvent("afterPrint",null))},_scrollToPageNo:function(n){var r=this._currentPage,t,i;if(this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages))return this._currentPage=t,i=document.getElementById(this._id+"_viewerContainer"),i.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._scrollPage(this._pageHeight)},_scrollPage:function(){var n,i;return this._scrollTriggered=!0,n={},n.viewerAction=this._viewerAction.getPageModel,n.pageindex=this._currentPage.toString(),i=this.model.serviceUrl+"/"+this.model.serverActionSettings.print,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostPrint("POST",i,JSON.stringify(n)):this._doAjaxPostPrint("POST",this.model.serviceUrl,JSON.stringify({jsonResult:n})),!0},_printPages:function(){var e=navigator.userAgent,r=this,o=this._printIframe,u,i,w,b,s,a,k,nt,v,g,c;for(o.name="printFrame",o.style.position="absolute",o.style.top="-100000000px",document.body.appendChild(o),u=o.contentWindow?o.contentWindow:o.contentDocument.document?o.contentDocument.document:o.contentDocument,u.document.open(),e.indexOf("Edge")==-1?e.indexOf("Chrome")!=-1||e.indexOf("Safari")!=-1||e.indexOf("Firefox")!=-1?(u.document.write("<!DOCTYPE html>"),u.document.write("<html moznomarginboxes mozdisallowselectionprint><head><style>html, body { height: 100%; } img { height: 100%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(u.document.write("<!DOCTYPE html>"),u.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; display: block; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0cm; size: 816px 1056px;}<\/style><\/head><body><center>")),i=1;i<=r._totalPages;i++){var l="",h="",f=document.getElementById(this._id+"pagecanvas_"+i),p=document.getElementById(this._id+"selectioncanvas_"+i);for(l=f.toDataURL(),window.innerWidth<screen.width?(h=r._zoomVal,r._topValue=!0,w=r._pageContents[parseInt(i)],b=r._printPdfPages(w),l=b.toDataURL()):h=1,e.indexOf("Firefox")==-1&&r._pageSize[i-1].PageWidth>r._pageSize[i-1].PageHeight&&(s=f.getContext("2d"),a=new Image,s.clearRect(0,0,f.width,f.height),f.width=r._pageSize[i-1].PageHeight,f.height=r._pageSize[i-1].PageWidth,f.style.height=r._pageSize[i-1].PageWidth+"px",f.style.width=r._pageSize[i-1].PageHeight+"px",s.save(),s.translate(f.width/2,f.height/2),s.rotate(-Math.PI/2),a.src=l,s.drawImage(a,-a.width/2,-a.height/2),s.restore(),l=f.toDataURL()),u.document.write('<div style="margin:0px;width:816px;height:1056px;position:relative"><img src="'+l+'" id="image_'+i+'" /><div id="fields_'+i+'"><\/div><\/div><br/>'),k=n(p).find(".e-pdfviewer-formFields").length,nt=2,v=0;v<k;v++){var d="",y=n(p).find(".e-pdfviewer-formFields")[v],t=y.cloneNode(!0);y.type=="select-one"&&(d=y.selectedIndex,g=t.children,n(g[d]).prop("selected",!0));var tt=r._pageSize[i-1].PageWidth,it=r._pageSize[i-1].PageHeight,rt=it/1056,ut=tt/816,ft=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;(ft||e.indexOf("Edge")!=-1)&&(n(t).css("left",parseFloat(n(t).css("left"))+"px"),n(t).css("top",parseFloat(n(t).css("top"))-6+"px"));window.innerWidth<screen.width&&(n(t).css("left",parseFloat(n(t).css("left"))/h+"px"),n(t).css("top",parseFloat(n(t).css("top"))/h+"px"));n(t).css("left",parseFloat(n(t).css("left"))/ut+"px");n(t).css("top",parseFloat(n(t).css("top"))/rt+"px");n(t).css("width",parseFloat(n(t).css("width"))/h+"px");n(t).css("height",parseFloat(n(t).css("height"))/h+"px");n(u.document.getElementById("fields_"+i)).append(t)}}if(this._topValue=!1,u.document.write("<\/center><\/body><\/html>"),navigator.userAgent.match("Firefox")?window.frames.printFrame.close():u.document.close(),e.indexOf("Edge")==-1)if(e.indexOf("Chrome")!=-1||e.indexOf("Safari")!=-1||e.indexOf("Firefox")!=-1)r=this,setTimeout(function(){window.frames.printFrame.focus();window.frames.printFrame.print();document.body.removeChild(o)},500);else{c=n("iframe")[0];try{c.contentWindow.document.execCommand("print",!1,null)}catch(et){c.contentWindow.print()}}else{c=n("iframe")[0];try{c.contentWindow.document.execCommand("print",!1,null)}catch(et){c.contentWindow.print()}}this._restoreViewer()},_printCancel:function(){this._abortPrinting=!0;this._restoreViewer();this._raiseClientEvent("afterPrint",null)},_restoreViewer:function(){var n,t,i,r;for(this._isPrintingProcess=!1,this._currentPage=this._currentPageBackup,this._zoomVal=this._zoomValBackup,this._zoomLevel=this._zoomLevelBackup,n=1;n<=this._totalPages;n++)t=document.getElementById(this._id+"pagecanvas_"+n),this._pageSize[n-1].PageWidth>this._pageSize[n-1].PageHeight&&(t.style.height=this._pageSize[n-1].PageHeight+"px",t.style.width=this._pageSize[n-1].PageWidth+"px",t.width=this._pageSize[n-1].PageWidth,t.height=this._pageSize[n-1].PageHeight,this._renderedCanvasList.length=0);this._fitTypeBackup==null?this._zoomContainer(this._zoomVal,!1):(i=this._fitToPage(this._fitTypeBackup),this._applyDropDownVal(i,!0,!1),this._updatePageFitModel(this._fitType));r=document.getElementById(this._id+"_viewerContainer");r.scrollTop=this._scrollTop;this._showPrintLoadingIndicator(!1)},_doAjaxPostPrint:function(i,r,u){var e=JSON.parse(u),o,f;this._pdfService==t.PdfViewer.PdfService.Local?this._currentPrintPage=e.pageindex:(o=e.jsonResult,this._currentPrintPage=o.pageindex);this.model.allowClientBuffering&&this._isBuffering&&this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);f=this;n.ajax({type:i,url:r,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:u,traditional:!0,success:function(n){var i,u,r;(typeof n=="object"?f._printPdfPages(JSON.stringify(n)):f._printPdfPages(n),f._scrollTriggered=!1,f._abortPrinting)||(parseFloat(f._currentPrintPage)<f.pageCount?(i={},i.viewerAction=f._viewerAction.getPageModel,i.pageindex=(parseFloat(f._currentPrintPage)+1).toString(),u=f.model.serviceUrl+"/"+f.model.serverActionSettings.print,f._pdfService==t.PdfViewer.PdfService.Local?f._doAjaxPostPrint("POST",u,JSON.stringify(i)):f._doAjaxPostPrint("POST",f.model.serviceUrl,JSON.stringify({jsonResult:i}))):(r=navigator.userAgent,r.indexOf("Chrome")!=-1||r.indexOf("Safari")!=-1||r.indexOf("Firefox")!=-1?setTimeout(function(){f._printPages()},1e3):f._printPages(),f._raiseClientEvent("afterPrint",null)))},error:function(n){n.readyState==0}})},_printPdfPages:function(r){var ht=0,ti=r,w,ct,e,l,k,ft,nt,v,s,d,st,o,f;if(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),w=parseInt(jsondata.currentpage),this._showPageLoadingIndicator(w,!0),ct=jsondata.imagestream,e=parseInt(jsondata.currentpage),this._renderedCanvasList.indexOf(e)==-1&&this._renderedCanvasList.push(parseInt(jsondata.currentpage)),this._pageContents[parseInt(jsondata.currentpage)]=ti,this._topValue==!0){var lt=parseInt(jsondata.currentpage),l=document.createElement("canvas"),at=this._pageSize[lt-1].PageHeight,vt=this._pageSize[lt-1].PageWidth;l.style.visibility="hidden";l.style.width=vt+"px";l.style.height=at+"px";l.style.backgroundColor="white";l.className="e-pdfviewer-pageCanvas";l.height=at;l.width=vt}else l=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));(this._pageSize[e-1].PageRotation==90||this._pageSize[e-1].PageRotation==270)&&(l.height=this._zoomVal*this._pageSize[e-1].PageHeight,l.width=this._zoomVal*this._pageSize[e-1].PageWidth,l.style.width=this._zoomVal*this._pageSize[e-1].PageWidth+"px",l.style.height=this._zoomVal*this._pageSize[e-1].PageHeight+"px");var u=l.getContext("2d"),ut=[],yt=[],ii=[],p=navigator.userAgent,g,pt=[];for(this._regenerateFormFields(jsondata,w),k=n("#"+this._id+"selectioncanvas_"+w).children(),v=0;v<k.length;v++)(k[v].hasAttribute("href")||n(k[v]).hasClass("e-pdfviewer-formFields"))&&n(k[v]).remove();for(this._createFormFields(jsondata,w),ft=ct.textelements,nt=0;nt<ft.length;nt++){var h=ft[nt],et=h.color,c=h.matrix;c!=null&&(c=c.Elements);var wt=h.brush,a=h.pathValue,ri=h.iscliping,bt=h.restorecanvas,ot=h.imagedata,b=h.fillrule,ui=h.isFillandStroke,fi=h.fillcolor,kt=h.strokecolor,dt=h.linewidth,gt=h.linecap,tt=h.linearGradientBrush,it=h.textureBrushs,rt=h.charID;if(a!=null?(a=a.split(";"),rt&&(pt[rt]=a)):a==null&&rt&&(a=pt[rt]),bt==!1&&u.save(),a!=i&&u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),a!=null){for(u.beginPath(),v=0;v<a.length;v++)s=a[v],d=s[0],d=="M"?(s=s.substring(1,s.length),s=s.split(" "),u.moveTo(s[0],s[1])):d=="L"?(s=s.substring(1,s.length),s=s.split(" "),u.lineTo(s[0],s[1])):d=="C"?(s=s.substring(1,s.length),s=s.split(" "),u.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])):d=="Z"&&u.closePath();ri==!0?(b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(b)),u.clip()):ui==i?wt=="Fill"?(u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):et,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill()):wt=="FillandStroke"?(u.fillStyle=et,u.fill(),u.strokeStyle=kt,u.stroke()):(u.strokeStyle=et,u.lineWidth=dt,u.lineCap=gt,u.stroke()):(u.strokeStyle=kt,u.lineWidth=dt,u.lineCap=gt,u.stroke(),u.fillStyle=tt!=i?this._getGradientBrush(tt,u):it!=i?this._createTextureBrush(it,u,h):fi,b=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(b)),u.fill())}bt&&u.restore();ot!=i&&((g=p.indexOf("Firefox"))==-1&&(g=p.indexOf("Chrome"))==-1&&(g=p.indexOf("Safari"))==-1&&(g=p.indexOf("AppleWebKit"))==-1||this._topValue?(st=new Image,st.src=ot,u.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]),u.drawImage(st,0,0,1,1)):(ut.push(ot),yt.push(c),this._printWinImageRendering(ut,yt,ii,u,l,ht,e),ht++))}if(o=l,f=this,this._pageSize[e-1].PageRotation!=0&&!(ut.length!=0&&(p.indexOf("Firefox")!=-1||p.indexOf("Chrome")!=-1))){o=document.getElementById(this._id+"pagecanvas_"+parseInt(jsondata.currentpage));var ni=o.toDataURL(),u=o.getContext("2d"),y=new Image;p.indexOf("Firefox")!=-1?(y.onload=function(){u.clearRect(0,0,o.width,o.height);f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px");u.save();u.translate(o.width/2,o.height/2);u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2);u.drawImage(y,-y.width/2,-y.height/2);u.restore()},y.src=ni):(u.clearRect(0,0,o.width,o.height),f._pageSize[e-1].PageRotation==90||f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight,o.height=f._zoomVal*f._pageSize[e-1].PageWidth,o.style.height=f._zoomVal*f._pageSize[e-1].PageWidth+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageHeight+"px"):(o.width=f._zoomVal*f._pageSize[e-1].PageWidth,o.height=f._zoomVal*f._pageSize[e-1].PageHeight,o.style.height=f._zoomVal*f._pageSize[e-1].PageHeight+"px",o.style.width=f._zoomVal*f._pageSize[e-1].PageWidth+"px"),u.save(),u.translate(o.width/2,o.height/2),u.rotate(f._pageSize[e-1].PageRotation/2*Math.PI/2),y.src=ni,u.drawImage(y,-y.width/2,-y.height/2),u.restore())}return this._showPageLoadingIndicator(w,!1),o},_printWinImageRendering:function(n,t,r,u,f,e,o){var s=this,h=new Image;h.onload=function(){var f=t[e];if(u.setTransform(f[0],f[1],f[2],f[3],f[4],f[5]),r[e]!=i&&u.drawImage(r[e],0,0,1,1),r.length-1==e&&s._pageSize[o-1].PageRotation!=0){var n=document.getElementById(s._id+"pagecanvas_"+o),l=n.toDataURL(),h=n.getContext("2d"),c=new Image;c.onload=function(){h.clearRect(0,0,n.width,n.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(n.width=s._zoomVal*s._pageSize[o-1].PageHeight,n.height=s._zoomVal*s._pageSize[o-1].PageWidth,n.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(n.width=s._zoomVal*s._pageSize[o-1].PageWidth,n.height=s._zoomVal*s._pageSize[o-1].PageHeight,n.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px",n.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px");h.save();h.translate(n.width/2,n.height/2);h.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);h.drawImage(c,-c.width/2,-c.height/2);h.restore()};c.src=l}};h.src=n[e];r.push(h)},_showPrintButton:function(t){t?(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isPrintHidden=!1):(n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isPrintHidden=!0)},_showDownloadButton:function(t){t?(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isDownloadHidden=!1):(n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isDownloadHidden=!0)},_updatePageNavigation:function(n,t){n>1&&n<t?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==1&&n<t?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):n==t&&t!=1?(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")):(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this._isJsondataAvailable||(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast"));this.currentPageNumber=this._currentPage},_gotoFirstPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoLastPage:function(){if(this._totalPages&&this._totalPages>0){this._currentPage=this._totalPages;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoNextPage:function(){if(this._totalPages&&this._currentPage<this._totalPages){this._currentPage=this._currentPage+1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPreviousPage:function(){if(this._totalPages&&this._currentPage>1){this._currentPage=this._currentPage-1;var n=document.getElementById(this._id+"_viewerContainer");n.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);this._pageviewscrollchanged(this._pageHeight);this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPageNo:function(n){var i={currentPageNumber:0},r=n,f=this._currentPage,t,u;this._totalPages&&(t=parseInt(n),t>=1&&t<=this._totalPages&&this._currentPage!=t&&(this._currentPage=t,u=document.getElementById(this._id+"_viewerContainer"),u.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages)));f!=r&&(i.currentPageNumber=r,this._raiseClientEvent("pageChange",i))},_gotoPage:function(t){this._setPageSize(this._pageHeight,this._pageWidth,null,null);var i=parseInt(t);this._updatePageNavigation(i,this._totalPages);this._totalPages>0&&this._totalPages&&(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(i))},_allowOnlyNumbers:function(n){return(n.which<48||n.which>57)&&n.which!=8&&n.which!=13?!1:!0},_onkeyPress:function(t){if(t.which==13)try{var i=parseInt(n(t.currentTarget).val());i>0&&i<=this.pageCount?this._gotoPageNo(i):n(t.currentTarget).val(this.currentPageNumber)}catch(r){}},_showPageNavigationControls:function(t){t?(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","block"),n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),this._isNavigationHidden=!1):(n("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","none"),this._isNavigationHidden=!0,!this._isPrintHidden&&this._isNavigationHidden&&this._isMagnificationHidden&&n("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"))},_showFittoPage:function(t){t?(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","block")):(n("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","none"))},_resetPage:function(){var t=n("#"+this._id+"_pageviewContainer"),r=n("#"+this._id+"_pageviewOuterline");t[0]!=i&&(r.css({width:t.width(),height:t.height()}),r.css({width:t[0].getBoundingClientRect().width,height:t[0].getBoundingClientRect().height}))},_applyFitToWidth:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToWidth");this._applyDropDownVal(_scaleXY,!0,!1);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_applyFitToPage:function(){this._isAutoZoom=!1;_scaleXY=this._fitToPage("fitToPage");this._applyDropDownVal(_scaleXY,!1,!0);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_updatePageFitModel:function(n){n=="fitToWidth"?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage")):n=="fitToPage"&&(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"))},_applyFitToWidthAuto:function(){_scaleXY=this._fitToAuto("fitToWidth");this._applyDropDownValAuto(_scaleXY,!0,!1)},_fitToAuto:function(){this._resetPage();var r=n("#"+this._id+"_viewerContainer"),o=n("#"+this._id+"_pageviewContainer"),s=n("#"+this._id+"_pageviewOuterline");if(r[0]!=i){var f=r.width(),h=r.height(),e=this._pageWidth,c=this._pageHeight,t=1,u=1;return t=(f-25)/e,this._isAutoZoom&&(t=Math.min(1,t),t==1&&(this._zoomLevelBackup=this._zoomLevel=3)),window.innerWidth>=screen.width&&(this._isWindowResizing=!1),u=t,this._zoomVal=t,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),this._initRerendering(),this._updateZoomButtons(),{scalX:t,scalY:u}}},_fitToPage:function(t){var u,l;if(this._pageSize!=i){this._resetPage();var s=n("#"+this._id+"_viewerContainer"),a=n("#"+this._id+"_pageviewContainer"),v=n("#"+this._id+"_pageviewOuterline"),e=s.width(),h=s.height();if(t=="fitToWidth")for(u=0;u<this._pageSize.length;u++)l=0,pageWidth=this._pageSize[u].PageRotation==90||this._pageSize[u].PageRotation==270?this._pageSize[u].PageHeight:this._pageSize[u].PageWidth,pageWidth>this._highestWidth&&(this._highestWidth=pageWidth);else this._highestWidth=this._pageWidth;var o=this._highestWidth,c=this._pageHeight,r=1,f=1;return this._fitType=t,t=="fitToPage"?(r=(e-25)/o,f=h/c,h>c&&(f=this._preZoomVal),e>o&&(r=this._preZoomVal),r=f,this._zoomVal=r,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal)):t=="fitToWidth"&&(r=(e-25)/o,f=r,this._zoomVal=r,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal)),this._updateZoomButtons(),{scalX:r,scalY:f}}},_selectDropDownIndex:function(t){var i=n(n("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active");n("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,r,u){if(t!=i)if(u){var f=t.scalX>t.scalY?t.scalY:t.scalX;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(f*100)+"%");this._ejDropDownInstance.model.value=Math.round(f*100)+"%";this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else r?(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalX*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalX*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_applyDropDownValAuto:function(t){this._isAutoZoom?(n("#"+this._id+"_toolbar_zoomSelection_hidden").val("Auto"),this._ejDropDownInstance.model.value="Auto"):(n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(t.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(t.scalY*100)+"%",this._ejDropDownInstance.model.selectedIndices[0]="");n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")},_showFitToPagetip:function(){var t=n("#"+this._id+"_toolbar_fittoPagePopup"),r,i;t.length>0||(t=this._renderPageFitPopup(),n("body").append(t),this._on(n("#"+this._id+"_toolbar_fittoPagePopup li.e-pdfviewer-popupli"),"click",this._pageFitMenuClick));t.css("display")=="block"?t.css("display","none"):t.css("display","block");r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0].getBoundingClientRect();i=n(n("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0]).offset();t.css({top:i.top+r.height-3,left:i.left-5})},_zoomValChange:function(t){var f,e,r,u;this._ejViewerInstance||(f=this._id.split("_toolbar")[0],e=n("#"+f),ejViewerInstance=e.ejPdfViewer("instance"));t.value!=i?(t.value=="Auto"?(ejViewerInstance.model.isResponsive=!0,r=1,ejViewerInstance._zoomLevel=3,ejViewerInstance._isAutoZoom=!0):(r=parseInt(t.value)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._zoomLevel=t.itemId,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(r,!1)):t.target.innerHTML!=i&&(u=t.target.innerHTML,t.target.innerHTML=="Auto"?(ejViewerInstance.model.isResponsive=!0,r=1,ejViewerInstance._isAutoZoom=!0):(u=u.substring(0,u.length-1),r=parseInt(u)/100,ejViewerInstance.model.isResponsive=!1,ejViewerInstance._isAutoZoom=!1),ejViewerInstance._zoomContainer(r,!1))},_zoomIn:function(){if(this._zoomLevel>=7?this._zoomLevel=7:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomOut:function(){if(this._zoomLevel<=1?this._zoomLevel=1:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}this.model.isResponsive=!1},_zoomInContainer:function(t,i){var k=i,v=n("#"+this._id+"_viewerContainer"),y=n("#"+this._id+"_pageviewContainer"),e,c,u,w,o,s,h,f,b,a,r;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+k);var nt=y.width(),tt=y.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},p=document.getElementById(this._id+"_viewerContainer"),d=p.scrollTop,g=d/this._previousZoom*this._zoomVal,it="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++)c=0,this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(e=(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2,c=this._pageSize[r-1].PageHeight):(e=(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2,c=this._pageSize[r-1].PageWidth),(e<0||this._fitType=="fitToWidth"&&c==this._highestWidth)&&(e=5),u=document.getElementById(this._id+"pagecanvas_"+r),w=u.getContext("2d"),this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",o=this._pageSize[r-1].PageWidth*this._zoomVal,s=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=s+"px",u.style.height=o+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",o=this._pageSize[r-1].PageHeight*this._zoomVal,s=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=s+"px",u.style.height=o+"px"),w.clearRect(0,0,u.clientWidth,u.clientHeight),h=n("#"+this._id+"pageDiv_"+r),h[0].style.top=this._pageLocation[r]*this._zoomVal+"px",h[0].style.left=e+"px",h[0].style.width=s+"px",h[0].style.height=o+"px",f=document.getElementById(this._id+"selectioncanvas_"+r),f.style.height=u.height+"px",f.style.width=u.width+"px",f.style.position="absolute",f.style.left=0,f.style.top=0,f.style.backgroundColor="transparent",f.style.zIndex="2",this._isAutoZoom||(n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"}),b=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup"),a=b.childNodes[0],a.style.top=(u.height-a.clientHeight)/2+"px");if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?v.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):v.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].removeEventListener("load",this._imageOnLoad);p.scrollTop=g;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._preZoomVal=this._zoomVal;this._previousZoom=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100);this._highestWidth=0},_zoomOutContainer:function(t,i){var b=i,a=n("#"+this._id+"_viewerContainer"),v=n("#"+this._id+"_pageviewContainer"),h,u,p,e,o,s,f,w,l,r;this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+b);var g=v.width(),nt=v.height(),c={currentZoomPercentage:0,previousZoomPercentage:0},y=document.getElementById(this._id+"_viewerContainer"),k=y.scrollTop,d=k/this._previousZoom*this._zoomVal,tt="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++)h=this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(this.element.width()-this._pageSize[r-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[r-1].PageWidth*this._zoomVal)/2,h<0&&(h=5),u=document.getElementById(this._id+"pagecanvas_"+r),p=u.getContext("2d"),this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(u.height=this._pageSize[r-1].PageWidth*this._zoomVal,u.width=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.height=this._pageSize[r-1].PageWidth*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageHeight*this._zoomVal+"px",e=this._pageSize[r-1].PageWidth*this._zoomVal,o=this._pageSize[r-1].PageHeight*this._zoomVal,u.style.width=o+"px",u.style.height=e+"px"):(u.height=this._pageSize[r-1].PageHeight*this._zoomVal,u.width=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.height=this._pageSize[r-1].PageHeight*this._zoomVal+"px",u.style.width=this._pageSize[r-1].PageWidth*this._zoomVal+"px",e=this._pageSize[r-1].PageHeight*this._zoomVal,o=this._pageSize[r-1].PageWidth*this._zoomVal,u.style.width=o+"px",u.style.height=e+"px"),p.clearRect(0,0,u.clientWidth,u.clientHeight),s=n("#"+this._id+"pageDiv_"+r),s[0].style.top=this._pageLocation[r]*this._zoomVal+"px",s[0].style.left=h+"px",s[0].style.width=o+"px",s[0].style.height=e+"px",f=document.getElementById(this._id+"selectioncanvas_"+r),f.style.height=u.height+"px",f.style.width=u.width+"px",f.style.position="absolute",f.style.left=0,f.style.top=0,f.style.backgroundColor="transparent",f.style.zIndex="2",n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"}),w=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup"),l=w.childNodes[0],l.style.top=(u.height-l.clientHeight)/2+"px";if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?a.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):a.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].removeEventListener("load",this._imageOnLoad);y.scrollTop=d;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;c.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);c.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",c);this.zoomPercentage=Math.round(this._zoomVal*100)},_zoomContainer:function(n,t){if(this._fitType=null,this._zoomVal=n,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isAutoZoom&&this._renderedCanvasList&&this._isWindowResizing)this._applyFitToWidthAuto(),n=this._zoomVal;else{var i=Math.abs(this._preZoomVal-n);if(i==0)return!1;this._preZoomVal>n?this._zoomOutContainer(t,i):this._zoomInContainer(t,i)}this._preZoomVal=n;this._updateZoomButtons()},_calculateZoomLevel:function(n){var r;this._calculateZoomArrayValues();for(var u=n,t=0,i=this._zoomArray.length-1;t<=i&&!(t==0&&i==0);)r=Math.round((t+i)/2),this._zoomArray[r]<=u?t=r+1:this._zoomArray[r]>=u&&(i=r-1);this._lowerZoomIndex=i;this._higherZoomIndex=t},_applyLowerZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._lowerZoomIndex);this._fitType=null},_applyHigherZoomIndex:function(){var t=0,n;for(this._calculateZoomArrayValues(),n=0;n<this._zoomArray.length;n++)this._preZoomVal!=this._zoomArray[n]&&t++;t==this._zoomArray.length&&(this._zoomLevel=this._higherZoomIndex);this._fitType=null},_calculateZoomArrayValues:function(){var t,r,n;if(this._zoomArray==i)for(t=document.getElementById(this._id+"_toolbar_zoomSelection_popup").getElementsByTagName("li"),r=[],this._zoomArray=r,n=0;n<t.length;n++)r.push(parseInt(t[n].textContent)/100)},_updateZoomButtons:function(){this._zoomVal<=.5?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin")):this._zoomVal==4?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout")):(this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"))},_showZoomControl:function(t){t?(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","block"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","block"),this._isMagnificationHidden=!1):(n("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","none"),n("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","none"),this._isMagnificationHidden=!0)},_fitToAutoSize:function(){for(var s,e,a,u,f,o,r,h,c,v,y,nt=this._zoomVal,p=n("#"+this._id+"_viewerContainer"),w=n("#"+this._id+"_pageviewContainer"),tt=w.width(),it=w.height(),l={currentZoomPercentage:0,previousZoomPercentage:0},b=document.getElementById(this._id+"_viewerContainer"),d=b.scrollTop,g=d/this._previousZoom*this._zoomVal,rt="scale("+this._zoomVal+","+this._zoomVal+")",i=1;i<=this._totalPages;i++){if(s=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[i-1].PageWidth*this._zoomVal)/2,(this._isAutoZoom&&this._zoomVal<1||s<0)&&(s=5),e=document.getElementById(this._id+"pagecanvas_"+i),a=e.getContext("2d"),this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(u=this._pageSize[i-1].PageWidth*this._zoomVal,f=this._pageSize[i-1].PageHeight*this._zoomVal):(u=this._pageSize[i-1].PageHeight*this._zoomVal,f=this._pageSize[i-1].PageWidth*this._zoomVal),e.style.height=u+"px",e.style.width=f+"px",o=n("#"+this._id+"pageDiv_"+i),o[0].style.top=this._pageLocation[i]*this._zoomVal+"px",o[0].style.left=s+"px",o[0].style.width=f+"px",o[0].style.height=u+"px",r=document.getElementById(this._id+"selectioncanvas_"+i),r.style.height=u+"px",r.style.width=f+"px",r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.backgroundColor="transparent",r.style.zIndex="2",h=this._pageContents[parseInt(i)],h&&this._renderedCanvasList.indexOf(i)!=-1){for(jsondata=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(h):JSON.parse(h.d),c=n("#"+this._id+"selectioncanvas_"+i).children(),k=0;k<c.length;k++)n(c[k]).hasClass("e-pdfviewer-textLayer")&&(n(c[k]).remove(),n("#"+this._id+"selectioncanvas_"+i).removeClass("text_container"));n("#"+this._id+"selectioncanvas_"+i).hasClass("text_container")?this._resizeSelection(jsondata,i,a):this._textSelection(jsondata,i,a)}n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").css({display:"none",height:u+"px",width:f+"px",left:"0px",top:"0px"});v=document.getElementById(this._id+"pageDiv_"+i+"_WaitingPopup");v&&(y=v.childNodes[0],y.style.top=(e.height-y.clientHeight)/2+"px")}this._zoomVal<1?p.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):p.css({"-ms-scroll-limit-y-max":""});b.scrollTop=g;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;this._preZoomVal=this._zoomVal;l.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);l.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",l);this.zoomPercentage=Math.round(this._zoomVal*100)},_initRerendering:function(){var n,u,t,i,r;this._isRerenderCanvasCreated||(this._designNewCanvas(),n=[],u=this._currentPage,n.push(parseInt(this._currentPage)),this._renderedCanvasList?(t=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(t)!=-1&&n.push(t),i=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(i)!=-1&&n.push(i)):(t=parseInt(this._currentPage)-1,n.push(t),i=parseInt(this._currentPage)+1,n.push(i)),this._rerenderCanvasList=n,!0&&(r=this,clearInterval(r._scrollTimer),r._bgRenderTimer=setInterval(function(){r._rerenderCanvas(u)},10)),this._renderedCanvasList.length=0)},_designNewCanvas:function(){for(var t=1;t<=this._totalPages;t++){var e=document.getElementById(this._id+"pageDiv_"+t),f=document.getElementById(this._id+"pagecanvas_"+t),i=document.createElement("canvas"),r,u;this._pageSize[t-1].PageRotation==90||this._pageSize[t-1].PageRotation==270?(r=this._pageSize[t-1].PageWidth*this._zoomVal,u=this._pageSize[t-1].pageHeight*this._zoomVal):(r=this._pageSize[t-1].PageHeight*this._zoomVal,u=this._pageSize[t-1].PageWidth*this._zoomVal);i.style.visibility="hidden";i.style.width=u+"px";i.style.height=r+"px";i.style.backgroundColor="white";i.height=r;i.width=u;i.id=f.id;i.className="e-pdfviewer-pageCanvas";f.id=this._id+"oldcanvas_"+t;e.appendChild(i);n(i).css({"user-select":"none"})}this._isRerenderCanvasCreated=!0},_replaceOldCanvas:function(){for(var t,n=1;n<=this._totalPages;n++){var i=document.getElementById(this._id+"pageDiv_"+n),r=document.getElementById(this._id+"pagecanvas_"+n),u=document.getElementById(this._id+"oldcanvas_"+n);r.style.visibility="visible";i.removeChild(u)}this._isRerenderCanvasCreated=!1;t=this;clearInterval(t._bgRenderTimer);t._scrollTimer=setInterval(function(){t._pageviewscrollchanged(t._pageHeight)},500)},_rerenderCanvas:function(t){var i,r;if(this._renderedCanvasList.indexOf(parseInt(t))==-1&&t<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t))!=-1?(i=this._pageContents[parseInt(t)],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)-1)==-1&&t-1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)-1)!=-1?(i=this._pageContents[parseInt(t)-1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1):this._renderedCanvasList.indexOf(parseInt(t)+1)==-1&&t+1<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t)+1)!=-1&&(i=this._pageContents[parseInt(t)+1],this._rerenderPdfPage(i),this._renderCount=this._renderCount+1),this._renderCount==this._rerenderCanvasList.length){for(this._replaceOldCanvas(),r=1;r<=this._totalPages;r++)this._renderedCanvasList.indexOf(r)==-1&&n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block"});this._renderCount=0;this._rerenderCanvasList.length=0}},_rerenderPdfPage:function(r){var si=r,d,ni,nt,a,e,tt,lt,ii,o,w,it,y,f,rt,gt,ht,c,s;for(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),d=parseInt(r.currentpage),ni=r.imagestream,this._pageContents[parseInt(r.currentpage)]=si,this._regenerateFormFields(r,d),nt=n("#"+this._id+"selectioncanvas_"+d).children(),y=0;y<nt.length;y++)(nt[y].hasAttribute("href")||n(nt[y]).hasClass("e-pdfviewer-formFields"))&&n(nt[y]).remove();this._createFormFields(r,d);var p=r.linkannotation,ti=r.annotpagenum,ct=this;if(this.model.enableHyperlink)for(a=0;a<p.length;a++){if(e=document.createElement("a"),e.id="linkdiv_"+a,tt=p[a].AnnotRectangle,e.style.background="transparent",e.style.position="absolute",e.style.left=this._convertPointToPixel(tt.Left*this._zoomVal)+"px",e.style.top=this._convertPointToPixel(tt.Top*this._zoomVal)+"px",e.style.width=this._convertPointToPixel(tt.Width*this._zoomVal)+"px",e.style.height=this._convertPointToPixel(tt.Height*this._zoomVal)+"px",e.style.color="transparent",p[a].URI.indexOf("mailto:")!=-1?(lt=p[a].URI.substring(p[a].URI.indexOf("mailto:"),p[a].URI.length),e.title=lt,e.setAttribute("href",lt)):(e.title=p[a].URI,e.setAttribute("href",p[a].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(e.target="_self",e.onclick=function(){var n={hyperlink:this.href};ct._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(e.target="_blank",e.onclick=function(){var n={hyperlink:this.href};ct._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(e.onclick=function(){var n={hyperlink:this.href};return ct._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ti[a]!=i){var hi=this._pageSize[d-1].PageHeight,ci=this._convertPointToPixel(p[a].AnnotLocation),li=hi-ci,ai=parseFloat(this._pageLocation[ti[a]]*this._zoomVal)+parseFloat(li*this._zoomVal);e.name=ai;e.onclick=function(){var n=document.getElementById("container_viewerContainer");return n.scrollTop=this.name,!1}}ii=document.getElementById(this._id+"selectioncanvas_"+d);ii.appendChild(e)}o=parseInt(r.currentpage);w=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));(this._pageSize[o-1].PageRotation==90||this._pageSize[o-1].PageRotation==270)&&(w.height=this._zoomVal*this._pageSize[o-1].PageHeight,w.width=this._zoomVal*this._pageSize[o-1].PageWidth,w.style.width=this._zoomVal*this._pageSize[o-1].PageWidth+"px",w.style.height=this._zoomVal*this._pageSize[o-1].PageHeight+"px");var u=w.getContext("2d"),at=[],ri=[],vi=[],ui=[],fi=[],yi,b=navigator.userAgent,k,ei=0,vt=[],ft=ni.textelements;for(it=0;it<ft.length;it++){var h=ft[it],yt=h.color,l=h.matrix;l!=null&&(l=l.Elements);var pt=h.brush,v=h.pathValue,pi=h.iscliping,oi=h.restorecanvas,wt=h.imagedata,g=h.fillrule,wi=h.isFillandStroke,bi=h.fillcolor,bt=h.strokecolor,kt=h.linewidth,dt=h.linecap,et=h.linearGradientBrush,ot=h.textureBrushs,st=h.charID;if(v!=null?(v=v.split(";"),st&&(vt[st]=v)):v==null&&st&&(v=vt[st]),oi==!1&&u.save(),v!=i&&u.setTransform(l[0]*this._zoomVal,l[1],l[2],l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),v!=null){for(u.beginPath(),y=0;y<v.length;y++)f=v[y],rt=f[0],rt=="M"?(f=f.substring(1,f.length),f=f.split(" "),u.moveTo(f[0],f[1])):rt=="L"?(f=f.substring(1,f.length),f=f.split(" "),u.lineTo(f[0],f[1])):rt=="C"?(f=f.substring(1,f.length),f=f.split(" "),u.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5])):rt=="Z"&&u.closePath();pi==!0?(g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(g)),u.clip()):wi==i?pt=="Fill"?(u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):yt,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill()):pt=="FillandStroke"?(u.fillStyle=yt,u.fill(),u.strokeStyle=bt,u.stroke()):pt=="Stroke"?(u.strokeStyle=bt,u.lineWidth=kt,u.lineCap=dt,u.stroke()):(u.strokeStyle=yt,u.lineWidth=kt,u.lineCap=dt,u.stroke()):(u.strokeStyle=bt,u.lineWidth=kt,u.lineCap=dt,u.stroke(),u.fillStyle=et!=i?this._getGradientBrush(et,u):ot!=i?this._createTextureBrush(ot,u,h):bi,g=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(g)),u.fill())}if(oi&&u.restore(),wt!=i)if((k=b.indexOf("Firefox"))!=-1||(k=b.indexOf("Chrome"))!=-1||(k=b.indexOf("Safari"))!=-1||(k=b.indexOf("AppleWebKit"))!=-1){at.push(wt);ri.push(l);fi.push(ft);ui.push(it);yi=this._zoomVal;this._isContainImage=!0;break}else gt=new Image,gt.src=wt,u.setTransform(l[0]*this._zoomVal,l[1]*this._zoomVal,l[2]*this._zoomVal,l[3]*this._zoomVal,l[4]*this._zoomVal,l[5]*this._zoomVal),u.drawImage(gt,0,0,1,1)}if((k=b.indexOf("Firefox"))!=-1||(k=b.indexOf("Chrome"))!=-1||(k=b.indexOf("Safari"))!=-1||(k=b.indexOf("AppleWebKit"))!=-1)for(ht=0;ht<at.length;ht++)this._imageRenderingPinch(ft,vi,at,ri,u,ht,fi,ui,vt,w,o,ei),ei++;if(c=w,s=this,this._pageSize[o-1].PageRotation!=0){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var ki=c.toDataURL(),u=c.getContext("2d"),ut=new Image;ut.onload=function(){u.clearRect(0,0,c.width,c.height);s._pageSize[o-1].PageRotation==90||s._pageSize[o-1].PageRotation==270?(c.width=s._zoomVal*s._pageSize[o-1].PageHeight,c.height=s._zoomVal*s._pageSize[o-1].PageWidth,c.style.height=s._zoomVal*s._pageSize[o-1].PageWidth+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageHeight+"px"):(c.width=s._zoomVal*s._pageSize[o-1].PageWidth,c.height=s._zoomVal*s._pageSize[o-1].PageHeight,c.style.height=s._zoomVal*s._pageSize[o-1].PageHeight+"px",c.style.width=s._zoomVal*s._pageSize[o-1].PageWidth+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(s._pageSize[o-1].PageRotation/2*Math.PI/2);u.drawImage(ut,-ut.width/2,-ut.height/2);u.restore()};ut.src=ki}return this._showPageLoadingIndicator(d,!1),c},_regenerateFormFields:function(t,i){var u=t.PdfRenderedFields,r,c,f,o,h,e,s;if(u!=null)for(r=0;r<u.length;r++)if(u[r].PageIndex+1==i)if(c=u[r].LineBounds,f=document.getElementById(this._id+"input_"+i+"_"+r),u[r].Name=="Textbox")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="Password")o=n(f).attr("name"),u[r].FieldName==o&&(u[r].Text=n(f).val());else if(u[r].Name=="RadioButton")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="CheckBox")o=n(f).attr("name"),u[r].GroupName==o&&(u[r].Selected=n(f).prop("checked")==!0?!0:!1);else if(u[r].Name=="DropDown"){if(o=n(f).attr("name"),u[r].Text==o)for(u[r].SelectedValue==""&&(s=n(f).children()[0],s.id="dropdownhide",n(s).prop("selected")==!0&&(u[r].SelectedValue="")),e=0;e<u[r].TextList.length;e++)s=n(f).children()[0].id=="dropdownhide"?n(f).children()[e+1]:n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedValue=u[r].TextList[e])}else if(u[r].Name=="ListBox")for(h=0,e=0;e<u[r].TextList.length;e++)s=n(f).children()[e],n(s).prop("selected")==!0&&(u[r].SelectedList[h]=e,h++)},_imageRenderingPinch:function(n,t,r,u,f,e,o,s,h,c,l,a){var y=this,v=y._zoomVal,p=new Image;p.onload=function(){for(var d,g,et,ft,e,tt,at=!1,k=0;k<u.length;k++)if(at==!1)for(d=u[k],f.setTransform(d[0]*v,d[1]*v,d[2]*v,d[3]*v,d[4]*v,d[5]*v),t[a]!=i&&f.drawImage(t[a],0,0,1,1),g=s[k],g=g+1,et=o[k];g<et.length;){var p=et[g],ot=p.color,w=p.matrix;w!=null&&(w=w.Elements);var st=p.brush,b=p.pathValue,pt=p.iscliping,vt=p.restorecanvas,yt=p.imagedata,nt=p.fillrule,wt=p.isFillandStroke,bt=p.fillcolor,ht=p.strokecolor,ct=p.linewidth,lt=p.linecap,it=p.linearGradientBrush,rt=p.textureBrushs,ut=p.charID;if(b!=null?(b=b.split(";"),ut&&(h[ut]=b)):b==null&&ut&&(b=h[ut]),vt==!1&&f.save(),b!=i&&f.setTransform(w[0]*v,w[1],w[2],w[3]*v,w[4]*v,w[5]*v),b!=null){for(f.beginPath(),ft=0;ft<b.length;ft++)e=b[ft],tt=e[0],tt=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):tt=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):tt=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):tt=="Z"&&f.closePath();pt==!0?(nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(nt)),f.clip()):wt==i?st=="Fill"?(f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):ot,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill()):st=="FillandStroke"?(f.fillStyle=ot,f.fill(),f.strokeStyle=ht,f.stroke()):st=="Stroke"?(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ot,f.lineWidth=ct,f.lineCap=lt,f.stroke()):(f.strokeStyle=ht,f.lineWidth=ct,f.lineCap=lt,f.stroke(),f.fillStyle=it!=i?y._getGradientBrush(it,f):rt!=i?y._createTextureBrush(rt,f,p):bt,nt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(nt)),f.fill())}if(vt&&f.restore(),yt!=i){at=!0;r.pop();u.pop();o.pop();s.pop();r.push(yt);u.push(w);o.push(n);s.push(g);k=-1;a++;break}g++}else y._imageRenderingPinch(n,t,r,u,f,k,o,s,h,c,l,a),a++};p.src=r[e];t.push(p)},_touchStart:function(t){var u=t.touches,i,r;u.length>1&&t.preventDefault();i=n(t.target).parents(".e-pdfviewer.e-js");r=i.ejPdfViewer("instance");r._touched=!1},_touchMove:function(t){var u=t.touches,f,i,r;u.length>1&&(f=n(t.target).parents(".e-pdfviewer.e-js"),i=f.ejPdfViewer("instance"),i._touched=!0,i._isRerenderCanvasCreated||(n(".e-pdfviewer-formFields").hide(),r=Math.sqrt(Math.pow(u[0].clientX-u[1].clientX,2)+Math.pow(u[0].clientY-u[1].clientY,2)),i._prevDiff>-1?r>i._prevDiff?i._pinchOut(t):r<i._prevDiff&&i._pinchIn(t):i._zoomVal<2?i._prevDiff!=-1&&r>i._prevDiff&&i._pinchIn(t):i._prevDiff==-1&&i._zoomVal>2&&r>i._prevDiff&&i._pinchIn(t),i._prevDiff=r))},_touchEnd:function(t){var s=n(t.target).parents(".e-pdfviewer.e-js"),i=s.ejPdfViewer("instance"),r,o,f,e,u;i._prevDiff=-1;i._isRenderedByPinch&&(i._renderedCanvasList.length!=0&&(i._isRerenderCanvasCreated||(i._designNewCanvas(),r=[],o=i._currentPage,r.push(parseInt(i._currentPage)),f=parseInt(i._currentPage)-1,i._renderedCanvasList.indexOf(f)!=-1&&r.push(f),e=parseInt(i._currentPage)+1,i._renderedCanvasList.indexOf(e)!=-1&&r.push(e),i._rerenderCanvasList=r,u=i,window.clearInterval(u._scrollTimer),u._bgRenderTimer=setInterval(function(){u._rerenderCanvas(o)},10),i._renderedCanvasList.length=0)),i._isRenderedByPinch=!1)},_pointerdown:function(n){n.originalEvent.pointerType=="touch"&&(this._pointerCount=this._pointerCount+1,this._pointerCount<=2&&(n.preventDefault(),this._pointers.push(n.originalEvent),this._pointerCount==2&&(this._pointerCount=0)))},_pointermove:function(n){var i,t,r,u;if(n.originalEvent.pointerType=="touch"&&this._pointers.length==2){for(n.preventDefault(),i=0;i<this._pointers.length;i++)if(n.originalEvent.pointerId==this._pointers[i].pointerId){this._pointers[i]=n.originalEvent;break}this._isRerenderCanvasCreated||(t=Math.sqrt(Math.pow(this._pointers[0].clientX-this._pointers[1].clientX,2)+Math.pow(this._pointers[0].clientY-this._pointers[1].clientY,2)),this._prevDiff>-1&&(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),r=document.getElementById(this._id+"_viewerContainer"),u=r.scrollTop,u==0||(t>this._prevDiff?this._pinchOut(n):t<this._prevDiff&&this._pinchIn(n)),this._prevDiff=t)}},_pointerup:function(n){var t,f,r,u,i;n.originalEvent.pointerType=="touch"&&(this._pointers=[],this._pointerCount=0,this._prevDiff=-1,this._isRenderedByPinch&&(n.preventDefault(),this._renderedCanvasList.length!=0&&(this._isRerenderCanvasCreated||(this._designNewCanvas(),t=[],f=this._currentPage,t.push(parseInt(this._currentPage)),r=parseInt(this._currentPage)-1,this._renderedCanvasList.indexOf(r)!=-1&&t.push(r),u=parseInt(this._currentPage)+1,this._renderedCanvasList.indexOf(u)!=-1&&t.push(u),this._rerenderCanvasList=t,i=this,window.clearInterval(i._scrollTimer),i._bgRenderTimer=setInterval(function(){i._rerenderCanvas(f)},10),this._renderedCanvasList.length=0)),this._isRenderedByPinch=!1))},_pinchOut:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal+.01;this._zoomVal>2&&(this._zoomVal=this._zoomVal+.01);this._zoomVal>4&&(this._zoomVal=4,this._isPinchLimitReached=!0);this._zoomVal<=4?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=4},_pinchIn:function(){this._isAutoZoom=!1;this._zoomVal=this._zoomVal-.01;this._zoomVal<4&&this._zoomVal>2&&(this._zoomVal=this._zoomVal-.01);this._zoomVal<.5&&(this._zoomVal=.5,this._isPinchLimitReached=!0);this._zoomVal>=.5?(this._isPinchLimitReached||(this._fitType=null,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(this._zoomVal*100)+"%"),this._ejDropDownInstance.model.value=this._zoomVal*100+"%",this._ejDropDownInstance.model.selectedIndices[0]="",n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"),this._updateZoomButtons(),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=.5},_textSearch:function(){this._clearAllOccurrences();this._selectedIndex=0;this._isTextSearch=!0;this._searchedPages=[];this._searchCollection=[];var t=n("#"+this._id+"_pdfviewer_searchinput").val();if(this._searchText=t,this._searchText&&this._searchText!=""?this._enableSearchIcons():this._disableSearchIcons(),t==""||t==" "||!t)return!0;this._searchPageIndex=parseInt(this._currentPage);this._initSearch(this._searchPageIndex);this._highlightOtherOccurrences()},_disableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"none",opacity:"0.6"});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"none",opacity:"0.6"});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.disable()},_enableSearchIcons:function(){n("#"+this._id+"_pdfviewer_previous_search").css({"pointer-events":"",opacity:""});n("#"+this._id+"_pdfviewer_next_search").css({"pointer-events":"",opacity:""});var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");t.enable()},_prevSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!0,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex-1,this._selectedIndex<0?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<1&&(this._searchPageIndex=parseInt(this._totalPages)),this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex),this._highlightOtherOccurrences())},_nextSearch:function(){this._searchText&&(this._clearAllOccurrences(),this._isPrevSearch=!1,this._isTextSearch=!0,this._selectedIndex=this._selectedIndex+1,this._searchCollection[this._searchPageIndex]?this._selectedIndex>=this._searchCollection[this._searchPageIndex].length?(this._selectedIndex=0,this._searchPageIndex=this._searchPageIndex<this._totalPages?this._searchPageIndex+1:1,this._initSearch(this._searchPageIndex)):this._highlightText(this._searchPageIndex,this._selectedIndex):(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)),this._highlightOtherOccurrences())},_matchcase:function(){var t=n("#"+this._id+"_search_matchcase").data("ejCheckBox");this._isMatchCase=t.model.checkState=="check"?!0:!1;this._textSearch()},_searchKeypressHandler:function(t){t.which==13&&(this._searchText=n("#"+this._id+"_pdfviewer_searchinput").val(),this._searchMatches[this._searchPageIndex]&&this._searchText!=""?this._searchMatches[this._searchPageIndex].length==0?this._initSearch(this._searchPageIndex):this._nextSearch():this._searchText!=""&&(this._searchPageIndex=this._currentPage,this._selectedIndex=0,this._initSearch(this._searchPageIndex)))},_initSearch:function(n){var t=this._searchText.length,i=this._searchText;this._getPossibleMatches(n,i,t)},_getPossibleMatches:function(t,i,r){var e,u,s,f,o;if(n("#"+this._id+"_pdfviewer_searchinput").hasClass("e-pdfviewer-nooccurrence")||n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._pageText[parseInt(t)]||t!=this._searchPageIndex||(this._isRequestFired=!0,e={},e.viewerAction=this._viewerAction.getPageModel,e.pageindex=t.toString(),n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader"),this._doAjaxPostSearch(JSON.stringify(e),t)),u=this._pageText[t],u){for(this._isMatchCase||(u=u.toLowerCase(),i=i.toLowerCase()),s=[],f=-r;;){if(f=u.indexOf(i,f+r),f==-1)break;s.push(f)}this._searchMatches[t]=s;t==this._searchPageIndex?(this._selectedIndex<0&&this._isPrevSearch&&(this._selectedIndex=this._searchMatches[t].length-1),(this._isRequestFired&&this._searchMatches[t].length!=0||this._renderedCanvasList.indexOf(t)==-1&&this._searchMatches[t].length!=0)&&(this._gotoPageNo(t),this._isPageScrolledForSearch=!0),this._searchMatches[t].length==0?(t!=this._totalPages?(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._isPrevSearch?(this._searchPageIndex=this._searchPageIndex-1,this._searchPageIndex<=0&&(this._searchPageIndex=this._totalPages)):this._searchPageIndex=this._searchPageIndex+1):(this._searchedPages.indexOf(parseInt(t))==-1&&this._searchedPages.push(t),this._searchPageIndex=this._isPrevSearch?this._searchPageIndex-1:1),this._searchedPages.length!=this._totalPages||this._searchMatches[t].length!=0?this._initSearch(this._searchPageIndex):(n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-nooccurrence"),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),this._isRequestFired=!1)):this._isRequestFired?(n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),o=this,setTimeout(function(){o._convertMatches(t,r);o._isRequestFired=!1;o._isPageScrolledForSearch=!1},100)):this._convertMatches(t,r)):this._searchMatches[t].length!=0&&this._convertMatches(t,r);this._isRequestFired||this._isPageScrollHighlight||(this._isPageScrolledForSearch=!1)}},_convertMatches:function(n,t){for(var f,s,i=0,h=this._searchMatches[n],u=this._textDivs[n],r=0,e=u.length-1,c=[],o=0,l=h.length;o<l;o++){if(f=h[o],this._isPageScrolledForSearch)while(i!=e&&f>=r+u[i].textContent.split("\n")[0].length)r+=u[i].textContent.split("\n")[0].length,i++;else while(i!=e&&f>=r+u[i].textContent.length)r+=u[i].textContent.length,i++;for(s={begin:{divId:i,offsetValue:f-r}},f+=t;i!=e&&f>r+u[i].textContent.length;)r+=u[i].textContent.length,i++;s.end={divId:i,offsetValue:f-r};c.push(s)}this._searchCollection[n]=c;this._highlightText(n,this._selectedIndex)},_highlightText:function(n){for(var s,a,h=this._searchCollection[n],u=this._textDivs[n],t=null,c,f,v=h.length,o=0;o<v;o++){var l=h[o],r=l.begin,e=l.end;if(o==this._selectedIndex&&n==this._searchPageIndex?(f="e-pdfviewer-texthighlight",c=r.divId):f="e-pdfviewer-text-highlightother",t&&r.divId===t.divId?this._addSpanForSearch(t.divId,t.offsetValue,r.offsetValue,n,u,null):(t!==null&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null),this._beginText(r,u,n,null)),r.divId==e.divId)this._addSpanForSearch(r.divId,r.offsetValue,e.offsetValue,n,u,f);else{for(this._addSpanForSearch(r.divId,r.offsetValue,i,n,u,f),s=r.divId+1,a=e.divId;s<a;s++)this._addSpanForSearch(s,0,i,n,u,f+" middle");this._beginText(e,u,n,f)}t=e}t&&this._addSpanForSearch(t.divId,t.offsetValue,i,n,u,null);n==this._searchPageIndex&&this._scrollToSearchStr(u[c],{y:-70,x:-400});this._isTextHighlighted=!0},_beginText:function(n,t,i,r){var u=n.divId;t[u].textContent="";this._addSpanForSearch(u,0,n.offsetValue,i,t,r)},_addSpanForSearch:function(t,i,r,u,f,e){var h=this._textContents[u],c=h[t].substring(i,r),s=document.createTextNode(c),o;if(e){this._isTextHighlighted=!0;o=document.createElement("span");o.className=e+" e-pdfviewer-textLayer";n(o).hasClass("middle")&&(f[t].textContent="");o.appendChild(s);f[t].appendChild(o);return}f[t].appendChild(s)},_scrollToSearchStr:function(n,t){for(var i=n.offsetParent,r=n.offsetTop+n.clientTop,u=n.offsetLeft+n.clientLeft;i.id!=this._id+"_viewerContainer";)r+=i.offsetTop,u+=i.offsetLeft,i=i.offsetParent;t&&(r+=t.y,u+=t.x,this._zoomVal>1.5&&(i.scrollLeft=u));i.scrollTop=r},_highlightOtherOccurrences:function(){for(var i,t=1;t<=this._totalPages;t++)this._renderedCanvasList.indexOf(t)!=-1&&t!=this._searchPageIndex&&this._initSearch(t);this._isPageScrollHighlight=!1;i=this;setTimeout(function(){n("#"+i._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader")},100)},_clearAllOccurrences:function(){var u,r,f,t;for(this._isTextHighlighted=!1,this._isTextSearch=!1,this._searchAjaxRequestState!=null&&(this._searchAjaxRequestState.abort(),this._searchAjaxRequestState=null),this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-nooccurrence"),u=1;u<=this._totalPages;u++)if(this._renderedCanvasList.indexOf(parseInt(u))!==-1){if(r=this._textDivs[u],f=this._textContents[u],!r||r==i)break;for(t=0;t<r.length;t++)r[t].textContent=f[t],this._isFindboxPresent||(r[t].textContent="",r[t].textContent=f[t]+"\r\n")}},_doAjaxPostSearch:function(i,r){var u=this;this._searchAjaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:i,traditional:!0,async:!1,success:function(n){var i;i=typeof n=="object"?JSON.stringify(n):n;jsondata=typeof n=="object"?u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(JSON.stringify(n)):JSON.parse(JSON.stringify(n).d):u._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(n):JSON.parse(n.d);u._pageContents[parseInt(jsondata.currentpage)]=i;u._pageText[parseInt(jsondata.currentpage)]=jsondata.pageContents;u._initSearch(r)},error:function(){}})},_keyboardShortcutFind:function(n){n.ctrlKey&&n.which==70&&(n.preventDefault(),this._isTextSearchHidden||this._displaySearchBox())},_setSearchToolbarTop:function(){var n=document.getElementById(this._id+"_pdfviewer_searchbox");n.style.top="0px"},_displaySearchBox:function(){this._isToolbarHidden||(n("#"+this._id+"_pdfviewer_searchbox").css("display")=="none"?(this._clearSelector(),this._displaySearch=!0,n("#"+this._id+"_pdfviewer_searchbox").css({position:"absolute",display:"block"}),this._resizeSearchToolbar(),n("#"+this._id+"_pdfviewer_searchinput").focus().select(),this._isFindboxPresent=!0):(this._displaySearch=!1,this._isFindboxPresent=!1,this._clearAllOccurrences(),n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),n("#"+this._id+"_pdfviewer_searchbox").css({display:"none"})))},_showTextSearchButton:function(t){t?(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","block"),this._isTextSearchHidden=!1):(n("#"+this._id+"_find").parent().parents(".e-pdfviewer-toolbarul").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isTextSearchHidden=!0)},_wireEvents:function(){var i=navigator.userAgent.indexOf("Chrome")!=-1,r=navigator.userAgent.indexOf("Firefox")!=-1,e=navigator.userAgent.indexOf("Safari")!=-1,u=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,o=navigator.userAgent.indexOf("Edge")!=-1,f=document.documentMode||/Edge/.test(navigator.userAgent),s=this,t;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick),this._on(n("#"+this._id+"_toolbarContainer"),"mousedown",this._onToolBarContainerMouseDown),this._on(n(".e-pdfviewer-ejdropdownlist"),"mousedown",this._onToolBarContainerMouseDown),this.enableTextSelection?(document.documentMode||u?(this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._on(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._on(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):f||(r?this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy):i&&(this._on(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._on(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._on(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd)),this._on(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._on(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._on(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._on(n("#"+this._id+"_viewerContainer"),"mouseenter",this._onTextContainerMouseEnter),this._on(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._on(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart)),i||r||u||o||f?(this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.copy",this._copySelectedText),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.googleSearch",this._openInNewTab),this._on(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick)):e&&this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp)):this.enableTextSelection||n("#"+this._id+"_viewerContainer").attr("unselectable","on").css({"-moz-user-select":"-moz-none","-moz-user-select":"none","-o-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"}).bind("selectstart",function(){return!1}));n(window).on("keydown",function(n){n.ctrlKey&&(n.keyCode==65||n.keyCode==97)&&n.preventDefault()});t=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").css({"touch-action":"pan-x pan-y"});n("#"+this._id+"_pdfviewerContainer").css({"touch-action":"pan-x pan-y",position:"relative"});(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(t.addEventListener("touchstart",this._touchStart),t.addEventListener("touchmove",this._touchMove),t.addEventListener("touchleave",this._touchEnd),t.addEventListener("touchend",this._touchEnd),t.addEventListener("touchcancel",this._touchEnd));this._on(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._on(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._on(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._on(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._on(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._on(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._on(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._on(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._on(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._on(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip)},_unwireEvents:function(){var e=navigator.userAgent.indexOf("Chrome")!=-1,i=navigator.userAgent.indexOf("Firefox")!=-1,o=navigator.userAgent.indexOf("Safari")!=-1,r=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,u=navigator.userAgent.indexOf("Edge")!=-1,f=document.documentMode||/Edge/.test(navigator.userAgent),t;this.model.toolbarSettings.templateId||(this._on(n("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._off(n("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(n("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(n("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(n("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick));t=document.getElementById(this._id+"_viewerContainer");document.documentMode||u||r||f?(this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"dblclick",this._selectingTextOnDblClick),this._off(n("#"+this._id+"_viewerContainer"),"click",this._selectingTextOnClick)):(i&&this._off(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),this._off(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._off(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),this._off(n("#"+this._id+"_viewerContainer"),"mouseleave",this._onTextContainerMouseLeave),this._off(n("#"+this._id+"_viewerContainer"),"mouseover",this._onTextContainerMouseIn),this._off(n("#"+this._id+"_viewerContainer"),"touchstart",this._onTextContainerTouch),this._off(n("#"+this._id+"_viewerContainer"),"touchend",this._onTextContainerTouchEnd),this._off(n("#"+this._id+"_viewerContainer"),"touchmove",this._onTextContainerTouchMove),this._off(n("#"+this._id+"_viewerContainer"),"dragstart",this._onTextContainerDragStart),this._off(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick));(e||i||r||f||u)&&(this._off(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.copy",this._copySelectedText),this._off(n("#"+this._id+"_pageviewContainer"),"click","a.googleSearch",this._openInNewTab),this._off(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp));(navigator.userAgent.match("Firefox")||navigator.userAgent.match("Chrome"))&&(t.removeEventListener("touchstart",this._touchStart),t.removeEventListener("touchmove",this._touchMove),t.removeEventListener("touchleave",this._touchEnd),t.removeEventListener("touchend",this._touchEnd),t.removeEventListener("touchcancel",this._touchEnd));this._off(n("#"+this._id+"_viewerContainer"),"pointerdown",this._pointerdown);this._off(n("#"+this._id+"_viewerContainer"),"pointermove",this._pointermove);this._off(n("#"+this._id+"_viewerContainer"),"pointerup",this._pointerup);this._off(n("#"+this._id+"_viewerContainer"),"pointerleave",this._pointerup);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"input",this._textSearch);this._off(n("#"+this._id+"_pdfviewer_searchinput"),"keypress",this._searchKeypressHandler);this._off(n("#"+this._id+"_pdfviewer_previous_search"),"click",this._prevSearch);this._off(n("#"+this._id+"_pdfviewer_next_search"),"click",this._nextSearch);this._off(n("#"+this._id+"_pdfviewer_close_search"),"click ",this._displaySearchBox);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip);this._off(n("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip);this._off(n(window),"resize",this._viewerResize)},_onToolBarContainerMouseDown:function(n){return n.preventDefault(),!1},_onToolbarItemClick:function(t){t.target.id==this._id+"_txtpageNo"&&n("#"+this._id+"_txtpageNo").select();n("#"+this._id+"_rptTooltip").css("display","none")},_selectingTextOnClick:function(n){this._timers&&this._clientx==n.clientX&&this._clienty==n.clientY&&(clearTimeout(this._timers),this._timers=null,this._selectingEntireLine(n))},_selectingEntireLine:function(t){var i,u=[],v=t.target,y=v.getBoundingClientRect(),p=n(".e-pdfviewer-textLayer").length,r,o,s,c;if(n(t.target).hasClass("e-pdfviewer-textLayer")){for(r=0;r<p;r++){var w=n(".e-pdfviewer-textLayer")[r].getBoundingClientRect(),f=parseInt(w.top),e=parseInt(y.top);(f==e||f+1==e||f-1==e)&&(o=n(".e-pdfviewer-textLayer")[r].id,o!=""&&u.push(o))}s=window.getSelection();s.removeAllRanges();var i=document.createRange(),b=u.length-1,l=document.getElementById(u[0]),h=document.getElementById(u[b]),a=h.childNodes.length;a>0?(c=h.childNodes[a-1],i.setStart(l,0),i.setEnd(c,c.length)):(i.setStart(l,0),i.setEnd(h,1));s.addRange(i)}},_selectingTextOnDblClick:function(n){this._clientx=n.clientX;this._clienty=n.clientY;this._getElementTouch(n.target,n.clientX,n.clientY);this._timers=setTimeout(function(){this._timers=null},200)},_onTextContainerMouseIn:function(n){if(this.Clicked)return n.preventDefault(),!1},_onTextContainerMouseUp:function(t){var y,c,w,l,a,k,v,d,o;this._curDown=!1;var i=[],e=t.target,r=document.getElementById(this._id+"custom-menu"),g=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,s=window.getSelection().toString();if(t.type=="contextmenu")if(y=window.getSelection(),y.anchorNode){var u=y.getRangeAt(0),h=u.cloneContents(),f=h.childNodes,b=u.startContainer.parentNode.className,p=n(h).find("span");if(p.length>0&&(p[0].className=="e-pdfviewer-texthighlight e-pdfviewer-textLayer"||p[0].className=="e-pdfviewer-text-highlightother e-pdfviewer-textLayer")&&u.startContainer.id&&i.push(u.startContainer.id),g&&n(h).children().length==0&&(b=="e-pdfviewer-textLayer"?i.push(u.startContainer.parentElement.id):i.push(u.startContainer.id)),h.childElementCount==0)b=="e-pdfviewer-textLayer"?i.push(u.startContainer.parentElement.id):i.push(u.startContainer.id);else if(f.length>0)if(f[0].className=="e-waitingpopup e-js")for(c=0;c<f.length;c++)for(w=n(f[c]).find(".text_container").children(),l=0;l<w.length;l++)i.push(w[l].id);else for(a=0;a<f.length;a++)k=f[a].id,i.push(k);for(v=0;v<i.length;v++)if((n(e).hasClass("e-pdfviewer-text-highlightother")||n(e).hasClass("e-pdfviewer-texthighlight"))&&(e=e.parentElement),e.id==i[v]){this._contextMenu=!0;break}else this._contextMenu=!1}else this._contextMenu=!1;s!=""&&t.which==3&&this._contextMenu&&t.type=="contextmenu"&&!this._isCopyRestrict?(t.preventDefault(),s.length>20?(d=s.substring(0,18),str=d+"...",n(r).find("li a.googleSearch").text("Search Google For '"+str+"'")):n(r).find("li a.googleSearch").text("Search Google For '"+s+"'"),o=this._setContextMenuPostion(t),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),n(r).show(),n(r).offset({top:o.y,left:o.x}).show(),this._contextMenu=!1):n(r).has(t.target).length==0&&(n(r).hide(),t.type!="contextmenu"||this._contextMenu?this._contextMenu&&t.preventDefault():this._clearSelector())},_setContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.pageX,i.y=t.pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,u.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,u},_createWaterDropDiv:function(){var f=n("#"+this._id+"_pageviewContainer"),u=document.createElement("DIV"),r,i,t;u.id=this._id+"droplet1";u.className="e-pdfviewer-droplet1";r=document.createElement("DIV");r.id=this._id+"droplet2";r.className="e-pdfviewer-droplet2";f.append(u);f.append(r);i=n("#"+this._id+"_viewerContainer");t=this;n("#"+this._id+"droplet2").on("touchmove",function(r){var e=n(i).scrollTop(),c,l,f,u,o,s,h;n("#"+t._id+"touchcustom-menu").hide();r.preventDefault();o=n("#"+t._id+"droplet1").offset();r.type=="touchmove"&&(c=r.originalEvent.changedTouches[0].clientX,l=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3));u>=o.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,s=t._selectingTextByTouch(parent,f,u,!0)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,s=t._selectingTextByTouch(parent,f,u,!1));n(parent).hasClass("e-pdfviewer-textLayer")&&(h=n("#"+t._id+"droplet2").width(),n("#"+t._id+"droplet2").offset({top:u+window.scrollY,left:f-h}))});n("#"+this._id+"droplet1").on("touchmove",function(r){var e=n(i).scrollTop(),c,l,f,u,o,s,h;n("#"+t._id+"touchcustom-menu").hide();r.preventDefault();o=n("#"+t._id+"droplet2").offset();r.type=="touchmove"&&(c=r.originalEvent.changedTouches[0].clientX,l=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",0),f=r.originalEvent.changedTouches[0].clientX,u=r.originalEvent.changedTouches[0].clientY,n(r.target).css("z-index",1e3));u<=o.top?(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e-30):offset=range.startOffset):n(i).scrollTop(e-30)),parent=textNode.parentElement,s=t._selectingTextByTouch(parent,f,u,!1)):(document.caretPositionFromPoint?(range=document.caretPositionFromPoint(f,u),textNode=range.offsetNode):document.caretRangeFromPoint&&(range=document.caretRangeFromPoint(f,u),range!=null?(textNode=range.startContainer,n(textNode).hasClass("e-pdfviewer-toolbarcontainer")?n(i).scrollTop(e+30):offset=range.startOffset):n(i).scrollTop(e+30)),parent=textNode.parentElement,s=t._selectingTextByTouch(parent,f,u,!0));n(r.target).css("z-index",1e3);n(parent).hasClass("e-pdfviewer-textLayer")&&(h=n("#"+t._id+"droplet1").width(),n("#"+t._id+"droplet1").offset({top:u+window.scrollY,left:f-h}))})},_selectingTextByTouch:function(n,t,i,r){var f,e,s,h,c,o,u;if(n.nodeType==n.TEXT_NODE)for(u=n.ownerDocument.createRange(),f=window.getSelection(),u.selectNodeContents(n),e=0,s=u.endOffset;e<s;){if(u.setStart(n,e),u.setEnd(n,e+1),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return h=u.toString(),c=u.getBoundingClientRect(),f.anchorNode!=null&&f.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r?(u.setStart(f.anchorNode,f.anchorOffset),f.removeAllRanges(),f.addRange(u),f.extend(n,e)):f.anchorNode==null||r||(u.setEnd(f.focusNode,f.focusOffset),f.removeAllRanges(),f.addRange(u)),u.detach(),h;e+=1}else for(o=0;o<n.childNodes.length;o++){if(u=n.childNodes[o].ownerDocument.createRange(),u.selectNodeContents(n.childNodes[o]),u.getBoundingClientRect().left<=t&&u.getBoundingClientRect().right>=t&&u.getBoundingClientRect().top<=i&&u.getBoundingClientRect().bottom>=i)return u.detach(),this._selectingTextByTouch(n.childNodes[o],t,i,r);u.detach()}return null},_onTextContainerTouchMove:function(t){if(n(t.target).hasClass("e-pdfviewer-textLayer")&&this._lockTimer){var i=t.originalEvent.changedTouches[0].clientX,r=t.originalEvent.changedTouches[0].clientY,u=document.getElementById(this._id+"touchcustom-menu");parseInt(i)!=parseInt(this._curPosX)&&parseInt(r)!=parseInt(this._curPosY)&&(n(".text_container").css("visibility","hidden"),n(".e-pdfviewer-formFields").css("visibility","visible"),n(u).hide(),t.preventDefault())}},_setTouchContextMenu:function(t){var f=n("#"+this._id+"touchcustom-menu"),i={},u={},r={};return r.x=f.outerWidth(),r.y=f.outerHeight(),i.x=t.originalEvent.changedTouches[0].pageX,i.y=t.originalEvent.changedTouches[0].pageY,u.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x:i.x-r.x/2,i.y&&(u.y=i.y-r.y),u},_onTextContainerTouch:function(t){var r=t.originalEvent.touches.length,i;if(this._curPosX=t.originalEvent.changedTouches[0].clientX,this._curPosY=t.originalEvent.changedTouches[0].clientY,!this._lockTimer)return i=this,this._timer=setTimeout(function(){i._onlongtouch(t)},1e3),this._lockTimer=!0,n(t.target).hasClass("e-pdfviewer-textLayer")?(t.preventDefault(),n(".text_container").css("visibility",""),!1):void 0},_onlongtouch:function(t){if(t.type=="touchstart"&&t.target.id!=this._id+"droplet2"||t.target.id!=this._id+"droplet2"){this._longTouch=!0;n(".text_container").css("visibility","");this._curXPos=t.originalEvent.changedTouches[0].clientX;this._curYPos=t.originalEvent.changedTouches[0].clientY;var i=this._getElementTouch(t.target,this._curXPos,this._curYPos,!0);t.preventDefault()}},_onTextContainerTouchEnd:function(t){var c,p,l,a,d,v,e;t.preventDefault();var u=[],it=t.target,h,st=t.originalEvent.touches.length;if(this._timer){clearTimeout(this._timer);this._lockTimer=!1;var i=document.getElementById(this._id+"touchcustom-menu"),ht=t.originalEvent.changedTouches[0].clientX,ct=t.originalEvent.changedTouches[0].clientY,r=window.getSelection();if(r.anchorNode){h=r.getRangeAt(0);var k=h.cloneContents(),f=k.childNodes,rt=h.startContainer.parentElement.className;if(k.childElementCount!=0||this._longTouch){if(f.length>0)if(f[0].className=="e-waitingpopup e-js")for(c=0;c<f.length;c++)for(p=n(f[c]).find(".text_container").children(),l=0;l<p.length;l++)u.push(p[l].id);else for(a=0;a<f.length;a++)d=f[a].id,u.push(d)}else rt=="e-pdfviewer-textLayer"?u.push(h.startContainer.parentElement.id):u.push(h.startContainer.id);for(v=0;v<u.length;v++)if(it.id==u[v]){this._touchcontextMenu=!0;break}else this._touchcontextMenu=!1}else this._touchcontextMenu=!1;if(this._rangePosition&&this._longTouch){n(".text_container").css("visibility","");var ut=n(i).outerHeight(),ft=n(i).outerWidth(),w=this._rangePosition.width/2,et=window.getSelection().toString();this._ranges||this._touchcontextMenu||t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(t.target.id==this._id+"droplet1"||t.target.id==this._id+"droplet2"?(n(i).show(),e=this._setTouchContextMenu(t),n(i).show(),n(i).offset({top:e.y,left:e.x}).show()):(n(i).show(),n(i).offset({top:this._rangePosition.top-ut+window.scrollY,left:this._rangePosition.left+w-ft/2})),this._ranges=!1,n(".text_container").css("visibility","")):n(t.target).hasClass("copy")||n(t.target).hasClass("googleSearch")?n(i).hide():(n(i).hide(),this._waterDropletDivHide())}else n(i).hide();if(n(i).css("display")!="none"||t.target.id==this._id+"droplet2"||t.target.id==this._id+"droplet1"||t.target.className=="copy"||t.target.className=="googleSearch"||n("#"+this._id+"custom-menu").css("display")!="none"||this._touched||this._touchcontextMenu){if(this._touchcontextMenu){var r=window.getSelection(),o=document.createRange(),g=r.anchorNode.compareDocumentPosition(r.focusNode),nt=!1;(!g&&r.anchorOffset>r.focusOffset||g===Node.DOCUMENT_POSITION_PRECEDING)&&(nt=!0);nt?(o.setStart(r.focusNode,r.focusOffset),o.setEnd(r.anchorNode,r.anchorOffset)):(o.setStart(r.anchorNode,r.anchorOffset),o.setEnd(r.focusNode,r.focusOffset));var ut=n(i).outerHeight(),ft=n(i).outerWidth(),ot=o.getBoundingClientRect(),s=o.getClientRects(),b=s.length-1,lt=ot.width/2,y=document.getElementById(this._id+"droplet1"),tt=document.getElementById(this._id+"droplet2"),w=n(y).outerWidth(),at=n(y).outerHeight(),et=window.getSelection().toString();et!=""&&(e=this._setTouchContextMenu(t),n(y).show(),n(y).offset({top:s[0].top+window.scrollY,left:s[0].left-w}).show(),n(tt).show(),n(tt).offset({top:s[b].top+window.scrollY,left:s[b].left+s[b].width-w}).show(),n(i).show(),n(i).offset({top:e.y,left:e.x}).show());t.preventDefault()}}else this._clearSelector(),this._clearText=!0;this._clearText&&(n(i).hide(),this._waterDropletDivHide(),this._clearText=!1)}},_onTextContainerMouseDown:function(t){n(".text_container").css("visibility","");var i=t.target;this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide();this._curYPos=t.clientY;this._curXPos=t.clientX;n(t.target).hasClass("text_container")||n(t.target).hasClass("e-pdfviewer-viewercontainer")||t.which==3||(this._curDown=!0);n("#"+this._id+"custom-menu").css("display")=="none"&&t.which!=3&&this._clearSelector();n("#"+this._id+"_viewerContainer").focus();n(i).hasClass("e-pdfviewer-formFields")||n(i).hasClass("e-pdfviewer-ListBox")||this._isFormFields||n(i).hasClass("e-dropdownSelect")||t.preventDefault()},_onTextContainerclick:function(t){this._waterDropletDivHide();var i=t.target;t.originalEvent.detail==2&&n(i).hasClass("e-pdfviewer-textLayer")&&(t.preventDefault(),this._getElementTouch(i,t.clientX,t.clientY,!1),t.preventDefault());t.originalEvent.detail==3&&n(i).hasClass("e-pdfviewer-textLayer")&&this._selectingEntireLine(t)},_onTextContainerMouseMove:function(t){var i,r,u,f;t.preventDefault();n(".text_container").css("visibility","");u=t.target;this.pageY=t.pageY;this._curDown==!0&&n("#"+this._id+"custom-menu").css("display")=="none"&&(i=t.clientY,r=t.clientX,f=this._getWordAtPoint(u,r,i),t.preventDefault())},_onTextContainerMouseLeave:function(t){var r,i,u;if(this._curDown==!0){r=this;t.preventDefault();i=n("#"+this._id+"_viewerContainer");u=n(i).offset().top;this._scrollMove=t.clientY>u?setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()+200},"fast")},500):setInterval(function(){n(i).animate({scrollTop:n(i).scrollTop()-200},"fast")},500);n(window).on("mouseup",function(n){return this._curDown=!1,r._onMouseClickedOutside(n),n.preventDefault(),n.stopPropagation(),!1})}},_onTextContainerMouseEnter:function(){this._scrollMove&&clearInterval(this._scrollMove)},_onMouseClickedOutside:function(n){this._curDown=!1;this._scrollMove&&clearInterval(this._scrollMove);n.preventDefault();n.stopPropagation()},_onTextContainerDragStart:function(n){n.preventDefault()},_clearSelector:function(){window.getSelection&&(window.getSelection().removeAllRanges?window.getSelection().removeAllRanges():document.selection&&document.selection.empty())},_createContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"custom-menu";i.className="e-pdfviewer-custom-menu";r.append(i);t=document.createElement("ol");t.className="orderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li><a href='javascript:void(0);' class='copy'>Copy<\/a><\/li>");n(t).append("<li><a href='javascript:void(0);' class='googleSearch'>Search Google For <\/a><\/li>")},_createTouchContextMenu:function(){var t=document.createElement("div"),i=n("#"+this._id+"_pageviewContainer"),r;t.id=this._id+"touchcustom-menu";t.className="e-pdfviewer-touchcustom-menu";i.append(t);r=window.getSelection().toString();n(t).append("<div class='e-pdfviewer-touchCopy'><a href='javascript:void(0);' class='copy'>Copy<\/a><\/div>");n(t).append("<div class='e-pdfviewer-touchDot'><a href='javascript:void(0);' class='googleSearch'>Search<\/a><\/div>")},_onTextKeyboardCopy:function(n){n.ctrlKey&&n.keyCode==67&&(n.preventDefault(),this._isCopyRestrict||this._copySelectedText(n))},_copySelectedText:function(t){var f,h,e,r;if(!this._isCopyRestrict){if(f=window.getSelection().getRangeAt(0).toString(),h=navigator.userAgent.indexOf("Firefox")>-1,window.clipboardData&&window.clipboardData.setData)return e=clipboardData.setData("Text",f),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),e;if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var i=window.getSelection(),u=document.createRange(),o=i.anchorNode.compareDocumentPosition(i.focusNode),s=!1;(!o&&i.anchorOffset>i.focusOffset||o===Node.DOCUMENT_POSITION_PRECEDING)&&(s=!0);s?(u.setStart(i.focusNode,i.focusOffset),u.setEnd(i.anchorNode,i.anchorOffset)):(u.setStart(i.anchorNode,i.anchorOffset),u.setEnd(i.focusNode,i.focusOffset));r=document.createElement("textarea");n(r).css("contenteditable","true");r.textContent=f;r.style.position="fixed";document.body.appendChild(r);r.select();i.removeAllRanges();i.addRange(u)}try{return document.execCommand("copy")}catch(c){console.warn("Copy to clipboard failed.",c)}finally{document.body.removeChild(r);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}},_openInNewTab:function(){var t=window.getSelection().toString(),i="http://www.google.com/search?q="+t,r=window.open(i,"_blank");r.focus();n("#"+this._id+"custom-menu").hide()},_waterDropletDivHide:function(){n(document.getElementById(this._id+"droplet1")).hide();n(document.getElementById(this._id+"droplet2")).hide()},_getWordAtPoint:function(n,t,i){var o,f,h,c,e,r;if(n.nodeType==n.TEXT_NODE){var s=!1,r=n.ownerDocument.createRange(),u=window.getSelection();for(u.anchorNode!=null&&(o=u.anchorNode.compareDocumentPosition(u.focusNode),(!o&&u.anchorOffset>u.focusOffset||o===Node.DOCUMENT_POSITION_PRECEDING)&&(s=!0)),r.selectNodeContents(n),f=0,h=r.endOffset;f<h;){if(r.setStart(n,f),r.setEnd(n,f+1),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return c=r.toString(),u.anchorNode!=null&&u.anchorNode.parentNode.className=="e-pdfviewer-textLayer"&&r.setStart(u.anchorNode,u.anchorOffset),u.removeAllRanges(),u.addRange(r),s?u.extend(n,f):u.extend(n,f+1),r.detach(),c;f+=1}}else for(e=0;e<n.childNodes.length;e++){if(r=n.childNodes[e].ownerDocument.createRange(),r.selectNodeContents(n.childNodes[e]),r.getBoundingClientRect().left<=t&&r.getBoundingClientRect().right>=t&&r.getBoundingClientRect().top<=i&&r.getBoundingClientRect().bottom>=i)return r.detach(),this._getWordAtPoint(n.childNodes[e],t,i);r.detach()}return null},_getElementTouch:function(t,i,r,u){var y,h,l,o,a,s,f;if(t.nodeType==t.TEXT_NODE)for(y=window.getSelection(),f=t.ownerDocument.createRange(),f.selectNodeContents(t),h=0,l=f.endOffset;h<l;){if(f.setStart(t,h),f.setEnd(t,h+1),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r){var d=f.toString(),p=t.textContent,e=[],c,l;for(s=0;s<p.length;s++)p[s]==" "&&e.push(s);for(o=0;o<e.length;o++){if(h==e[o]&&(c=e[o],l=e[o]),e[0]>h){c=0;l=e[o];break}h>e[o]&&h<e[o+1]?(c=e[o],l=e[o+1]):h>e[o]&&(e[o+1]||(c=e[o]))}if(this.startelem=c,this.endelem=l,c==0?f.setStart(t,c):f.setStart(t,c+1),f.setEnd(t,l),y.removeAllRanges(),y.addRange(f),u){a=f.getBoundingClientRect();this._rangePosition=a;this._ranges=!0;this._selectedRanges=f;var v=document.getElementById(this._id+"droplet1"),w=document.getElementById(this._id+"droplet2"),b=n(v).width(),k=n(v).height();n(v).show();n(v).offset({top:a.top+window.scrollY+k/2,left:a.left-b}).show();n(w).show();n(w).offset({top:a.top+window.scrollY+k/2,left:a.left+a.width-b}).show()}return f.detach(),d}h+=1}else for(s=0;s<t.childNodes.length;s++){if(f=t.childNodes[s].ownerDocument.createRange(),f.selectNodeContents(t.childNodes[s]),f.getBoundingClientRect().left<=i&&f.getBoundingClientRect().right>=i&&f.getBoundingClientRect().top<=r&&f.getBoundingClientRect().bottom>=r)return f.detach(),this._getElementTouch(t.childNodes[s],i,r,u);f.detach()}return null},_toolbarClick:function(t){var f=t.target,i=t.target,r,u;if(this._isToolbarClick)if(n("#"+this._id+"_rptTooltip").css("display","none"),this._selectionNodes=window.getSelection(),this._maintainSelection(),this._displaySearch=!1,n(i).hasClass("e-pdfviewer-toolbarli")&&(i=n(i).find("span")),n(i).hasClass("e-pdfviewer-print"))this._isPrintRestrict||this._print();else if(n(i).hasClass("e-pdfviewer-download"))this._isAsynchronousDownload=!0,this._saveFormFieldsValue();else if(n(i).hasClass("e-pdfviewer-gotofirst")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoFirstPage();else if(n(i).hasClass("e-pdfviewer-gotolast")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoLastPage();else if(n(i).hasClass("e-pdfviewer-gotonext")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoNextPage();else if(n(i).hasClass("e-pdfviewer-gotoprevious")&&!n(i).hasClass("e-pdfviewer-disabled"))this._gotoPreviousPage();else if(n(i).hasClass("e-pdfviewer-zoomin"))this._applyLowerZoomIndex(),this._zoomIn();else if(n(i).hasClass("e-pdfviewer-zoomout"))this._applyHigherZoomIndex(),this._zoomOut();else if(n(i).hasClass("e-pdfviewer-fitpage")||n(i).hasClass("e-pdfviewer-fitwidth")){r=i;u=n(r).attr("id");switch(u){case this._id+"_fitWidth":this._applyFitToWidth();break;case this._id+"_fitPage":this._applyFitToPage()}}else n(i).hasClass("e-pdfviewer-find")&&this._displaySearchBox()},_save:function(n){var i=this.fileName.indexOf("\\")==-1?this.fileName:this.fileName.replace(/^.*[\\\/]/,"");var t=navigator.userAgent,r=this._base64toBlob(n.DocumentStream,"application/pdf",512);t.indexOf("Edge")==-1?t.indexOf("Firefox")!=-1||t.indexOf("Chrome")!=-1||t.indexOf("Safari")!=-1||t.indexOf("AppleWebKit")!=-1?this._download(r,"",i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i)},_base64toBlob:function(n,t,i){var e,o,r,f,s,u,h;for(t=t||"",i=i||512,e=atob(n),o=[],r=0;r<e.length;r+=i){for(f=e.slice(r,r+i),s=new Array(f.length),u=0;u<f.length;u++)s[u]=f.charCodeAt(u);h=new Uint8Array(s);o.push(h)}return new Blob(o,{type:t})},_createBlob:function(n,t){if(typeof Blob!="undefined")return new Blob([n],{type:t});warn('The "Blob" constructor is not supported.')},_download:function(n,t,i){var u=URL.createObjectURL(n),r=document.createElement("a"),f;r.click?(r.href=u,r.target="_parent","download"in r&&(r.download=i),(document.body||document.documentElement).appendChild(r),r.click(),r.parentNode.removeChild(r)):(window.top===window&&u.split("#")[0]===window.location.href.split("#")[0]&&(f=u.indexOf("?")===-1?"?":"&",u=u.replace(/#|$/,f+"$&")),window.open(u,"_parent"))},_showToolbar:function(t){t?(n("#"+this._id+"_toolbarContainer").css("display","block"),this._setSearchToolbarTop(),this._isToolbarHidden=!1):(n("#"+this._id+"_toolbarContainer").css("display","none"),this._isFindboxPresent&&this._displaySearchBox(),this._isToolbarHidden=!0)},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(0);t.disable();n("#"+this._id+"_txtpageNo").attr("disabled","disabled");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotofirst");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotolast")}},_enableToolbarItems:function(){this._isToolbarClick=!0;this.model.toolbarSettings.templateId||this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_showIconToolTip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showTooltipContent(t)},_hideIconToolTip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(n){return n.css("display")=="block"?!1:!0},_showTooltipContent:function(t){var r=t.target,i,u,l,f,o,a,v,y,p,w,b,k,d,g,it,s,h,nt,tt,c,e,rt;if(this.model.toolbarSettings.showTooltip&&!this._isDevice){if(l=!0,n(r).hasClass("e-pdfviewer-toolbarli")&&(r=n(r).find("span")),f=n(r).prev(),n(r).hasClass("e-pdfviewer-print")&&(o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-print")[0],i=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-print")[0].getBoundingClientRect(),u=this._getTootipText("print")),n(r).hasClass("e-pdfviewer-download"))o=n("#"+this._id+"_toolbarContainer .e-pdfviewer-download")[0],i=o?o.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-download")[0].getBoundingClientRect(),u=this._getTootipText("download");else if(n(r).hasClass("e-pdfviewer-gotofirst")||n(f).hasClass("e-pdfviewer-gotofirst"))a=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotofirst")[0],i=a?a.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotofirst")[0].getBoundingClientRect(),u=this._getTootipText("first");else if(n(r).hasClass("e-pdfviewer-gotolast")||n(f).hasClass("e-pdfviewer-gotolast"))v=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotolast")[0],i=v?v.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotolast")[0].getBoundingClientRect(),u=this._getTootipText("last");else if(n(r).hasClass("e-pdfviewer-gotonext")||n(f).hasClass("e-pdfviewer-gotonext"))y=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotonext")[0],i=y?y.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotonext")[0].getBoundingClientRect(),u=this._getTootipText("next");else if(n(r).hasClass("e-pdfviewer-gotoprevious")||n(f).hasClass("e-pdfviewer-gotoprevious"))p=n("#"+this._id+"_toolbarContainer .e-pdfviewer-gotoprevious")[0],i=p?p.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-gotoprevious")[0].getBoundingClientRect(),u=this._getTootipText("previous");else if(n(r).hasClass("e-pdfviewer-zoomin")||n(f).hasClass("e-pdfviewer-zoomin"))w=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomin")[0],i=w?w.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomin")[0].getBoundingClientRect(),u=this._getTootipText("zoomin");else if(n(r).hasClass("e-pdfviewer-zoomout")||n(f).hasClass("e-pdfviewer-zoomout"))b=n("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomout")[0],i=b?b.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-zoomout")[0].getBoundingClientRect(),u=this._getTootipText("zoomout");else if(n(r).hasClass("e-pdfviewer-tbpage")||n(r).hasClass("e-pdfviewer-pagenumber")||n(r).hasClass("e-pdfviewer-labelpageno"))k=n("#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage")[0],i=k?k.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-tbpage")[0].getBoundingClientRect(),u=this._getTootipText("pageIndex");else if(n(r).hasClass("e-pdfviewer-ejdropdownlist")||n(r).hasClass("e-dropdownlist")||n(r).hasClass("e-select")||n(r).hasClass("e-down-arrow"))d=n("#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist")[0],i=d?d.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-ejdropdownlist")[0].getBoundingClientRect(),u=this._getTootipText("zoom"),l=this._viewpopupBlockNone(n("#"+this._id+"_toolbar_zoomSelection_popup_list_wrapper"));else if(n(r).hasClass("e-pdfviewer-fitwidth")||n(r).hasClass("e-pdfviewer-fitpage")||n(f).hasClass("e-pdfviewer-fitwidth")||n(f).hasClass("e-pdfviewer-fitpage")){g=r;it=n(g).attr("id");switch(it){case this._id+"_fitWidth":s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0];i=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect();u=this._getTootipText("fittoWidth");break;case this._id+"_fitPage":h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0];i=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect();u=this._getTootipText("fittopage");break;default:nt=n(g).prev();n(nt).hasClass("e-pdfviewer-fitwidth")?(s=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0],i=s?s.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitwidth")[0].getBoundingClientRect(),u=this._getTootipText("fittoWidth")):n(nt).hasClass("e-pdfviewer-fitpage")&&(h=n("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0],i=h?h.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-fitpage")[0].getBoundingClientRect(),u=this._getTootipText("fittopage"))}}else n(r).hasClass("e-pdfviewer-find")&&(this._isFindboxPresent||(tt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],i=tt?tt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0].getBoundingClientRect(),u=this._getTootipText("search")));u&&l&&(c=this._viewerMaxZindex(),n("#"+this._id+"_rptTooltip_Header").html(u.header),n("#"+this._id+"_rptTooltip_Content").html(u.content),e=document.getElementById(this._id+"_toolbarContainer").getBoundingClientRect(),rt=this.element[0].clientWidth,rt<i.left+2*i.width?u.header=="Zoom"?n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:i.top-e.top-21,left:i.left-e.left-2*i.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:i.top-e.top-21,left:i.left-e.left-3*i.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:i.top-e.top-21,left:i.left-e.left+i.width/2,display:"block",position:"absolute"}))}},_viewerMaxZindex:function(){var u=this.element.parents(),i,r,t;return i=n("body").children(),index=i.index(this.popup),i.splice(index,1),n(i).each(function(n,t){u.push(t)}),r=n(this.model.target).children(),cindex=r.index(this.popup),r.splice(cindex,1),n(r).each(function(n,t){u.push(t)}),t=Math.max.apply(t,n.map(u,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!t||t<1e4?t=1e4:t+=1,t},_getTootipText:function(n){var i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r="",u="";switch(n){case"print":r=i.toolbar.print.headerText;u=i.toolbar.print.contentText;break;case"download":r=i.toolbar.download.headerText;u=i.toolbar.download.contentText;break;case"first":r=i.toolbar.first.headerText;u=i.toolbar.first.contentText;break;case"previous":r=i.toolbar.previous.headerText;u=i.toolbar.previous.contentText;break;case"next":r=i.toolbar.next.headerText;u=i.toolbar.next.contentText;break;case"last":r=i.toolbar.last.headerText;u=i.toolbar.last.contentText;break;case"zoomin":r=i.toolbar.zoomIn.headerText;u=i.toolbar.zoomIn.contentText;break;case"zoomout":r=i.toolbar.zoomOut.headerText;u=i.toolbar.zoomOut.contentText;break;case"pageIndex":r=i.toolbar.pageIndex.headerText;u=i.toolbar.pageIndex.contentText;break;case"zoom":r=i.toolbar.zoom.headerText;u=i.toolbar.zoom.contentText;break;case"fittoWidth":r=i.toolbar.fitToWidth.headerText;u=i.toolbar.fitToWidth.contentText;break;case"fittopage":r=i.toolbar.fitToPage.headerText;u=i.toolbar.fitToPage.contentText;break;case"search":r=i.toolbar.search.headerText;u=i.toolbar.search.contentText}return{header:r,content:u}},_setInitialization:function(){this._canvascount=0;this._fileName="";this._isToolbarClick=!1;this._pageModel=null;this._currentPage=1;this._zoomLevel=2;this._pageImageStream=null;this._pageWidth;this._pageHeight;this._pageLocation=[];this._scrollTriggered=!1;this._previousPage=1;this._totalPages;this._previousPosition;this._cummulativeHeight;this._backgroundPage=1;this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._searchMatches=[];this._pagePrinted=!1;this._printingPage=1;this._printingTimer;this._previousZoom=1;this._renderPreviousPage=!1;this._pageSize;this._eventpreviouszoomvalue;this._eventzoomvalue;this._pdfFileName;this._zoomArray=[];this._rerenderCanvasList=[];this._ajaxRequestState=null},_showViewerBlock:function(t){if(t){n("#"+this._id+"_viewBlockContainer").css("display","block");var i=n("#"+this._id+"_viewBlockContainer .e-pdfviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else n("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&n("#"+this._id+"_viewBlockContainer.e-pdfviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){n("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_viewerContainer"});n("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showloadingIndicator:function(t){t?(n("#"+this._id+"_loadingIndicator").css("display","block"),n("#"+this._id+"_pageviewOuterContainer").css("display","none")):(n("#"+this._id+"_loadingIndicator").css("display","none"),n("#"+this._id+"_pageviewOuterContainer").css("display","block"));n("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t,appendTo:"#"+this._id+"_loadingIndicator"});n("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showPrintLoadingIndicator:function(t){n("#"+this._id+"e-pdf-viewer").css({position:"relative"});n("#"+this._id+"e-pdf-viewer").ejWaitingPopup({showOnInit:t,text:"Preparing document for printing...",cssClass:"e-pdfviewer-waitingpopup-print",appendTo:"#"+this._id+"e-pdf-viewer"})},_viewerResize:function(){var t=this,s=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,h=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,r=n(t.element).height(),u=n(t.element).width(),e,o,f;h.indexOf("%")!=-1?(t._isPercentHeight=parseInt(h),e=t._isHeight?n(t.element).parent().height():r,r=t._isHeight?e:e/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?r=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0&&(r=t.element[0].parentElement.clientHeight);t.element.height(r);s.indexOf("%")!=-1?(t._isPercentWidth=parseInt(s),o=t._isWidth?n(t.element).parent().width():u,u=t._isWidth?o:o/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?u=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&t.element[0].parentElement.clientWidth!=0&&(u=t.element[0].parentElement.clientWidth);t.element.width(u);t._toolbar._activeItem=i;t._toolbar._reSizeHandler();n("#"+t._id+"_pdfviewer_searchul").removeClass("e-separator");n("#"+t._id+"_pdfviewer_downloadul").removeClass("e-separator");f=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_printul").parent()[0]!=f[0]&&(this._isDownloadCntlHidden||(f.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._isDownloadCntlHidden=!0));n("#"+this._id+"_pdfviewer_downloadul").parent()[0]!=f[0]&&this._isDownloadCntlHidden&&(this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._isDownloadCntlHidden=!1);t._toolbarResizeHandler();t._resizeSearchToolbar();t.model.isResponsive&&t._renderedCanvasList.length>0&&t._isAutoZoom&&t._applyFitToWidthAuto();t._fitType!="fitToWidth"||t.model.isResponsive||t._applyFitToWidth();t._isWindowResizing=!0;t._applyLeftPosition()},_applyLeftPosition:function(){for(var t,i,n=1;n<=this._totalPages;n++)t=this._fitType=="fitToWidth"||this._isAutoZoom&&this._zoomVal<1?5:this._pageSize[n-1].PageRotation==90||this._pageSize[n-1].PageRotation==270?(this.element.width()-this._pageSize[n-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[n-1].PageWidth*this._zoomVal)/2,t<0&&(t=5),i=document.getElementById(this._id+"pageDiv_"+n),i&&(i.style.left=t+"px")},_toolbarResizeHandler:function(){var t=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_searchul").parent()[0]!=t[0]&&(this._isZoomCntlHidden=!0,t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_zoomul")[0]));n("#"+this._id+"_pdfviewer_zoomul").parent()[0]==t[0]&&this._isZoomCntlHidden&&(t.append(n("#"+this._id+"_pdfviewer_zoomul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),this._isZoomCntlHidden=!1)},_resizeSearchToolbar:function(){var t=document.getElementById(this._id+"_pdfviewer_searchbox"),r,e,f,o,u,i;t&&(r=n("#"+this._id+"_toolbarContainer .e-pdfviewer-find")[0],r||(r=n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-find")[0]),e=r.getBoundingClientRect(),f=document.getElementById("e-pdfviewer-arrow-responsive"),f&&document.head.removeChild(f),n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")?(o=document.getElementById(this._id+"_toolbarContainer"),t.style.left="0px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"):(t.style.left=r.parentNode.parentNode.offsetLeft-r.parentNode.parentNode.parentNode.offsetLeft-2+"px",i=n("#"+this._id+"_pdfviewer_searchinput")[0],i.style.width="150px",t.style.width="400px"),u=document.getElementById(this._id+"e-pdf-viewer"),u.clientWidth<t.offsetLeft+t.clientWidth?(i=n("#"+this._id+"_pdfviewer_searchinput")[0],this._isZoomCntlHidden?(i.style.width=parseInt(i.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px",t.style.width=parseInt(t.style.width)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"):n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")&&(t.style.left=parseInt(t.style.left)-(t.offsetLeft+t.clientWidth-u.clientWidth)+"px"),this._responsiveArrow(e,t))},_responsiveArrow:function(t,i){var r=document.createElement("Style"),f,u;r.id="e-pdfviewer-arrow-responsive";document.head.appendChild(r);style=r.sheet;!navigator.userAgent.match("Firefox")&&style?(f=i.getBoundingClientRect(),u=t.left-f.left,style.addRule(".e-pdfviewer-arrow::before","left:"+u+"px"),style.addRule(".e-pdfviewer-arrow::after","left:"+u+"px")):n("#"+this._id+"_pdfviewer_searchbox").removeClass("e-pdfviewer-arrow")},goToPage:function(n){this._gotoPageNo(n)},goToLastPage:function(){this._gotoLastPage()},goToFirstPage:function(){this._gotoFirstPage()},goToNextPage:function(){this._gotoNextPage()},goToPreviousPage:function(){this._gotoPreviousPage()},print:function(){this._print()},abortPrint:function(){this._printCancel()},showPrintTools:function(n){this._showPrintButton(n)},showDownloadTool:function(n){this._showDownloadButton(n)},showTextSearchTool:function(n){this._showTextSearchButton(n)},showPageNavigationTools:function(n){this._showPageNavigationControls(n)},showMagnificationTools:function(n){this._showZoomControl(n);this._showFittoPage(n)},showToolbar:function(n){this._showToolbar(n)},unload:function(){this._unLoad()},load:function(r){var e,u,o,f;if(n("#"+this._id+"_viewerContainer").scrollTop(0),this._showloadingIndicator(!0),this.isDocumentEdited=!1,this._fitType=null,this.model.isResponsive=!0,this._isAutoZoom=!0,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_search"),this._zoomVal=1,this._zoomLevel=3,this.fileName=null,n("#"+this._id+"_toolbar_zoomSelection_hidden").val("Auto"),this._ejDropDownInstance.model.value="Auto",this._initToolbar(),r)for(e=this._canvascount;e>=1;)n("#"+this._id+"pageDiv_"+e).remove(),e--;window.clearInterval(this._scrollTimer);u={};u.viewerAction="GetPageModel";u.controlId=this._id;u.pageindex="1";u.isInitialLoading="true";o=r.split("base64,")[1];o==i?(this._fileName=r,u.newFileName=this._fileName,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(u),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:u}),"_getPageModel")):(f=this.model.serviceUrl,u.uploadedFile=o,this._fileId=this._createGUID(),u.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?(f=this.model.serviceUrl+"/"+this.model.serverActionSettings.fileUpload,this._doAjaxPost("POST",f,JSON.stringify(u),"_getPageModel")):(f=f.replace(this.model.serverActionSettings.load,this.model.serverActionSettings.fileUpload),this._doAjaxPost("POST",f,JSON.stringify({jsonResult:u}),"_getPageModel")))},fitToPage:function(){this._applyFitToPage()},fitToWidth:function(){this._applyFitToWidth()},download:function(n){this._isAsynchronousDownload=typeof n=="boolean"?n:!0;this._saveFormFieldsValue()},zoomIn:function(){this._applyLowerZoomIndex();this._zoomIn()},zoomOut:function(){this._applyHigherZoomIndex();this._zoomOut()},zoomTo:function(t){t<50?t=50:t>400&&(t=400);var i=parseInt(t)/100;t=="Auto"?(i=1,this.model.isResponsive=!0):(t=t+"%",this.model.isResponsive=!1);this._calculateZoomLevel(i);this._zoomContainer(i,!1);n("#"+this._id+"_toolbar_zoomSelection_hidden").val(t);this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active");this._ejDropDownInstance.model.value=t}});t.PdfViewer.ToolbarItems={MagnificationTools:1,PageNavigationTools:2,PrintTools:4,DownloadTool:8,TextSearchTool:16,All:31};t.PdfViewer.PdfService={Local:1,Remote:2};t.PdfViewer.LinkTarget={Default:1,NewTab:2,NewWindow:4};t.PdfViewer.Locale=t.PdfViewer.Locale||{};t.PdfViewer.Locale["default"]=t.PdfViewer.Locale["en-US"]={toolbar:{print:{headerText:"Print",contentText:"Print the PDF document."},download:{headerText:"Download",contentText:"Download the PDF document."},first:{headerText:"First",contentText:"Go to the first page of the PDF document."},previous:{headerText:"Previous",contentText:"Go to the previous page of the PDF document."},next:{headerText:"Next",contentText:"Go to the next page of the PDF document."},last:{headerText:"Last",contentText:"Go to the last page of the PDF document."},zoomIn:{headerText:"Zoom-In",contentText:"Zoom in to the PDF document."},zoomOut:{headerText:"Zoom-Out",contentText:"Zoom out of the PDF document."},pageIndex:{headerText:"Page Number",contentText:"Current page number to view."},zoom:{headerText:"Zoom",contentText:"Zoom in or out on the PDF document."},fitToWidth:{headerText:"Fit to Width",contentText:"Fit the PDF page to the width of the container."},fitToPage:{headerText:"Fit to Page",contentText:"Fit the PDF page to the container."},search:{headerText:"Search Text",contentText:"Search text in the PDF pages."}}}})(jQuery,Syncfusion)});
  