assets.js.GroupdocsViewer.all.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groupdocs-viewer Show documentation
Show all versions of groupdocs-viewer Show documentation
GroupDocs.Viewer for Java is a powerful document viewer component
that allows you to display over 50 document formats in your Java applications.
The viewer can both rasterize documents and convert them to SVG+HTML+CSS, delivering true-text high-fidelity rendering.
Supported file formats include: Microsoft Office, Microsoft Visio, Microsoft Project, Outlook documents, PDF, AutoCAD, Image files (JPG, BMP, GIF, TIFF, etc.) and many more formats.
if(window.jGroupdocs||(window.jGroupdocs={}),window.jGroupdocs.stringExtensions={format:function(e){for(var t=e,i=arguments.length;--i;)t=t.replace(new RegExp("\\{"+(i-1)+"\\}","gm"),arguments[i]);return t},trim:function(e,t){var i=new RegExp("^["+t+"]+|["+t+"]+$","g");return e.replace(i,"")},trimStart:function(e,t){var i=new RegExp("^["+t+"]+","g");return e.replace(i,"")},trimEnd:function(e,t){var i=new RegExp("["+t+"]+$","g");return e.replace(i,"")},getAccentInsensitiveRegexFromString:function(e){function t(e){return e.replace(n,function(e){return"["+e+i[e]+"]"})}var i={a:"àáâãäåæ",c:"ç",e:"èéêëæ",i:"ìíîï",n:"ñ",o:"òóôõöø",s:"ß",u:"ùúûü",y:"ÿ"},n=/[aceinosuy]/g;return t(e)},_padWithLeadingZeros:function(e){return new Array(5-e.length).join("0")+e},_unicodeCharEscape:function(e){return"\\u"+this._padWithLeadingZeros(e.toString(16))},unicodeEscape:function(e){var t=this;return e.split("").map(function(e){var i=e.charCodeAt(0);return i>127?t._unicodeCharEscape(i):e}).join("")}},window.jGroupdocs.http={splitUrl:function(){var e=new RegExp("(\\w+)://([^/]+)([^?]*)([?].+)?");return function(t){var i=t.match(e),n=i.length>3?i[3]:null,o=i.length>4?i[4]:null;return{schema:i[1],authority:i.length>2?i[2]:null,path:n,query:o,queryDict:$.fn.q(o),pathAndQuery:o?n+o:n}}}()},JsInject={Container:function(){this.serviceEntries=[],this.disposables=[]}},JsInject.Container.prototype.Resolve=function(e,t,i,n,o,s,r,a,l,h){return this.ResolveInternal(e,!0,t,i,n,o,s,r,a,l,h)},JsInject.Container.prototype.TryResolve=function(e,t,i,n,o,s,r,a,l,h){return this.ResolveInternal(e,!1,t,i,n,o,s,r,a,l,h)},JsInject.Container.prototype.RegisterInternal=function(e,t,i,n){if(this.RegisteredInternal(e))throw"Factory with name '"+e+"' alredy registered";this.serviceEntries[e]={factory:t,scope:i,owner:n,instance:null}},JsInject.Container.prototype.Dispose=function(){for(var e in this.disposables)this.disposables[e].Dispose()},JsInject.Container.prototype.ResolveInternal=function(e,t,i,n,o,s,r,a,l,h,u){if(!this.RegisteredInternal(e)){if(t)throw"Factory with name '"+e+"' is not registered";return null}return e=this.serviceEntries[e],"container"===e.scope?(null===e.instance&&(e.instance=this.CreateInstanceInternal(e.factory,e.owner,i,n,o,s,r,a,l,h,u)),e.instance):this.CreateInstanceInternal(e.factory,e.owner,i,n,o,s,r,a,l,h,u)},JsInject.Container.prototype.CreateInstanceInternal=function(e,t,i,n,o,s,r,a,l,h,u){return e=e(this,i,n,o,s,r,a,l,h,u),"container"===t&&"function"==typeof e.Dispose&&this.disposables.push(e),e},JsInject.Container.prototype.RegisteredInternal=function(e){return void 0!==this.serviceEntries[e]},JsInject.Registration=function(e,t){this.name=e,this.factory=t,this.scope="none",this.owner="consumer"},JsInject.Registration.prototype.Reused=function(){return this.scope="container",this.Owned(),this},JsInject.Registration.prototype.Owned=function(){return this.owner="container",this},JsInject.ContainerBuilder=function(){this.registrations=[]},JsInject.ContainerBuilder.prototype.Register=function(e,t){var i=new JsInject.Registration(e,t);return this.registrations.push(i),i},JsInject.ContainerBuilder.prototype.Create=function(){var e,t=new JsInject.Container;for(e in this.registrations){var i=this.registrations[e];t.RegisterInternal(i.name,i.factory,i.scope,i.owner)}return t},JsInject.Container.prototype.Register=function(e,t,i){e=new JsInject.Registration(e,t),i&&e.Reused(),this.RegisterInternal(e.name,e.factory,e.scope,e.owner)},window.jSaaspose||(window.jSaaspose={}),!window.Container){window.Container=new JsInject.Container,Container.Register("Cacher",function(){return $.jCacher},!0),Container.Register("Rx.Observable",function(){return Rx.Observable},!0),Container.Register("RequestObservable",function(){return $.ajaxAsObservable},!0),Container.Register("AsyncSubject",function(){return new Rx.AsyncSubject},!1);var host=window.location.hostname+(window.location.port?":"+window.location.port:""),applicationPath=$.ui.groupdocsViewer.prototype.applicationPath;if("/"!=applicationPath){var slashPosition=applicationPath.indexOf("//"),hostNamePosition=slashPosition+2;applicationPath.indexOf(host,hostNamePosition)!=hostNamePosition&&($.ui.groupdocsViewer.prototype.isWorkingCrossDomain=!0)}Container.Register("PortalService",function(){return new jSaaspose.PortalService($.ui.groupdocsViewer.prototype.applicationPath,$.ui.groupdocsViewer.prototype.useHttpHandlers,$.ui.groupdocsViewer.prototype.isWorkingCrossDomain)},!0),Container.Register("HttpProvider",function(){return{buildUrl:function(e,t,i){var n=jGroupdocs.stringExtensions.trimEnd(e,"/");return t&&t.length>0&&(n+="/"+jGroupdocs.stringExtensions.trimStart(t,"/")),i&&(n+=(-1!=n.indexOf("&")||-1!=n.indexOf("?")?"&":"?")+jQuery.param(i)),n},signUrl:function(){return""}}},!0)}!function(e){e.fn.ellipsis=function(t){var i=document.documentElement.style;return"textOverflow"in i||"OTextOverflow"in i?this:this.each(function(){var i=e(this);if("hidden"==i.css("overflow")){var n=i.html(),o=(i.width(),e(this.cloneNode(!0)).hide().css({position:"absolute",width:"auto",overflow:"visible","max-width":"inherit"}));i.after(o);for(var s=n;s.length>0&&o.width()>i.width();)s=s.substr(0,s.length-1),o.html(s+"...");if(i.html(o.html()),o.remove(),1==t){var r=i.width();setInterval(function(){i.width()!=r&&(r=i.width(),i.html(n),i.ellipsis())},200)}}})}}(jQuery),function(e){e.fn.innerTip=function(t){return this.each(function(){var i=e(this);i.focusin(function(){i.hasClass("empty")&&(i.val(""),i.removeClass("empty"))}),i.focusout(function(){""==i.val()&&(i.val(t.text),i.addClass("empty"))}),i.bind("reset",function(){i.val(t.text),i.addClass("empty")}),i.val(t.text),i.addClass("empty")})}}(jQuery),function(e){var t={classes:[]};e.fn.corners=function(i){return this.each(function(){var n=e(this);-1===e.inArray(i.id,t.classes)&&(t.classes.push(i.id),e("body").append('")),n.css({position:"relative"}),n.prepend(''),n.append('')})}}(jQuery),function(e){e.fn.hitch=function(e,t,i,n){return this.bind(e,n,function(){return t.apply(i||this,Array.prototype.slice.call(arguments))})}}(jQuery),function(e){e.fn.q=function(t){var i={};if(t){var t=t.replace(/^\?/,"").replace(/\&$/,"");e.each(t.split("&"),function(){var e=this.split("=")[0],t=this.split("=")[1];/^[0-9.]+$/.test(t)&&(t=parseFloat(t)),t&&(i[e]=t)})}return i}}(jQuery),function(e){var t=function(e){e.preventDefault()},i=function(e){e.click(t),e.is("input[type='submit'],input[type='button']")&&e.attr("disabled","disabled")},n=function(t,n,o){var s=t.data("clone");s||(s=t.clone(!1),e.each(s[0].attributes,function(e,t){null!=t&&"class"!=t.name&&s.attr(t.name,"")}),""!=n&&s.addClass(n),i(s),t.data("clone",s),t.after(s)),s.attr("title",o),t.hide(),s.show()},o=function(e){var t=e.data("clone");t&&(e.show(),t.hide())};e.fn.activator=function(t){return this.each(function(){var i=e(this);return"enable"==t.action?void o(i):void("disable"==t.action&&n(i,t.cl,t.tip))})},e.fn.isEnable=function(){var t=e(this),i=t.data("clone");return i&&i.is(":visible")?!1:!0}}(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(e){return"string"==typeof e&&(e=document.getElementById(e)),e.addClass||(e.hide=function(){this.style.display="none"},e.show=function(){this.style.display=""},e.addClass=function(e){this.removeClass(e),this.className+=" "+e},e.removeClass=function(e){for(var t=this.className.split(/\s+/),i=-1,n=0;n-1&&(t.splice(i,1),this.className=t.join(" ")),this},e.hasClass=function(e){return!!this.className.match(new RegExp("\\s*"+e+"\\s*"))}),e},setMoviePath:function(e){this.moviePath=e},dispatch:function(e,t,i){var n=this.clients[e];n&&n.receiveEvent(t,i)},register:function(e,t){this.clients[e]=t},getDOMObjectPosition:function(e){return{left:0,top:0,width:e.width?e.width:e.offsetWidth,height:e.height?e.height:e.offsetHeight}},Client:function(e){this.handlers={},this.id=ZeroClipboard.nextId++,this.movieId="ZeroClipboardMovie_"+this.id,ZeroClipboard.register(this.id,this),e&&this.glue(e)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(e,t,i){this.domElement=ZeroClipboard.$(e);var n=99;this.domElement.style.zIndex&&(n=parseInt(this.domElement.style.zIndex,10)+1),"string"==typeof t?t=ZeroClipboard.$(t):"undefined"==typeof t&&(t=document.getElementsByTagName("body")[0]);var o=ZeroClipboard.getDOMObjectPosition(this.domElement,t);this.div=document.createElement("div");var s=this.div.style;if(s.position="absolute",s.left=""+o.left+"px",s.top=""+o.top+"px",s.width=""+o.width+"px",s.height=""+2*o.height+"px",s.zIndex=n,"object"==typeof i)for(addedStyle in i)s[addedStyle]=i[addedStyle];t.appendChild(this.div),this.div.innerHTML=this.getHTML(o.width,o.height)},getHTML:function(e,t){var i="",n="id="+this.id+"&width="+e+"&height="+t;if(navigator.userAgent.match(/MSIE/)){var o=location.href.match(/^https/i)?"https://":"http://";i+=''}else i+='';return i},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var e=document.getElementsByTagName("body")[0];try{e.removeChild(this.div)}catch(t){}this.domElement=null,this.div=null}},reposition:function(e){if(e&&(this.domElement=ZeroClipboard.$(e),!this.domElement&&this.hide()),this.domElement&&this.div){var t=ZeroClipboard.getDOMObjectPosition(this.domElement),i=this.div.style;i.left=""+t.left+"px",i.top=""+t.top+"px"}},setText:function(e){this.clipText=e,this.ready&&this.movie.setText(e)},addEventListener:function(e,t){e=e.toString().toLowerCase().replace(/^on/,""),this.handlers[e]||(this.handlers[e]=[]),this.handlers[e].push(t)},setHandCursor:function(e){this.handCursorEnabled=e,this.ready&&this.movie.setHandCursor(e)},setCSSEffects:function(e){this.cssEffects=!!e},receiveEvent:function(e,t){switch(e=e.toString().toLowerCase().replace(/^on/,"")){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){var i=this;return void setTimeout(function(){i.receiveEvent("load",null)},1)}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var i=this;return setTimeout(function(){i.receiveEvent("load",null)},100),void(this.ready=!0)}this.ready=!0,this.movie.setText(this.clipText),this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[e])for(var n=0,o=this.handlers[e].length;o>n;n++){var s=this.handlers[e][n];"function"==typeof s?s(this,t):"object"==typeof s&&2==s.length?s[0][s[1]](this,t):"string"==typeof s&&window[s](this,t)}}},function(e,t){function i(e,t,i,n){this.key=e,this.value=t,this.expires=i,this.slidingExpiration=n}function n(e,t){this.key=e,this.mappings=t}function o(t){var i=[],o=[],s=[];!function(){if(t&&window.localStorage){if(window.localStorage.jCacher){for(var e=jQuery.parseJSON(window.localStorage.jCacher),n=0;n-1?i[n]:null},this.getCacheItems=function(){return i},this.removeCacheItem=function(n){var r=e.inArray(n,o);if(t&&window.localStorage){var a=jQuery.parseJSON(window.localStorage.jCacher);a.dependencyMappings.splice(r,1),a.items.splice(r,1),window.localStorage.jCacher=jQuery.toJSON(a)}i.splice(r,1),o.splice(r,1),s.splice(r,1)},this.addCacheItem=function(r){var a=e.inArray(r.key,o);if(-1==a){var l=new n(r.key,[]);if(i.push(r),o.push(r.key),s.push(l),t&&window.localStorage){var h=jQuery.parseJSON(window.localStorage.jCacher),u=function(){var e={};return e.expires=r.expires.getTime(),e.key=r.key,e.value=r.value,e.slidingExpiration=r.slidingExpiration,e}();h.items.push(u),h.dependencyMappings.push(l),window.localStorage.jCacher=jQuery.toJSON(h)}}else if(i[a]=r,t&&window.localStorage){var h=jQuery.parseJSON(window.localStorage.jCacher);h.items[a]=r,window.localStorage.jCacher=jQuery.toJSON(h)}},this.getCacheKeys=function(){return o},this.registerDependencies=function(i,n){for(var r=0;r-1?s[i].mappings:null},this.clear=function(){window.localStorage&&window.localStorage.removeItem("jCacher"),i=[],s=[],o=[]}}e.jCacher=new function(){var n=this,s=e(this);n.version="1.0.0",n.count=0;var r,a,l,h=new o(!1),u=function(e,t){return new Date(e.getTime()+t)},d=function(e,i){var o=h.getCacheItem(e);if(null!==e&&e!==t&&null!==o){n.count--;var s=h.getDependencyMappings(e);h.removeCacheItem(e),f(o,i);for(var r=0;r0?r=setTimeout(c,t):c()}},f=function(e,t){s.trigger("itemremoved",[e,t])};n.itemremoved=function(e){s.bind("itemremoved",e)},n.add=function(o,s,r,d,c){if(s!==t){-1==e.inArray(o,h.getCacheKeys())&&n.count++;var g;(r||d)&&(r?g=u(new Date,1e3*r):d&&(g=d)),c&&h.registerDependencies(o,c);var f=new i(o,s,g,r);h.addCacheItem(f),(g&&(l===t||l>g)||a==o||null===l)&&p(f)}},n.get=function(e){var t=h.getCacheItem(e);if(t){var i=new Date;if(t.slidingExpiration)if(t.expires=u(i,1e3*t.slidingExpiration),e==a||l&&t.expires0?d(e,"removed"):void 0},n.clear=function(){n.count>0&&(n.count=0,h.clear(),null!==r&&(clearTimeout(r),r=null))},h.getCacheItems().length>0&&p()}}(jQuery),ko.exportSymbol=function(e,t){for(var i=e.split("."),n=window,o=0;oI;I++){var M,O=w[I],E=v+"["+I+"]";switch(O.status){case"added":var R=h(ko.utils.unwrapObservable(n),O.value,P);M=ko.utils.unwrapObservable(r(void 0,R,o,l,e,E)),E=a(ko.utils.unwrapObservable(n),R,x),T[E]=M,x[E]=!0;break;case"retained":R=h(ko.utils.unwrapObservable(n),O.value,P),M=h(e,O.value,P),r(M,R,o,l,e,E),E=a(ko.utils.unwrapObservable(n),R,x),T[E]=M,x[E]=!0;break;case"deleted":M=h(e,O.value,P)}b.push({event:O.status,item:M})}e(T),o[l]&&o[l].arrayChanged&&ko.utils.arrayForEach(b,function(e){o[l].arrayChanged(e.event,e.item)})}else if(c(n)){if(e=ko.utils.unwrapObservable(e),!e){if(y())return x=_(),S()&&(x=C(x)),x;if(S())return C(x);e={}}S()&&(e=C(e)),f.save(n,e),d(n,function(t){var i=v.length?v+"."+t:t;if(-1==ko.utils.arrayIndexOf(o.ignore,i))if(-1!=ko.utils.arrayIndexOf(o.copy,i))e[t]=n[t];else{var s=f.get(n[t])||r(e[t],n[t],o,t,e,i);ko.isWriteableObservable(e[t])?e[t](ko.utils.unwrapObservable(s)):e[t]=s,o.mappedProperties[i]=!0}})}else switch(i(n)){case"function":S()?ko.isWriteableObservable(n)?(n(C(n)),e=n):e=C(n):e=n;break;default:ko.isWriteableObservable(e)?e(S()?C(e):ko.utils.unwrapObservable(n)):(e=y()?_():ko.observable(ko.utils.unwrapObservable(n)),S()&&e(C(e)))}return e}function a(e,t,i){for(var n=0,o=e.length;o>n;n++)if(i[n]!==!0&&e[n]===t)return n;return null}function l(e,t){var n;return t&&(n=t(e)),"undefined"===i(n)&&(n=e),ko.utils.unwrapObservable(n)}function h(e,t,i){if(e=ko.utils.arrayFilter(ko.utils.unwrapObservable(e),function(e){return l(e,i)===t}),0==e.length)throw Error("When calling ko.update*, the key '"+t+"' was not found!");if(e.length>1&&c(e[0]))throw Error("When calling ko.update*, the key '"+t+"' was not unique!");return e[0]}function u(e,t){return ko.utils.arrayMap(ko.utils.unwrapObservable(e),function(e){return t?l(e,t):e})}function d(e,t){if(e instanceof Array)for(var i=0;i=0?t[o]=n:(e.push(i),t.push(n))},this.get=function(i){return i=ko.utils.arrayIndexOf(e,i),i>=0?t[i]:void 0}}ko.mapping={};var g,f,m="__ko_mapping__",v=ko.dependentObservable,b=0,w={include:["_destroy"],ignore:[],copy:[]},y=w;ko.mapping.isMapped=function(e){return(e=ko.utils.unwrapObservable(e))&&e[m]},ko.mapping.fromJS=function(e){if(0==arguments.length)throw Error("When calling ko.fromJS, pass the object you want to convert.");window.setTimeout(function(){b=0},0),b++||(g=[],f=new p);var i,o;2==arguments.length&&(arguments[1][m]?o=arguments[1]:i=arguments[1]),3==arguments.length&&(i=arguments[1],o=arguments[2]),o&&(i=t(i,o[m])),i=n(i);var s=r(o,e,i);return o&&(s=o),--b||window.setTimeout(function(){ko.utils.arrayForEach(g,function(e){e&&e()})},0),s[m]=t(s[m],i),s},ko.mapping.fromJSON=function(e){var t=ko.utils.parseJson(e);return arguments[0]=t,ko.mapping.fromJS.apply(this,arguments)},ko.mapping.updateFromJS=function(){throw Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!")},ko.mapping.updateFromJSON=function(){throw Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!")},ko.mapping.toJS=function(e,t){if(y||ko.mapping.resetDefaultOptions(),0==arguments.length)throw Error("When calling ko.mapping.toJS, pass the object you want to convert.");if(!(y.ignore instanceof Array))throw Error("ko.mapping.defaultOptions().ignore should be an array.");if(!(y.include instanceof Array))throw Error("ko.mapping.defaultOptions().include should be an array.");if(!(y.copy instanceof Array))throw Error("ko.mapping.defaultOptions().copy should be an array.");return t=n(t,e[m]),ko.mapping.visitModel(e,function(e){return ko.utils.unwrapObservable(e)},t)},ko.mapping.toJSON=function(e,t){var i=ko.mapping.toJS(e,t);return ko.utils.stringifyJson(i)},ko.mapping.defaultOptions=function(){return arguments.length>0?void(y=arguments[0]):y},ko.mapping.resetDefaultOptions=function(){y={include:w.include.slice(0),ignore:w.ignore.slice(0),copy:w.copy.slice(0)}},ko.mapping.visitModel=function(e,t,o){o=o||{},o.visitedObjects=o.visitedObjects||new p,o.parentName||(o=n(o));var s,r=ko.utils.unwrapObservable(e);if(!c(r))return t(e,o.parentName);t(e,o.parentName),s=r instanceof Array?[]:{},o.visitedObjects.save(e,s);var a=o.parentName;return d(r,function(e){if(!o.ignore||-1==ko.utils.arrayIndexOf(o.ignore,e)){var n=r[e],l=o,h=a||"";if(r instanceof Array?a&&(h+="["+e+"]"):(a&&(h+="."),h+=e),l.parentName=h,-1!==ko.utils.arrayIndexOf(o.copy,e)||-1!==ko.utils.arrayIndexOf(o.include,e)||!r[m]||!r[m].mappedProperties||r[m].mappedProperties[e]||r instanceof Array)switch(i(ko.utils.unwrapObservable(n))){case"object":case"undefined":l=o.visitedObjects.get(n),s[e]="undefined"!==i(l)?l:ko.mapping.visitModel(n,t,o);break;default:s[e]=t(n,o.parentName)}}}),s},ko.exportSymbol("ko.mapping",ko.mapping),ko.exportSymbol("ko.mapping.fromJS",ko.mapping.fromJS),ko.exportSymbol("ko.mapping.fromJSON",ko.mapping.fromJSON),ko.exportSymbol("ko.mapping.isMapped",ko.mapping.isMapped),ko.exportSymbol("ko.mapping.defaultOptions",ko.mapping.defaultOptions),ko.exportSymbol("ko.mapping.toJS",ko.mapping.toJS),ko.exportSymbol("ko.mapping.toJSON",ko.mapping.toJSON),ko.exportSymbol("ko.mapping.updateFromJS",ko.mapping.updateFromJS),ko.exportSymbol("ko.mapping.updateFromJSON",ko.mapping.updateFromJSON),ko.exportSymbol("ko.mapping.visitModel",ko.mapping.visitModel)}(),function(){var e,t,i=this,n="Index out of range";t="undefined"==typeof ProvideCustomRxRootObject?i.Rx={}:ProvideCustomRxRootObject();var o=function(){},s=function(){return(new Date).getTime()},r=function(e,t){return e===t},a=function(e){return e},l=function(e){return{Dispose:e}},h={Dispose:o};t.Disposable={Create:l,Empty:h};var u=t.BooleanDisposable=function(){var e=!1;this.GetIsDisposed=function(){return e},this.Dispose=function(){e=!0}},d=function(e){e.a++,this.Dispose=function(){var t=!1;e.b||this.c||(this.c=!0,e.a--,0==e.a&&e.d&&(e.b=!0,t=!0)),t&&e.e.Dispose()}},c=t.RefCountDisposable=function(e){this.d=!1,this.b=!1,this.e=e,this.a=0,this.Dispose=function(){var e=!1;this.b||this.d||(this.d=!0,0==this.a&&(this.b=!0,e=!0)),e&&this.e.Dispose()},this.GetDisposable=function(){return this.b?h:new d(this)}},p=t.CompositeDisposable=function(){for(var e=new m,t=0;te||e>=o)throw n;0==e?(i.shift(),o--):(i.splice(e,1),o--)},this.IndexOf=function(e){for(var t=0;o>t;t++)if(s(e,i[t]))return t;return-1},this.Remove=function(e){var t=this.IndexOf(e);return-1==t?!1:(this.RemoveAt(t),!0)},this.Clear=function(){i=[],o=0},this.GetCount=function(){return o},this.GetItem=function(e){if(0>e||e>=o)throw n;return i[e]},this.SetItem=function(e,t){if(0>e||e>=o)throw n;i[e]=t},this.ToArray=function(){for(var e=[],t=0;t=this.h||0>e)){var t=e-1>>1;if(!(0>t||t==e)&&this.i(e,t)){var i=this.g[e];this.g[e]=this.g[t],this.g[t]=i,this.j(t)}}},v.prototype.k=function(t){t===e&&(t=0);var i=2*t+1,n=2*t+2,o=t;if(i0;){var e=this.m.Dequeue();this.l=e.n,e.o()}},o.RunTo=function(e){for(;this.m.GetCount()>0&&this.f(this.m.Peek().n,e)<=0;){var t=this.m.Dequeue();this.l=t.n,t.o()}},o.GetTicks=function(){return this.l},o.l=0,o.m=new v(function(t,i){return e(t.n,i.n)}),o.f=e,o},y=(t.TestScheduler=function(){return new w(function(e,t){return e-t},function(e,t){return e+t},function(e){return new Date(e)},function(e){return 0>=e?1:e})},new b(function(e){return this.ScheduleWithTime(e,0)},function(t,i){var n=this.Now()+i,o=new C(t,n);if(this.m===e){var s=new _;try{this.m.Enqueue(o),s.p()}finally{s.q()}}else this.m.Enqueue(o);return o.r()},s));y.s=function(t){if(this.m===e){var i=new _;try{t(),i.p()}finally{i.q()}}else t()},b.CurrentThread=y;var _=function(){y.m=new v(function(e,t){try{return e.n-t.n}catch(i){}}),this.q=function(){y.m=e},this.p=function(){for(;y.m.GetCount()>0;){var e=y.m.Dequeue();if(!e.t()){for(;e.n-y.Now()>0;);!e.t()&&e.o()}}}},S=0,C=function(e,t){this.u=S++,this.o=e,this.n=t,this.v=new u,this.t=function(){return this.v.GetIsDisposed()},this.r=function(){return this.v}},P=new b(function(e){return e(),h},function(e,t){for(;this.Now1||"function"==typeof e?new T(e,t,i):e,this.x(n)},x:function(e){var t=!1,i=new g,n=this;return y.s(function(){var o=new T(function(i){!t&&e.OnNext(i)},function(n){t||(t=!0,i.Dispose(),e.OnError(n))},function(){t||(t=!0,i.Dispose(),e.OnCompleted())});i.Replace(n.w(o))}),new p(i,l(function(){t=!0}))},Select:function(e){var t=this;return k(function(i){var n=0;return t.Subscribe(new T(function(t){var o;try{o=e(t,n++)}catch(s){return void i.OnError(s)}i.OnNext(o)},function(e){i.OnError(e)},function(){i.OnCompleted()}))})},Let:function(t,i){if(i===e)return t(this);var n=this;return k(function(e){var o,s=i();try{o=t(s)}catch(r){return W(r).Subscribe(e)}var a=new g,l=new g,h=new p(l,a);return a.Replace(o.Subscribe(function(t){e.OnNext(t)},function(t){e.OnError(t),h.Dispose()},function(){e.OnCompleted(),h.Dispose()})),l.Replace(n.Subscribe(s)),h})},MergeObservable:function(){var e=this;return k(function(t){var i=!1,n=new p,o=new g;return n.Add(o),o.Replace(e.Subscribe(function(e){var o=new g;n.Add(o),o.Replace(e.Subscribe(function(e){t.OnNext(e)},function(e){t.OnError(e)},function(){n.Remove(o),1==n.GetCount()&&i&&t.OnCompleted()
}))},function(e){t.OnError(e)},function(){i=!0,1==n.GetCount()&&t.OnCompleted()})),n})},y:function(e,t){var i=f(t);return i.unshift(this),e(i)},Concat:function(){return this.y(R,arguments)},Merge:function(){return this.y(E,arguments)},Catch:function(){return this.y(F,arguments)},OnErrorResumeNext:function(){return this.y(L,arguments)},Zip:function(t,i){var n=this;return k(function(o){var s=[],r=[],a=!1,l=!1,h=new p,u=function(t){h.Dispose(),s=e,r=e,o.OnError(t)};return h.Add(n.Subscribe(function(e){if(l)return void o.OnCompleted();if(r.length>0){var t,n=r.shift();try{t=i(e,n)}catch(a){return h.Dispose(),void o.OnError(a)}o.OnNext(t)}else s.push(e)},u,function(){return l?void o.OnCompleted():void(a=!0)})),h.Add(t.Subscribe(function(e){if(a)return void o.OnCompleted();if(s.length>0){var t,n=s.shift();try{t=i(n,e)}catch(l){return h.Dispose(),void o.OnError(l)}o.OnNext(t)}else r.push(e)},u,function(){return a?void o.OnCompleted():void(l=!0)})),h})},CombineLatest:function(e,t){var i=this;return k(function(n){var o,s,r=!1,a=!1,l=!1,h=!1,u=new p,d=function(e){u.Dispose(),n.OnError(e)};u.Add(i.Subscribe(function(e){if(h)return void n.OnCompleted();if(a){var i;try{i=t(e,s)}catch(l){return u.Dispose(),void n.OnError(l)}n.OnNext(i)}o=e,r=!0},d,function(){return h?void n.OnCompleted():void(l=!0)})),u.Add(e.Subscribe(function(e){if(l)return void n.OnCompleted();if(r){var i;try{i=t(o,e)}catch(h){return u.Dispose(),void n.OnError(h)}n.OnNext(i)}s=e,a=!0},d,function(){return l?void n.OnCompleted():void(h=!0)}))})},Switch:function(){var t=this;return k(function(i){var n=!1,o=new g,s=new g;return s.Replace(t.Subscribe(function(t){if(!n){var r=new g;r.Replace(t.Subscribe(function(e){i.OnNext(e)},function(e){s.Dispose(),o.Dispose(),i.OnError(e)},function(){o.Replace(e),n&&i.OnCompleted()})),o.Replace(r)}},function(e){o.Dispose(),i.OnError(e)},function(){n=!0,o.Get()===e&&i.OnCompleted()})),new p(s,o)})},TakeUntil:function(e){var t=this;return k(function(i){var n=new p;return n.Add(e.Subscribe(function(){i.OnCompleted(),n.Dispose()},function(e){i.OnError(e)},function(){})),n.Add(t.Subscribe(i)),n})},SkipUntil:function(e){var t=this;return k(function(i){var n=!0,s=new p;return s.Add(e.Subscribe(function(){n=!1},function(e){i.OnError(e)},o)),s.Add(t.Subscribe(new T(function(e){!n&&i.OnNext(e)},function(e){i.OnError(e)},function(){!n&&i.OnCompleted()}))),s})},Scan1:function(e){var t=this;return N(function(){var i,n=!1;return t.Select(function(t){return n?i=e(i,t):(i=t,n=!0),i})})},Scan:function(e,t){var i=this;return N(function(){var n,o=!1;return i.Select(function(i){return o?n=t(n,i):(n=t(e,i),o=!0),n})})},Scan0:function(e,t){var i=this;return k(function(n){var o=e,s=!0;return i.Subscribe(function(e){s&&(s=!1,n.OnNext(o));try{o=t(o,e)}catch(i){return void n.OnError(i)}n.OnNext(o)},function(e){s&&n.OnNext(o),n.OnError(e)},function(){s&&n.OnNext(o),n.OnCompleted()})})},Finally:function(e){var t=this;return M(function(i){var n=t.Subscribe(i);return function(){try{n.Dispose(),e()}catch(t){throw e(),t}}})},Do:function(t,i,n){var s;s=0==arguments.length||arguments.length>1||"function"==typeof t?new T(t,i!==e?i:o,n):t;var r=this;return k(function(t){return r.Subscribe(new T(function(e){try{s.OnNext(e)}catch(i){return void t.OnError(i)}t.OnNext(e)},function(n){if(i!==e)try{s.OnError(n)}catch(o){return void t.OnError(o)}t.OnError(n)},function(){if(n!==e)try{s.OnCompleted()}catch(i){return void t.OnError(i)}t.OnCompleted()}))})},Where:function(e){var t=this;return k(function(i){var n=0;return t.Subscribe(new T(function(t){var o=!1;try{o=e(t,n++)}catch(s){return void i.OnError(s)}o&&i.OnNext(t)},function(e){i.OnError(e)},function(){i.OnCompleted()}))})},Take:function(t,i){i===e&&(i=P);var n=this;return k(function(e){if(0>=t)return n.Subscribe().Dispose(),A(i).Subscribe(e);var o=t;return n.Subscribe(new T(function(t){o-->0&&(e.OnNext(t),0==o&&e.OnCompleted())},function(t){e.OnError(t)},function(){e.OnCompleted()}))})},GroupBy:function(t,i,n){t===e&&(t=a),i===e&&(i=a),n===e&&(n=function(e){return e.toString()});var o=this;return k(function(s){var r={},a=new g,l=new c(a);return a.Replace(o.Subscribe(function(o){var a;try{a=t(o)}catch(h){for(var u in r)r[u].OnError(h);return void s.OnError(h)}var d,c=!1;try{var g=n(a);r[g]===e?(d=new Z,r[g]=d,c=!0):d=r[g]}catch(h){for(var u in r)r[u].OnError(h);return void s.OnError(h)}if(c){var f=k(function(e){return new p(l.GetDisposable(),d.Subscribe(e))});f.Key=a,s.OnNext(f)}var m;try{m=i(o)}catch(h){for(var u in r)r[u].OnError(h);return void s.OnError(h)}d.OnNext(m)},function(e){for(var t in r)r[t].OnError(e);s.OnError(e)},function(){for(var e in r)r[e].OnCompleted();s.OnCompleted()})),l})},TakeWhile:function(e){var t=this;return k(function(i){var n=!0;return t.Subscribe(new T(function(t){if(n){try{n=e(t)}catch(o){return void i.OnError(o)}n?i.OnNext(t):i.OnCompleted()}},function(e){i.OnError(e)},function(){i.OnCompleted()}))})},SkipWhile:function(e){var t=this;return k(function(i){var n=!1;return t.Subscribe(new T(function(t){if(!n)try{n=!e(t)}catch(o){return void i.OnError(o)}n&&i.OnNext(t)},function(e){i.OnError(e)},function(){i.OnCompleted()}))})},Skip:function(e){var t=this;return k(function(i){var n=e;return t.Subscribe(new T(function(e){n--<=0&&i.OnNext(e)},function(e){i.OnError(e)},function(){i.OnCompleted()}))})},SelectMany:function(e){return this.Select(e).MergeObservable()},TimeInterval:function(t){t===e&&(t=P);var i=this;return N(function(){var e=t.Now();return i.Select(function(i){var n=t.Now(),o=n-e;return e=n,{Interval:o,Value:i}})})},RemoveInterval:O,Timestamp:function(t){return t===e&&(t=P),this.Select(function(e){return{Timestamp:t.Now(),Value:e}})},RemoveTimestamp:O,Materialize:function(){var e=this;return k(function(t){return e.Subscribe(new T(function(e){t.OnNext(new $("N",e))},function(e){t.OnNext(new $("E",e)),t.OnCompleted()},function(){t.OnNext(new $("C")),t.OnCompleted()}))})},Dematerialize:function(){return this.SelectMany(function(e){return e})},AsObservable:function(){var e=this;return k(function(t){return e.Subscribe(t)})},Delay:function(t,i){i===e&&(i=x);var n=this;return k(function(o){var s=[],r=!1,a=new g,l=n.Materialize().Timestamp().Subscribe(function(n){return"E"==n.Value.Kind?(o.OnError(n.Value.Value),s=[],void(r&&a.Dispose())):(s.push({Timestamp:i.Now()+t,Value:n.Value}),void(r||(a.Replace(i.ScheduleRecursiveWithTime(function(t){var n;do n=e,s.length>0&&s[0].Timestamp<=i.Now()&&(n=s.shift().Value),n!==e&&n.Accept(o);while(n!==e);s.length>0?(t(Math.max(0,s[0].Timestamp-i.Now())),r=!0):r=!1},t)),r=!0)))});return new p(l,a)})},Throttle:function(t,i){i===e&&(i=x);var n=this;return k(function(e){var o,s=!1,r=new g,a=0,l=n.Subscribe(function(n){s=!0,o=n,a++;var l=a;r.Replace(i.ScheduleWithTime(function(){s&&a==l&&e.OnNext(o),s=!1},t))},function(t){r.Dispose(),e.OnError(t),s=!1,a++},function(){r.Dispose(),s&&e.OnNext(o),e.OnCompleted(),s=!1,a++});return new p(l,r)})},Timeout:function(t,i,n){n===e&&(n=x),i===e&&(i=W("Timeout",n));var o=this;return k(function(e){var s=new g,r=new g,a=0,l=a,h=!1;return r.Replace(n.ScheduleWithTime(function(){h=a==l,h&&s.Replace(i.Subscribe(e))},t)),s.Replace(o.Subscribe(function(o){var l=0;h||(a++,l=a,e.OnNext(o),r.Replace(n.ScheduleWithTime(function(){h=a==l,h&&s.Replace(i.Subscribe(e))},t)))},function(t){h||(a++,e.OnError(t))},function(){h||(a++,e.OnCompleted())})),new p(s,r)})},Sample:function(t,i){i===e&&(i=x);var n=this;return k(function(e){var o,s=!1,r=!1,a=new p;return a.Add(z(t,i).Subscribe(function(){s&&(e.OnNext(o),s=!1),r&&e.OnCompleted()},function(t){e.OnError(t)},function(){e.OnCompleted()})),a.Add(n.Subscribe(function(e){s=!0,o=e},function(t){e.OnError(t),a.Dispose()},function(){r=!0})),a})},Repeat:function(t,i){var n=this;return i===e&&(i=P),t===e&&(t=-1),k(function(e){var o=t,s=new g,r=new p(s),a=function(t){s.Replace(n.Subscribe(function(t){e.OnNext(t)},function(t){e.OnError(t)},function(){return o>0&&(o--,0==o)?void e.OnCompleted():void t()}))};return r.Add(i.ScheduleRecursive(a)),r})},Retry:function(t,i){var n=this;return i===e&&(i=P),t===e&&(t=-1),k(function(e){var o=t,s=new g,r=new p(s),a=function(t){s.Replace(n.Subscribe(function(t){e.OnNext(t)},function(i){return o>0&&(o--,0==o)?void e.OnError(i):void t()},function(){e.OnCompleted()}))};return r.Add(i.ScheduleRecursive(a)),r})},BufferWithTime:function(t,i,n){n===e&&(n=x),i===e&&(i=t);var o=this;return k(function(e){var s=new m,r=n.Now(),a=function(){for(var e=[],t=0;t=0&&e.push(i.Value)}return e},l=new p,h=function(t){e.OnError(t)},u=function(){e.OnNext(a()),e.OnCompleted()};return l.Add(o.Subscribe(function(e){s.Add({Value:e,Timestamp:n.Now()})},h,u)),l.Add(j(t,i,n).Subscribe(function(){for(var o=a(),l=n.Now()+i-t;s.GetCount()>0&&s.GetItem(0).Timestamp-l<=0;)s.RemoveAt(0);e.OnNext(o),r=l},h,u)),l})},BufferWithTimeOrCount:function(t,i,n){n===e&&(n=x);var o=this;return k(function(e){var s,r=0,a=new m,l=function(){e.OnNext(a.ToArray()),a.Clear(),r++},h=new g;(s=function(e){var i=n.ScheduleWithTime(function(){var t=!1,i=0;e==r&&(l(),i=r,t=!0),t&&s(i)},t);h.Replace(i)})(r);var u=o.Subscribe(function(e){var t=!1,n=0;a.Add(e),a.GetCount()==i&&(l(),n=r,t=!0),t&&s(n)},function(t){e.OnError(t),a.Clear()},function(){e.OnNext(a.ToArray()),r++,e.OnCompleted(),a.Clear()});return new p(u,h)})},BufferWithCount:function(t,i){i===e&&(i=t);var n=this;return k(function(e){var o=[],s=0;return n.Subscribe(function(n){0==s?o.push(n):s--;var r=o.length;if(r==t){var a=o;o=[];for(var l=Math.min(i,r),h=l;r>h;h++)o.push(a[h]);s=Math.max(0,i-t),e.OnNext(a)}},function(t){e.OnError(t)},function(){o.length>0&&e.OnNext(o),e.OnCompleted()})})},StartWith:function(t,i){t instanceof Array||(t=[t]),i===e&&(i=P);var n=this;return k(function(e){var o=new p,s=0;return o.Add(i.ScheduleRecursive(function(i){se&&i.OnNext(n.shift())},function(e){i.OnError(e)},function(){i.OnCompleted()})})},TakeLast:function(e){var t=this;return k(function(i){var n=[];return t.Subscribe(function(t){n.push(t),n.length>e&&n.shift()},function(e){i.OnError(e)},function(){for(;n.length>0;)i.OnNext(n.shift());i.OnCompleted()})})}};var E=I.Merge=function(t,i){return i===e&&(i=P),H(t,i).MergeObservable()},R=I.Concat=function(t,i){return i===e&&(i=P),k(function(e){var n=new g,o=0,s=i.ScheduleRecursive(function(i){if(o=e},function(e){return e+1},a,n)},I.Repeat=function(t,i,n){n===e&&(n=P),i===e&&(i=-1);var o=i;return k(function(e){return n.ScheduleRecursive(function(i){return e.OnNext(t),o>0&&(o--,0==o)?void e.OnCompleted():void i()})})},I.Generate=function(t,i,n,o,s){return s===e&&(s=P),k(function(e){var r=t,a=!0;return s.ScheduleRecursive(function(t){var s,l=!1;try{a?a=!1:r=n(r),l=i(r),l&&(s=o(r))}catch(h){return void e.OnError(h)}l?(e.OnNext(s),t()):e.OnCompleted()})})}),L=(I.GenerateWithTime=function(t,i,n,o,s,r){return r===e&&(r=x),new k(function(e){var a,l,h=t,u=!0,d=!1;return r.ScheduleRecursiveWithTime(function(t){d&&e.OnNext(a);try{u?u=!1:h=n(h),d=i(h),d&&(a=o(h),l=s(h))}catch(r){return void e.OnError(r)}d?t(l):e.OnCompleted()},0)})},I.OnErrorResumeNext=function(t,i){return i===e&&(i=P),k(function(e){var n=new g,o=0,s=i.ScheduleRecursive(function(i){if(o0,l=function(e,t){s.Add({Value:new $(e,t),Timestamp:n.Now()})};this.A=function(){if(t!==e)for(;s.GetCount()>t;)s.RemoveAt(0);if(a)for(;s.GetCount()>0&&n.Now()-s.GetItem(0).Timestamp>i;)s.RemoveAt(0)},this.OnNext=function(e){if(!r){for(var t=o.ToArray(),i=0;i99?Math.round(m/10):m),t:12>p?"a":"p",tt:12>p?"am":"pm",T:12>p?"A":"P",TT:12>p?"AM":"PM",Z:r?"UTC":(String(o).match(t)||[""]).pop().replace(i,""),o:(v>0?"-":"+")+n(100*Math.floor(Math.abs(v)/60)+Math.abs(v)%60,4),S:["th","st","nd","rd"][h%10>3?0:(h%100-h%10!=10)*h%10]};return s.replace(e,function(e){return e in b?b[e]:e.slice(1,e.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},Date.prototype.format=function(e,t){return dateFormat(this,e,t)},function(){var e=8,t="",i=0,n=function(t){for(var i=[],n=(1<s;s+=e)i[s>>5]|=(t.charCodeAt(s/e)&n)<<32-e-s%32;return i},o=function(e){for(var t,i=[],n=e.length,o=0;n>o;o+=2){if(t=parseInt(e.substr(o,2),16),isNaN(t))return"INVALID HEX STRING";i[o>>3]|=t<<24-4*(o%8)}return i},s=function(e){for(var t,n=i?"0123456789ABCDEF":"0123456789abcdef",o="",s=4*e.length,r=0;s>r;r+=1)t=e[r>>2]>>8*(3-r%4),o+=n.charAt(t>>4&15)+n.charAt(15&t);return o},r=function(e){for(var i,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s="",r=4*e.length,a=0;r>a;a+=3)for(n=(e[a>>2]>>8*(3-a%4)&255)<<16|(e[a+1>>2]>>8*(3-(a+1)%4)&255)<<8|e[a+2>>2]>>8*(3-(a+2)%4)&255,i=0;4>i;i+=1)s+=8*a+6*i<=32*e.length?o.charAt(n>>6*(3-i)&63):t;return s},a=function(e,t){return e<>>32-t},l=function(e,t,i){return e^t^i},h=function(e,t,i){return e&t^~e&i},u=function(e,t,i){return e&t^e&i^t&i},d=function(e,t){var i=(65535&e)+(65535&t),n=(e>>>16)+(t>>>16)+(i>>>16);return(65535&n)<<16|65535&i},c=function(e,t,i,n,o){var s=(65535&e)+(65535&t)+(65535&i)+(65535&n)+(65535&o),r=(e>>>16)+(t>>>16)+(i>>>16)+(n>>>16)+(o>>>16)+(s>>>16);return(65535&r)<<16|65535&s},p=function(e,t){var i,n,o,s,r,p,g,f,m,v=[],b=[1732584193,4023233417,2562383102,271733878,3285377520],w=[1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782];for(e[t>>5]|=128<<24-t%32,e[(t+65>>9<<4)+15]=t,m=e.length,g=0;m>g;g+=16){for(i=b[0],n=b[1],o=b[2],s=b[3],r=b[4],f=0;80>f;f+=1)v[f]=16>f?e[f+g]:a(v[f-3]^v[f-8]^v[f-14]^v[f-16],1),p=20>f?c(a(i,5),h(n,o,s),r,w[f],v[f]):40>f?c(a(i,5),l(n,o,s),r,w[f],v[f]):60>f?c(a(i,5),u(n,o,s),r,w[f],v[f]):c(a(i,5),l(n,o,s),r,w[f],v[f]),r=s,s=o,o=a(n,30),n=i,i=p;b[0]=d(i,b[0]),b[1]=d(n,b[1]),b[2]=d(o,b[2]),b[3]=d(s,b[3]),b[4]=d(r,b[4])}return b},g=function(t,i){if(this.sha1=null,this.strBinLen=null,this.strToHash=null,"HEX"===i){if(0!==t.length%2)return"TEXT MUST BE IN BYTE INCREMENTS";this.strBinLen=4*t.length,this.strToHash=o(t)}else{if("ASCII"!==i&&"undefined"!=typeof i)return"UNKNOWN TEXT INPUT TYPE";this.strBinLen=t.length*e,this.strToHash=n(t)}};g.prototype={getHash:function(e){var t=null,i=this.strToHash.slice();switch(e){case"HEX":t=s;break;case"B64":t=r;break;default:return"FORMAT NOT RECOGNIZED"}return null===this.sha1&&(this.sha1=p(i,this.strBinLen)),t(this.sha1)},getHMAC:function(t,i,a){var l,h,u,d,c,g=[],f=[];switch(a){case"HEX":l=s;break;case"B64":l=r;break;default:return"FORMAT NOT RECOGNIZED"}if("HEX"===i){if(0!==t.length%2)return"KEY MUST BE IN BYTE INCREMENTS";h=o(t),c=4*t.length}else{if("ASCII"!==i)return"UNKNOWN KEY INPUT TYPE";h=n(t),c=t.length*e}for(c/8>64?(h=p(h,c),h[15]&=4294967040):64>c/8&&(h[15]&=4294967040),u=0;15>=u;u+=1)g[u]=909522486^h[u],f[u]=1549556828^h[u];return d=p(g.concat(this.strToHash),512+this.strBinLen),d=p(f.concat(d),672),l(d)}},window.jsSHA=g}(),jSaaspose.PortalService=function(e,t,i){this._init(e,t,i)},$.extend(jSaaspose.PortalService.prototype,{_urlSuffix:"",_lastError:null,_service:null,_cacheTimeout:300,applicationPath:null,useJSONP:!1,_useHttpHandlers:!1,urlPrefix:"document-viewer",_init:function(e,t,i){this.applicationPath=e,this._useHttpHandlers=t,t&&(this._urlSuffix="Handler"),$.browser.msie&&8==$.browser.version&&i&&(this.useJSONP=!0)},viewDocumentAsHtml:function(e,t,i,n,o,s,r,a,l,h,u,d,c,p,g,f,m,v,b){var w={userId:e,privateKey:t,guid:i,useHtmlBasedEngine:!0,preloadPagesCount:n,fileDisplayName:o,usePngImagesForHtmlBasedEngine:s,convertWordDocumentsCompletely:r,ignoreDocumentAbsence:d,supportPageRotation:c,supportListOfContentControls:p,supportListOfBookmarks:g,watermarkText:a,watermarkColor:l,watermarkPosition:h,watermarkWidth:u,embedImagesIntoHtmlForWordFiles:f};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,w,m,v,null!=b?b:!1)},getDocumentPageHtml:function(e,t,i,n,o,s){var r={path:e,pageIndex:t,usePngImages:i,embedImagesIntoHtmlForWordFiles:n};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetDocumentPageHtml"+this._urlSuffix,r,o,s,!1)},viewDocument:function(e,t,i,n,o,s,r,a,l,h,u,d,c,p,g,f,m,v){var b={guid:e,width:t,quality:i,usePdf:n,preloadPagesCount:o,password:s,fileDisplayName:r,watermarkText:a,watermarkColor:l,watermarkPosition:h,watermarkFontSize:u,ignoreDocumentAbsence:d,supportPageRotation:c,supportListOfContentControls:p,supportListOfBookmarks:g};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,b,f,m,null!=v?v:!1)},getPdf2JavaScript:function(e,t,i,n,o,s){var r={guid:i,descForHtmlBasedEngine:n};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPdf2JavaScript"+this._urlSuffix,r,o,s,!1)},getImageUrlsAsync:function(e,t,i,n,o,s,r,a,l,h,u,d,c,p,g,f,m,v,b){var w={userId:e,privateKey:t,guid:i,dimension:n,token:o,firstPage:s,pageCount:r,quality:a,usePdf:l,docVersion:h,watermarkText:u,watermarkColor:d,watermarkPosition:c,watermarkFontSize:p,ignoreDocumentAbsence:g,useHtmlBasedEngine:f,supportPageRotation:m};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetImageUrls"+this._urlSuffix,w,v,b,!1)},loadFileBrowserTreeData:function(e,t,i,n,o,s,r,a,l,h,u,d,c){var p={userId:e,privateKey:t,path:i,pageIndex:n,pageSize:o,orderBy:s,orderAsc:r,filter:a,fileTypes:l,extended:h};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/LoadFileBrowserTreeData"+this._urlSuffix,p,u,d,null!=c?c:!0)},getPrintableHtml:function(e,t,i,n,o,s,r,a,l,h){var u={path:e,useHtmlBasedEngine:t,displayName:i,watermarkText:n,watermarkColor:o,watermarkPosition:s,watermarkWidth:r,ignoreDocumentAbsence:a};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPrintableHtml"+this._urlSuffix,u,l,h,!1)},reorderPage:function(e,t,i,n,o){var s={path:e,oldPosition:t,newPosition:i};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ReorderPage"+this._urlSuffix,s,n,o,!1)},rotatePage:function(e,t,i,n,o){var s={path:e,pageNumber:t,rotationAmount:i};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/RotatePage"+this._urlSuffix,s,n,o,!1)},_runServiceSync:function(e,t,i){var n=null,o=!1,s=function(e){o=!0,n=e.data};return this._runService(e,t,!1,s,null,i),n},_runServiceAsync:function(e,t,i,n,o,s){return this._runService(e,t,!0,i,n,o,s)},_highLevelErrorHandler:function(e){window.jGDError&&window.jGDError(e.Reason)},_runService:function(e,t,i,n,o,s,r){var a=JSON.stringify(t),l=null;if(s){l=Container.Resolve("Cacher");var h=l.get(e+a);if(h)return h.value.Subscribe(function(e){this._successHandler(e,n)}.bind(this),function(e){this._errorHandler(e,o,!1)}.bind(this)),h.value}var u;u=this.useJSONP?this._useHttpHandlers?"data="+a.toString():t:a;var d=Container.Resolve("RequestObservable")({url:e,type:this.useJSONP?"GET":"POST",contentType:"application/json; charset=utf-8",dataType:this.useJSONP?"jsonp"+(r?" xml":""):null,data:u,async:i}),c=Container.Resolve("AsyncSubject");return d.Finally=function(e){c.Subscribe(e)},d.Subscribe(function(e){if(e)if(e.data.success===!1){var t={code:e.data.code,Reason:e.data?e.data.Reason:null};this._highLevelErrorHandler(t),o&&o(t)}else this._successHandler(e,n);c.OnNext(),c.OnCompleted()}.bind(this),function(e){this._errorHandler(e,o,!1),c.OnNext(),c.OnCompleted()}.bind(this)),s&&l.add(e+a,d,this._cacheTimeout),d},_errorHandler:function(b,d,e){if(0!=b.xmlHttpRequest.readyState){if(401==b.xmlHttpRequest.status)return void(window.location=Container.Resolve("HttpProvider").buildUrl("/","sign-in",{returnUrl:window.location.href}));var a,c=0;if(""!=b.xmlHttpRequest.responseText){var f="";try{a=eval("("+b.xmlHttpRequest.responseText+")")}catch(g){a={Reason:b.xmlHttpRequest.responseText}
}c=500}else c=404,a={Reason:"Service link is not found"};404!=this._lastError&&e&&(this._lastError=c,404==c?jerror(a.Reason):jerror());try{d&&d(a)}catch(g){}}},_successHandler:function(e,t){t&&(""==e.xmlHttpRequest.responseText&&(e.data=null),t(e))}}),function(){var e=jQuery.event.special,t="D"+ +new Date,i="D"+(+new Date+1);e.scrollstart={setup:function(){var i,n=function(t){{var n=this;arguments}i?clearTimeout(i):(t.type="scrollstart",$(n).trigger("scrollstart")),i=setTimeout(function(){i=null},e.scrollstop.latency)};jQuery(this).bind("scroll",n).data(t,n)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(t))}},e.scrollstop={latency:300,setup:function(){var t,n=function(i){{var n=this;arguments}t&&clearTimeout(t),t=setTimeout(function(){t=null,i.type="scrollstop",$(n).trigger("scrollstop")},e.scrollstop.latency)};jQuery(this).bind("scroll",n).data(i,n)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(i))}}}(),function(e,t){e.widget("ui.docViewer",{_viewModel:null,options:{fileId:0,fileVersion:1,userId:0,userKey:null,baseUrl:null,_mode:"full",_docGuid:"",quality:null,use_pdf:"true",showHyperlinks:!0},_create:function(){e.extend(this.options,{documentSpace:this.element}),this.options.createHtml&&this._createHtml(),this._viewModel=this.getViewModel(),ko.applyBindings(this._viewModel,this.element.get(0))},_init:function(){e(this._viewModel).bind("getPagesCount",function(t,i){e(this.element).trigger("getPagesCount",[i])}.bind(this)),e(this._viewModel).bind("onDocumentLoaded",function(e,t){this.element.trigger("onDocumentLoaded",t)}.bind(this)),e(this._viewModel).bind("onDocumentPasswordRequired",function(){e(this.element).trigger("onDocumentPasswordRequired")}.bind(this)),e(this._viewModel).bind("_onProcessPages",function(t,i){e(this.element).trigger("_onProcessPages",[i])}.bind(this)),e(this._viewModel).bind("onProcessPages",function(t,i){e(this.element).trigger("onProcessPages",[i])}.bind(this)),e(this._viewModel).bind("onScrollDocView",function(t,i){e(this.element).trigger("onScrollDocView",[i])}.bind(this)),e(this._viewModel).bind("onBeforeScrollDocView",function(t,i){e(this.element).trigger("onBeforeScrollDocView",[i])}.bind(this)),e(this._viewModel).bind("onDocumentLoadComplete",function(t,i,n){e(this.element).trigger("onDocumentLoadComplete",[i,n])}.bind(this)),e(this._viewModel).bind("onSearchPerformed",function(t,i){e(this.element).trigger("onSearchPerformed",[i])}.bind(this)),e(this._viewModel).bind("onPageImageLoaded",function(){e(this.element).trigger("onPageImageLoaded")}.bind(this)),e(this._viewModel).bind("onDocViewScrollPositionSet",function(t,i){e(this.element).trigger("onDocViewScrollPositionSet",[i])}.bind(this)),e(this._viewModel).bind("onDocumentPageSet",function(t,i){e(this.element).trigger("onDocumentPageSet",[i])}.bind(this))},getViewModel:function(){return null==this._viewModel&&(this._viewModel=this._createViewModel()),this._viewModel},_createViewModel:function(){return new docViewerViewModel(this.options)},applyBindings:function(){ko.applyBindings(this._viewModel,this.element.get(0))},_createHtml:function(){var t;t=this.options.supportPageRotation?" + ' translateY(' + (($root.isHtmlDocument() && ($data.rotation() == 270 || $data.rotation() == 180)) ? '100%' : '0') + ') ' + 'rotate(' + $data.rotation() + 'deg)' + ' translateX(' + (($data.rotation() == 180 || (!$root.isHtmlDocument() && $data.rotation() == 270)) ? '-100%' : '0') + ')' + ' translateY(' + (($data.rotation() == 90 || (!$root.isHtmlDocument() && $data.rotation() == 180)) ? '-100%' : '0') + ') ' ":"";var i="'-ms-transform': 'scale(' + $data.heightRatio() * $root.zoom() / 100.0 + ')' ";"html"==this.options.pageContentType&&e.browser.msie&&(8==e.browser.version?i="zoom: $data.heightRatio() * $root.zoom() / 100.0 ":i+=t),i+=",";var n;n=this.options.watermarkText?'':"";var o,s=' '+n,r=' ";o=this.options.useEmScaling?r:s;var a,l="html"==this.options.pageContentType;a=l&&this.options.useEmScaling?'class="pages_container html_pages_container" data-bind="style:{fontSize: (16.* $root.zoom() / 100.0) + \'px\'}"':'class="pages_container '+(l?"html_pages_container":"")+"\" data-bind=\"style: { height: $root.useVirtualScrolling ? ($root.documentHeight() + 'px') : 'auto', width: ($root.layout() == $root.Layouts.TwoPagesInRow || $root.layout() == $root.Layouts.CoverThenTwoPagesInRow) ? ($root.pageWidth() + $root.imageHorizontalMargin) * 2 + 'px': 'auto'}\"";var h=' '+(l?o:' ")+' ',u=this.element;e(h).appendTo(u),u.trigger("onHtmlCreated"),this.element=e("#"+this.options.docViewerId)}}),docViewerModel=function(t){e.extend(this,t),this._init()},e.extend(docViewerModel.prototype,{_init:function(){this._portalService=Container.Resolve("PortalService")},loadDocument:function(e,t,i,n,o,s,r,a,l,h,u,d,c,p,g){var f=function(e){null!=e.data&&"undefined"!=typeof e.data.guid?p.apply(this,[e.data]):g.apply(this,[{code:e.data.code,Reason:e.data?e.data.Reason:null}])};switch(this._mode){case"embed":this._portalService.viewEmbedDocumentAllAsync(this.userId,this.userKey,e,i,this.quality,this.use_pdf,this.preloadPagesCount,n,o,f,g);break;case"webComponent":this._portalService.viewDocument(e,i,this.quality,this.usePdf,this.preloadPagesCount,n,o,s,r,a,l,h,u,d,c,f,g);break;case"annotatedDocument":this._portalService.viewAnnotatedDocumentAsync(this.userId,this.userKey,e,null,t,i,null,this.quality,this.use_pdf,{text:s,color:r,position:a,fontSize:l},f,g,!1);break;default:this._portalService.viewDocumentAllAsync(this.userId,this.userKey,e,null,t,i,null,this.quality,this.use_pdf,f,g,!1)}},loadDocumentAsHtml:function(e,t,i,n,o,s,r,a,l,h,u,d,c,p,g,f){this._portalService.viewDocumentAsHtml(this.userId,this.userKey,e,this.preloadPagesCount,i,n,o,s,r,a,l,h,u,d,c,p,function(e){e.data&&"undefined"!=typeof e.data.guid?g.apply(this,[e.data]):f.apply(this)},function(e){f.apply(this,[e])},!1)},loadProperties:function(e,t){this._portalService.getDocInfoAsync(this.userId,this.userKey,e,function(e){t.apply(this,[e.data])})},loadHyperlinks:function(e,t,i){this._portalService.getDocumentHyperlinks(e,function(e){t.apply(this,[e.data])},function(e){i.apply(this,[e])})},retrieveImageUrls:function(e,t,i,n,o,s,r,a,l,h,u,d,c){this._portalService.getImageUrlsAsync(this.userId,this.userKey,e,n,t,0,i,null==this.quality?"":this.quality,this.use_pdf,this.fileVersion,o,s,r,a,l,h,u,function(e){d.apply(this,[e.data])},function(e){c.apply(this,[e])})},getDocumentPageHtml:function(e,t,i,n,o,s){this._portalService.getDocumentPageHtml(e,t,i,n,function(e){o.apply(this,[e.data])},function(e){s.apply(this,[e])})},reorderPage:function(e,t,i,n,o){this._portalService.reorderPage(e,t,i,function(e){n.apply(this,[e.data])},function(e){o.apply(this,[e])})},rotatePage:function(e,t,i,n,o){this._portalService.rotatePage(e,t,i,function(e){n.apply(this,[e.data])},function(e){o.apply(this,[e])})}}),docViewerViewModel=function(t){e.extend(this,t),this._create(t)},e.extend(docViewerViewModel.prototype,{Layouts:{ScrollMode:1,BookMode:2,OnePageInRow:3,TwoPagesInRow:4,CoverThenTwoPagesInRow:5},_model:null,pagesDimension:null,pageImageWidth:0,imageHorizontalMargin:34,imageVerticalMargin:0,initialZoom:100,zoom:null,scale:null,docWasLoadedInViewer:!1,scrollPosition:[0,0],inprogress:null,pages:null,pageInd:null,pageWidth:null,pageHeight:null,pageCount:null,docType:null,fileId:null,_dvselectable:null,_thumbnailHeight:140,_firstPage:null,_sessionToken:"",imageUrls:[],pagePrefix:"page-",documentName:null,fit90PercentWidth:!1,_pageBounds:null,unscaledPageHeight:null,unscaledPageWidth:null,pageLeft:null,preloadPagesCount:null,viewerLayout:1,changedUrlHash:!1,hashPagePrefix:"page",pageContentType:"image",scrollbarWidth:null,password:null,useJavaScriptDocumentDescription:!1,minimumImageWidth:null,fileDisplayName:null,hyperlinks:null,watermarkText:null,watermarkWidth:null,watermarkColor:null,watermarkLeft:null,watermarkTop:null,watermarkScreenWidth:null,searchText:null,htmlSearchHighlightClassName:"search_highlight_html",htmlSearchHighlightElement:"span",htmlSearchHighlightSvgElement:"tspan",currentWordCounter:0,matchedNods:null,searchMatches:null,matchedNodsCount:0,matchesCount:null,searchSeparatorsList:'\\-[\\]{}()*+?\\\\^|\\s.,:;+"/',usePngImagesForHtmlBasedEngine:!1,loadAllPagesOnSearch:!1,serverPages:null,convertWordDocumentsCompletely:!1,ignoreDocumentAbsence:!1,tabs:null,useTabsForPages:null,tabPanelHeight:30,supportPageRotation:!1,fileType:null,activeTab:null,autoHeight:null,isHtmlDocument:null,rotatedWidth:null,alwaysShowLoadingSpinner:null,supportListOfContentControls:!1,supportListOfBookmarks:!1,options:{showHyperlinks:!0},_create:function(e){this._model=new docViewerModel(e),this._init(e)},_init:function(e){this.initCustomBindings(),0!=this.viewerLeft&&(this.viewerWidth-=this.viewerLeft,this.documentSpace.css("width",this.viewerWidth+"px"));var t=852,i=1100;this.pageImageWidth=t,this.pages=ko.observableArray([]),this.scale=ko.observable(this.initialZoom/100),this.inprogress=ko.observable(!1),this.pageLeft=ko.observable(0),this.pageInd=ko.observable(1),this.pageWidth=ko.observable(t),this.pageHeight=ko.observable(i),this.pageCount=ko.observable(0),this.docType=ko.observable(-1),this.documentName=ko.observable(""),this.password=ko.observable(""),this.preloadPagesCount=e.preloadPagesCount,this.browserIsChrome=ko.observable(!1),this.hyperlinks=ko.observableArray(),this.useTabsForPages=ko.observable(!1),this.tabs=ko.observableArray([]),this.activeTab=ko.observable(0),this.autoHeight=ko.observable(!1),this.isHtmlDocument=ko.observable(!1),this.alwaysShowLoadingSpinner=ko.observable(!1),this.rotatedWidth=ko.computed(function(){if(this.useTabsForPages()){var e;if(this.supportPageRotation&&this.useTabsForPages()&&this.pages){var t=this.pages()[0];t&&t.rotation()%180>0&&(e=this.pageWidth()*t.prop())}else e=this.pageWidth();return e/this.zoom()*100+"px"}return"auto"},this),this.layout=ko.observable(this.viewerLayout),this.firstVisiblePageForVirtualMode=ko.observable(0).extend({rateLimit:{method:"notifyWhenChangesStop",timeout:400}}),this.lastVisiblePageForVirtualMode=ko.observable(0).extend({rateLimit:{method:"notifyWhenChangesStop",timeout:400}}),this.documentHeight=ko.observable(0),"html"==this.pageContentType&&(this.imageHorizontalMargin=0,this.calculatePointToPixelRatio()),this.docViewerId||(this.docViewerId=this.documentSpace.attr("id")),this.pagePrefix=this.docViewerId+"-page-",e.fit90PercentWidth&&(this.pageImageWidth=.9*this.documentSpace.width()-2*this.imageHorizontalMargin),"image"==this.pageContentType&&(this.initialWidth=this.pageImageWidth),this.zoomToFitWidth&&(this.initialWidth=this.pageImageWidth=this.getFitWidth()),this.zoom=ko.observable(this.initialZoom),this.documentHeight=ko.observable(0),this.options.showHyperlinks=0!=e.showHyperlinks&&"false"!=this.use_pdf,this.options.highlightColor=e.highlightColor,this.matchedNods=[],this.searchMatches=[],this.serverPages=[{w:this.initialWidth,h:100}];var n;0==this.pages().length&&(n={number:1,visible:ko.observable(!1),url:ko.observable(""),htmlContent:ko.observable(""),searchText:ko.observable(null)},this.supportPageRotation&&(n.rotation=ko.observable(0)),this.variableHeightPageSupport&&(n.prop=ko.observable(1),n.heightRatio=ko.observable(1)),this.useVirtualScrolling&&(n.left=0,n.top=ko.observable(0)),this.pages.push(n)),this.pagesContainerElement=this.documentSpace.find(".pages_container"),this.contentControlsFromHtml=[],e.fileId?this.loadDocument():n.visible(!0)},loadDocument:function(e){this.inprogress(!0),this.documentSpace.trigger("onDocumentloadingStarted");var t=1;if("image"==this.pageContentType){var i;i=this.shouldMinimumWidthBeUsed(this.pageImageWidth*this.initialZoom/100,!1)?this.minimumImageWidth:Math.round(this.pageImageWidth*this.initialZoom/100),this._model.loadDocument(e||this.fileId,t,i,this.password(),this.fileDisplayName,this.watermarkText,this.watermarkColor,this.watermarkPosition,this.watermarkWidth,this.ignoreDocumentAbsence,this.supportPageRotation,this.supportListOfContentControls,this.supportListOfBookmarks,function(t){"undefined"!=typeof e&&(this.fileId=e),this.pageWidth(this.pageImageWidth*(this.initialZoom/100)),this.zoom(this.initialZoom),this.docWasLoadedInViewer&&this.setPageNumerInUrlHash(1),this._onDocumentLoadedBeforePdf2Xml(t)}.bind(this),function(e){this._onDocumentLoadFailed(e)}.bind(this))}else"html"==this.pageContentType&&this._model.loadDocumentAsHtml(e||this.fileId,t,this.fileDisplayName,this.usePngImagesForHtmlBasedEngine,this.convertWordDocumentsCompletely,this.watermarkText,this.watermarkColor,this.watermarkPosition,this.watermarkWidth,this.ignoreDocumentAbsence,this.supportPageRotation,this.supportListOfContentControls,this.supportListOfBookmarks,this.embedImagesIntoHtmlForWordFiles,function(t){"undefined"!=typeof e&&(this.fileId=e),this.pageWidth(this.pageImageWidth*(this.initialZoom/100)),this._onDocumentLoadedBeforePdf2Xml(t)}.bind(this),function(e){this._onDocumentLoadFailed(e)}.bind(this));"undefined"!=typeof viewModelPathOnlineDoc&&viewModelPathOnlineDoc.pathOnlineDoc("")},getDocumentPageHtml:function(t,i){var n;n=this.useTabsForPages()?this.tabs()[t]:this.pages()[t],n.visible()||n.startedDownloadingPage||(n.startedDownloadingPage=!0,this._model.getDocumentPageHtml(this.fileId,t,this.usePngImagesForHtmlBasedEngine,this.embedImagesIntoHtmlForWordFiles,function(o){var s=o;n.htmlContent(s);var r={text:this.searchText,isCaseSensitive:!1,searchForSeparateWords:this.searchForSeparateWords,treatPhrasesInDoubleQuotesAsExact:this.treatPhrasesInDoubleQuotesAsExact,pageNumber:t};this.useVirtualScrolling&&(n.parsedHtmlElement=e(s),n.currentValue=s,this.parseSearchParameters(n.parsedHtmlElement.not("style")[0],r)),n.searchText(r),n.visible(!0),n.startedDownloadingPage=!1,this.markContentControls(t),i&&i.call()}.bind(this),function(e){n.startedDownloadingPage=!1,this._onError(e)}.bind(this)))},retrieveImageUrls:function(e){var t,i,n;n=this.shouldMinimumWidthBeUsed(this.pageWidth(),!0)?this.minimumImageWidth:this.pageWidth(),i=Math.floor(n)+"x",this._model.retrieveImageUrls(this.fileId,this._sessionToken,e,i,this.watermarkText,this.watermarkColor,this.watermarkPosition,this.watermarkWidth,this.ignoreDocumentAbsence,this.useHtmlBasedEngine,this.supportPageRotation,function(i){for(t=0;e>t;t++)this.pages()[t].url(i.image_urls[t]),this.loadImagesForVisiblePages()}.bind(this),function(e){this._onError(e)}.bind(this))},_onError:function(e){this.inprogress(!1);var t=window.jerror||window.jGDError;t&&t(e.Reason||"The document couldn't be loaded...")},_onDocumentLoadFailed:function(t){this.inprogress(!1),"Unauthorized"==t.code?e(this).trigger("onDocumentPasswordRequired"):this._onError(t)},_onDocumentLoadedBeforePdf2Xml:function(e){function t(){i._onDocumentLoaded(e)}var i=this,n={userId:this.userId,privateKey:this.userKey,fileId:this.fileId,guid:e.guid,documentDescription:e.documentDescription,callback:t};this.useJavaScriptDocumentDescription?(n.synchronousWork=this.textSelectionSynchronousCalculation,n.descForHtmlBasedEngine="html"==this.pageContentType||"false"==this.use_pdf,this._pdf2XmlWrapper=new jGroupdocs.Pdf2JavaScriptWrapper(n),this._onDocumentLoaded(e)):"false"==this.use_pdf?this._onDocumentLoaded(e):this._pdf2XmlWrapper=new jSaaspose.Pdf2XmlWrapper(n)},_onDocumentLoaded:function(i){this.useJavaScriptDocumentDescription&&(i.page_count=this._pdf2XmlWrapper.getPageCount()),i.page_size||(i.page_size={}),e(this).trigger("onDocumentLoaded",i);var n=this;this._sessionToken=i.token,this.docGuid=i.guid,this.pageCount(i.page_count),this.documentName(i.name),this.docType(i.doc_type),this.password(i.password),this.matchesCount=0,e(this).trigger("getPagesCount",i.page_count),this.variableHeightPageSupport&&(i.documentDescription=this._pdf2XmlWrapper.documentDescription);var o,s,r,a,l=null,h=null;if(this.supportListOfContentControls&&(this.contentControls=this._pdf2XmlWrapper.getContentControls()),this.supportListOfBookmarks&&(this.bookmarks=this._pdf2XmlWrapper.getBookmarks()),"image"==this.pageContentType)("false"!=this.use_pdf||this.variableHeightPageSupport)&&(h=this._pdf2XmlWrapper.getPageSize(),this.variableHeightPageSupport&&(i.page_size.Width=h.width,i.page_size.Height=h.height),this.scale(this.pageImageWidth*(this.initialZoom/100)/h.width),this.unscaledPageHeight=Number(h.height),this.unscaledPageWidth=Number(h.width)),this.heightWidthRatio=parseFloat(i.page_size.Height/i.page_size.Width),this.pageHeight(Math.round(this.pageImageWidth*this.heightWidthRatio*(this.initialZoom/100))),e(this).trigger("_onProcessPages",i);else if("html"==this.pageContentType){this.watermarkScreenWidth=null,this.zoom(100),this.fileType=i.fileType,this.urlForResourcesInHtml=i.urlForResourcesInHtml,r="Txt"==this.fileType||"Xml"==this.fileType,this.isHtmlDocument("Html"==this.fileType||"Htm"==this.fileType||r);var u="Cells"==i.doc_type||this.isHtmlDocument();this.useTabsForPages(u),u|="Image"==i.doc_type,this.documentSpace.trigger("isDocumentSinglePaged.groupdocs",u),this.alwaysShowLoadingSpinner(!u);var d=e.browser.webkit&&!!window.chrome;this.browserIsChrome(d);var c=i.pageCss;c||(c=""),this.pageCssElement&&this.pageCssElement.remove(),this.urlForImagesInHtml=i.urlForImagesInHtml,this.urlForFontsInHtml=i.urlForFontsInHtml,this.pageCssElement=e({});var p=i.pageHtml,g=this.pages()[0];l=this._pdf2XmlWrapper.documentDescription.pages,this.autoHeight(this.useTabsForPages());var f;if(this.useTabsForPages()){if(this.pageCount(1),this.isHtmlDocument()){var m;if(r)m=""+p+"";else{var v=this.getHtmlElementContents(p,"head");if(v){var b=this.getHtmlElements(v,"style"),w=this.getHtmlElementAttributess(v,"link");if(null!=w)for(o=0;o "),this.pageCssElement=this.pageCssElement.add(f),f.appendTo("head"))}}if(b)for(o=0;o"+c+""),this.pageCssElement=this.pageCssElement.add(f),f.appendTo("head"),this.calculatePointToPixelRatio();var x=this.documentSpace.find(".html_page_contents:first");if(g.htmlContent(p),g.visible(!0),this.clearContentControls(),this.markContentControls(0),this.tabs.removeAll(),this.useTabsForPages()){var T=this._pdf2XmlWrapper.documentDescription.sheets;if(T)for(o=0;o0?this.documentSpace.addClass("doc_viewer_tabs"):this.documentSpace.removeClass("doc_viewer_tabs");var I,k=x.children("div,table,img");if(this.useTabsForPages()){I=k.width();var M=k.height();g.prop(M/I),h={width:I,height:M},g.heightRatio(1)}this.supportPageRotation&&(s=l?l[0].rotation:0,"undefined"==typeof s&&(s=0),this.applyPageRotationInBrowser(0,g,s)),this.imageHorizontalMargin=(x.outerWidth(!0)-x.outerWidth(!1))/2,i.page_size.Width=h.width,i.page_size.Height=h.height;var O=h.width,E=!1,R=k.children();1==R.length&&1==R.filter("img").length&&(E=!0);var H=null;E||this.useTabsForPages()||(H=k.css("width"),k.css("width",O+"pt")),I=this.isHtmlDocument()?this.getFitWidth():k.width(),this.heightWidthRatio=parseFloat(i.page_size.Height/i.page_size.Width),(!this.useTabsForPages()||!this.supportPageRotation||g.rotation%180==0)&&this.pageWidth(I),null!==H&&"undefined"!=typeof H&&k.css("width",H),this.pageHeight(Math.round(this.pageWidth()*this.heightWidthRatio)),this.pageWidth(this.pageWidth()+2*this.imageHorizontalMargin),this.pageHeight(this.pageHeight()+this.imageVerticalMargin),this.initialWidth=this.pageWidth()}var W,D=this.pageCount(),A=[];if("image"==this.pageContentType){var N,F;for(this.variableHeightPageSupport&&(this.serverPages=l=this._pdf2XmlWrapper.documentDescription.pages,F=this._pdf2XmlWrapper.getPageCount()),o=0;D>o;o++)N=oo&&l?l[o].h/l[o].w:this.pageHeight()/this.pageWidth())),this.supportPageRotation&&(s=this.serverPages[o].rotation,"undefined"==typeof s&&(s=0),W.rotation=ko.observable(s),this.applyPageRotationInBrowser(o,W,s)),this.useVirtualScrolling&&(W.left=0,W.top=ko.observable(0)),A.push(W)}else if("html"==this.pageContentType){this.serverPages=l=this._pdf2XmlWrapper.documentDescription.pages,pageWidth=this.pageWidth(),W=this.pages()[0],A.push(W);var V;for(o=1;D>o;o++)a=this.getScaleRatioForPage(h.width,h.height,l[o].w,l[o].h),V=l[o].h/l[o].w,W={number:o+1,visible:ko.observable(!1),htmlContent:ko.observable(""),prop:ko.observable(V),heightRatio:ko.observable(a),searchText:ko.observable(null)},this.supportPageRotation&&(s=this.serverPages[o].rotation,"undefined"==typeof s&&(s=0),W.rotation=ko.observable(s),this.applyPageRotationInBrowser(o,W,s)),this.useVirtualScrolling&&(W.left=0,W.top=ko.observable(0)),A.push(W);this.documentSpace.trigger("_onProcessPages",[i,A,this.getDocumentPageHtml,this,this.pointToPixelRatio,this.docViewerId])}if(this.pages(A),this.calculatePagePositionsForVirtualMode(),this._firstPage=this.documentSpace.find("#"+this.pagePrefix+"1"),!(this.pages().length>0&&0==this._firstPage.length)||this.useVirtualScrolling){e(this).trigger("onProcessPages",[this.docGuid]),this.inprogress(!1),"image"==this.pageContentType&&this.recalculatePageLeft();var L=Math.floor(this.pagesContainerElement.width()/this.pageWidth());0==L&&(L=1),this.layout()==this.Layouts.OnePageInRow&&(L=1);var z=this.scale();if(this._dvselectable=this.pagesContainerElement.dvselectable({txtarea:this.selectionContent,pdf2XmlWrapper:this._pdf2XmlWrapper,startNumbers:this.getVisiblePagesNumbers(),pagesCount:this.pageCount(),proportion:z,pageHeight:this.getPageHeight(),horizontalPageCount:L,docSpace:this.documentSpace,pagePrefix:this.pagePrefix,searchPartialWords:this.searchPartialWords,storeAnnotationCoordinatesRelativeToPages:this.storeAnnotationCoordinatesRelativeToPages,initializeStorageOnly:"html"==this.pageContentType,preventTouchEventsBubbling:this.preventTouchEventsBubbling,highlightColor:this.options.highlightColor,useVirtualScrolling:this.useVirtualScrolling,pageLocations:this.useVirtualScrolling?this.pages():null}),this._dvselectable.dvselectable("setVisiblePagesNumbers",this.getVisiblePagesNumbers()),!this.zoomToFitHeight&&this.loadImagesForVisiblePages(!0),this.docWasLoadedInViewer||this.usePageNumberInUrlHash!==t&&1!=this.usePageNumberInUrlHash)this.setPage(1);else{var B=location.pathname;location.hash.substring(1,this.hashPagePrefix.length+1)!=this.hashPagePrefix&&this.setPage(1),Sammy(function(){function e(){1!=n.pageInd()&&n.setPage(1)}function t(){if(!n.changedUrlHash&&0!=this.params.splat.length&&0!=this.params.splat[0].length){var e=this.params.splat[0],t=Number(e);isNaN(t)&&(t=1),t>n.pageCount()&&(t=n.pageCount()),1>t&&(t=1),n.setPage(t)}}this.get(/\#page(.*)/i,t),this.get(B,e)}).run()}if(this.adjustInitialZoom(),this.docWasLoadedInViewer=!0,"image"==this.pageContentType&&"webComponent"!=this._mode&&"annotatedDocument"!=this._mode&&this._loadHyperlinks(),this.preloadPagesOnBrowserSide){var j=this.preloadPagesCount;null===j&&(j=this.pageCount()),this.loadImagesForPages(1,j)}e(this).trigger("onScrollDocView",{pi:1,direction:"up",position:0}),e(this).trigger("onDocumentLoadComplete",[i,this._pdf2XmlWrapper]),this.documentSpace.trigger("documentLoadCompleted.groupdocs")}},_onDocumentHyperlinksLoaded:function(t){if(!t||!t.links)return void this.hyperlinks.removeAll();var i=[],n=this.getSelectableInstance();e.each(t.links,function(){var e={url:this.Url,pageNumber:this.PageNumber,targetPage:this.TargetPage,rect:new jSaaspose.Rect(this.Bounds.X,this.Bounds.Y,this.Bounds.X+this.Bounds.Width,this.Bounds.Y+this.Bounds.Height)};e.frame=ko.observable(null!=n?n.convertPageAndRectToScreenCoordinates(e.pageNumber,e.rect):e.rect),i.push(e)}),this.hyperlinks(i)},_loadHyperlinks:function(){1==this.options.showHyperlinks&&this._model.loadHyperlinks(this.fileId,this._onDocumentHyperlinksLoaded.bind(this),function(){})},_refreshHyperlinkFrames:function(){var t=this.getSelectableInstance();e.each(this.hyperlinks(),function(){this.frame(null!=t?t.convertPageAndRectToScreenCoordinates(this.pageNumber,this.rect):this.rect)})},setPageWidth:function(e){this.pageImageWidth=e},setContainerWidth:function(e){this.viewerWidth=e},getFitWidth:function(){var e;e=this.viewerWidth?this.viewerWidth:this.documentSpace.width();var t=this.getScrollbarWidth();return e-t-2*(this.imageHorizontalMargin+1)},getFitWidthZoom:function(){return this.getFitWidth()/this.initialWidth*100},setContainerHeight:function(e){this.viewerHeight=e},getViewerHeight:function(){var e;return e=this.viewerHeight?this.viewerHeight:this.documentSpace.parent().height()},getFitHeightZoom:function(){var e=this.getViewerHeight();return(e-(this.imageVerticalMargin+2))/Math.round(this.initialWidth*this.heightWidthRatio)*100},getScrollbarWidth:function(){if(null==this.scrollbarWidth){var t=e("").css("width","100px").css("height","100px").css("overflow","scroll").css("position","absolute").css("top","-9999px"),i=t[0];document.body.appendChild(i),this.scrollbarWidth=i.offsetWidth-i.clientWidth,document.body.removeChild(i)}return this.scrollbarWidth},getPageHeight:function(){return this.unscaledPageHeight*this.scale()},getSelectable:function(){return this._dvselectable},_onPropertiesLoaded:function(t){e(this).trigger("onDocumentLoaded",{fileId:this.fileId,response:t})},getFileId:function(){return this.fileId},ScrollDocView:function(t,i){var n=this.isSetCalled;if(this.isSetCalled=!1,!n&&!this.useTabsForPages()){var o=null,s=this.documentSpace.height(),r=e(i.target).scrollTop();if(e(this).trigger("onBeforeScrollDocView",{position:r}),this.variableHeightPageSupport){var a=this.getSelectableInstance();if(null==a)return null;a.initStorage();var l,h,u,d=a.pageLocations,c=this.pages();u=this.getVisiblePagesNumbers();for(var p,g,f,m,v=this.documentSpace.height(),b=null,w=null,y=u.start-1;y<=u.end-1;y++)l=this.useVirtualScrolling?c[y].top():d[y].y,pageHeight=c[y].prop()*this.pageWidth(),h=Math.floor(l+pageHeight),p=Math.max(l,r),g=Math.min(h,r+v),f=g-p,m=f/pageHeight,(null==w||m>w)&&(w=m,b=y);o=b+1}else if(null!=this._firstPage){o=(r+s/2)/this._firstPage.outerHeight(!0);var _=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());0==_&&(_=1),this.layout()==this.Layouts.OnePageInRow&&(_=1),o>>=0;var S=this.pageCount();o!=S&&(o+=1),o=(o-1)*_+1,o>S&&(o=S)}null!==o&&(this.pageInd(o),this.setPageNumerInUrlHash(o),e(this).trigger("onScrollDocView",{pi:o,position:r}),this.documentSpace.trigger("documentScrolledToPage.groupdocs",[o]))}},ScrollDocViewEnd:function(t,i){if(!this.useTabsForPages()){this.isSetCalled=!1,this.scrollPosition=[e(i.target).scrollLeft(),e(i.target).scrollTop()];var n=this.loadImagesForVisiblePages();this._dvselectable&&e(this._dvselectable).dvselectable("setVisiblePagesNumbers",n),e(this).trigger("onDocumentPageSet",[this.pageInd()]),this.documentSpace.trigger("documentScrolledToPage.groupdocs",[this.pageInd()])}},getVisiblePagesNumbers:function(){if(this.useTabsForPages())return{start:1,end:1};var e,t=null,i=null,n=this.documentSpace.scrollTop(),o=null,s=this.documentSpace.height();if(this.variableHeightPageSupport){var r=this.getSelectableInstance();if(null==r&&!this.useVirtualScrolling)return null;var a,l,h=this.pages();if(this.useVirtualScrolling)l=h.length;else{if(a=r.pageLocations,a.length!=h.length)return null;l=a.length}for(var u,d,c=0;l>c;c++)u=this.useVirtualScrolling?h[c].top():a[c].y,e=h[c].prop()*this.pageWidth(),d=u+e,(u>=n&&n+s>=u||d>=n&&n+s>=d||n>=u&&d>=n+s)&&(null===t?t=c+1:i=c+1);null===i&&(i=t)}else if(null!=this._firstPage){e=this._firstPage.outerHeight(!0);
var p=this._firstPage.outerWidth(!0),g=this.pagesContainerElement.width();o=Math.floor(n/e)+1;var f=Math.floor((n+s)/e)+1,m=Math.floor(g/p);0==m&&(m=1),this.layout()==this.Layouts.OnePageInRow&&(m=1),t=1!=o?(o-1)*m+1:1,i=f*m<=this.pageCount()?f*m:this.pageCount()}return{start:t,end:i}},loadImagesForVisiblePages:function(e){var t=this.getVisiblePagesNumbers();if(null!=t){var i=t.start,n=t.end;null!==i&&null!==n&&(this.loadImagesForPages(i,n,e),this.useVirtualScrolling&&(this.firstVisiblePageForVirtualMode(t.start-1),this.lastVisiblePageForVirtualMode(t.end-1)))}return t},loadImagesForPages:function(e,t,i){for(var n=e;t>=n;n++){var o=this.pages()[n-1];o.visible()&&this.markContentControls(n-1),"image"==this.pageContentType?(this.triggerImageLoadedEvent(n),this.supportPageRotation&&i&&this.addSuffixToImageUrl(o)):"html"==this.pageContentType&&!o.visible()&&this.getDocumentPageHtml(n-1),o.visible(!0)}},setPage:function(t){this.isSetCalled=!0;var i=Number(t);(isNaN(i)||1>i)&&(i=1),this.pageInd(i);var n;if(this.variableHeightPageSupport)if(this.useVirtualScrolling)n=this.pages()[i-1].top();else{var o=this.getSelectableInstance();if(null!=o&&o.pageLocations&&o.pageLocations.length>0){var s=o.pageLocations[i-1].y;n=s}}else{var r=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());0==r&&(r=1),this.layout()==this.Layouts.OnePageInRow&&(r=1);var a=Math.ceil(i/r)-1;n=a*this._firstPage.outerHeight(!0)}var l=this.documentSpace.scrollTop();if(this.documentSpace.scrollTop(n),this.documentSpace.scrollTop()==l&&(this.isSetCalled=!1),e(this).trigger("onDocViewScrollPositionSet",{position:n}),"image"==this.pageContentType)this.triggerImageLoadedEvent(i),this.pages()[i-1].visible(!0);else if("html"==this.pageContentType){var h=this.pages()[i-1];!h.visible()&&this.getDocumentPageHtml(i-1)}this.setPageNumerInUrlHash(i),e(this).trigger("onDocumentPageSet",[i]),this.documentSpace.trigger("documentPageSet.groupdocs",i)},triggerImageLoadedEvent:function(t){e.browser.msie&&!this.pages()[t-1].visible()&&e("img#img-"+t).load(function(){e(this).trigger("onPageImageLoaded")})},setZoom:function(e){if(this.zoom(e),this.loadPagesZoomed(),this.clearContentControls(),"image"==this.pageContentType){if(this._pdf2XmlWrapper){var t=this._pdf2XmlWrapper.getPageSize();this.scale(this.pageImageWidth/t.width*e/100)}this._dvselectable.dvselectable("changeSelectedRowsStyle",this.scale()),this.reInitSelectable(),this.useVirtualScrolling&&(this.getSelectableInstance().recalculateSearchPositions(this.scale()),this.highlightSearch()),this.recalculatePageLeft(),this.setPage(this.pageInd()),this.shouldMinimumWidthBeUsed(this.pageWidth(),!0)&&this.loadImagesForVisiblePages(),this.options.showHyperlinks&&this._refreshHyperlinkFrames()}else"html"==this.pageContentType&&(this.reInitSelectable(),this.setPage(this.pageInd()),this.loadImagesForVisiblePages())},loadPagesZoomed:function(){var e=Math.round(this.initialWidth*this.zoom()/100),t=Math.round(e*this.heightWidthRatio),i=this.pages();if(e!=this.pageWidth()||t!=this.pageHeight()){if(this.pagesDimension=Math.floor(e)+"x",this.pageWidth(e),this.pageHeight(t),this.useTabsForPages()){var n=this.documentSpace.find(".html_page_contents:first"),o=n.children("div,table,img"),s=o[0].getBoundingClientRect(),r=20,a=this.autoHeight();this.autoHeight(!0),i[0].prop((s.height+r)/e),this.autoHeight(a)}else this.calculatePagePositionsForVirtualMode();if("image"==this.pageContentType){var l=this.pageCount();!this.shouldMinimumWidthBeUsed(e,!0)&&this.retrieveImageUrls(l)}}},performSearch:function(t,i,n,o,s){if("image"==this.pageContentType){var r=this.getSelectableInstance();if(null!=r){var a=r.performSearch(t,this.scale(),i,n,o,s);e(this).trigger("onSearchPerformed",[a])}}else{this.searchText=t,this.searchForSeparateWords=n,this.treatPhrasesInDoubleQuotesAsExact=o;for(var l,h=this.pages(),u=0;u0&&-1==P||-1!=P)&&(d="^"+d),t=new RegExp(d,r?"":"i"),g=e.data,-1==P?k&&(g=g.substr(I,g.length-I),T=I,k=!1):(T=P+x,g=g.substr(T,g.length-T));for(var M,O="",E=null,R=0;R=u){for(var F="search_highlight"+this.matchesCount.toString(),V=u-1;V>=0;V--)this.highlightOneNode(this.matchedNods[V],this.searchMatches[V].index,this.searchMatches[V].length,F,n,l);return this.currentWordCounter=0,this.matchedNods=[],this.searchMatches=[],this.matchedNodsCount=0,this.matchesCount++,c}}else this.currentWordCounter=0,this.matchedNods=[],this.searchMatches=[]}while(p&&T+p.index+p[0].length=z;L--)L-=this.searchHtmlElement(e.childNodes[L],t,i,n,o,s,r,a,l,h);else for(L=z;B>L;L++)L+=this.searchHtmlElement(e.childNodes[L],t,i,n,o,s,r,a,l,h)}return 0},highlightOneNode:function(t,i,n,o,s,r){var a,l,h=!1,u=e(t);if(u.is("tspan")||u.parent().is("tspan")){h=!0,l=this.htmlSearchHighlightSvgElement;var d="http://www.w3.org/2000/svg";a=document.createElementNS(d,l),a.setAttribute("class",s||this.htmlSearchHighlightClassName)}else l=this.htmlSearchHighlightElement,a=document.createElement(l),a.className=s||this.htmlSearchHighlightClassName;var c=e(a);o&&c.attr("name",o),c.attr("data-page-num",r.toString());var p,g,f=t.data,m=!1,v=[],b=0;if(this.isRTL(f)){for(p=0;p=w.start&&y>i){_=i-w.start,i=y-_;break}for(C=0;C=w.start&&y>=S){_=S-w.start,S=y-_,i=S,i+n>f.length&&(n=f.length-i);break}}var P=t.splitText(i);P.splitText(n);var x=P.cloneNode(!0);a.appendChild(x),P.parentNode.replaceChild(a,P)},removeSearchHighlight:function(t){var i=this.htmlSearchHighlightElement+"."+this.htmlSearchHighlightClassName,n=this.htmlSearchHighlightSvgElement+"."+this.htmlSearchHighlightClassName;e(t).find(i+","+n).each(function(){var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()})},getWords:function(t){var i,n="[^"+this.searchSeparatorsList+"]+",o=new RegExp(n,"g"),s=t.match(o);return i=null==s?null:e.map(s,function(e){return""!=e?e:void 0})},selectTextInRect:function(t,i,n,o,s,r){return this._dvselectable?e(this._dvselectable).dvselectable("highlightPredefinedArea",t,i,n,o,s,r):null},deselectTextInRect:function(t,i,n,o){this._dvselectable&&e(this._dvselectable).dvselectable("unhighlightPredefinedArea",t,i,n,o)},recalculatePageLeft:function(){if(null!=this._firstPage&&null!=this.pagesContainerElement){var e=this._firstPage.offset().left-this.pagesContainerElement.offset().left;this.pageLeft(e)}},reInitSelectable:function(){var e=this.getVisiblePagesNumbers();null!=this._dvselectable&&this._dvselectable.dvselectable("reInitPages",this.scale(),e,this.scrollPosition,this.getPageHeight(),this.pages())},reInitCanvasOffset:function(){var e=this.getSelectableInstance();e.initCanvasOffset()},openCurrentPage:function(){this.setPage(this.pageInd())},setPageNumerInUrlHash:function(e){(this.usePageNumberInUrlHash===t||1==this.usePageNumberInUrlHash)&&(""!=location.hash||e>1)&&(this.changedUrlHash=!0,location.hash=this.hashPagePrefix+e.toString(),this.changedUrlHash=!1)},isScrollViewerVisible:function(){return this.documentSpace.is(":visible")},getSelectableInstance:function(){if(null==this._dvselectable)return null;var e=this._dvselectable.data("ui-dvselectable");return e||(e=this._dvselectable.data("dvselectable")),e},shouldMinimumWidthBeUsed:function(e,t){var i=null;if("false"!=this.use_pdf&&t){var n=this._pdf2XmlWrapper.getPageSize();i=n.width}return null!=this.minimumImageWidth&&(e<=this.minimumImageWidth||null!==i&&i=r;r++)i=n[r].url(),n[r].url(i+"#0"),n[r].visible(!0);this._pdf2XmlWrapper&&this._pdf2XmlWrapper.reorderPage(e,t),this.reInitSelectable(),this.loadImagesForVisiblePages()}.bind(this),function(e){this._onError(e)}.bind(this))},rotatePage:function(e){var t=this.pageInd()-1;this._model.rotatePage(this.fileId,t,e,function(e){var i=this.pages()[t];this.applyPageRotationInBrowser(t,i,e.resultAngle),this.setPage(t+1),this.loadImagesForVisiblePages(!0)}.bind(this),function(e){this._onError(e)}.bind(this))},applyPageRotationInBrowser:function(e,t,i){if(this.supportPageRotation){var n=t.rotation();if(0!=n||0!=i){"image"==this.pageContentType&&n!=i&&(t.visible(!1),this.addSuffixToImageUrl(t),t.visible(!0)),t.rotation(i);var o=t.rotation()%180,s=this._pdf2XmlWrapper.documentDescription.pages;if(s){var r,a,l,h=this.getPageSize(),u=s[e];if(this.useTabsForPages()){var d=this.documentSpace.find(".html_page_contents:first"),c=d.children("div,table");r=c.width(),a=c.height(),o>0?(l=r,this.pageWidth(a*this.zoom()/100)):(l=a,this.pageWidth(r*this.zoom()/100))}else r=u.w,a=u.h,l=h.height;var p;o>0?(t.prop(r/a),"html"==this.pageContentType&&(p=this.getScaleRatioForPage(h.width,h.height,a,r),t.heightRatio(p))):(t.prop(a/r),"html"==this.pageContentType&&(p=this.getScaleRatioForPage(h.width,h.height,r,a),t.heightRatio(p))),this.calculatePagePositionsForVirtualMode(),this.reInitSelectable(),this.loadImagesForVisiblePages(!0)}}}},getHtmlElements:function(e,t){var i=new RegExp("<"+t+"[^>]*>(?:.|\\r?\\n)*?<\\/"+t+">","gi"),n=e.match(i);return n},getHtmlElementContents:function(e,t){var i=new RegExp("<"+t+"[^>]*>((?:.|\\r?\\n)*?)<\\/"+t+">","i"),n=e.match(i),o=null;return n&&(o=n[1]),o},getHtmlElementAttributess:function(e,t){var i=new RegExp("<"+t+"[^>]*/?>","gi"),n=e.match(i);return n},getPageBodyContents:function(e){return e.match(/]*>((?:.|\r?\n)*?)<\/body>/)[1]},getPageBodyContentsWithReplace:function(e){var t=""),s="";return s},isPageVisible:function(e){return this.pages()[e].visible()},getPageLocations:function(){return this.getSelectableInstance().pageLocations},getPageSize:function(){return this._pdf2XmlWrapper.getPageSize()},fixImageReferencesInHtml:function(e){return this.getPageBodyContents(e)},calculatePointToPixelRatio:function(){var t=100,i=e("").css("width",t+"pt").css("height","0");i.appendTo(this.documentSpace);var n=i.width();this.pointToPixelRatio=n/t,i.remove()},activateTab:function(e){function t(){var t=n.pages(),o=t[0];o.htmlContent(i.htmlContent());var s=n.documentSpace.find(".html_page_contents:first"),r=s.children("div,table"),a=r.width();n.initialWidth=a,o.prop(r.height()/a),n.pageWidth(a*n.zoom()/100),n.activeTab(e),n.supportPageRotation&&n.applyPageRotationInBrowser(0,o,o.rotation())}var i=this.tabs()[e],n=this;i.visible()?t():this.getDocumentPageHtml(e,function(){t()})},adjustInitialZoom:function(){if(this.zoomToFitHeight&&this.setZoom(this.getFitHeightZoom()),"html"==this.pageContentType&&this.zoomToFitWidth){var e=this.getFitWidth(),t=this.pageWidth();if(!this.onlyShrinkLargePages||t>e){var i=e/t*100;this.setZoom(i)}}},intToColor:function(e){null===e?e=4294901760:e>>>=0;var t=255&e,i=(65280&e)>>>8,n=(16711680&e)>>>16,o=((4278190080&e)>>>24)/255;return"rgba("+[n,i,t,o].join(",")+")"},watermarkTransform:function(e,t){var i=0;e.rotation&&(i=e.rotation());var n=e.prop(),o="Top",s="Bottom",r="Diagonal",a="Left",l="Center",h="Right",u="",d=l;0==this.watermarkPosition.indexOf(o)?u=o:0==this.watermarkPosition.indexOf(s)?u=s:0==this.watermarkPosition.indexOf(r)&&(u=r,d=l),u!=r&&(-1!=this.watermarkPosition.indexOf(a)?d=a:-1!=this.watermarkPosition.indexOf(l)?d=l:-1!=this.watermarkPosition.indexOf(h)&&(d=h));var c,p="translate(",g=100,f=g*n;if(null==this.watermarkScreenWidth){var m=t.getBBox();this.watermarkScreenWidth=m.width}c=this.watermarkScreenWidth;var v;v=0==this.watermarkWidth?1:this.watermarkWidth/100;var b=g;u==r&&g>f&&(b=f);var w=b*v,y=b/c;i%180!=0&&u!=r&&(w=f*v,y=f/c),v*=y;var _=g/2,S=f/2,C=0;switch(d){case l:C=(g-w)/2;break;case a:C=0;break;case h:C=g-w}if(p+=C+","+(u==o?0:f-f*v)+")scale("+v+")",u==r&&(p+="translate(0,"+-S/v+") rotate("+(-50+i)+","+(_-C)/v+","+f+") "),!e.rotation||u==r)return p;var P,x=0,T=0,I=0,k=0;switch(d==l?(P=(_-C)/v,k=u==o?0:f):d==a?(P=_/v,i%180!=0&&(I=(_-S)/v),k=u==o?0:f):d==h&&(P=-(C-_)/v,i%180!=0&&(I=-(_-S)/v),k=u==o?0:f),i){case 90:u==o?(x=S/v,T=-_/v):(x=-S/v,T=_/v);break;case 180:u==o?(x=S/v,T=-S/v):(x=-S/v,T=S/v);break;case 270:u==o?(x=S/v,T=-_/v):(x=-S/v,T=_/v)}return(u==o||u==s)&&(p+="translate(0,"+x+") rotate("+i+","+P+","+k+") translate("+I+","+T+")"),p},addSuffixToImageUrl:function(e){var t=e.url(),i="?",n=t.indexOf("dummy=");-1!=n&&(t=t.substring(0,n-1));var o=t.indexOf("?");-1!=o&&(i="&"),e.url(t+i+"dummy="+(new Date).getTime())},isRTL:function(e){var t="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-﷾--",i="֑-߿יִ-﷽ﹰ-ﻼ",n=new RegExp("^[^"+t+"]*["+i+"]");return n.test(e)},setLoadingState:function(e){this.inprogress(e)},getScaleRatioForPage:function(e,t,i){var n,o;return n=e/i,o=n},pageElementStyle:function(e){var t={},i=this.pages();if(this.useVirtualScrolling){var n=this.firstVisiblePageForVirtualMode();e+=n,nd)&&(d=i),l=u+d+o,g?(u+=d+o,h=0):h+=a+s;this.documentHeight(l)}},clearContentControls:function(){if(this.supportListOfContentControls&&this.contentControlsFromHtml){for(var e,t=0;t=p.contentControls[h].startPage&&t<=p.contentControls[h].endPage)if(n.indexOf(s)==u){var g=n.indexOf(a,u)+1,f=n.substring(g,n.length),m="1"==n[u+s.length],v=i;"undefined"==typeof d[h]&&((m||0==v.parent().children(":not([name^='"+o+"'])").length)&&(v=v.parent()),d[h]={title:f,number:h}),d[h].startElement=v,d[h].moveUpInDom=m}else 0==i.parent().children(":not([name^='"+o+"'])").length&&(i=i.parent()),"undefined"==typeof d[h]&&(d[h]={endElement:i,number:h}),d[h].endElement=i}),n=0;n=this.contentControls[n].startPage&&t<=this.contentControls[n].endPage&&(d[n]||(d[n]={number:n,title:this.contentControls[n].title}));for(n=0;n").appendTo(t);r.visualWrapper=u,u.addClass("content_control_visual_wrapper");var d=a.nextUntil(l,":not([name^='"+o+"'])").add(l);r.moveUpInDom&&(d=d.add(a));var c=d.find("*");d=d.add(c);var p,g,f,m,v=null,b=null,w=null,y=null,_=this.zoom()/100;d.each(function(){var t=e(this);0!=t.width()&&0!=t.height()&&(p=t.offset().left,(null===v||v>p)&&(v=p),g=t.width()*_,(null===b||p+g>b)&&(b=p+g),f=t.offset().top,(null===w||w>f)&&(w=f),m=t.height()*_,(null===y||f+m>y)&&(y=f+m))});var S=t.offset().left,C=t.offset().top;if(u.css("left",v-S+"px"),u.css("width",b-v+"px"),u.css("top",w-C+"px"),u.css("height",y-w+"px"),u.attr("data-title",r.title),0==s){i.sort(function(e,t){return e.visualWrapper&&t.visualWrapper?t.visualWrapper.width()*t.visualWrapper.height()-e.visualWrapper.width()*e.visualWrapper.height():0});for(var P=1,x=0;x=2&&'"'==a[0]&&'"'==a[a.length-1]&&(n=n.substr(1,a.length-2),n=n.replace(/^[\r\n\s]+|[\r\n\s]+$/g,""),i.currentWordCounter=0,i.matchedNods=[],i.searchMatches=[],i.matchedNodsCount=0,r=!0)}var l=/[-[\]{}()*+?.,\\^$|#\s]/g;if(o=i.getWords(n),null==o)return;o=jQuery.map(o,function(e){return e.replace(l,"\\$&")});for(var h=!1,u=0;ue.bottomRight.x||this.bottomRight.xe.bottomRight.y||this.bottomRight.ythis.bottomRight.x&&(this.bottomRight.x=[this.topLeft.x,this.topLeft.x=this.bottomRight.x][0]),this.topLeft.y>this.bottomRight.y&&(this.bottomRight.y=[this.topLeft.y,this.topLeft.y=this.bottomRight.y][0]),this}}),$.ctrl=function(e,t,i){$(document).keydown(function(n){return i||(i=[]),n.keyCode==e.charCodeAt(0)&&n.ctrlKey?(t.apply(this,i),!0):void 0})},function(e,t){e.widget("ui.dvselectable",e.ui.mouse,{customArea:[],search:null,lasso:null,pages:[],prevProportions:1,prevCustomTemplateProportions:1,searchProportions:1,selectedRowsCoordinates:[],highlightPaneContainer:null,highlightSearchPaneContainer:null,buttonPaneContainer:null,template:"",searchTemplate:"",addTemplate:"",cAreaPageIndex:0,cAreaFieldIndex:0,annotationContainer:"{1}",annotationTemplate:"",timeouts:[],flag:0,options:{appendTo:"body",txtarea:"",pdf2XmlWrapper:null,startNumbers:null,pagesCount:0,proportion:1,cancel:":input,option,.comment",bookLayout:!1,docSpace:"",highlightColor:null},_initialized:!1,_textSelectionByCharModeEnabled:!1,_canvasOffset:null,_canvasScroll:null,_mouseStartPos:null,_selectionInfo:{position:-1,length:0},SelectionModes:{SelectText:0,SelectRectangle:1,SelectTextToStrikeout:2,ClickPoint:3,TrackMouseMovement:4,DoNothing:5},_mode:null,_lassoCssElement:null,rightMargin:35,parentElement:null,_viewModel:null,selectionCounter:0,_create:function(){function t(e){e.preventBubble()
}this._initialized=!1,this.initCanvasOffset(),this.options.initializeStorageOnly||(this.dragged=!1,this.options.preventTouchEventsBubbling&&this.element.bind({touchstart:t,touchmove:t,touchend:t}),this._mouseInit(),this.helper=e(""),this.createEventHandlers(),this.setMode(this.SelectionModes.SelectText),this.pagePrefix=this.options.pagePrefix),this.search=[]},createEventHandlers:function(){var t=this;e.ctrl("C",function(){var i=e(document.activeElement),n=i.attr("id");(n==t.options.txtarea.attr("id")||!i.is("input")&&!i.is("textarea"))&&t.options.txtarea.focus().select()}),e(t.element).bind({click:function(e){return t.mouseClickHandler(e)}})},_init:function(){this._initialized=!1,null!=this.options.pdf2XmlWrapper&&(this.initStorage(),this._initialized=!1)},destroy:function(){return this._mouseDestroy(),this},initStorage:function(){if(!this._initialized){this._initialized=!0;var t;this.pageLocations=this.options.useVirtualScrolling?e.map(this.options.pageLocations,function(e){return new jSaaspose.Point(e.left,e.top())}):this._getPageLocations(),t=this.pageLocations,null!=this.options.pdf2XmlWrapper&&(this.pages=this.options.bookLayout?this.options.pdf2XmlWrapper.getPages(this.options.proportion,t,this.options.startNumbers.start-1,this.options.startNumbers.end-1,this.options.useVirtualScrolling):this.options.pdf2XmlWrapper.getPages(this.options.proportion,t,0,this.options.pagesCount-1))}},initCanvasOffset:function(){this.parentElement=this.options.docSpace.parent();var e=this.element.parent().offset(),t=e.left,i=e.top;this.options.bookLayout&&(i=this.parentElement.offset().top),this._canvasOffset=new jSaaspose.Point(t,i)},getPages:function(){return this.initStorage(),this.pages},_getPageLocations:function(){var t=this,i=this.options.docSpace.attr("id"),n=".page-image",o=this.element.find(n);return this.options.bookLayout&&(o=o.filter("[id='"+i+"-img-"+this.options.startNumbers.start.toString()+"'],[id='"+i+"-img-"+this.options.startNumbers.end.toString()+"']")),this._canvasScroll=this.getCanvasScroll(),e.map(o,function(i){var n=e(i),o=n.offset().left-t._canvasOffset.x+t._canvasScroll.x,s=t.options.bookLayout?0:n.offset().top-t.element.offset().top;return new jSaaspose.Point(o,s)})},getCanvasScroll:function(){return this.options.bookLayout?new jSaaspose.Point(this.parentElement.scrollLeft(),this.parentElement.scrollTop()):new jSaaspose.Point(this.element.parent().scrollLeft(),this.element.parent().scrollTop())},clearSelection:function(){this.element.find(".selection-highlight:not(.static)").remove()},_mouseCapture:function(e){return this._canvasScroll=this.getCanvasScroll(),this._mouseStartPos=new jSaaspose.Point(e.pageX-this._canvasOffset.x+this._canvasScroll.x,e.pageY-this._canvasOffset.y+this._canvasScroll.y),this._mode!=this.SelectionModes.DoNothing&&null!=this._findPageAt(this._mouseStartPos)},_mouseStart:function(){if(this.options.docSpace.focus(),this.initStorage(),this.clearSelection(),this._mode==this.SelectionModes.DoNothing)return!1;if(this.selectionCounter++,this._canvasScroll=this.getCanvasScroll(),this.options.bookLayout&&(this._canvasScroll.y+=this.parentElement.parent().scrollTop()),this.checkMouseIsInEdgeInBookMode(this._mouseStartPos.x,this._mouseStartPos.y))return!1;if(this._mode==this.SelectionModes.TrackMouseMovement){var e=this._mouseStartPos.y,t=this.findPageAtVerticalPosition(e),i=parseInt(t.pageId)-1;this.element.trigger("onMouseMoveStarted",[i,{left:this._mouseStartPos.x,top:e}])}else this.element.append(this.helper),this.helper.css({left:this._mouseStartPos.x,top:this._mouseStartPos.y,width:0,height:0});this.options.txtarea.val(""),this.lasso=new jSaaspose.Rect},_mouseDrag:function(e){if(this._mode==this.SelectionModes.DoNothing||this.checkMouseIsInEdgeInBookMode(this._mouseStartPos.x,this._mouseStartPos.y))return!1;var i=this._mouseStartPos.x,n=this._mouseStartPos.y,o=e.pageX-this._canvasOffset.x+this._canvasScroll.x,s=e.pageY-this._canvasOffset.y+this._canvasScroll.y,r=o,a=s;if(!this._findPageAt(new jSaaspose.Point(r,a)))return!1;if(this.dragged=!0,i>o){var l=o;o=i,i=l}if(n>s){var l=s;s=n,n=l}return this.lasso.set(i,n,o,s),this._mode!=this.SelectionModes.ClickPoint&&this._mode!=this.SelectionModes.TrackMouseMovement&&this.helper.css({left:i,top:n,width:this.lasso.width(),height:this.lasso.height()}),this.findSelectedPages(!1,null,t,this.options.highlightColor),this.element.trigger("onMouseDrag",[{left:r,top:a}]),!1},_mouseStop:function(t){if(this._mode==this.SelectionModes.DoNothing)return!1;this.helper.remove();var i=this._findPageAt(this.lasso.topLeft)||this.pages[0];if("undefined"==typeof i)return!1;var n,o=parseInt(i.pageId)-1,s=null;if(0>o)return!1;if(this._mode==this.SelectionModes.SelectText||this._mode==this.SelectionModes.SelectTextToStrikeout){if(!this.dragged)return!1;var r=this;this.dragged=!1;var a=r._getDocumentHighlightRects();if(!a||0==a.length)return!1;var l="",h=this.options.storeAnnotationCoordinatesRelativeToPages?this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso):this.convertRectToAbsoluteCoordinates(this.lasso),u=h.top(),d=h.bottom();h=a[0].originalRect;var c=h.left(),p=h.right(),g=h.top(),f=h.bottom(),m=a[0].position,v=a[a.length-1].position+a[a.length-1].length-m;s=[];for(var b=0;b0&&(a[b-1].page!=a[b].page||a[b-1].row!=a[b].row)?"\r\n":" ",h=a[b].originalRect,s.push(h),c=Math.min(c,h.left()),p=Math.max(p,h.right()),g=Math.min(g,h.top()),f=Math.max(f,h.bottom());var w=this.options.proportion;this.options.storeAnnotationCoordinatesRelativeToPages?(u=Math.min(g,u),d=Math.max(f,d)):(n=o*this.options.pageHeight,n/=w,u=Math.max(n+g,u),d=Math.min(n+f,d));var y=new jSaaspose.Rect(c,u,p,d),_=y.clone();this.options.txtarea.val(e.trim(l))}switch(this._mode){case this.SelectionModes.SelectText:this.element.trigger("onTextSelected",[o,_,m,v,this.selectionCounter,s]);break;case this.SelectionModes.SelectTextToStrikeout:this.element.trigger("onTextToStrikeoutSelected",[o,_,m,v,this.selectionCounter,s]);break;case this.SelectionModes.SelectRectangle:var S;S=this.options.storeAnnotationCoordinatesRelativeToPages?this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso,this._mouseStartPos):this.convertRectToAbsoluteCoordinates(this.lasso,this._mouseStartPos),this.element.trigger("onRectangleSelected",[o,S]);break;case this.SelectionModes.ClickPoint:this.mouseClickHandler(t);break;case this.SelectionModes.TrackMouseMovement:e(this.element).trigger("onMouseMoveStopped",[])}return!1},mouseClickHandler:function(e){if(this.options.docSpace.focus(),this._mode==this.SelectionModes.ClickPoint){this.initStorage(),this._canvasScroll=this.getCanvasScroll();var t=e.pageX-this._canvasOffset.x+this._canvasScroll.x,i=e.pageY-this._canvasOffset.y+this._canvasScroll.y,n=new jSaaspose.Rect(t,i,t,i),o=this._findPageAt(n.topLeft);if(!o)return!0;var s=parseInt(o.pageId)-1;return n=this.options.storeAnnotationCoordinatesRelativeToPages?this.convertRectToRelativeToPageUnscaledCoordinates(n):this.convertRectToAbsoluteCoordinates(n),this.element.trigger("onPointClicked",[s,n]),!1}return!0},checkMouseIsInEdgeInBookMode:function(e,t){var i=this.element.width(),n=this.element.height(),o=100,s=100;return this.options.bookLayout&&(e>i-o&&s>t||e>i-o&&t>n-s||o>e&&s>t||o>e&&t>n-s)?!0:!1},convertRectToAbsoluteCoordinates:function(e,t){this.initStorage();var i=e.clone(),n=this.options.proportion,o=null;o=this._findPageNearby(t?t:i.topLeft),i.subtract(o.rect.topLeft);var s=parseInt(o.pageId)-1,r=s*this.options.pageHeight;return r/=n,i.scale(1/n),i.add(new jSaaspose.Point(0,r)),i},convertRectToScreenCoordinates:function(e){this.initStorage();var t=e.clone().scale(this.options.proportion);t.top()<0&&t.setTop(0);var i=this.options.pageHeight,n=Math.floor(t.top()/i);return t.subtract(new jSaaspose.Point(0,n*i)),t.add(this.pages[n].rect.topLeft),t},convertRectToRelativeToPageUnscaledCoordinates:function(e,t){this.initStorage();var i=e.clone(),n=this.options.proportion,o=null;return o=this._findPageNearby(t?t:i.topLeft),i.subtract(o.rect.topLeft),i.scale(1/n),i},convertPageAndRectToScreenCoordinates:function(e,t){this.initStorage();var i=t.clone().scale(this.options.proportion);return i.top()<0&&i.setTop(0),i.add(this.pages[e].rect.topLeft),i},highlightPredefinedArea:function(e,t,i,n,o,s){this.initStorage(),this.dragged=!0,this.lasso=this.options.storeAnnotationCoordinatesRelativeToPages?this.convertPageAndRectToScreenCoordinates(i,e):this.convertRectToScreenCoordinates(e),this.selectionCounter++;var r=this._findPageAt(this.lasso.topLeft)||this.pages[0],a=this.options.startNumbers;return this.options.startNumbers={start:parseInt(r.pageId),end:parseInt(r.pageId)},this.findSelectedPages(!0,t,n,o||this.options.highlightColor,s),this.options.startNumbers=a,this.dragged=!1,"undefined"==typeof n?this.selectionCounter:n},unhighlightPredefinedArea:function(t,i,n,o){this.lasso=this.options.storeAnnotationCoordinatesRelativeToPages?this.convertPageAndRectToScreenCoordinates(n,t):this.convertRectToScreenCoordinates(t);var s=this._getDocumentHighlightRects();if(s&&0!=s.length){"undefined"==typeof o&&(o="");for(var r=0;r=2&&'"'==h[0]&&'"'==h[h.length-1]&&(o=!1,a=h.substr(1,h.length-2),a=a.replace(/^[\r\n\s]+|[\r\n\s]+$/g,""),l=!0)}if(this.search.length=0,this.initHighlightSearchPaneContainer(),""==a)return-1;this.searchProportions=i;var u,d,c,p,g,f,m=this.pages,v=m.length,b=[],w=[],y=[],_=0;r&&(f=new RegExp(window.jGroupdocs.stringExtensions.getAccentInsensitiveRegexFromString(a)));for(var S,C=0;v>C;C++){for(var P,x,T=m[C].rows,I=T.length,k=C+1,M=0;I>M;M++){var O,E=0,R=0,H=T[M];if(O=n?H.text:H.text.toLowerCase(),o){if(y=this.getWords(a),r){for(var W=[],D=0;DN;N++)for(A=0;u>A;A++){var F=e.trim(y[A]),V=P[N].text;if(n||(F=F.toLowerCase(),V=V.toLowerCase()),g=V.search(F),-1!=g){for(var L=this.options.pdf2XmlWrapper.getRowCharacterCoordinates(C,M),z=P[N].originalRect.left(),B=0,j=0;j=Math.round(z)){B=j;break}}var $=B+g;E=$E||E>ot)&&(E=z),lt=$+F.length,R=lt>=L.length?H.originalRect.right():L[lt],S=P[N].rect.clone(),S.subtract(P[N].pageLocation);var Z=this.options.proportion,J=E*Z,q=R*Z;S.setLeft(J),S.setRight(q),b.push(S),S=P[N].originalRect.clone(),S.setLeft(E),S.setRight(R),w.push(S)}}}else{var G;for(G=O.search(r?f:a);-1!=G;)if(P=H.words,this.options.searchPartialWords){var X=/\s/g,K=O.substring(0,G),Q=K.match(X),Y=a.match(X),et=0,tt=0;Q&&(et=Q.length),Y&&(tt=Y.length);var it=et+tt,L=this.options.pdf2XmlWrapper.getRowCharacterCoordinates(C,M),z=P[et].originalRect.left(),nt=P[it].originalRect.left(),ot=P[it].originalRect.right(),st=H.originalRect.right();g=K.length-K.lastIndexOf(" ")-1;for(var B=0,rt=0,at=!1,j=0;j=Math.round(z)&&(B=j,at=!0),Math.round(U)>=Math.round(nt)){rt=j;break}}var $=B+g;E=$E||E>ot)&&(E=z);var lt,ht=a.lastIndexOf(" "),ut=a.substring(ht+1,a.length);lt=et==it?$+a.length:rt+ut.length;var dt=!0;if(ltR&&(R=st),!s||!l||dt){S=P[et].rect.clone(),S.subtract(P[et].pageLocation);var Z=this.options.proportion,J=E*Z,q=R*Z;S.setLeft(J),S.setRight(q),b.push(S),S=P[et].originalRect.clone(),S.setLeft(E),S.setRight(R),w.push(S)}G=O.indexOf(a,G+a.length)}else{if(y=this.getWords(a),u=y.length,0==u)break;if(x=P.length,1==u)for(p=0;x>p;p++)P[p].text.toLowerCase()==e.trim(y[0].toLowerCase())&&(S=P[p].rect.clone(),S.subtract(P[p].pageLocation),b.push(S));else for(d=0,c=u-1,p=0;x>p;p++)P[p].text.toLowerCase()==e.trim(y[d].toLowerCase())&&(S=P[p].rect.clone(),S.subtract(P[p].pageLocation),S.setRight(S.left()+P[p+c].rect.right()-P[p].rect.left()),b.push(S));G=-1}}}b.length>0&&(this.search.push({PageId:k,pageWords:b.slice(0),pageWordsUnscaled:w.slice(0)}),_+=b.length,b.length=0,w.length=0)}return this.highlightSearch(null,null),_},getWords:function(t){return e.map(t.split(" "),function(e){return""!=e?e:void 0})},highlightSearch:function(t,i){if(this.search){var n=this.search;this.initHighlightSearchPaneContainer();for(var o=0;o=t&&i>=s-1)for(var r=n[o].pageWords,a=0;ar;r++){for(var a="",l=t[r].PageId,h=t[r].pageWords,u=h.length,d=0;u>d;d++){var c=Math.round(Math.round(h[d].width()/o)*e),p=Math.round(Math.round(h[d].height()/o)*e),g=Math.round(Math.round(h[d].top()/o)*e),f=Math.round((h[d].left()-i)/o*e+i),m=window.jGroupdocs.stringExtensions.format(this.searchTemplate,this.pagePrefix+l+"-search-highlight-"+d,g,p,c,f);a+=m}s[l-1].innerHTML=a}}},recalculateSearchPositions:function(e){if(this.options.useVirtualScrolling&&0!=this.search.length){this.initHighlightSearchPaneContainer();for(var t=this.search,i=t.length,n=0;i>n;n++)for(var o,s,r,a,l=t[n],h=l.pageWordsUnscaled,u=h.length,d=0;u>d;d++)a=Math.round(h[d].left()*e),o=Math.round(h[d].width()*e),r=Math.round(h[d].top()*e),s=Math.round(h[d].height()*e),l.pageWords[d].set(a,r,a+o,r+s)}},clearAllTimeOuts:function(){var e=this.timeouts,t=e.length;if(t>0){for(var i=t;i--;)clearTimeout(e[i]);e=[]}},_getElementsByClassName:function(e,t){t||(t=document.getElementsByTagName("body")[0]);for(var i=[],n=new RegExp("\\b"+e+"\\b"),o=t.getElementsByTagName("*"),s=0,r=o.length;r>s;s++)n.test(o[s].className)&&i.push(o[s]);return i},highlightTemplateAreas:function(t,i){this.customArea=e.extend(!0,[],t),this.changeCustomAreasStyle(i)},changeCustomAreasStyle:function(t){if("undefined"!=typeof this.customArea&&0!=this.customArea.length){var i=this,n=this.customArea,o=31,s=n.length;e("#"+this.options.docSpace.attr("id")+"-pages-container .custom-pane").html("");var r=0,a="";!function l(){for(var h=n[r].fields,u=h.length,d=n[r].PageId,c=0;u>c;c++){var p=Math.round(Math.round(h[c].Width)*t),g=Math.round(Math.round(h[c].Height)*t),f=Math.round(Math.round(h[c].Y)*t),m=Math.round((h[c].X-o)*t+o),v=i.cAreaPageIndex==r&&i.cAreaFieldIndex==c?"border-color:blue":"";a+="";var b=window.jGroupdocs.stringExtensions.format(i.addTemplate,this.pagePrefix+r+"-custom-check-"+c,f-5,m+p-8,1==h[c].iconType?"selection-check":"selection-del",r+"/"+c);a+=b}++r;var w=s>r?n[r].PageId:-1;""!=a&&w!=d&&(e("#"+this.pagePrefix+d+" .custom-pane").html(a),i.bindCustomHandler(d),a=""),s>r&&setTimeout(l,0)}()}},bindCustomHandler:function(t){var i=this;e("#"+this.pagePrefix+t+" div.input-overlay1, #"+this.pagePrefix+t+" div.selection-check, #"+this.pagePrefix+t+" div.selection-del").bind({click:function(){var t=e(this).attr("index"),n=e("#doc-space").docAssemblyViewer("getViewModel");if("undefined"!=typeof t){var o=t.split("/"),s=o[0],r=o[1];return i.cAreaPageIndex=s,i.cAreaFieldIndex=r,n.moveTo({groupIndex:parseInt(s),fieldIndex:parseInt(r)}),!1}}}),e("#"+this.pagePrefix+t+" div.input-overlay1").bind({mouseover:function(t){var i=e(this).attr("index"),n=e("#doc-space").docAssemblyViewer("getViewModel");if("undefined"!=typeof i){var o=i.split("/"),s=o[0],r=o[1];n.mouseover(t,{groupIndex:parseInt(s),fieldIndex:parseInt(r)})}},mouseout:function(t){var i=e(this).attr("index"),n=e("#doc-space").docAssemblyViewer("getViewModel");if("undefined"!=typeof i){var o=i.split("/"),s=o[0],r=o[1];n.mouseout(t,{groupIndex:parseInt(s),fieldIndex:parseInt(r)})}}})},setCustomAreaIndex:function(e){var t=e.pageIndex,i=e.fieldIndex;this.cAreaPageIndex=t,this.cAreaFieldIndex=i},changeTemplateAreaIcon:function(t){var i=this.customArea,n=i[t.pageIndex].fields,o=this.pagePrefix+"{0}-custom-check-{1}",s=window.jGroupdocs.stringExtensions.format(o,t.pageIndex,t.fieldIndex);e("#"+s).attr("class",1==t.iconType?"selection-check":"selection-del"),n[t.fieldIndex].iconType=t.iconType},findSelectedPages:function(t,i,n,o,s){if(this._mode==this.SelectionModes.SelectText||this._mode==this.SelectionModes.SelectTextToStrikeout){"undefined"==typeof n&&(n=this.selectionCounter);var r=this._getDocumentHighlightRects(n);if(r&&0!=r.length)for(var a=null,l=null,h="",u=0;ua.bottom()||n.right()>a.right()&&n.top()a.bottom()&&n.top()a&&l>n&&o>=l,d=a>=n&&o>a&&l>o,c=d?-1:1,p=d?h.length-1:0;p=0&&!i.intersects(h[p].rect);p+=c)h[p].shown=!1;if(p==h.length||0>p)return null;for(var g=h[p],f=0,m=0,v=g.rect.left(),b=g.rect.top(),w=g.originalRect.left(),y=g.originalRect.top(),_=0,S=0,C={bounds:null,text:"",page:e+(this.options.bookLayout?this.options.startNumbers.start-1:0),row:t,position:g.position,length:g.text.length};p=0&&(d||u||i.intersects(h[p].rect));p+=c)g=h[p],g.shown=!0,this.dragged||(this._textSelectionByCharModeEnabled?this._textSelectionByCharModeEnabled&&(C.text+=g.isLastWordChar?g.text+" ":g.text):C.text+=g.text+" "),v=Math.min(v,g.rect.left()),b=Math.min(b,g.rect.top()),f=Math.max(f,g.rect.right()),m=Math.max(m,g.rect.bottom()),w=Math.min(w,g.originalRect.left()),y=Math.min(y,g.originalRect.top()),_=Math.max(_,g.originalRect.right()),S=Math.max(S,g.originalRect.bottom());for(;p=0;p+=c)h[p].shown=!1;var P=new jSaaspose.Rect(v,b+1,f,m-1);P.subtract(s.rect.topLeft),C.bounds=P;var x=new jSaaspose.Rect(w,y+1,_,S-1);return C.originalRect=x,C.length=g.position+g.text.length,C},_findPageAt:function(e){for(var t=0;t=this.pages[r].rect.top()&&e.y<=this.pages[r].rect.bottom()){var a=Math.abs(e.x-this.pages[r].rect.left());(!o||t>a)&&(t=a,o=!0,n=r)}else if(e.x>=this.pages[r].rect.left()&&e.x<=this.pages[r].rect.right()){var l=Math.abs(e.y-this.pages[r].rect.top());(!s||i>l)&&(i=l,s=!0,n=r)}}return this.pages[n]},findPageAtVerticalPosition:function(e){for(var t=0;t=this.pages[t].rect.top()&&e<=this.pages[t].rect.bottom()||e>=this.pages[t].rect.bottom()&&t+1>=this.pages.length||e>=this.pages[t].rect.bottom()&&e<=this.pages[t+1].rect.top())return this.pages[t];return null},setTextSelectionMode:function(e){this._textSelectionByCharModeEnabled=e},setMode:function(t){this._mode=t,t==this.SelectionModes.SelectText||t==this.SelectionModes.SelectTextToStrikeout?null==this._lassoCssElement&&(this._lassoCssElement=e('').appendTo("head")):this._lassoCssElement&&(this._lassoCssElement.remove(),this._lassoCssElement=null)},getMode:function(){return this._mode},getRowsFromRect:function(e){this.initStorage();var t=null;this.lasso=e.clone(),this.lasso=new jSaaspose.Rect(Math.round(this.lasso.left()),Math.round(this.lasso.top())+.001,Math.round(this.lasso.right()),Math.round(this.lasso.bottom())-.001);for(var i=this._getDocumentHighlightRects(),n=0;n0&&t.lengthg&&(i+1)*l>g;g++){var f,m=this.documentDescription.pages[g];if("undefined"!=typeof o){if(o>g)continue;if(g>s){p=!0;break}f=t[g-o]}else f=t[g];var v=m.number;n=u/m.w;var b=this.getRows(m,v,n,r,f),w=f.x+m.w*n,y=f.y+m.h*n;e.push({pageId:v,rows:b,rect:new jSaaspose.Rect(f.x,f.y,w,y)})}return d?p:(i++,void(h>i&&!p&&window.setTimeout(function(){c(e,i,n,o,s)},10)))}.bind(this);if(o||this.options.synchronousWork)for(var p=0;h>p&&!c(s,p,e,i,n,!0);p++);else window.setTimeout(function(){c(s,d,e,i,n)},10);return s},getRows:function(e,t,i,n,o){var s=[];if(e.rows)for(var r=0;r=i?1:i>n?n:1!=i?i-1:1,this._viewModel.pageInd(t),e(this.element).trigger("onUpNavigate",t)},down:function(){var t,i=this._viewModel.pageInd(),n=this._viewModel.pageCount();t=0>=i?1:i>n?n:i!=n?parseInt(i)+1:i,this._viewModel.pageInd(t),e(this.element).trigger("onDownNavigate",t)},set:function(t){var i=this._viewModel.pageInd(),n=this.setPageIndex(t),o="up";i>n&&(o="down"),e(this.element).trigger("onSetNavigate",{pageIndex:n,direction:o})},setPageIndex:function(e){var t=Number(e),i=this._viewModel.pageCount();return isNaN(t)?t=1:0>=t?t=1:t>i&&(t=i),this._viewModel.pageInd(t),t},openFirstPage:function(){this.selectPage(1)},openLastPage:function(){this.selectPage(this.pageCount())},onKeyPress:function(e){13==e.keyCode&&this.set(this._viewModel.pageInd())},setPagesCount:function(e){this._pageCount=e,this._viewModel.pageCount(e)},_createHtml:function(){var t=this.element;t.addClass("left"),e('of
').appendTo(t),t.trigger("onHtmlCreated")},_createEmbeddedHtml:function(){var t=this.element;t.addClass("left"),e('Page
of
').appendTo(t),t.trigger("onHtmlCreated")}})}(jQuery),function(e,t){e.widget("ui.thumbnails",{_viewModel:null,_pageCount:0,_sessionToken:"",_docGuid:"",_docVersion:1,_pagesWidth:"150",_heightWidthRatio:0,_thumbsSelected:0,_thumbnailWidth:150,_portalService:Container.Resolve("PortalService"),options:{quality:null,use_pdf:"false",baseUrl:null,userId:0,userKey:null,supportPageRotation:!1},_create:function(){if(this.useHtmlThumbnails=this.options.useHtmlThumbnails,this.useHtmlBasedEngine=this.options.useHtmlBasedEngine,this.options.supportPageReordering){var t=this;ko.bindingHandlers.sortableArray={init:function(i,n){var o=n();e(i).sortable({axis:"y",update:function(e,i){var n=i.item[0],s=ko.dataFor(n),r=o.indexOf(s),a=ko.utils.arrayIndexOf(i.item.parent().children(),n);i.item.remove(),a>=0&&(o.remove(s),o.splice(a,0,s)),t.rootElement.trigger("onPageReordered",[r,a])}})}}}this.options.createHtml&&this._createHtml(),this.options.thumbnailWidth&&(this._thumbnailWidth=this.options.thumbnailWidth),this._viewModel=this.getViewModel(),ko.applyBindings(this._viewModel,this.element.get(0)),this.options.useInnerThumbnails&&ko.applyBindings(this._viewModel,this.toggleThuumbnailsButton[0])},_createViewModel:function(){var e={thumbnails:ko.observable([]),pageInd:ko.observable(1),pageCount:ko.observable(0),busy:ko.observable(!0)};return e._thumbnailHeight=ko.observable(201),e.useInnerThumbnails=this.options.useInnerThumbnails,e.showThumbnails=ko.observable(this.options.openThumbnails),e.element=this.element,e.rootElement=this.rootElement,e.thumbnailPanelElement=this.thumbnailPanelElement,this.useHtmlThumbnails&&(e.scale=ko.observable(0)),e.scrollThumbnailsPanel=function(e){this._onScrollLeftPanel(e)
}.bind(this),e.selectPage=function(e){this.set(e)}.bind(this),e.hideThumbnails=function(){for(var e,t=0;tx;x++){if(g={number:x+1,busy:ko.observable(!0),visible:ko.observable(!1),url:ko.observable("")},u){if(xc&&(_=c/v,v=c,m=this._thumbnailWidth*_)}else m=this._thumbnailWidth,v=215;g.width=ko.observable(m),g.height=ko.observable(v),f=0,b="",C>v&&(f=((C-v)/2).toString(),b="white"),g.verticalPadding=ko.observable(f),g.backgroundColor=ko.observable(b),g.wrapperHeight=c,g.scale=ko.observable(l*d[x].h/r),this.useHtmlThumbnails&&(g.htmlContent=t[x].htmlContent)}S.push(g)}this._viewModel.thumbnails(S);var I=parseInt(this._heightWidthRatio*h),k="";u||(k=".grpdx .thumbnailsContainer .thumb-page{min-height:"+I.toString()+"px}"),this.loadThumbnails()},loadThumbnails:function(){var e=Math.ceil(this.element.height()/parseInt(150*this._heightWidthRatio));this._countToShowOnThumbDiv=e,this._thumbsCountToShow=Number(e)+Math.ceil(Number(Number(e)/2)),this._thumbsSelected=this._thumbsCountToShow,this.retrieveImageUrls(this._viewModel.pageCount())},retrieveImageUrls:function(e){this._portalService.getImageUrlsAsync(this.options.userId,this.options.userKey,this._docGuid,this._thumbnailWidth.toString()+"x",this._sessionToken,0,e,this.options.quality,this.options.use_pdf,this._docVersion,null,null,null,null,this.options.ignoreDocumentAbsence,this.options.useHtmlBasedEngine,this.options.supportPageRotation,function(t){for(var i=0;e>i;i++)this._viewModel.thumbnails()[i].url(t.data.image_urls[i]);this._onScrollLeftPanel()}.bind(this),function(){for(var t=0;e>t;t++)this.makeThumbnailNotBusy(t)}.bind(this))},makeThumbnailNotBusy:function(e){var t=this._viewModel.thumbnails()[e];t.busy(!1)},_onScrollLeftPanel:function(){for(var e=this._viewModel.pageCount(),t=(this._thumbnailWidth,this.element),i=t.find(".thumb-page:first").outerHeight(!1),n=t.scrollTop(),o=t.height(),s=Math.floor(n/i),r=Math.floor((n+o)/i)+1,a=e-2>r?r+2:e,l=s;a>l;l++)this.useHtmlThumbnails&&this.getDocumentPageHtmlCallback.call(this.viewerViewModel,l),this._viewModel.thumbnails()[l].visible(!0);this._thumbsSelected=r},setThumbnailsScroll:function(i){var n=i.direction,o=i.pi;this._viewModel.pageInd!=o&&(this._viewModel.pageInd(o),!i.eventAlreadyRaised&&this.element.trigger("onSetThumbnailsScroll",o));var s=this.element.parent().find(".thumb-page"),r=this.element.offset().top,a=(s.outerHeight(),this.element.find("ul li:nth-child("+this._viewModel.pageInd()+")"));if(0!=a.length){var l=a.offset().top+4*e(".doc-viewer-panel .accordion-tab").outerHeight()-e(window).height(),h=a.offset().top+a.height()-r,u=a.offset().top,d=this.element.scrollTop(),c=u-r;n==t&&(n=1==o?"up":"down"),"up"==n&&(c=r-u,(0>h||l>0)&&this.element.scrollTop(d-c)),"down"==n&&(c=u-r,(l>0||0>h)&&this.element.scrollTop(d+c))}},set:function(t){this._viewModel.pageInd(t),e(this.element).trigger("onSetThumbnails",t)},setPageWithoutEvent:function(e){this._viewModel.pageInd(e)},setPagesCount:function(e){this._pageCount=e,this._viewModel.pageCount(e)},_createHtml:function(){var t,i=this.element;t=this.options.supportPageReordering?"foreach: thumbnails, sortableArray: thumbnails":"foreach: thumbnails",this.element=e(' - '+(this.useHtmlThumbnails?" ":" ")+'
'),this.options.useInnerThumbnails?(this.thumbnailPanelElement=e(''),this.element.appendTo(this.thumbnailPanelElement),this.toggleThuumbnailsButton=e(''),this.toggleThuumbnailsButton.appendTo(this.thumbnailPanelElement),this.thumbnailPanelElement.prependTo(i)):this.element.appendTo(i),this.rootElement=i}})}(jQuery),function(e){fileOpenDialogViewModel=function(e,t,i){this.fileOpenDialog=e,this.fileUploader=t,this.fileExplorer=i,this._init()},e.extend(fileOpenDialogViewModel.prototype,{_explorerViewModel:null,_uploaderElements:[],_init:function(){this.fileExplorer.bind("onPathChanged",this._onExplorerPathChanged.bind(this)),this.fileExplorer.bind("onNodeSelected",this._onExplorerNodeSelected.bind(this)),this._explorerViewModel=e(this.fileExplorer).explorer("getViewModel"),this.fileUploader.bind("onStart",this._onFileUploaderStart.bind(this)),this.fileUploader.bind("onProgress",this._onFileUploaderProgress.bind(this)),this.fileUploader.bind("onComplete",this._onFileUploaderComplete.bind(this))},_onExplorerPathChanged:function(){},_onExplorerNodeSelected:function(t,i){i.id>0&&"file"===i.type&&e(this.fileOpenDialog.fileExplorer).trigger("fileSelected",i)},_onFileUploaderStart:function(e,t,i,n){this._explorerViewModel.busy(!0),this._uploaderElements[t]=this._explorerViewModel.createFile(i,n)},_onFileUploaderProgress:function(t,i,n,o,s){s>0&&e(this.fileOpenDialog.explorerProgressPercentage).text(Math.round(o/s*100)+" %")},_onFileUploaderComplete:function(t,i,n){var o=this._uploaderElements,s=this._explorerViewModel;e(this.fileOpenDialog.explorerProgressPercentage).text("100 %"),s.busy(!1),i&&n?(o[i].id=n.id,o[i].guid=n.guid,o[i].url=n.url,o[i].Name=n.name,o[i].docType(n.docType),o[i].sizeInKb(Math.round(n.size/1024)),o[i].version=n.version,o[i].path=s.path()+"/"+n.name,o[i].name(n.name),o[i].uploading(!1),o[i].open()):s._removeEntity(o[i])}})}(jQuery),function(e){e.widget("ui.fileOpenDialog",{_viewModel:null,options:{autoOpen:!0,url:"",uploadWebFiles:!1,fileTypes:"doc,docx,docm,dot,dotx,dotm,rtf,odt,ott,pdf",resourcePrefix:""},_create:function(){var t=this,i=(t.options,this.element);i.addClass("modal fade modal2 modal800px");var n=(t.wrapper=e("")).addClass("modal_inner_wrapper").prependTo(i);this._buildDialogHeader(n);var o=(t.content=e("")).addClass("modal_content").appendTo(n),s=(t.inputWrapLeft=e("")).addClass("modal_input_wrap_left").appendTo(o),r=(t.fileExplorer=e("")).addClass("file_browser_content").appendTo(s);this._buildFileUploader(r,t);var a=(t.filesArea=e("")).attr("data-bind","fileDnD: {}").css({position:"relative"}).appendTo(r),l=(e("").css({position:"relative"}).appendTo(a),e("").addClass("file_browser_sort").appendTo(a));this._buildExplorerHeaders(l,"file_browser_sort_filename","Name","File Name","FileName"),this._buildExplorerHeaders(l,"file_browser_sort_size","Size","Size","Size"),this._buildExplorerHeaders(l,"file_browser_sort_modified","ModifiedOn","Modified","Modified"),this._buildFoldersList(a),this._buildFilesList(a),this._buildFooter(n),this.element.trigger("onHtmlCreated"),this._viewModel=this.getViewModel()},_init:function(){},_buildDialogHeader:function(t){{var i=(e("").addClass("popclose").attr("data-dismiss","modal").appendTo(t),e("").addClass("modal_header").appendTo(t));e("").text("Open File").attr("data-localize","OpenFile").appendTo(i)}},_buildFileUploader:function(t,i){{var n=(i.fileUploader=e("")).addClass("file_browser_toolbar").css({position:"relative",display:"inline-block",overflow:"hidden"}).appendTo(t);e("").appendTo(n),e("").addClass("small_button file_browser_upload_btn").attr("data-localize","ParentFolder").attr("data-bind","click: function () { $parent.openParentFolder();}").text("Parent folder").appendTo(n),e("").appendTo(n)}if(i.options.uploadWebFiles){(i.openFromUrlButton=e("")).addClass("small_button").text("Open From URL").appendTo(n)}},_buildExplorerProgress:function(t){{var i=e("").attr("data-bind","visible: busy()").addClass("explorer-progress").appendTo(t),n=e("").css({position:"relative",top:"50px",left:"50%",width:"96px",height:"56px"}).appendTo(i);e("").attr("src",this.options.resourcePrefix+"/Images/uploading.gif").attr("alt","").css({width:"16px",height:"16px"}).appendTo(n),e("
").appendTo(n),(self.explorerProgressPercentage=e("")).attr("id","explorer-progress-percentage").appendTo(n)}},_buildExplorerHeaders:function(t,i,n,o,s){{var r=e("").attr("href","#").attr("data-bind","click: function() { setOrder("+n+");}").addClass(i).appendTo(t);e("").text(o).attr("data-localize",s).appendTo(r),e("").addClass("smallarrow").attr("data-bind","visible: orderBy() === '"+n+"', css: {up: orderAsc(), down: !orderAsc()}").appendTo(r)}},_buildFoldersList:function(t){{var i=e("
").addClass("file_browser_folder_list").attr("data-bind","foreach: folders").appendTo(t),n=e("").attr("data-bind","attr: { id: 'explorer-entity-' + id }, click: open").appendTo(i),o=e("").addClass("file_browser_listbox folderlist").appendTo(n);e("").addClass("listicons licon_folder").appendTo(o),e("").addClass("listname_file_browser foldername").attr("data-bind","text: name()").appendTo(o)}},_buildFilesList:function(t){{var i=e("
").addClass("file_browser_file_list").attr("data-bind","foreach: files").appendTo(t),n=e("").attr("data-bind","attr: { id: 'explorer-entity-' + id }, click: open").appendTo(i),o=e("").addClass("file_browser_listbox filelist").appendTo(n);e("").addClass("listicons").attr("data-bind","css: { 'licon_unkwn': (docType() != 'words' && docType() != 'pdf' && docType() != 'slides' &&docType() != 'cells' && docType() != 'image' && docType() != 'email' && docType() != 'diagram' && docType() != 'project' && docType() != 'taggedimage'), 'licon_word': docType() == 'words', 'licon_pdf': docType() == 'pdf', 'licon_ppt': docType() == 'slides', 'licon_xls': docType() == 'cells', 'licon_bmp': (docType() == 'image' || docType() == 'taggedimage'), 'licon_outlook': docType() == 'email', 'licon_visio': docType() == 'diagram', 'licon_mpp': docType() == 'project' }").appendTo(o),e("").addClass("listname_file_browser filenameellipses").attr("data-bind","text: name(), ellipsis: true").appendTo(o),e("").addClass("listfilesize listsmalltext").attr("data-bind","text: (sizeInKb() + 'Kb')").appendTo(o)}e("").addClass("listfilesize listsmalltext").attr("data-bind","text: modifiedOn()").appendTo(o)},_buildFooter:function(t){{var i=(self.footer=e("")).addClass("modal_footer").appendTo(t);e("").addClass("modal_btn_wrapper").appendTo(i)}},_createViewModel:function(){var t=this.options.hostUrl,i=this.options.userId,n=this.options.userKey,o=e(this.fileExplorer).explorer({userId:i,privateKey:n,pageSize:30,fileTypes:this.options.fileTypes,urlHashEnabled:this.options.urlHashEnabled}),s=e(this.fileUploader).uploader({url:t,userId:i,key:n,proxy:"Uploader.aspx",fld:"",multiple:!0,addFileBtn:e(this.uploadButton)});return new fileOpenDialogViewModel(this,s,o)},getViewModel:function(){return this._viewModel||(this._viewModel=this._createViewModel()),this._viewModel},destroy:function(){e.Widget.prototype.destroy.call(this)}})}(jQuery),function(e,t){e.widget("ui.explorer",{_viewModel:null,_init:function(){this._viewModel=this.getViewModel(),this._viewModel.path.subscribe(function(t){e(this.element).trigger("onPathChanged",[t])}.bind(this)),e(this._viewModel).bind("onNodeSelected",function(t,i,n){e(this.element).trigger("onNodeSelected",[i,n])}.bind(this)),ko.applyBindings(this._viewModel,this.element.get(0))},_createViewModel:function(){return new explorerViewModel(this._getViewModelOptions())},_getViewModelOptions:function(){return{userId:this.options.userId,userKey:this.options.privateKey,pageSize:this.options.pageSize,fileTypes:this.options.fileTypes,startupPath:this.options.startupPath,view:this.options.view,urlHashEnabled:this.options.urlHashEnabled}},getViewModel:function(){return this._viewModel||(this._viewModel=this._createViewModel()),this._viewModel},setFilter:function(e){this._viewModel.setFilter(e)},setOrder:function(e){this._viewModel.setFilter(e)}}),explorerModel=function(t){e.extend(this.options,t),this._init()},e.extend(explorerModel.prototype,{_portalService:Container.Resolve("PortalService"),_path:"",_entitiesLoaded:0,_entitiesTotal:0,_filter:{name:"",types:null},_order:{by:ko.observable("Name"),asc:ko.observable(!0)},options:{userId:"",userKey:"",pageSize:30,extended:!1},_init:function(){},_loadPage:function(e,t,i,n){this._portalService.loadFileBrowserTreeData(this.options.userId,this.options.userKey,t,e?e:0,this.options.pageSize,this._order.by(),this._order.asc(),this._filter.name,this._filter.types,this.options.extended,function(e){"success"===e.textStatus?(this._entitiesLoaded+=e.data.nodes.length,this._entitiesTotal=e.data.count,i.apply(this,[t,e.data.nodes])):n.apply(this,[])}.bind(this),function(e){n.apply(this,[e])}.bind(this),!1)},openFolder:function(e,t,i){this._path=e||"",this._entitiesLoaded=0,this._entitiesTotal=0,this._loadPage(0,this._path,t,i)},loadMore:function(e,t){if(this._entitiesLoaded>=this._entitiesTotal)return!1;var i=Math.ceil(this._entitiesLoaded/this.options.pageSize);return this._loadPage(i,this._path,e,t),!0},createFolder:function(e,t,i){this._portalService.createFolderAsync(this.options.userId,this.options.userKey,e,function(n){n.data>0?t.apply(this,[e,n.data]):i.apply(this,[e,null,n.data])}.bind(this),function(t){i.apply(this,[t,e])}.bind(this)).Subscribe()},setFilter:function(e){this._filter.name=e.name,this._filter.types=e.types},setOrder:function(e){if(this._order.by()==e){var t=!this._order.asc();this._order.asc(t)}else this._order.asc(!0),this._order.by(e)}}),explorerViewModel=function(e){this._init(e)},e.extend(explorerViewModel.prototype,{_model:null,_filtering:!1,_ordering:!1,_userId:null,_userKey:null,urlHashEnabled:!0,busy:ko.observable(!1),path:ko.observable(""),entities:ko.observableArray(),files:ko.observableArray(),folders:ko.observableArray(),changedUrlHash:!1,view:ko.observable("listing"),_init:function(e){this._model=this._createModel(e),this._userId=e.userId,this._userKey=e.userKey,"undefined"!=typeof e.urlHashEnabled&&(this.urlHashEnabled=e.urlHashEnabled),this.busy=ko.observable(!1),this.path=ko.observable(""),this.entities=ko.observableArray(),this.files=ko.observableArray(),this.folders=ko.observableArray(),this.isNotRootFolder=ko.computed({read:function(){return!(""===this.path())},owner:this}),!e.skipStartupPathLoad&&this.openFolder(e.startupPath)},_createModel:function(e){return new explorerModel(e)},_addRoot:function(){var e=this._createEntity("Home","folder");return e.path="",this.entities.push(e),e},_onEntitiesLoaded:function(t,i){var n=this;(n._filtering||n._ordering||t!=n.path())&&(n.entities.removeAll(),n.files.removeAll(),n.folders.removeAll()),e.each(i,function(){if(!this.extended){var e=this;n._extendEntity(e),n.entities.push(e)}"file"==this.type?n.files.push(this):n.folders.push(this)}),n._filtering=!1,n._ordering=!1,n.path(t),this.urlHashEnabled&&(this.changedUrlHash=!0,location.hash=n.view()+"#"+t,this.changedUrlHash=!1),n.busy(!1)},_onNetworkError:function(e){this.busy(!1),jerror(e.Reason||e)},_extendEntity:function(t){var i=this,n=t.supportedTypes?e.map(t.supportedTypes,function(e){return e.toUpperCase()}):[];e.extend(t,{extended:!0,name:ko.observable(t.name),uploading:ko.observable(!1),isNewVersion:!1,processingOnServer:!1,sizeInKb:ko.observable(Math.round(t.size/1024)),docType:ko.observable(t&&t.docType?t.docType.toLowerCase():""),modifiedOn:function(){return isNaN(t.modifyTime)||t.modifyTime<0?"---":new Date(t.modifyTime).format("mmm dd, yyyy")},percentCompleted:ko.observable(0),uploadSpeed:ko.observable(0),remainingTime:ko.observable(0),supportedTypes:ko.observableArray(n),thumbnail:ko.observable(t.thumbnail),selected:ko.observable(!1),isVisible:ko.observable(!0),viewJobId:ko.observable(null),viewJobPoller:null}),t.statusText=ko.computed(function(){return this.viewJobId()&&this.viewJobId()>0?"Server-side processing ...":"Time remaining: "+this.remainingTime()+" secs @ "+this.uploadSpeed()+" kb/Sec."},t),t.open=function(n){"file"===t.type?e(i).trigger("onNodeSelected",[t,n]):i.openFolder(t.path)},t.viewJobId.subscribe(function(e){e&&e>0&&(t.processingOnServer=!0,this.viewJobPoller=new jobPoller({userId:i._userId,userKey:i._userKey,jobId:e,completed:function(){t.uploading(!1),t.processingOnServer=!1,t.viewJobPoller=null},failed:function(){t.uploading(!1),t.processingOnServer=!1,t.viewJobPoller=null},timedout:function(){t.uploading(!1),t.processingOnServer=!1,t.viewJobPoller=null}}),this.viewJobPoller.start())})},_findEntity:function(e,t){for(var i=0;i0?e.length-e.replace(/\/+/g,"").length+1:0},getSelectedEntities:function(){return e.map(this.entities(),function(e){return e.id&&e.selected()?e:void 0})},openFolder:function(e){this.busy()||(this.busy(!0),this._model.openFolder(e,this._onEntitiesLoaded.bind(this),this._onNetworkError.bind(this)))},openParentFolder:function(){var e=this.path().lastIndexOf("/"),t=this.path().substr(0,e>0?e:0);t!=this.path()&&this.openFolder(t)},loadMore:function(){return!this.busy()&&this.busy(this._model.loadMore(this._onEntitiesLoaded.bind(this),this._onNetworkError.bind(this))),this.busy()},createFile:function(e,t){var i=this._findEntity(e,"file");if(i)return i.uploading(!0),i.isNewVersion=!0,i;var n=this._createEntity(e,"file",t);return n.uploading(!0),n.isNewVersion=!1,this.entities.push(n),this.files.unshift(n),n},entityExists:function(e,t){return null!=this._findEntity(e,t)},setFilter:function(e){this._filtering=!0,this._model.setFilter(e),this.openFolder(this.path())},setOrder:function(e){this._ordering=!0,this._model.setOrder(e),this.openFolder(this.path())},orderBy:function(){return this._model._order.by()},orderAsc:function(){return this._model._order.asc()},findEntity:function(e,t){return this._findEntity(e,t)},isNullOrWhiteSpace:function(e){return null===e||"undefined"==e||null!==e.match(/^ *$/)}})}(jQuery);var OverrideMode={Override:0,Rename:1,Break:2,Skip:3};!function(a,b){a.widget("ui.uploader",{_appender:null,_handler:null,options:{multiple:!0,userId:b,key:"",url:"",proxy:"",fld:"documents",formats:"",onComplete:null,onStart:null,addFileBtn:null,skipErrors:!1,delayedStart:!1,isForUserStorage:!1,overrideMode:OverrideMode.Override},_initHandler:function(){if(null==this._handler){var e=Container.Resolve("HttpProvider").buildUrl(this.options.url,this.options.proxy,{user_id:this.options.userId,fld:this.options.fld});this._handler=a.handlerFactory.get({multiple:this.options.multiple,baseServerHost:this.options.url,isForUserStorage:this.options.isForUserStorage,folder:this.options.fld,action:this.options.key?Container.Resolve("HttpProvider").signUrl(e,this.options.key):e,skipErrors:this.options.skipErrors,overrideMode:this.options.overrideMode}),a(this._handler).hitch("onComplete",this._onComplete,this),a(this._handler).hitch("onProgress",this._onProgress,this),a(this._handler).hitch("onStart",this._onStart,this)}},_initAppender:function(){if(null==this._appender){var e=this;this._appender=new FileAppender({container:this.element,multiple:!this._handler.sync,_addFileBtn:this.options.addFileBtn,onAddItemAction:function(t){e.options.delayedStart?a(e.element).trigger("onFileSelected",[a.fileInputUtils.getName(t),t]):e._uploadFile(t)}})}},_create:function(){this._initHandler(),this._initAppender()},_onCancel:function(e){var t=e.data;this._handler.cancel(t)},_onComplete:function(e,t,i){this.options.onComplete?this.options.onComplete.apply(this,[t,i]):a(this.element).trigger("onComplete",[t,i])},_beforeStart:function(e){return this.options.beforeStart?this.options.beforeStart(e):!0},_onStart:function(e,t,i,n){this.options.onStart?this.options.onStart.apply(this,[t,i,n]):a(this.element).trigger("onStart",[t,i,n])},_onProgress:function(e,t,i,n,o,s,r){this.options.onProgress?this.options.onProgress.apply(this,[t,i,n,o,s,r]):a(this.element).trigger("onProgress",[t,i,n,o,s,r])},_uploadFile:function(e,t){var i=this._handler.add(e,jSaaspose.utils.getSequenceNumber()),n=this._handler.getPath(i);if("undefined"!=typeof t&&(this._handler.overrideMode=t),!this._beforeStart(n))return void this._handler.cancel(i);var o=this._addFileItem(i,n);return""==this.options.formats||-1!=this.options.formats.indexOf(o.ext.toLowerCase())?(a(this.element).trigger("onAdded",[o,null]),this._handler.upload(i)):a(this.element).trigger("onAdded",[null,"Not allowed format"]),i},upload:function(){throw new"not implemented"},uploadFile:function(e,t){return this._uploadFile(e,t)},cancelUploadFile:function(e){this._handler.cancel(e)},_addFileItem:function(e,t){return{id:e,name:t,ext:this._getExt(t)}},_getExt:function(e){return Container.Resolve("PathProvider").getExt(e).toUpperCase()},_setOption:function(e,t){a.Widget.prototype._setOption.call(this,e,t),"fld"===e&&(this._handler=null,this._initHandler())}}),UploadHandlerBasic=function(e){a.extend(this,e)},a.extend(UploadHandlerBasic.prototype,{action:"",_inputs:{},sync:!0,skipErrors:!1,getPath:function(e){return a.fileInputUtils.getPath(this._inputs[e])},getSize:function(e){var t=this._inputs[e];return a.fileInputUtils.getSize(t)},add:function(e,t){return this._inputs[t]=e,a(e).detach(),t},upload:function(e){this._upload(e)},cancel:function(e){this._cancel(e)},_parseResponse:function(a){try{var b=eval("("+a+")")}catch(c){throw"Error in file processing at server side:"+a}return b},_upload:function(){},_cancel:function(){}}),IFrameHandler=function(){UploadHandlerBasic.apply(this,arguments)},a.extend(IFrameHandler.prototype,UploadHandlerBasic.prototype,{_upload:function(e){var t=this._inputs[e],i=Container.Resolve("PathProvider").getName(this.getPath(e));a(t).attr("name",i);var n=this._createForm(e),o=this._createIFrame(e);n.append(t);var s=o.get(0).document?o.get(0).document:o.get(0).contentDocument?o.get(0).contentDocument:o.get(0).contentWindow.document;s.body.appendChild(n.get(0)),o.hitch("load",function(){var t=this._getIframeContentJSON(o[0]);a(this).trigger("onComplete",[e,t.success?t.parsed:null]),delete this._inputs[e],setTimeout(function(){o.remove()},1)},this),a(this).trigger("onStart",[e,i]),n.submit(),n.remove()},_createForm:function(e){var t=a('');return t.attr("id","form"+e),t.attr("target","iframe"+e),t.attr("action",this.isForUserStorage?this._buildUriForIframeAction():this.action),t},_buildUriForIframeAction:function(){var e="";return a.ajax({url:this.baseServerHost+"getFileUploadUrl",data:"path="+this.folder+"&forIframe=true",async:!1,success:function(t){e=t}}),e},_createIFrame:function(e){var t=a('').appendTo("body");return t.attr("id","iframe"+e),t},_cancel:function(e){a("iframe"+e).remove(),delete this._inputs[e]},_getIframeContentJSON:function(e){try{if(!e.parentNode)return;if(e.contentDocument&&e.contentDocument.body&&"false"==e.contentDocument.body.innerHTML)return;var t=e.contentDocument?e.contentDocument:e.contentWindow.document,i=t.body.innerHTML.replace(/^<[^>]+>|<[^>]+>$/g,""),n=this.isForUserStorage?this._correctDataFromIframe(this._parseResponse(i)):this._parseResponse(i);return{success:!0,parsed:n}}catch(o){}return{success:!1,parsed:b}},_correctDataFromIframe:function(e){var t={};return t.code=e.status,t.error=e.error_message,t.id=e.result.upload_Request_Results[0].id,t.fileType=e.result.upload_Request_Results[0].file_type,t.docType=e.result.upload_Request_Results[0].type.toLowerCase(),t.guid=e.result.upload_Request_Results[0].guid,t.thumbnail=e.result.upload_Request_Results[0].thumbnail,t.upload_time=e.result.upload_Request_Results[0].upload_time,t.viewJobId=e.result.upload_Request_Results[0].view_job_id,t.size=e.result.upload_Request_Results[0].size,t.name=e.result.upload_Request_Results[0].adj_name,t.version=e.result.upload_Request_Results[0].version,t.url=e.result.upload_Request_Results[0].url,t.field_count=0,t.supportedTypes={},a.ajax({type:"POST",url:this.baseServerHost+"getJsonFileInfo",data:{fileType:e.result.upload_Request_Results[0].file_type},async:!1,success:function(e){t.supportedTypes=e}}),t}}),AjaxHandler=function(){UploadHandlerBasic.apply(this,arguments),this.sync=!1,this._xhrs={}},a.extend(AjaxHandler.prototype,UploadHandlerBasic.prototype,{updateProgress:function(e){if(e.lengthComputable){e.loaded/e.total}},_upload:function(e){var t=this._inputs[e],i=this,n=UploadHandlerBasic.prototype.getPath.apply(this,[e]),o=UploadHandlerBasic.prototype.getSize.apply(this,[e]),s=i._xhrs[e]=new XMLHttpRequest,r=(new Date).getTime();s.upload.onprogress=function(t){if(t.lengthComputable){var o=(new Date).getTime()-r,s=t.loaded/o,l=(t.total-t.loaded)*o/t.loaded;a(i).trigger("onProgress",[e,n,t.loaded,t.total,s,l])}};var l=this.isForUserStorage;s.onreadystatechange=function(){if(4==s.readyState){if(0==s.status&&s.canceled)return void a(i).trigger("onComplete",[e,"canceled"]);if(0==s.status)return void a(i).trigger("onComplete",[e,null]);var t=(new Date).getTime()-r,h=o/t;a(i).trigger("onProgress",[e,n,o,o,h,0]);var u=null;if(200==s.status)try{if(u=l?i._correctData(i._parseResponse(s.responseText)):i._parseResponse(s.responseText),"Unauthorized"==u.code)return void(window.location=Container.Resolve("HttpProvider").buildUrl("/","sign-in",{returnUrl:window.location.href}));if(!i.skipErrors){if("Forbidden"==u.code)throw u;if("QuotaExceeded"==u.code)throw u;if("StorageLimitExceeded"==u.code)throw u}}catch(d){jerror(u.error),u=null}a(i).trigger("onComplete",[e,u]),delete i._inputs[e],delete i._xhrs[e]}},this.overrideMode==OverrideMode.Rename?a(this).trigger("onStart",[e,n+" (new copy)",o]):a(this).trigger("onStart",[e,n,o]),this.isForUserStorage?(s.open("POST",i._buildUriForUserStorage(n),!0),this.overrideMode=OverrideMode.Override):s.open("POST",i._buildUri(n),!0),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("X-File-Name",encodeURIComponent(n)),s.setRequestHeader("Content-Type","application/octet-stream"),s.send(t)},_correctData:function(e){var t={};return t.id=e.result.id,t.code=e.result.status,t.fileType=e.result.file_type,t.docType=e.result.type.toLowerCase(),t.guid=e.result.guid,t.thumbnail=e.result.thumbnail,t.upload_time=e.result.upload_time,t.viewJobId=e.result.view_job_id,t.size=e.result.size,t.name=e.result.adj_name,t.version=e.result.version,t.url=e.result.url,t.error=e.result.error_message,t.field_count=0,t.supportedTypes={},a.ajax({type:"POST",url:this.baseServerHost+"getJsonFileInfo",data:{fileType:e.result.file_type},async:!1,success:function(e){t.supportedTypes=e}}),t},_buildUri:function(e){return this.action+"&"+a.param({fileName:e,multiple:!0})},_buildUriForUserStorage:function(e){var t="";return a.ajax({url:this.baseServerHost+"getFileUploadUrl",data:"path="+this.folder+"&filename="+encodeURIComponent(e)+"&overrideMode="+this.overrideMode,async:!1,success:function(e){t=e}}),t},_cancel:function(e){this._inputs[e]&&delete this._inputs[e],this._xhrs[e]&&(this._xhrs[e].canceled=!0,this._xhrs[e].abort(),delete this._xhrs[e])}}),HandleFactory=function(){},a.extend(HandleFactory.prototype,{get:function(e){return e.multiple&&this._isXHRSupported()?new AjaxHandler(e):new IFrameHandler(e)},_isXHRSupported:function(){var e=a('');return"multiple"in e[0]&&"undefined"!=typeof File&&"undefined"!=typeof(new XMLHttpRequest).upload}}),ItemAppender=function(e){a.extend(this,e),this._init(),this._subscribe()},a.extend(ItemAppender.prototype,{container:null,template:"",onAddItemAction:null,multiple:!1,_addFileBtn:null,_input:null,_init:function(){this._input=a("#input",this.container),null==this._addFileBtn&&(this._addFileBtn=a("#button",this.container))},_subscribe:function(){}}),FileAppender=function(){ItemAppender.apply(this,arguments)},a.extend(FileAppender.prototype,ItemAppender.prototype,{_init:function(){ItemAppender.prototype._init.apply(this),this._input=this._createInput().prependTo(this._addFileBtn)},_createInput:function(){var e=a('');return this.multiple&&e.attr("multiple","multiple"),e},_subscribe:function(){this._input.hitch("change",this._onChange,this)},_onChange:function(e){var t=this;this.multiple?(a.each(e.target.files,function(){t.onAddItemAction(this)}),a(e.target).remove()):this.onAddItemAction(e.target),this._input=this._createInput().prependTo(this._addFileBtn),this._subscribe()}}),InputTypeFile=function(e){a.extend(this,e),this._init(),this._subscribe()
},a.extend(InputTypeFile.prototype,{onFileSelected:null,name:null,element:null,_input:null,_init:function(){this._input=this._createInput().prependTo(this.element)},_createInput:function(){var e=a('');return e.attr("name",this.name),e},_subscribe:function(){this._input.hitch("change",this._onChange,this)},_onChange:function(e){this.onFileSelected(e.target)}}),IFrame=function(e){a.extend(this,e),this._init()},a.extend(IFrame.prototype,{values:null,elements:null,action:null,onComplete:null,_init:function(){var e=this._createForm(),t=this._createIFrame();a.each(this.values,function(){var t=a('');e.append(t)}),a.each(this.elements,function(){e.append(this)});var i=t.get(0).document?t.get(0).document:t.get(0).contentDocument?t.get(0).contentDocument:t.get(0).contentWindow.document;i.body.appendChild(e.get(0)),t.hitch("load",function(){var e=this._getIframeContentJSON(t[0]);this.onComplete&&this.onComplete(e.parsed),setTimeout(function(){t.remove()},1)},this),e.submit(),e.remove()},_createForm:function(){var e=a('');return e.attr("action",_buildUriForIframeAction()),e.attr("target","iframe"),e},_buildUriForIframeAction:function(){var e="";return a.ajax({url:"getFileUploadUrl",data:"path="+this.folder+"&forIframe=true",async:!1,success:function(t){e=t}}),e},_createIFrame:function(){return a('').appendTo("body")},_getIframeContentJSON:function(e){try{if(!e.parentNode)return;if(e.contentDocument&&e.contentDocument.body&&"false"==e.contentDocument.body.innerHTML)return;var t=e.contentDocument?e.contentDocument:e.contentWindow.document,i=this._parseResponse(t.body.innerHTML);return{success:!0,parsed:i}}catch(n){jerror()}return{success:!1,parsed:b}},_parseResponse:function(a){try{var b=eval("("+a+")")}catch(c){throw"Error in file processing at server side:"+a}return b}}),FileInputUntils=function(){},a.extend(FileInputUntils.prototype,{getPath:function(e){var t=e.fullPath;return t?(t=t.trimStart("/"),t.replace(/\//g,"\\")):e.fileName||e.name||e.value},getName:function(e){return Container.Resolve("PathProvider").getName(this.getPath(e))},getSize:function(e){return null!=e.fileSize?e.fileSize:e.size}}),a.handlerFactory=new HandleFactory,a.fileInputUtils=new FileInputUntils}(jQuery),function(e){e.widget("ui.zooming",{options:{zoomValues:[5,15,25,50,75,100,125,150,175,200,300,400,600]},_viewModel:null,_create:function(){this.options.createHtml&&this._createHtml(),this._viewModel=this.getViewModel(),ko.applyBindings(this._viewModel,this.element.get(0)),e(this._viewModel).bind("onSetZoom",function(t,i){e(this.element).trigger("onSetZoom",[i])}.bind(this)),e(this._viewModel).bind("zoomSet.groupdocs",function(e,t){this.element.trigger("zoomSet.groupdocs",[t])}.bind(this))},getViewModel:function(){if(this._viewModel)return this._viewModel;var t=e.extend({element:this.element},this.options),i=new zoomingViewModel(t);return i},_createHtml:function(){var t=this.element;this.element=e('').appendTo(t),t.trigger("onHtmlCreated")}}),zoomingModel=function(){},zoomingViewModel=function(t){e.extend(this,t),this._init(t)},e.extend(zoomingViewModel.prototype,{_model:null,zooms:null,_currentZoom:null,_currentZoomIndex:0,dropDownMenuIsVisible:null,dropDownMenuClicked:!1,_init:function(e){this._currentZoom=ko.observable(100),this.zooms=ko.observableArray([]),this.dropDownMenuIsVisible=ko.observable(!1);for(var t,i=e.zoomValues.length-1;i>=0;i--)t=e.zoomValues[i],this.zooms.push({name:t.toString()+"%",value:t}),t==this._currentZoom()&&(this._currentZoomIndex=this.zooms().length-1);this.setFitWidthZoom(100),this.setFitHeightZoom(100)},setFitWidthZoom:function(e){for(var t={name:"Fit Width",value:e,localizationKey:"FitWidth",fitWidth:!0},i=!1,n=0;n=0?n:this._indexOfNearestZoom(i,!1),e(this).trigger("onSetZoom",i),e(this).trigger("zoomSet.groupdocs",i)},setZoomWithoutEvent:function(e){var t=this._indexOfZoom(e);t>=0&&(this._currentZoom(e),this._currentZoomIndex=t)},zoomIn:function(){var t=!1,i=this._currentZoomIndex;this._isFitToBounds()?(i=this._indexOfNearestZoom(this.zooms()[this._currentZoomIndex].value,!0),t=i>=0):this._currentZoomIndex>0&&(i=this._currentZoomIndex-1,t=!0),t&&(this._currentZoomIndex=i,this._currentZoom(this.zooms()[this._currentZoomIndex].value),e(this).trigger("onSetZoom",this._currentZoom()),e(this).trigger("zoomSet.groupdocs",this._currentZoom()))},zoomOut:function(){var t=!1,i=this._currentZoomIndex;this._isFitToBounds()?(i=this._indexOfNearestZoom(this.zooms()[this._currentZoomIndex].value,!1),t=i>=0):this._currentZoomIndex=0;i--)o=this.zooms()[i],n=o.value,o.fitWidth||o.fitHeight||(n>e&&(null===r||r>n)?(r=n,a=i):e>n&&(null===l||n>l)&&(l=n,h=i));return t?null===a?-1:a:null===h?-1:h},_isFitToBounds:function(){return this.zooms()[this._currentZoomIndex].fitWidth||this.zooms()[this._currentZoomIndex].fitHeight},showDropDownMenu:function(e){this.dropDownMenuIsVisible(e)},toggleDropDownMenu:function(e,t){this.dropDownMenuIsVisible(!this.dropDownMenuIsVisible()),this.dropDownMenuClicked=!0,this.element.trigger("onMenuClicked"),t.stopPropagation()}})}(jQuery),function(e){e.widget("ui.docViewerPageFlip",{_viewModel:null,options:{fileId:0,fileVersion:1,userId:0,userKey:null,baseUrl:null,_mode:"full",_docGuid:"",quality:null,use_pdf:"true"},_create:function(){this.options.createHtml&&this._createHtml(),e.extend(this.options,{documentSpace:this.element}),this._viewModel=this.getViewModel(),ko.applyBindings(this._viewModel,this.element.get(0))},_init:function(){e(this._viewModel).bind("getPagesCount",function(t,i){e(this.element).trigger("getPagesCount",[i])}.bind(this)),e(this._viewModel).bind("onDocumentLoaded",function(){e(this.element).trigger("onDocumentLoaded")}.bind(this)),e(this._viewModel).bind("_onProcessPages",function(t,i){e(this.element).trigger("_onProcessPages",[i])}.bind(this)),e(this._viewModel).bind("onProcessPages",function(t,i){e(this.element).trigger("onProcessPages",[i])}.bind(this)),e(this._viewModel).bind("onScrollDocView",function(t,i){e(this.element).trigger("onScrollDocView",[i])}.bind(this)),e(this._viewModel).bind("onDocumentLoadComplete",function(t,i){e(this.element).trigger("onDocumentLoadComplete",[i])}.bind(this)),e(this._viewModel).bind("onSearchPerformed",function(t,i){e(this.element).trigger("onSearchPerformed",[i])}.bind(this)),e(this._viewModel).bind("onPageTurned",function(t,i){e(this.element).trigger("onPageTurned",[i])}.bind(this))},getViewModel:function(){return null==this._viewModel&&(this._viewModel=this._createViewModel()),this._viewModel},_createViewModel:function(){return new docViewerPageFlipViewModel(this.options)},applyBindings:function(){ko.applyBindings(this._viewModel,this.element.get(0))},_createHtml:function(){var t='',i=this.element;this.element=e(t).appendTo(i),i.trigger("onHtmlCreated")}});var t=function(t){e.extend(this,t),this._init()};e.extend(t.prototype,{_init:function(){this._portalService=Container.Resolve("PortalService")},loadDocument:function(e,t,i,n,o){switch(this._mode){case"embed":this._portalService.viewEmbedDocumentAllAsync(this.userId,this.userKey,e,i,this.quality,this.use_pdf,-1,null,function(e){null!=e.data&&"undefined"!=typeof e.data.guid?n.apply(this,[e.data]):o.apply(this,[{}])},function(e){o.apply(this,[e])});break;case"embedlite":this._portalService.viewDocumentAllAsync(this.userId,this.userKey,e,null,null,null,null,this.quality,this.use_pdf,function(e){"undefined"!=typeof e.data.guid?n.apply(this,[e.data]):o.apply(this)},function(e){o.apply(this,[e])},!1);break;default:this._portalService.viewDocumentAllAsync(this.userId,this.userKey,e,null,t,i,null,this.quality,this.use_pdf,function(e){e.data&&"undefined"!=typeof e.data.guid?n.apply(this,[e.data]):o.apply(this)},function(e){o.apply(this,[e])},!1)}},loadProperties:function(e,t){this._portalService.getDocInfoAsync(this.userId,this.userKey,e,function(e){t.apply(this,[e.data])})},retrieveImageUrls:function(e,t,i,n,o,s){this._portalService.getImageUrlsAsync(this.userId,this.userKey,e,i,n,0,t,null==this.quality?"":this.quality,this.use_pdf,this.fileVersion,function(e){o.apply(this,[e.data])},function(e){s.apply(this,[e])})}}),window.docViewerPageFlipViewModel=function(t){e.extend(this,t),this._create(t)},e.extend(window.docViewerPageFlipViewModel.prototype,{_model:null,pagesDimension:null,pageImageWidth:568,imageHorizontalMargin:34,initialZoom:100,zoom:null,scale:null,docWasLoadedInViewer:!1,scrollPosition:[0,0],inprogress:null,pages:null,pageInd:null,pageWidth:null,pageHeight:null,pageCount:null,docType:null,fileId:null,_dvselectable:null,_thumbnailHeight:140,_firstPage:null,imageUrls:[],pagePrefix:"page-flip-",documentName:null,fit90PercentWidth:!1,_pageBounds:null,changedUrlHash:!1,bookWidth:0,pagingBarWidth:30,turnPageWithoutEvent:!1,minimumImageWidth:null,_create:function(e){this._model=new t(e),this._init(e)},_init:function(e){this.pages=ko.observableArray([]),this.scale=ko.observable(this.initialZoom/100),this.zoom=ko.observable(this.initialZoom),this.inprogress=ko.observable(!1),this.pageLeft=ko.observable(0),this.pageInd=ko.observable(1),this.pageWidth=ko.observable(0),this.pageHeight=ko.observable(0),this.pageCount=ko.observable(0),this.docType=ko.observable(-1),this.documentName=ko.observable(""),this.docViewerId||(this.docViewerId=this.documentSpace.attr("id")),this.pagePrefix=this.docViewerId+"-page-flip-",e.fit90PercentWidth&&(this.pageImageWidth=.9*this.documentSpace.width()-2*this.imageHorizontalMargin),this.pagesDimension=Math.floor(this.pageImageWidth).toString()+"x",0==this.pages().length&&this.pages.push({number:1,visible:ko.observable(!1),url:ko.observable("")})},loadDocument:function(e){this.inprogress(!0),"undefined"!=typeof e&&(this.fileId=e),this.docWasLoadedInViewer=!1;var t=1;this._model.loadDocument(this.fileId,t,this.pageImageWidth,function(e){this._onDocumentLoaded(e)}.bind(this),function(e){this._onError(e)}.bind(this)),"undefined"!=typeof viewModelPathOnlineDoc&&viewModelPathOnlineDoc.pathOnlineDoc("")},retrieveImageUrls:function(e){var t,i,n;n=this.shouldMinimumWidthBeUsed(this.pageWidth(),!0)?this.minimumImageWidth:this.pageWidth(),i=Math.floor(n)+"x",this._model.retrieveImageUrls(this.fileId,e,i,this.token,function(i){var n;for(t=0;e>t;t++){this.pages()[t].url(i.image_urls[t]),n=t+1;var o=this.setImageElementSize(n,this.pageWidth(),this.pageHeight());o.attr("src",this.pages()[n-1].url())}this.loadImagesForVisiblePages()}.bind(this),function(e){this._onError(e)}.bind(this))},_onError:function(e){this.inprogress(!1),jerror(e.Reason||"The document couldn't be loaded...")},_onDocumentLoaded:function(t,i){e(this).trigger("onDocumentLoaded"),this.fileId=t.guid,this.docGuid=t.guid,this.documentName(t.name),this.docType(t.doc_type),this.pageCount(t.page_count),this.token=t.token,e(this).trigger("getPagesCount",t.page_count),e(this).trigger("_onProcessPages",t);var n=null;"false"!=this.use_pdf&&(this._pdf2XmlWrapper=i,n=this._pdf2XmlWrapper.getPageSize()),this.pagesContainerElement=this.documentSpace.find("div.pages_container_flip"),this.heightWidthRatio=parseFloat(t.page_size.Height/t.page_size.Width);var o;if(o=this.viewerWidth?this.viewerWidth:this.documentSpace.parent().width(),this.pageWidth((o-2*this.pagingBarWidth)/2),this.pageHeight(Math.round(this.pageWidth()*this.heightWidthRatio)),this._dvselectable){var s=this._dvselectable.data("ui-dvselectable");s||(s=this._dvselectable.data("dvselectable")),s.destroy()}this.pagesContainerElement.turn("is")&&this.pagesContainerElement.turn("destroy"),this.pagesContainerElement.height(this.pageHeight()),this.inprogress(!1);for(var r=this.pageCount(),a=[],l=1;r>=l;l++)a.push({number:l,visible:ko.observable(!1),url:ko.observable("")});for(this.pages(a),this._firstPage=this.pagesContainerElement.find("#"+this.pagePrefix+"1"),e(this).trigger("onProcessPages",[this.docGuid]),l=0;l div:first").clone().prependTo(this.pagesContainerElement),this.documentSpace.find("div.bookCovers > div:last").clone().appendTo(this.pagesContainerElement),this.setPage(1,!0,!0);var u=this;this.pagesContainerElement.turn({elevation:50,acceleration:!0,gradients:!0,autoCenter:!0,duration:1e3,width:o-2*this.pagingBarWidth,height:this.pageHeight()}),this.pagesContainerElement.bind("turning",function(t,i){var n=e(this),o=n.turn("pages");return i>o?void t.preventDefault():(i-=1,u.setImageElementSize(i-1,u.pageWidth(),u.pageHeight()),u.setPage(i-1,!0),u.setImageElementSize(i,u.pageWidth(),u.pageHeight()),u.setPage(i,!0,!0),u.setImageElementSize(i+1,u.pageWidth(),u.pageHeight()),u.setPage(i+1,!0),u.setImageElementSize(i+2,u.pageWidth(),u.pageHeight()),void u.setPage(i+2,!0))}),this.pagesContainerElement.bind("turned",function(t,i){if(i-=1,u.setImageElementSize(i-1,u.pageWidth(),u.pageHeight()),u.setPage(i-1,!0),u.setImageElementSize(i,u.pageWidth(),u.pageHeight()),u.setPage(i,!0),u.setImageElementSize(i+1,u.pageWidth(),u.pageHeight()),u.setPage(i+1,!0),u.setImageElementSize(i+2,u.pageWidth(),u.pageHeight()),u.setPage(i+2,!0),u._dvselectable){var n=u.getVisiblePagesNumbers(),o=2;i==r&&(o=1),u._dvselectable.dvselectable("reInitPages",u.scale(),n,u.scrollPosition,u.getPageHeight(),o)}var s=e(this);s.turn("center"),!u.turnPageWithoutEvent&&i>0&&r>=i&&e(this).trigger("onPageTurned",i),u.turnPageWithoutEvent=!1}),this.documentSpace.width(this.pagesContainerElement.width()),this.zoomToFitHeight&&this.setZoom(this.getFitHeightZoom()),e(this).trigger("onDocumentLoadComplete",[t])},setDimension:function(e){this.pagesDimension=e+"x"},setPageWidth:function(e){this.pageImageWidth=e},getFitWidthZoom:function(){var e;return e=this.viewerWidth?this.viewerWidth:this.documentSpace.parent().width(),e/(2*(this.initialWidth+this.pagingBarWidth))*100},getFitHeightZoom:function(){var e;return e=this.viewerHeight?this.viewerHeight:this.documentSpace.parent().height(),e/Math.round(this.initialWidth*this.heightWidthRatio)*100},getPageHeight:function(){return this.unscaledPageHeight*this.scale()},getSelectable:function(){return this._dvselectable},_onPropertiesLoaded:function(t){e(this).trigger("onDocumentLoaded",{fileId:this.fileId,response:t})},getFileId:function(){return this.fileId},ScrollDocView:function(){},ScrollDocViewEnd:function(){},getVisiblePagesNumbers:function(){var e,t,i=this.pageInd();i%2==1?(e=i,t=i+1):(e=i-1,t=i);var n=this.pageCount();return t>n&&(t=n),{start:e,end:t}},loadImagesForVisiblePages:function(){for(var e=this.getVisiblePagesNumbers(),t=e.start,i=e.end,n=t;i>=n;n++)this.pages()[n-1].visible(!0);return e},setPage:function(t,i,n){var o=this.pageCount(),s=Number(t);s>o&&(s=o),(isNaN(s)||1>s)&&(s=1);var r;r=this.pageInd()o?n-2:this.pageInd()-2,1>t&&(t=1),this.setPage(t,!0),this.turnPageWithoutEvent=!0,this.pagesContainerElement.turn("previous"),this.pageInd(t),t>0&&o>=t&&e(this).trigger("onPageTurned",t)},nextBroadside:function(){var t,i=this.pagesContainerElement.turn("page"),n=i-1,o=this.pageCount();t=0==n||n>o?n+2:this.pageInd()+2,t>o&&(t=o),this.setPage(t,!0),this.turnPageWithoutEvent=!0,this.pagesContainerElement.turn("next"),this.pageInd(t),t>0&&o>=t&&e(this).trigger("onPageTurned",t)},setZoom:function(e){if(this.zoom(e),this.isPageFlipViewerVisible()){if(this.loadPagesZoomed(),this._pdf2XmlWrapper){var t=this._pdf2XmlWrapper.getPageSize();this.scale(this.initialWidth/t.width*e/100)}this.pagesContainerElement.width(2*this.pageWidth()),this.pagesContainerElement.height(this.pageHeight()),this.documentSpace.width(2*this.pageWidth()),this.pagesContainerElement.turn("size",this.pagesContainerElement.width(),this.pagesContainerElement.height());var i=this.pagesContainerElement.find("img.page_image_flip");i.width(this.pageWidth()),i.height(this.pageHeight()),this._dvselectable.dvselectable("changeSelectedRowsStyle",this.scale());var n=this.getVisiblePagesNumbers(),o=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());0==o&&(o=1),this._dvselectable.dvselectable("reInitPages",this.scale(),n,this.scrollPosition,this.pageWidth()*this.heightWidthRatio,o)}},loadPagesZoomed:function(){var e=this.initialWidth*this.zoom()/100>>0,t=e*this.heightWidthRatio>>0;this.pagesDimension=e+"x",this.pageWidth(e),this.pageHeight(t);var i=this.pageCount();this.setPage(this.pageInd()),!this.shouldMinimumWidthBeUsed(e,!0)&&this.retrieveImageUrls(i)},performSearch:function(t){var i=this._dvselectable.dvselectable("performSearch",t,this.zoom()/100);e(this).trigger("onSearchPerformed",[i])},selectTextInRect:function(t){this._dvselectable&&e(this._dvselectable).dvselectable("highlightPredefinedArea",t)},deselectTextInRect:function(t,i){this._dvselectable&&e(this._dvselectable).dvselectable("unhighlightPredefinedArea",t,i)},reInitSelectable:function(){var e=this.getVisiblePagesNumbers();null!=this._dvselectable&&this._dvselectable.dvselectable("reInitPages",this.scale(),e,this.scrollPosition,this.getPageHeight())},onDocumentPageSet:function(e){this.pageInd(e),this.isPageFlipViewerVisible()&&this.openCurrentPage()},openCurrentPage:function(){this.pagesContainerElement&&this.setPage(this.pageInd())},isPageFlipViewerVisible:function(){return this.documentSpace.is(":visible")},shouldMinimumWidthBeUsed:function(e,t){var i=null;if("false"!=this.use_pdf&&t){var n=this._pdf2XmlWrapper.getPageSize();i=n.width}return null!=this.minimumImageWidth&&(e<=this.minimumImageWidth||null!==i&&i',i=this.element;e(t).appendTo(i),i.trigger("onHtmlCreated")}});var t=function(t){e.extend(this,t),this._init()};e.extend(t.prototype,{_init:function(){}});var i=function(t){e.extend(this,t),this._create(t)};e.extend(i.prototype,{searchValue:null,previousEnabled:null,nextEnabled:null,minAreaTopRelativeToBeginning:null,maxAreaTopRelativeToBeginning:null,searched:!1,viewerIsScrolled:!1,searchForward:!1,closestArea:null,newHighlightedAreaLeftRelative:0,highlightAreas:null,sible:null,useHtmlBasedEngine:!1,useCaseSensitiveSearch:!1,useAccentInsensitiveSearch:!1,viewerViewModel:null,pageNumberAttribute:"data-page-num",useRtl:!1,_create:function(e){this._model=new t(e),this._init(e)},_init:function(){this.searchValue=ko.observable(""),this.previousEnabled=ko.observable(!0),this.nextEnabled=ko.observable(!0),this.visible=ko.observable(this.searchIsVisible)},triggerSearchEvent:function(e,t,i,n){if(!this.searched){var o=this.searchValue();this.element.trigger("onPerformSearch",[o,e,t,i,n])}return this.searched=!0,!1},findClosestArea:function(t,i,n,o,s){this.searched;this.triggerSearchEvent(i,n,o,s);var r,a,l,h,u=!1,d=null,c=null,p=null,g="current_search_highlight";a=this.viewerViewModel.getVisiblePagesNumbers(),l=a.start-1,h=a.end-1,this.highlightAreas=this.viewerElement.find(this.useHtmlBasedEngine?".search_highlight_html":".search-pane .search-highlight");var f=this.highlightAreas;this.currentHighlightArea=this.highlightAreas.filter("."+g+",tspan[class*='"+g+"']");var m=null;this.currentHighlightArea.length>0&&(this.currentHighlightArea.is("[name*='search_highlight']")&&(r=this.currentHighlightArea.attr("name"),this.currentHighlightArea=f.filter("[name='"+r+"']")),u=!0,d=this.currentHighlightArea.offset().left,c=this.currentHighlightArea.offset().top,p=this.currentHighlightArea.height());var v,b=this.pagesContainerElement=this.viewerElement.find(".pages_container"),w=b.offset().top,y=b.offset().left,_=this.viewerElement.scrollTop();v=this.getScrollTop(_);var S=0,C=null,P=0,x=0,T=0;this.minAreaTopRelativeToBeginning=null,this.maxAreaTopRelativeToBeginning=null,this.minAreaLeftRelativeToBeginning=null,this.maxAreaLeftRelativeToBeginning=null;var I,k,M,O=!0,E=this;if(this.highlightAreas.each(function(){var i=e(this);if(!E.useHtmlBasedEngine||!u||r!=i.attr("name")){var n=i.offset().top;P=n-w;var o=i.offset().left;if(T=o-y,(null==E.minAreaTopRelativeToBeginning||P==E.minAreaTopRelativeToBeginning&&TE.maxAreaLeftRelativeToBeginning)&&(E.maxAreaLeftRelativeToBeginning=T),(null==E.minAreaTopRelativeToBeginning||PE.maxAreaTopRelativeToBeginning)&&(E.maxAreaTopRelativeToBeginning=P,E.maxAreaLeftRelativeToBeginning=T),u){var s=Math.abs(P-v);1>s&&(M=Math.abs(o-d),M>=1&&(t&&o>d||!t&&d>o)&&(C>M||null===C)&&(m=i,C=M,x=Math.round(P),O=!1))}if(null===C&&(t&&P>v||!t&&v>P)){var a=Math.abs(P-v);a>=1&&(S>a&&S-a>=1||O?(m=i,S=a,x=Math.round(P),O=!1,t?I=o:k=o):Math.abs(a-S)<1&&(t&&I>o&&(I=o,m=i,x=Math.round(P)),!t&&o>k&&(k=o,m=i,x=Math.round(P))))}}}),this.useVirtualScrolling&&!m){var R,H=this.viewerViewModel.pages();if(t)for(var W=this.viewerViewModel.lastVisiblePageForVirtualMode()+1;W0)){m=R.get(0),f=f.add(m),x=D.top();break}}}var A,N,F,V,L=null,z=null;if(m){var B=e(m),j=parseInt(B.attr(this.pageNumberAttribute));N=j,j>h?(A=h,F=1):(A=l,F=-1);var U=!0;if(this.useHtmlBasedEngine&&null!==j&&!(j>=l&&h>=j))for(V=A;V!=N;V+=F)if(!this.viewerViewModel.isPageVisible(V)){this.loadPagesOnOneLevel(V,t,i,n,o),U=!1;break}if(U){B.is("[name*='search_highlight']")?(r=B.attr("name"),m=f.filter("[name='"+r+"']")):m=B,this.viewerElement[0].scrollTop=x,this.viewerIsScrolled=!0,this.viewerElement.trigger("ScrollDocView",[null,{target:this.viewerElement[0]}]),this.viewerElement.trigger("ScrollDocViewEnd",[null,{target:this.viewerElement[0]}]),this.viewerIsScrolled=!1,w=b.offset().top;var $,Z;this.currentHighlightArea.removeClass(g),this.currentHighlightArea.is("tspan")?($=this.currentHighlightArea.attr("class"),Z=$.replace(new RegExp("\\b"+g+"\\b"),""),this.currentHighlightArea.attr("class",Z)):m.addClass(g),m.is("tspan")?($=m.attr("class"),m.attr("class",$+" "+g)):m.addClass(g);var J=m.offset().top,q=J-w;L=m.offset().left,z=L-y,v=q}}else if(t?(F=1,A=h,N=this.viewerViewModel.pageCount()):(F=-1,A=l,N=-1),this.useHtmlBasedEngine&&!(j>=l&&h>=j))for(V=A;V!=N;V+=F)if(!this.viewerViewModel.isPageVisible(V)){this.loadPagesOnOneLevel(V,t,i,n,o);break}this.searchForward=t,!m&&u&&(m=this.currentHighlightArea),this.closestArea=m,this.newHighlightedAreaLeftRelative=z;var G=this.isPreviousEnabled(v);this.previousEnabled(G);var X=this.isNextEnabled(v);this.nextEnabled(X)},isPreviousEnabled:function(e){var t=this.getScrollTop(e),i=!this.searched||this.useHtmlBasedEngine||null!=this.minAreaTopRelativeToBeginning&&(Math.floor(t)>Math.ceil(this.minAreaTopRelativeToBeginning)||Math.abs(t-this.minAreaTopRelativeToBeginning)<1&&null!==this.newHighlightedAreaLeftRelative&&this.newHighlightedAreaLeftRelative>this.minAreaLeftRelativeToBeginning);return i},isNextEnabled:function(e){var t=this.getScrollTop(e),i=!this.searched||this.useHtmlBasedEngine||null!=this.maxAreaTopRelativeToBeginning&&(Math.ceil(t)=0&&Math.abs(l[c].y+h*u[c].prop-d)<2;c--)a.push(c);this.viewerViewModel.getDocumentPageHtml(e,s)},getScrollTop:function(e){var t,i,n=null!=this.closestArea;this.pagesContainerElement||(this.pagesContainerElement=this.viewerElement.find(".pages_container"));var o,s=this.pagesContainerElement.offset().top,r=this.viewerElement.height(),a=e,l=e+r;return n&&(t=this.closestArea.offset().top,i=this.closestArea.height(),o=t-s,Math.ceil(o)+i>=a&&Math.floor(o)<=l&&(e=o)),e}})}(jQuery),function(e,t){var i=/[<>&\r\n"']/gm,n={"<":"lt;",">":"gt;","&":"amp;","\r":"#13;","\n":"#10;",'"':"quot;","'":"apos;"};e.extend({fileDownload:function(o,s){function r(){if(-1!=document.cookie.indexOf(p.cookieName+"="+p.cookieValue))return b.onSuccess(o),document.cookie=p.cookieName+"=; expires="+new Date(1e3).toUTCString()+"; path="+p.cookiePath,void l(!1);if(y||w)try{var t=y?y.document:a(w);if(t&&null!=t.body&&t.body.innerHTML.length){var i=!0;if(S&&S.length){var n=e(t.body).contents().first();n.length&&n[0]===S[0]&&(i=!1)}if(i)return b.onFail(t.body.innerHTML,o),void l(!0)}}catch(s){return b.onFail(s.message,o),void l(!0)}setTimeout(r,p.checkInterval)}function a(e){var t=e[0].contentWindow||e[0].contentDocument;return t&&t.document&&(t=t.document),t}function l(e){setTimeout(function(){y&&(d&&y.close(),u&&(y.focus(),e&&y.close()))},0)}function h(e){return e.replace(i,function(e){return"&"+n[e]})}var u,d,c,p=e.extend({preparingMessageHtml:null,failMessageHtml:null,androidPostUnsupportedMessageHtml:"Unfortunately your Android browser doesn't support this type of file download. Please try again with a different browser.",dialogOptions:{modal:!0},prepareCallback:function(){},successCallback:function(){},failCallback:function(){},httpMethod:"GET",data:null,checkInterval:100,cookieName:"fileDownload",cookieValue:"true",cookiePath:"/",popupWindowTitle:"Initiating file download...",encodeHTMLEntities:!0,containerElement:e("body")},s),g=new e.Deferred,f=(navigator.userAgent||navigator.vendor||t.opera).toLowerCase();/ip(ad|hone|od)/.test(f)?u=!0:-1!==f.indexOf("android")?d=!0:c=/avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|playbook|silk|iemobile|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(f)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(f.substr(0,4));var m=p.httpMethod.toUpperCase();if(d&&"GET"!==m)return e().dialog?e("").html(p.androidPostUnsupportedMessageHtml).dialog(p.dialogOptions):alert(p.androidPostUnsupportedMessageHtml),g.reject();var v=null,b={onPrepare:function(t){p.preparingMessageHtml?v=e("").html(p.preparingMessageHtml).dialog(p.dialogOptions):p.prepareCallback&&p.prepareCallback(t)},onSuccess:function(e){v&&v.dialog("close"),p.successCallback(e),g.resolve(e)},onFail:function(t,i){v&&v.dialog("close"),p.failMessageHtml&&e("").html(p.failMessageHtml).dialog(p.dialogOptions),p.failCallback(t,i),g.reject(t,i)}};b.onPrepare(o),null!==p.data&&"string"!=typeof p.data&&(p.data=e.param(p.data));var w,y,_,S;if("GET"===m){if(null!==p.data){var C=o.indexOf("?");-1!==C?"&"!==o.substring(o.length-1)&&(o+="&"):o+="?",o+=p.data}u||d?(y=t.open(o),y.document.title=p.popupWindowTitle,t.focus()):c?t.location(o):(w=p.containerElement.find("iframe[name='jqueryFileDownloadJS']"),0!=w.length&&w.remove(),w=e("
© 2015 - 2024 Weber Informatics LLC | Privacy Policy