Skip to content

Instantly share code, notes, and snippets.

@yerdzxc
Last active July 26, 2023 06:48
Show Gist options
  • Save yerdzxc/e37fca4f05ca6fb199a60e7d443057e3 to your computer and use it in GitHub Desktop.
Save yerdzxc/e37fca4f05ca6fb199a60e7d443057e3 to your computer and use it in GitHub Desktop.
Unknown javscript script
!function(){var e={876(){!function(){"use strict";if("file:"!==location.protocol){var e,t,n,o,i,l,r,a,s,c,u,d,f,g,h,p,m,b,v,$,y,T=(o={},i=[],l=[],r=function(o){var i=document.getElementById("page"+o),r=document.createElement("div");r.className="page-inner",r.setAttribute("style","position: absolute; pointer-events: none;"),r.style.width=i.style.width,r.style.height=i.style.height,i.appendChild(r),l[o]=r;for(var a=0;a<e.length;a++)if(e[a].page===o)for(var s=e[a].annotations,c=0;c<s.length;c++)n(r,s[c],t)},IDRViewer.on("ready",function(n){t=n;var o=n.url||"",l=new XMLHttpRequest;l.open("GET",o+"annotations.json",!0),l.onload=function(){l.status>=200&&l.status<400&&(e=JSON.parse(l.responseText).pages,function(){if(i.length){for(var e=0;e<i.length;e++)r(i[e]);i=[]}}())},l.send()}),IDRViewer.on("pageload",function(t){e?r(t.page):i.push(t.page)}),IDRViewer.on("pageunload",function(e){l[e.page]&&(l[e.page].parentNode.removeChild(l[e.page]),l[e.page]=null)}),o.setLoadFunction=function(e){n=e},o),_=(s={click:[],mouseover:[],mouseout:[],touchstart:[],setup:[]},(a={}).register=function(e,t,n){for(var o=0;o<e.length;o++)for(var i=0;i<t.length;i++)s[t[i]].push({type:e[o],handler:n})},a.onclick=function(e,t){for(var n=0;n<s.click.length;n++)e.type===s.click[n].type&&s.click[n].handler.onclick.apply(this,[e,t])},a.onmouseover=function(e,t){for(var n=0;n<s.mouseover.length;n++)e.type===s.mouseover[n].type&&s.mouseover[n].handler.onmouseover.apply(this,[e,t])},a.onmouseout=function(e,t){for(var n=0;n<s.mouseout.length;n++)e.type===s.mouseout[n].type&&s.mouseout[n].handler.onmouseout.apply(this,[e,t])},a.ontouchstart=function(e,t){for(var n=0;n<s.touchstart.length;n++)e.type===s.touchstart[n].type&&s.touchstart[n].handler.ontouchstart.apply(this,[e,t])},a.onsetup=function(e,t){for(var n=0;n<s.setup.length;n++)e.type===s.setup[n].type&&s.setup[n].handler.onsetup.apply(this,[e,t])},a),x={play:function(e,t){(!c||c.ended||c.paused||(c.pause(),t!==u))&&(u=t,(c=new Audio(e)).play())}};f={},IDRViewer.on("ready",function(e){d=e.pagecount}),f.onsetup=function(e){if(e.action&&"URI"===e.action.type){let t=document.createElement("a");t.href=e.action.uri,t.title=e.action.uri,t.target="_blank",t.style.position="absolute",t.style.width="100%",t.style.height="100%",this.appendChild(t)}},f.onmouseover=function(e){e.action&&"URI"!==e.action.type&&(this.style.cursor="pointer")},f.onclick=function(e,t){if(e.action)switch(e.action.type){case"GoTo":IDRViewer.goToPage(e.action.page,e.action.zoom);break;case"Named":switch(e.action.name){case"NextPage":IDRViewer.next();break;case"PrevPage":IDRViewer.prev();break;case"FirstPage":IDRViewer.goToPage(1);break;case"LastPage":d&&IDRViewer.goToPage(d)}break;case"Sound":x.play((t.url||"")+e.action.sound,e.objref);break;case"Launch":t.enableLaunchActions&&window.open("../"+e.action.target,"_blank")}},_.register(["Link","Widget","TextLink"],["click","mouseover","setup"],f),g={onmouseover:function(){this.style.cursor="pointer"},onclick:function(e,t){e.sound&&x.play((t.url||"")+e.sound,e.objref)}},_.register(["Sound"],["click","mouseover"],g),h={onmouseover:function(){this.style.cursor="pointer"},onclick:function(e,t){var n=document.createElement("a");n.href=(t.url||"")+e.attachment,n.download=e.filename,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)}},_.register(["FileAttachment"],["click","mouseover"],h),v=function(e){if(e.contents&&e.objref){var t=document.querySelector("[data-objref='"+e.objref+"']").getBoundingClientRect(),n=(t.right-t.left)/2+t.left,o=t.bottom,i=document.createElement("div");i.dataset.parentRef=e.objref,i.setAttribute("style","position: fixed; width: 300px; min-height: 200px; left: "+(n-150)+"px; top: "+(o+5)+"px; background-color: #FFFFEF; border-radius: 10px; border: 1px #bbb solid; padding: 10px; box-sizing: border-box; font-family: Arial;");var l=document.createElement("p");e.title&&(l.innerText=e.title),l.setAttribute("style","font-weight: bold; margin: 0;");var r=document.createElement("p");return e.contents&&(r.innerText=e.contents),i.appendChild(l),i.appendChild(r),document.body.appendChild(i),i}return null},(b={}).onmouseover=function(e){m||(p?(p.parentNode.removeChild(p),p=null):p=v(e))},b.onmouseout=function(){p&&(p.parentNode.removeChild(p),p=null)},b.onclick=function(e){if(m){if(p){var t=p.dataset.parentRef;p.parentNode.removeChild(p),p=null,t!==e.objref&&(p=v(e))}else p=v(e)}},b.ontouchstart=function(){m=!0},_.register(["Text","Line","Square","Circle","Polygon","PolyLine","Highlight","Underline","Squiggly","StrikeOut","Stamp","Caret","Ink","FileAttachment","Redact","Projection"],["click","mouseover","mouseout","touchstart"],b),$={onmouseover:function(){this.style.cursor="pointer"},onclick:function(e,t){if(e.richmedia.length){var n=e.richmedia[0].type.startsWith("video"),o=document.createElement(n?"video":"audio");o.setAttribute("style","position: absolute; object-fit: fill; pointer-events: auto;"),o.setAttribute("controls","controls"),o.style.left=e.bounds[0]+"px",o.style.top=e.bounds[1]+"px",o.style.width=e.bounds[2]+"px",o.style.height=e.bounds[3]+"px",o.title=e.type,o.dataset.objref=e.objref;for(var i=0;i<e.richmedia.length;i++){var l=document.createElement("source");l.setAttribute("src",(t.url||"")+e.richmedia[i].src),l.setAttribute("type",e.richmedia[i].type),o.appendChild(l)}this.parentNode.replaceChild(o,this)}}},_.register(["RichMedia"],["click","mouseover"],$),y={onmouseover:function(){this.style.cursor="pointer"},onclick:function(e,t){if(e.action){var n=document.createElement(e.action.media.type.substr(0,5));if(n.setAttribute("style","position: absolute; pointer-events: auto;"),n.setAttribute("controls","controls"),n.style.left=e.bounds[0]+"px",n.style.top=e.bounds[1]+"px",n.title=e.type,n.dataset.objref=e.objref,"video/mp4"===e.action.media.type){n.style.objectFit="fill",n.style.width=e.bounds[2]+"px",n.style.height=e.bounds[3]+"px";var o=document.createElement("source");o.setAttribute("src",(t.url||"")+e.action.media.src),o.setAttribute("type",e.action.media.type),n.appendChild(o)}else"audio/mpeg"===e.action.media.type&&n.setAttribute("src",(t.url||"")+e.action.media.src);this.parentNode.replaceChild(n,this),n.play()}}},_.register(["Screen"],["click","mouseover"],y),T.setLoadFunction(function(e,t,n){var o=document.createElement("div");o.setAttribute("style","position: absolute; pointer-events: auto; -webkit-user-select: none;"),o.style.left=t.bounds[0]+"px",o.style.top=t.bounds[1]+"px",o.style.width=t.bounds[2]+"px",o.style.height=t.bounds[3]+"px",t.objref&&(o.dataset.objref=t.objref),t.appearance&&(o.style.backgroundImage="url('"+t.appearance+"')",o.style.backgroundSize="100% 100%"),e.appendChild(o),o.addEventListener("click",function(){_.onclick.apply(this,[t,n])}),o.addEventListener("mouseover",function(){_.onmouseover.apply(this,[t,n])}),o.addEventListener("mouseout",function(){_.onmouseout.apply(this,[t,n])}),o.addEventListener("touchstart",function(){_.ontouchstart.apply(this,[t,n])}),_.onsetup.apply(o,[t,n])})}else console.log("Annotations functionality is not available when loading from the file:// protocol.")}()},334(){!function(){"use strict";let e={isFullscreenEnabled:function(){return document.fullscreenEnabled||document.msFullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled},isFullscreen:function(){return!!(document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement)},toggleFullScreen:function(){this.isFullscreen()?(document.exitFullscreen||document.msExitFullscreen||document.mozCancelFullScreen||document.webkitCancelFullScreen).call(document):(document.body.requestFullscreen||document.body.msRequestFullscreen||document.body.mozRequestFullScreen||document.body.webkitRequestFullscreen).call(document.body)}};for(let t in e)e.hasOwnProperty(t)&&(IDRViewer[t]=e[t]);["fullscreenchange","MSFullscreenChange","mozfullscreenchange","webkitfullscreenchange"].forEach(function(t){document.addEventListener(t,function(){IDRViewer.fire("fullscreenchange",{isFullscreen:e.isFullscreen()})})})}()},800(e,t){var n;!function(){"use strict";let o={LAYOUT_PRESENTATION:"presentation",LAYOUT_MAGAZINE:"magazine",LAYOUT_CONTINUOUS:"continuous",SELECT_SELECT:"select",SELECT_PAN:"pan",ZOOM_SPECIFIC:"specific",ZOOM_ACTUALSIZE:"actualsize",ZOOM_FITWIDTH:"fitwidth",ZOOM_FITHEIGHT:"fitheight",ZOOM_FITPAGE:"fitpage",ZOOM_AUTO:"auto"},i,l,r,a,s,c,u=1,d=0,f=!1,g=[];o.setup=function(e){e||(e=IDRViewer.config),f=!0,a=e.bounds,d=e.pagecount,s=void 0!==e.paddingX?e.paddingX:5,c=void 0!==e.paddingY?e.paddingY:5,(u<1||u>d)&&(u=1),l=document.getElementById("idrviewer");let t=document.createElement("div");t.style.position="relative",t.style.display="inline-block",t.style.verticalAlign="middle",t.style.minWidth="100%",t.style.lineHeight="normal",t.style.overflow="hidden",l.appendChild(t),(i=document.createElement("div")).id="contentContainer",i.style.transform="translateZ(0)",i.style.padding=c+"px "+s+"px",t.appendChild(i);for(let n=1;n<=d;n++){let $=document.createElement("div");$.id="page"+n,$.setAttribute("style","width: "+a[n-1][0]+"px; height: "+a[n-1][1]+"px;"),$.className="page",i.appendChild($),g[n]=$}b.setup(),p.setup(),h.setup(e.pageType,e.url),m.setup(!!e.isR2L),v.setup(),r.goToPage(u),p.setPage(u,!0);let y={selectMode:b.currentSelectMode,isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),layout:r.toString(),availableLayouts:m.getAvailableLayouts(),isFirstPage:1===u,isLastPage:r.isLastPage(u)};for(let T in e)e.hasOwnProperty(T)&&(y[T]=e[T]);y.page=u,o.fire("ready",y)};let h=function(){let e={},t="file:"===location.protocol,n=[],o,i,l,r=!1,s="";e.setup=function(e,n){i=(l="svgz"===e)||"svg"===e,n&&(s=n),t&&!i&&console.log("Cannot load pages using AJAX over the file:// protocol. Falling back to iframes (some features may not be available).");let r=document.createElement("style");r.setAttribute("type","text/css"),document.head.appendChild(r),o=r.sheet,i&&window.addEventListener("mousedown",function(e){0===e.button&&u(window)})},e.clearSelection=function(){i?u(window):c(window)};let c=function(e){try{e.getSelection?e.getSelection().empty?e.getSelection().empty():e.getSelection().removeAllRanges&&e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.empty()}catch(t){}},u=function(e){try{c(e);for(let t=1;t<=d;t++)p.isVisible(t)&&c(g[t].firstChild.contentDocument)}catch(n){}},f=function(e,t){let n=document.createElement("iframe");n.setAttribute("class","page-inner"),n.setAttribute("src",s+e+".html"),n.setAttribute("tabindex","-1"),n.setAttribute("style","width: "+a[e-1][0]+"px; height: "+a[e-1][1]+"px; position: absolute; border: 0;"),n.onload=t,g[e].appendChild(n)};return e.show=function(e){g[e].firstChild.style.display="block"},e.hide=function(e){g[e].firstChild.style.display="none"},e.load=function(e,c){i?function(e,t){let n=function(){this.removeEventListener("load",n);try{this.contentDocument.addEventListener("mousedown",function(e){0===e.button&&u(window)})}catch(e){}t()},o=document.createElement("object");o.setAttribute("width",""+a[e-1][0]),o.setAttribute("height",""+a[e-1][1]),o.setAttribute("data",s+e+(l?".svgz":".svg")),o.setAttribute("type","image/svg+xml"),o.setAttribute("class","page-inner"),o.setAttribute("style","position: absolute"),o.addEventListener("load",n),g[e].appendChild(o)}(e,c):t?f(e,c):function(e,t){let i=new XMLHttpRequest;i.open("GET",s+e+".html",!0),i.onload=function(){i.status>=200&&i.status<400?function(e,t,i){let l=document.createElement("div");l.innerHTML=e;let a=l.querySelector("#p"+t);a.style.margin="0",a.style.overflow="hidden",a.style.position="absolute";let c=function(){this&&this.removeEventListener("load",c),i()},u=a.querySelector("#pdf"+t);u.setAttribute("tabindex","-1");let d=u.getAttribute("data")||u.getAttribute("src");if(d&&u.addEventListener("load",c),s){let f=u.getAttribute("data");f?u.setAttribute("data",s+f):(f=u.getAttribute("src"))&&-1===f.indexOf("base64")&&u.setAttribute("src",s+f)}let h=a.querySelector("#fonts"+t);if(h){let p=h.innerHTML;h.parentNode.removeChild(h),p.match(/@font-face\s*{[\s\S]*?}/g).forEach(function(e){-1===n.indexOf(e)&&(n.push(e),o.insertRule(e.replace('url("','url("'+s),o.cssRules.length))})}let m=a.querySelector(".shared-css");m&&(m.parentNode.removeChild(m),r||(document.head.appendChild(m),r=!0)),$.addClass(a,"page-inner"),g[t].appendChild(a),d||c()}(i.responseText,e,t):f(e,t)},i.onerror=function(){f(e,t)},i.send()}(e,c)},e.unload=function(e){g[e].removeChild(g[e].firstChild)},e}(),p=function(){let e="loading",t="hidden",n="unloaded",i="loaded",l={},r=[],a,s,c,u=0,f=0;l.setup=function(){c=d;for(let e=1;e<=d;e++)r[e]=n,g[e].dataset.state=n};let p=function(e,t){m(r[e],t),r[e]=t,g[e].dataset.state=t},m=function(o,l){switch(o){case e:u--;break;case i:f--;break;case t:break;case n:c--}switch(l){case e:u++;break;case i:f++;break;case t:break;case n:c++}},b=function(e){return r[e]===i},v=function(e){return r[e]===i||r[e]===t},$=function(e){r[e]===i&&(p(e,t),h.hide(e))},y=function(l){if(r[l]===t&&(p(l,i),h.show(l)),r[l]===n){p(l,e);let a=function(){p(l,i),o.fire("pageload",{page:l})};h.load(l,a)}},T=function(e){r[e]!==i&&r[e]!==t||(p(e,n),h.unload(e),o.fire("pageunload",{page:e}))},_=function(){if(y(a),u<2)for(let e=1;e<10&&(x(a-e)&&(b(a-e)||y(a-e)),2!==u)&&(x(a+e)&&(b(a+e)||y(a+e)),2!==u);e++);let t=1,n=d;for(;f+u>20;)a-t>n-a?(b(t)&&$(t),t++):(b(n)&&$(n),n--);for(t=1,n=d;d-c>50;)a-t>n-a?(v(t)&&T(t),t++):(v(n)&&T(n),n--);s=setTimeout(_,500)},x=function(e){return e>=1&&e<=d};return l.setPage=function(e,t){a=e,t&&y(e),clearTimeout(s),s=setTimeout(_,500)},l.stopLoading=function(){clearTimeout(s),s=setTimeout(_,500)},l.hide=$,l.isVisible=b,l}(),m=function(){let e={},t={},n,i=!0,s=!1;return e.setup=function(e){s=e;for(let o=0;o<d;o++)if(a[o][0]!==a[0][0]||a[o][1]!==a[0][1]){i=!1;break}(r=t[n]||t[IDRViewer.LAYOUT_CONTINUOUS]).setup(i,s),$.addClass(l,"layout-"+r.toString()),s&&$.addClass(l,"isR2L")},e.setLayout=function(e){r.unload(),$.removeClass(l,"layout-"+r.toString()),(r=t[e]).setup(i,s),$.addClass(l,"layout-"+r.toString()),v.updateZoom(IDRViewer.ZOOM_AUTO),r.goToPage(u),o.fire("layoutchange",{layout:e})},e.addLayout=function(e,n){t[e]=n},e.setDefault=function(e){n=e},e.getAvailableLayouts=function(){return Object.keys(t)},e.updatePage=function(e){u!=e&&(u=e,p.setPage(e),o.fire("pagechange",{page:u,pagecount:d,isFirstPage:1===u,isLastPage:r.isLastPage(e)}))},e}();m.addLayout(o.LAYOUT_PRESENTATION,function(){let e={},t;e.setup=function(e){t=e},e.unload=function(){for(let e=1;e<=d;e++)g[e].style.marginLeft="",g[e].style.marginTop="",$.removeClass(g[e],"current","prev","next","before","after");i.style.width="",i.style.height=""},e.goToPage=function(o){m.updatePage(o),t||v.updateZoom(),l.scrollTop=0,n(o),e.updateLayout()},e.getVisiblePages=function(){return[u]};let n=function(e){for(let t=1;t<=d;t++)$.removeClass(g[t],"current","prev","next","before","after"),delete g[t].dataset.visible,t<e?$.addClass(g[t],"before"):t>e&&$.addClass(g[t],"after");$.addClass(g[e],"current"),g[e].dataset.visible="true",e-1>=1&&$.addClass(g[e-1],"prev"),e+1<=d&&$.addClass(g[e+1],"next")};return e.updateLayout=function(){let e=v.getZoom(),t=Math.floor(a[u-1][0]*e),n=0,o=l.clientWidth-2*s;o>t?n=(o-t)/2:o=t;let r=Math.floor(a[u-1][1]*e),f=0,h=l.clientHeight-2*c;h>r?f=(h-r)/2:h=r,i.style.width=o+"px",i.style.height=h+"px";for(let p=1;p<=d;p++)g[p].style.marginLeft=n+"px",g[p].style.marginTop=f+"px"},e.isLastPage=function(e){return e===d},e.getZoomBounds=function(){return{width:a[u-1][0],height:a[u-1][1]}},e.getAutoZoom=function(e,t){return Math.min(e,t)},e.next=function(){o.goToPage(u+1)},e.prev=function(){o.goToPage(u-1)},e.toString=function(){return IDRViewer.LAYOUT_PRESENTATION},e}()),m.addLayout(o.LAYOUT_MAGAZINE,function(){let e={},t,n;function r(e){return e>1&&e<d}e.setup=function(e,o){t=e,n=o},e.unload=function(){for(let e=1;e<=d;e++)g[e].style.marginLeft="",g[e].style.marginTop="",$.removeClass(g[e],"current","prev","next","before","after");i.style.width="",i.style.height=""},e.goToPage=function(n){1!==n&&n%2!=0&&(n-=1),m.updatePage(n),t||v.updateZoom(),f(n),e.updateLayout()},e.getVisiblePages=function(){let e=[u];return r(u)&&e.push(u+1),e};let f=function(e){for(let t=1;t<=d;t++)$.removeClass(g[t],"current","prev","next","before","after"),delete g[t].dataset.visible;if($.addClass(g[e],"current"),g[e].dataset.visible="true",r(e)&&($.addClass(g[e+1],"current"),g[e+1].dataset.visible="true"),1==e&&(e=0),e+2<=d&&($.addClass(g[e+2],"next"),e+3<=d&&$.addClass(g[e+3],"next")),e-1>0&&($.addClass(g[e-1],"prev"),e-2>0&&$.addClass(g[e-2],"prev")),e+4<=d)for(let n=e+4;n<=d;n++)$.addClass(g[n],"after");if(e-3>0)for(let o=e-3;o>0;o--)$.addClass(g[o],"before")};return e.updateLayout=function(){let e=r(u),t=v.getZoom(),o=Math.floor(a[u-1][0]*t),f=e?Math.floor(a[u][0]*t):o,h=Math.max(2*Math.max(o,f),l.clientWidth-2*s),p=Math.floor(h/2),m=p,b=p;n?b-=f:m-=o;let $=Math.floor(a[u-1][1]*t),y=e?Math.floor(a[u][1]*t):$,T=Math.max($,y,l.clientHeight-2*c),_=Math.floor((T-(n?y:$))/2),x=Math.floor((T-(n?$:y))/2);i.style.width=h+"px",i.style.height=T+"px",g[1].style.marginLeft=b+"px",g[1].style.marginTop=x+"px";for(let E=2;E<=d;E+=2)g[E].style.marginLeft=m+"px",g[E].style.marginTop=_+"px",E<d&&(g[E+1].style.marginLeft=b+"px",g[E+1].style.marginTop=x+"px")},e.isLastPage=function(e){return e+(1==e?1:2)>d},e.getZoomBounds=function(){let e=r(u),t=Math.floor(a[u-1][0]),n=e?Math.floor(a[u][0]):0,o=Math.floor(a[u-1][1]),i=e?Math.floor(a[u][1]):0;return{width:2*Math.max(t,n),height:Math.max(o,i)}},e.getAutoZoom=function(e,t){return Math.min(e,t)},e.next=function(){o.goToPage(u+(1==u?1:2))},e.prev=function(){o.goToPage(u-1)},e.toString=function(){return IDRViewer.LAYOUT_MAGAZINE},e}()),m.addLayout(o.LAYOUT_CONTINUOUS,function(){let e={},t=0,n=0,i=[];e.setup=function(){l.addEventListener("scroll",r);for(let e=0;e<d;e++)a[e][0]>t&&(t=a[e][0]),a[e][1]>n&&(n=a[e][1])},e.unload=function(){l.removeEventListener("scroll",r)};let r=function(){p.stopLoading(),f()},f=function(){let e,t;if(g[1].getBoundingClientRect().top>0)m.updatePage(1);else for(e=1;e<=d;e++){let n=g[e].getBoundingClientRect();t=n.top;let o=n.bottom-n.top;if(t<=.25*o&&t>-(.5*o)){m.updatePage(e);break}}h()},h=function(){let e,t;i.forEach(e=>{delete g[e].dataset.visible}),i=[u];let n=l.clientHeight,o=function(e){return(t=g[e].getBoundingClientRect()).bottom>0&&t.top<n};for(e=u-1;e>=1&&o(e);e--)i.push(e);for(e=u+1;e<=d&&o(e);e++)i.push(e);i.forEach(e=>{g[e].dataset.visible="true"})};return e.goToPage=function(e,t){let n=0;if(t){let o=t.split(" ");switch(o[0]){case"XYZ":n=Number(o[2]);break;case"FitH":case"FitBH":n=Number(o[1]);break;case"FitR":n=Number(o[4])}(isNaN(n)||n<0||n>a[e-1][1])&&(n=0),0!==n&&(n=a[e-1][1]-n)}let i=v.getZoom();l.scrollTop=g[e].offsetTop-c+n*i,m.updatePage(e),h()},e.getVisiblePages=function(){return i},e.updateLayout=function(){h()},e.isLastPage=function(e){return e===d},e.getZoomBounds=function(){return{width:t,height:n}},e.getAutoZoom=function(t){return e.getZoomBounds().width>l.clientWidth-2*s?t:1},e.next=function(){o.goToPage(u+1)},e.prev=function(){o.goToPage(u-1)},e.toString=function(){return IDRViewer.LAYOUT_CONTINUOUS},e}());let b=function(){let e={},t,n,r,a,s=!1;e.setup=function(){switch((a=document.createElement("div")).id="overlay",i.parentNode.insertBefore(a,i),r){case IDRViewer.SELECT_PAN:case IDRViewer.SELECT_SELECT:break;default:r=IDRViewer.SELECT_SELECT}this.currentSelectMode=r,this.currentSelectMode==o.SELECT_SELECT?e.enableTextSelection():e.enablePanning()},e.enableTextSelection=function(){this.currentSelectMode=o.SELECT_SELECT,$.removeClass(a,"panning"),a.removeEventListener("mousedown",c),document.removeEventListener("mouseup",u),a.removeEventListener("mousemove",d)};let c=function(e){return e=e||window.event,$.addClass(a,"mousedown"),t=e.clientX,n=e.clientY,s=!0,!1},u=function(){$.removeClass(a,"mousedown"),s=!1},d=function(e){if(s)return e=e||window.event,l.scrollLeft=l.scrollLeft+t-e.clientX,l.scrollTop=l.scrollTop+n-e.clientY,t=e.clientX,n=e.clientY,!1};return e.enablePanning=function(){this.currentSelectMode=o.SELECT_PAN,h.clearSelection(),$.addClass(a,"panning"),a.addEventListener("mousedown",c),document.addEventListener("mouseup",u),a.addEventListener("mousemove",d)},e.setDefaultMode=function(e){r=e},e}();o.setSelectMode=function(e){f?(e==o.SELECT_SELECT?b.enableTextSelection():b.enablePanning(),o.fire("selectchange",{type:e})):b.setDefaultMode(e)};let v=function(){let e={},t=[.1,.25,.5,.75,1,1.25,1.5,2,2.5,3,3.5,4],n=[o.ZOOM_AUTO,o.ZOOM_FITPAGE,o.ZOOM_FITHEIGHT,o.ZOOM_FITWIDTH,o.ZOOM_ACTUALSIZE],i,u,f,h=o.ZOOM_AUTO,m=0,b=1;e.setup=function(){let e=document.createElement("style");e.setAttribute("type","text/css"),document.head.appendChild(e),u=e.sheet,window.addEventListener("resize",function(){v()}),v(f)};let v=function(e){var n;p.stopLoading();let s=!1,c=!1;(b=$(e))>=t[t.length-1]?(b=t[t.length-1],c=!0):b<=t[0]&&(b=t[0],s=!0);let f=l.scrollTop/l.scrollHeight;r.updateLayout();let y=r.getVisiblePages();for(let T=1;T<=d;T++)-1===y.indexOf(T)&&p.hide(T);i&&u.deleteRule(i);let _,x="-webkit-transform: "+(_="translateX(0px) translateY(0px) scale("+(n=b)+")")+";\n-ms-transform: "+_+";\ntransform: "+_+";";i=u.insertRule(".page-inner { \n"+x+"\n}",u.cssRules.length);for(let E=0;E<d;E++)g[E+1].style.width=Math.floor(a[E][0]*b)+"px",g[E+1].style.height=Math.floor(a[E][1]*b)+"px";l.scrollTop=l.scrollHeight*f,++m%2==1&&v(),o.fire("zoomchange",{zoomType:h,zoomValue:b,isMinZoom:s,isMaxZoom:c})},$=function(e){let t=r.getZoomBounds(),n=(l.clientWidth-2*s)/t.width,i=(l.clientHeight-2*c)/t.height,a=parseFloat(e);switch(isNaN(a)||(b=a,e=o.ZOOM_SPECIFIC),e||(e=h),e){case o.ZOOM_AUTO:b=r.getAutoZoom(n,i);break;case o.ZOOM_FITWIDTH:b=n;break;case o.ZOOM_FITHEIGHT:b=i;break;case o.ZOOM_FITPAGE:b=Math.min(n,i);break;case o.ZOOM_ACTUALSIZE:b=1}return h=e,b};return e.updateZoom=v,e.zoomIn=function(){v(function(){let e=b,o,i=t[t.length-1];for(let l=0;l<t.length;l++)if(t[l]>e){i=t[l];break}for(let r=0;r<n.length;r++){let a=$(n[r]);if(a>e&&a<=i){if(o&&a===i)continue;o=n[r],i=a}}return o||i}())},e.zoomOut=function(){v(function(){let e=b,o,i=t[0];for(let l=t.length-1;l>=0;l--)if(t[l]<e){i=t[l];break}for(let r=0;r<n.length;r++){let a=$(n[r]);if(a<e&&a>=i){if(o&&a===i)continue;o=n[r],i=a}}return o||i}())},e.getZoom=function(){return b},e.setDefault=function(e){f=e},e}();o.zoomIn=function(){v.zoomIn()},o.zoomOut=function(){v.zoomOut()},o.setZoom=function(e){f?v.updateZoom(e):v.setDefault(e)},o.goToPage=function(e,t){f?e>=1&&e<=d&&r.goToPage(Number(e),t):u=e},o.next=function(){r.next()},o.prev=function(){r.prev()},o.setLayout=function(e){f?m.setLayout(e):m.setDefault(e)},o.updateLayout=function(){v.updateZoom()},function(){let e={};o.on=function(t,n){e[t]||(e[t]=[]),-1===e[t].indexOf(n)&&e[t].push(n)},o.off=function(t,n){if(e[t]){let o=e[t].indexOf(n);-1!==o&&e[t].splice(o,1)}},o.fire=function(t,n){e[t]&&e[t].forEach(function(e){e(n)})}}();let $={addClass:function(e,t){let n=0!==e.className.length?e.className.split(" "):[];-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" "))},removeClass:function(){let e=arguments[0],t=0!==e.className.length?e.className.split(" "):[];for(let n=1;n<arguments.length;n++){let o=t.indexOf(arguments[n]);-1!==o&&t.splice(o,1)}e.className=t.join(" ")}};void 0===(n=(function(){return o}).apply(t,[]))||(e.exports=n),window&&(window.IDRViewer=o)}()},167(){let e,t,n,o,i,l,r,a;e="URLSearchParams"in window?new URL(document.location).searchParams:(o={},-1!=(l=(i=document.URL).toString().indexOf("?"))&&i.substr(l+1).split("&").forEach(function(e){let t=e.split("=");o[t[0]]=t[1]}),{get:function(e){return o[e]},set:function(e,t){o[e]=t},toString:function(){let e=[];for(let t in o)e.push(t+"="+o[t]);return e.join("&")}}),r=function(e){history.pushState&&(t===IDRViewer.LAYOUT_CONTINUOUS?(n&&clearTimeout(n),n=setTimeout(function(){a(e.page)},1e3)):a(e.page))},a=function(t){try{e.set("page",t),history.pushState({page:t},null,"?"+e.toString())}catch(n){}},IDRViewer.goToPage(parseInt(e.get("page"))||1),history.pushState&&IDRViewer.on("ready",function(n){t=n.layout;try{e.set("page",n.page),history.replaceState({page:n.page},null,"?"+e.toString())}catch(o){}window.onpopstate=function(e){IDRViewer.off("pagechange",r),IDRViewer.goToPage(e.state.page),IDRViewer.on("pagechange",r)},IDRViewer.on("pagechange",r),IDRViewer.on("layoutchange",function(e){t=e.layout})})},452(){!function(){"use strict";let e,t,n="file:"===location.protocol,o,i,l=-1;n&&console.log("Search functionality is not available when loading from the file:// protocol."),IDRViewer.on("ready",function(e){t=e.url||"",i=e.page}),IDRViewer.on("pagechange",e=>{i=e.page}),IDRViewer.loadSearch=function(o,i){if(e)o&&setTimeout(function(){o(!0)},0);else{if(n)return void(o&&o(!1));let l=new XMLHttpRequest;l.open("GET",t+"search.json",!0),i&&l.addEventListener("progress",function(e){e.lengthComputable&&i(Math.floor(e.loaded/e.total*100))}),l.onload=function(){l.status>=200&&l.status<400&&(e=JSON.parse(l.responseText),IDRViewer.fire("searchready",{})),o&&o(!!e)},l.onerror=function(){o&&o(!1)},l.send()}},IDRViewer.search=function(t,n,i,r=!1){if(!e)throw Error("Search not loaded. loadSearch() must be called first.");if(o=[],l=-1,e&&t){t=n?t:t.toUpperCase();for(let a=0;a<e.length;a++){let s=n?e[a]:e[a].toUpperCase(),c=-1,u=0;do if((c=s.indexOf(t,c+1))>=0){let d=c>=50?c-50:0,f=c+t.length<e[a].length-50?c+t.length+50:e[a].length,g={page:a+1,index:u++};r?(g.preSnippet=e[a].substring(d,c),g.postSnippet=e[a].substring(c+t.length,f),g.result=e[a].substring(c,c+t.length)):g.snippet=a+1+" - "+e[a].substr(d,f-d),o.push(g)}while(!i&&-1!==c)}}return IDRViewer.fire("search",{searchTerm:t,results:o,settings:{matchCase:n,limitOnePerPage:i,decomposeSnippets:r}}),o},IDRViewer.nextSearchResult=function(){let e=l>=0?o[(l+1)%o.length]:o.find(e=>e.page>=i);e?IDRViewer.selectSearchResult(e.page,e.index):console.warn("Failed to find next search result")},IDRViewer.prevSearchResult=function(){let e=l>=0?o[l-1>=0?l-1:o.length-1]:o.reduce((e,t)=>t.page<=i?t:e);e?IDRViewer.selectSearchResult(e.page,e.index):console.warn("Failed to find previous search result")},IDRViewer.selectSearchResult=function(e,t){if(!o)return void console.warn("There isn't currently a search");let n=o.findIndex(n=>n.page===e&&n.index===t);-1!==n?(l=n,IDRViewer.goToPage(e),IDRViewer.fire("searchresultselected",{resultIndex:n,result:o[n]})):console.warn("That isn't a valid search result")}}(),function(){"use strict";let e,t,n,o={},i=null,l=[];function r(e){return parseInt(e.substring(4))}function a(n){let i=e(n),a=i.getTextElements();if(!a||(i.clearHighlights(),!t||!t.searchTerm||!o.hasOwnProperty(r(n.id))))return;if(e===u&&0===a[0].getComputedTextLength())return void(l.includes(n)||l.push(n));let s=JSON.parse(JSON.stringify(t)),c=0,d={beginning:0,end:0,elements:[]};for(let f of(s.searchTerm=i.processSearchTerm(s.searchTerm),a)){let g=void 0!==f.dataset.mappings?JSON.parse(f.dataset.mappings):void 0,h,p=i.getRawText(f),m=[];if(g){let b=[...p.matchAll(/&(?:gt|lt|amp);/gi)].reduce((e,t)=>(e.push({index:t.index-e.reduce((e,t)=>e+t.offset,0),offset:t[0].length-1}),e),[]);for(let v of g){let $=v[0]+m.reduce((e,t)=>e+t.offset,0)+b.filter(e=>e.index<v[0]).reduce((e,t)=>e+t.offset,0),y=v[1];p=p.substring(0,$)+y+p.substring($+1),m.push({index:$,offset:y.length-1})}}s.matchCase?h=p:(h=p.toUpperCase(),s.searchTerm=s.searchTerm.toUpperCase(),h.length!==p.length&&console.error("Failed to handle a ligature"));let T,_=0,x=!1;for(;_<h.length;){for(T=0;_+T<h.length&&c<s.searchTerm.length;)"&"===h.charAt(_+T)?x=!0:x&&";"===h.charAt(_+T)&&(x=!1),h.charAt(_+T)===s.searchTerm.charAt(c)?(T++,c++):(T=0,c=0,d.elements.length||_++,d={beginning:0,end:0,elements:[]});if(T>0){if(x)d={beginning:0,end:0,elements:[]},c=0,_++;else{if(!d.elements.length)for(let E of(d.beginning=_,m)){if(!(d.beginning>E.index))break;d.beginning<E.index+E.offset?d.beginning-=d.beginning-E.index:d.beginning-=E.offset}if(d.elements.push(f),c===s.searchTerm.length){for(let L of(d.end=_+T,m)){if(!(d.end>L.index))break;d.end<L.index+L.offset?d.end-=d.end-L.index:d.end-=L.offset}i.storeDescriber(d),c=0,d={beginning:0,end:0,elements:[]}}_+=T}}}}i.highlightResults(),o[r(n.id)].pageHandler=i}function s(){if(Object.keys(o)&&i){let e=o[i.page];e&&e.pageHandler.setMatchDescriptorSelected(i.index,!1)}i=null}function c(e){return Number(e).toString(16).padStart(6,"0")}IDRViewer.on("ready",t=>{e="html"===t.pageType?d:u}),IDRViewer.on("pageunload",e=>{delete o[e.page],i&&i.page===e.page&&s()}),IDRViewer.on("searchready",()=>{IDRViewer.on("pageload",function(e){o.hasOwnProperty(e.page)&&(a(document.querySelector("#page"+e.page)),i&&i.page===e.page&&o[e.page].pageHandler.setMatchDescriptorSelected(i.index,!0))}),e===u&&setInterval(function(){if(l.length>0){let e=l.shift();e&&(0!==e.querySelector("object").contentDocument.querySelector("text").getComputedTextLength()?(a(e),i&&i.page===e.page&&o[e.page].pageHandler.setMatchDescriptorSelected(i.index,!0)):l.push(e))}},500)}),IDRViewer.on("search",e=>{s(),o=e.results.reduce((e,t)=>(e.hasOwnProperty(t.page)?e[t.page].count++:e[t.page]={count:1,pageHandler:null},e),{}),clearTimeout(n),n=setTimeout(function(){t={searchTerm:e.searchTerm,matchCase:e.settings.matchCase,limitOnePerPage:e.settings.limitOnePerPage};let n=document.getElementsByClassName("page");for(let o=0;o<n.length;o++){let i=n[o];i.innerHTML&&a(i)}},300)}),IDRViewer.on("searchresultselected",e=>{s(),i={page:e.result.page,index:e.result.index};let t=o[e.result.page];void 0!==t?t.count<=e.result.index?console.error("There aren't that many results on that page"):t.pageHandler&&(t.pageHandler.setMatchDescriptorSelected(e.result.index,!0),t.pageHandler.scrollIntoView(e.result.index)):console.error("That page doesn't have any results on it")});let u=function(e){let t={searchResults:[]};function n(e,t,n,o,i,l){return{x:e,y:t,width:n,height:o,transform:i,refElement:l}}return t.getTextElements=function(){let t=e.querySelector("object").contentDocument;if(!t||0!==(t=t.querySelectorAll("text")).length)return t},t.clearHighlights=function(){let t=[...e.querySelector("object").contentDocument.querySelectorAll(".highlight")];for(;t.length>0;){let n=t.pop();n.parentNode.removeChild(n)}},t.processSearchTerm=function(e){return e},t.getRawText=function(e){return e.textContent},t.storeDescriber=function(e){t.searchResults=t.searchResults.concat(function(e){let t=[];if(1===e.elements.length){let o=e.elements[0],i=o.getExtentOfChar(e.beginning),l=o.getExtentOfChar(e.end-1);t.push(n(i.x,i.y,l.x+l.width-i.x,l.y+l.height-i.y,o.getAttribute("transform"),o))}else{let r=e.elements[0],a=r.getExtentOfChar(e.beginning),s=r.getExtentOfChar(r.textContent.length-1);t.push(n(a.x,a.y,s.x+s.width-a.x,s.y+s.height-a.y,r.getAttribute("transform"),r));for(let c=1;c<e.elements.length-1;c++)a=(r=e.elements[c]).getBBox(),t.push(n(a.x,a.y,a.width,a.height,r.getAttribute("transform"),r));a=(r=e.elements[e.elements.length-1]).getBBox(),s=r.getExtentOfChar(e.end-1),t.push(n(a.x,a.y,s.x+s.width-a.x,s.y+s.height-a.y,r.getAttribute("transform"),r))}return t}(e))},t.highlightResults=function(){var e,n;for(let o=0;o<t.searchResults.length;o++){let i=t.searchResults[o];i.refElement.parentNode.insertBefore((n=o,function(e,t,n,o,i,l){let r=document.createElementNS("http://www.w3.org/2000/svg","rect");return r.setAttributeNS(null,"x",e),r.setAttributeNS(null,"y",t),r.setAttributeNS(null,"width",n),r.setAttributeNS(null,"height",o),r.setAttributeNS(null,"fill","yellow"),r.setAttributeNS(null,"class","highlight"),r.setAttributeNS(null,"data-index",c(l)),i&&r.setAttributeNS(null,"transform",i),r}((e=i).x,e.y,e.width,e.height,e.transform,n)),i.refElement)}},t.setMatchDescriptorSelected=function(t,n){let o=e.querySelector("object").contentDocument.querySelectorAll('[data-index="'+c(t)+'"].highlight');for(let i of o)n?(i.classList.add("selected"),i.style.fill="orange"):(i.classList.remove("selected"),i.style.fill="")},t.scrollIntoView=function(e){t.searchResults[e].refElement.scrollIntoView({block:"nearest",inline:"start"})},t.getMatchesCount=function(){return t.searchResults.length},t},d=function(e){let t={textElements:void 0,searchResults:[]};function n(e,t){return'<span class="highlight" data-index="'+c(t)+'">'+e+"</span>"}function o(e,t){let n=e.find(e=>e.element===t);n?n.length+=51:e.push({element:t,length:51})}return t.getTextElements=function(){if(t.textElements=e.querySelector(".text-container"),!t.textElements||(t.textElements=t.textElements.children,0!==t.textElements.length))return t.textElements},t.clearHighlights=function(){for(let e=0;e<t.textElements.length;e++){let n=t.textElements[e];n.innerHTML=n.innerHTML.replace(/<span class="highlight(?: selected)?" data-index="[a-fA-F0-9]{6}">|<\/span>/gim,"")}},t.processSearchTerm=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},t.getRawText=function(e){return e.innerHTML},t.storeDescriber=function(e){t.searchResults.push(e)},t.highlightResults=function(){let e=[];for(let i=0;i<t.searchResults.length;i++){let l=t.searchResults[i];if(1===l.elements.length){let r,a,s=l.elements[0],c=s.innerHTML;for(let u=0;u<e.length;u++)if(e[u].element===s){r=e[u];break}a=r?r.length:0,s.innerHTML=c.substring(0,l.beginning+a);let d=n(c.substring(l.beginning+a,l.end+a),i);s.innerHTML+=d,o(e,s),s.innerHTML+=c.substring(l.end+a,c.length)}else{let f,g,h=l.elements[0],p=h.innerHTML;for(let m=0;m<e.length;m++)if(e[m].element===h){f=e[m];break}g=f?f.length:0,h.innerHTML=p.substring(0,l.beginning+g);let b=n(p.substring(l.beginning+g,p.length),i);h.innerHTML+=b,o(e,h);for(let v=1;v<l.elements.length-1;v++)p=(h=l.elements[v]).innerHTML,h.innerHTML="",b=n(p,i),h.innerHTML+=b,o(e,h);p=(h=l.elements[l.elements.length-1]).innerHTML,h.innerHTML="",b=n(p.substring(0,l.end),i),h.innerHTML+=b,h.innerHTML+=p.substring(l.end,p.length),o(e,h)}}},t.setMatchDescriptorSelected=function(t,n){let o=e.querySelectorAll('[data-index="'+c(t)+'"].highlight');for(let i of o)n?i.classList.add("selected"):i.classList.remove("selected")},t.scrollIntoView=function(e){t.searchResults[e].elements[0].scrollIntoView({block:"nearest",inline:"start"})},t.getMatchesCount=function(){return t.searchResults.length},t}}()},685(){!function(){"use strict";let e=function(){let e={ja:{"control.sidebar":"サイドバー","control.theme-toggle":"テーマ切換","control.prev":"前のページ","control.next":"次のページ","control.select":"選択","control.move":"パン","control.zoom-out":"縮小","control.zoom-in":"拡大","control.actual-size":"実際のサイズ","control.fit-width":"幅に合わせる","control.fit-height":"高さに合わせる","control.fit-page":"ページに合わせる","control.auto":"自動","control.fullscreen":"フルスクリーン","control.thumbnails":"サムネイル","control.bookmarks":"ブックマーク","control.presentation":"プレゼンテーション","control.magazine":"マガジン","control.continuous":"スクロール","control.search":"検索","control.page":"ページ","search.search":"検索","search.match-case":" 大文字・小文字を区別","search.limit-results-1":" 結果を1ページ1つに制限する","search.limit-results-500":"最初の500件が表示されます。","search.unavailable":"検索できません","search.loading":"ローディング"},fr:{"control.sidebar":"Barre lat\xe9rale","control.theme-toggle":"Basculer entre les th\xe8mes","control.prev":"Page pr\xe9c\xe9dente","control.next":"Page suivante","control.select":"S\xe9lectionner","control.move":"D\xe9placer","control.zoom-out":"Zoom arri\xe8re","control.zoom-in":"Zoom avant","control.actual-size":"Taille r\xe9elle","control.fit-width":"Pleine largeur","control.fit-height":"Pleine hauteur","control.fit-page":"Page enti\xe8re","control.auto":"Automatique","control.fullscreen":"Plein \xe9cran","control.thumbnails":"Vignettes","control.bookmarks":"Signets","control.presentation":"Pr\xe9sentation","control.magazine":"Magazine","control.continuous":"En continu","control.search":"Recherche","control.page":"Page","search.search":"Rechercher","search.match-case":" Respecter la casse","search.limit-results-1":" Limiter les r\xe9sultats \xe0 1 par page","search.limit-results-500":"Limit\xe9e aux 500 premiers r\xe9sultats","search.unavailable":"Recherche non accessible","search.loading":"Chargement en cours"},de:{"control.sidebar":"Seitenleiste","control.theme-toggle":"Darstellung wechseln","control.prev":"Vorherige Seite","control.next":"N\xe4chste Seite","control.select":"Ausw\xe4hlen","control.move":"Bewegen","control.zoom-out":"Zoom Out","control.zoom-in":"Zoom In","control.actual-size":"Tats\xe4chliche Gr\xf6sse","control.fit-width":"Breite f\xfcllend","control.fit-height":"H\xf6he f\xfcllend","control.fit-page":"Seite f\xfcllend","control.auto":"Automatisch","control.fullscreen":"Ganzer Bildschirm","control.thumbnails":"Mini-Ansichten","control.bookmarks":"Lesezeichen","control.presentation":"Pr\xe4sentationsdarstellung","control.magazine":"Magazindarstellung","control.continuous":"Fortlaufende Darstellung","control.search":"Suchen","control.page":"Seite","search.search":"Suchen","search.match-case":"Gross-/Kleinschreibung beachten","search.limit-results-1":"Auf 1 Resultat pro Seite begrenzen","search.limit-results-500":"Auf die ersten 500 Resultate begrenzen.","search.unavailable":"Suche nicht verf\xfcgbar.","search.loading":"Lade"},hi:{"control.sidebar":"साइडबार","control.theme-toggle":"विषय टॉगल","control.prev":"पिछला पृष्ठ","control.next":"अगला पृष्ठ","control.select":"चुनते हैं","control.move":"पान","control.zoom-out":"छोटा करें","control.zoom-in":"बड़ा करें","control.actual-size":"वास्तविक आकार","control.fit-width":"चौड़ाई पर फ़िट","control.fit-height":"ठीक ऊंचाई","control.fit-page":"फिट पेज","control.auto":"स्वचालित","control.fullscreen":"पूर्ण स्क्रीन","control.thumbnails":"थंबनेल","control.bookmarks":"बुकमार्क","control.presentation":"प्रदर्शन","control.magazine":"पत्रिका","control.continuous":"निरंतर","control.search":"खोज","control.page":"पृष्ठ","search.search":"खोज","search.match-case":"मिलान घटना","search.limit-results-1":"सीमा परिणाम 1 प्रति पृष्ठ","search.limit-results-500":"पहले 500 परिणामों तक सीमित है","search.unavailable":"उपलब्ध नहीं खोजें।","search.loading":"लोड हो रहा है"}},t=(navigator.language||navigator.userLanguage).substr(0,2),n=!!e[t]&&e[t];return{getTranslation:function(e){return n?n[e]:null},updateElements:function(){if(n){let e,o;document.documentElement.setAttribute("lang",t);let i=document.querySelectorAll("[data-lang-title]");for(e=0;e<i.length;e++)n[(o=i[e]).dataset.langTitle]&&(o.title=n[o.dataset.langTitle]);let l=document.querySelectorAll("[data-lang-text]");for(e=0;e<l.length;e++)n[(o=l[e]).dataset.langText]&&(o.innerText=n[o.dataset.langText])}}}}(),t=function(e){return document.getElementById(e)},n=function(e,t){let n=0!==e.className.length?e.className.split(" "):[];-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" "))},o=function(e,t){let n=0!==e.className.length?e.className.split(" "):[],o=n.indexOf(t);-1!==o&&n.splice(o,1),e.className=n.join(" ")},i=function(e,t){let n=0!==e.className.length?e.className.split(" "):[],o=n.indexOf(t),i;return -1===o?(n.push(t),i=!0):(n.splice(o,1),i=!1),e.className=n.join(" "),i},l=function(){let e={},n={},o,l,r,a=function(e){document.querySelectorAll("#sidebar-controls > button").forEach(t=>{t.setAttribute("tabindex",e)})};return IDRViewer.on("ready",function(i){for(let s in t("btnSideToggle").addEventListener("click",e.toggleSidebar),o=t("sidebar"),n)n[s].setup(i),n[s].hide();r=l,a("-1")}),e.register=function(e,t,o){n[e]=t,o&&(l=e)},e.switchTo=function(e){r!==e&&(n[r].hide(),n[r=e].show())},e.openSidebar=function(){-1===document.body.className.indexOf("sidebar-open")&&e.toggleSidebar()},e.toggleSidebar=function(){i(document.body,"sidebar-open")?(a("0"),n[r].show()):(n[r].hide(),a("-1"))},e}();!function(){let i,r,a,s,c,u,d,f,g,h,p=function(e){let t=IDRViewer.selectSearchResult(parseInt(this.dataset.page),parseInt(this.dataset.index));t&&(c.innerText=String(t)),e.preventDefault()},m=function(e){return e.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;")},b=function(){var t;let n=document.getElementById("searchResults");n.innerText="";let o=s.value,i=g.checked,l=h.checked,r=IDRViewer.search(o,i,l,!0);u.innerText=String(r.length),c.innerText="0",t=0===r.length,d.disabled=t,f.disabled=t;let a=document.createDocumentFragment();for(let b=0;b<r.length&&b<500;b++){let v=r[b].page,$=r[b].index,y=document.createElement("a");y.href="?page="+v,y.innerHTML=v+" - "+m(r[b].preSnippet)+"<b>"+m(r[b].result)+"</b>"+m(r[b].postSnippet),y.className="result",y.dataset.page=v,y.dataset.index=$,y.addEventListener("click",p),a.appendChild(y)}if(r.length>=500){let T=document.createElement("span");T.innerText=e.getTranslation("search.limit-results-500")||"Limited to first 500 results.",T.className="result",a.appendChild(T)}n.appendChild(a)};l.register("search",{setup:function(){(r=t("btnSearch")).addEventListener("click",function(){l.switchTo("search")}),i=t("search-panel"),s=t("searchInput"),c=t("searchHighlightSelected"),u=t("searchHighlightTotal"),d=t("nextHighlight"),f=t("prevHighlight"),g=t("cbMatchCase"),h=t("cbLimitResults"),s.value=e.getTranslation("search.loading")||"Loading",s.disabled="disabled",s.addEventListener("input",b),s.addEventListener("keydown",function(e){switch(e.key){case"Esc":case"Escape":""!==s.value?(s.value="",b()):(s.blur(),l.toggleSidebar());break;case"Enter":e.shiftKey?IDRViewer.prevSearchResult():IDRViewer.nextSearchResult()}}),g.addEventListener("click",b),h.addEventListener("click",b),d.addEventListener("click",function(){IDRViewer.nextSearchResult()}),f.addEventListener("click",function(){IDRViewer.prevSearchResult()}),document.addEventListener("keydown",function(e){"f"===e.key&&(e.ctrlKey||e.metaKey)&&(l.openSidebar(),l.switchTo("search"),s.focus(),s.select(),e.preventDefault())}),IDRViewer.on("searchresultselected",function(e){c.innerText=e.resultIndex+1})},show:function(){o(i,"hidden"),n(r,"disabled"),a||(a=!0,IDRViewer.loadSearch(function(t){t?(s.value="",s.disabled="",s.focus()):s.value=e.getTranslation("search.unavailable")||"Search not available."},function(t){s.value=(e.getTranslation("search.loading")||"Loading")+" ("+t+"%)"})),s.focus()},hide:function(){n(i,"hidden"),o(r,"disabled")}})}(),function(){let i=[],r=[],a,s,c,u,d,f,g,h,p=!0,m=function(){h||(h=setInterval(b,250)),g&&clearTimeout(g),g=setTimeout(v,500)},b=function(){let e=a.scrollTop,t=e+a.clientHeight;for(let l=0;l<u;l++)i[l]||(r[l]+160>e&&r[l]<t?n(a.children[l].firstChild,"spinning"):o(a.children[l].firstChild,"spinning"))},v=function(){h&&(h=clearInterval(h)),g=null;for(let e=0;e<u;e++)if(!i[e]){let t=a.children[e];if(t.offsetTop>a.scrollTop+a.clientHeight)break;t.offsetTop+t.clientHeight>a.scrollTop&&(t.innerHTML='<img src="'+f+"thumbnails/"+(e+1)+"."+c+'" />',i[e]=!0)}};IDRViewer.on("pagechange",function(e){d=e.page,-1===a.className.indexOf("hidden")&&$(),p=!0});let $=function(){let e=a.children[d-1];if(-1===e.className.indexOf("currentPageThumbnail")){for(let t=0;t<u;t++)o(a.children[t],"currentPageThumbnail");n(e,"currentPageThumbnail"),p&&(a.scrollTop=a.scrollTop+e.getBoundingClientRect().top-a.getBoundingClientRect().top)}};l.register("thumbnails",{setup:function(n){(s=t("btnThumbnails")).addEventListener("click",function(){l.switchTo("thumbnails")}),(a=t("thumbnails-panel")).addEventListener("scroll",m),d=n.page,u=n.pagecount,c=n.thumbnailType,f=n.url||"",function(t){let n=[];for(let o=0;o<t.length;o++){let i=Math.floor(t[o][1]*(160/t[o][0]));n[o]=t[o][0]>t[o][1]||i<=200?i:200}let l=function(e){p=!1,IDRViewer.goToPage(this.dataset.page),e.preventDefault()};for(let s=1;s<=t.length;s++){let c=document.createElement("a");c.style.height=n[s-1]+"px",c.className="thumbnail",c.href="?page="+s,c.id="thumb"+s,c.dataset.page=String(s),c.addEventListener("click",l),c.setAttribute("tabindex","-1"),c.setAttribute("title",(e.getTranslation("control.page")||"Page")+" "+s);let u=Math.floor((n[s-1]-42)/2);c.innerHTML='<div class="spinner" style="margin-top: '+u+'px;"></div>',a.appendChild(c)}for(let d=1;d<=t.length;d++)r[d-1]=a.children[d-1].offsetTop}(n.bounds);for(let o=0;o<u;o++)i[o]=!1},show:function(){o(a,"hidden"),n(s,"disabled"),setTimeout(b,250),v(),$()},hide:function(){n(a,"hidden"),o(s,"disabled")}},!0)}(),function(){let e,i,r=function(e){e.preventDefault(),e.stopPropagation(),2!==e.detail?IDRViewer.goToPage(parseInt(this.dataset.page),this.dataset.zoom):this.parentElement.classList.toggle("open")},a=function(e,t){let n=document.createElement("div");n.classList.add("bookmark-container");for(let o=0;o<t.length;o++){let i=t[o],l=document.createElement("div");l.classList.add("bookmark-item");let s=document.createElement("a");if(s.title="Page "+i.page,s.innerText=i.title,s.dataset.page=i.page,s.dataset.zoom=i.zoom,s.href="?page="+s.dataset.page,s.addEventListener("click",r),l.appendChild(s),n.appendChild(l),void 0!==i.children){l.classList.add("parent");let c=document.createElement("div");c.classList.add("toggle"),l.prepend(c),c.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),this.parentElement.classList.toggle("open")}),a(l,i.children)}}e.appendChild(n)};l.register("bookmarks",{setup:function(o){(i=t("btnBookmarks")).addEventListener("click",function(){l.switchTo("bookmarks")}),e=t("bookmarks-panel"),o.bookmarks.length>0?a(e,o.bookmarks):n(i,"hidden")},show:function(){o(e,"hidden"),n(i,"disabled")},hide:function(){n(e,"hidden"),o(i,"disabled")}})}(),function(){let e,i,l,r,a,s,c,u=function(){IDRViewer.goToPage(parseInt(a.options[a.selectedIndex].value)),this.blur()},d=function(t,n){let o="/ "+n;return e&&(o="("+t+" / "+n+")"),o},f=function(e){if(null==document.activeElement||"INPUT"!==document.activeElement.tagName)switch(e.keyCode){case 33:IDRViewer.prev(),e.preventDefault();break;case 34:IDRViewer.next(),e.preventDefault();break;case 37:r?IDRViewer.next():IDRViewer.prev(),e.preventDefault();break;case 39:r?IDRViewer.prev():IDRViewer.next(),e.preventDefault();break;case 36:IDRViewer.goToPage(1),e.preventDefault();break;case 35:IDRViewer.goToPage(l),e.preventDefault()}},g=function(e){i.innerText=d(e.page,e.pagecount),a.selectedIndex=e.page-1,e.isFirstPage?n(c,"disabled"):o(c,"disabled"),e.isLastPage?n(s,"disabled"):o(s,"disabled")};IDRViewer.on("ready",function(o){e=!!o.pageLabels.length,l=o.pagecount,r=o.isR2L,i=t("pgCount"),a=t("btnGo"),c=t("btnPrev"),s=t("btnNext"),o.isFirstPage&&n(c,"disabled"),o.isLastPage&&n(s,"disabled"),a.addEventListener("change",u),c.addEventListener("click",function(e){IDRViewer.prev(),e.preventDefault()}),s.addEventListener("click",function(e){IDRViewer.next(),e.preventDefault()}),o.isR2L&&function(){s.parentNode.insertBefore(c,s),c.parentNode.insertBefore(s,c.parentNode.firstChild);let e=s.innerHTML;s.innerHTML=c.innerHTML,c.innerHTML=e}(),document.addEventListener("keydown",f),function(e,t,n){a.innerText="";for(let o=1;o<=t;o++){let i=document.createElement("option");i.value=String(o),i.innerText=n.length?n[o-1]:String(o),a.appendChild(i)}a.selectedIndex=e-1}(o.page,o.pagecount,o.pageLabels),i.innerText=d(o.page,o.pagecount),IDRViewer.on("pagechange",g)})}(),function(){let e,i,l,r=function(t){e.value=t.zoomType,e.options[0].innerText=Math.floor(100*t.zoomValue)+"%",t.isMinZoom?n(l,"disabled"):o(l,"disabled"),t.isMaxZoom?n(i,"disabled"):o(i,"disabled")},a=function(){let t=e.value;t!==IDRViewer.ZOOM_SPECIFIC&&IDRViewer.setZoom(t),this.blur()};IDRViewer.on("ready",function(){e=t("btnZoom"),i=t("btnZoomIn"),l=t("btnZoomOut"),e.addEventListener("change",a),i.addEventListener("click",function(e){IDRViewer.zoomIn(),e.preventDefault()}),l.addEventListener("click",function(e){IDRViewer.zoomOut(),e.preventDefault()}),document.addEventListener("keydown",function(e){(e.ctrlKey||e.metaKey)&&("0"===e.key?(IDRViewer.setZoom(IDRViewer.ZOOM_AUTO),e.preventDefault()):"-"===e.key?(IDRViewer.zoomOut(),e.preventDefault()):"+"!==e.key&&"="!==e.key||(IDRViewer.zoomIn(),e.preventDefault()))}),document.addEventListener("wheel",function(e){(e.ctrlKey||e.metaKey)&&(e.deltaY>0?(IDRViewer.zoomOut(),e.preventDefault()):e.deltaY<0&&(IDRViewer.zoomIn(),e.preventDefault()))},{passive:!1}),e.value=IDRViewer.ZOOM_AUTO,IDRViewer.on("zoomchange",r)})}(),function(){let o,i=function(){IDRViewer.setLayout(o.value),this.blur()};IDRViewer.on("ready",function(l){o=t("btnView"),function(t,l,r){if(r.length>1&&t>1){let a=document.createElement("option");a.innerText=e.getTranslation("control.presentation")||"Presentation",a.value=IDRViewer.LAYOUT_PRESENTATION,o.appendChild(a),-1!==r.indexOf(IDRViewer.LAYOUT_MAGAZINE)&&((a=document.createElement("option")).innerText=e.getTranslation("control.magazine")||"Magazine",a.value=IDRViewer.LAYOUT_MAGAZINE,o.appendChild(a)),-1!==r.indexOf(IDRViewer.LAYOUT_CONTINUOUS)&&((a=document.createElement("option")).innerText=e.getTranslation("control.continuous")||"Continuous",a.value=IDRViewer.LAYOUT_CONTINUOUS,o.appendChild(a)),o.addEventListener("change",i),o.value=l}else n(o,"hidden")}(l.pagecount,l.layout,l.availableLayouts)})}(),function(){let e,i,l=function(t){switch(t){case IDRViewer.SELECT_PAN:o(i,"disabled"),n(e,"disabled");break;case IDRViewer.SELECT_SELECT:o(e,"disabled"),n(i,"disabled")}},r=function(e){l(e.type)};IDRViewer.on("ready",function(n){e=t("btnMove"),i=t("btnSelect"),e.addEventListener("click",function(e){IDRViewer.setSelectMode(IDRViewer.SELECT_PAN),e.preventDefault()}),i.addEventListener("click",function(e){IDRViewer.setSelectMode(IDRViewer.SELECT_SELECT),e.preventDefault()}),l(n.selectMode),IDRViewer.on("selectchange",r)})}(),IDRViewer.on("ready",function(i){e.updateElements(),document.title=i.title?i.title:i.fileName,t("idrviewer").addEventListener("transitionend",function(){IDRViewer.updateLayout()});let l=function(e){o(document.body,"light-theme"),o(document.body,"dark-theme"),n(document.body,e?"dark-theme":"light-theme")};l(window.matchMedia("(prefers-color-scheme: dark)").matches),t("btnThemeToggle").addEventListener("click",function(){l(-1===document.body.className.indexOf("dark-theme"))}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{l(e.matches)});let r=t("btnFullScreen");IDRViewer.isFullscreenEnabled()?r.addEventListener("click",function(e){IDRViewer.toggleFullScreen(),e.preventDefault()}):n(r,"hidden"),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&n(document.body,"is-mobile")})}()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n(800),n(334),n(167),n(876),n(452),n(685)}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment