text: /*!
  *  filename: ej.pdfviewer.min.js
  *  version : 20.1.0.60
  *  Copyright Syncfusion Inc. 2001 - 2022. 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.draggable.min","./../common/ej.scroller.min","./ej.button.min","./ej.dropdownlist.min","./ej.maskedit.min","./ej.splitbutton.min","./ej.menu.min","./ej.slider.min","./ej.dialog.min","./ej.tab.min","./ej.colorpicker.min","./ej.toolbar.min","./ej.tooltip.min","./ej.waitingpopup.min","./ej.checkbox.min","./ej.editor.min"],n):n()})(function(){(function(n,t,r){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",unload:"Unload"},documentPath:null,toolbarSettings:{toolbarItem:255,showTooltip:!0},enableHyperlink:!0,enableTextSelection:!0,pdfService:1,locale:"en-US",interactionMode:1,bufferingMode:1,pageChange:"",documentLoad:"",hyperlinkClick:"",beforePrint:"",afterPrint:"",zoomchange:"",bufferStart:"",bufferEnd:"",annotationAdd:"",annotationRemove:"",annotationPropertiesChange:"",annotationResize:"",signatureDelete:"",signatureAdd:"",signatureResize:"",signaturePropertiesChange:"",isResponsive:!0,pageClick:"",allowClientBuffering:!1,documentUnload:"",ajaxRequestFailure:"",ajaxRequestSuccess:"",annotationType:null,enableTextMarkupAnnotations:!0,enableHighlightAnnotation:!0,enableStrikethroughAnnotation:!0,enableUnderlineAnnotation:!0,enableSignature:!0,shouldFlattenDocument:!1,enableRequiredFormFieldValidation:!1,validateRequiredFormField:"",downloadStart:"",downloadEnd:"",strikethroughSettings:{color:"#ff0000",author:"Guest",opacity:1,subject:"Strikethrough",modifiedDate:null,isLocked:!1},underlineSettings:{color:"#00ff00",author:"Guest",opacity:1,subject:"Underline",modifiedDate:null,isLocked:!1},highlightSettings:{color:"#ffff00",author:"Guest",opacity:1,subject:"Highlight",modifiedDate:null,isLocked:!1},signatureSettings:{color:"#000000",opacity:1,width:0,height:0,left:0,top:0},textSelectionContextMenu:{isEnable:!0,isCopyEnable:!0,isSearchEnable:!0,isHighlightEnable:!0,isStrikeoutEnable:!0},annotationContextMenu:{isEnable:!0,isPopupEnable:!0,isDeleteEnable:!0,isPropertiesEnable:!0}},dataTypes:{toolbarSettings:"data"},_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,_isSignatureHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,_isWindowResizing:!1,_ejViewerInstance:null,_isAutoZoom:!1,_isAutoSelected:!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,_isPageExtraction:!1,_isFormFieldsDisabled:!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,_horizontalResolution:null,_isAsynchronousDownload:!0,_searchedText:null,_annotationActive:!1,_isHighlight:!1,_isUnderline:!1,_isStrikeout:!1,_drawColor:null,_selectedAnnotation:null,_selectedAnnotationObject:null,_isPopupNoteFocused:!1,_colorpickerObject:null,_toolbarColorpickerObject:null,_isBackwardSelection:!1,_isPropertiesWindowOpen:!1,_isAnnotationSelected:!1,_currentAnnotationRectangle:[],_currentAnnotationRectangleBackup:[],_annotationBackupNoteSave:[],_isPopupNoteVisible:!1,_isUnderlineEnabled:!1,_isHighlightEnabled:!1,_isStrikeOutEnabled:!1,_isContextMenuPresent:!1,_isDefaultColorSet:!1,_isTextSelection:!1,_colorPickerStatus:null,_annotationsDeletedNo:null,_selectedValue:null,_highestHeight:0,_removeSearch:!1,_ajaxInProgress:!1,_isNonBreackingCharacter:!1,_mouseDetection:!1,_oldX:null,_mouseX:null,_oldY:null,_mouseY:null,_newObject:[],_newx:null,_newy:null,_outputString:"",_completeSign:[],_outputPath:{},_valueChanges:{},_totalSignature:[],_isCanvasClicked:!1,_isCanasResized:!1,_tempCanvas:null,_previousZoomValue:1,_canvasTopPosition:0,_canvasLeftPosition:0,_newpoints:[],_maxpointsX:0,_minpointsX:0,_maxpointsY:0,_minpointsY:0,_controlSelectionRange:null,_selectionObject:null,_cancelDownloads:!1,_downloadfileName:null,_signatureLayer:[],_renderedCanvasList:null,_textureobj:[],_isToolbarHeightChanged:!1,_isPinchZoomed:!1,_isTouchEnded:!1,_prevZoomX:0,_zoomX:0,_zoomY:0,_textlayout:[],_responseData:null,_isSelectionDisabled:!1,_ispdfium:!1,_ispageCleared:!1,_isControlHided:!1,_isTouchAdded:!1,_maxTabindex:0,_minTabindex:-1,_maintainTabindex:{},_maintanMinTabindex:{},_isMobileDevice:!1,_renderPages:[],_isPositionSet:!1,_unloadRequestList:[],_isDownloadedRestricited:!1,pageCount:0,currentPageNumber:1,zoomPercentage:100,fileName:null,isDocumentEdited:!1,_init:function(){var f,i,u;if(this._isMobileDevice=t.isDevice(),this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,this._renderViewer(),this._initViewer(),this._createContextMenu(),this._createHighlightContextMenu(),this._createWaterDropDiv(),this._createTouchContextMenu(),this._createPopupMenu(),this._createNote(),this._createPropertiesMenu(),this._createColorPalette(),this._createSignatureControl(),f=document.getElementById(this._id+"_pdfviewer_colorpicker"),f&&(f.style.display="none"),this._isToolbarColorPicker=!1,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",i.zoomValue=this._zoomVal,this.model.allowClientBuffering&&(i.enableOfflineMode=!0,this.model.bufferingMode==t.PdfViewer.BufferingMode.Default?i.bufferingMode="default":this.model.bufferingMode==t.PdfViewer.BufferingMode.Complete&&(i.bufferingMode="complete"),this._isPrintingProcess||(i.isPageScrolled=!1)),this.model.documentPath){var r=this.model.documentPath,e=r.split("base64,")[1],o=!1,s=!1;e||(this.model.documentPath.indexOf("\\")!=-1||this.model.documentPath.indexOf("/")!=-1?(o=!0,s=!0,this.model.documentPath.toLowerCase().endsWith(".pdf")||(r=this.model.documentPath+".pdf")):(u=r.split(","),u.length>1?(i.newFileName=u[1],i.password=u[0]):i.newFileName=r,this._fileName=i.newFileName));i.file=r}i.id=this._createGUID();this._fileId=i.id;this._ajaxState!=null&&(this._ajaxState.abort(),this._ajaxState=null,this._scrollTriggered=!1);this.model.allowClientBuffesring?this.model.bufferingMode==t.PdfViewer.BufferingMode.Default?this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(i),"_getPageModel",!0):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}),"_getPageModel",!0):this.model.bufferingMode==t.PdfViewer.BufferingMode.Complete&&(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._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._ideviceScrolling();this._currentPage=1;this._textMarkupAnnotationList=[];this._newAnnotationList=[];this._colorModifiedAnnotationList=[];this._existingAnnotationsModified=[];this._deletedAnnotationList=[];this._undoAnnotationCollection=[];this._redoAnnotationCollection=[];this._deletedAnnotationCollection=[];this._recentOperation=[];this._annotationsDeletedNo=[];this._redoActions=[];this._totalAnnotations=[];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._showTextMarkupButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.TextMarkupAnnotationTools),this._showSignatureButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.SignatureTool),this._showSelectionButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.SelectionTool));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0);this._on(n("#"+this._id+"e-pdf-viewer"),"keydown",this._keyboardShortcutFind)},_unLoad:function(){var u,i,r,t;if(this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null),!(this._unloadRequestList.indexOf(this._fileId)>-1)){for(this._unloadRequestList.push(this._fileId),u=this,i={},i.id=this._fileId,this.pageCount!=0&&n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.unload,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(i),traditional:!0,error:function(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}}),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"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_signature"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_select"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_scroll"),r=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),r._selectItemByIndex(0),r.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._renderPages&&(this._renderPages.length=0);this._pageContents&&(this._pageContents=null);this._currentPage=1;this._totalPages=0;this._showloadingIndicator(!1);this._showPageLoadingIndicator(!1);this._raiseClientEvent("documentUnload",null)}},_destroy:function(){var t,i;for(this._isDestroyed=!0,n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),clearTimeout(this._scrollTimer),this._unwireEvents(),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;n("#"+this._id+"_PropertiesDialogTab").data("ejTab")._destroy();n("#"+this._id+"_signatureContainerDialogTab").data("ejDialog")._destroy();n("#"+this._id+"_pdfviewer_colorpicker").data("ejColorPicker")._destroy();n("#"+this._id+"_colorpicker").data("ejColorPicker")._destroy();n("#"+this._id+"_containerDialogTab").data("ejDialog")._destroy();n("#"+this._id+"_pdfviewer_colorpicker_Presets").parent().remove();n("#"+this._id+"_signatureContainerDialogTab").remove();n("#"+this._id+"_containerDialogTab").remove();n("#"+this._id+"_pageviewContainer").remove();n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList")._destroy();n("#"+this._id+"_pdfviewer_searchbox").data("ejToolbar")._destroy();this._toolbar._destroy();n("#"+this._id+"_toolbarContainer").remove();n("#"+this._id+"_viewerContainer").remove();n("#"+this._id+"_viewBlockContainer").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.element.html("");i=n(this.element).clone();i.removeClass("e-pdfviewer e-js");this.element.replaceWith(i);this._renderedCanvasList.length=0;this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var n=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none","min-width":"200px",width:""},{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,o,c,h,l,a,v,y,s;this.model.toolbarSettings.templateId?(s=document.getElementById(this.model.toolbarSettings.templateId),i.append(s),s.ejToolbar({enableSeparator:!0,height:s.height(),click:this.model.toolbarSettings.click,isResponsive:!0}),s.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),o=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_textmarkupul"}),this._appendToolbarItems(o,"underline"),this._appendToolbarItems(o,"strikeout"),this._appendToolbarItems(o,"highlight"),r.append(o),c=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_signatureul"}),this._appendToolbarItems(c,"signature"),r.append(c),h=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_selectul"}),this._appendToolbarItems(h,"selection"),this._appendToolbarItems(h,"scrolling"),r.append(h),l=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_downloadul"}),this._appendToolbarItems(l,"download"),r.append(l),a=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_printul"}),this._appendToolbarItems(a,"print"),r.append(a),v=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_searchul"}),this._appendToolbarItems(v,"search"),r.append(v),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:0}),y=n("#"+this._id+"_toolbar_zoomSelection_hidden"),y&&n(y).attr("aria-label","zoomselection hidden")),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this),itemHover:n.proxy(this._toolbarHover,this),isResponsive:!0,overflowClose:n.proxy(this._overflowToolbarClose,this)}),this._toolbar=n("#"+this._id+"_toolbarContainer").data("ejToolbar"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-responsive-toolbar").addClass("e-pdfviewer e-pdfviewer-responsivesecondarytoolbar"),n("#"+this._id+"_pdfviewer_searchul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_signatureul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_selectul").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,g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],h,c,l,a,v,y,p,w,b,k,d,e;switch(i){case"print":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"});h=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(h);break;case"download":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_download"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-download","",{},{id:this._id+"_toolbar_download"});r.append(c);break;case"gotofirst":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"});l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{});r.append(l);break;case"gotolast":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"});a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{});r.append(a);break;case"gotonext":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{});r.append(v);break;case"gotoprevious":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"});y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{});r.append(y);break;case"gotopage":r=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{id:this._id+"_pdfviewer_toolbar_pageli"});var o=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block",overflow:"visible"},{}),nt=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none","aria-label":"pageNo"}),tt=t.buildTag("span.e-pdfviewer-labelpageno","",{},{});o.append(nt);o.append(tt);r.append(o);break;case"zoomin":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"});p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(p);break;case"zoomout":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"});w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(w);break;case"zoom":r=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{id:this._id+"_pdfviewer_toolbar_zoomli"});var o=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","aria-label":"zoomSelection"}),g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],it=g.contextMenu.auto.contentText;u.append("<option Selected>"+it+"<\/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>");this._isMobileDevice||u.append("<option>400%<\/option>");o.append(u);r.append(o);break;case"fitWidth":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"});b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"});r.append(b);break;case"fitPage":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"});k=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"});r.append(k);break;case"search":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_search"});d=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-find","",{},{id:this._id+"_find"});r.append(d);break;case"highlight":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-highlight","",{},{id:this._id+"_pdfviewer_toolbar_highlight"});var rt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-highlight-markup","",{},{id:this._id+"_highlight_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_highlight_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_highlight_dropdown_arrow"});f.append(s);r.append(rt);r.append(f);break;case"underline":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-underline","",{},{id:this._id+"_pdfviewer_toolbar_underline"});var ut=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-underline-markup","",{},{id:this._id+"_underline_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_underline_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_underline_dropdown_arrow"});f.append(s);r.append(ut);r.append(f);break;case"strikeout":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-strikeout","",{},{id:this._id+"_pdfviewer_toolbar_strikeout"});var ft=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-strikeout-markup","",{},{id:this._id+"_strikeout_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_strikeout_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_strikeout_dropdown_arrow"});f.append(s);r.append(ft);r.append(f);break;case"signature":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-sign","",{},{id:this._id+"_pdfviewer_toolbar_signature"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-sign","",{},{id:this._id+"_sign"});r.append(e);break;case"selection":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-select","",{},{id:this._id+"_pdfviewer_toolbar_select"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-select","",{},{id:this._id+"_select"});r.append(e);break;case"scrolling":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-scroll","",{},{id:this._id+"_pdfviewer_toolbar_scroll"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-scroll","",{},{id:this._id+"_scroll"});r.append(e)}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._toolbarResizeHandler();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","",{}),a,y,h;r.append(i);var c=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{}),u=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-inputcontainer","",{},{}),p=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Find : ",{float:"left","padding-top":"1px","margin-right":"5px",width:"32px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{id:this._id+"_pdfviewer_findlabel"}),w=t.buildTag("input.e-pdfviewer-searchinput e-pdfviewer-elementalignments ejinputtext","",{width:"150px"},{id:this._id+"_pdfviewer_searchinput","aria-label":"search input"});u.append(p);u.append(w);c.append(u);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"}),l=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-close","",{float:"left","margin-left":"4px"},{id:this._id+"_pdfviewer_close_search"}),b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-prevfind","",{},{id:this._id+"_prevfind"});f.append(b);n(f).css({"pointer-events":"none",opacity:"0.6"});n(e).css({"pointer-events":"none",opacity:"0.6"});a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-nextfind","",{},{id:this._id+"_nextfind"});e.append(a);var v=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{}),o=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-checkboxcontainer","",{float:"left",overflow:"visible"},{}),s=t.buildTag("input","",{},{type:"checkbox","aria-label":"search matchcase"}),k=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Match case",{float:"left","padding-top":"3px","margin-left":"5px","margin-top":"4px",width:"70.5px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{id:this._id+"_pdfviewer_matchlabel"});o.append(s);o.append(k);v.append(o);y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closefind","",{},{id:this._id+"_closefind"});l.append(y);i.append(c);i.append(f);i.append(e);i.append(v);i.append(l);r.ejToolbar({enableSeparator:!1,isResponsive:!1,width:"400px",hide:!0,itemHover:n.proxy(this._toolbarHover,this)});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);h=n("#"+this._id+"_search_matchcase_hidden");h&&n(h).attr("aria-label","search hidden matchcase")},_createColorPalette:function(){var i=t.buildTag("div.e-pdfviewer-colorpicker","",{},{id:this._id+"_pdfviewer_colorpicker"});n("#"+this._id+"_pdfviewerContainer").append(i);i.ejColorPicker({displayInline:!0,modelType:"palette",change:n.proxy(this._setDrawColor,this)});this._toolbarColorpickerObject=i.data("ejColorPicker")},_setContainerSize:function(){var t=document.getElementById(this._id),i,f,r,u,e,o;t&&(i=t.clientHeight,i==0&&(this._isControlHided=!0,i=parseFloat(t.style.height),f=parseFloat(t.style.width),n("#"+this._id+"_viewerContainer").css({width:f+"px"})),r=0,this._isDevice||(u=n("#"+this._id+"_viewBlockContainer"),u.css("display").toLowerCase()=="block"&&(r=u.height())),e=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height(),o=i-r-e-4,n("#"+this._id+"_viewerContainer").css({height:o+"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").unbind("mouseup").on("mouseup",function(n){var e=n.offsetX,o=n.offsetY,t,i,r,f,s;n.target&&n.target.id&&n.target.id!=""&&(t=parseInt(n.target.id.split("text_")[1])||parseInt(n.target.id.split("selectioncanvas_")[1])||parseInt(n.target.id.split("secondarycanvas_")[1])||parseInt(n.target.id.split("pagecanvas_")[1])||parseInt(n.target.id.split("input_")[1].split("_")[0]),isNaN(t)&&(t=u.currentPageNumber),i=document.getElementById(u._id+"pageDiv_"+t),i&&(r=u._zoomVal,f=i.getBoundingClientRect(),e=(n.clientX-f.left)/r,o=(n.clientY-f.top)/r));s={offsetX:e,offsetY:o};u._raiseClientEvent("pageClick",s)});this._scrollTimer=setInterval(function(){u._pageviewscrollchanged(t)},500);u._backgroundPage=1;this._previousZoom=1;u._previousPage=u._currentPage;this._canvascount=this._totalPages;this.model.allowClientBuffering||(this._pageLocation=[],this._renderedCanvasList=[],this._pageContents=[],this._pageText=[],this._textDivs=[],this._textContents=[],this._searchMatches=[],this._searchCollection=[],this._pageLocation[1]=0,this._searchedPages=[],this._pointers=[],this._imageObj=[],this._pagesGot=[],this._imageSrcCollection=[],this._selectionPages=[]);this._designPageCanvas()},_designPageCanvas:function(){var o=5,l=n("#"+this._id+"_pageviewContainer"),c=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewOuterline"),a=c.width(),w=c.height(),v=this._pageWidth,b=this._pageHeight,s=1,i,h,e,y,r,u;for(s=(a-25)/v,s=Math.min(1,s),this._zoomVal=s,i=1;i<=this._totalPages;i++){h=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;h<0&&(h=5);e=t.buildTag("div","",{},{id:this._id+"pageDiv_"+i});l.append(e);e.css("position","absolute");e.css("top",this._zoomVal*o);e.css("left",h+"px");this._pageLocation[i]=o;var f=document.createElement("canvas");f.id=this._id+"_secondarycanvas_"+i;f.className="e-pdfviewer-secondarycanvas";f.style.position="absolute";f.style.left=0;f.style.top=0;f.style.backgroundColor="transparent";e.append(f);y=this;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";e.append(r);f.height=r.height;f.width=r.width;f.style.height=r.height+"px";f.style.width=r.width+"px";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";u.style.overflow="hidden";e.append(u);this._isControlHided||(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"}));o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?parseFloat(o)+parseFloat(this._pageSize[i-1].PageWidth)+8:parseFloat(o)+parseFloat(this._pageSize[i-1].PageHeight)+8}this._cummulativeHeight=o;this._isControlHided=!1},_computeCurrentPage:function(){var f=0,t=0,o=document.getElementById(this._id+"_viewerContainer"),u=o.scrollTop,i,e,s;this._zoomVal!=1&&(u=u+this._currentPage*(8-this._zoomVal*8));var c=0,h=0,l={currentPageNumber:0};for(i=0;i<this._totalPages;i++){if(this._isDestroyed)return;if(f>u&&u>=0){if(t=i,e=document.getElementById(this._id+"_viewerContainer"),s=n("#"+this._id+"pageDiv_"+t)[0],s!=r&&s!=null){var v=s.getBoundingClientRect(),y=v.bottom,p=n("#"+this._id+"e-pdf-viewer")[0],w=parseInt(p.getBoundingClientRect().height),b=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height(),k=parseInt(n(e).css("height"))-b,d=w-k,a=parseFloat(f)-parseFloat(u),g=o.clientHeight,nt=o.clientHeight-a;o.clientHeight<this._pageSize[i-1].PageHeight*this._zoomVal+this._pageSize[i].PageHeight*this._zoomVal&&parseInt(this._pageLocation[i]*this._zoomVal)<e.scrollTop?nt>a&&y<=290+d&&(t=parseFloat(t)+1,n("#"+this._id+"pageDiv_"+t).css("visibility",""),this._renderPreviousPage=!0):this._pageSize[i-1].PageOrientation=="Landscape"&&e.scrollTop>parseInt(this._pageLocation[i]*this._zoomVal)&&g<=600&&(t=parseFloat(t)+1,n("#"+this._id+"pageDiv_"+t).css("visibility",""),this._renderPreviousPage=!0);this._renderPreviousPage=!1;break}}else f=this._pageSize[i].PageRotation==90||this._pageSize[i].PageRotation==270?parseFloat(f)+parseFloat(this._pageSize[i].PageWidth*this._zoomVal)+8:parseFloat(f)+parseFloat(this._pageSize[i].PageHeight*this._zoomVal)+8;t=u>=0?i+1:1}if(this._fitType=="fitToPage"){var tt=parseFloat(n("#"+this._id+"pageDiv_"+t).css("height")),it=this._pageLocation[t]*this._zoomVal,rt=parseFloat(n(e).css("height")),ut=(rt-tt)/2;n("#"+this._id+"pageDiv_"+t).css("top",it+ut+"px");n("#"+this._id+"pageDiv_"+(t+1)).css("visibility","hidden");n("#"+this._id+"pageDiv_"+(t-1)).css("visibility","hidden")}n("#"+this._id+"pageDiv_"+t).css("visibility","");n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages);c=document.getElementById(this._id+"_txtpageNo").value;n("#"+this._id+"_txtpageNo").val(t);this._updatePageNavigation(t,this._totalPages);h=document.getElementById(this._id+"_txtpageNo").value;l.currentPageNumber=h;this._currentPage=t;this.currentPageNumber=this._currentPage;c!=h&&this._raiseClientEvent("pageChange",l)},_pageviewscrollchanged:function(){var s=0,h=n("#"+this._id+"_viewerContainer").scrollTop(),c,o,f,l,i,e,u;this._isTargetPage&&this.model.allowClientBuffering&&this.model.bufferingMode==t.PdfViewer.BufferingMode.Default&&(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,id:this._fileId,pageindex:this._targetPage.toString(),enableOfflineMode:!0,bufferingMode:"default",isPageScrolled:!1},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,i,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(i=jsondata[t],i)u._pageContents[parseInt(i.currentpage)]=JSON.stringify(i),u._pageText[parseInt(i.currentpage)]=i.pageContents,u._pagesGot.push(parseInt(i.currentpage)),f++;else{e=!0;break}if(i==r&&!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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=this._currentPage.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))))));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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=this._currentPage.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))));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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=(parseInt(this._currentPage)-1).toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this.model.allowClientBuffering&&(i.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=f.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this.model.allowClientBuffering&&(i.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i})))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=(parseInt(this._currentPage)-1).toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this.model.allowClientBuffering&&(i.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=f.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this.model.allowClientBuffering&&(l=!0,this._isPrintingProcess||(i.isPageScrolled=!1)),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i),l):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i})))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=(parseInt(this._currentPage)-1).toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=f.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i})))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=f.toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))):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,i={},i.viewerAction=this._viewerAction.getPageModel,i.pageindex=(parseInt(this._currentPage)-1).toString(),i.id=this._fileId,i.zoomValue=this._zoomVal,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(i)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}))));this._previousPosition=h;u=this;setTimeout(function(){var r,e;if(u.model){var o=t.PdfViewer.Locale[u.model.locale]?t.PdfViewer.Locale[u.model.locale]:t.PdfViewer.Locale["default"],i=o.contextMenu.auto.contentText,f=n("#"+u._id+"_toolbar_zoomSelection").data("ejDropDownList");f&&(r=n("#"+u._id+"_toolbar_zoomSelection_hidden").val(),r!=i&&(n("#"+u._id+"_toolbar_zoomSelection_popup li")[0].innerHTML=i,e=f.selectedIndex(),e==0&&isNaN(parseFloat(r))&&(n("#"+u._id+"_toolbar_zoomSelection_hidden").val(i),u._ejDropDownInstance.model.value=i),u._searchBoxLocalization()))}u._selectionRange==null||u._displaySearch||(u._selectionNodes.addRange(u._selectionRange),u._selectionRange=null,u._selectionNodes=null)},5e3)},_doAjaxPostscroll:function(i,r,u,f){var e=this;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);this._ajaxInProgress=!0;this._ajaxState=n.ajax({type:i,url:r,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:u,traditional:!0,success:function(n){var r,i;e._ajaxInProgress=!1;n=e._ajaxResponseData(n);e._scrollTriggered=!1;typeof n=="object"?e._drawPdfPage(JSON.stringify(n)):e._drawPdfPage(n);e._searchText&&e._isRequestFired&&(r=typeof n=="object"?JSON.stringify(n):n,jsondata=typeof n=="object"?e._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(JSON.stringify(n)):JSON.parse(JSON.stringify(n).d):e._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(n):JSON.parse(n.d),e._pageContents[parseInt(jsondata.currentpage)]=r,e._pageText[parseInt(jsondata.currentpage)]=jsondata.pageContents,e._searchText&&e._isRequestFired&&e._initSearch(e._searchPageIndex));f&&e.model.allowClientBuffering&&(i=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),e._pagesGot.push(parseInt(i.currentpage)),parseInt(i.currentpage)<=e._totalPages&&(e._targetPage=i.currentpage+1,e._isTargetPage=!0))},error:function(n){n.readyState!=0&&e._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_drawPdfPage:function(i){var di=i,f,gt,l,u,h,w,st,nt,ct,y,c,ft,ni,vi,it,g,e,et,ci,o,kt,dt,v,s;if(i=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),this._renderedCanvasList.push(parseInt(i.currentpage)),this._renderPages.indexOf(parseInt(i.currentpage))==-1&&this._renderPages.push(parseInt(i.currentpage)),f=parseInt(i.currentpage),this._isWindowResizing||this._showPageLoadingIndicator(f,!0),gt=i.imagestream,l=document.getElementById(this._id+"pagecanvas_"+parseInt(i.currentpage)),l&&this.model){if(u=l.getContext("2d"),h=this._scalingTextContent(u),this._pageSize[f-1].PageRotation==90||this._pageSize[f-1].PageRotation==270?(l.width=this._zoomVal*this._pageSize[f-1].PageWidth*h,l.height=this._zoomVal*this._pageSize[f-1].PageHeight*h,l.style.height=this._zoomVal*this._pageSize[f-1].PageHeight+"px",l.style.width=this._zoomVal*this._pageSize[f-1].PageWidth+"px"):(l.width=this._zoomVal*this._pageSize[f-1].PageWidth*h,l.height=this._zoomVal*this._pageSize[f-1].PageHeight*h,l.style.height=this._zoomVal*this._pageSize[f-1].PageHeight+"px",l.style.width=this._zoomVal*this._pageSize[f-1].PageWidth+"px"),this._pageContents[parseInt(i.currentpage)]=di,this._pageText[parseInt(i.currentpage)]=i.pageContents,this._imageObj=[],n("#"+this._id+"selectioncanvas_"+f).hasClass("text_container")?this._resizeSelection(i,f,u):(this._textSelection(i,f,u),this._textMarkupAnnotationList[parseInt(i.currentpage)]=i.textMarkupAnnotation,this._textMarkupAnnotationList[parseInt(i.currentpage)]&&(this._totalAnnotations[f]=i.textMarkupAnnotation.slice())),n("#"+this._id+"selectioncanvas_"+f).hasClass("input_container")?this._generateFormFields(i,f):this._createFormFields(i,f),navigator.userAgent.indexOf("Firefox")!=-1)for(w=gt.textelements,st=0;st<w.length;st++)if(o=w[st],nt=o.textureBrushs,nt){var li=o.texturFields[0].Image,rt="data:image/png;base64,"+li,ht=new Image;ht.src=rt;this._imageSrcCollection.push(ht.src)}for(this._isTextSearch&&(s=this,setTimeout(function(){s._isPageScrollHighlight=!0;s._isPageScrolledForSearch=!0;s._highlightOtherOccurrences()},100)),ct=n("#"+this._id+"selectioncanvas_"+f).children(),g=0;g<ct.length;g++)ct[g].hasAttribute("href")&&n(ct[g]).remove();var k=i.linkannotation,ai=i.annotpagenum,lt=this;if(this.model.enableHyperlink)for(y=0;y<k.length;y++){if(c=document.createElement("a"),c.id="linkdiv_"+y,ft=k[y].AnnotRectangle,c.style.background="transparent",c.style.position="absolute",c.style.left=this._convertPointToPixel(ft.Left*this._zoomVal)+"px",c.style.top=this._convertPointToPixel(ft.Top*this._zoomVal)+"px",c.style.width=this._convertPointToPixel(ft.Width*this._zoomVal)+"px",c.style.height=this._convertPointToPixel(ft.Height*this._zoomVal)+"px",c.style.color="transparent",k[y].URI.indexOf("mailto:")!=-1?(ni=k[y].URI.substring(k[y].URI.indexOf("mailto:"),k[y].URI.length),c.title=ni,c.setAttribute("href",ni)):(c.title=k[y].URI,c.setAttribute("href",k[y].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(c.target="_self",c.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(c.target="_blank",c.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(c.onclick=function(){var n={hyperlink:this.href};return lt._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ai[y]!=r){var gi=this._pageSize[f-1].PageHeight,nr=this._convertPointToPixel(k[y].AnnotLocation),tr=gi-nr,ir=parseFloat(this._pageLocation[ai[y]]*this._zoomVal)+parseFloat(tr*this._zoomVal);c.name=ir;c.onclick=function(){var n=document.getElementById(lt._id+"_viewerContainer");return n.scrollTop=this.name,!1}}vi=document.getElementById(this._id+"selectioncanvas_"+f);vi.appendChild(c)}this._textMarkupAnnotationList[f]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[f],f);var p=parseInt(i.currentpage),ti=[],at=[],rr=[],vt=[],yt=[],ii=[],ur=[],yi=0,pi,d=navigator.userAgent,tt,wi=0,pt=[],w=gt.textelements;if(w.imagedata!=null&&i.isPdfRenderingEngine){var fr=w.imagedata,ri=new Image,s=this;this._ispdfium=!0;this._isContainImage=!0;ri.onload=function(){s._renderImages(l,ri,l.width,l.height,h)};ri.src=fr[0]}for(it=0;it<w.length;it++){var o=w[it],ui=o.color,a=o.matrix;a!=null&&(a=a.Elements);var fi=o.brush,b=o.pathValue,er=o.iscliping,bi=o.restorecanvas,rt=o.imagedata,ut=o.fillrule,or=o.isFillandStroke,sr=o.fillcolor,ei=o.strokecolor,oi=o.linewidth,si=o.linecap,wt=o.linearGradientBrush,nt=o.textureBrushs,bt=o.charID,cr=o.rectvalue,ki=o.alpha,hi=o.dashPattern;if(hi!=null&&hi.length>0&&u.setLineDash(hi),b!=null?(b=b.split(";"),bt&&(pt[bt]=b)):b==null&&bt&&(b=pt[bt]),bi==!1&&u.save(),b!=r&&u.setTransform(a[0]*this._zoomVal*h,a[1]*this._zoomVal*h,a[2]*this._zoomVal*h,a[3]*this._zoomVal*h,a[4]*this._zoomVal*h,a[5]*this._zoomVal*h),b!=null){for(u.beginPath(),g=0;g<b.length;g++)e=b[g],et=e[0],et=="M"?(e=e.substring(1,e.length),e=e.split(" "),u.moveTo(e[0],e[1])):et=="L"?(e=e.substring(1,e.length),e=e.split(" "),u.lineTo(e[0],e[1])):et=="C"?(e=e.substring(1,e.length),e=e.split(" "),u.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):et=="Z"&&u.closePath();er==!0?(ut=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(ut)),u.clip()):or==r?fi=="Fill"?(wt!=r?u.fillStyle=this._getGradientBrush(wt,u):nt!=r?u.fillStyle=this._createTextureBrush(nt,u,o):(ki!=r&&(u.globalAlpha=ki),u.fillStyle=ui),ut=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(ut)),u.fill()):fi=="FillandStroke"?(u.fillStyle=ui,u.fill(),u.strokeStyle=ei,u.stroke()):fi=="Stroke"?(u.strokeStyle=ei,u.lineWidth=oi,u.lineCap=si,u.stroke()):(u.strokeStyle=ui,u.lineWidth=oi,u.lineCap=si,u.stroke()):(u.strokeStyle=ei,u.lineWidth=oi,u.lineCap=si,u.stroke(),u.fillStyle=wt!=r?this._getGradientBrush(wt,u):nt!=r?this._createTextureBrush(nt,u,o):sr,ut=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(ut)),u.fill())}if(bi&&u.restore(),rt!=r)if((tt=d.indexOf("Firefox"))!=-1||(tt=d.indexOf("Chrome"))!=-1||(tt=d.indexOf("Safari"))!=-1||(tt=d.indexOf("AppleWebKit"))!=-1){ti.push(rt);at.push(a);yt.push(w);vt.push(it);pi=this._zoomVal;this._isContainImage=!0;break}else ci=new Image,ci.src=rt,u.setTransform(a[0]*this._zoomVal*h,a[1]*this._zoomVal*h,a[2]*this._zoomVal*h,a[3]*this._zoomVal*h,a[4]*this._zoomVal*h,a[5]*this._zoomVal*h),u.drawImage(ci,0,0,1,1);if(nt!=r){if(o=w[it],nt){var li=o.texturFields[0].Image,rt="data:image/png;base64,"+li,ht=new Image;ht.src=rt;ii.push(ht.src)}at.push(a);yt.push(w);vt.push(it);pi=this._zoomVal;break}}for(kt=0;kt<ii.length;kt++)this._textureBrushRendering(w,ur,ii,at,u,kt,yt,vt,pt,l,p,yi),yi++;if((tt=d.indexOf("Firefox"))!=-1||(tt=d.indexOf("Chrome"))!=-1||(tt=d.indexOf("Safari"))!=-1||(tt=d.indexOf("AppleWebKit"))!=-1)for(dt=0;dt<ti.length;dt++)this._imageRendering(w,rr,ti,at,u,dt,yt,vt,pt,l,p,wi),wi++;if(v=l,s=this,this._pageSize[p-1].PageRotation!=0&&!this._isContainImage&&!(rt!=r&&d.indexOf("Firefox")!=-1)){v=document.getElementById(this._id+"pagecanvas_"+parseInt(i.currentpage));var hr=v.toDataURL(),u=v.getContext("2d"),h=s._scalingTextContent(u),ot=new Image;ot.onload=function(){u.clearRect(0,0,v.width,v.height);s._pageSize[p-1].PageRotation==90||s._pageSize[p-1].PageRotation==270?(v.width=s._zoomVal*s._pageSize[p-1].PageHeight*h,v.height=s._zoomVal*s._pageSize[p-1].PageWidth*h,v.style.height=s._zoomVal*s._pageSize[p-1].PageWidth+"px",v.style.width=s._zoomVal*s._pageSize[p-1].PageHeight+"px"):(v.width=s._zoomVal*s._pageSize[p-1].PageWidth*h,v.height=s._zoomVal*s._pageSize[p-1].PageHeight*h,v.style.width=s._zoomVal*s._pageSize[p-1].PageWidth+"px",v.style.height=s._zoomVal*s._pageSize[p-1].PageHeight+"px");u.save();u.translate(v.width/2,v.height/2);u.rotate(s._pageSize[p-1].PageRotation/2*Math.PI/2);u.drawImage(ot,-ot.width/2,-ot.height/2);u.restore()};ot.src=hr}return this._showPageLoadingIndicator(f,!1),this._changingImageCanvasPosition(f),this._showSignature(),v}},_renderImages:function(n,t){var i=n.getContext("2d"),r=window.innerWidth/screen.width,u=window.innerHeight/screen.height;i.drawImage(t,0,0,n.width-r,n.height-u)},_textureBrushRendering:function(n,t,i,u,f,e,o,s,h,c,l,a){var y=this._zoomVal,p=new Image,v=this,w=navigator.userAgent;p.onload=function(){for(var tt,dt,g,at,lt,e,ot,kt=!1,b=v._scalingTextContent(f),nt=0;nt<u.length;nt++)if(kt==!1){if(tt=u[nt],f.setTransform(tt[0]*y*b,tt[1]*y*b,tt[2]*y*b,tt[3]*y*b,tt[4]*y*b,tt[5]*y*b),t[a]!=r){var ft=t[a],it=document.createElement("canvas"),ni=it.getContext("2d");it.width=ft.width;it.height=ft.height;ni.drawImage(ft,0,0,ft.width,ft.height,0,0,it.width,it.height);dt=f.createPattern(it,"repeat");f.fillStyle=dt;f.fill()}for(g=s[nt],g=g+1,at=o[nt];g<at.length;){var p=at[g],vt=p.color,k=p.matrix;k!=null&&(k=k.Elements);var yt=p.brush,d=p.pathValue,ti=p.iscliping,gt=p.restorecanvas,ii=p.imagedata,rt=p.fillrule,ri=p.isFillandStroke,ui=p.fillcolor,pt=p.strokecolor,wt=p.linewidth,bt=p.linecap,ht=p.linearGradientBrush,et=p.textureBrushs,ct=p.charID,ei=p.rectvalue;if(d!=null?(d=d.split(";"),ct&&(h[ct]=d)):d==null&&ct&&(d=h[ct]),gt==!1&&f.save(),d!=r&&f.setTransform(k[0]*y*b,k[1]*y*b,k[2]*y*b,k[3]*y*b,k[4]*y*b,k[5]*y*b),d!=null){for(f.beginPath(),lt=0;lt<d.length;lt++)e=d[lt],ot=e[0],ot=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):ot=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):ot=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):ot=="Z"&&f.closePath();ti==!0?(rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(rt)),f.clip()):ri==r?yt=="Fill"?(f.fillStyle=ht!=r?v._getGradientBrush(ht,f):et!=r?v._createTextureBrush(et,f,p):vt,rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(rt)),f.fill()):yt=="FillandStroke"?(f.fillStyle=vt,f.fill(),f.strokeStyle=pt,f.stroke()):yt=="Stroke"?(f.strokeStyle=pt,f.lineWidth=wt,f.lineCap=bt,f.stroke()):(f.strokeStyle=vt,f.lineWidth=wt,f.lineCap=bt,f.stroke()):(f.strokeStyle=pt,f.lineWidth=wt,f.lineCap=bt,f.stroke(),f.fillStyle=ht!=r?v._getGradientBrush(ht,f):et!=r?v._createTextureBrush(et,f,p):ui,rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(rt)),f.fill())}if(gt&&f.restore(),et!=r){kt=!0;i.pop();u.pop();o.pop();s.pop();i.push(ii);u.push(k);o.push(n);s.push(g);nt=-1;a++;break}g++}}else v._textureBrushRendering(n,t,i,u,f,nt,o,s,h,c,l,a),a++;if(g==n.length&&v._pageSize[l-1].PageRotation!=0){var w=document.getElementById(v._id+"pagecanvas_"+l),fi=w.toDataURL(),ut=w.getContext("2d"),st=new Image;st.onload=function(){ut.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");ut.save();ut.translate(w.width/2,w.height/2);ut.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);ut.drawImage(st,-st.width/2,-st.height/2);ut.restore()};st.src=fi}};p.src=i[e];t.push(p);this._textureobj.push(p)},_hidingSignature:function(){n(".e-pdfviewer-imagecanvasDraw").hide();var t=document.getElementById(this._id+"e-pdfviewer-selector"),i=document.getElementsByClassName("e-pdfviewer-buttons");n(t).remove();n(i).remove()},_showSignature:function(){n(".e-pdfviewer-imagecanvasDraw").show();var t=document.getElementById(this._id+"e-pdfviewer-selector"),i=document.getElementsByClassName("e-pdfviewer-buttons");n(t).remove();n(i).remove()},_changingImageCanvasPosition:function(){var t=n(".e-pdfviewer-imagecanvasDraw");this._calculatingPositions(t);this._previousZoomValue=this._zoomVal},_calculatingPositions:function(t){for(var f,i=0;i<t.length;i++){var e=parseFloat(n(t[i]).css("left"))/this._previousZoomValue*this._zoomVal,o=parseFloat(n(t[i]).css("top"))/this._previousZoomValue*this._zoomVal,r=parseFloat(n(t[i]).css("width"))/this._previousZoomValue*this._zoomVal,u=parseFloat(n(t[i]).css("height"))/this._previousZoomValue*this._zoomVal;n(t[i]).css("top",o+"px");n(t[i]).css("left",e+"px");t[i].className!="e-pdfviewer-buttons"&&(n(t[i]).css("width",r+"px"),n(t[i]).css("height",u+"px"));f=this._outputPath[t[i].id];this._reDrawSignature(f,t[i],r,u)}},_reDrawSignature:function(t,i,r,u){var l=document.getElementById(this._id+"_imageTemp"),it=parseFloat(n(l).css("width")),rt=parseFloat(n(l).css("height")),s=this._valueChanges[i.id],d=s.differenceX/r,g=s.differenceY/u,a=this.element[0].parentElement.clientWidth,e,o,f,v,y,h,c;for(a>=500?(e=u/400,o=r/470):(e=u/100,o=r/a),(e<=0||o<=0)&&(e=1,o=1),f=i.getContext("2d"),v=f.strokeStyle,i.width=r,i.height=u,i.style.width=r+"px",i.style.height=u+"px",y=t.split("<br>").length,f.beginPath(),h=0;h<y;h++)if(c=t.split("<br>")[h].split(".").slice(1).join("."),c){var p=c.substring(0,6),nt=c.substring(6),tt=nt.replace(/[{()}]/g,""),w=tt.split(","),b=(parseFloat(w[0])-s.minimumX)/d,k=(parseFloat(w[1])-s.minimumY)/g;p=="moveTo"?f.moveTo(b,k):p=="lineTo"&&f.lineTo(b,k)}f.lineWidth=4;f.scale(o,e);f.strokeStyle=v;f.stroke()},_scalingTextContent:function(){return 2},_convertPointToPixel:function(n){return this._horizontalResolution?parseFloat(n)*(this._horizontalResolution/72):parseFloat(n)*(96/72)},_convertPixelToPoint:function(n){return this._horizontalResolution?parseFloat(n)*(72/this._horizontalResolution):parseFloat(n)*(72/96)},_getRandomNum:function(){return((1+Math.random())*65536|0).toString(16).substring(1)},_createGUID:function(){return"Syncfusion_PDFviewer_"+(this._getRandomNum()+this._getRandomNum()+"-"+this._getRandomNum()+"-4"+this._getRandomNum().substr(0,3)+"-"+this._getRandomNum()+this._getRandomNum()+this._getRandomNum()).toLowerCase()},_createSignatureID:function(){return"Signature_"+(this._getRandomNum()+this._getRandomNum()+"-"+this._getRandomNum()+"-4"+this._getRandomNum().substr(0,3)+"-"+this._getRandomNum()+this._getRandomNum()+this._getRandomNum()).toLowerCase()},_updateFontSize:function(n,t,i){for(var e,r,o,s,h=this._convertPointToPixel(i.Width*this._zoomVal)+"px",f=!0,u=0;u<t.children.length;u++)if(e=document.createElement("canvas"),r=e.getContext("2d"),r.fontFamily="sans-serif",r.fontSize=n,o=r.fontSize+"px",r.font=o+" "+r.fontFamily,s=r.measureText(t.children[u].innerHTML).width,parseFloat(h)<s){f=!1;break}return f},_createFormFields:function(t,r){var f,u,l,w,c,s,b,o,y,tt,k,it,rt,h,d;this._minTabindex=-1;this._maxTabindex=0;var e=t.pdfRenderedFields,p=t.cropBoxValue,g=navigator.userAgent,h=this;if(e!=null)for(f=0;f<e.length;f++)if(e[f].PageIndex+1==r){var a=e[f].LineBounds,v=this._getRotation(e[f].RotationAngle),nt=!1;if(e[f].RotationAngle!=0&&(nt=!0,a=this._getBoundsPosition(a,this._pageSize[r-1],e[f].RotationAngle,nt)),e[f].Name=="Textbox"){if(e[f].Visible==1)continue;e[f].Multiline?(u=document.createElement("textarea"),n(u).css("resize","none")):(u=document.createElement("input"),u.type="text");o=e[f].BackColor;l=e[f].FontColor;h._addAlignmentPropety(e[f],u);e[f].IsReadonly||this._isFormFieldsDisabled?(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")):n(u).css("background-color","rgba("+o.R+","+o.G+","+o.B+","+.2+")");n(u).css("color","rgb("+l.R+","+l.G+","+l.B+")");e[f].IsRequired?n(u).css("border","1px solid red"):n(u).css("border",e[f].BorderWidth);n(u).attr("name",e[f].FieldName);w=this._convertPointToPixel(e[f].Font.Height*this._zoomVal)+"px";e[f].MaxLength>0&&n(u).attr("maxlength",e[f].MaxLength);e[f].InsertSpaces&&n(u).css("letter-spacing",w);e[f].Text!=""?n(u).val(e[f].Text):n(u).val("");n(u).css({transform:"rotate("+v+"deg)"})}else if(e[f].Name=="Password")u=document.createElement("input"),u.type="password",o=e[f].BackColor,l=e[f].FontColor,e[f].IsReadonly||this._isFormFieldsDisabled?(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")):n(u).css("background-color","rgba("+o.R+","+o.G+","+o.B+","+.2+")"),n(u).css("color","rgb("+l.R+","+l.G+","+l.B+")"),e[f].IsRequired?n(u).css("border","1px solid red"):n(u).css("border",e[f].BorderWidth),(e[f].IsReadonly||this._isFormFieldsDisabled)&&n(u).attr("disabled",!0),h._addAlignmentPropety(e[f],u),n(u).attr("name",e[f].FieldName),w=this._convertPointToPixel(e[f].Font.Height*this._zoomVal)+"px",e[f].MaxLength>0&&n(u).attr("maxlength",e[f].MaxLength),e[f].InsertSpaces&&n(u).css("letter-spacing",w),e[f].Text!=""?n(u).val(e[f].Text):n(u).val(""),n(u).css({transform:"rotate("+v+"deg)"});else if(e[f].Name=="RadioButton")u=document.createElement("input"),u.type="radio",e[f].IsRequired?(n(u).css("border","1px solid red"),n(u).css("outline","1px solid red")):n(u).css("border",e[f].BorderWidth),e[f].Selected==!0&&n(u).prop("checked",!0),n(u).val(e[f].Value),n(u).attr("name",e[f].GroupName),n(u).css("cursor","pointer"),(e[f].IsReadonly||this._isFormFieldsDisabled)&&(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")),g.indexOf("Chrome")!=-1&&n(u).css("-webkit-apperance","none"),n(u).css({transform:"rotate("+v+"deg)"});else if(e[f].Name=="CheckBox")u=document.createElement("input"),u.type="checkbox",e[f].IsRequired&&(n(u).css("border","1px solid red"),n(u).css("outline","1px solid red")),e[f].Selected==!0?n(u).prop("checked",!0):g.indexOf("Chrome")!=-1&&n(u).css("-webkit-appearance","none"),n(u).attr("name",e[f].GroupName),o=e[f].BackColor,e[f].IsReadonly||this._isFormFieldsDisabled?(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")):(n(u).css("background-color","rgba("+o.R+","+o.G+","+o.B+","+.2+")"),n(u).css("cursor","pointer")),n(u).css({transform:"rotate("+v+"deg)"});else if(e[f].Name=="DropDown"){for(u=document.createElement("select"),e[f].IsRequired?n(u).css("border","1px solid red"):n(u).css("border",e[f].BorderWidth),n(u).css({transform:"rotate("+v+"deg)"}),n(u).attr("name",e[f].Text),e[f].SelectedValue==""&&(s=document.createElement("option"),s.id="dropdownhide",n(s).css("display","none"),s.selected="selected",s.innerHTML="",u.appendChild(s)),c=0;c<e[f].TextList.length;c++)s=document.createElement("option"),s.className="e-dropdownSelect",e[f].SelectedValue==e[f].TextList[c]||e[f].SelectedIndex==c?n(s).prop("selected",!0):n(s).prop("selected",!1),s.innerHTML=e[f].TextList[c],u.appendChild(s);o=e[f].BackColor;e[f].IsReadonly||this._isFormFieldsDisabled?(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")):n(u).css("background-color","rgba("+o.R+","+o.G+","+o.B+","+.2+")");n(u).css("color","black")}else if(e[f].Name=="ListBox"){for(u=document.createElement("select"),n(u).attr("multiple","multiple"),e[f].IsRequired?n(u).css("border","1px solid red"):n(u).css("border",e[f].BorderWidth),n(u).attr("name",e[f].Text),c=0;c<e[f].TextList.length;c++){for(s=document.createElement("option"),s.className="e-pdfviewer-ListBox",b=0;b<e[f].SelectedList.length;b++)e[f].SelectedList[b]==c&&n(s).prop("selected",!0);s.innerHTML=e[f].TextList[c];u.appendChild(s);o=e[f].BackColor;o=e[f].BackColor;e[f].IsReadonly||this._isFormFieldsDisabled?(n(u).attr("disabled",!0),n(u).css("background-color","none"),n(u).css("cursor","default")):n(u).css("background-color","rgba("+o.R+","+o.G+","+o.B+","+.2+")")}n(u).css("color","black");(e[f].IsReadonly||this._isFormFieldsDisabled)&&n(u).attr("disabled",!0);n(u).css({transform:"rotate("+v+"deg)"})}e[f].Font!=null&&((e[f].Font.Bold||e[f].Font.Italic||e[f].Font.Strikeout||e[f].Font.Underline)&&(e[f].Font.Italic&&(u.style.fontStyle="italic"),e[f].Font.Bold&&(u.style.fontWeight="Bold")),n(u).css("font-family",e[f].Font.Name),e[f].IsAutoSize?(y=this._convertPointToPixel(e[f].Font.Height*this._zoomVal),this._updateFontSize(y,u,a)?n(u).css("font-size",y):(tt=10*this._zoomVal+"px",n(u).css("font-size",tt))):(y=this._convertPointToPixel(e[f].Font.Height*this._zoomVal)+"px",n(u).css("font-size",y)));(n(u).css("background-color")=="rgba(255, 255, 255, 0.2)"||n(u).css("background-color")=="rgba(0, 0, 0, 0.2)")&&n(u).css("background-color","rgba(0, 20, 200, 0.2)");p||(p=0);this._maxTabindex=Math.max(this._maxTabindex,e[f].TabIndex);this._minTabindex==-1&&(this._minTabindex=e[f].TabIndex);this._minTabindex=Math.min(this._minTabindex,e[f].TabIndex);this._maintainTabindex[r.toString()]=this._maxTabindex;this._maintanMinTabindex[r.toString()]=this._minTabindex;u.tabIndex=e[f].TabIndex;n(u).css("box-sizing","border-box");n(u).attr("aria-label","form fields");n(u).css("margin","0px");u.style.borderStyle="solid";k=e[f].BorderColor;e[f].IsRequired?n(u).attr("required",!0):n(u).css("border-color","rgba("+k.R+","+k.G+","+k.B+",1)");u.id=this._id+"input_"+r+"_"+f;u.className="e-pdfviewer-formFields";u.style.zIndex=1e3;u.style.maxWidth="none";u.style.left=this._convertPointToPixel((a.X+p)*this._zoomVal)+"px";u.style.top=this._convertPointToPixel((a.Y+p)*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(a.Width*this._zoomVal)+"px";u.style.height=this._convertPointToPixel(a.Height*this._zoomVal)+"px";u.style.position="absolute";it=document.getElementById(this._id+"selectioncanvas_"+r);n("#"+this._id+"selectioncanvas_"+r).addClass("input_container");it.appendChild(u);h=this;d=navigator.userAgent.indexOf("Chrome")!=-1;n(u).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"&&d&&n(t.target).css("-webkit-appearance","");n(t.target).css("background-color",f);rt=t.target.style.borderWidth;n(t.target).css("border-width","0");h._isFormFields=!0;n(t.target).on("keyup",function(t){var r=n(t.target)[0],f=n(r).val(),s=h._pageContents[h._currentPage],c=JSON.parse(s),l=c.pdfRenderedFields,e=r.id.split("_"),a=e[e.length-1],o=n(t.target).attr("type"),v=n(t.target).attr("name"),u=n(".e-pdfviewer-formFields"),i;if(o=="text"||o=="password"||r.type=="textarea")for(i=0;i<u.length;i++)n(u[i]).attr("name")==v&&n(u[i]).val(f);f!=l[a].Text&&(h.isDocumentEdited=!0)})});n(u).on("blur",function(t){var u=n(t.target).attr("type"),o=n(t.target)[0].type,i,r,f,e;i=d?n(t.target).css("background-color"):t.target.style["background-color"];r=i.lastIndexOf(",");u=="checkbox"&&n(t.target).prop("checked")==!0?(f=i.slice(0,r+1)+0+")",n(t.target).css("background-color",f)):(u=="checkbox"&&n(t.target).css("-webkit-appearance","none"),e=i.slice(0,r+1)+.2+")",n(t.target).css("background-color",e));n(t.target).css("border-width",rt);h._isFormFields=!1});n(u).on("change",function(){h.isDocumentEdited=!0});n(u).unbind("click").on("click touchstart",function(t){var e=n(t.target).attr("type"),c=n(t.target)[0].type,o,f,u,r;if(e=="password"||e=="text"){r=n(t.target)[0];n(r).on("keypress",function(t){var u=n(r).attr("maxlength"),i;n(r).val().length+1==u&&(i=n(r).val()+String.fromCharCode(t.keyCode),n(r).val(i),n(r).blur());h.isDocumentEdited=!0});n(r).on("keyup",function(t){var e=n(r).val(),c=h._pageContents[h._currentPage],l=JSON.parse(c),a=l.pdfRenderedFields,o=r.id.split("_"),v=o[o.length-1],s=n(t.target).attr("type"),y=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields"),u;if(s=="text"||s=="password"||input[i].type=="textarea")for(u=0;u<f.length;u++)n(f[u]).attr("name")==y&&n(f[u]).val(e);e!=a[v].Text&&(h.isDocumentEdited=!0)});n(r).unbind("change").on("change",function(){var t=n(r).val();n(r).val(t)})}if(e=="radio"){for(o=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields:radio"),u=0;u<f.length;u++)n(f[u]).attr("name")==o&&n(f[u]).prop("checked",!1);n(t.target).prop("checked",!0)}else if(e=="checkbox"){var o=n(t.target).attr("name"),f=n(".e-pdfviewer-formFields:checkbox"),l=n(t.target).prop("checked"),s=!1;for(u=0;u<f.length;u++)n(f[u]).attr("name")==o&&(n(f[u]).prop("checked",!1),s=!0);s&&l&&n(t.target).prop("checked",!0);n(t.target).prop("checked")==!0?(n(t.target).prop("checked",!0),d&&n(t.target).css("-webkit-appearance",""),n(t.target).css("border-width","1px")):n(t.target).prop("checked",!1)}else if(c=="select-one"){h.isDocumentEdited=!0;r=n(t.target)[0];n(r).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)})}})}},_getRotation:function(n){var t=n;switch(t){case 1:return"90";case 2:return"180";case 3:return"270";case 0:return"0";default:return"0"}},_getBoundsPosition:function(n,t,i){var r,u=this._convertPixelToPoint(t.PageHeight),f=this._convertPixelToPoint(t.PageWidth);switch(i){case 0:r=n;break;case 1:r={X:f-n.Y-n.Height-(n.Width/2-n.Height/2),Y:n.X+(n.Width/2-n.Height/2),Width:n.Width,Height:n.Height};break;case 2:r={X:f-n.X-n.Width,Y:u-n.Y-n.Height,Width:n.Width,Height:n.Height};break;case 3:r={X:n.Y-(n.Width/2-n.Height/2),Y:u-n.X-n.Width+(n.Width/2-n.Height/2),Width:n.Width,Height:n.Height};break;case 90:r={X:f-n.Y-n.Height,Y:n.X,Width:n.Height,Height:n.Width};break;case 180:r={X:f-n.X-n.Width,Y:u-n.Y-n.Height,Width:n.Width,Height:n.Height};break;case 270:r={X:n.Y,Y:u-n.X-n.Width,Width:n.Height,Height:n.Width}}return r||(r=n),r},_addAlignmentPropety:function(t,i){var r=t.Alignment;switch(r){case 0:n(i).css("text-align","left");break;case 1:n(i).css("text-align","center");break;case 2:n(i).css("text-align","right");break;case 3:n(i).css("text-align","justify")}},_checkvalidation:function(){var r=!1,u={},i=n(".e-pdfviewer-formFields"),t,s,f,e,h,o,l,c;if(i!=null)for(t=0;t<i.length;t++)if(i[t].type=="text"||i[t].type=="password"||i[t].type=="textarea")n(i[t]).attr("required")&&i[t].value==""&&(u[i[t].name]=i[t].value,r=!0);else if(i[t].type=="radio"&&n(i[t]).attr("required")&&!n(i[t]).prop("checked")){for(u[i[t].name]=i[t].value,r=!0,s=n(".e-pdfviewer-formFields:radio"),f=0;f<s.length;f++)if(n(s[f]).attr("name")==i[t].name&&n(i[t]).attr("required")&&n(s[f]).prop("checked")){r=!1;break}}else if(i[t].type=="checkbox"&&n(i[t]).attr("required")&&!n(i[t]).prop("checked"))u[i[t].name]=n(i[t]).prop("checked"),r=!0;else if(i[t].type=="select-multiple"&&n(i[t]).attr("required")&&i[t].selectedIndex==-1){for(r=!0,e=[],h=n(i[t]).children(),o=0;o<h.length;o++)n(h[o]).prop("selected")==!0&&e.push(h[o].text);e=JSON.stringify(e);u[i[t].name]=e}return r&&(l={responseData:JSON.stringify(u),status:"Please fill required fields"},c=this._raiseClientEvent("validateRequiredFormField",l),c&&c.cancel&&(this._isDownloadedRestricited=!0)),r},_saveFormFieldsValue:function(){var s,o,r,p,h,a,v,nt,y,w,tt,b,g,t,l,e,i,c,f,k,u,d,it;if(!this._checkvalidation()||!(this._isDownloadedRestricited||this.model.enableRequiredFormFieldValidation)){if(s={},o={},n("#"+this._id+"_toolbar_download").parent().parents(".e-pdfviewer-toolbarul").css("visibility",""),r=n(".e-pdfviewer-formFields"),r!=null)for(t=0;t<r.length;t++)if(r[t].type=="text"||r[t].type=="password"||r[t].type=="textarea")s[r[t].name]=r[t].value;else if(r[t].type=="radio"&&n(r[t]).prop("checked")==!0)s[r[t].name]=r[t].value;else if(r[t].type=="checkbox"){for(p=n(".e-pdfviewer-formFields:checkbox"),h=[],a=0;a<p.length;a++)n(p[a]).attr("name")==r[t].name&&h.push(p[a]);if(h.length>1&&n(r[t]).prop("checked")==!0)for(v=0;v<h.length;v++)h[v].id==r[t].id&&(s[r[t].name]=v);else if(h.length>1){for(nt=!0,u=0;u<h.length;u++)if(n(h[u]).prop("checked")){nt=!1;break}nt&&(s[r[t].name]=-1)}else n(r[t]).prop("checked")==!0?s[r[t].name]=n(r[t]).prop("checked"):h.length==1&&(s[r[t].name]=n(r[t]).prop("checked"))}else if(r[t].type=="select-one"&&r[t].options.length>0&&r[t].selectedIndex!=-1)s[r[t].name]=r[t].options[r[t].selectedIndex].text;else if(r[t].type=="select-multiple"){for(y=[],w=n(r[t]).children(),e=0;e<w.length;e++)n(w[e]).prop("selected")==!0&&y.push(w[e].text);y=JSON.stringify(y);s[r[t].name]=y}for(tt=[],t=1;t<=this._totalPages;t++){if(l=[],b=this._textMarkupAnnotationList[t],b)for(e=0;e<b.length;e++)if(i=b[e],i)for(c=i.Opacity,i.TextMarkupAnnotationType=="Highlight"&&(c=c*.5),i.Author==null&&(i.Author=this.model.strikethroughSettings.author),f=new Date(i.ModifiedDate.toString()),k=f.getMonth()+1+"/"+f.getDate()+"/"+f.getFullYear()+" "+f.getHours()+":"+f.getMinutes()+":"+f.getSeconds(),u=0;u<i.Bounds.length;u++)d={index:i.index,colorA:i.Opacity*255,colorR:i.Color.R,colorG:i.Color.G,colorB:i.Color.B,opacity:c,type:i.TextMarkupAnnotationType,author:i.Author,subject:i.Subject,text:i.Note,xPosition:i.Bounds[u].X,yPosition:i.Bounds[u].Y,height:i.Bounds[u].Height,width:i.Bounds[u].Width,modifiedDate:k},l.push(d);tt[t-1]=l}for(g=[],t=1;t<=this._totalPages;t++){for(l=[],g[t-1]=l,e=0;e<this._newAnnotationList[t-1].length;e++)for(i=this._newAnnotationList[t-1][e],c=i.opacity,i.type=="Highlight"&&(c=c*.5),f=new Date(i.modifiedDate.toString()),k=f.getMonth()+1+"/"+f.getDate()+"/"+f.getFullYear()+" "+f.getHours()+":"+f.getMinutes()+":"+f.getSeconds(),u=0;u<i.bounds.length;u++)d={type:i.type,xPosition:i.bounds[u].xPosition,yPosition:i.bounds[u].yPosition,height:i.bounds[u].height,width:i.bounds[u].width,colorA:i.colorA,colorR:i.colorR,colorG:i.colorG,colorB:i.colorB,opacity:c,author:i.author,subject:i.subject,text:i.note,modifiedDate:k},l.push(d);g[t-1]=l}this._saveSignatureControl();o.savetextMarkupAnnotation=JSON.stringify(g);o.existingAnnotations=JSON.stringify(tt);o.savedFields=JSON.stringify(s);o.isEdited=this.isDocumentEdited;o.signatureFields=JSON.stringify(this._completeSign);o.id=this._fileId;this._completeSign.length>0&&(it=this._createSignatureID(),this._signatureLayer.push(it));o.signatureValues=JSON.stringify(this._signatureLayer);o.newFileID=it;this.fileName&&(o.newFileName=this.fileName,this._pdfFileName!=this.fileName&&(this._pdfFileName=this.fileName));this._saveAs("POST",this.model.serviceUrl,JSON.stringify(o))}},_saveSignatureControl:function(){var i;this._completeSign=[];var u=n(".e-pdfviewer-imagecanvasDraw"),a=0,v=0;for(i=0;i<u.length;i++){var a=0,v=0,t=u[i],f=[],e=t.getContext("2d"),o=t.id.split("imagecanvasDraw_")[1].split("_")[0],r=e.strokeStyle,s=parseInt(r.slice(1,3),16),h=parseInt(r.slice(3,5),16),c=parseInt(r.slice(5,7),16),l={id:t.id,xPosition:parseFloat(n(t).css("left"))/this._zoomVal,yPosition:parseFloat(n(t).css("top"))/this._zoomVal,height:parseInt(parseFloat(n(t).css("height"))/this._zoomVal),width:parseInt(parseFloat(n(t).css("width"))/this._zoomVal),path:this._outputPath[t.id],pageIndex:o,rotation:0,valueChange:this._valueChanges[t.id],zoomValue:this._zoomVal,colorA:parseFloat(n(t).css("opacity"))*255,colorR:s,colorG:h,colorB:c};f.push(l);this._completeSign.push(f)}},_saveAs:function(t,i,r){var u=this;this._ajaxDownloaded!=null&&(this._ajaxDownloaded.abort(),this._ajaxDownloaded=null);this._ajaxDownloaded=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){var i,t;if(u._cancelDownloads){u._downloadAborted();return}i={responseData:n,type:"Download"};u._raiseClientEvent("ajaxRequestSuccess",i);n&&u._save(n);t={};t.fileName=u._downloadfileName;t.status="is completed";u._raiseClientEvent("downloadEnd",t)},error:function(n,t,i){u._cancelDownloads&&i=="abort"&&u._downloadAborted();u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_downloadAborted:function(){var t=this,n={};n.fileName=t._downloadfileName;n.status="is aborted";t._raiseClientEvent("downloadEnd",n)},_generateFormFields:function(t,i){var f=t.pdfRenderedFields,l=t.cropBoxValue,u,h,y,r,a,p,w,s,o,e,c,b,v;if(f!=null)for(u=0;u<f.length;u++)if(h=f[u].LineBounds,y=!1,f[u].RotationAngle!=0&&(y=!0,h=this._getBoundsPosition(h,this._pageSize[i-1],f[u].RotationAngle,y)),r=document.getElementById(this._id+"input_"+i+"_"+u),r&&(r.style.display="block"),f[u].PageIndex+1==i){if(f[u].Name=="Password"||f[u].Name=="Textbox"){if(f[u].Visible==1)continue;e=f[u].BackColor;a=f[u].FontColor;this._addAlignmentPropety(f[u],r);f[u].IsRequired&&n(r).css("border","1px solid red");f[u].IsReadonly||this._isFormFieldsDisabled?(n(r).attr("disabled",!0),n(r).css("background-color","none"),n(r).css("cursor","default")):n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");n(r).css("color","rgb("+a.R+","+a.G+","+a.B+")");p=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",p);w=n(r).val();n(r).val(w)}else if(f[u].Name=="RadioButton")f[u].IsRequired?(n(r).css("border","1px solid red"),n(r).css("outline","1px solid red")):n(r).css("border",f[u].BorderWidth),(f[u].IsReadonly||this._isFormFieldsDisabled)&&n(r).css("disabled",!0),n(r).prop("checked")==!0&&n(r).prop("checked",!0),n(r).attr("name",f[u].GroupName),f[u].IsReadonly||this._isFormFieldsDisabled?(n(r).attr("disabled",!0),n(r).css("background-color","none"),n(r).css("cursor","default")):n(r).css("cursor","pointer");else if(f[u].Name=="CheckBox")e=f[u].BackColor,f[u].IsRequired&&(n(r).css("border","1px solid red"),n(r).css("outline","1px solid red")),(f[u].IsReadonly||this._isFormFieldsDisabled)&&n(r).css("disabled",!0),n(r).prop("checked")==!0&&n(r).prop("checked",!0),f[u].IsReadonly||this._isFormFieldsDisabled?(n(r).attr("disabled",!0),n(r).css("background-color","none"),n(r).css("cursor","default")):(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(f[u].IsRequired?n(r).css("border","1px solid red"):n(r).css("border",f[u].BorderWidth),n(r).css({transform:"rotate("+rotation+"deg)"}),(f[u].IsReadonly||this._isFormFieldsDisabled)&&n(r).css("disabled",!0),f[u].SelectedValue==""&&(o=n(r).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[u].TextList.length;s++)o=n(r).children()[0].id=="dropdownhide"?n(r).children()[s+1]:n(r).children()[s],n(o).prop("selected")==!0&&n(o).prop("selected",!0),o.innerHTML=f[u].TextList[s],e=f[u].BackColor,f[u].IsReadonly||this._isFormFieldsDisabled?(n(r).attr("disabled",!0),n(r).css("background-color","none"),n(r).css("cursor","default")):n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");n(r).css("color","black")}else if(f[u].Name=="ListBox"){for(n(r).attr("multiple","multiple"),f[u].IsRequired?n(r).css("border","1px solid red"):n(r).css("border",f[u].BorderWidth),(f[u].IsReadonly||this._isFormFieldsDisabled)&&n(r).css("disabled",!0),s=0;s<f[u].TextList.length;s++)o=n(r).children()[s],n(o).prop("selected")==!0?n(o).prop("selected",!0):n(o).prop("selected",!1),o.innerHTML=f[u].TextList[s],e=f[u].BackColor,f[u].IsReadonly||this._isFormFieldsDisabled?(n(r).attr("disabled",!0),n(r).css("background-color","none"),n(r).css("cursor","default")):n(r).css("background-color","rgba("+e.R+","+e.G+","+e.B+","+.2+")");n(r).css("color","black")}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),f[u].IsAutoSize?(c=this._convertPointToPixel(f[u].Font.Height*this._zoomVal),this._updateFontSize(c,r,h)?n(r).css("font-size",c):(b=10*this._zoomVal+"px",n(r).css("font-size",b))):(c=this._convertPointToPixel(f[u].Font.Height*this._zoomVal)+"px",n(r).css("font-size",c)));(n(r).css("background-color")=="rgba(255, 255, 255, 0.2)"||n(r).css("background-color")=="rgba(0, 0, 0, 0.2)")&&n(r).css("background-color","rgba(0, 20, 200, 0.2)");l||(l=0);n(r).css("box-sizing","border-box");n(r).attr("aria-label","form fields");n(r).css("margin","0px");r.style.borderStyle="solid";v=f[u].BorderColor;f[u].IsRequired?n(r).attr("required",!0):n(r).css("border-color","rgba("+v.R+","+v.G+","+v.B+",1)");r.style.zIndex=1e3;r.style.maxWidth="none";r.style.left=this._convertPointToPixel((h.X+l)*this._zoomVal)+"px";r.style.top=this._convertPointToPixel((h.Y+l)*this._zoomVal)+"px";r.style.width=this._convertPointToPixel(h.Width*this._zoomVal)+"px";r.style.height=this._convertPointToPixel(h.Height*this._zoomVal)+"px";r.style.position="absolute"}},_textSelection:function(t,i,r){for(var f,b,k,d,v,c,l,g,rt=navigator.userAgent.indexOf("Edge")!=-1,y,ut=document.documentMode||/Edge/.test(navigator.userAgent),ft=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,h=t.selection,p=[],a=[],w=new RegExp(String.fromCharCode(160),"g"),e=0;e<h.length;e++){var s=" ",o=h[e].LineBounds,u=document.createElement("DIV");u.id=this._id+"text_"+i+"_"+e;u.className="e-pdfviewer-textLayer";f=h[e].Line;f=f.replace(/</g,"&lt;");f=f.replace(/>/g,"&gt;");var nt=new RegExp("[\x00-]+"),tt=nt.test(f),it=this._isRtl(f);!tt&&it?(w=new RegExp(String.fromCharCode(160),"g"),f=f.replace(w," "),f=f.split("").reverse().join(""),a.push(f)):a.push(h[e].Line.toString());(this._previousBounds==parseInt(o.Y)||this._previousBounds==parseInt(o.Y+1)||this._previousBounds==parseInt(o.Y-1))&&(s=document.getElementById(this._id+"text_"+i+"_"+(e-1)),s.innerHTML!=" "&&(s.innerHTML=s.innerHTML.replace(/&nbsp;/g," "),s.innerHTML=s.innerHTML.replace(/(\r\n|\n|\r)/gm,""),this._textlayout.pop(s)));this._previousBounds=parseInt(o.Y);u.innerHTML=f+"\r\n";n(u).filter(function(){y=n(u).html().match(/&nbsp;/)});y!==null&&(this._isNonBreackingCharacter=!0);u.innerHTML=u.innerHTML.replace(/&nbsp;/g," ");u.innerHTML=u.innerHTML.replace(/&nbsp;/g," ");b=f.replace(/  +/g," ");b!=" "&&(u.style.whiteSpace="pre");u.style.background="transparent";u.style.position="absolute";u.style.left=this._convertPointToPixel(o.X*this._zoomVal)+"px";u.style.top=this._convertPointToPixel(o.Y*this._zoomVal)+"px";u.style.width=this._convertPointToPixel(o.Width*this._zoomVal)+"px";u.style.color="transparent";u.style.fontSize=this._convertPointToPixel(o.Height*this._zoomVal)+"px";u.style.fontFamily="sans-serif";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;k=r.measureText(h[e].Line).width;d=parseFloat(u.style.width)/k;u.style.transform="scaleX("+d+")";v=document.getElementById(this._id+"selectioncanvas_"+i);n("#"+this._id+"selectioncanvas_"+i).addClass("text_container");v.appendChild(u);c=v.getBoundingClientRect();l=u.getBoundingClientRect();(l.width+l.left>=c.width+c.left||l.width>c.width)&&(n(u).css("width","auto"),g=u.clientWidth,n(u).css("width",g+"px"));p.push(u);this._textlayout.push(u)}this._previousBounds=null;this._textDivs[i]=p;this._textContents[i]=a},_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,i,u,f,e,o,s,h,c,l,a){var y=this._zoomVal,p=new Image,v=this;p.onload=function(){for(var tt,g,ct,ht,e,ut,bt=!1,w=v._scalingTextContent(f),nt=0;nt<u.length;nt++)if(bt==!1)for(tt=u[nt],f.setTransform(tt[0]*y*w,tt[1]*y*w,tt[2]*y*w,tt[3]*y*w,tt[4]*y*w,tt[5]*y*w),t[a]!=r&&f.drawImage(t[a],0,0,1,1),g=s[nt],g=g+1,ct=o[nt];g<ct.length;){var p=ct[g],lt=p.color,k=p.matrix;k!=null&&(k=k.Elements);var at=p.brush,d=p.pathValue,ni=p.iscliping,kt=p.restorecanvas,dt=p.imagedata,it=p.fillrule,ti=p.isFillandStroke,ii=p.fillcolor,vt=p.strokecolor,yt=p.linewidth,pt=p.linecap,et=p.linearGradientBrush,ot=p.textureBrushs,st=p.charID,ui=p.rectvalue,gt=p.alpha,wt=p.dashPattern;if(wt!=null&&wt.length>0&&f.setLineDash(wt),d!=null?(d=d.split(";"),st&&(h[st]=d)):d==null&&st&&(d=h[st]),kt==!1&&f.save(),d!=r&&f.setTransform(k[0]*y*w,k[1]*y*w,k[2]*y*w,k[3]*y*w,k[4]*y*w,k[5]*y*w),d!=null){for(f.beginPath(),ht=0;ht<d.length;ht++)e=d[ht],ut=e[0],ut=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):ut=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):ut=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):ut=="Z"&&f.closePath();ni==!0?(it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(it)),f.clip()):ti==r?at=="Fill"?(et!=r?f.fillStyle=v._getGradientBrush(et,f):ot!=r?f.fillStyle=v._createTextureBrush(ot,f,p):(gt!=r&&(f.globalAlpha=gt),f.fillStyle=lt),it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(it)),f.fill()):at=="FillandStroke"?(f.fillStyle=lt,f.fill(),f.strokeStyle=vt,f.stroke()):at=="Stroke"?(f.strokeStyle=vt,f.lineWidth=yt,f.lineCap=pt,f.stroke()):(f.strokeStyle=lt,f.lineWidth=yt,f.lineCap=pt,f.stroke()):(f.strokeStyle=vt,f.lineWidth=yt,f.lineCap=pt,f.stroke(),f.fillStyle=et!=r?v._getGradientBrush(et,f):ot!=r?v._createTextureBrush(ot,f,p):ii,it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(it)),f.fill())}if(kt&&f.restore(),dt!=r){bt=!0;i.pop();u.pop();o.pop();s.pop();i.push(dt);u.push(k);o.push(n);s.push(g);nt=-1;a++;break}g++}else v._imageRendering(n,t,i,u,f,nt,o,s,h,c,l,a),a++;if(g==n.length&&v._pageSize[l-1].PageRotation!=0){var b=document.getElementById(v._id+"pagecanvas_"+l),ri=b.toDataURL(),rt=b.getContext("2d"),w=v._scalingTextContent(f),ft=new Image;ft.onload=function(){rt.clearRect(0,0,b.width,b.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(b.width=v._zoomVal*v._pageSize[l-1].PageHeight*w,b.height=v._zoomVal*v._pageSize[l-1].PageWidth*w,b.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(b.width=v._zoomVal*v._pageSize[l-1].PageWidth*w,b.height=v._zoomVal*v._pageSize[l-1].PageHeight*w,b.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");rt.save();rt.translate(b.width/2,b.height/2);rt.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);rt.drawImage(ft,-ft.width/2,-ft.height/2);rt.restore()};ft.src=ri}};p.src=i[e];t.push(p);this._imageObj.push(p)},_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=n.Rectangle,e=n.InterpolationColors,h=e.Colors,o=e.Positions,r,s,f=i.X<=0&&i.Y==0?t.createLinearGradient(i.X,i.Height,i.X,i.Y):t.createLinearGradient(i.X,i.Y,i.Width,i.Height),u=0;u<o.length;u++)r=h[u],r=r.split(","),s=this._rgb2Color(r[0],r[1],r[2]),f.addColorStop(o[u],s);return f},_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)},_ajaxResponseData:function(n){var t=this,i;return t._responseData=null,i={responseData:n,type:"Rendering"},t._raiseClientEvent("ajaxRequestSuccess",i),t._responseData!=null&&t._responseData!=""&&typeof t._responseData=="object"?n=JSON.stringify(t._responseData):t._responseData!=null&&t._responseData!=""&&(n=t._responseData),n},_doAjaxPost:function(t,i,r,u,f){var e=this,o=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 c,i,t,s,l,r,h,a,u;if(n=e._ajaxResponseData(n),e.model.allowClientBuffering){if(e._initPages(),jsondata=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),jsondata=jsondata.pdf,c=e._getObjectSize(jsondata),jsondata){for(i=1;i<=c;i++)t=jsondata[i],t&&(e._pageContents[parseInt(t.currentpage)]=JSON.stringify(t),e._pageText[parseInt(t.currentpage)]=t.pageContents);n=e._pageContents[parseInt(1)]}}else typeof n=="object"&&(n=JSON.stringify(n));s=JSON.parse(n);l=s.pagecount;l==0?(this.pageCount=0,e._unLoad()):(typeof n=="object"?e[o](JSON.stringify(n)):e[o](n),r=s.filename.split("\\"),h=r.length>0?r[r.length-1]:e._fileName!=""&&e._fileName!=null?e._fileName:null,a={fileName:h},e._downloadfileName=h,e.model&&(e._raiseClientEvent("documentLoad",a),e.model.allowClientBuffering&&(u=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),e._pagesGot.push(parseInt(u.currentpage)))));e.model.allowClientBuffering&&f&&(e._pagesGot.push(parseInt(u.currentpage)+1),2<=e._totalPages&&(e._targetPage=u.currentpage+2,e._isTargetPage=!0))},error:function(n){(o=="_clearCurrentServerCache"||n.readyState!=0)&&e._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_initPages:function(){this._pageLocation=[];this._renderedCanvasList=[];this._pageContents=[];this._renderPages=[];this._pageText=[];this._textDivs=[];this._textlayout=[];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._selectionPages=[]},_getObjectSize:function(n){var t=0;for(var i in n)n.hasOwnProperty(i)&&t++;return t},_raiseClientEvent:function(i,r){var f=this.model[i],e=[],u;return 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}:i=="ajaxRequestFailure"?u={message:r}:i=="ajaxRequestSuccess"?u={responseData:r.responseData,requestType:r.type}:i=="annotationAdd"?u={annotationSettings:r.annotationSettings,annotationID:r.annotationId,pageID:r.pageId,annotationBound:r.annotationBound,annotationType:r.annotationType}:i=="annotationRemove"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType}:i=="annotationPropertiesChange"?u={annotationID:r.annotationId,pageID:r.pageId,annotationType:r.annotationType,isColorChanged:r.isColorChanged,isOpacityChanged:r.isOpacityChanged}:i=="annotationResize"?u={annotationSettings:r.annotationSettings,annotationID:r.annotationID,pageID:r.pageID,annotationBound:r.annotationBound,annotationType:r.annotationType}:i=="signatureDelete"?u={pageNumber:r.pageNumber}:i=="signatureAdd"?u={signatureSettings:r.signatureSettings,pageNumber:r.pageNumber,signatureBound:r.signatureBound,signatureID:r.signatureID}:i=="signatureMove"?u={signatureSettings:r.signatureSettings,pageNumber:r.pageNumber,signatureBound:r.signatureBound,signatureID:r.signatureID}:i=="signatureResize"?u={signatureSettings:r.signatureSettings,pageNumber:r.pageNumber,signatureCurrentBound:r.signatureCurrentBound,signaturePreviousBound:r.signaturePreviousBound}:i=="signaturePropertiesChange"?u={pageID:r.pageId,isColorChange:r.isColorChange,isOpacityChange:r.isOpacityChange,perviousColor:r.perviousColor,currentColor:r.currentColor,previousOpacity:r.previousOpacity,currentOpacity:r.currentOpacity}:i=="downloadStart"?u={fileName:r.fileName,status:r.status}:i=="downloadEnd"?u={fileName:r.fileName,status:r.status}:i=="validateRequiredFormField"&&(u={responseData:r.responseData,status:r.status}),this._trigger(i,u),u):void 0},_getPageModel:function(i){var r,f,u;if(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")),r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),r&&this.model){for(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._horizontalResolution=r.horizontalResolution,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._isSelectionHidden||(this.model.enableTextSelection&&(this._isEnabled=!0),this.model.interactionMode==t.PdfViewer.InteractionMode.TextSelection&&this.model.enableTextSelection?this.model.enableTextSelection=!0:this.model.interactionMode==t.PdfViewer.InteractionMode.Pan&&(this.model.enableTextSelection=!1),f=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),this._isCopyRestrict?this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_select"):this._isCopyRestrict||this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_select"),this.model.enableTextSelection&&!f?this._highlightSelectItems():(!this.model.enableTextSelection||f)&&(this._isEnabled||this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_select"),this._highlightScrollItems())),this._gotoPage(this._currentPage),this._toolbarResizeHandler(),this._setSearchToolbarTop(),this._resizeSearchToolbar(),this._drawPdfPage(i),u=0;u<this._totalPages;u++)this._newAnnotationList[u]=[],this._colorModifiedAnnotationList[u]=[],this._deletedAnnotationList[u]=[],this._existingAnnotationsModified[u]=[],this._redoAnnotationCollection[u]=[],this._annotationsDeletedNo[u]=0,this._totalAnnotations[u+1]=[];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;this.model.enableTextSelection=!1;break;case"PageExtraction":this._isPageExtraction=!0;break;case"FillFields":this._isFormFieldsDisabled=!0;break;case"EditAnnotations":this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_highlight");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_strikeout");this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_underline")}},_print:function(){this._abortPrinting=!1;this._isPrintingProcess=!0;this._raiseClientEvent("beforePrint",null);this._abortPrinting||(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._ispdfium||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(),n.id=this._fileId,n.isPrinting=!0,n.signatureValues=JSON.stringify(this._signatureLayer),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,u=this,f=this._printIframe,r,i,k,it,rt,ut,at,v,et,c,l,y,p,ot,g,w,s,o,h;for(f.name="printFrame",f.style.position="absolute",f.style.top="-100000000px",document.body.appendChild(f),r=f.contentWindow?f.contentWindow:f.contentDocument.document?f.contentDocument.document:f.contentDocument,r.document.open(),e.indexOf("Edge")==-1?e.indexOf("Chrome")!=-1||e.indexOf("Safari")!=-1||e.indexOf("Firefox")!=-1?(r.document.write("<!DOCTYPE html>"),r.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>")):(r.document.write("<!DOCTYPE html>"),r.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; }@media print { body { margin: 0cm; }img { box-sizing: border-box; }br, button { display: none; }} @page{margin:0.5cm; size: 816px 1056px;}<\/style><\/head><body><center>")):(r.document.write("<!DOCTYPE html>"),r.document.write("<html><head><style>html, body { height: 99%; } img { height: 99%; width: 100%; }@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<=u._totalPages;i++){var b="",a="",ct=document.getElementById(this._id+"pagecanvas_"+i),nt=document.getElementById(this._id+"selectioncanvas_"+i),tt=document.getElementById(this._id+"_secondarycanvas_"+i),lt=document.getElementById(this._id+"pageDiv_"+i);for(b=ct.toDataURL(),k=tt.toDataURL(),window.innerWidth<screen.width&&!u._ispdfium?(a=u._zoomVal,u._topValue=!0,it=u._pageContents[parseInt(i)],rt=u._printPdfPages(it),b=rt.toDataURL(),k=tt.toDataURL()):a=1,r.document.write('<div style="margin:0px;width:816px;height:1056px;position:relative"><img src="'+b+'" id="image_'+i+'" /><img src="'+k+'" id = "secimage_'+i+'" style="margin:0px;top:0px;left:0px;position:absolute;width:816px;height:1056px;z-index:2" /><div id="fields_'+i+'"><\/div><div id="signaturefields_'+i+'"style="margin:0px;top:0px;left:0px;position:absolute;z-index:1000"><\/div><\/div><br/>'),ut=n(nt).find(".e-pdfviewer-formFields").length,at=2,v=0;v<ut;v++){var ft="",d=n(nt).find(".e-pdfviewer-formFields")[v],t=d.cloneNode(!0);if(d.type=="select-one"&&(ft=d.selectedIndex,et=t.children,n(et[ft]).prop("selected",!0)),c=u._pageSize[i-1].PageWidth*u._zoomVal,l=u._pageSize[i-1].PageHeight*u._zoomVal,c>l?(y=l/816,p=c/1056):(y=l/1056,p=c/816),ot=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,(ot||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"))/a+"px"),n(t).css("top",parseFloat(n(t).css("top"))/a+"px")),n(t).css("left",parseFloat(n(t).css("left"))/p+"px"),n(t).css("top",parseFloat(n(t).css("top"))/y+"px"),n(t).css("width",parseFloat(n(t).css("width"))/p+"px"),n(t).css("height",parseFloat(n(t).css("height"))/y+"px"),c>l){n(t).css({transform:"rotate(-90deg)"});var vt=parseFloat(n(t).css("left")),st=parseFloat(n(t).css("width"))/2,ht=parseFloat(n(t).css("height"))/2;n(t).css("left",ht-st+parseFloat(n(t).css("top"))+"px");n(t).css("top",st-ht+vt+"px")}n(t).css("margin","-1px");n(r.document.getElementById("fields_"+i)).append(t)}for(g=n(lt).find(".e-pdfviewer-imagecanvasDraw"),w=0;w<g.length;w++)s=n(g)[w],o=document.createElement("img"),o.src=s.toDataURL(),n(o).css("position","absolute"),n(o).css("left",n(s).css("left")),n(o).css("top",n(s).css("top")),n(o).css("width",n(s).css("width")),n(o).css("height",n(s).css("height")),n(r.document.getElementById("signaturefields_"+i)).append(o)}if(this._topValue=!1,r.document.write("<\/center><\/body><\/html>"),navigator.userAgent.match("Firefox")?window.frames.printFrame.close():r.document.close(),e.indexOf("Edge")==-1)if(e.indexOf("Chrome")!=-1||e.indexOf("Safari")!=-1||e.indexOf("Firefox")!=-1)u=this,setTimeout(function(){window.frames.printFrame.focus();window.frames.printFrame.print();document.body.removeChild(f)},500);else{h=n("iframe")[0];try{h.contentWindow.document.execCommand("print",!1,null)}catch(yt){h.contentWindow.print()}}else{h=n("iframe")[0];try{h.contentWindow.document.execCommand("print",!1,null)}catch(yt){h.contentWindow.print()}}this._restoreViewer()},_printCancel:function(){this._abortPrinting=!0;this._zoomValBackup=this._zoomVal;this._zoomLevelBackup=this._zoomLevel;this._currentPageBackup=this._currentPage;this._restoreViewer();this._raiseClientEvent("afterPrint",null)},_restoreViewer:function(){var n,t,i,r;for(this._isPrintingProcess=!1,this._isViewerRestored=!0,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 s=JSON.parse(u),h,e,u,c,o,f;if(this._pdfService==t.PdfViewer.PdfService.Local?this._currentPrintPage=s.pageindex:(h=s.jsonResult,this._currentPrintPage=h.pageindex),this.model.allowClientBuffering&&this._isBuffering&&this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null),this._pageContents[this._currentPrintPage]){if(e=this._pageContents[this._currentPrintPage],typeof e=="object"?this._printPdfPages(JSON.stringify(e)):this._printPdfPages(e),this._scrollTriggered=!1,this._abortPrinting)return;parseFloat(this._currentPrintPage)<this.pageCount?(u={},u.viewerAction=this._viewerAction.getPageModel,u.pageindex=(parseFloat(this._currentPrintPage)+1).toString(),u.id=this._fileId,u.isPrinting=!0,u.signatureValues=JSON.stringify(this._signatureLayer),c=this.model.serviceUrl+"/"+this.model.serverActionSettings.print,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostPrint("POST",c,JSON.stringify(u)):this._doAjaxPostPrint("POST",this.model.serviceUrl,JSON.stringify({jsonResult:u}))):(o=navigator.userAgent,o.indexOf("Chrome")!=-1||o.indexOf("Safari")!=-1||o.indexOf("Firefox")!=-1?(f=this,setTimeout(function(){f._printPages()},1e3)):this._ispdfium||this._printPages(),this._raiseClientEvent("afterPrint",null))}else 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;(n=f._ajaxResponseData(n),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(),i.id=f._fileId,i.isPrinting=!0,i.signatureValues=JSON.stringify(f._signatureLayer),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._ispdfium||f._printPages(),f._raiseClientEvent("afterPrint",null)))},error:function(n){n.readyState!=0&&f._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_printPdfPages:function(i){var kt=0,si=i,y,a,dt,e,c,u,h,tt,g,it,k,s,rt,bt,st,o,f;if(y=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),a=parseInt(y.currentpage),this._showPageLoadingIndicator(a,!0),dt=y.imagestream,e=parseInt(y.currentpage),this._renderedCanvasList.indexOf(e)==-1&&this._renderedCanvasList.push(parseInt(y.currentpage)),this._pageContents[a]||(this._textMarkupAnnotationList[parseInt(y.currentpage)]=y.textMarkupAnnotation),this._pageContents[parseInt(y.currentpage)]=si,(this._textMarkupAnnotationList[a]||this._newAnnotationList[a-1])&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[a],a),this._topValue==!0){var gt=parseInt(y.currentpage),c=document.createElement("canvas"),ni=this._pageSize[gt-1].PageHeight,ti=this._pageSize[gt-1].PageWidth;c.style.visibility="hidden";c.style.width=ti+"px";c.style.height=ni+"px";c.style.backgroundColor="white";c.className="e-pdfviewer-pageCanvas";c.height=ni;c.width=ti}else c=document.getElementById(this._id+"pagecanvas_"+parseInt(y.currentpage));u=c.getContext("2d");h=this._scalingTextContent(u);this._pageSize[e-1].PageRotation==90||this._pageSize[e-1].PageRotation==270?(c.height=this._zoomVal*this._pageSize[e-1].PageHeight*h,c.width=this._zoomVal*this._pageSize[e-1].PageWidth*h,c.style.width=this._zoomVal*this._pageSize[e-1].PageWidth+"px",c.style.height=this._zoomVal*this._pageSize[e-1].PageHeight+"px"):(c.width=this._pageSize[a-1].PageWidth*h,c.height=this._pageSize[a-1].PageHeight*h,c.style.height=this._pageSize[a-1].PageHeight+"px",c.style.width=this._pageSize[a-1].PageWidth+"px");var ut=[],ii=[],hi=[],ri=[],ui=[],p=navigator.userAgent,w,ht=[];for(this._regenerateFormFields(y,a),tt=n("#"+this._id+"selectioncanvas_"+a).children(),k=0;k<tt.length;k++)(tt[k].hasAttribute("href")||n(tt[k]).hasClass("e-pdfviewer-formFields"))&&n(tt[k]).remove();if(this._createFormFields(y,a),g=dt.textelements,g.imagedata!=null&&y.isPdfRenderingEngine){var h=1,ci=g.imagedata,ct=new Image,f=this;ct.onload=function(){if(f._renderImages(c,ct,c.width,c.height,h),f._pageSize[e-1].PageOrientation=="Landscape"&&f._renderLandspaceImages(!1,c,e,w),f.pageCount==e){var n=navigator.userAgent;n.indexOf("Chrome")==-1&&n.indexOf("Safari")==-1&&n.indexOf("Firefox")==-1&&f._printPages()}};ct.src=ci[0]}for(it=0;it<g.length;it++){var l=g[it],lt=l.color,v=l.matrix;v!=null&&(v=v.Elements);var at=l.brush,b=l.pathValue,li=l.iscliping,fi=l.restorecanvas,vt=l.imagedata,nt=l.fillrule,ai=l.isFillandStroke,vi=l.fillcolor,yt=l.strokecolor,pt=l.linewidth,wt=l.linecap,ft=l.linearGradientBrush,et=l.textureBrushs,ot=l.charID,ei=l.alpha;if(b!=null?(b=b.split(";"),ot&&(ht[ot]=b)):b==null&&ot&&(b=ht[ot]),fi==!1&&u.save(),b!=r&&u.setTransform(v[0]*h,v[1]*h,v[2]*h,v[3]*h,v[4]*h,v[5]*h),b!=null){for(u.beginPath(),k=0;k<b.length;k++)s=b[k],rt=s[0],rt=="M"?(s=s.substring(1,s.length),s=s.split(" "),u.moveTo(s[0],s[1])):rt=="L"?(s=s.substring(1,s.length),s=s.split(" "),u.lineTo(s[0],s[1])):rt=="C"?(s=s.substring(1,s.length),s=s.split(" "),u.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])):rt=="Z"&&u.closePath();li==!0?(nt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(nt)),u.clip()):ai==r?at=="Fill"?(ft!=r?u.fillStyle=this._getGradientBrush(ft,u):et!=r?u.fillStyle=this._createTextureBrush(et,u,l):(ei!=r&&(u.globalAlpha=ei),u.fillStyle=lt),nt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(nt)),u.fill()):at=="FillandStroke"?(u.fillStyle=lt,u.fill(),u.strokeStyle=yt,u.stroke()):at=="Stroke"?(u.strokeStyle=yt,u.lineWidth=pt,u.lineCap=wt,u.stroke()):(u.strokeStyle=lt,u.lineWidth=pt,u.lineCap=wt,u.stroke()):(u.strokeStyle=yt,u.lineWidth=pt,u.lineCap=wt,u.stroke(),u.fillStyle=ft!=r?this._getGradientBrush(ft,u):et!=r?this._createTextureBrush(et,u,l):vi,nt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(nt)),u.fill())}if(fi&&u.restore(),vt!=r)if((w=p.indexOf("Firefox"))==-1&&(w=p.indexOf("Chrome"))==-1&&(w=p.indexOf("Safari"))==-1&&(w=p.indexOf("AppleWebKit"))==-1||this._topValue)bt=new Image,bt.src=vt,u.setTransform(v[0]*h,v[1]*h,v[2]*h,v[3]*h,v[4]*h,v[5]*h),u.drawImage(bt,0,0,1,1);else{ut.push(vt);ii.push(v);ui.push(g);ri.push(it);this._isContainImage=!0;break}}if((w=p.indexOf("Firefox"))!=-1||(w=p.indexOf("Chrome"))!=-1||(w=p.indexOf("Safari"))!=-1||(w=p.indexOf("AppleWebKit"))!=-1)for(st=0;st<ut.length;st++)this._printWinImageRendering(g,hi,ut,ii,u,st,ui,ri,ht,c,e,kt),kt++;if(o=c,f=this,!(this._pageSize[e-1].PageRotation==0||this._pageSize[e-1].PageRotation==90)&&!(ut.length!=0&&(p.indexOf("Firefox")!=-1||p.indexOf("Chrome")!=-1))){o=document.getElementById(this._id+"pagecanvas_"+parseInt(y.currentpage));var oi=o.toDataURL(),u=o.getContext("2d"),h=f._scalingTextContent(u),d=new Image;p.indexOf("Firefox")!=-1?(d.onload=function(){u.clearRect(0,0,o.width,o.height);f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight*h,o.height=f._zoomVal*f._pageSize[e-1].PageWidth*h,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*h,o.height=f._zoomVal*f._pageSize[e-1].PageHeight*h,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(d,-d.width/2,-d.height/2);u.restore()},d.src=oi):(u.clearRect(0,0,o.width,o.height),f._pageSize[e-1].PageRotation==270?(o.width=f._zoomVal*f._pageSize[e-1].PageHeight*h,o.height=f._zoomVal*f._pageSize[e-1].PageWidth*h,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*h,o.height=f._zoomVal*f._pageSize[e-1].PageHeight*h,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),d.src=oi,u.drawImage(d,-d.width/2,-d.height/2),u.restore())}return this._renderLandspaceImages(y.isPdfRenderingEngine,c,e,w),this._showPageLoadingIndicator(a,!1),this._changingImageCanvasPosition(a),this._showSignature(),o},_renderLandspaceImages:function(n,t,i,r){var e=navigator.userAgent,o=this._scalingTextContent(),l;if(this._pageSize[i-1].PageWidth>this._pageSize[i-1].PageHeight&&!n){var u=new Image,s=new Image,a=t.toDataURL(),h=this._pageSize[i-1].PageHeight,c=this._pageSize[i-1].PageWidth,f=document.getElementById(this._id+"_secondarycanvas_"+i);(r=e.indexOf("Firefox"))!=-1||(r=e.indexOf("Chrome"))!=-1||(r=e.indexOf("Safari"))!=-1||(r=e.indexOf("AppleWebKit"))!=-1?(l=this,u.onload=function(){l._renderRotatedImages(t,u,h,c,o)},u.src=a,s.onload=function(){l._renderRotatedImages(f,s,h,c,o)},s.src=f.toDataURL()):(u.src=a,this._renderRotatedImages(t,u,h,c,o),f.src=f.toDataURL(),this._renderRotatedImages(f,s,h,c,o))}},_renderRotatedImages:function(n,t,i,r,u){var f=n.getContext("2d");n.width=i*u;n.height=r*u;n.style.height=r+"px";n.style.width=i+"px";f.save();f.translate(n.width/2,n.height/2);f.rotate(-Math.PI/2);f.drawImage(t,-t.width/2,-t.height/2);f.restore()},_printWinImageRendering:function(n,t,i,u,f,e,o,s,h,c,l,a){var v=this,y=new Image;y.onload=function(){for(var p,it,pt,ct,y,et,ti=!1,nt=u[e],tt=0;tt<u.length;tt++)if(p=v._scalingTextContent(f),ti==!1)for(nt=u[tt],f.setTransform(nt[0]*p,nt[1]*p,nt[2]*p,nt[3]*p,nt[4]*p,nt[5]*p),t[a]!=r&&f.drawImage(t[a],0,0,1,1),it=s[tt],it=it+1,pt=o[tt];it<pt.length;){var w=pt[it],wt=w.color,k=w.matrix;k!=null&&(k=k.Elements);var bt=w.brush,d=w.pathValue,fi=w.iscliping,ii=w.restorecanvas,ri=w.imagedata,rt=w.fillrule,ei=w.isFillandStroke,oi=w.fillcolor,kt=w.strokecolor,dt=w.linewidth,gt=w.linecap,ot=w.linearGradientBrush,st=w.textureBrushs,ht=w.charID,si=w.rectvalue,ui=w.alpha;if(d!=null?(d=d.split(";"),ht&&(h[ht]=d)):d==null&&ht&&(d=h[ht]),ii==!1&&f.save(),d!=r&&f.setTransform(k[0]*p,k[1]*p,k[2]*p,k[3]*p,k[4]*p,k[5]*p),d!=null){for(f.beginPath(),ct=0;ct<d.length;ct++)y=d[ct],et=y[0],et=="M"?(y=y.substring(1,y.length),y=y.split(" "),f.moveTo(y[0],y[1])):et=="L"?(y=y.substring(1,y.length),y=y.split(" "),f.lineTo(y[0],y[1])):et=="C"?(y=y.substring(1,y.length),y=y.split(" "),f.bezierCurveTo(y[0],y[1],y[2],y[3],y[4],y[5])):et=="Z"&&f.closePath();fi==!0?(rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(rt)),f.clip()):ei==r?bt=="Fill"?(ot!=r?f.fillStyle=v._getGradientBrush(ot,f):st!=r?f.fillStyle=v._createTextureBrush(st,f,w):(ui!=r&&(f.globalAlpha=ui),f.fillStyle=wt),rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(rt)),f.fill()):bt=="FillandStroke"?(f.fillStyle=wt,f.fill(),f.strokeStyle=kt,f.stroke()):bt=="Stroke"?(f.strokeStyle=kt,f.lineWidth=dt,f.lineCap=gt,f.stroke()):(f.strokeStyle=wt,f.lineWidth=dt,f.lineCap=gt,f.stroke()):(f.strokeStyle=kt,f.lineWidth=dt,f.lineCap=gt,f.stroke(),f.fillStyle=ot!=r?v._getGradientBrush(ot,f):st!=r?v._createTextureBrush(st,f,w):oi,rt=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(rt)),f.fill())}if(ii&&f.restore(),ri!=r){ti=!0;i.pop();u.pop();o.pop();s.pop();i.push(ri);u.push(k);o.push(n);s.push(it);tt=-1;a++;break}it++}else v._printWinImageRendering(n,t,i,u,f,tt,o,s,h,c,l,a),a++;if(t.length-1==e&&v._pageSize[l-1].PageRotation!=0){var b=document.getElementById(v._id+"pagecanvas_"+l),ni=b.toDataURL(),ut=b.getContext("2d"),p=v._scalingTextContent(f),g=new Image;g.onload=function(){ut.clearRect(0,0,b.width,b.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(b.width=v._zoomVal*v._pageSize[l-1].PageHeight*p,b.height=v._zoomVal*v._pageSize[l-1].PageWidth*p,b.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(b.width=v._zoomVal*v._pageSize[l-1].PageWidth*p,b.height=v._zoomVal*v._pageSize[l-1].PageHeight*p,b.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");ut.save();ut.translate(b.width/2,b.height/2);ut.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);ut.drawImage(g,-g.width/2,-g.height/2);ut.restore()};g.src=ni}if(v._pageSize[l-1].PageWidth>v._pageSize[l-1].PageHeight){var g=new Image,ft=new Image,ni=c.toDataURL(),lt=v._pageSize[l-1].PageHeight,at=v._pageSize[l-1].PageWidth,vt=document.getElementById(v._id+"_secondarycanvas_"+l),yt=navigator.userAgent;(offsett=yt.indexOf("Firefox"))!=-1||(offsett=yt.indexOf("Chrome"))!=-1||(offsett=yt.indexOf("Safari"))!=-1||(offsett=yt.indexOf("AppleWebKit"))!=-1?(g.onload=function(){v._renderRotatedImages(c,g,lt,at,p)},g.src=ni,ft.onload=function(){v._renderRotatedImages(vt,ft,lt,at,p)},ft.src=vt.toDataURL()):(g.src=ni,v._renderRotatedImages(c,g,lt,at,p),ft.onload=function(){v._renderRotatedImages(vt,ft,lt,at,p)},ft.src=vt.toDataURL())}};y.src=i[e];t.push(y);this._imageObj.push(y)},_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){var i,r,u;this._setPageSize(this._pageHeight,this._pageWidth,null,null);i=parseInt(t);this._updatePageNavigation(i,this._totalPages);r=parseFloat(n("#"+this._id+"_toolbarContainer").css("height"));this._totalPages>0&&this._totalPages&&(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),u=parseFloat(n("#"+this._id+"_toolbarContainer").css("height")),r!=u&&(this._isToolbarHeightChanged=!0),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){t.preventDefault();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+"_fitPage").parents("ul.e-pdfviewer-toolbarul").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"),n("#"+this._id+"_fitPage").parents("ul.e-pdfviewer-toolbarul").css("display","none"))},_resetPage:function(){var t=n("#"+this._id+"_pageviewContainer"),i=n("#"+this._id+"_pageviewOuterline");t[0]!=r&&(i.css({width:t.width(),height:t.height()}),i.css({width:t[0].getBoundingClientRect().width,height:t[0].getBoundingClientRect().height}))},_applyFitToWidth:function(){this._isAutoZoom=!1;this._isAutoSelected=!1;var n=this._fitToPage("fitToWidth");this._applyDropDownVal(n,!0,!1);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_applyFitToPage:function(){this._isAutoZoom=!1;this._isAutoSelected=!1;var n=this._fitToPage("fitToPage");this._applyDropDownVal(n,!1,!0);this._updatePageFitModel(this._fitType);this.model.isResponsive=!1},_updatePageFitModel:function(t){t=="fitToWidth"?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),n("#"+this._id+"_pageviewContainer").find(".e-waitingpopup").css("visibility",""),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage")):t=="fitToPage"&&(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"))},_applyFitToWidthAuto:function(){var n=this._fitToAuto("fitToWidth");this._applyDropDownValAuto(n,!0,!1)},_fitToAuto:function(){this._resetPage();var i=n("#"+this._id+"_viewerContainer"),o=n("#"+this._id+"_pageviewContainer"),s=n("#"+this._id+"_pageviewOuterline");if(i[0]!=r){var f=i.width(),h=i.height(),e=this._pageWidth,c=this._pageHeight,t=1,u=1;return t=(f-25)/e,this._isAutoZoom&&(window.innerHeight!=screen.height&&(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 o,u,s,i,y;if(this._pageSize!=r){this._resetPage();var l=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewContainer"),w=n("#"+this._id+"_pageviewOuterline"),h=l.width(),a=l.height();if(t=="fitToWidth")for(u=0;u<this._pageSize.length;u++)o=0,o=this._pageSize[u].PageRotation==90||this._pageSize[u].PageRotation==270?this._pageSize[u].PageHeight:this._pageSize[u].PageWidth,o>this._highestWidth&&(this._highestWidth=o);else this._highestWidth=this._pageWidth;if(t=="fitToPage")for(u=0;u<this._pageSize.length;u++)s=0,s=this._pageSize[u].PageRotation==90||this._pageSize[u].PageRotation==270?this._pageSize[u].PageWidth:this._pageSize[u].PageHeight,s>this._highestHeight&&(this._highestHeight=s);else this._highestHeight=this._PageHeight;var c=this._highestWidth,v=this._highestHeight,f=1,e=1;if(this._fitType=t,t=="fitToPage"){f=(h-25)/c;e=a/v;a>v&&(e=this._preZoomVal);h>c&&(f=this._preZoomVal);f=this._fitType=="fitToPage"&&this._pageSize[this._currentPage-1].PageOrientation=="Landscape"&&f<e?f:e;this._zoomVal=f;this._zoomInContainer();this._calculateZoomLevel(this._zoomVal);n("#"+this._id+"pageDiv_"+(this._currentPage+1)).css("visibility","hidden");i=this;y=document.getElementById(this._id+"_viewerContainer");n("#"+this._id+"_viewerContainer").on("mousewheel DOMMouseScroll",function(t){var r=document.getElementById(i._id+"_viewerContainer"),u=n("#"+i._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(t.originalEvent.wheelDelta>0||t.originalEvent.detail<0?i._currentPage>1&&(n("#"+i._id+"pageDiv_"+(i._currentPage-1)).css("visibility",""),r.scrollTop=parseFloat(i._pageLocation[i._currentPage-1]*i._zoomVal),n("#"+i._id+"pageDiv_"+i._currentPage).css("visibility","hidden")):i._currentPage!=i._totalPages&&(n("#"+i._id+"pageDiv_"+(i._currentPage+1)).css("visibility",""),r.scrollTop=parseFloat(i._pageLocation[i._currentPage+1]*i._zoomVal),i._currentPage+1==i._totalPages?n("#"+i._id+"pageDiv_"+i._currentPage).css("visibility","hidden"):n("#"+i._id+"pageDiv_"+(i._currentPage+2)).css("visibility","hidden")),t.preventDefault())});n(window).on("keydown",function(t){var r=document.getElementById(i._id+"_viewerContainer"),u=n("#"+i._id+"_pdfviewer_toolbar_fitPage").attr("aria-disabled");u=="true"&&(i._currentPage>1&&t.keyCode=="38"?(n("#"+i._id+"pageDiv_"+(i._currentPage-1)).css("visibility",""),r.scrollTop=parseFloat(i._pageLocation[i._currentPage-1]*i._zoomVal),n("#"+i._id+"pageDiv_"+i._currentPage).css("visibility","hidden")):i._currentPage!=i._totalPages&&t.keyCode=="40"&&(n("#"+i._id+"pageDiv_"+(i._currentPage+1)).css("visibility",""),r.scrollTop=parseFloat(i._pageLocation[i._currentPage+1]*i._zoomVal),i._currentPage+1==i._totalPages?n("#"+i._id+"pageDiv_"+i._currentPage).css("visibility","hidden"):n("#"+i._id+"pageDiv_"+(i._currentPage+2)).css("visibility","hidden")))});y.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal);n("#"+i._id+"pageDiv_"+(i._currentPage-1)).css("visibility","hidden");n("#"+i._id+"pageDiv_"+(i._currentPage+1)).css("visibility","hidden")}else t=="fitToWidth"&&(f=(h-25)/c,e=f,this._zoomVal=f,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal));return this._updateZoomButtons(),{scalX:f,scalY:e}}},_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,i,u){if(t!=r)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 i?(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(i){if(this._isAutoZoom){var u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],r=u.contextMenu.auto.contentText;n("#"+this._id+"_toolbar_zoomSelection_hidden").val(r);this._ejDropDownInstance.model.value=r}else n("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(i.scalY*100)+"%"),this._ejDropDownInstance.model.value=Math.round(i.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(i){var f,s,o,e;if(!this._ejViewerInstance)var h=this._id.split("_toolbar")[0],c=n("#"+h),u=c.ejPdfViewer("instance");s=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"];o=s.contextMenu.auto.contentText;i.value!=r?(i.value==o||i.model.selectedItemIndex==0?(u.model.isResponsive=!0,f=1,u._zoomLevel=3,u._isAutoZoom=!0,u._isAutoSelected=!0):(f=parseInt(i.value)/100,u.model.isResponsive=!1,u._zoomLevel=i.itemId,u._isAutoZoom=!1,u._isAutoSelected=!1),u._zoomContainer(f,!1)):i.target.innerHTML!=r&&(e=i.target.innerHTML,i.target.innerHTML==o?(u.model.isResponsive=!0,f=1,u._isAutoZoom=!0):(e=e.substring(0,e.length-1),f=parseInt(e)/100,u.model.isResponsive=!1,u._isAutoZoom=!1),u._zoomContainer(f,!1))},_zoomIn:function(){if(this._isMobileDevice&&this._zoomLevel>=6?this._zoomLevel=6: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 c,v,nt,l,f,e,p,o,s,a,h,tt,w,u,b;this._hidingSignature();var it=i,k=n("#"+this._id+"_viewerContainer"),d=n("#"+this._id+"_pageviewContainer");this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+it);var rt=d.width(),et=d.height(),y={currentZoomPercentage:0,previousZoomPercentage:0},g=document.getElementById(this._id+"_viewerContainer"),ut=g.scrollTop,ft=ut/this._previousZoom*this._zoomVal,ot="scale("+this._zoomVal+","+this._zoomVal+")";for(u=1;u<=this._totalPages;u++)this._ispdfium&&this._zoomVal>1&&(this._pageContents[u]=null),v=0,this._pageSize[u-1].PageRotation==90||this._pageSize[u-1].PageRotation==270?(c=(this.element.width()-this._pageSize[u-1].PageHeight*this._zoomVal)/2,v=this._pageSize[u-1].PageHeight):(c=(this.element.width()-this._pageSize[u-1].PageWidth*this._zoomVal)/2,v=this._pageSize[u-1].PageWidth),nt=c+this._pageSize[u-1].PageWidth*this._zoomVal,(c<0||this._fitType=="fitToWidth"&&v==this._highestWidth||this._fitType=="fitToPage"&&this._pageSize[u-1].PageOrientation=="Landscape"&&nt>rt)&&(c=5),l=!1,f=document.getElementById(this._id+"pagecanvas_"+u),f!=r&&(this._renderPages&&this._renderPages.indexOf(u)!=-1&&(l=!0),e=document.getElementById(this._id+"_secondarycanvas_"+u),p=f.getContext("2d"),this._pageSize[u-1].PageRotation==90||this._pageSize[u-1].PageRotation==270?(l||(f.height=this._pageSize[u-1].PageWidth*this._zoomVal,f.width=this._pageSize[u-1].PageHeight*this._zoomVal),f.style.height=this._pageSize[u-1].PageWidth*this._zoomVal+"px",f.style.width=this._pageSize[u-1].PageHeight*this._zoomVal+"px",o=this._pageSize[u-1].PageWidth*this._zoomVal,s=this._pageSize[u-1].PageHeight*this._zoomVal,f.style.width=s+"px",f.style.height=o+"px",e.width=s,e.height=o,e.style.width=s+"px",e.style.height=o+"px"):(l||(f.height=this._pageSize[u-1].PageHeight*this._zoomVal,f.width=this._pageSize[u-1].PageWidth*this._zoomVal),f.style.height=this._pageSize[u-1].PageHeight*this._zoomVal+"px",f.style.width=this._pageSize[u-1].PageWidth*this._zoomVal+"px",o=this._pageSize[u-1].PageHeight*this._zoomVal,s=this._pageSize[u-1].PageWidth*this._zoomVal,f.style.width=s+"px",f.style.height=o+"px",e.width=s,e.height=o,e.style.width=s+"px",e.style.height=o+"px"),l||p.clearRect(0,0,f.clientWidth,f.clientHeight),a=n("#"+this._id+"pageDiv_"+u),a[0].style.top=this._pageLocation[u]*this._zoomVal+"px",a[0].style.left=c+"px",a[0].style.width=s+"px",a[0].style.height=o+"px",h=document.getElementById(this._id+"selectioncanvas_"+u),h.style.height=f.height+"px",h.style.width=f.width+"px",h.style.position="absolute",h.style.left=0,h.style.top=0,h.style.backgroundColor="transparent",h.style.zIndex="2",n("#"+this._id+"selectioncanvas_"+u).hasClass("text_container")&&this._pageContents[parseInt(u)]!=null&&this._resizeSelection(JSON.parse(this._pageContents[parseInt(u)]),u,p),this._isAutoZoom||l||(n("#"+this._id+"pageDiv_"+u+"_WaitingPopup").css({display:"block",height:f.height+"px",width:f.width+"px",left:"0px",top:"0px"}),tt=document.getElementById(this._id+"pageDiv_"+u+"_WaitingPopup"),w=tt.childNodes[0],w.style.top=(f.height-w.clientHeight)/2+"px"));if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?k.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):k.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(u=0;u<this._imageObj.length;u++)this._imageObj[u].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;g.scrollTop=ft;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._preZoomVal=this._zoomVal;this._previousZoom=this._zoomVal;y.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);y.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",y);this.zoomPercentage=Math.round(this._zoomVal*100);this._highestWidth=0;this._highestHeight=0;b=[];this._selectedAnnotationObject&&(b.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,b))},_zoomOutContainer:function(t,i){var l,u,h,v,f,e,o,c,s,d,y,r,p;this._hidingSignature();var g=i,w=n("#"+this._id+"_viewerContainer"),b=n("#"+this._id+"_pageviewContainer");this._selectionNodes=window.getSelection();n(".e-pdfviewer-formFields").hide();this._selectionNodes.anchorOffset==0&&this._selectionNodes.focusOffset==0||this._maintainSelection();t&&(this._zoomVal=this._zoomVal+g);var it=b.width(),rt=b.height(),a={currentZoomPercentage:0,previousZoomPercentage:0},k=document.getElementById(this._id+"_viewerContainer"),nt=k.scrollTop,tt=nt/this._previousZoom*this._zoomVal,ut="scale("+this._zoomVal+","+this._zoomVal+")";for(r=1;r<=this._totalPages;r++)this._ispdfium&&this._zoomVal>1&&(this._pageContents[r]=null),l=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,l<0&&(l=5),u=document.getElementById(this._id+"pagecanvas_"+r),h=!1,this._renderPages&&this._renderPages.indexOf(r)!=-1&&(h=!0),v=u.getContext("2d"),f=document.getElementById(this._id+"_secondarycanvas_"+r),this._pageSize[r-1].PageRotation==90||this._pageSize[r-1].PageRotation==270?(h||(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",f.width=o,f.height=e,f.style.width=o+"px",f.style.height=e+"px"):(h||(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",f.width=o,f.height=e,f.style.width=o+"px",f.style.height=e+"px"),h||v.clearRect(0,0,u.clientWidth,u.clientHeight),c=n("#"+this._id+"pageDiv_"+r),c[0].style.top=this._pageLocation[r]*this._zoomVal+"px",c[0].style.left=l+"px",c[0].style.width=o+"px",c[0].style.height=e+"px",s=document.getElementById(this._id+"selectioncanvas_"+r),s.style.height=u.height+"px",s.style.width=u.width+"px",s.style.position="absolute",s.style.left=0,s.style.top=0,s.style.backgroundColor="transparent",s.style.zIndex="2",n("#"+this._id+"selectioncanvas_"+r).hasClass("text_container")&&this._pageContents[parseInt(r)]!=null&&this._resizeSelection(JSON.parse(this._pageContents[parseInt(r)]),r,v),h||(n("#"+this._id+"pageDiv_"+r+"_WaitingPopup").css({display:"block",height:u.height+"px",width:u.width+"px",left:"0px",top:"0px"}),d=document.getElementById(this._id+"pageDiv_"+r+"_WaitingPopup"),y=d.childNodes[0],y.style.top=(u.height-y.clientHeight)/2+"px");if(this._renderedCanvasList&&(this._renderedCanvasList.length=0),this._zoomVal<1?w.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):w.css({"-ms-scroll-limit-y-max":""}),this._imageObj)for(r=0;r<this._imageObj.length;r++)this._imageObj[r].onload=null;n("#"+this._id+"_popupmenu").hide();this._isPopupNoteVisible=!1;k.scrollTop=tt;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;a.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);a.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",a);this.zoomPercentage=Math.round(this._zoomVal*100);p=[];this._selectedAnnotationObject&&(p.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,p))},_zoomContainer:function(t,i){if(this._fitType=null,this._zoomVal=t,n("#"+this._id+"_pageviewContainer").find(".e-waitingpopup").css("visibility",""),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isAutoZoom&&this._renderedCanvasList&&(this._isWindowResizing||this._isAutoSelected)&&!this._isViewerRestored)this._applyFitToWidthAuto(),t=this._zoomVal;else{var r=Math.abs(this._preZoomVal-t);if(r==0)return!1;this._preZoomVal>t?this._zoomOutContainer(i,r):this._zoomInContainer(i,r)}this._preZoomVal=t;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;this._zoomLevel=this._lowerZoomIndex},_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,i,n;if(this._zoomArray==r)for(t=document.getElementById(this._id+"_toolbar_zoomSelection_popup").getElementsByTagName("li"),i=[],this._zoomArray=i,n=0;n<t.length;n++)i.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._zoomVal==2&&this._isMobileDevice?(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 a,s,f,w,e,o,b,h,u,v,k,y,c,d,g,ot,ct,it,vt=this._zoomVal,rt=n("#"+this._id+"_viewerContainer"),ut=n("#"+this._id+"_pageviewContainer"),yt=ut.width(),pt=ut.height(),p={currentZoomPercentage:0,previousZoomPercentage:0},l=document.getElementById(this._id+"_viewerContainer"),ft=l.scrollTop,et=ft/this._previousZoom*this._zoomVal,wt="scale("+this._zoomVal+","+this._zoomVal+")",i=1;i<=this._totalPages;i++){if(this._ispdfium&&(this._pageContents[parseInt(i)]=null),a=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||a<0)&&(a=5),s=document.getElementById(this._id+"pagecanvas_"+i),f=document.getElementById(this._id+"_secondarycanvas_"+i),s!=r)if(w=s.getContext("2d"),this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(e=this._pageSize[i-1].PageWidth*this._zoomVal,o=this._pageSize[i-1].PageHeight*this._zoomVal):(e=this._pageSize[i-1].PageHeight*this._zoomVal,o=this._pageSize[i-1].PageWidth*this._zoomVal),b=!1,this._renderPages&&this._renderPages.indexOf(i)!=-1&&(b=!0),s.style.height=e+"px",s.style.width=o+"px",this._renderedCanvasList.indexOf(i)!=-1?(f.style.width=o+"px",f.style.height=e+"px",f.height=this._pageSize[i-1].PageHeight*this._zoomVal,f.width=this._pageSize[i-1].PageWidth*this._zoomVal,this._clearRectOnClick(i)):(f.style.width=o+"px",f.style.height=e+"px",f.height=this._pageSize[i-1].PageHeight*this._zoomVal,f.width=this._pageSize[i-1].PageWidth*this._zoomVal),h=n("#"+this._id+"pageDiv_"+i),h[0].style.top=this._pageLocation[i]*this._zoomVal+"px",h[0].style.left=a+"px",h[0].style.width=o+"px",h[0].style.height=e+"px",u=document.getElementById(this._id+"selectioncanvas_"+i),this._isPinchZoomed)u.style.display="none";else if(u.style.display="block",u.style.height=e+"px",u.style.width=o+"px",u.style.position="absolute",u.style.left=0,u.style.top=0,u.style.backgroundColor="transparent",u.style.zIndex="2",v=this._pageContents[parseInt(i)],!this._isTouchEnded,v||this._renderedCanvasList.indexOf(i)!=-1){for(k=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(v):JSON.parse(v.d),y=n("#"+this._id+"selectioncanvas_"+i).children(),c=0;c<y.length;c++)n(y[c]).hasClass("e-pdfviewer-textLayer")&&(n(y[c]).remove(),n("#"+this._id+"selectioncanvas_"+i).removeClass("text_container"));n("#"+this._id+"selectioncanvas_"+i).hasClass("text_container")||this._pageContents[parseInt(i)]==null?this._pageContents[parseInt(i)]!=null&&this._resizeSelection(k,i,w):this._textSelection(k,i,w)}n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").css({display:"none",height:e+"px",width:o+"px",left:"0px",top:"0px"});b||(d=document.getElementById(this._id+"pageDiv_"+i+"_WaitingPopup"),d&&(g=d.childNodes[0],g.style.top=(s.height-g.clientHeight)/2+"px"))}if(this._ispdfium&&(this._ispageCleared=!0),this._zoomVal<1?rt.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):rt.css({"-ms-scroll-limit-y-max":""}),n("#"+this._id+"_popupmenu").hide(),this._isPopupNoteVisible=!1,ot=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,this._isPinchZoomed&&!ot){var lt=ft,st=document.getElementById(this._id+"pagecanvas_"+this._currentPage).getBoundingClientRect(),nt=(st.top-this._currentPage*5)*this._preZoomVal+this._currentPage*5,ht=this._zoomY,tt=lt+ht,at=(st.top-this._currentPage*5)*this._zoomVal+this._currentPage*5+(tt-nt<0?tt-nt:(tt-nt)*(this._zoomVal/this._preZoomVal));et=at-ht;ct=(l.scrollLeft+this._prevZoomX)*(this._zoomVal/this._preZoomVal)-this._zoomX;l.scrollLeft=ct;this._prevZoomX=this._zoomX}l.scrollTop=et;this._eventpreviouszoomvalue=this._preZoomVal;this._eventzoomvalue=this._zoomVal;this._previousZoom=this._zoomVal;this._preZoomVal=this._zoomVal;p.previousZoomPercentage=Math.round(this._eventpreviouszoomvalue*100);p.currentZoomPercentage=Math.round(this._eventzoomvalue*100);this._raiseClientEvent("zoomChange",p);this.zoomPercentage=Math.round(this._zoomVal*100);it=[];this._selectedAnnotationObject&&(it.push(this._selectedAnnotationObject.annotation),this._drawAnnotSelectRect(this._selectedAnnotationObject.pageIndex,it))},_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 f,t=1;t<=this._totalPages;t++){var o=document.getElementById(this._id+"pageDiv_"+t),e=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.display="none";i.style.width=u+"px";i.style.height=r+"px";i.style.backgroundColor="white";i.height=r;i.width=u;i.id=e.id;i.className="e-pdfviewer-pageCanvas";e.id=this._id+"oldcanvas_"+t;o.appendChild(i);n(i).css({"user-select":"none"});f=document.getElementById(this._id+"_secondarycanvas_"+t);f.style.width=u+"px";f.style.height=r+"px";f.width=u;f.height=r}this._isRerenderCanvasCreated=!0},_replaceOldCanvas:function(){for(var t,n=1;n<=this._totalPages;n++){var f=document.getElementById(this._id+"pageDiv_"+n),i=document.getElementById(this._id+"pagecanvas_"+n),u=document.getElementById(this._id+"oldcanvas_"+n);i!=r&&i!=null&&(i.style.display="block");u!=r&&u!=null&&f.removeChild(u)}this._isRerenderCanvasCreated=!1;t=this;clearInterval(t._bgRenderTimer);this._pageContents&&(t._scrollTimer=setInterval(function(){t._pageviewscrollchanged(t._pageHeight)},500))},_rerenderCanvas:function(t){var i,u,f,o,e;if(this._renderedCanvasList.indexOf(parseInt(t))==-1&&t<=this._totalPages&&this._rerenderCanvasList.indexOf(parseInt(t))!=-1?(i=this._pageContents[parseInt(t)],i!=r&&i!=null&&(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],i!=r&&i!=null&&(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],i!=r&&i!=null&&(this._rerenderPdfPage(i),this._renderCount=this._renderCount+1)),this._renderCount==this._rerenderCanvasList.length||this._ispageCleared&&this._ispdfium){for(this._replaceOldCanvas(),u=1;u<=this._totalPages;u++)this._renderedCanvasList.indexOf(u)==-1&&this._renderPages.indexOf(u)==-1&&n("#"+this._id+"pageDiv_"+u+"_WaitingPopup").css({display:"block"}),f=document.getElementById(this._id+"pageDiv_"+u+"_WaitingPopup"),f&&(o=document.getElementById(this._id+"pagecanvas_"+u),e=f.childNodes[0],e.style.top=(o.height-e.clientHeight)/2+"px");this._renderCount=0;this._rerenderCanvasList.length=0}},_rerenderPdfPage:function(i){var ai=i,y,ui,it,p,s,rt,at,vt,h,l,u,e,ut,b,f,ft,ri,ct,a,o;if(i!=r&&i!=null){for(i=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),this._renderedCanvasList.push(parseInt(i.currentpage)),y=parseInt(i.currentpage),ui=i.imagestream,this._pageContents[parseInt(i.currentpage)]=ai,this._regenerateFormFields(i,y),it=n("#"+this._id+"selectioncanvas_"+y).children(),b=0;b<it.length;b++)(it[b].hasAttribute("href")||n(it[b]).hasClass("e-pdfviewer-formFields"))&&n(it[b]).remove();this._createFormFields(i,y);var k=i.linkannotation,fi=i.annotpagenum,lt=this;if(this.model.enableHyperlink)for(p=0;p<k.length;p++){if(s=document.createElement("a"),s.id="linkdiv_"+p,rt=k[p].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",k[p].URI.indexOf("mailto:")!=-1?(at=k[p].URI.substring(k[p].URI.indexOf("mailto:"),k[p].URI.length),s.title=at,s.setAttribute("href",at)):(s.title=k[p].URI,s.setAttribute("href",k[p].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(s.target="_self",s.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(s.target="_blank",s.onclick=function(){var n={hyperlink:this.href};lt._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(s.onclick=function(){var n={hyperlink:this.href};return lt._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),fi[p]!=r){var vi=this._pageSize[y-1].PageHeight,yi=this._convertPointToPixel(k[p].AnnotLocation),pi=vi-yi,wi=parseFloat(this._pageLocation[fi[p]]*this._zoomVal)+parseFloat(pi*this._zoomVal);s.name=wi;s.onclick=function(){var n=document.getElementById("container_viewerContainer");return n.scrollTop=this.name,!1}}vt=document.getElementById(this._id+"selectioncanvas_"+y);vt&&vt.appendChild(s)}if(this._textMarkupAnnotationList[y]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[y],y),h=parseInt(i.currentpage),l=document.getElementById(this._id+"pagecanvas_"+parseInt(i.currentpage)),l!=r&&l!=null){u=l.getContext("2d");e=this._scalingTextContent(u);this._pageSize[h-1].PageRotation==90||this._pageSize[h-1].PageRotation==270?(l.height=this._zoomVal*this._pageSize[h-1].PageHeight*e,l.width=this._zoomVal*this._pageSize[h-1].PageWidth*e,l.style.width=this._zoomVal*this._pageSize[h-1].PageWidth+"px",l.style.height=this._zoomVal*this._pageSize[h-1].PageHeight+"px"):(l.width=this._zoomVal*this._pageSize[y-1].PageWidth*e,l.height=this._zoomVal*this._pageSize[y-1].PageHeight*e,l.style.height=this._zoomVal*this._pageSize[y-1].PageHeight+"px",l.style.width=this._zoomVal*this._pageSize[y-1].PageWidth+"px");var u=l.getContext("2d"),yt=[],ei=[],bi=[],oi=[],si=[],ki,d=navigator.userAgent,g,hi=0,pt=[],nt=ui.textelements;if(nt.imagedata!=null&&i.isPdfRenderingEngine){var e=1,di=nt.imagedata,wt=new Image,o=this;wt.onload=function(){o._renderImages(l,wt,l.width,l.height,e)};wt.src=di[0]}for(ut=0;ut<nt.length;ut++){var c=nt[ut],bt=c.color,v=c.matrix;v!=null&&(v=v.Elements);var kt=c.brush,w=c.pathValue,gi=c.iscliping,ci=c.restorecanvas,dt=c.imagedata,tt=c.fillrule,nr=c.isFillandStroke,tr=c.fillcolor,gt=c.strokecolor,ni=c.linewidth,ti=c.linecap,ot=c.linearGradientBrush,st=c.textureBrushs,ht=c.charID,li=c.alpha,ii=c.dashPattern;if(ii!=null&&ii.length>0&&u.setLineDash(ii),w!=null?(w=w.split(";"),ht&&(pt[ht]=w)):w==null&&ht&&(w=pt[ht]),ci==!1&&u.save(),w!=r&&u.setTransform(v[0]*this._zoomVal*e,v[1]*this._zoomVal*e,v[2]*this._zoomVal*e,v[3]*this._zoomVal*e,v[4]*this._zoomVal*e,v[5]*this._zoomVal*e),w!=null){for(u.beginPath(),b=0;b<w.length;b++)f=w[b],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();gi==!0?(tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(tt)),u.clip()):nr==r?kt=="Fill"?(ot!=r?u.fillStyle=this._getGradientBrush(ot,u):st!=r?u.fillStyle=this._createTextureBrush(st,u,c):(li!=r&&(u.globalAlpha=li),u.fillStyle=bt),tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill()):kt=="FillandStroke"?(u.fillStyle=bt,u.fill(),u.strokeStyle=gt,u.stroke()):kt=="Stroke"?(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=bt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke(),u.fillStyle=ot!=r?this._getGradientBrush(ot,u):st!=r?this._createTextureBrush(st,u,c):tr,tt=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(tt)),u.fill())}if(ci&&u.restore(),dt!=r)if((g=d.indexOf("Firefox"))!=-1||(g=d.indexOf("Chrome"))!=-1||(g=d.indexOf("Safari"))!=-1||(g=d.indexOf("AppleWebKit"))!=-1){yt.push(dt);ei.push(v);si.push(nt);oi.push(ut);ki=this._zoomVal;this._isContainImage=!0;break}else ri=new Image,ri.src=dt,u.setTransform(v[0]*this._zoomVal*e,v[1]*this._zoomVal*e,v[2]*this._zoomVal*e,v[3]*this._zoomVal*e,v[4]*this._zoomVal*e,v[5]*this._zoomVal*e),u.drawImage(ri,0,0,1,1)}if((g=d.indexOf("Firefox"))!=-1||(g=d.indexOf("Chrome"))!=-1||(g=d.indexOf("Safari"))!=-1||(g=d.indexOf("AppleWebKit"))!=-1)for(ct=0;ct<yt.length;ct++)this._imageRenderingPinch(nt,bi,yt,ei,u,ct,si,oi,pt,l,h,hi),hi++;if(a=l,o=this,this._pageSize[h-1].PageRotation!=0&&!this._isContainImage){a=document.getElementById(this._id+"pagecanvas_"+parseInt(i.currentpage));var ir=a.toDataURL(),u=a.getContext("2d"),e=o._scalingTextContent(u),et=new Image;et.onload=function(){u.clearRect(0,0,a.width,a.height);o._pageSize[h-1].PageRotation==90||o._pageSize[h-1].PageRotation==270?(a.width=o._zoomVal*o._pageSize[h-1].PageHeight*e,a.height=o._zoomVal*o._pageSize[h-1].PageWidth*e,a.style.height=o._zoomVal*o._pageSize[h-1].PageWidth+"px",a.style.width=o._zoomVal*o._pageSize[h-1].PageHeight+"px"):(a.width=o._zoomVal*o._pageSize[h-1].PageWidth*e,a.height=o._zoomVal*o._pageSize[h-1].PageHeight*e,a.style.height=o._zoomVal*o._pageSize[h-1].PageHeight+"px",a.style.width=o._zoomVal*o._pageSize[h-1].PageWidth+"px");u.save();u.translate(a.width/2,a.height/2);u.rotate(o._pageSize[h-1].PageRotation/2*Math.PI/2);u.drawImage(et,-et.width/2,-et.height/2);u.restore()};et.src=ir}return this._changingImageCanvasPosition(y),this._showSignature(),this._showPageLoadingIndicator(y,!1),a}}},_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),f&&(f.style.display="block"),u[r].Name=="Textbox"){if(u[r].Visible==1)continue;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,i,u,f,e,o,s,h,c,l,a){var v=this,y=v._zoomVal,p=new Image;p.onload=function(){for(var tt,g,ct,ht,e,ut,bt=!1,w=v._scalingTextContent(f),nt=0;nt<u.length;nt++)if(bt==!1)for(tt=u[nt],f.setTransform(tt[0]*y*w,tt[1]*y*w,tt[2]*y*w,tt[3]*y*w,tt[4]*y*w,tt[5]*y*w),t[a]!=r&&f.drawImage(t[a],0,0,1,1),g=s[nt],g=g+1,ct=o[nt];g<ct.length;){var p=ct[g],lt=p.color,k=p.matrix;k!=null&&(k=k.Elements);var at=p.brush,d=p.pathValue,ni=p.iscliping,kt=p.restorecanvas,dt=p.imagedata,it=p.fillrule,ti=p.isFillandStroke,ii=p.fillcolor,vt=p.strokecolor,yt=p.linewidth,pt=p.linecap,et=p.linearGradientBrush,ot=p.textureBrushs,st=p.charID,gt=p.alpha,wt=p.dashPattern;if(wt!=null&&wt.length>0&&f.setLineDash(wt),d!=null?(d=d.split(";"),st&&(h[st]=d)):d==null&&st&&(d=h[st]),kt==!1&&f.save(),d!=r&&f.setTransform(k[0]*y*w,k[1]*y*w,k[2]*y*w,k[3]*y*w,k[4]*y*w,k[5]*y*w),d!=null){for(f.beginPath(),ht=0;ht<d.length;ht++)e=d[ht],ut=e[0],ut=="M"?(e=e.substring(1,e.length),e=e.split(" "),f.moveTo(e[0],e[1])):ut=="L"?(e=e.substring(1,e.length),e=e.split(" "),f.lineTo(e[0],e[1])):ut=="C"?(e=e.substring(1,e.length),e=e.split(" "),f.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):ut=="Z"&&f.closePath();ni==!0?(it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.clip(it)),f.clip()):ti==r?at=="Fill"?(et!=r?f.fillStyle=v._getGradientBrush(et,f):ot!=r?f.fillStyle=v._createTextureBrush(ot,f,p):(gt!=r&&(f.globalAlpha=gt),f.fillStyle=lt),it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(it)),f.fill()):at=="FillandStroke"?(f.fillStyle=lt,f.fill(),f.strokeStyle=vt,f.stroke()):at=="Stroke"?(f.strokeStyle=vt,f.lineWidth=yt,f.lineCap=pt,f.stroke()):(f.strokeStyle=lt,f.lineWidth=yt,f.lineCap=pt,f.stroke()):(f.strokeStyle=vt,f.lineWidth=yt,f.lineCap=pt,f.stroke(),f.fillStyle=et!=r?v._getGradientBrush(et,f):ot!=r?v._createTextureBrush(ot,f,p):ii,it=="evenodd"&&(f.msFillRule="evenodd",f.mozFillRule="evenodd",f.fill(it)),f.fill())}if(kt&&f.restore(),dt!=r){bt=!0;i.pop();u.pop();o.pop();s.pop();i.push(dt);u.push(k);o.push(n);s.push(g);nt=-1;a++;break}g++}else v._imageRenderingPinch(n,t,i,u,f,nt,o,s,h,c,l,a),a++;if(g==n.length&&v._pageSize[l-1].PageRotation!=0){var b=document.getElementById(v._id+"pagecanvas_"+l),ri=b.toDataURL(),rt=b.getContext("2d"),w=v._scalingTextContent(f),ft=new Image;ft.onload=function(){rt.clearRect(0,0,b.width,b.height);v._pageSize[l-1].PageRotation==90||v._pageSize[l-1].PageRotation==270?(b.width=v._zoomVal*v._pageSize[l-1].PageHeight*w,b.height=v._zoomVal*v._pageSize[l-1].PageWidth*w,b.style.height=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.width=v._zoomVal*v._pageSize[l-1].PageHeight+"px"):(b.width=v._zoomVal*v._pageSize[l-1].PageWidth*w,b.height=v._zoomVal*v._pageSize[l-1].PageHeight*w,b.style.width=v._zoomVal*v._pageSize[l-1].PageWidth+"px",b.style.height=v._zoomVal*v._pageSize[l-1].PageHeight+"px");rt.save();rt.translate(b.width/2,b.height/2);rt.rotate(v._pageSize[l-1].PageRotation/2*Math.PI/2);rt.drawImage(ft,-ft.width/2,-ft.height/2);rt.restore()};ft.src=ri}};p.src=i[e];t.push(p)},_touchStart:function(t){var r=t.touches,u,i;r.length>1&&t.preventDefault();u=n(t.target).parents(".e-pdfviewer.e-js");i=u.ejPdfViewer("instance");i._touched=!1;i._zoomY=r[0].clientY;i._zoomX=r[0].clientX},_touchMove:function(t){var r=t.touches,f,i,u;r.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(),u=Math.sqrt(Math.pow(r[0].clientX-r[1].clientX,2)+Math.pow(r[0].clientY-r[1].clientY,2)),i._zoomY=(r[0].clientY+r[1].clientY)/2,i._zoomX=(r[0].clientX+r[1].clientX)/2,i._isPinchZoomed=!0,i._prevDiff>-1?u>i._prevDiff?i._pinchOut(t):u<i._prevDiff&&i._pinchIn(t):i._zoomVal<2?i._prevDiff!=-1&&u>i._prevDiff&&i._pinchIn(t):i._prevDiff==-1&&i._zoomVal>2&&u>i._prevDiff&&i._pinchIn(t),i._prevDiff=u))},_touchEnd:function(t){var s=n(t.target).parents(".e-pdfviewer.e-js"),i=s.ejPdfViewer("instance"),r,o,f,e,u;i._isPinchZoomed&&(i._isPinchZoomed=!1,i._isTouchEnded=!0,i._fitToAutoSize(),i._calculateZoomLevel(i._zoomVal));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.target.className!="e-pdfviewer-formFields"&&(n.preventDefault(),this._pointers.push(n.originalEvent),this._pointerCount==2&&(this._pointerCount=0)),this._zoomY=n.originalEvent.clientY,this._zoomX=n.originalEvent.clientX)},_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._zoomY=(this._pointers[0].clientY+this._pointers[1].clientY)/2,this._zoomX=(this._pointers[0].clientX+this._pointers[1].clientX)/2,this._isPinchZoomed=!0,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._isPinchZoomed&&(this._isPinchZoomed=!1,this._isTouchEnded=!0,this._fitToAutoSize(),this._calculateZoomLevel(this._zoomVal)),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._isAutoSelected=!1;this._isAutoZoom=!1;this._zoomVal=this._zoomVal+.05;this._zoomVal>2&&(this._zoomVal=this._zoomVal+.05);var t=4;this._isMobileDevice&&(t=2);this._zoomVal>t&&(this._zoomVal=t,this._isPinchLimitReached=!0);this._zoomVal<=t?(this._isPinchLimitReached||(this._changingImageCanvasPosition(this._currentPage),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(),n("#"+this._id+"_pageviewContainer").find(".e-waitingpopup").css("visibility",""),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._isRenderedByPinch=!0),this._isPinchLimitReached=!1):this._zoomVal=t;this._isMobileDevice&&this._zoomVal==t&&(this._updateZoomButtons(),n("#"+this._id+"_toolbar_zoomSelection_hidden").val(t*100+"%"))},_pinchIn:function(){this._isAutoSelected=!1;this._isAutoZoom=!1;this._zoomVal=this._zoomVal-.04;this._zoomVal<4&&this._zoomVal>2&&(this._zoomVal=this._zoomVal-.04);this._zoomVal<.5&&(this._zoomVal=.5,this._isPinchLimitReached=!0);this._zoomVal>=.5?(this._isPinchLimitReached||(this._changingImageCanvasPosition(this._currentPage),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(),n("#"+this._id+"_pageviewContainer").find(".e-waitingpopup").css("visibility",""),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(){var t;if(this._removeSearch=!1,this._clearAllOccurrences(),this._selectedIndex=0,this._isTextSearch=!0,this._searchedPages=[],this._searchCollection=[],t=this._isToolbarHidden||n("#"+this._id+"_pdfviewer_searchbox").css("display")!="block"?this._searchText:n("#"+this._id+"_pdfviewer_searchinput").val(),this._searchText=t,this._searchText&&this._searchText!=""?this._enableSearchIcons():this._disableSearchIcons(),t==""||t==" "||!t)return n("#"+this._id+"_pdfviewer_searchinput").removeClass("e-pdfviewer-progressloader"),!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&&(t.preventDefault(),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 i=this._searchText.length,t=this._searchText;t==""&&t==" "&&t||this._getPossibleMatches(n,t,i)},_getPossibleMatches:function(t,i,r){if(!this._pageText[parseInt(t)]&&t==this._searchPageIndex){this._isRequestFired=!0;var u={};u.viewerAction=this._viewerAction.getPageModel;u.pageindex=t.toString();u.id=this._fileId;n("#"+this._id+"_pdfviewer_searchinput").addClass("e-pdfviewer-progressloader");this._ajaxInProgress||this._doAjaxPostSearch(JSON.stringify(u),t)}this._searchPageText(t,i,r)},_searchPageText:function(t,i,r){var u=this._pageText[t],e,o;if(u){this._isMatchCase||(u=u.toLowerCase(),i=i.toLowerCase());var s=[],f=-r,h=/[^\u0000-\u00ff]/.test(u),c=new RegExp("[\x00-]+"),l=c.test(u),a=this._isRtl(u);for(!l&&a&&(e=new RegExp(String.fromCharCode(160),"g"),u=u.replace(e," "),i=i.split("").reverse().join(""),i=i.replace(/\s/g," ")),this._isNonBreackingCharacter&&h&&(e=new RegExp(String.fromCharCode(160),"g"),u=u.replace(e," "));;){if(i==""||i==" "||!i)break;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):(i!=""&&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],i=l.begin,e=l.end;if(o==this._selectedIndex&&n==this._searchPageIndex?(f="e-pdfviewer-texthighlight",c=i.divId):f="e-pdfviewer-text-highlightother",t&&i.divId===t.divId?this._addSpanForSearch(t.divId,t.offsetValue,i.offsetValue,n,u,null):(t!==null&&this._addSpanForSearch(t.divId,t.offsetValue,r,n,u,null),this._beginText(i,u,n,null)),i.divId==e.divId)this._addSpanForSearch(i.divId,i.offsetValue,e.offsetValue,n,u,f);else{for(this._addSpanForSearch(i.divId,i.offsetValue,r,n,u,f),s=i.divId+1,a=e.divId;s<a;s++)this._addSpanForSearch(s,0,r,n,u,f+" middle");this._beginText(e,u,n,f)}t=e}t&&this._addSpanForSearch(t.divId,t.offsetValue,r,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 c,h=new RegExp(String.fromCharCode(160),"g"),l=this._textContents[u],a=l[t].length,y=new RegExp("[\x00-]+"),v=this._isRtl(l[t]),o,s;if(v){if(c=l[t].substring(a-i,a-r),o=document.createTextNode(c),e){this._isTextHighlighted=!0;s=document.createElement("span");s.className=e+" e-pdfviewer-textLayer";n(s).hasClass("middle")&&(f[t].textContent="");o.textContent=o.textContent.replace(h," ");n(s).prepend(o);n(f[t]).prepend(s);f[t].innerHTML.replace(/&nbsp;/g," ");return}o.textContent=o.textContent.replace(h," ");n(f[t]).prepend(o);f[t].innerHTML=f[t].innerHTML.replace(h," ")}else{if(c=l[t].substring(i,r),o=document.createTextNode(c),e){this._isTextHighlighted=!0;s=document.createElement("span");s.className=e+" e-pdfviewer-textLayer";n(s).hasClass("middle")&&(f[t].textContent="");o.textContent=o.textContent.replace(h," ");s.appendChild(o);s.innerHTML=s.innerHTML.replace(h," ");f[t].appendChild(s);f[t].innerHTML=f[t].innerHTML.replace(h," ");return}o.textContent=o.textContent.replace(h," ");f[t].appendChild(o);f[t].innerHTML=f[t].innerHTML.replace(h," ")}},_isRtl:function(n){var t=new RegExp("^[^A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF]*[\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC]");return t.test(n)},_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 n=1;n<=this._totalPages;n++)this._renderedCanvasList.indexOf(n)!=-1&&n!=this._searchPageIndex&&this._initSearch(n);this._isPageScrollHighlight=!1},_clearAllOccurrences:function(){var s,u,i,f,t,o,e;if(this._searchedText="",this._isTextSearch)for(s=document.getElementById(this._id+"custom-menu"),n(s).hide(),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(i=this._textDivs[u],f=this._textContents[u],!i||i==r)break;for(t=0;t<i.length;t++)if(o=!1,i[t].textContent=f[t],!this._isFindboxPresent||this._removeSearch){for(i[t].textContent="",e=0;e<this._textlayout.length;e++)if(this._textlayout[e].id==i[t].id){o=!0;break}i[t].textContent=o?f[t]+"\r\n":f[t]}}},_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,success:function(n){var i;n=u._ajaxResponseData(n);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(n){u._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_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&&(n.style.top="0px")},_searchBoxLocalization:function(){var r=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[0],u=n("#"+this._id+"_pdfviewer_searchbox").find(".e-pdfviewer-label")[1],i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=i.contextMenu.Find.contentText,e=i.contextMenu.matchCase.contentText;n(r).text(f);n(u).text(e)},_displaySearchBox:function(){this._isToolbarHidden||(n("#"+this._id+"_pdfviewer_searchbox").css("display")=="none"?(this._searchBoxLocalization(),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)},_renderTextMarkupAnnotation:function(n,t){var s=document.getElementById(this._id+"_secondarycanvas_"+t),i,h,u,e,o,f;if(s!=r&&s!=null){if(i=s.getContext("2d"),i.setLineDash([]),s.height=this._pageSize[t-1].PageHeight*this._zoomVal,s.width=this._pageSize[t-1].PageWidth*this._zoomVal,n)for(h=0;h<n.length;h++)if(u=n[h],u.TextMarkupAnnotationType=="StrikeOut"){for(e=u.Color,u.isLocked=this.model.strikethroughSettings.isLocked,o=0;o<u.Bounds.length;o++)f=u.Bounds[o],i.globalAlpha=u.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(f.X)*this._zoomVal,this._convertPointToPixel(f.Y+f.Height/2)*this._zoomVal),i.lineTo(this._convertPointToPixel(f.Width+f.X)*this._zoomVal,this._convertPointToPixel(f.Y+f.Height/2)*this._zoomVal),i.strokeStyle="rgb("+e.R+","+e.G+","+e.B+")",i.closePath(),i.msFillRule="nonzero",i.stroke();i.lineWidth=u.BorderWidth;i.save()}else if(u.TextMarkupAnnotationType=="Highlight"){for(u.isLocked=this.model.highlightSettings.isLocked,o=0;o<u.Bounds.length;o++)f=u.Bounds[o],i.beginPath(),i.rect(this._convertPointToPixel(f.X)*this._zoomVal,this._convertPointToPixel(f.Y)*this._zoomVal,this._convertPointToPixel(f.Width)*this._zoomVal,this._convertPointToPixel(f.Height)*this._zoomVal),i.lineWidth=u.BorderWidth,e=u.Color,i.globalAlpha=u.Opacity*.5,i.closePath(),i.fillStyle="rgb("+e.R+","+e.G+","+e.B+")",i.msFillRule="nonzero",i.fill();i.save()}else if(u.TextMarkupAnnotationType=="Underline"){for(u.isLocked=this.model.underlineSettings.isLocked,e=u.Color,o=0;o<u.Bounds.length;o++)f=u.Bounds[o],i.globalAlpha=u.Opacity,i.beginPath(),i.moveTo(this._convertPointToPixel(f.X)*this._zoomVal,this._convertPointToPixel(f.Y+f.Height)*this._zoomVal),i.lineTo(this._convertPointToPixel(f.Width+f.X)*this._zoomVal,this._convertPointToPixel(f.Y+f.Height)*this._zoomVal),i.lineWidth=u.BorderWidth,i.closePath(),i.strokeStyle="rgb("+e.R+","+e.G+","+e.B+")",i.msFillRule="nonzero",i.stroke();i.save()}this._newAnnotationList[t-1]&&this._newAnnotationList[t-1].length!=0&&this._renderNewAnnotations(this._newAnnotationList[t-1],i)}},_renderNewAnnotations:function(n,t){for(var i,u,r,f=0;f<n.length;f++)if(i=n[f],i.type=="StrikeOut"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height/2)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}else if(i.type=="Highlight"){for(t.globalAlpha=i.opacity*.5,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.rect(r.xPosition*this._zoomVal,r.yPosition*this._zoomVal,r.width*this._zoomVal,r.height*this._zoomVal),t.closePath(),t.fillStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.msFillRule="nonzero",t.fill();t.save()}else if(i.type=="Underline"){for(t.globalAlpha=i.opacity,u=0;u<i.bounds.length;u++)r=i.bounds[u],t.beginPath(),t.moveTo(r.xPosition*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.lineTo((r.xPosition+r.width)*this._zoomVal,(r.yPosition+r.height)*this._zoomVal),t.strokeStyle="rgb("+i.colorR+","+i.colorG+","+i.colorB+")",t.closePath(),t.msFillRule="nonzero",t.stroke();t.save()}},_addAnnotation:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+this._currentPage),r=t.getContext("2d"),i;t.style.zIndex="2";i=window.getSelection().toString();switch(n){case"StrikeOut":window.getSelection().toString()?(this._drawStrikeOutAnnotation(),this._isHighlight=!1,this._annotationActive=!0):(this._annotationActive=!0,this._isHighlight=!1,this._isStrikeout=!0,this._isUnderline=!1);break;case"Underline":window.getSelection().toString()?(this._drawUnderlineAnnotation(),this._annotationActive=!0,this._isHighlight=!1):(this._annotationActive=!0,this._isHighlight=!1,this._isUnderline=!0,this._isStrikeout=!1);break;case"Highlight":window.getSelection().toString()?(this._drawHighlightAnnotation(),this._annotationActive=!0,this._isHighlight=!0):(this._annotationActive=!0,this._isHighlight=!0,this._isUnderline=!1,this._isStrikeout=!1)}},_initHighlight:function(){this._isHighlightEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Highlight"),this._isHighlightEnabled=!0,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!0)},_initStrikeOut:function(){this._isStrikeOutEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._addAnnotation("StrikeOut"),this._isStrikeOutEnabled=!0,this._isUnderlineEnabled=!1,this._isHighlightEnabled=!1,this._isStrikeout=!0)},_initUnderline:function(){this._isUnderlineEnabled?(this._isToolbarColorPicker||(this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._isHighlightEnabled=!1,this._annotationActive=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._drawColor=null,this._isDefaultColorSet=!1),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1):(this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._addAnnotation("Underline"),this._isUnderlineEnabled=!0,this._isHighlightEnabled=!1,this._isStrikeOutEnabled=!1,this._isUnderline=!0)},_showSignatureDialog:function(){if(this.model.enableSignature){var i=document.getElementById(this._id+"_imageTemp"),r=this.element[0].parentElement.clientWidth,s=this.element[0].parentElement.clientHeight;r>=500?(i.width=470,i.style.width="470px",window.innerHeight>=500?(i.height=400,i.style.height="400px"):(i.height=100,i.style.height="100px")):(i.width=r,i.height=100,i.style.width=r+"px",i.style.height="100px");var u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=u.signatureWindow.Signature.contentText,e=u.signatureWindow.Add.contentText,o=u.signatureWindow.clear.contentText;this._replaceTextLocale(n("#"+this._id+"_addSignature")[0],e);this._replaceTextLocale(n("#"+this._id+"_clearSignature")[0],o);n("#"+this._id+"_signatureContainerDialogTab").ejDialog({title:f});n("#"+this._id+"_popupmenu").hide();this._clearRectOnClick(this._currentPage);n("#"+this._id+"_signatureContainerDialogTab").ejDialog("open")}},_createSignatureControl:function(){var e,o,r,s,u,i;this._minX=this._minY=0;this._maxX=this._maxY=0;var i=this,l=n("#"+this._id+"_pageviewContainer"),f=document.createElement("div");f.id=this._id+"_signatureContainerDialogTab";e=document.createElement("div");o=document.createElement("div");o.id=this._id+"_signatureContainer";r=document.createElement("canvas");r.id=this._id+"_imageTemp";s=i.element[0].parentElement;s&&(u=s.clientWidth,u>=500?(r.width=470,r.height=400,r.style.width="470px",r.style.height="400px"):(r.width=u,r.height=100,r.style.width=u+"px",r.style.height="100px"));o.appendChild(r);var a=r.getContext("2d"),h=t.buildTag("button","Add",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px",float:"right",opacity:"0.2",cursor:"default","pointer-events":"none"},{id:this._id+"_addSignature"}),c=t.buildTag("button","Clear",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px",float:"right"},{id:this._id+"_clearSignature"});e.appendChild(c[0]);e.appendChild(h[0]);f.appendChild(o);f.appendChild(e);l.append(f);h.ejButton({showRoundedCorner:!1,size:"small"});c.ejButton({showRoundedCorner:!1,size:"small"});i=this;n("#"+this._id+"_imageTemp").on("mousedown touchstart",function(n){n.which!=3&&n.type!="contextmenu"&&(n.preventDefault(),i._findMouse(n),i._mouseDetection=!0,i._oldX=i._mouseX,i._oldY=i._mouseY,i._newObject=[],i._newpoints=[],i._mouseEvent(n))});n("#"+this._id+"_imageTemp").on("mousemove touchmove",function(t){i._mouseDetection&&(i._findMouse(t),n("#"+i._id+"_addSignature").css({opacity:"",cursor:"pointer","pointer-events":""}),i._mouseEvent(t))});n(window).on("mouseup touchend",function(){i._mouseDetection==!0&&i._convertToString(i._newObject,a);i._mouseDetection=!1});n("#"+this._id+"_addSignature").on("click touchend",function(t){i._newCanvas=null;i._signatureAdded=!0;i._isNewlyAdded=!0;var r=document.getElementById(i._id+"pageDiv_"+i._currentPage);i.model.signatureSettings.left>0&&i.model.signatureSettings.top>0&&(t.preventDefault(),i._signatureAdded=!1,i._isNewlyAdded=!1,i._isPositionSet=!0,i._addSignature(t),i._isPositionSet=!1);t.type=="touchend"&&(t.preventDefault(),i._signatureAdded=!1,i._isNewlyAdded=!1,i._addSignature(t));n(r).on("mousemove",function(n){i._isNewlyAdded&&(i._isNewlyAdded=!1,i._addSignature(n))});n("#"+i._id+"_signatureContainerDialogTab").ejDialog("close")});n("#"+this._id+"_clearSignature").on("click",function(t){n("#"+i._id+"_addSignature").css({opacity:"0.2",cursor:"default","pointer-events":"none"});i._clearSignature(t)});n("#"+this._id+"_signatureContainerDialogTab").ejDialog({showOnInit:!1,enableResize:!1,allowDraggable:!1,zIndex:1e8,backgroundScroll:!1,enableModal:!0,open:function(t){n("#"+i._id+"_addSignature").css({opacity:"0.2",cursor:"default","pointer-events":"none"});i._clearSignature(t)},close:function(){n("#"+i._id+"_addSignature").css({opacity:"0.2",cursor:"default","pointer-events":"none"});var t=document.getElementById(i._id+"_imageTemp"),r=t.getContext("2d");r.clearRect(0,0,t.width,t.height)}});u>=500?n("#"+this._id+"_signatureContainerDialogTab").ejDialog({width:"500px"}):n("#"+this._id+"_signatureContainerDialogTab").ejDialog({width:"auto"});n("#"+this._id+"_signatureContainerDialogTab").addClass("e-pdfviewer-sign-dialog")},_convertToString:function(n,t){this._addMoveTo(n[0],n[1],t);this._addLineTo(n[0],n[1],t);for(var i=2;i<n.length;i=i+2)this._addLineTo(n[i],n[i+1],t)},_addLineTo:function(n,t){this._newx=n;this._newy=t;this._outputString+="<br>.lineTo("+this._newx+","+this._newy+");"},_addMoveTo:function(n,t){this._newx=n;this._newy=t;this._outputString+="<br>.moveTo("+this._newx+","+this._newy+");"},_findMouse:function(n){var i,t;n.type=="touchstart"||n.type=="touchmove"?(t={},i=n.originalEvent.target.getBoundingClientRect(),this._mouseX=n.originalEvent.touches[0].pageX-i.left,this._mouseY=n.originalEvent.touches[0].pageY-i.top,t={x:this._mouseX,y:this._mouseY},this._newpoints.push(t)):n.offsetX?(t={},this._mouseX=n.offsetX,this._mouseY=n.offsetY,t={x:this._mouseX,y:this._mouseY},this._newpoints.push(t)):n.layerX&&(this._mouseX=n.layerX,this._mouseY=n.layerY)},_mouseEvent:function(n){this._mouseDetection&&(this._draw(2,n),this._oldX=this._mouseX,this._oldY=this._mouseY)},_draw:function(n){var i=document.getElementById(this._id+"_imageTemp"),t=i.getContext("2d");t.beginPath();t.moveTo(this._oldX,this._oldY);t.lineTo(this._mouseX,this._mouseY);t.stroke();t.lineWidth=n;t.arc(this._oldX,this._oldY,n/2,0,Math.PI*2,!0);t.closePath();this._newObject.push(this._mouseX,this._mouseY)},_appendChildElement:function(n){var t=document.createElement("div");t.style.position="absolute";t.style.border="1px solid #4f80ff";t.style.backgroundColor="white";t.style.width="8px";t.style.height="8px";t.className=n.className;t.id=n.id;t.style.zIndex="100000000";t.style.left=parseFloat(n.style.width)/2-parseFloat(t.style.width)/2+"px";t.style.top=parseFloat(n.style.height)/2-parseFloat(t.style.height)/2+"px";n.appendChild(t)},_addSignature:function(t){var p=this._currentPage,u=document.getElementById(this._id+"pageDiv_"+p),h=document.getElementById(this._id+"pagecanvas_"+p),ut=document.getElementById(this._id+"_imageTemp"),v=this._totalSignature.length,ct=parseFloat(n(ut).css("width")),lt=parseFloat(n(ut).css("height")),r=document.createElement("canvas"),w,b,k,it,rt,e,o,i,d,s,et,ot,g,f;if(r.id=this._id+"imagecanvasDraw_"+p+"_"+v,r.className="e-pdfviewer-imagecanvasDraw",f=this._outputString.split("<br>")[1].split(".").slice(1).join("."),f){var ft=f.substring(0,6),nt=f.substring(6),tt=nt.replace(/[{()}]/g,""),a=tt.split(","),c=parseFloat(a[0]),l=parseFloat(a[1]);this._maxpointsX=this._minpointsX=c;this._maxpointsY=this._minpointsY=l}for(v=this._outputString.split("<br>").length,w=0;w<v;w++)if(f=this._outputString.split("<br>")[w].split(".").slice(1).join("."),f){var ft=f.substring(0,6),nt=f.substring(6),tt=nt.replace(/[{()}]/g,""),a=tt.split(","),c=parseFloat(a[0]),l=parseFloat(a[1]);this._minpointsX>=c&&(this._minpointsX=c);this._minpointsY>=l&&(this._minpointsY=l);this._maxpointsX<=c&&(this._maxpointsX=c);this._maxpointsY<=l&&(this._maxpointsY=l)}this._minpointsX=this._minpointsX-5;this._minpointsY=this._minpointsY-5;this._maxpointsX=this._maxpointsX+5;this._maxpointsY=this._maxpointsY+5;b=this._maxpointsX-this._minpointsX;k=this._maxpointsY-this._minpointsY;this._differenceX=b;this._differenceY=k;it=this.model.signatureSettings.height==0?140:this.model.signatureSettings.height;rt=this.model.signatureSettings.width==0?200:this.model.signatureSettings.width;r.width=rt*this._zoomVal;r.height=it*this._zoomVal;r.style.width=rt*this._zoomVal+"px";r.style.height=it*this._zoomVal+"px";e=r.width;o=r.height;r.style.position="absolute";t.type=="touchend"?(t=t.originalEvent.changedTouches[0],d=n("#"+this._id+"_viewerContainer"),r.style.left=parseFloat(n(d).css("width"))/2-n(u).offset().left+"px",r.style.top=parseFloat(n(d).css("height"))/2-n(u).offset().top+"px",parseFloat(r.style.top)+o>n(u).height()?r.style.top=parseFloat(r.style.top)-o+"px":parseFloat(r.style.top)<0&&(r.style.top=parseFloat(r.style.top)+o+"px"),this._isTouchAdded=!0):this._isPositionSet?(r.style.left=this.model.signatureSettings.left+e/2<h.clientWidth?this.model.signatureSettings.left+"px":"0px",r.style.top=this.model.signatureSettings.top+o<h.clientHeight?this.model.signatureSettings.top+"px":"0px"):(t.pageX-n(u).offset().left+e/2<h.clientWidth&&t.pageX-n(u).offset().left-e/2>0?r.style.left=t.pageX-n(u).offset().left-e/2+"px":t.pageX-n(u).offset().left-e<=0?r.style.left="0px":t.pageX-n(u).offset().left+e>=h.clientWidth&&(r.style.left=t.pageX-n(u).offset().left-e+"px"),r.style.top=t.pageY-n(u).offset().top+o<h.clientHeight&&t.pageY-n(u).offset().top-o>0?t.pageY-n(u).offset().top-o+"px":"0px");this._canvasTopPosition=t.pageX;this._canvasLeftPosition=t.pageY;this._newCanvas=r;r.style.zIndex="10000000";u.appendChild(r);i=this;d=n("#"+this._id+"_viewerContainer");n(window).on("mousemove",function(t){var r,f;if(i._signatureAdded&&i._newCanvas){r=i._newCanvas;f=r.getContext("2d");i._isCanasResized=!1;i._startWidth=r.clientWidth;i._startHeight=r.clientHeight;var s=r.getBoundingClientRect(),e=t.pageX-i._canvasTopPosition,o=t.pageY-i._canvasLeftPosition;i._canvasTopPosition=t.pageX;i._canvasLeftPosition=t.pageY;var c=o+parseFloat(r.style.top),l=e+parseFloat(r.style.left),a=document.getElementById(i._id+"e-pdfviewer-buttons");r.style.left=t.pageX-n(u).offset().left+i._startWidth/2<h.clientWidth&&t.pageX-n(u).offset().left-i._startWidth/2>0?t.pageX-n(u).offset().left-i._startWidth/2+"px":r.style.left;r.style.top=t.pageY-n(u).offset().top+i._startHeight/2<h.clientHeight&&t.pageY-n(u).offset().top-i._startHeight/2>0?t.pageY-n(u).offset().top-i._startHeight/2+"px":r.style.top}});n(window).on("mouseup touchend",function(){i._isCanasResized=!1;i._isCanvasClicked=!1;var n=i._tempCanvas;i._tempCanvas||(n=i._newCanvas);i._signatureAdded&&i._signatureAddEvent(n);i._signatureAdded=!1;i._isCanvasMoved&&i._addingHistoryMove(n);i._isCanvasResizeOver&&i._addingHistoryResize(n)});n(u).on("mousedown touchstart",function(t){var u=document.getElementById(i._id+"e-pdfviewer-selector"),f=document.getElementsByClassName("e-pdfviewer-buttons"),e;i._signatureAdded&&i._signatureAddEvent(i._newCanvas);t.target.className!="e-pdfviewer-imagecanvasDraw"&&t.target.className!="e-pdfviewer-buttons"&&(e=document.getElementById(this._id+"highlight-menu"),n(e).hide(),i._tempCanvas=null,i._isCanasResized=!1,i._isCanvasClicked=!1);u&&!i._isCanvasClicked&&!i._isCanasResized&&f&&(n(u).remove(),n(f).remove());i._signatureAdded=!1;n(r).on("mousedown touchstart",function(t){var f,e,u;i._signatureAdded=!1;i._clearRectOnClick(i._AnnotationPage);t.type=="touchstart"&&(t.preventDefault(),t=t.originalEvent.changedTouches[0]);var s=t.target.id,o=document.getElementById(s),h=document.getElementById(i._id+"pageDiv_"+p);i._tempCanvas=o;i._canvasTopPosition=t.pageX;i._canvasLeftPosition=t.pageY;i._isCanvasClicked=!0;i._isCanasResized=!1;i._initialCoordinates={};i._initialCoordinates.left=parseFloat(o.style.left);i._initialCoordinates.top=parseFloat(o.style.top);i._removeSelector();f=document.createElement("div");f.style.position="absolute";f.style.borderRadius="3px";f.style.border="1px solid #4f80ff";f.id=i._id+"e-pdfviewer-selector";e=i._getBounds(t);f.style.width=e.width+"px";f.style.height=e.height+"px";f.style.left=e.x;f.style.top=e.y;f.style.zIndex="100000";h.appendChild(f);u=document.createElement("div");u.style.position="absolute";u.id=i._id+"e-pdfviewer-rightbottombtn";u.className="e-pdfviewer-buttons";u.style.width="20px";u.style.height="20px";u.style.left=parseFloat(e.width)-parseFloat(u.style.width)/2+"px";u.style.top=parseFloat(e.height)-parseFloat(u.style.height)/2+"px";u.style.zIndex="100000000";u.style.cursor="se-resize";f.appendChild(u);i._appendChildElement(u);n(".e-pdfviewer-buttons").on("mousedown touchstart",function(t){var u,r;t.type=="touchstart"&&(t.preventDefault(),t=t.originalEvent.changedTouches[0]);u=document.getElementById(i._id+"e-pdfviewer-selector");i._target=t.target;r=i._tempCanvas;i._startX=t.clientX;i._startY=t.clientY;i._startWidth=r.clientWidth;i._startHeight=r.clientHeight;i._initialSize={height:parseInt(i._startHeight),width:parseInt(i._startWidth)};i._canvasTopPosition=parseFloat(n(r).css("top"));i._canvasLeftPosition=parseFloat(n(r).css("left"));i._isCanasResized=!0});n(window).on("mousemove touchmove",function(t){var e=document.getElementById(i._id+"pagecanvas_"+i._currentPage),y=document.getElementById(i._id+"e-pdfviewer-selector"),c,o,r,l;if(t.type=="touchmove"&&(t=t.originalEvent.changedTouches[0]),i._isCanasResized==!0){c=document.getElementById(i._id+"pageDiv_"+i._currentPage);o=t.target;o.className!="e-pdfviewer-buttons"&&(o.style.cursor="auto");r=i._tempCanvas;l=r.getContext("2d");i._isCanvasClicked=!1;var s=i._startWidth+(t.clientX-i._startX),h=i._startHeight+(t.clientY-i._startY),u=i._canvasLeftPosition-(i._startX-t.clientX),f=i._canvasTopPosition-(i._startY-t.clientY);s-=n(r).outerWidth()-parseInt(n(r).css("width"));s+="px";h-=n(r).outerHeight()-parseInt(n(r).css("height"));h+="px";u+="px";f+="px";i._applyNewBounds(t,r,s,h,u,f,i._startX,i._startY,t.pageX,t.clientY,i._target,e,c);i._calculateIconPosition(t)}if(i._isCanvasClicked==!0&&y){r=i._tempCanvas;l=r.getContext("2d");i._isCanasResized=!1;i._startWidth=r.clientWidth;i._startHeight=r.clientHeight;var p=document.getElementById(i._id+"e-pdfviewer-buttons"),a=t.pageX-i._canvasTopPosition,v=t.pageY-i._canvasLeftPosition;i._canvasTopPosition=t.pageX;i._canvasLeftPosition=t.pageY;var f=v+parseFloat(r.style.top),u=a+parseFloat(r.style.left),w=parseFloat(r.clientWidth)+parseFloat(r.style.left);u>0&&u+i._startWidth<e.clientWidth?(f>0&&f+i._startHeight<e.clientHeight&&(r.style.top=v+parseFloat(r.style.top)+"px"),r.style.left=a+parseFloat(r.style.left)+"px",i._calculateIconPosition(t)):(r.style.top=r.style.top+"px",r.style.left=r.style.left+"px");i._isCanvasMoved=!0}});n(".e-pdfviewer-buttons").on("mouseup touchend",function(){i._isCanasResized=!1;i._isCanvasClicked=!1;i._target=null;i._isCanvasResizeOver&&i._addingHistoryResize(r)})});n(r).on("mouseup touchend",function(){i._isCanvasClicked=!1;i._isCanasResized=!1;i._isCanvasMoved&&i._addingHistoryMove(r)})});for(s=r.getContext("2d"),v=this._outputString.split("<br>").length,this._totalSignature.push(r),this._outputPath[r.id]=this._outputString,s.beginPath(),et=b/r.clientWidth,ot=k/r.clientHeight,g=0;g<v;g++)if(f=this._outputString.split("<br>")[g].split(".").slice(1).join("."),f){var ft=f.substring(0,6),nt=f.substring(6),tt=nt.replace(/[{()}]/g,""),a=tt.split(","),c=(parseFloat(a[0])-this._minpointsX)/et,l=(parseFloat(a[1])-this._minpointsY)/ot;ft=="moveTo"?s.moveTo(c,l):ft=="lineTo"&&s.lineTo(c,l)}s.lineWidth=4;s.scale(.5,.5);s.strokeStyle=this.model.signatureSettings.color;s.stroke();var st=this._minpointsX,ht=this._minpointsY,y={};y.minimumX=st;y.minimumY=ht;y.differenceX=b;y.differenceY=k;this._valueChanges[r.id]=y;n(r).css("opacity",this.model.signatureSettings.opacity);n("#"+this._id+"_containerDialogTab").ejDialog("close");(this._isTouchAdded||this._isPositionSet)&&(this._signatureAddEvent(r),this._isTouchAdded=!1,this._isPositionSet=!1)},_signatureAddEvent:function(t){var r={width:0,height:0,x:0,y:0},i;t&&(r.width=t.clientWidth/this._zoomVal,r.height=t.clientHeight/this._zoomVal,r.x=parseFloat(n(t).css("left"))/this._zoomVal,r.y=parseFloat(n(t).css("top"))/this._zoomVal);i={};i.signatureSettings=this.model.signatureSettings;i.signatureID=t.id;i.pageNumber=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);i.signatureBound=r;this.isDocumentEdited=!0;this._raiseClientEvent("signatureAdd",i)},_addingHistoryMove:function(t){var i=this,r={},e,o,s,u,f;r.operation="signatureMoved";e=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);r.pageNumber=e;r.signCanvas=t;o=document.getElementById(i._id+"pageDiv_"+e);s=o.getBoundingClientRect();i._newinitialCoordinates={};i._newinitialCoordinates.left=parseFloat(t.style.left);i._newinitialCoordinates.top=parseFloat(t.style.top);r.Coordinates=i._newinitialCoordinates;r.initialCoordinates=i._initialCoordinates;i._recentOperation.push(r);i._isCanvasMoved=!1;u={width:0,height:0,x:0,y:0};t&&(u.width=t.clientWidth/this._zoomVal,u.height=t.clientHeight/this._zoomVal,u.x=parseFloat(n(t).css("left"))/this._zoomVal,u.y=parseFloat(n(t).css("top"))/this._zoomVal);f={};f.signatureSettings=this.model.signatureSettings;f.signatureID=t.id;f.pageNumber=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);f.signatureBound=u;this._raiseClientEvent("signatureMove",f)},_addingHistoryResize:function(t){var i=this,o=i._outputPath[t.id],s=t.clientWidth,h=t.clientHeight,r,e,u;i._reDrawSignature(o,t,s,h);r={};r.operation="signatureResized";e=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);r.pageNumber=e;r.signCanvas=t;r.initialSize=i._initialSize;r.size=i._size;i._recentOperation.push(r);i._isCanvasResizeOver=!1;u={width:0,height:0,x:0,y:0};t&&(u.width=t.clientWidth/i._zoomVal,u.height=t.clientHeight/i._zoomVal,u.x=parseFloat(n(t).css("left"))/i._zoomVal,u.y=parseFloat(n(t).css("top"))/i._zoomVal);var c=t.getContext("2d"),f={},l={color:c.strokeStyle,opacity:n(t).css("opacity")};f.signatureSettings=l;f.pageNumber=t.id;f.pageId=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);f.signatureCurrentBound=u;f.signaturePreviousBound=i._size;i._raiseClientEvent("signatureResize",f)},_moveSignatureArrowKey:function(t){var r=this,i,u,s,e,o,p,f,h,y,w;if(t.keyCode==37||t.keyCode==38||t.keyCode==39||t.keyCode==40){if(i=r._tempCanvas,i&&t.preventDefault(),u=document.getElementById(r._id+"e-pdfviewer-selector"),s=document.getElementById(r._id+"pagecanvas_"+r._currentPage),i&&(e=parseFloat(i.style.left),o=parseFloat(i.style.top),r._keyInitialCoordinates={},r._keyInitialCoordinates.left=e,r._keyInitialCoordinates.top=o),p=n("#"+this._id+"_viewerContainer"),i&&u){var e=parseFloat(i.style.left),o=parseFloat(i.style.top),c=parseFloat(i.style.width),l=parseFloat(i.style.height),a=parseFloat(n(u).css("left")),v=parseFloat(n(u).css("top"));switch(t.keyCode){case 37:e+c>0&&e-20>0&&(i.style.left=parseFloat(i.style.left)-20+"px",n(u).css("left",a-20+"px"));break;case 39:e+c+20<s.clientWidth&&(i.style.left=parseFloat(i.style.left)+20+"px",n(u).css("left",a+20+"px"));break;case 38:o+l>0&&o-20>0&&(i.style.top=parseFloat(i.style.top)-20+"px",n(u).css("top",v-20+"px"));break;case 40:o+l+20<s.clientHeight&&(i.style.top=parseFloat(i.style.top)+20+"px",n(u).css("top",v+20+"px"))}f={};f.operation="keyMoved";h=parseInt(i.id.split("imagecanvasDraw_")[1].split("_")[0]);f.pageNumber=h;f.signCanvas=i;y=document.getElementById(r._id+"pageDiv_"+h);w=y.getBoundingClientRect();r._newinitialPosition={};r._newinitialPosition.left=parseFloat(i.style.left);r._newinitialPosition.top=parseFloat(i.style.top);f.Coordinates=r._newinitialPosition;f.keyinitialCoordinates=r._keyInitialCoordinates;r._recentOperation.push(f)}}else t.keyCode==46&&r._deleteSignatureCanvas()},_applyNewBounds:function(t,i,r,u,f,e,o,s,h,c,l,a){var v=this,y,p;v._size={};y=n(i).css("left");p=n(i).css("top");l.id==v._id+"e-pdfviewer-rightbottombtn"&&(parseFloat(y)>0&&parseFloat(r)+parseFloat(y)<a.clientWidth&&n(i).css("width",r),v._size.width=r);l.id==v._id+"e-pdfviewer-rightbottombtn"&&(parseFloat(p)>0&&parseFloat(u)+parseFloat(p)<a.clientHeight&&n(i).css("height",u),v._size.height=u);v._isCanvasResizeOver=!0},_calculateIconPosition:function(n){var t=this,r=document.getElementById(t._id+"e-pdfviewer-selector"),u=document.getElementById(t._id+"e-pdfviewer-rightbottombtn"),f=document.getElementById(t._id+"e-pdfviewer-leftBottomBtn"),e=document.getElementById(t._id+"e-pdfviewer-rightTopBtn"),o=document.getElementById(t._id+"e-pdfviewer-leftTopBtn"),s=document.getElementsByClassName("e-pdfviewer-rotatebuttons")[0],h=document.getElementsByClassName("e-pdfviewer-rotate")[0],i=t._getBounds(n);r.style.width=i.width+"px";r.style.height=i.height+"px";r.style.left=i.x;r.style.top=i.y;u.style.left=parseFloat(i.width)-parseFloat(u.style.width)/2+"px";u.style.top=parseFloat(i.height)-parseFloat(u.style.height)/2+"px"},_removeSelector:function(){var i=this,t=document.getElementById(i._id+"e-pdfviewer-selector"),r=n(".e-pdfviewer-buttons");t&&(n(t).remove(),n(r).remove())},_getBounds:function(){var t={width:0,height:0,x:0,y:0},i=this._tempCanvas;return i&&(t.width=i.clientWidth,t.height=i.clientHeight,t.x=n(i).css("left"),t.y=n(i).css("top")),t},_clearSignature:function(){var n=document.getElementById(this._id+"_imageTemp"),t=n.getContext("2d");t.clearRect(0,0,n.width,n.height);this._outputString="";this._newObject=[];this._minX=this._minY=0;this._maxX=this._maxY=0},_getPagePosition:function(n){var t=document.getElementById(this._id+"selectioncanvas_"+n);return t.getBoundingClientRect()},_getTextNodes:function(n,t){var u=[],i=document.createRange(),f=n.getRangeAt(0),c=f.getBoundingClientRect(),h,y,o,e,r,s;if(n.anchorNode==n.focusNode)this._isBackwardSelection?(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)):n.anchorOffset<n.focusOffset?(i.setStart(n.anchorNode,n.anchorOffset),i.setEnd(n.focusNode,n.focusOffset)):(i.setStart(n.focusNode,n.focusOffset),i.setEnd(n.anchorNode,n.anchorOffset)),h=i.getBoundingClientRect(),u.push(h);else if(this._isBackwardSelection)this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u);else{var l=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,a=navigator.userAgent.indexOf("Edge")!=-1,v=document.documentMode||/Edge/.test(navigator.userAgent);if(l||a||v){for(y=!1,r=0;r<this._textDivs[t].length;r++)s=this._textDivs[t][r].textContent,s==n.anchorNode.data&&(o=r),s==n.focusNode.data&&(e=r),r!=this._textDivs[t].length-1||e||(e=this._textDivs[t].length-1);o<e||!o?this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u):this._getAnnotationOffsets(f,n.focusNode,n.anchorNode,n.focusOffset,n.anchorOffset,u)}else this._getAnnotationOffsets(f,n.anchorNode,n.focusNode,n.anchorOffset,n.focusOffset,u)}return{rectangleBound:c,bounds:u}},_getAnnotationOffsets:function(n,t,i,r,u,f){var o,l,e,a,b,k,p,d,s,g,h,v,c,y,w,nt;for(t.parentNode.className=="e-pdfviewer-selectiondiv text_container"?(o=parseInt(t.id.split("text_")[1]),l=parseInt(t.id.split("text_"+o+"_")[1])):(o=parseInt(t.parentNode.id.split("text_")[1]),l=parseInt(t.parentNode.id.split("text_"+o+"_")[1])),i.parentNode.className=="e-pdfviewer-selectiondiv text_container"?(e=parseInt(i.id.split("text_")[1]),a=parseInt(i.id.split("text_"+e+"_")[1])):(e=parseInt(i.parentNode.id.split("text_")[1]),a=parseInt(i.parentNode.id.split("text_"+e+"_")[1])),this._isFindboxPresent&&this._clearAllOccurrences(),d=o!=e&&this._isBackwardSelection?e:o,s=d;s<=e;s++){if(g=this._textDivs[s],s==o)p=l;else if(this._isBackwardSelection)p=0;else break;for(h=p;h<this._textDivs[s].length;h++){for(v=g[h],c=document.createRange(),b=h==l?r:0,k=h==a?u:v.textContent.length,y=0;y<v.childNodes.length;y++)w=v.childNodes[y],c.setStart(w,b),c.setEnd(w,k);if(nt=c.getBoundingClientRect(),c.detach(),f.push(nt),s==e&&h==a)break}}},_drawStrikeOutAnnotation:function(){var v,f,k,e,d,g,r,nt;if(this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation){if(window.getSelection().toString()){var l=window.getSelection(),t=this._getAnchorId(l),a,tt=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,it=navigator.userAgent.indexOf("Edge")!=-1,rt=document.documentMode||/Edge/.test(navigator.userAgent);(tt||it||rt)&&(v=this._getSelectionNodes(l),t=v.anchorIds,a=v.focusIds,t<a?this._isBackwardSelection=!1:t>a&&(this._isBackwardSelection=!0));var p=[],w=this._getTextNodes(l,t),i=this._drawColor?this._drawColor:this.model.strikethroughSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var ft=new Date,ut=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:this._getModifiedDate(),h={type:"StrikeOut",bounds:[],author:this.model.strikethroughSettings.author,subject:this.model.strikethroughSettings.subject,modifiedDate:ut,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.strikethroughSettings.opacity,note:"",pageNumber:t,isLocked:this.model.strikethroughSettings.isLocked};for(r=0;r<w.bounds.length;r++){var c=this._getPagePosition(t),u=w.bounds[r],y=u.left-c.left,f=u.top-c.top;f>this._pageSize[t-1].PageHeight&&(t++,c=this._getPagePosition(t),f=u.top-c.top);var b=document.getElementById(this._id+"_secondarycanvas_"+t),et=b.getBoundingClientRect(),o=b.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(y,f+u.height/2);o.lineTo(y+u.width,f+u.height/2);o.closePath();o.strokeStyle=i;o.stroke();k={xPosition:y/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};h.bounds.push(k)}for(this._newAnnotationList[t-1].push(h),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(h))),e={},e.annotationSettings=this.model.strikethroughSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=h.bounds,e.annotationType="StrikeOut",this._raiseClientEvent("annotationAdd",e),d=this._newAnnotationList[t-1].length-1,p.push(d),g={operation:"AddedStrikeOut",pageNumber:t,indexes:p},this._recentOperation.push(g),this._redoActions=[],r=0;r<this._totalPages;r++)nt=[],this._redoAnnotationCollection[r]=nt;window.getSelection().removeAllRanges();this.isDocumentEdited=!0}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_getModifiedDate:function(){var n=new Date,t=n.toLocaleDateString([],{year:"numeric",month:"long",day:"numeric"}),i=n.toLocaleTimeString([],{hour:"numeric",minute:"numeric"});return t+" "+i},_drawUnderlineAnnotation:function(){var v,f,k,e,d,g,r,nt;if(this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&window.getSelection().toString()){var l=window.getSelection(),t=this._getAnchorId(l),a,tt=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,it=navigator.userAgent.indexOf("Edge")!=-1,rt=document.documentMode||/Edge/.test(navigator.userAgent);(tt||it||rt)&&(v=this._getSelectionNodes(l),t=v.anchorIds,a=v.focusIds,t<a?this._isBackwardSelection=!1:t>a&&(this._isBackwardSelection=!0));var p=[],i=this._drawColor?this._drawColor:this.model.underlineSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var w=this._getTextNodes(l,t),ft=new Date,ut=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:this._getModifiedDate(),h={type:"Underline",bounds:[],author:this.model.underlineSettings.author,subject:this.model.underlineSettings.subject,modifiedDate:ut,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.underlineSettings.opacity,note:"",pageNumber:t,isLocked:this.model.underlineSettings.isLocked};for(r=0;r<w.bounds.length;r++){var c=this._getPagePosition(t),u=w.bounds[r],y=u.left-c.left,f=u.top-c.top;f>this._pageSize[t-1].PageHeight&&(t++,c=this._getPagePosition(t),f=u.top-c.top);var b=document.getElementById(this._id+"_secondarycanvas_"+t),et=b.getBoundingClientRect(),o=b.getContext("2d");o.beginPath();f=f-1.2*this._zoomVal;o.moveTo(y,f+u.height);o.lineTo(y+u.width,f+u.height);o.closePath();o.strokeStyle=i;o.stroke();k={xPosition:y/this._zoomVal,yPosition:f/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};h.bounds.push(k)}for(this._newAnnotationList[t-1].push(h),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(h))),e={},e.annotationSettings=this.model.underlineSettings,e.annotationId=this._totalAnnotations[t].length-1,e.pageId=t,e.annotationBound=h.bounds,e.annotationType="Underline",this._raiseClientEvent("annotationAdd",e),d=this._newAnnotationList[t-1].length-1,p.push(d),g={operation:"AddedUnderline",pageNumber:t,indexes:p},this._recentOperation.push(g),this._redoActions=[],r=0;r<this._totalPages;r++)nt=[],this._redoAnnotationCollection[r]=nt;this.isDocumentEdited=!0;window.getSelection().removeAllRanges();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_getAnchorId:function(n){return n.anchorNode.parentNode.className=="e-pdfviewer-selectiondiv text_container"?parseInt(n.anchorNode.id.split("text_")[1]):parseInt(n.anchorNode.parentNode.id.split("text_")[1])},_getSelectionNodes:function(n){var t,i;return t=n.anchorNode.parentNode.className=="e-pdfviewer-selectiondiv text_container"?parseInt(n.anchorNode.id.split("text_")[1]):parseInt(n.anchorNode.parentNode.id.split("text_")[1]),i=n.focusNode.parentNode.className=="e-pdfviewer-selectiondiv text_container"?parseInt(n.focusNode.id.split("text_")[1]):parseInt(n.focusNode.parentNode.id.split("text_")[1]),{anchorIds:t,focusIds:i}},_drawHighlightAnnotation:function(){var v,e,k,f,d,g,r,nt;if(this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation){if(window.getSelection().toString()){var l=window.getSelection(),t=this._getAnchorId(l),a,tt=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,it=navigator.userAgent.indexOf("Edge")!=-1,rt=document.documentMode||/Edge/.test(navigator.userAgent);(tt||it||rt)&&(v=this._getSelectionNodes(l),t=v.anchorIds,a=v.focusIds,t<a?this._isBackwardSelection=!1:t>a&&(this._isBackwardSelection=!0));var y=[],p=this._getTextNodes(l,t),i=this._drawColor?this._drawColor:this.model.highlightSettings.color,s;typeof i=="object"?(s=JSON.parse(JSON.stringify(i)),i="rgb("+i.r+","+i.g+","+i.b+")"):typeof i=="string"&&(s=this._toolbarColorpickerObject.hexCodeToRGB(i));var ft=new Date,ut=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:this._getModifiedDate(),h={type:"Highlight",bounds:[],author:this.model.highlightSettings.author,subject:this.model.highlightSettings.subject,modifiedDate:ut,colorR:s.r,colorG:s.g,colorB:s.b,colorA:255,opacity:this.model.highlightSettings.opacity,note:"",pageNumber:t,isLocked:this.model.highlightSettings.isLocked};for(r=0;r<p.bounds.length;r++){var c=this._getPagePosition(t),u=p.bounds[r],w=u.left-c.left,e=u.top-c.top;e>this._pageSize[t-1].PageHeight&&(t++,c=this._getPagePosition(t),e=u.top-c.top);var b=document.getElementById(this._id+"_secondarycanvas_"+t),et=b.getBoundingClientRect(),o=b.getContext("2d");o.beginPath();e=e-1.2*this._zoomVal;o.rect(w,e,u.width,u.height);o.closePath();o.globalAlpha=.5;o.fillStyle=i;o.fill();k={xPosition:w/this._zoomVal,yPosition:e/this._zoomVal,width:u.width/this._zoomVal,height:u.height/this._zoomVal};h.bounds.push(k)}for(this._newAnnotationList[t-1].push(h),this._totalAnnotations[t].push(JSON.parse(JSON.stringify(h))),f={},f.annotationSettings=this.model.highlightSettings,f.annotationId=this._totalAnnotations[t].length-1,f.pageId=t,f.annotationBound=h.bounds,f.annotationType="Highlight",this._raiseClientEvent("annotationAdd",f),d=this._newAnnotationList[t-1].length-1,y.push(d),g={operation:"AddedHighlight",pageNumber:t,indexes:y},this._recentOperation.push(g),this._redoActions=[],r=0;r<this._totalPages;r++)nt=[],this._redoAnnotationCollection[r]=nt;this.isDocumentEdited=!0;window.getSelection().removeAllRanges()}n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide();this._waterDropletDivHide();n("#"+this._id+"touchcustom-menu").hide()}},_drawAnnotationRect:function(n,t,i,r,u){var e=document.getElementById(this._id+"_secondarycanvas_"+n),f;e&&(f=e.getContext("2d"),f.beginPath(),f.setLineDash([4]),f.globalAlpha=1,f.rect(t,i,r,u),f.closePath(),f.strokeStyle="blue",f.stroke(),f.save())},_drawAnnotSelectRect:function(n,t){var f,e,o,u,r,i;if(this._tempCanvas=null,this._removeSelector(),f=t[t.length-1],this._selectedAnnotation=f,this._selectedAnnotationObject={},this._selectedAnnotationObject.annotation=f,this._selectedAnnotationObject.pageIndex=n,e=this._getAnnotation(t,n),e.isExistingAnnotation)for(o=this._textMarkupAnnotationList[n][e.currentAnnotationIndex],r=0;r<o.Bounds.length;r++)i=o.Bounds[r],this._drawAnnotationRect(n,this._convertPointToPixel(i.X)*this._zoomVal,this._convertPointToPixel(i.Y)*this._zoomVal,this._convertPointToPixel(i.Width)*this._zoomVal,this._convertPointToPixel(i.Height)*this._zoomVal);else if(u=t[0],u.bounds)for(r=0;r<u.bounds.length;r++)i=u.bounds[r],this._drawAnnotationRect(n,(i.xPosition-.5)*this._zoomVal,(i.yPosition-.5)*this._zoomVal,(i.width+.5)*this._zoomVal,(i.height+.5)*this._zoomVal);this._isAnnotationSelected=!0},_clearRectOnClick:function(n){var t=document.getElementById(this._id+"_secondarycanvas_"+n),i;t&&(i=t.getContext("2d"),i.setLineDash([]),this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[n],n),this._isAnnotationSelected=!1,this._selectedAnnotationObject=null)},_onCanvasMousedown:function(t,i,r){var f=t.getContext("2d"),e=parseInt(i-n(t.parentNode).offset().left),o=parseInt(r-n(t.parentNode).offset().top),u=f.getImageData(e,o,1,1).data;this._annotationColor=this._rgb2Color(u[0],u[1],u[2])},_showPopupNote:function(t){var o=document.getElementById(this._id+"_note_content"),i=this._currentAnnotationRectangle[0],s=i.Note?i.Note:i.note,e,r,u;if(s){o.innerText=s;var h=i.Color?i.Color.R:i.colorR,c=i.Color?i.Color.G:i.colorG,l=i.Color?i.Color.B:i.colorB,f=document.getElementById(this._id+"_author_content");f.style.borderBottom="1px solid black";f.style.fontWeight="bold";e=i.Author?i.Author:i.author;e;f.textContent=e;o.style.backgroundColor="rgb("+h+","+c+","+l+")";r=n("#"+this._id+"_popup_note");u=this._setPopupMenuPosition(t,r);r.css({display:"block","background-color":"rgb("+h+","+c+","+l+")",position:"absolute"});r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show();r.offset({top:u.y+5,left:u.x+5}).show();r.show()}},_showPopupMenu:function(t){var v,s,h,c,e,l,a,r,o,u,i,y,f;if(!this._isPropertiesWindowOpen){if(this._isPopupNoteVisible=!0,n("#"+this._id+"_popup_note").hide(),document.getElementById(this._id+"_popupinnercontent").innerText="",v=document.getElementById(this._id+"highlight-menu"),n(v).hide(),this._isContextMenuPresent=!1,s=document.getElementById(this._id+"_popupinnercontent"),n(s).focus(),s.contentEditable=!0,l=this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup,this._annotationBackupNoteSave=l,a=this._getAnnotation(l,this._AnnotationPage),a.isExistingAnnotation)r=this._textMarkupAnnotationList[this._AnnotationPage][a.currentAnnotationIndex],h=r.Author,c=r.ModifiedDate,r.Note&&(e=r.Note);else for(o=0;o<this._currentAnnotations.length;o++){u=this._currentAnnotations[o];h=u.author;c=u.modifiedDate;u.note&&(e=u.note);break}document.getElementById(this._id+"_username").innerText=h;document.getElementById(this._id+"_currentTime").innerText=c;e&&(document.getElementById(this._id+"_popupinnercontent").innerText=e);i=document.getElementById(this._id+"_popupmenu");n(i).css("z-index",1e9);y=n(i);f=this._setPopupMenuPosition(t,y);n(i).show();n(i).offset({top:f.y,left:f.x}).show();n(i).show();n(i).offset({top:f.y,left:f.x}).show();n(i).show()}},_saveNote:function(){var f,t,u,i,n;f=this._annotationBackupNoteSave?this._annotationBackupNoteSave:this._currentAnnotationRectangle.length>0?this._currentAnnotationRectangle:this._currentAnnotationRectangleBackup;var o=new Date,e=this._getAnnotation(f,this._AnnotationPage),r=document.getElementById(this._id+"_popupinnercontent");if(e.isExistingAnnotation)t=this._textMarkupAnnotationList[this._AnnotationPage][e.currentAnnotationIndex],t.Note!=r.textContent&&(n=t.TextMarkupAnnotationType,n=="Highlight"?t.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:this._getModifiedDate():n=="Underline"?t.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:this._getModifiedDate():n=="StrikeOut"&&(t.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:this._getModifiedDate()),t.Note=r.textContent);else for(u=0;u<this._currentAnnotations.length;u++){i=this._currentAnnotations[u];i.note!=r.textContent&&(n=i.type,n=="Highlight"?i.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:this._getModifiedDate():n=="Underline"?i.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:this._getModifiedDate():n=="StrikeOut"&&(i.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:this._getModifiedDate()),i.note=r.innerText);break}r.innerText=""},_setPropertiesWindowLocale:function(t){var i=t.propertyWindow.appearance.contentText,r=t.propertyWindow.general.contentText,u=t.propertyWindow.color.contentText,f=t.propertyWindow.opacity.contentText,e=t.propertyWindow.author.contentText,o=t.propertyWindow.subject.contentText,s=t.propertyWindow.modified.contentText,h=t.propertyWindow.ok.contentText,c=t.propertyWindow.cancel.contentText,l=t.propertyWindow.locked.contentText;this._replaceTextLocale(n("#"+this._id+"_appearanceli").children("a")[0],i);this._replaceTextLocale(n("#"+this._id+"_generalli").children("a")[0],r);this._replaceTextLocale(n("#"+this._id+"_colorspan")[0],u);this._replaceTextLocale(n("#"+this._id+"_opacityspan")[0],f);this._replaceTextLocale(n("#"+this._id+"_authorspan")[0],e);this._replaceTextLocale(n("#"+this._id+"_subjectspan")[0],o);this._replaceTextLocale(n("#"+this._id+"_modifiedspan")[0],s);this._replaceTextLocale(n("#"+this._id+"_ok")[0],h);this._replaceTextLocale(n("#"+this._id+"_cancel")[0],c);this._replaceTextLocale(n("#"+this._id+"_lockedprop")[0],l)},_showPropertiesMenu:function(){var e,d,g,f,c,a,v,y,p,w,u,i,l,r,k,tt,h,it,rt,s,o;if(this._isPropertiesWindowOpen=!0,e=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],this._setPropertiesWindowLocale(e),d=document.getElementById(this._id+"highlight-menu"),n(d).hide(),n("#"+this._id+"_generalli").css("display",""),n(".e-pdfviewer-lockedcheckbox").css("visibility",""),n("#"+this._id+"_lockedprop").css("visibility",""),this._isContextMenuPresent=!1,g=n("#"+this._id+"_PropertiesDialogTab").data("ejTab"),g.showItem(0),w=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage),this._tempCanvas){o=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox");o.option("checked",!1);var nt=this._tempCanvas,ut=nt.getContext("2d"),b=ut.strokeStyle,ft=parseInt(b.slice(1,3),16),et=parseInt(b.slice(3,5),16),ot=parseInt(b.slice(5,7),16);f={r:ft,g:et,b:ot};c=parseFloat(n(nt).css("opacity"));u="Signature";n("#"+this._id+"_generalli").css("display","none");n(".e-pdfviewer-lockedcheckbox").css("visibility","hidden");n("#"+this._id+"_lockedprop").css("visibility","hidden");this._hided=!0}else if(w.isExistingAnnotation)i=this._textMarkupAnnotationList[this._AnnotationPage][w.currentAnnotationIndex],f={r:i.Color.R,g:i.Color.G,b:i.Color.B},c=i.Opacity,a=i.Author,v=i.Subject,y=i.ModifiedDate,p=i.isLocked,u=i.TextMarkupAnnotationType;else if(this._currentAnnotations.length>0)for(l=0;l<this._currentAnnotations.length;l++){r=this._currentAnnotations[l];f={r:r.colorR,g:r.colorG,b:r.colorB};c=r.opacity;a=r.author;v=r.subject;y=r.modifiedDate;p=r.isLocked;u=r.type;break}f&&this._colorpickerObject.option("value",this._rgb2Color(f.r,f.g,f.b));s=n("#"+this._id+"_slider").data("ejSlider");k=parseInt(c*100);s.option("value",k);n("#"+this._id+"_opacity").val(k+"%");n("#"+this._id+"_author_input").val(a);n("#"+this._id+"_subject_input").val(v);tt=document.getElementById(this._id+"_modifieddate").childNodes[0];tt.textContent=y;n("#"+this._id+"_containerDialogTab").ejDialog({title:u+" Properties"});h=n("#"+this._id+"_containerDialogTab_title").children("span")[0];u=="Highlight"?h.textContent=e.propertyWindow.highlightProperties.contentText:u=="StrikeOut"?h.textContent=e.propertyWindow.strikeOutProperties.contentText:u=="Underline"?h.textContent=e.propertyWindow.underlineProperties.contentText:u=="Signature"&&(h.textContent=e.propertyWindow.signatureProperties.contentText);n("#"+this._id+"_containerDialogTab").ejDialog("open");it=Math.max(0,(n(window).height()-n("#"+this._id+"_containerDialogTab").outerHeight())/2+n(window).scrollTop())+"px";rt=Math.max(0,(n(window).width()-n("#"+this._id+"_containerDialogTab").outerWidth())/2+n(window).scrollLeft())+"px";n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:rt,Y:it}});p?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),s=n("#"+this._id+"_slider").data("ejSlider"),s.disable(),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),o=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),o.option("checked",!0)):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),s=n("#"+this._id+"_slider").data("ejSlider"),s.enable(),o=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),o.option("checked",!1))},_lockProperties:function(){var i=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),t;i.model.checkState=="check"?(this._colorpickerObject.option("enabled",!1),document.getElementById(this._id+"_opacity").disabled=!0,n("#"+this._id+"_opacity").addClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!0,n("#"+this._id+"_author_input").addClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!0,n("#"+this._id+"_subject_input").addClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.disable()):(this._colorpickerObject.option("enabled",!0),document.getElementById(this._id+"_opacity").disabled=!1,n("#"+this._id+"_opacity").removeClass("e-disable"),document.getElementById(this._id+"_author_input").disabled=!1,n("#"+this._id+"_author_input").removeClass("e-disable"),document.getElementById(this._id+"_subject_input").disabled=!1,n("#"+this._id+"_subject_input").removeClass("e-disable"),t=n("#"+this._id+"_slider").data("ejSlider"),t.enable())},_setDrawColor:function(n){this._isDefaultColorSet&&(this._drawColor=this._toolbarColorpickerObject.hexCodeToRGB(n.value),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1)},_createNote:function(){var r=n("#"+this._id+"_viewerContainer"),i=t.buildTag("div.e-pdfviewer-annotation-note","",{display:"none"},{id:this._id+"_popup_note"}),u=t.buildTag("div.e-pdfviewer-annotation-authorcontent","",{},{id:this._id+"_author_content"}),f=t.buildTag("div.e-pdfviewer-annotation-notecontent","",{},{id:this._id+"_note_content"});i.append(u);i.append(f);r.append(i)},_createPopupMenu:function(){var p=n("#"+this._id+"_viewerContainer"),r=document.createElement("DIV"),u,f,c,v,l,o,s,y,e,i,h,a;r.id=this._id+"_popupmenu";r.className="e-pdfviewer-popupmenu";p.append(r);u=document.createElement("DIV");u.className="e-pdfviewer-header";u.id=this._id+"_popupheader";r.appendChild(u);f=document.createElement("DIV");f.className="e-pdfviewer-username";f.id=this._id+"_username";f.innerHTML="Guest";u.appendChild(f);c=t.buildTag("div.e-pdfviewer-closepopup","",{},{id:this._id+"_popup_close"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closeicon");c[0].appendChild(v[0]);u.appendChild(c[0]);l=this;n(".e-pdfviewer-closeicon").on("click touchend",function(){l._saveNote();n(".e-pdfviewer-popupmenu").hide();l._isPopupNoteVisible=!1});o=document.createElement("DIV");s=document.createElement("DIV");o.className="e-pdfviewer-currenttime";s.id=this._id+"_currentTime";y=new Date;s.innerHTML=y.toLocaleString();o.appendChild(s);r.appendChild(o);e=document.createElement("DIV");e.className="e-pdfviewer-content";e.id=this._id+"_popupcontent";i=document.createElement("DIV");i.className="e-pdfviewer-innercontent";i.id=this._id+"_popupinnercontent";i.innerText=" ";i.style.width="366.667px";i.style.height="132.073px";i.style.overflow="hidden";i.style.overflowY="auto";e.appendChild(i);r.appendChild(e);h=document.createElement("DIV");h.className="e-pdfviewer-footer";h.id=this._id+"_popupfooter";r.appendChild(h);a=document.getElementById(this._id+"_popupmenu");i.addEventListener("paste",function(n){n.preventDefault();var t=n.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,t)});this._on(n(a),"mousedown touchstart",this._popupNoteMousedown);this._on(n(a),"mouseup touchend",this._popupNoteMouseup);this._on(n(window),"touchmove mousemove",this._movePopupNote)},_popupNoteMousedown:function(n){if(n.type=="touchstart"&&(n=n.originalEvent.changedTouches[0]),n.which!=3||n.type=="touchstart"){this._isPopupNoteFocused=!0;var t=document.getElementById(this._id+"_popupmenu");this._xpos=n.clientX-t.offsetLeft;this._ypos=n.clientY-t.offsetTop}},_popupNoteMouseup:function(){this._enableSelection();this._isPopupNoteFocused=!1},_movePopupNote:function(t){var u,i;if(t.type=="touchmove"&&(t=t.originalEvent.changedTouches[0]),this._isPopupNoteFocused||t.type=="touchmove"){u=document.getElementById(this._id+"_viewerContainer");i=document.getElementById(this._id+"_popupmenu");this._isContextMenuPresent=!0;var r=t.clientX-this._xpos,f=t.clientY-this._ypos,e=this._calulateCurrentPosition(f,i),o=parseFloat(n(i).css("width")),s=parseFloat(n(i).css("height"));r>0&&r+o<=u.clientWidth&&(i.style.left=r+"px");e&&(i.style.top=f+"px")}},_calulateCurrentPosition:function(t,i){for(var f,e,r=5,o=parseFloat(n(i).css("height")),u=1;u<=this._totalPages;u++)f=this._pageSize[u-1].PageHeight*this._zoomVal,u==this._AnnotationPage&&t>r&&t+o<f+r&&(e=r),r+=f;if(e)return!0},_createPropertiesMenu:function(){var ii=n("#"+this._id+"_pageviewContainer"),vt=document.createElement("div"),b,k,r,ti,d,c,g,nt,tt,l,e,it,rt,ut,i,a,pt,o,v,ft,et,ot,u,y,st,ht,ct,f,s,lt,at,p,wt,bt;vt.id=this._id+"_containerDialogTab";var yt=document.createElement("div"),w=t.buildTag("div","",{height:"auto"},{id:this._id+"_PropertiesDialogTab"}),kt=document.createElement("ul");kt.innerHTML="<li id= '"+this._id+"_appearanceli'><a href=#"+this._id+"_apperanceProperties>Appearance<\/a><\/li><li id= '"+this._id+"_generalli'><a href=#"+this._id+"_generalProperties>General<\/a><\/li>";b=t.buildTag("div","",{},{id:this._id+"_apperanceProperties"});k=t.buildTag("div","",{},{id:this._id+"_generalProperties"});yt.appendChild(w[0]);w[0].appendChild(kt);w[0].appendChild(b[0]);w[0].appendChild(k[0]);r=document.createElement("div");r.style.paddingBottom="11px";var dt=t.buildTag("button.e-pdfviewer-properties-okbtn","OK",{float:"right","margin-right":"18px"},{id:this._id+"_ok"}),gt=t.buildTag("button.e-pdfviewer-properties-cancelbtn","Cancel",{float:"right"},{id:this._id+"_cancel"}),ni=t.buildTag("input","",{},{type:"checkbox","aria-label":"locked Checkbox"}),h=document.createElement("label");h.id=this._id+"_lockedprop";h.className="e-pdfviewer-properties-label";h.style.marginRight="18px";h.innerHTML="Locked";r.appendChild(ni[0]);r.appendChild(h);r.appendChild(gt[0]);r.appendChild(dt[0]);ni.ejCheckBox({cssClass:"e-pdfviewer-lockedcheckbox",id:this._id+"_lockedcheckbox",size:t.CheckboxSize.Small,change:n.proxy(this._lockProperties,this)});b[0].style.height="300px";k[0].style.height="300px";yt.appendChild(r);vt.appendChild(yt);ii.append(vt);dt.ejButton({showRoundedCorner:!0,size:"small"});gt.ejButton({showRoundedCorner:!0,size:"small"});n("#"+this._id+"_PropertiesDialogTab").ejTab({});ti=this.element.width();ti>=500?n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"500px",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this),backgroundScroll:!1,enableModal:!0}):n("#"+this._id+"_containerDialogTab").ejDialog({showOnInit:!1,width:"auto",enableResize:!1,close:n.proxy(this._closePropertiesWindow,this),backgroundScroll:!1,enableModal:!0});d=document.createElement("div");c=document.createElement("div");c.className="e-pdfviewer-color-container";d.appendChild(c);g=document.createElement("div");g.className="e-pdfviewer-color-span";nt=document.createElement("div");nt.className="e-pdfviewer-color-picker";c.appendChild(g);c.appendChild(nt);tt=document.createElement("SPAN");tt.id=this._id+"_colorspan";tt.innerHTML="Color:";g.appendChild(tt);l=document.createElement("input");l.type="text";l.id=this._id+"_colorpicker";n(l).attr("aria-label","colorpicker");nt.appendChild(l);e=document.createElement("div");e.className="e-pdfviewer-opacity-container";d.appendChild(e);it=document.createElement("div");it.className="e-pdfviewer-opacity-span";rt=document.createElement("div");rt.className="e-pdfviewer-opacity-field";e.appendChild(it);e.appendChild(rt);ut=document.createElement("SPAN");ut.id=this._id+"_opacityspan";ut.innerHTML="Opacity:";it.appendChild(ut);i=document.createElement("input");i.type="text";i.id=this._id+"_opacity";i.className="e-inputchangeval";i.value="100%";i.style.width="50px";i.style.height="20px";n(i).attr("aria-label","opacity");rt.appendChild(i);a=document.createElement("div");a.className="e-pdfviewer-slider-control";a.style.width="100px";e.appendChild(a);pt=document.createElement("DIV");pt.id=this._id+"_slider";a.appendChild(pt);b.append(d);n("#"+this._id+"_colorpicker").ejColorPicker({modelType:"palette"});n("#"+this._id+"_colorpicker").ejColorPicker("hide");this._colorpickerObject=n("#"+this._id+"_colorpicker").data("ejColorPicker");n("#"+this._id+"_slider").ejSlider({cssClass:"e-pdfviewer-opacity-slider",value:100,minValue:0,maxValue:100,incrementStep:1,showRoundedCorner:!0,change:this._slidervaluechange,slide:this._slidervaluechange});o=document.createElement("div");o.style.border="0px";v=document.createElement("div");v.className="e-pdfviewer-author-container";o.appendChild(v);ft=document.createElement("div");ft.className="e-pdfviewer-author-span";v.appendChild(ft);et=document.createElement("SPAN");et.id=this._id+"_authorspan";et.innerHTML="Author:";ft.appendChild(et);ot=document.createElement("div");ot.className="e-pdfviewer-author-inputdiv";v.appendChild(ot);u=document.createElement("input");u.id=this._id+"_author_input";u.className="e-pdfviewer-author-input";n(u).attr("aria-label","author input");ot.appendChild(u);y=document.createElement("div");y.className="e-pdfviewer-subject-container";o.appendChild(y);st=document.createElement("div");st.className="e-pdfviewer-subject-span";y.appendChild(st);ht=document.createElement("SPAN");ht.id=this._id+"_subjectspan";ht.innerHTML="Subject:";st.appendChild(ht);ct=document.createElement("div");ct.className="e-pdfviewer-subject-inputdiv";y.appendChild(ct);f=document.createElement("input");f.id=this._id+"_subject_input";f.className="e-pdfviewer-subject-input";n(f).attr("aria-label","subject input");ct.appendChild(f);s=document.createElement("div");s.className="e-pdfviewer-modifieddate-container";s.style.height="18.67px";o.appendChild(s);lt=document.createElement("div");lt.className="e-pdfviewer-modified-labeldiv";at=document.createElement("SPAN");at.id=this._id+"_modifiedspan";at.innerHTML="Modified:";lt.appendChild(at);s.appendChild(lt);p=document.createElement("div");p.className="e-pdfviewer-modifieddate-labeldiv";p.id=this._id+"_modifieddate";wt=document.createElement("SPAN");wt.innerHTML="";p.appendChild(wt);s.appendChild(p);k.append(o);n("#"+this._id+"_containerDialogTab_title").addClass("e-pdfviewer-propertiestitle");n("#"+this._id+"_containerDialogTab").addClass("e-pdfviewer-propertiestab");n("#"+this._id+"_PropertiesDialogTab").addClass("e-pdfviewer-innertab");n("#"+this._id+"_apperanceProperties").addClass("e-pdfviewer-appearanceprop");n("#"+this._id+"_generalProperties").addClass("e-pdfviewer-generalprop");n("#"+this._id+"_appearanceli").addClass("e-pdfviewer-tab-li");n("#"+this._id+"_generalli").addClass("e-pdfviewer-tab-li");n(i).addClass("e-pdfviewer-elementalignments");n(i).addClass("ejinputtext");n(u).addClass("e-pdfviewer-elementalignments");n(u).addClass("ejinputtext");n(f).addClass("e-pdfviewer-elementalignments");n(f).addClass("ejinputtext");this._tabObject=n("#"+this._id+"_PropertiesDialogTab").data("ejTab");this._on(n("#"+this._id+"_ok"),"click",this._applyAnnotationProperties);this._on(n("#"+this._id+"_cancel"),"click",this._cancelAnnotationProperties);bt=document.getElementById(this._id+"_lockedcheckbox_hidden");bt&&n(bt).attr("aria-label","hidden checkbox")},_applyAnnotationProperties:function(){var e=this._tabObject,i=this._colorpickerObject.rgb,r=parseInt(n("#"+this._id+"_opacity").val().split("%")[0])/100,u=n("#"+this._id+"_author_input").val(),f=n("#"+this._id+"_subject_input").val(),t=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);this._changeAnnotationProperties(i,r,u,f,t.currentAnnotationIndex,this._AnnotationPage,t.isExistingAnnotation);n("#"+this._id+"_containerDialogTab").ejDialog("close")},_cancelAnnotationProperties:function(){n("#"+this._id+"_containerDialogTab").ejDialog("close")},_getAnnotation:function(n,t){for(var f,h,u,i=this._textMarkupAnnotationList[t],e=[],o=null,s=!1,r=0;r<n.length;r++)if(i)for(f=0;f<i.length;f++)n[r]==i[f]&&(e.push(i[f]),o=f,s=!0);for(i=this._newAnnotationList[t-1],r=0;r<n.length;r++){if(i)for(u=0;u<i.length;u++)n[r]==i[u]&&(e.push(i[u]),o=u,s=!1,h=i[u]);if(n[r]==h)break}return this._currentAnnotations=e,{currentAnnotationIndex:o,isExistingAnnotation:s}},_changeAnnotationProperties:function(t,i,r,u,f,e,o){var b=document.getElementById(this._id+"_secondarycanvas_"+e),ft,h,w,s,v,p,a,nt,et;if(b&&!this._tempCanvas){ft=b.getContext("2d");ft.clearRect(0,0,b.width,b.height);this._selectedAnnotationObject=null;var k=!1,d=!1,c,g,h={},ot=new Date;this._drawAnnotSelectRect(e,this._currentAnnotationRectangleBackup)}if(this._tempCanvas){var tt=!1,it=!1,y=this._tempCanvas,l=y.getContext("2d"),rt=l.strokeStyle,ut=n(y).css("opacity");l.strokeStyle="rgb("+t.r+","+t.g+","+t.b+")";l.stroke();n(y).css("opacity",i);ut!=i&&(tt=!0);rt!=l.strokeStyle&&(it=!0);(tt||it)&&(h={},h.isColorChange=it,h.isOpacityChange=tt,h.signatureID=this._tempCanvas.id,h.currentColor=l.strokeStyle,h.perviousColor=rt,h.previousOpacity=ut,h.currentOpacity=i,h.pageId=parseInt(this._tempCanvas.id.split("imagecanvasDraw_")[1].split("_")[0]),this._raiseClientEvent("signaturePropertiesChange",h));a={operation:"SignatureModifed",pageNumber:this._currentPage,sign:y,newstrokeStyle:l.strokeStyle,newsopacity:n(y).css("opacity"),previousstrokeStyle:rt,previousOpacity:ut};p=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox");this._recentOperation.push(a)}else o?(s=this._textMarkupAnnotationList[e][f],(s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b||s.Opacity!=i||s.Author!=r||s.Subject!=u)&&(v={},v=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(v),s.Color.R!=t.r||s.Color.G!=t.g||s.Color.B!=t.b?k=!0:s.Opacity!=i&&(d=!0),s.Color.R=t.r,s.Color.G=t.g,s.Color.B=t.b,s.Color.A=t.a,s.Opacity=i,s.Author=r,s.Subject=u,c=s.TextMarkupAnnotationType,c=="Highlight"?s.ModifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:this._getModifiedDate():c=="Underline"?s.ModifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:this._getModifiedDate():c=="StrikeOut"&&(s.ModifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:this._getModifiedDate()),g=f,this._totalAnnotations[e][f]=JSON.parse(JSON.stringify(s)),w={},w.index=f,w.annotation=s,w.action="propertyChanged",this._existingAnnotationsModified[e-1].push(w),a={operation:"propertiesModifiedForExistingAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(a)),p=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=p.model.checkState=="check"?!0:!1):(s=this._newAnnotationList[e-1][f],(s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b||s.opacity!=i||s.author!=r||s.subject!=u)&&(v={},v=JSON.parse(JSON.stringify(s)),this._colorModifiedAnnotationList[e-1].push(v),s.colorR!=t.r||s.colorG!=t.g||s.colorB!=t.b?k=!0:s.opacity!=i&&(d=!0),s.colorR=t.r,s.colorG=t.g,s.colorB=t.b,s.opacity=i,s.colorA=s.opacity*255,s.author=r,s.subject=u,c=s.type,c=="Highlight"?s.modifiedDate=this.model.highlightSettings.modifiedDate?this.model.highlightSettings.modifiedDate:this._getModifiedDate():c=="Underline"?s.modifiedDate=this.model.underlineSettings.modifiedDate?this.model.underlineSettings.modifiedDate:this._getModifiedDate():c=="StrikeOut"&&(s.modifiedDate=this.model.strikethroughSettings.modifiedDate?this.model.strikethroughSettings.modifiedDate:this._getModifiedDate()),g=this._textMarkupAnnotationList[e]?this._textMarkupAnnotationList[e].length+f:f,this._totalAnnotations[e][g]=JSON.parse(JSON.stringify(s)),p=n("#"+this._id+"_lockedcheckbox").data("ejCheckBox"),s.isLocked=p.model.checkState=="check"?!0:!1,a={operation:"propertiesModifiedForNewAnnot",pageNumber:this._AnnotationPage,indexes:f},this._recentOperation.push(a)));for((k||d)&&(h.isColorChanged=k,h.isOpacityChanged=d,h.annotationType=c,h.annotationId=g,h.pageId=e,this._raiseClientEvent("annotationPropertiesChange",h)),this._redoActions=[],nt=0;nt<this._totalPages;nt++)et=[],this._redoAnnotationCollection[nt]=et;this.isDocumentEdited=!0;this._tempCanvas||this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[e],e)},_slidervaluechange:function(t){var i=t.value,r=this._id.split("_slider")[0];n("#"+r+"_opacity").val(i+"%")},_deleteAnnotation:function(){var u,f,o,s,e,t,c;if(this._isAnnotationSelected){var i,h=[],r={},n=this._getAnnotation(this._currentAnnotationRectangleBackup,this._AnnotationPage);if(n.isExistingAnnotation){for(i=this._textMarkupAnnotationList[this._AnnotationPage],u=i[n.currentAnnotationIndex],r.annotationType=u.TextMarkupAnnotationType,this._deletedAnnotationList[this._AnnotationPage-1].push(u),f={},f.index=u.Index,r.annotationId=u.Index,r.pageId=this._AnnotationPage,f.annotation=u,f.action="deleted",this._existingAnnotationsModified[this._AnnotationPage-1].push(f),this._annotationsDeletedNo[this._AnnotationPage-1]=this._annotationsDeletedNo[this._AnnotationPage-1]+1,t=0;t<i.length;t++)i[t]!=u&&h.push(i[t]);e={operation:"existingAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex};this._recentOperation.push(e);this._textMarkupAnnotationList[this._AnnotationPage]=h;this._totalAnnotations[this._AnnotationPage].splice(n.currentAnnotationIndex,1)}else i=this._newAnnotationList[this._AnnotationPage-1],o=i[n.currentAnnotationIndex],r.annotationType=o.type,this._deletedAnnotationList[this._AnnotationPage-1].push(o),this._newAnnotationList[this._AnnotationPage-1].splice(n.currentAnnotationIndex,1),s=this._textMarkupAnnotationList[this._AnnotationPage]?this._textMarkupAnnotationList[this._AnnotationPage].length+n.currentAnnotationIndex:n.currentAnnotationIndex,r.annotationId=s,r.pageId=this._AnnotationPage,this._totalAnnotations[this._AnnotationPage].splice(s,1),e={operation:"newAnnotationDeleted",pageNumber:this._AnnotationPage,indexes:n.currentAnnotationIndex},this._recentOperation.push(e);for(this._redoActions=[],t=0;t<this._totalPages;t++)c=[],this._redoAnnotationCollection[t]=c;this._raiseClientEvent("annotationRemove",r);this.isDocumentEdited=!0;this._clearRectOnClick(this._AnnotationPage);this._isAnnotationSelected=!1}this._deleteSignatureCanvas()},_createHighlightContextMenu:function(){var i=document.createElement("div"),r=n("#"+this._id+"_pageviewContainer"),t,u;i.id=this._id+"highlight-menu";i.className="e-pdfviewer-highlight-menu";r.append(i);t=document.createElement("ol");t.className="highlightorderedList";i.appendChild(t);u=window.getSelection().toString();n(t).append("<li class='popupnoteli'><a href='javascript:void(0);' class='popupnote' id = '"+this._id+"_openPopup'>Open Pop-Up Note<\/a><\/li>");n(t).append("<li class='deleteAnnotationli'><a href='javascript:void(0);' id='"+this._id+"_deleteannot' class='deleteAnnotation'>Delete <\/a><\/li>");n(t).append("<li class='Propertiesli'><a href='javascript:void(0);' class='Properties' id = '"+this._id+"_propAnnot'>Properties.... <\/a><\/li>")},_setPopupMenuPosition:function(t,i){var e;(t.type=="touchstart"&&i[0].id==this._id+"_popupmenu"||t.type=="touchmove"&&i[0].id==this._id+"_popup_note")&&(t=t.originalEvent.changedTouches[0]);var r={},f={},u={};return u.x=i.outerWidth(),u.y=i.outerHeight(),r.x=t.pageX,r.y=t.pageY,f.x=r.x+u.x>n(window).width()+n(window).scrollLeft()?r.x-u.x:r.x,f.y=r.y+u.y>n(window).height()+n(window).scrollTop()?r.y-u.y:r.y,i[0].id==this._id+"_popupmenu"&&(e=document.getElementById(this._id+"_viewerContainer"),f.x+u.x>e.clientWidth&&(f.x=f.x-u.x/4)),f},_setDeleteContextMenuPostion:function(t){var f=n("#"+this._id+"custom-menu");t.type=="touchstart"&&(t=t.originalEvent.changedTouches[0]);var 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},_setHighLightContextMenuPostion: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},_onViewerKeypress:function(t){var o,s,r,i,u,f;if(this._moveSignatureArrowKey(t),t.ctrlKey&&t.which==90||t.ctrlKey&&t.keyCode==90?this._isPropertiesWindowOpen||this._undo():(t.ctrlKey&&t.which==89||t.ctrlKey&&t.keyCode==89)&&(this._isPropertiesWindowOpen||this._redo()),t.which==9&&t.target&&t.target.className=="e-pdfviewer-formFields")if(o=t.target.id.split("input_")[1].split("_")[0],s=parseInt(o),this._maintainTabindex[o]==t.target.tabIndex){if(r=document.getElementById(this._id+"selectioncanvas_"+(s+1)),r)i=n(r).find(".e-pdfviewer-formFields"),i.length>0&&(i[0].focus(),t.preventDefault());else if(r=document.getElementById(this._id+"selectioncanvas_1"),r)for(i=n(r).find(".e-pdfviewer-formFields"),u=0;u<i.length;u++)if(i[u].tabIndex==this._maintanMinTabindex["1"]){i[u].focus();t.preventDefault();break}}else{var r=document.getElementById(this._id+"selectioncanvas_"+s),i=n(r).find(".e-pdfviewer-formFields"),e=!0;for(f=0;f<i.length;f++)if(e=!1,i[f].tabIndex==t.target.tabIndex+1){i[f].focus();e=!0;t.preventDefault();break}e||(t.target.nextElementSibling.focus(),t.preventDefault(),e=!0)}},_undo:function(){var n,t,i;if(this._removeSelector(),n=this._recentOperation.pop(),n){if(n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut"){for(t=0;t<n.indexes.length;t++)i=this._newAnnotationList[n.pageNumber-1].pop(),this._redoAnnotationCollection[n.pageNumber-1].push(i);this._redoActions.push(n)}else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?(this._undoModifiedProperty(n),this._redoActions.push(n)):n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted"?(this._undoDeletedItem(n),this._redoActions.push(n)):n.operation=="signatureAdded"?(this._undoSignatureAdd(n),this._redoActions.push(n)):n.operation=="signatureResized"?(this._undoSignatureResize(n),this._redoActions.push(n)):n.operation=="signatureMoved"?(this._undoSignatureMove(n),this._redoActions.push(n)):n.operation=="signatureDeleted"?(this._undoSignatureDeletion(n),this._redoActions.push(n)):n.operation=="keyMoved"?(this._undoSignatureKeyMoved(n),this._redoActions.push(n)):n.operation=="SignatureModifed"&&(this._undoSignatureProperties(n),this._redoActions.push(n));this._clearRectOnClick(n.pageNumber)}},_undoSignatureProperties:function(t){var i=t.sign,r=i.getContext("2d");r.strokeStyle=t.previousstrokeStyle;r.stroke();n(i).css("opacity",t.previousOpacity)},_undoModifiedProperty:function(n){var t,r,i;n.operation=="propertiesModifiedForExistingAnnot"?(t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.Color.R=i.Color.R,t.Color.G=i.Color.G,t.Color.B=i.Color.B,t.Opacity=i.Opacity,this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._newAnnotationList[n.pageNumber-1][n.indexes],r=JSON.parse(JSON.stringify(t)),this._redoAnnotationCollection[n.pageNumber-1].push(r),i=this._colorModifiedAnnotationList[n.pageNumber-1].pop(),t.colorR=i.colorR,t.colorG=i.colorG,t.colorB=i.colorB,t.opacity=i.opacity,t.colorA=i.colorA)},_undoDeletedItem:function(n){var t,r,i;n.operation=="existingAnnotationDeleted"?(t=this._deletedAnnotationList[n.pageNumber-1].pop(),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,0,t),this._totalAnnotations[n.pageNumber].splice(n.indexes,0,t),this._existingAnnotationsModified[n.pageNumber-1].pop()):(t=this._deletedAnnotationList[n.pageNumber-1].pop(),r=this._newAnnotationList[n.pageNumber-1].splice(n.indexes,0,t),i=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(i,0,t))},_undoSignatureAdd:function(t){var i=t.signCanvas;n(i).remove()},_undoSignatureDeletion:function(n){var t=n.signCanvas,i=document.getElementById(this._id+"pageDiv_"+n.pageNumber);i.appendChild(t)},_undoSignatureMove:function(n){var t=n.signCanvas;n.initialCoordinates&&(t.style.left=n.initialCoordinates.left+"px",t.style.top=n.initialCoordinates.top+"px")},_undoSignatureKeyMoved:function(n){var t=n.signCanvas;n.keyinitialCoordinates&&(t.style.left=n.keyinitialCoordinates.left+"px",t.style.top=n.keyinitialCoordinates.top+"px")},_undoSignatureResize:function(n){var t=n.signCanvas;n.initialSize&&(t.style.height=n.initialSize.height+"px",t.style.width=n.initialSize.width+"px")},_redo:function(){var n,t,i;if(this._removeSelector(),n=this._redoActions.pop(),n){if(this._recentOperation.push(n),n.operation=="AddedHighlight"||n.operation=="AddedUnderline"||n.operation=="AddedStrikeOut")for(t=0;t<n.indexes.length;t++)i=this._redoAnnotationCollection[n.pageNumber-1].pop(),this._newAnnotationList[n.pageNumber-1].push(i);else n.operation=="propertiesModifiedForExistingAnnot"||n.operation=="propertiesModifiedForNewAnnot"?this._redoModifiedProperty(n):n.operation=="existingAnnotationDeleted"||n.operation=="newAnnotationDeleted"?this._redoDeletedItem(n):n.operation=="signatureAdded"?this._redoSignatureAdd(n):n.operation=="signatureResized"?this._redoSignatureResize(n):n.operation=="signatureMoved"?this._redoSignatureMove(n):n.operation=="signatureDeleted"?this._redoSignatureDelete(n):n.operation=="keyMoved"?this._redoSignatureKeyMoved(n):n.operation=="SignatureModifed"&&this._redoSignatureProperties(n);this._clearRectOnClick(n.pageNumber)}},_redoSignatureProperties:function(t){var i=t.sign,r=i.getContext("2d");r.strokeStyle=t.newstrokeStyle;r.stroke();n(i).css("opacity",t.newsopacity)},_redoModifiedProperty:function(n){var r;if(n.operation=="propertiesModifiedForExistingAnnot"){var t=this._textMarkupAnnotationList[n.pageNumber][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.Color.R=i.Color.R;t.Color.G=i.Color.G;t.Color.B=i.Color.B;t.Opacity=i.Opacity;r={};r.index=n.indexes;r.annotation=t;r.action="propertyChanged";this._existingAnnotationsModified[n.pageNumber-1].push(r)}else{var t=this._newAnnotationList[n.pageNumber-1][n.indexes],u=JSON.parse(JSON.stringify(t)),i=this._redoAnnotationCollection[n.pageNumber-1].pop();this._colorModifiedAnnotationList[n.pageNumber-1].push(u);t.colorR=i.colorR;t.colorG=i.colorG;t.colorB=i.colorB;t.opacity=i.opacity;t.colorA=i.colorA}},_redoDeletedItem:function(n){var t,i,r;n.operation=="existingAnnotationDeleted"?(t=this._textMarkupAnnotationList[n.pageNumber],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._textMarkupAnnotationList[n.pageNumber].splice(n.indexes,1),this._totalAnnotations[n.pageNumber].splice(n.indexes,1)):(t=this._newAnnotationList[n.pageNumber-1],i=t[n.indexes],this._deletedAnnotationList[n.pageNumber-1].push(i),this._newAnnotationList[n.pageNumber-1].splice(n.indexes,1),r=this._textMarkupAnnotationList[n.pageNumber]?this._textMarkupAnnotationList[n.pageNumber].length+n.indexes:n.indexes,this._totalAnnotations[n.pageNumber].splice(r,1))},_redoSignatureAdd:function(n){var t=n.signCanvas,i=document.getElementById(this._id+"pageDiv_"+n.pageNumber);i.appendChild(t)},_redoSignatureDelete:function(t){var i=t.signCanvas;n(i).remove()},_redoSignatureMove:function(n){var t=n.signCanvas;n.Coordinates&&(t.style.left=n.Coordinates.left+"px",t.style.top=n.Coordinates.top+"px")},_redoSignatureKeyMoved:function(n){var t=n.signCanvas;n.Coordinates&&(t.style.left=n.Coordinates.left+"px",t.style.top=n.Coordinates.top+"px")},_redoSignatureResize:function(n){var t=n.signCanvas;n.size&&(t.style.height=n.size.height,t.style.width=n.size.width)},_displayColorPicker:function(t){var i=document.getElementById(this._id+"_pdfviewer_colorpicker");n(i).css("display")!="none"||this._isToolbarColorPicker?this._colorPickerStatus==t?(i.style.display="none",this._isToolbarColorPicker=!1):(t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._colorPickerStatus=t,this._isDefaultColorSet=!0):(i.style.display="block",this._isToolbarColorPicker=!0,this._colorPickerStatus!=t&&(this._drawColor=null,t=="Highlight"?this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color):t=="Underline"?this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color):t=="StrikeOut"&&this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color)),this._colorPickerStatus=t,this._isDefaultColorSet=!0)},_setPickerPosition:function(t){var r=n("#"+this._id+"_toolbarContainer"),i,u,f,e;this._toolbarColorpickerObject.refresh();i=document.getElementById(this._id+"_pdfviewer_colorpicker");u=i.getBoundingClientRect();n("#"+this._id+"_pdfviewer_textmarkupul").parent()[0]==r[0]?(i.style.top="0px",i.style.left=t.parentNode.offsetLeft+t.offsetLeft-r[0].offsetLeft-u.width+t.clientWidth+"px"):(f=document.getElementById(this._id+"_toolbarContainer_hiddenlist"),secondaryToolbarPosition=f.getBoundingClientRect(),e=document.getElementById(this._id+"_pdfviewer_textmarkupul").getBoundingClientRect(),i.style.top=secondaryToolbarPosition.bottom-e.bottom+"px",i.style.left=t.parentNode.parentNode.offsetLeft-r[0].offsetLeft+t.offsetLeft-u.width+t.clientWidth+"px")},_showSignatureButtons:function(t){t?(n("#"+this._id+"_pdfviewer_signatureul").css("display","block"),n("#"+this._id+"_pdfviewer_textmarkupul").addClass("e-separator"),this._isSignatureHidden=!1):(n("#"+this._id+"_pdfviewer_signatureul").css("display","none"),n("#"+this._id+"_pdfviewer_textmarkupul").removeClass("e-separator"),this._isSignatureHidden=!0)},_showTextMarkupButtons:function(t){t?(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","block"),n("#"+this._id+"_pdfviewer_zoomul").addClass("e-separator")):(n("#"+this._id+"_pdfviewer_textmarkupul").css("display","none"),n("#"+this._id+"_pdfviewer_zoomul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_colorpicker").css("display","none"),this._isToolbarColorPicker=!1)},_wireEvents:function(){var r=navigator.userAgent.indexOf("Chrome")!=-1,u=navigator.userAgent.indexOf("Firefox")!=-1,f=navigator.userAgent.indexOf("Safari")!=-1,e=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,h=navigator.userAgent.indexOf("Edge")!=-1,o=document.documentMode||/Edge/.test(navigator.userAgent),s=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),t=this,i;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._on(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),document.documentMode||e?(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)):o||(u?(this._on(n("#"+this._id+"_viewerContainer"),"keydown",this._onTextKeyboardCopy),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)):(r||s)&&(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"),"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)),r||u||e||h||o||s?(this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._on(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown),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"),"click touchstart","a.e-highlight-text",this._drawHighlightAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.e-strikeout-text",this._drawStrikeOutAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.deleteAnnotation",this._deleteAnnotation),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.popupnote",this._showPopupMenu),this._on(n("#"+this._id+"_pageviewContainer"),"click touchstart","a.Properties",this._showPropertiesMenu),this._on(n("#"+this._id+"_pageviewContainer"),"contextmenu",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"click",this._onTextContainerclick)):f&&(this._on(n("#"+this._id+"_viewerContainer"),"mouseup",this._onTextContainerMouseUp),this._on(n("#"+this._id+"_viewerContainer"),"mousemove",this._onTextContainerMouseMove),this._on(n("#"+this._id+"_viewerContainer"),"mousedown",this._onTextContainerMouseDown)));n(window).on("keydown",function(i){t._onViewerKeypress(i);t._onTextKeyboardCopy(i);i.ctrlKey&&(i.keyCode==65||i.keyCode==97)?i.preventDefault():i.keyCode==46&&(t._currentAnnotationRectangleBackup.length==0||t._isPropertiesWindowOpen||t._isPopupNoteVisible||(t._deleteAnnotation(),n("#"+t._id+"_popupmenu").hide(),t._isPopupNoteVisible=!1))});i=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")||f)&&i&&(i.addEventListener("touchstart",this._touchStart),i.addEventListener("touchmove",this._touchMove),i.addEventListener("touchleave",this._touchEnd),i.addEventListener("touchend",this._touchEnd),i.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);this._on(n("#"+this._id+"_pdfviewer_findlabel, #"+this._id+"_pdfviewer_matchlabel"),"mouseover",this._showLocalizationTooltip);this._on(n("#"+this._id+"_pdfviewer_findlabel, #"+this._id+"_pdfviewer_matchlabel"),"mouseout",this._hideLocalizationTooltip);this._on(n(".e-pdfviewer-toolbarli-label"),"mousedown",this._preventClick);this._on(n(window),"mousedown",this._windowMaintainSelection);this._on(n(window),"touchstart",this._windowOnTextContainerTouch)},_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),this._off(n("#"+this._id+"_viewerContainer"),"mousewheel",this._onContainerScroll),this._off(n(window),"keypress",this._onViewerKeypress));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("#"+this._id+"_pdfviewer_findlabel, #"+this._id+"_pdfviewer_matchlabel"),"mouseover",this._showLocalizationTooltip);this._off(n("#"+this._id+"_pdfviewer_findlabel, #"+this._id+"_pdfviewer_matchlabel"),"mouseout",this._hideLocalizationTooltip);this._off(n(".e-pdfviewer-toolbarli-label"),"mousedown",this._preventClick);this._off(n(window),"mousedown",this._windowMaintainSelection);this._off(n(window),"touchstart",this._windowOnTextContainerTouch);this._off(n(window),"resize",this._viewerResize)},_windowMaintainSelection:function(t){var i,r,f,u;t.target&&!n(t.target).parents().hasClass("e-pdfviewer")&&(t.target.nodeName!=="INPUT"||t.target.tagName!=="INPUT")&&(i=window.getSelection(),this._selectionNodes=i,r=document.createRange(),(n(i.anchorNode).parent().hasClass("e-pdfviewer-textLayer")&&n(i.focusNode).parent().hasClass("e-pdfviewer-textLayer")||n(i.anchorNode).hasClass("e-pdfviewer-textLayer")&&n(i.focusNode).hasClass("e-pdfviewer-textLayer"))&&(f=i.anchorNode.compareDocumentPosition(i.focusNode),u=!1,this._selectionObject={},this._selectionObject.isBackward=!1,(!f&&i.anchorOffset>i.focusOffset||f===Node.DOCUMENT_POSITION_PRECEDING)&&(u=!0),u?(this._selectionObject.isBackward=u,this._selectionObject.anchorOffset=i.focusOffset,this._selectionObject.focusOffset=i.anchorOffset,r.setStart(i.focusNode,i.focusOffset),r.setEnd(i.anchorNode,i.anchorOffset)):(this._selectionObject.anchorOffset=i.anchorOffset,this._selectionObject.focusOffset=i.focusOffset,r.setStart(i.anchorNode,i.anchorOffset),r.setEnd(i.focusNode,i.focusOffset)),this._controlSelectionRange=r,n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),this._waterDropletDivHide(),n("#"+this._id+"touchcustom-menu").hide(),t.preventDefault()))},_windowOnTextContainerTouch:function(t){var i=this,r=setTimeout(function(){i._controlSelectionRange=null;i._selectionObject=null;clearTimeout(r);n(t.target).parents().hasClass("e-pdfviewer")||(n("#"+i._id+"custom-menu")&&n("#"+i._id+"custom-menu").hide(),i._waterDropletDivHide(),n("#"+i._id+"touchcustom-menu").hide(),i._clearHighlightDiv())},1e3)},_clearHighlightDiv:function(){for(var t,u,n,i=1;i<=this._totalPages;i++)if(this._renderedCanvasList.indexOf(parseInt(i))!==-1){if(t=this._textDivs[i],u=this._textContents[i],!t||t==r)break;for(n=0;n<t.length;n++)t[n].textContent=u[n],this._isFindboxPresent||(t[n].textContent="",t[n].textContent=u[n]+"\r\n")}},_deleteSignatureCanvas:function(){var t=this._tempCanvas,i;if(t){var r={},u=document.getElementById(this._id+"e-pdfviewer-selector"),f=document.getElementsByClassName("e-pdfviewer-buttons");r.annotationID=t.id;r.pageNumber=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);i={};i.operation="signatureDeleted";i.signCanvas=t;i.pageNumber=parseInt(t.id.split("imagecanvasDraw_")[1].split("_")[0]);this._recentOperation.push(i);n(t).remove();n(u).remove();n(f).remove();this._raiseClientEvent("signatureDelete",r)}},_onContainerScroll:function(n){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;this._isPropertiesWindowOpen&&n.preventDefault()},_closePropertiesWindow:function(){this._isPropertiesWindowOpen=!1},_onToolBarContainerMouseDown:function(t){return n(t.target).hasClass("e-pdfviewer-ddl")||n(t.target).parents().hasClass("e-pdfviewer-ddl")||document.activeElement.id==this._id+"_toolbar_zoomSelection_wrapper"&&n("#"+this._id+"_toolbar_zoomSelection_wrapper").blur(),t.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._isAnnotationSelected&&(this._showPopupMenu(n),this._clearSelector(n));this._timers=setTimeout(function(){this._timers=null},200)},_onTextContainerMouseIn:function(n){if(this.Clicked)return n.preventDefault(),!1},_onTextContainerMouseUp:function(i){var b,l,k,u,h,r,a,f,st,ht,y,ft,lt,g,nt,p,e,at,tt,w,c,vt,rt,ut,o;if(this._dragstate&&(this._dragstate=!1),n("#"+this._id+"_toolbarContainer_hiddenlist").addClass("e-display-none"),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._isDefaultColorSet=!1,h=i.target,k=n("#"+this._id+"_popupinnercontent"),h==k[0]?k.focus():k.blur(),this._isPopupNoteFocused=!1,this._isPropertiesWindowOpen||i.target.id==this._id+"_popupinnercontent"||i.target.id==this._id+"_popupcontent")i.preventDefault();else{if(this._curDown=!1,u=[],h=i.target,this._currentAnnotationRectangle=[],r=document.getElementById(this._id+"custom-menu"),a=document.getElementById(this._id+"highlight-menu"),i.target.className!="popupnoteli"&&i.target.className!="deleteAnnotationli"&&i.target.className!="Propertiesli"&&i.target.className!="e-pdfviewer-highlight-menu"&&n(a).hide(),this._isContextMenuPresent=!1,f=parseInt(i.target.id.split("text_")[1])||parseInt(i.target.id.split("selectioncanvas_")[1])||parseInt(i.target.id.split("_secondarycanvas_")[1]),f&&this.model.enableTextMarkupAnnotations){for(e=1;e<=this._totalPages;e++)(this._textMarkupAnnotationList[e]||this._newAnnotationList[e-1])&&this._clearRectOnClick(e);st=document.getElementById(this._id+"_secondarycanvas_"+f);this._onCanvasMousedown(st,i.pageX,i.pageY);this._contextClickPosition(i,f)}if(window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(b=this._currentAnnotationRectangle[0],l=b.TextMarkupAnnotationType?b.TextMarkupAnnotationType:b.type,l=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):l=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle)):l=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=f,this._drawAnnotSelectRect(f,this._currentAnnotationRectangle))),ht=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0,y=window.getSelection().toString(),i.type=="contextmenu"){if(ft=window.getSelection(),ft.anchorNode){var s=ft.getRangeAt(0),d=s.cloneContents(),v=d.childNodes,ct=s.startContainer.parentNode.className,et=n(d).find("span");if(et.length>0&&(et[0].className=="e-pdfviewer-texthighlight e-pdfviewer-textLayer"||et[0].className=="e-pdfviewer-text-highlightother e-pdfviewer-textLayer")&&s.startContainer.id&&u.push(s.startContainer.id),lt=document.documentMode||/Edge/.test(navigator.userAgent),(ht||lt)&&n(d).children().length==0&&(ct=="e-pdfviewer-textLayer"&&s.startContainer.parentNode?u.push(s.startContainer.parentNode.id):u.push(s.startContainer.id)),d.childElementCount==0)ct=="e-pdfviewer-textLayer"?u.push(s.startContainer.parentElement.id):u.push(s.startContainer.id);else if(v.length>0)if(v[0].className=="e-waitingpopup e-js")for(g=0;g<v.length;g++)for(p=n(v[g]).find(".text_container").children(),nt=0;nt<p.length;nt++)u.push(p[nt].id);else if(v[0].className=="e-pdfviewer-selectiondiv text_container")for(p=n(".text_container").children(),c=0;c<p.length;c++)u.push(p[c].id);else for(e=0;e<v.length;e++)at=v[e].id,u.push(at);for(tt=0;tt<u.length;tt++)if((n(h).hasClass("e-pdfviewer-text-highlightother")||n(h).hasClass("e-pdfviewer-texthighlight"))&&(h=h.parentElement),h.id==u[tt]){this._contextMenu=!0;break}else this._contextMenu=!1}i.target.className=="e-pdfviewer-imagecanvasDraw"&&(this._contextMenu=!0)}if(i.which==3&&i.target.className=="e-pdfviewer-imagecanvasDraw"&&(this._contextMenu=!0),i.which==3&&this._contextMenu&&i.type=="contextmenu"&&!this._isCopyRestrict&&i.target.className=="e-pdfviewer-imagecanvasDraw")i.preventDefault(),this._showSignatureContext(i,a),this._contextMenu=!1;else if(y!=""&&i.which==3&&this._contextMenu&&i.type=="contextmenu"&&!this._isCopyRestrict&&i.target.className.indexOf("input_container")==-1&&this.model.textSelectionContextMenu.isEnable){i.preventDefault();this._searchedText="";var it=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],yt=it.contextMenu.copy.contentText,ot=it.contextMenu.googleSearch.contentText,pt=it.toolbar.highlight.headerText,wt=it.toolbar.strikeout.headerText;n(r).css("z-index",1e9);n(r).find("li a.copy").text(yt);n(r).find("li a.googleSearch").text(ot);n(r).find("li a.e-highlight-text").text(pt);n(r).find("li a.e-strikeout-text").text(wt);y.length>20?(rt=y.substring(0,18),ut=rt+"...",n(r).find("li a.googleSearch").text(ot+"'"+ut+"'")):n(r).find("li a.googleSearch").text(ot+"'"+y+"'");o=this._setContextMenuPostion(i);this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable"));this.model.textSelectionContextMenu.isCopyEnable||this.model.textSelectionContextMenu.isSearchEnable||this.model.textSelectionContextMenu.isHighlightEnable||this.model.textSelectionContextMenu.isStrikeoutEnable?(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()):n(r).hide();this._contextMenu=!1}else if(i.which==3&&i.type=="contextmenu"&&!this._isCopyRestrict&&(n(i.target).hasClass("e-pdfviewer-text-highlightother e-pdfviewer-textLayer")||n(i.target).hasClass("e-pdfviewer-texthighlight e-pdfviewer-textLayer")||n(i.target).hasClass("e-pdfviewer-texthighlight middle e-pdfviewer-textLayer"))&&this.model.textSelectionContextMenu.isEnable){if(i.preventDefault(),this._searchedText="",w=n(".e-pdfviewer-textLayer").find(".e-pdfviewer-texthighlight"),w.length>1)for(w=n(".e-pdfviewer-textLayer").find(".e-pdfviewer-texthighlight"),c=0;c<w.length;c++)vt=w[c].innerHTML,this._searchedText+=vt;else this._searchedText=i.target.innerHTML;this._searchedText.length>20?(rt=this._searchedText.substring(0,18),ut=rt+"...",n(r).find("li a.googleSearch").text("Search Google For '"+ut+"'")):n(r).find("li a.googleSearch").text("Search Google For '"+this._searchedText+"'");o=this._setContextMenuPostion(i);this.model.enableTextMarkupAnnotations?(this.model.enableHighlightAnnotation?n("#"+this._id+"_highlight_contextmenu").removeClass("e-disable"):n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),this.model.enableStrikethroughAnnotation?n("#"+this._id+"_strikeout_contextmenu").removeClass("e-disable"):n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable")):(n("#"+this._id+"_highlight_contextmenu").addClass("e-disable"),n("#"+this._id+"_strikeout_contextmenu").addClass("e-disable"));this.model.textSelectionContextMenu.isCopyEnable||this.model.textSelectionContextMenu.isSearchEnable||this.model.textSelectionContextMenu.isHighlightEnable||this.model.textSelectionContextMenu.isStrikeoutEnable?(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()):n(r).hide();this._contextMenu=!1}else n(r).has(i.target).length==0&&(n(r).hide(),i.type!="contextmenu"||this._contextMenu||i.target.className=="e-pdfviewer-formFields"?this._contextMenu&&i.preventDefault():this._clearSelector(),i.type=="contextmenu"&&(i.which!=3||this._contextMenu&&this.model.textSelectionContextMenu.isEnable&&y!=""||i.type!="contextmenu"||this._currentAnnotationRectangle.length==0&&"#000000"==this._annotationColor||!this.model.annotationContextMenu.isEnable?(this._currentAnnotationRectangle.length==0&&("#000000"==this._annotationColor||this.model.annotationContextMenu.isEnable)||i.preventDefault(),n(a).hide()):(this.model.enableTextMarkupAnnotations&&(l=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(i,a):l=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(i,a):l=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(i,a)),i.preventDefault())));this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())}},_replaceTextLocale:function(n,t){n.textContent=t},_showSignatureContext:function(i,r){var e=n(r).find(".popupnoteli"),u;n(e).css("display","none");this._showHideAnnotationMenu(r,"Signature");var f=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o=f.contextMenu.openPopup.contentText,s=f.contextMenu.properties.contentText;this._replaceTextLocale(n("#"+this._id+"_openPopup")[0],o);this._replaceTextLocale(n("#"+this._id+"_propAnnot")[0],s);u=this._setDeleteContextMenuPostion(i);this.model.annotationContextMenu.isPropertiesEnable||this.model.annotationContextMenu.isDeleteEnable?this.model.annotationContextMenu.isEnable&&(n(r).show(),n(r).offset({top:u.y,left:u.x}).show(),n(r).show(),n(r).offset({top:u.y,left:u.x}).show(),n(r).css("z-index",1e9)):n(r).hide()},_showAnnotationContextMenu:function(i,r){var e,u;n("#"+this._id+"_popup_note").hide();n("#"+this._id+"_popupmenu").hide();e=n(r).find(".popupnoteli");n(e).css("display","");this._showHideAnnotationMenu(r,"annotation");this._isPopupNoteVisible=!1;var f=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o=f.contextMenu.openPopup.contentText,s=f.contextMenu.Delete.contentText,h=f.contextMenu.properties.contentText;this._replaceTextLocale(n("#"+this._id+"_openPopup")[0],o);this._replaceTextLocale(n("#"+this._id+"_deleteannot")[0],s);this._replaceTextLocale(n("#"+this._id+"_propAnnot")[0],h);u=this._setHighLightContextMenuPostion(i);this._isContextMenuPresent=!0;this.model.annotationContextMenu.isPopupEnable||this.model.annotationContextMenu.isPropertiesEnable||this.model.annotationContextMenu.isDeleteEnable?this.model.annotationContextMenu.isEnable&&(n(r).show(),n(r).offset({top:u.y,left:u.x}).show(),n(r).show(),n(r).offset({top:u.y,left:u.x}).show()):n(r).hide()},_showHideSelectionContextMenu:function(t){this.model.textSelectionContextMenu.isEnable?(n(t).css("display",""),this.model.textSelectionContextMenu.isCopyEnable?n(t).find(".copyli").css("display",""):n(t).find(".copyli").css("display","none"),this.model.textSelectionContextMenu.isSearchEnable?n(t).find(".googlesearchli").css("display",""):n(t).find(".googlesearchli").css("display","none"),this.model.textSelectionContextMenu.isHighlightEnable?n(t).find(".e-highlight-textli").css("display",""):n(t).find(".e-highlight-textli").css("display","none"),this.model.textSelectionContextMenu.isStrikeoutEnable?n(t).find(".e-strikeout-textli").css("display",""):n(t).find(".e-strikeout-textli").css("display","none")):n(t).css("display","none")},_showHideAnnotationMenu:function(t,i){this.model.annotationContextMenu.isEnable?(this.model.annotationContextMenu.isPopupEnable?i=="annotation"&&n(t).find(".popupnoteli").css("display",""):n(t).find(".popupnoteli").css("display","none"),this.model.annotationContextMenu.isPropertiesEnable?n(t).find(".Propertiesli").css("display",""):n(t).find(".Propertiesli").css("display","none"),this.model.annotationContextMenu.isDeleteEnable?n(t).find(".deleteAnnotationli").css("display",""):n(t).find(".deleteAnnotationli").css("display","none")):n(t).css("display","none")},_contextClickPosition:function(n,t){var a,u,o,v,s,i,l,r,e;if(this._currentAnnotationRectangleBackup=[],u=[],o=!1,t&&(v=document.getElementById(this._id+"_secondarycanvas_"+t),a=v.getBoundingClientRect()),v){var h=n.clientX-a.left,c=n.clientY-a.top,f=this._newAnnotationList[t-1];for(s=0;s<f.length;s++)for(r=f[s],e=0;e<r.bounds.length;e++)if(i=r.bounds[e],h>=i.xPosition*this._zoomVal&&h<=(i.xPosition+i.width)*this._zoomVal&&c>=i.yPosition*this._zoomVal&&c<=(i.yPosition+i.height)*this._zoomVal)this._currentAnnotationRectangle.push(f[s]),this._currentAnnotationRectangleBackup.push(f[s]),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}if(f=this._textMarkupAnnotationList[t],f)for(l=0;l<f.length;l++)for(r=f[l],e=0;e<r.Bounds.length;e++){var i=r.Bounds[e],y=this._convertPointToPixel(i.X),p=this._convertPointToPixel(i.Y),w=this._convertPointToPixel(i.Width),b=this._convertPointToPixel(i.Height);if(h>=y*this._zoomVal&&h<=(y+w)*this._zoomVal&&c>=p*this._zoomVal&&c<=(p+b)*this._zoomVal)this._currentAnnotationRectangle.push(r),this._currentAnnotationRectangleBackup.push(r),o=!0,u.push(r);else{if(o){o=!1;break}this._isPopupNoteVisible||(this._currentAnnotationRectangleBackup=[]);this._currentAnnotationRectangle=[]}}u.length>1&&(u=this._compareAnnotations(u));this._currentAnnotationRectangle=u;this._currentAnnotationRectangleBackup=u}},_compareAnnotations:function(n){for(var i,f,t=0;t<n.length;t++){if(t==n.length-1)break;var r=n[t].bounds?n[t].bounds:n[t].Bounds,o=r[0].X?r[0].X:r[0].xPosition,s=r[0].Y?r[0].Y:r[0].yPosition,u=n[t+1].bounds?n[t+1].bounds:n[t+1].Bounds,e=u[0].X?u[0].X:u[0].xPosition,h=u[0].Y?u[0].Y:u[0].yPosition;o<e||s<h?(i=e,f=n[t+1]):(i=o,f=n[t]);i&&t==n.length-2&&i==o&&i==e&&(i=e,f=n[t+1])}return n=[],n.push(f),n},_setContextMenuPostion:function(t){var u=n("#"+this._id+"custom-menu");this._showHideSelectionContextMenu(u);var i={},f={},r={};return r.x=u.outerWidth(),r.y=u.outerHeight(),i.x=t.pageX,i.y=t.pageY,f.x=i.x+r.x>n(window).width()+n(window).scrollLeft()?i.x-r.x:i.x,f.y=i.y+r.y>n(window).height()+n(window).scrollTop()?i.y-r.y:i.y,f},_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,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(t._longTouch=!0,e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet1").offset(),r.type=="touchmove"&&(v=r.originalEvent.changedTouches[0].clientX,y=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>=s.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,h=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,h=t._selectingTextByTouch(parent,f,u,!1)),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet2").width(),n("#"+t._id+"droplet2").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()});n("#"+this._id+"droplet1").on("touchmove",function(r){var e,v,y,f,u,s,h,c;if(t.model.enableTextSelection){t._enableSelection();var o=window.getSelection(),l=parseInt(o.anchorNode.parentNode.id.split("text_")[1]),a=parseInt(o.focusNode.parentNode.id.split("text_")[1]);(l!=parseInt(t._selectionStartPage)||a!=parseInt(t._selectionStartPage))&&t._annotationActive||(e=n(i).scrollTop(),n("#"+t._id+"touchcustom-menu").hide(),r.preventDefault(),s=n("#"+t._id+"droplet2").offset(),r.type=="touchmove"&&(t._longTouch=!0,v=r.originalEvent.changedTouches[0].clientX,y=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<=s.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,h=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,h=t._selectingTextByTouch(parent,f,u,!0)),n(r.target).css("z-index",1e3),n(parent).hasClass("e-pdfviewer-textLayer")&&(c=n("#"+t._id+"droplet1").width(),n("#"+t._id+"droplet1").offset({top:u+window.scrollY,left:f-c})))}else t.model.enableTextSelection||t._disableSelection()})},_disableSelection:function(){this.model.enableTextSelection||(n("#"+this._id+"_viewerContainer").attr("unselectable","on").css({"-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}),this._isSelectionDisabled=!0)},_enableSelection:function(){this.model.enableTextSelection&&this._isSelectionDisabled&&(n("#"+this._id+"_viewerContainer").removeAttr("unselectable").css({"-moz-user-select":"text","-o-user-select":"text","-khtml-user-select":"text","-webkit-user-select":"text","-ms-user-select":"text","user-select":"text"}).unbind("selectstart").bind("selectstart",function(){return!0}),this._isSelectionDisabled=!1)},_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){var u,o,i,r,l,f,e;if(n("#"+this._id+"_toolbarContainer_hiddenlist").addClass("e-display-none"),n(t.target).hasClass("e-pdfviewer-textLayer")&&this._lockTimer){var s=t.originalEvent.changedTouches[0].clientX,h=t.originalEvent.changedTouches[0].clientY,c=document.getElementById(this._id+"touchcustom-menu");parseInt(s)!=parseInt(this._curPosX)&&parseInt(h)!=parseInt(this._curPosY)&&(n(".e-pdfviewer-formFields").css("visibility","visible"),n(c).hide())}u=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;o=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1]);this.model.enableTextMarkupAnnotations&&(this._isPopupNoteVisible||this._isContextMenuPresent||(u||this._contextClickPosition(t.originalEvent.changedTouches[0],o),this._currentAnnotationRectangle.length==0||u?(n("#"+this._id+"_popup_note").css({display:"none"}),this.model.enableTextSelection?(t.target.style.cursor="auto",t.preventDefault(),this._enableSelection()):this.model.enableTextSelection||this._isCanasResized||this._isCanvasClicked||(l=n("#"+this._id+"pageDiv_"+this._currentPage),this._dragstate?(this._deltax=this._dragx-t.pageX,this._deltay=this._dragy-t.pageY,f=n("#"+this._id+"_viewerContainer").scrollTop(),e=n("#"+this._id+"_viewerContainer").scrollLeft(),this._deltay>3?n("#"+this._id+"_viewerContainer").scrollTop(f+20):this._deltay<-2&&n("#"+this._id+"_viewerContainer").scrollTop(f-20),this._deltax>3?n("#"+this._id+"_viewerContainer").scrollLeft(e+20):this._deltax<-2&&n("#"+this._id+"_viewerContainer").scrollLeft(e-20),t.target.style.cursor="move",t.target.style.cursor="-webkit-grabbing",t.target.style.cursor="-moz-grabbing",t.target.style.cursor="grabbing",this._dragx=t.pageX,this._dragy=t.pageY):(t.target.style.cursor="move",t.target.style.cursor="-webkit-grab",t.target.style.cursor="-moz-grab",t.target.style.cursor="grab"))):(i=this._currentAnnotationRectangle[0],r=i.TextMarkupAnnotationType?i.TextMarkupAnnotationType:i.type,r=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):r=="Underline"&&this.model.enableUnderlineAnnotation?(this._showPopupNote(t),t.target.style.cursor="point_setPopupMenuPosition:er"):r=="Highlight"&&this.model.enableHighlightAnnotation&&(this._showPopupNote(t),t.target.style.cursor="pointer"))))},_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 i=n("#"+this._id+"_popup_note"),u,r;(i&&i.hide(),u=t.originalEvent.touches.length,this._curPosX=t.originalEvent.changedTouches[0].clientX,this._curPosY=t.originalEvent.changedTouches[0].clientY,this.model.enableTextSelection&&!this._isSelectionHidden&&event.target.className!="e-pdfviewer-formFields"&&t.preventDefault(),this._lockTimer)||(r=this,this._timer=setTimeout(function(){r._onlongtouch(t)},1e3),this._lockTimer=!0)},_onlongtouch:function(t){var i,f,r,u;t.type=="touchstart"&&t.target.id!=this._id+"droplet2"||t.target.id!=this._id+"droplet2"&&this.model.enableTextSelection?(this._enableSelection(),this._longTouch=!0,n(".text_container").css("visibility",""),this._curXPos=t.originalEvent.changedTouches[0].clientX,this._curYPos=t.originalEvent.changedTouches[0].clientY,i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),this._selectionStartPage=i,this._isPropertiesWindowOpen||i&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],i),this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangle[0]||(f=this._getElementTouch(t.target,this._curXPos,this._curYPos,!0),i&&this._clearRectOnClick(i)),t.target.className!="e-pdfviewer-imagecanvasDraw"||this._isCanasResized||this._isCanvasMoved||(r=document.getElementById(this._id+"highlight-menu"),this._showSignatureContext(t,r)),t.preventDefault()):this.model.enableTextSelection||(this._disableSelection(),u=document.getElementById(this._id+"touchcustom-menu"),n(u).hide(),this._waterDropletDivHide())},_onTextContainerTouchEnd:function(t){var ut,p,w,f,e,i,r,ft,b,tt,k,d,ot,g,c,v,nt;n("#"+this._id+"_toolbarContainer_hiddenlist").addClass("e-display-none");var o=[],s=t.target,y,pt=t.originalEvent.touches.length;if(this._timer){this._enableSelection();ut=n("a.popupnote");p=n("#"+this._id+"_popupinnercontent");document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!1;s==p[0]?p.focus():p.blur();s.id!=this._id+"highlight-menu"&&s!=ut[0]&&s!=p[0]&&s.className!="e-pdfviewer-imagecanvasDraw"&&(this._isPropertiesWindowOpen||(w=document.getElementById(this._id+"highlight-menu"),n(w).hide(),this._isContextMenuPresent=!1,r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&this._contextClickPosition(t.originalEvent.changedTouches[0],r),this._currentAnnotationRectangleBackup.length!=0&&this._isAnnotationSelected&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(window.getSelection().removeAllRanges(),i=document.getElementById(this._id+"touchcustom-menu"),n(i).hide(),this._waterDropletDivHide()),this._longTouch&&this._isAnnotationSelected&&this._currentAnnotationRectangleBackup.length!=0&&this._selectedAnnotation==this._currentAnnotationRectangleBackup[0]&&(this.model.enableTextMarkupAnnotations&&(f=this._currentAnnotationRectangleBackup[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Highlight"&&this.model.enableHighlightAnnotation?this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w):e=="Underline"&&this.model.enableUnderlineAnnotation&&this._showAnnotationContextMenu(t.originalEvent.changedTouches[0],w)),this._longTouch=!1),this._isContextMenuPresent||(r=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("_secondarycanvas_")[1]),r&&this.model.enableTextMarkupAnnotations&&(this._clearRectOnClick(r),ft=document.getElementById(this._id+"_secondarycanvas_"+r),this._onCanvasMousedown(ft,t.originalEvent.changedTouches[0].pageX,t.originalEvent.changedTouches[0].pageY),this._contextClickPosition(t.originalEvent.changedTouches[0],r)),window.getSelection().toString()||this._currentAnnotationRectangle.length!=0&&(f=this._currentAnnotationRectangle[0],e=f.TextMarkupAnnotationType?f.TextMarkupAnnotationType:f.type,e=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Highlight"&&this.model.enableHighlightAnnotation?(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle)):e=="Underline"&&this.model.enableUnderlineAnnotation&&(this._AnnotationPage=r,this._drawAnnotSelectRect(r,this._currentAnnotationRectangle))))));clearTimeout(this._timer);this._lockTimer=!1;var i=document.getElementById(this._id+"touchcustom-menu"),wt=t.originalEvent.changedTouches[0].clientX,bt=t.originalEvent.changedTouches[0].clientY,u=window.getSelection();if(u.anchorNode){y=u.getRangeAt(0);var et=y.cloneContents(),h=et.childNodes,ct=y.startContainer.parentElement.className;if(et.childElementCount!=0||this._longTouch){if(h.length>0)if(h[0].className=="e-waitingpopup e-js")for(b=0;b<h.length;b++)for(tt=n(h[b]).find(".text_container").children(),k=0;k<tt.length;k++)o.push(tt[k].id);else for(d=0;d<h.length;d++)ot=h[d].id,o.push(ot)}else ct=="e-pdfviewer-textLayer"?o.push(y.startContainer.parentElement.id):o.push(y.startContainer.id);for(g=0;g<o.length;g++)if(s.id==o[g]){this._touchcontextMenu=!0;break}else this._touchcontextMenu=!1}else this._touchcontextMenu=!1;if(this._rangePosition&&this._longTouch){n(".text_container").css("visibility","");var lt=n(i).outerHeight(),at=n(i).outerWidth(),it=this._rangePosition.width/2,vt=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"&&this.model.textSelectionContextMenu.isEnable?(n(i).show(),c=this._setTouchContextMenu(t),n(i).show(),n(i).offset({top:c.y,left:c.x}).show(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation())):!this._annotationActive&&this.model.textSelectionContextMenu.isEnable&&(n(i).show(),n(i).offset({top:this._rangePosition.top-lt+window.scrollY,left:this._rangePosition.left+it-at/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());this._longTouch=!1}else n(i).hide(),this._annotationActive&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation());if(this._annotationActive){if(this._touchcontextMenu){var u=window.getSelection(),l=document.createRange(),st=u.anchorNode.compareDocumentPosition(u.focusNode),ht=!1;(!st&&u.anchorOffset>u.focusOffset||st===Node.DOCUMENT_POSITION_PRECEDING)&&(ht=!0);ht?(l.setStart(u.focusNode,u.focusOffset),l.setEnd(u.anchorNode,u.anchorOffset)):(l.setStart(u.anchorNode,u.anchorOffset),l.setEnd(u.focusNode,u.focusOffset));var lt=n(i).outerHeight(),at=n(i).outerWidth(),yt=l.getBoundingClientRect(),a=l.getClientRects(),rt=a.length-1,kt=yt.width/2,v=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),it=n(v).outerWidth(),dt=n(v).outerHeight(),vt=window.getSelection().toString();vt!=""&&this.model.textSelectionContextMenu.isEnable&&(c=this._setTouchContextMenu(t),n(v).show(),n(v).offset({top:a[0].top+window.scrollY,left:a[0].left-it}).show(),n(nt).show(),n(nt).offset({top:a[rt].top+window.scrollY,left:a[rt].left+a[rt].width-it}).show(),n(i).show(),n(i).offset({top:c.y,left:c.x}).show());t.preventDefault()}}else 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||this.model.textSelectionContextMenu.isEnable&&(this._clearSelector(),this._clearText=!0);this._clearText&&(n(i).hide(),this._waterDropletDivHide(),this._clearText=!1)}else this.model.enableTextSelection||(v=document.getElementById(this._id+"droplet1"),nt=document.getElementById(this._id+"droplet2"),n(v).hide(),n(nt).hide(),this._disableSelection())},_onTextContainerMouseDown:function(t){var u,i,r,f;document.activeElement.id==this._id+"_toolbar_zoomSelection_wrapper"&&n("#"+this._id+"_toolbar_zoomSelection_wrapper").blur();this.model.enableTextSelection||(this._dragx=t.pageX,this._dragy=t.pageY,this._dragstate=!0);u=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection||u?this.model.enableTextSelection||(f=n("#"+this._id+"selectioncanvas_"+this._currentPage)[0].id,this._isCanasResized||this._isCanvasClicked||t.target.id!=f||(t.target.style.cursor="move",t.target.style.cursor="-webkit-grabbing",t.target.style.cursor="-moz-grabbing",t.target.style.cursor="grabbing"),this._disableSelection()):(this._enableSelection(),n(".text_container").css("visibility",""),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,this._removeSearch=!0,r=t.target.id.split("text_")[1],r&&(this._selectedValue=r.split("_")[0]),this._selectionStartPage=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1])),n("#"+this._id+"custom-menu").css("display")!="none"||t.which==3||n(i).hasClass("e-pdfviewer-secondarycanvas")||this._clearSelector(),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")&&this.model.enableTextSelection&&(t.preventDefault(),this._clearAllOccurrences(),this._enableSelection(),this._getElementTouch(i,t.clientX,t.clientY,!1),this._annotationActive&&!this._isAnnotationSelected&&(this._isStrikeout?this._drawStrikeOutAnnotation():this._isUnderline?this._drawUnderlineAnnotation():this._isHighlight&&this._drawHighlightAnnotation()),this._isAnnotationSelected&&(this._showPopupMenu(t),this._clearSelector(t)),t.preventDefault());t.originalEvent.detail==3&&n(i).hasClass("e-pdfviewer-textLayer")&&this.model.enableTextSelection?(this._enableSelection(),this._annotationActive||this._selectingEntireLine(t)):this.model.enableTextSelection||this._disableSelection()},_onTextContainerMouseMove:function(t){var r,i,h,u,f,y,e,o,c,l,a,s,v,p;this.model.enableTextSelection||t.target.className=="e-pdfviewer-imagecanvasDraw"||t.target.tagName.toLowerCase()=="a"?t.target.className!="e-pdfviewer-buttons"&&t.target.tagName.toLowerCase()!="a"&&(t.target.style.cursor="auto"):n("#"+this._id+"pageDiv_"+this._currentPage).css("cursor","-webkit-grab");r=navigator.userAgent.indexOf("MSIE")!=-1||!!document.documentMode==!0;t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||t.target.className=="e-pdfviewer-formFields"||(t.preventDefault(),this._enableSelection(),this._currentAnnotationRectangle=[],i=parseInt(t.target.id.split("text_")[1])||parseInt(t.target.id.split("selectioncanvas_")[1])||parseInt(t.target.id.split("secondarycanvas_")[1]),i&&!this._isPropertiesWindowOpen&&(r||(h=document.getElementById(this._id+"_secondarycanvas_"+i),this._onCanvasMousedown(h,t.pageX,t.pageY)),this.model.enableTextMarkupAnnotations&&(this._isPopupNoteVisible||this._isContextMenuPresent||(r||this._contextClickPosition(t,i),this._currentAnnotationRectangle.length==0||r?(n("#"+this._id+"_popup_note").css({display:"none"}),this.model.enableTextSelection?(t.target.style.cursor="auto",t.preventDefault(),this._enableSelection()):this.model.enableTextSelection||this._isCanasResized||this._isCanvasClicked||(y=n("#"+this._id+"pageDiv_"+this._currentPage),this._dragstate?(this._deltax=this._dragx-t.pageX,this._deltay=this._dragy-t.pageY,e=n("#"+this._id+"_viewerContainer").scrollTop(),o=n("#"+this._id+"_viewerContainer").scrollLeft(),this._deltay>3?n("#"+this._id+"_viewerContainer").scrollTop(e+20):this._deltay<-2&&n("#"+this._id+"_viewerContainer").scrollTop(e-20),this._deltax>3?n("#"+this._id+"_viewerContainer").scrollLeft(o+20):this._deltax<-2&&n("#"+this._id+"_viewerContainer").scrollLeft(o-20),t.target.style.cursor="move",t.target.style.cursor="-webkit-grabbing",t.target.style.cursor="-moz-grabbing",t.target.style.cursor="grabbing",this._dragx=t.pageX,this._dragy=t.pageY):(t.target.style.cursor="move",t.target.style.cursor="-webkit-grab",t.target.style.cursor="-moz-grab",t.target.style.cursor="grab"))):(u=this._currentAnnotationRectangle[0],f=u.TextMarkupAnnotationType?u.TextMarkupAnnotationType:u.type,f=="StrikeOut"&&this.model.enableStrikethroughAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):f=="Underline"&&this.model.enableUnderlineAnnotation?(this._showPopupNote(t),t.target.style.cursor="pointer"):f=="Highlight"&&this.model.enableHighlightAnnotation&&(this._showPopupNote(t),t.target.style.cursor="pointer"))))),n(".text_container").css("visibility",""),a=t.target,s=t.target.id.split("text_")[1],s&&(v=s.split("_")[0],this._isTextSelection=v==this._selectedValue?!0:!1),window.getSelection().toString()?this._selectionPages.indexOf(i)==-1&&i&&i!=0&&this._selectionPages.push(i):this._selectionPages=[],this.pageY=t.pageY,this._curDown==!0&&n("#"+this._id+"custom-menu").css("display")=="none"&&(this._removeSearch&&(this._clearAllOccurrences(),this._removeSearch=!1),c=t.clientY,l=t.clientX,(this._currentAnnotationRectangle.length==0||this._annotationActive&&this._isTextSelection)&&(p=this._getWordAtPoint(a,l,c)),t.preventDefault()))},_onTextContainerMouseLeave:function(t){var r,i,u,f;if(t.target.id==this._id+"_popupinnercontent"||t.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection){if(!this.model.enableTextSelection){f=this;n(window).on("mouseup",function(n){return f._dragstate=!1,n.preventDefault(),n.stopPropagation(),!1});this._disableSelection()}}else if(this._enableSelection(),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(n){n.target.id==this._id+"_popupinnercontent"||n.target.id==this._id+"_popupcontent"||!this.model.enableTextSelection?this.model.enableTextSelection||this._disableSelection():(this._enableSelection(),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 class='copyli'><a href='javascript:void(0);' class='copy'>Copy<\/a><\/li>");n(t).append("<li class='googlesearchli'><a href='javascript:void(0);' class='googleSearch'>Search Google For <\/a><\/li>");n(t).append("<li class='e-highlight-textli'><a href='javascript:void(0);' id = '"+this._id+"_highlight_contextmenu' class='e-highlight-text'>Highlight Text <\/a><\/li>");n(t).append("<li class='e-strikeout-textli'><a href='javascript:void(0);' id = '"+this._id+"_strikeout_contextmenu' class='e-strikeout-text'>Strikethrough Text <\/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 i,u="",h=document.documentMode||/Edge/.test(navigator.userAgent),e,l,f,o,s,r;if(!this._isCopyRestrict&&this._searchedText&&this._searchedText.length>0&&this._searchedText!=""&&this.model.enableTextSelection){if(this._enableSelection(),window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",this._searchedText),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;r=document.createElement("textarea");n(r).css("contenteditable","true");r.textContent=this._searchedText;r.style.position="fixed";document.body.appendChild(r);r.select();try{return document.execCommand("copy")}catch(c){console.warn("Copy to clipboard failed.",c)}finally{r&&document.body.removeChild(r);n("#"+this._id+"custom-menu").hide()}t.preventDefault()}else if(!this._isCopyRestrict&&this.model.enableTextSelection){if(this._enableSelection(),e=window.getSelection().getRangeAt(0).toString(),l=navigator.userAgent.indexOf("Firefox")>-1,window.clipboardData&&window.clipboardData.setData)return f=clipboardData.setData("Text",e),n("#"+this._id+"custom-menu")&&n("#"+this._id+"custom-menu").hide(),f;document.queryCommandSupported&&document.queryCommandSupported("copy")&&(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=e,r.style.position="fixed",document.body.appendChild(r),r.select(),h||(i.removeAllRanges(),i.addRange(u)));try{return document.execCommand("copy")}catch(c){console.warn("Copy to clipboard failed.",c)}finally{r&&document.body.removeChild(r);n("#"+this._id+"custom-menu").hide();h&&(i.removeAllRanges(),i.addRange(u))}t.preventDefault()}},_openInNewTab:function(){var t,i,r;t=this._searchedText&&this._searchedText.length>0&&this._searchedText!=""?this._searchedText: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,u,s,f,h,c,e,r;if(!this._isPopupNoteFocused&&!this._isCanvasClicked&&!this._isCanasResized){if(n.nodeType==n.TEXT_NODE)for(o=!1,this._isBackwardSelection=!1,r=n.ownerDocument.createRange(),u=window.getSelection(),u.anchorNode!=null&&(s=u.anchorNode.compareDocumentPosition(u.focusNode),(!s&&u.anchorOffset>u.focusOffset||s===Node.DOCUMENT_POSITION_PRECEDING)&&(o=!0,this._isBackwardSelection=!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),o?u.extend(n,f):u.extend(n,f+1),r.detach(),this._isTextSelection=!0,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._isTextSelection=!0,this._getWordAtPoint(n.childNodes[e],t,i);r.detach()}return this._isTextSelection=!1,null}},_getElementTouch:function(t,i,r,u){var y,h,l,o,a,d,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 g=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&&this.model.enableTextSelection){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()}else this.model.enableTextSelection||(this._disableSelection(),d=document.getElementById(this._id+"touchcustom-menu"),n(d).hide(),this._waterDropletDivHide());return f.detach(),g}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},_preventClick:function(t){var i;n(t.target).hasClass("e-pdfviewer-toolbarli-label")?(i=t.target,n(i).removeClass("e-active"),n(i).removeClass("e-hover")):(i=n(t.target).parents(".e-pdfviewer-toolbarli-label"),i.removeClass("e-active"),i.removeClass("e-hover"))},_toolbarHover:function(t){if(n(t.target).hasClass("e-pdfviewer-toolbarli-label")||n(t.target).parents().hasClass("e-pdfviewer-toolbarli-label")){var i;n(t.target).hasClass("e-pdfviewer-toolbarli-label")?(i=t.target,n(i).removeClass("e-hover")):(i=n(t.target).parents(".e-pdfviewer-toolbarli-label"),i.removeClass("e-hover"))}},_toolbarClick:function(t){var f=n("#"+this._id+"_popup_note"),s,i,u,e,o,r;if(f&&f.hide(),s=t.target,i=t.target,this._isToolbarClick)if(n("#"+this._id+"_rptTooltip").css("display","none"),n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")||n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow")||(this._selectionNodes=window.getSelection(),this._maintainSelection(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),(n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")||n(i).hasClass("e-pdfviewer-toolbar-underline")||n(i).hasClass("e-pdfviewer-toolbar-strikeout"))&&(document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1),this._displaySearch=!1,this._isDefaultColorSet=!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")){if(this._isAsynchronousDownload=!0,this._cancelDownloads=!1,u={},u.fileName=this._downloadfileName,u.status="is started",this._raiseClientEvent("downloadStart",u),this._cancelDownloads)return;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-select")||n(i).hasClass("e-pdfviewer-toolbar-select"))this._highlightSelectItems();else if(n(i).hasClass("e-pdfviewer-scroll")||n(i).hasClass("e-pdfviewer-toolbar-scroll"))this._highlightScrollItems();else if(n(i).hasClass("e-pdfviewer-sign")||n(i).hasClass("e-pdfviewer-toolbar-sign"))this._showSignatureDialog();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")){e=i;o=n(e).attr("id");switch(o){case this._id+"_fitWidth":this._applyFitToWidth();break;case this._id+"_fitPage":this._applyFitToPage()}}else n(i).hasClass("e-pdfviewer-find")?this._displaySearchBox():n(i).hasClass("e-pdfviewer-highlight-markup")||n(i).hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.highlightSettings.color),this._isDefaultColorSet=!0,this._initHighlight(),this._highlightSelectItems()):n(i).hasClass("e-pdfviewer-underline-markup")||n(i).hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.underlineSettings.color),this._isDefaultColorSet=!0,this._initUnderline(),this._highlightSelectItems()):n(i).hasClass("e-pdfviewer-strikeout-markup")||n(i).hasClass("e-pdfviewer-toolbar-strikeout")?this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._drawColor=null,this._toolbarColorpickerObject.option("value",this.model.strikethroughSettings.color),this._isDefaultColorSet=!0,this._initStrikeOut(),this._highlightSelectItems()):(n(i).hasClass("e-pdfviewer-dropdown-wrapper")||n(i).hasClass("e-pdfviewer-dropdown-arrow"))&&(r=n(i).parents(".e-pdfviewer-toolbarli"),r.hasClass("e-pdfviewer-toolbar-underline")?this.model.enableTextMarkupAnnotations&&this.model.enableUnderlineAnnotation&&(this._displayColorPicker("Underline"),this._setPickerPosition(r[0]),this._isUnderlineEnabled=!1,this._initUnderline(),this._highlightSelectItems()):r.hasClass("e-pdfviewer-toolbar-highlight")?this.model.enableTextMarkupAnnotations&&this.model.enableHighlightAnnotation&&(this._displayColorPicker("Highlight"),this._setPickerPosition(r[0]),this._isHighlightEnabled=!1,this._initHighlight(),this._highlightSelectItems()):r.hasClass("e-pdfviewer-toolbar-strikeout")&&this.model.enableTextMarkupAnnotations&&this.model.enableStrikethroughAnnotation&&(this._displayColorPicker("StrikeOut"),this._setPickerPosition(r[0]),this._isStrikeOutEnabled=!1,this._initStrikeOut(),this._highlightSelectItems()))},_enableSelectionOnly:function(){n("#"+this._id+"_pdfviewer_toolbar_select").hasClass("e-disable")?(this.model.enableTextSelection=!1,this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_select"),this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_scroll")):this._isCopyRestrict||(this.model.enableTextSelection=!0,this._enableSelection())},_enableScrollingOnly:function(){this.model.enableTextSelection=!1;this._disableSelection()},_highlightSelectItems:function(){this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_select");this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_scroll");this._enableSelectionOnly()},_highlightScrollItems:function(){this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_select");this._toolbar.selectItemByID(this._id+"_pdfviewer_toolbar_scroll");this._waterDropletDivHide();this._enableScrollingOnly()},_cancelDownload:function(){this._cancelDownloads=!0;this._ajaxDownloaded!=null&&(this._ajaxDownloaded.abort(),this._ajaxDownloaded=null)},_save:function(n){var i,t,u,r;i=this.fileName.indexOf("\\")==-1?this.fileName:this.fileName.replace(/^.*[\\\/]/,"");t=navigator.userAgent;u="";n.documentStream&&(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,u,i):window.navigator.msSaveOrOpenBlob(r,i):window.navigator.msSaveOrOpenBlob(r,i))},_base64toBlob:function(n,t,i){var e,o,r,f,s,u,h;if(t=t||"",i=i||512,e=[],n)for(o=atob(n),r=0;r<o.length;r+=i){for(f=o.slice(r,r+i),s=new Array(f.length),u=0;u<f.length;u++)s[u]=f.charCodeAt(u);h=new Uint8Array(s);e.push(h)}return new Blob(e,{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);this._setViewerContainerHeight()},_setViewerContainerHeight:function(){var f=document.getElementById(this._id).clientHeight,t=0,i,e,r,u;this._isDevice||(i=n("#"+this._id+"_viewBlockContainer"),i.css("display").toLowerCase()=="block"&&(t=i.height()));e=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();r=n("#"+this._id+"_toolbarContainer").css("display");r.toLowerCase()=="block"?u=f-t-e-4:r.toLowerCase()=="none"&&(u=f-t-4);n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t&&(t._selectItemByIndex(0),t.disable());n("#"+this._id+"_txtpageNo").attr("disabled","disabled");this._toolbar&&(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&&!this.model.toolbarSettings.templateId&&(this._isDevice||(n("#"+this._id+"_txtpageNo").removeAttr("disabled"),n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable()))},_showLocalizationTooltip:function(t){n("#"+this._id+"_rptTooltip").css("display")=="none"&&this._showLocaleTooltip(t)},_hideLocalizationTooltip:function(){n("#"+this._id+"_rptTooltip").css("display","none")},_showLocaleTooltip:function(i){var l=i.target,r,h,e,u,o,s,y;if(l.id==this._id+"_pdfviewer_findlabel"&&(u=n("#"+this._id+"_pdfviewer_findlabel")[0],u.scrollWidth>n(u).innerWidth()&&(u&&(r=u.getBoundingClientRect()),o=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],h="",e=o.contextMenu.Find.contentText)),l.id==this._id+"_pdfviewer_matchlabel"&&(u=n("#"+this._id+"_pdfviewer_matchlabel")[0],u.scrollWidth>n(u).innerWidth()&&(u&&(r=u.getBoundingClientRect()),o=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],h="",e=o.contextMenu.matchCase.contentText)),e){s=this._viewerMaxZindex();n("#"+this._id+"_rptTooltip_Header").html(h);n("#"+this._id+"_rptTooltip_Content").html(e);var f=document.getElementById(this._id+"_pdfviewer_searchbox").getBoundingClientRect(),c=n("#"+this._id+"_toolbarContainer")[0].getBoundingClientRect(),a=this.element[0].clientWidth,v=parseFloat(n("#"+this._id+"_rptTooltip").css("min-width"));a<=r.left+v?(n("#"+this._id+"_rptTooltip").css({zIndex:s+1,top:r.top-f.top+f.height-18,left:r.left-c.left+r.width/2-v,display:"block",position:"absolute"}),y=parseFloat(n("#"+this._id+"_rptTooltip").css("left")),y<0&&n("#"+this._id+"_rptTooltip").css("left","0px")):a<=r.left+2*r.width?n("#"+this._id+"_rptTooltip").css({zIndex:s+1,top:r.top-f.top+f.height-18,left:r.left-c.left-3*r.width,display:"block",position:"absolute"}):n("#"+this._id+"_rptTooltip").css({zIndex:s+1,top:r.top-f.top+f.height-18,left:r.left-c.left+r.width/2,display:"block",position:"absolute"})}},_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,st,s,h,nt,tt,it,rt,ut,ft,et,ot,c,lt;if(this.model&&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;st=n(g).attr("id");switch(st){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")):n(r).hasClass("e-pdfviewer-highlight-markup")||n(r).hasClass("e-pdfviewer-toolbar-highlight")?(it=n("#"+this._id+"_toolbarContainer .e-pdfviewer-highlight-markup")[0],i=it?it.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-highlight-markup")[0].getBoundingClientRect(),u=this._getTootipText("highlight")):n(r).hasClass("e-pdfviewer-strikeout-markup")||n(r).hasClass("e-pdfviewer-toolbar-strikeout")?(rt=n("#"+this._id+"_toolbarContainer .e-pdfviewer-strikeout-markup")[0],i=rt?rt.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-strikeout-markup")[0].getBoundingClientRect(),u=this._getTootipText("strikeout")):n(r).hasClass("e-pdfviewer-underline-markup")||n(r).hasClass("e-pdfviewer-toolbar-underline")?(ut=n("#"+this._id+"_toolbarContainer .e-pdfviewer-underline-markup")[0],i=ut?ut.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist .e-pdfviewer-underline-markup")[0].getBoundingClientRect(),u=this._getTootipText("underline")):n(r).hasClass("e-pdfviewer-sign")||n(r).hasClass("e-pdfviewer-toolbar-sign")?(ft=n("#"+this._id+"_toolbarContainer .e-pdfviewer-sign")[0],i=ft?ft.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist  .e-pdfviewer-sign")[0].getBoundingClientRect(),u=this._getTootipText("signature")):n(r).hasClass("e-pdfviewer-select")||n(r).hasClass("e-pdfviewer-toolbar-select")?(et=n("#"+this._id+"_toolbarContainer .e-pdfviewer-select")[0],i=et?et.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist  .e-pdfviewer-select")[0].getBoundingClientRect(),u=this._getTootipText("select")):(n(r).hasClass("e-pdfviewer-scroll")||n(r).hasClass("e-pdfviewer-toolbar-scroll"))&&(ot=n("#"+this._id+"_toolbarContainer .e-pdfviewer-scroll")[0],i=ot?ot.getBoundingClientRect():n("#"+this._id+"_toolbarContainer_hiddenlist  .e-pdfviewer-scroll")[0].getBoundingClientRect(),u=this._getTootipText("scroll"));if(u&&l){c=this._viewerMaxZindex();n("#"+this._id+"_rptTooltip_Header").html(u.header);n("#"+this._id+"_rptTooltip_Content").html(u.content);var e=document.getElementById(this._id+"_toolbarContainer").getBoundingClientRect(),ht=this.element[0].clientWidth,ct=parseFloat(n("#"+this._id+"_rptTooltip").css("min-width"));ht<=i.left+ct?(n("#"+this._id+"_rptTooltip").css({zIndex:c+1,top:i.top-e.top-21,left:i.left-e.left+i.width/2-ct,display:"block",position:"absolute"}),lt=parseFloat(n("#"+this._id+"_rptTooltip").css("left")),lt<0&&n("#"+this._id+"_rptTooltip").css("left","0px")):ht<=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 r=this.element.parents(),u=n("body").children(),e=u.index(this.popup),i,f,t;return u.splice(e,1),n(u).each(function(n,t){r.push(t)}),i=n(this.model.target).children(),f=i.index(this.popup),i.splice(f,1),n(i).each(function(n,t){r.push(t)}),t=Math.max.apply(t,n.map(r,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;break;case"highlight":r=i.toolbar.highlight.headerText;u=i.toolbar.highlight.contentText;break;case"strikeout":r=i.toolbar.strikeout.headerText;u=i.toolbar.strikeout.contentText;break;case"underline":r=i.toolbar.underline.headerText;u=i.toolbar.underline.contentText;break;case"signature":r=i.toolbar.signature.headerText;u=i.toolbar.signature.contentText;break;case"select":r=i.toolbar.select.headerText;u=i.toolbar.select.contentText;break;case"scroll":r=i.toolbar.scroll.headerText;u=i.toolbar.scroll.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;this._ajaxDownloaded=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")},_showSelectionButtons:function(t){t?(n("#"+this._id+"_pdfviewer_selectul").css("display","block"),n("#"+this._id+"_pdfviewer_signatureul").addClass("e-separator"),this._isSelectionHidden=!1):(n("#"+this._id+"_pdfviewer_selectul").css("display","none"),n("#"+this._id+"_pdfviewer_signatureul").removeClass("e-separator"),this._isSelectionHidden=!0)},_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(i){n("#"+this._id+"e-pdf-viewer").css({position:"relative"});var r=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],u=r.waitingPopup.print.contentText;n("#"+this._id+"e-pdf-viewer").ejWaitingPopup({showOnInit:i,text:u,cssClass:"e-pdfviewer-waitingpopup-print",appendTo:"#"+this._id+"e-pdf-viewer"})},_viewerResize:function(){var t,h,c,o,l,a,v,w,s,i,f,d;this.element==null&&(this.element=n("#"+this._id));this.model==null&&(this.model=n("#"+this._id).ejPdfViewer("instance").model);t=this;t._isPinchZoomed=!1;var y=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,p=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,e=n(t.element).height(),u=n(t.element).width();if(p.indexOf("%")!=-1?(t._isPercentHeight=parseInt(p),h=t._isHeight?n(t.element).parent().height():e,e=t._isHeight?h:h/100*t._isPercentHeight):t.element[0].parentElement.clientHeight!=0&&t._isPercentHeight!=-1?e=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&t.element[0].parentElement.clientHeight!=0&&(e=t.element[0].parentElement.clientHeight),t.element.height(e),o=0,t.element[0].parentElement&&(l=getComputedStyle(t.element[0].parentElement),c=parseFloat(l.paddingLeft),o=parseFloat(l.paddingRight)),y.indexOf("%")!=-1?(t._isPercentWidth=parseInt(y),a=t._isWidth?n(t.element).parent().width():u,u=t._isWidth?a:a/100*t._isPercentWidth):t.element[0].parentElement.clientWidth!=0&&t._isPercentWidth!=-1?(v=t.element[0].parentElement.clientWidth-c-o,u=t._isWidth?v:v/100*t._isPercentWidth):t._isWidth&&t.element[0].parentElement.clientWidth!=0&&(u=t.element[0].parentElement.clientWidth-c-o),t.element.width(u),t._toolbar._activeItem=r,t._toolbar._reSizeHandler(),u<=500?n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:u/2-307/2+"px",Y:e/2+"px"},width:"auto",height:"auto"}):n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:u/2-250+"px",Y:e/2+"px"},width:"500px",height:"322px"}),w=Math.max(0,(n(window).height()-n("#"+this._id+"_containerDialogTab").outerHeight())/2+n(window).scrollTop())+"px",s=Math.max(0,(n(window).width()-n("#"+this._id+"_containerDialogTab").outerWidth())/2+n(window).scrollLeft())+"px",n("#"+this._id+"_containerDialogTab").ejDialog({position:{X:s,Y:w}}),u<=500||window.innerHeight<=500){if(n("#"+this._id+"_signatureContainerDialogTab").ejDialog({width:"auto",height:"auto"}),i=n("#"+this._id+"_imageTemp")[0],i.height=100,i.width=u,i.style.height="100px",i.style.width=u+"px",f=t.element[0].parentElement.parentElement.parentElement,f){var s=f.offsetWidth,g=f.offsetHeight,b=s/2-i.width/2,k=window.innerHeight/2-i.height/2;n("#"+this._id+"_signatureContainerDialogTab").ejDialog({position:{X:b+"px",Y:k+"px"}})}}else if(i=n("#"+this._id+"_imageTemp")[0],i.height=400,i.width=470,i.style.height="400px",i.style.width="470px",f=t.element[0].parentElement.parentElement.parentElement,f){var s=f.offsetWidth,g=f.offsetHeight,b=s/2-i.width/2,k=window.innerHeight/2-i.height/2;n("#"+this._id+"_signatureContainerDialogTab").ejDialog({height:"503px"});n("#"+this._id+"_signatureContainerDialogTab").ejDialog({position:{X:b+"px",Y:k+"px"}})}n("#"+t._id+"_pdfviewer_searchul").removeClass("e-separator");n("#"+t._id+"_pdfviewer_downloadul").removeClass("e-separator");document.getElementById(t._id+"_pdfviewer_colorpicker").style.display="none";t._isToolbarColorPicker=!1;this._setViewerContainerHeight();t._toolbarResizeHandler();t._resizeSearchToolbar();d=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();t.model&&t.model.isResponsive&&t._renderedCanvasList.length>0&&t._isAutoZoom&&t._applyFitToWidthAuto();t.model&&t._fitType=="fitToWidth"&&!t.model.isResponsive&&t._applyFitToWidth();t._isViewerRestored=!1;t._isAutoSelected=!1;t._isWindowResizing=!0;t._applyLeftPosition()},_applyLeftPosition:function(){for(var i,r,t=1;t<=this._totalPages;t++){i=this._fitType=="fitToWidth"||this._isAutoZoom&&this._zoomVal<1?5:this._pageSize[t-1].PageRotation==90||this._pageSize[t-1].PageRotation==270?(this.element.width()-this._pageSize[t-1].PageHeight*this._zoomVal)/2:(this.element.width()-this._pageSize[t-1].PageWidth*this._zoomVal)/2;var u=i+this._pageSize[t-1].PageWidth*this._zoomVal,e=n("#"+this._id+"_pageviewContainer"),f=e.width();(i<0||this._fitType=="fitToPage"&&this._pageSize[t-1].PageOrientation=="Landscape"&&u>f)&&(i=u>f?0:5);r=document.getElementById(this._id+"pageDiv_"+t);r&&(r.style.left=i+"px")}},_toolbarResizeHandler:function(){var t=n("#"+this._id+"_toolbarContainer");n("#"+this._id+"_pdfviewer_printul").parent()[0]!=t[0]?(this._isDownloadCntlHidden||(t.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),this._isDownloadCntlHidden=!0),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"right"})):n("#"+this._id+"_pdfviewer_printul").parent()[0]==t[0]&&(n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").css({float:"right"}),n("#"+this._id+"_pdfviewer_searchul").css({float:"right"}),n("#"+this._id+"_pdfviewer_selectul").removeClass("e-separator"));n("#"+this._id+"_pdfviewer_downloadul").parent()[0]!=t[0]?this._isDownloadCntlHidden&&(this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._isDownloadCntlHidden=!1,n("#"+this._id+"_pdfviewer_searchul").css({float:"left"})):n("#"+this._id+"_pdfviewer_downloadul").parent()[0]==t[0]&&(n("#"+this._id+"_pdfviewer_downloadul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_downloadul").css({float:"right"}),t.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),t.append(n("#"+this._id+"_pdfviewer_printul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_toolbarContainer_target").addClass("e-display-none"),n("#"+this._id+"_toolbarContainer_target").removeClass("e-display-block"));n("#"+this._id+"_pdfviewer_searchul").parent()[0]!=t[0]&&(this._isSearchHidden||(this._isSearchHidden=!1,t.append(n("#"+this._id+"_pdfviewer_selectul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_searchul").css({float:"left"}),n("#"+this._id+"_pdfviewer_printul").css({float:"left","padding-right":"10px"}),n("#"+this._id+"_pdfviewer_downloadul").css({float:"left"}),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),n("#"+this._id+"_pdfviewer_searchul").addClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").addClass("e-separator")));n("#"+this._id+"_pdfviewer_selectul").parent()[0]!=t[0]&&(n("#"+this._id+"_pdfviewer_textmarkupul").parent()[0]!=t[0]&&(this._isZoomCntlHidden=!0,this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_zoomul")[0])),this._isSearchHidden=!0,t.append(n("#"+this._id+"_pdfviewer_selectul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_textmarkupul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_signatureul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_printul")[0]),this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_downloadul")[0]),n("#"+this._id+"_pdfviewer_printul").css({float:"left","padding-right":"10px"}),n("#"+this._id+"_pdfviewer_downloadul").css({float:"left"}),n("#"+this._id+"_pdfviewer_searchul").css({float:"left"}),n("#"+this._id+"_pdfviewer_selectul").addClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").addClass("e-separator"));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_textmarkupul")[0]),t.append(n("#"+this._id+"_pdfviewer_signatureul")[0]),t.append(n("#"+this._id+"_pdfviewer_selectul")[0]),t.append(n("#"+this._id+"_pdfviewer_searchul")[0]),n("#"+this._id+"_pdfviewer_printul").css({float:"right","padding-right":"0px"}),n("#"+this._id+"_pdfviewer_downloadul").css({float:"right"}),n("#"+this._id+"_pdfviewer_searchul").css({float:"right","padding-right":"0px"}),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_selectul").removeClass("e-separator"),this._isZoomCntlHidden=!1);this._isToolbarHeightChanged&&(this._toolbar._liTemplte.append(n("#"+this._id+"_pdfviewer_signatureul")[0]),this._isToolbarHeightChanged=!1);n("#"+this._id+"_toolbarContainer_target").hasClass("e-display-block")&&n("#"+this._id+"_toolbarContainer_hiddenlist")[0].childElementCount==2&&(n("#"+this._id+"_pdfviewer_searchul").css({float:"left"}),n("#"+this._id+"_pdfviewer_selectul").addClass("e-separator"))},_overflowToolbarClose:function(){document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none";this._isToolbarColorPicker=!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 u=document.createElement("Style"),r,e,f;u.id="e-pdfviewer-arrow-responsive";document.head.appendChild(u);r=u.sheet;!navigator.userAgent.match("Firefox")&&r?(e=i.getBoundingClientRect(),f=t.left-e.left,r.addRule(".e-pdfviewer-arrow::before","left:"+f+"px"),r.addRule(".e-pdfviewer-arrow::after","left:"+f+"px")):n("#"+this._id+"_pdfviewer_searchbox").removeClass("e-pdfviewer-arrow")},_ideviceScrolling:function(){var i=/iPhone|iPad|iPod/i.test(navigator.userAgent),n,t;i&&(n=document.createElement("Style"),n.id=this._id+"-pdfviewer-scrolling",document.head.appendChild(n),t=n.sheet,t.addRule("#"+this._id+"_viewerContainer","-webkit-overflow-scrolling:touch"))},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()},abortDownload:function(){this._cancelDownload()},viewerResize:function(){this._viewerResize()},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)},showTextMarkupAnnotationTools:function(n){this._showTextMarkupButtons(n)},showSignatureTool:function(n){this._showSignatureButtons(n)},addSignature:function(){this._showSignatureDialog()},showSelectionTool:function(n){this._showSelectionButtons(n)},showToolbar:function(n){this._showToolbar(n)},setJSONData:function(n){n!=null&&n!=""&&(this._responseData=n)},updateViewerSize:function(){this._setViewerContainerHeight()},unload:function(){this._unLoad()},load:function(i){var h,o,e,u,s,f;if(n("#"+this._id+"_viewerContainer").scrollTop(0),this._showloadingIndicator(!0),this.isDocumentEdited=!1,this._fitType=null,this.model.isResponsive=!0,this._isAutoZoom=!0,n("#"+this._id+"_pageviewContainer").find(".e-waitingpopup").css("visibility",""),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._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_signature"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_select"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_scroll"),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_highlight"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_underline"),this._toolbar.deselectItemByID(this._id+"_pdfviewer_toolbar_strikeout"),this._isHighlightEnabled=!1,this._isUnderlineEnabled=!1,this._isStrikeOutEnabled=!1,this._isHighlight=!1,this._isUnderline=!1,this._isStrikeout=!1,this._annotationActive=!1,this._isCopyRestrict=!1,this._isPrintRestrict=!1,this._isFormFieldsDisabled=!1,this._renderPages=[],this._zoomVal=1,this._zoomLevel=3,this._pdfFileName==this.fileName&&(this._fileName="",this.fileName=null),this._textlayout=[],this._signatureLayer=[],this._newAnnotationList=[],h=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],o=h.contextMenu.auto.contentText,n("#"+this._id+"_toolbar_zoomSelection_hidden").val(o),this._ejDropDownInstance.model.value=o,this._initToolbar(),i)for(e=this._canvascount;e>=1;)n("#"+this._id+"pageDiv_"+e).remove(),e--;this._ajaxState!=null&&(this._ajaxState.abort(),this._ajaxState=null,this._scrollTriggered=!1);window.clearInterval(this._scrollTimer);u={};u.viewerAction="GetPageModel";u.controlId=this._id;u.pageindex="1";u.isInitialLoading="true";u.zoomValue=this._zoomVal;s=i.split("base64,")[1];s==r?(this._fileName=i,u.newFileName=this._fileName,this._fileId=this._createGUID(),u.id=this._fileId,this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,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=s,this.fileName&&(u.newFileName=this.fileName),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")))},searchText:function(n){this._searchText=n;this._displaySearch=!0;this._isFindboxPresent=!0;this._textSearch()},searchNext:function(){this._nextSearch()},searchPrevious:function(){this._prevSearch()},matchCase:function(n){this._isMatchCase=n?!0:!1;this._textSearch()},cancelSearchText:function(){this._searchText="";this._displaySearch=!1;this._isFindboxPresent=!1;this._clearAllOccurrences()},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(i){i<50?i=50:i>400&&(i=400);this._isMobileDevice&&i>200&&(i=200);var r=parseInt(i)/100,u=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],f=u.contextMenu.auto.contentText;i==f?(r=1,this.model.isResponsive=!0,this._isAutoZoom=!0):(i=i+"%",this.model.isResponsive=!1,this._isAutoZoom=!1);this._calculateZoomLevel(r);this._zoomContainer(r,!1);n("#"+this._id+"_toolbar_zoomSelection_hidden").val(i);this._ejDropDownInstance.model.selectedIndices[0]="";n("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active");this._ejDropDownInstance.model.value=i},undo:function(){this._isPropertiesWindowOpen||this._undo()},redo:function(){this._isPropertiesWindowOpen||this._redo()},addAnnotation:function(n){n==t.PdfViewer.AnnotationType.Highlight?this._addAnnotation("Highlight"):n==t.PdfViewer.AnnotationType.Underline?this._addAnnotation("Underline"):n==t.PdfViewer.AnnotationType.Strikethrough&&this._addAnnotation("StrikeOut")}});t.PdfViewer.ToolbarItems={MagnificationTools:1,PageNavigationTools:2,PrintTools:4,DownloadTool:8,TextSearchTool:16,TextMarkupAnnotationTools:32,SignatureTool:64,SelectionTool:128,All:255};t.PdfViewer.PdfService={Local:1,Remote:2};t.PdfViewer.LinkTarget={Default:1,NewTab:2,NewWindow:4};t.PdfViewer.AnnotationType={Underline:1,Strikethrough:2,Highlight:4};t.PdfViewer.InteractionMode={TextSelection:1,Pan:2};t.PdfViewer.BufferingMode={Default:1,Complete:2};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."},highlight:{headerText:"Highlight Text",contentText:"Highlight text in the PDF pages."},strikeout:{headerText:"Strikethrough Text",contentText:"Strikethrough text in the PDF pages."},underline:{headerText:"Underline Text",contentText:"Underline text in the PDF pages."},signature:{headerText:"Signature",contentText:"Add or create hand-written signature."},select:{headerText:"Selection",contentText:"Selection tool for text."},scroll:{headerText:"Panning",contentText:"Click to pan around the document"}},contextMenu:{copy:{contentText:"Copy"},googleSearch:{contentText:"Search google"},openPopup:{contentText:"Open Pop-Up Note"},Delete:{contentText:"Delete"},properties:{contentText:"Properties...."},Find:{contentText:"Find:"},matchCase:{contentText:"Match Case"},auto:{contentText:"Auto"}},propertyWindow:{underlineProperties:{contentText:"Underline Properties"},strikeOutProperties:{contentText:"StrikeOut Properties"},highlightProperties:{contentText:"Highlight Properties"},signatureProperties:{contentText:"Signature Properties"},appearance:{contentText:"Appearance"},general:{contentText:"General"},color:{contentText:"Color:"},opacity:{contentText:"Opacity:"},author:{contentText:"Author:"},subject:{contentText:"Subject:"},modified:{contentText:"Modified:"},ok:{contentText:"OK"},cancel:{contentText:"Cancel"},locked:{contentText:"Locked"}},signatureWindow:{Signature:{contentText:"Add Signature"},Add:{contentText:"Add"},clear:{contentText:"Clear"}},waitingPopup:{print:{contentText:"Preparing document for printing..."}}}})(jQuery,Syncfusion)});
  