1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4836],{38362:function(e,t,n){n.r(t),n.d(t,{PdfPlayer:function(){return p}}),n(29305),n(32733),n(84701),n(81678),n(76281),n(44962),n(89336),n(4754),n(94),n(36947),n(78557),n(96054),n(90076),n(50987),n(99425),n(83994),n(82367);var i=n(8566),o=n(74550),r=n(79754),a=n(36300),s=n(70267),u=n(67430),l=n(38783),c=n(44797);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,v(i.key),i)}}function v(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}n(15453);var p=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="PDF Player",this.type=l.Q.MediaPlayer,this.id="pdfplayer",this.priority=1,this.onDialogClosed=this.onDialogClosed.bind(this),this.onWindowKeyDown=this.onWindowKeyDown.bind(this),this.onTouchStart=this.onTouchStart.bind(this)},t=[{key:"play",value:function(e){this.progress=0,this.loaded=!1,this.cancellationToken=!1,this.pages={},i.Ay.show();var t=this.createMediaElement();return this.setCurrentSrc(t,e)}},{key:"stop",value:function(){this.unbindEvents();var e={src:this.item};c.A.trigger(this,"stopped",[e]);var t=this.mediaElement;t&&(r.default.close(t),this.mediaElement=null),i.Ay.hide(),this.cancellationToken=!0}},{key:"destroy",value:function(){}},{key:"currentItem",value:function(){return this.item}},{key:"currentTime",value:function(){return this.progress}},{key:"duration",value:function(){return this.book?this.book.numPages:0}},{key:"volume",value:function(){return 100}},{key:"isMuted",value:function(){return!1}},{key:"paused",value:function(){return!1}},{key:"seekable",value:function(){return!0}},{key:"onWindowKeyDown",value:function(e){if(this.loaded&&!(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey))switch(o.Ay.getKeyName(e)){case"l":case"ArrowRight":case"Right":e.preventDefault(),this.next();break;case"j":case"ArrowLeft":case"Left":e.preventDefault(),this.previous();break;case"Escape":e.preventDefault(),this.stop()}}},{key:"onTouchStart",value:function(e){this.loaded&&e.touches&&0!==e.touches.length&&(e.touches[0].clientX<a.Ay.getWindowSize().innerWidth/2?this.previous():this.next())}},{key:"onDialogClosed",value:function(){this.stop()}},{key:"bindMediaElementEvents",value:function(){var e=this.mediaElement;e.addEventListener("close",this.onDialogClosed,{once:!0}),e.querySelector(".btnExit").addEventListener("click",this.onDialogClosed,{once:!0})}},{key:"bindEvents",value:function(){this.bindMediaElementEvents(),document.addEventListener("keydown",this.onWindowKeyDown),document.addEventListener("touchstart",this.onTouchStart)}},{key:"unbindMediaElementEvents",value:function(){var e=this.mediaElement;e.removeEventListener("close",this.onDialogClosed),e.querySelector(".btnExit").removeEventListener("click",this.onDialogClosed)}},{key:"unbindEvents",value:function(){this.mediaElement&&this.unbindMediaElementEvents(),document.removeEventListener("keydown",this.onWindowKeyDown),document.removeEventListener("touchstart",this.onTouchStart)}},{key:"createMediaElement",value:function(){var e=this.mediaElement;return e||((e=document.getElementById("pdfPlayer"))||((e=r.default.createDialog({exitAnimationDuration:400,size:"fullscreen",autoFocus:!1,scrollY:!1,exitAnimation:"fadeout",removeOnClose:!0})).id="pdfPlayer",e.innerHTML='<canvas id="canvas"></canvas><div class="actionButtons"><button is="paper-icon-button-light" class="autoSize btnExit" tabindex="-1"><span class="material-icons actionButtonIcon close" aria-hidden="true"></span></button></div>',r.default.open(e)),this.mediaElement=e,e)}},{key:"setCurrentSrc",value:function(e,t){var i=this,o=t.items[0];this.item=o,this.streamInfo={started:!0,ended:!1,item:this.item,mediaSource:{Id:o.Id}};var r=o.ServerId,a=u.tF.getApiClient(r);return Promise.all([n.e(59928),n.e(69601),n.e(99911)]).then(n.t.bind(n,12565,23)).then((function(e){var n=e.GlobalWorkerOptions,r=e.getDocument,u=a.getItemDownloadUrl(o.Id);return i.bindEvents(),n.workerSrc=s.appRouter.baseUrl()+"/libraries/pdf.worker.js",r({url:u,isEvalSupported:!1}).promise.then((function(e){if(!i.cancellationToken){i.book=e,i.loaded=!0;var n=t.startPositionTicks/1e4;0!==n?(i.loadPage(n+1),i.progress=n):i.loadPage(1)}}))}))}},{key:"next",value:function(){this.progress!==this.duration()-1&&(this.loadPage(this.progress+2),this.progress=this.progress+1,c.A.trigger(this,"pause"))}},{key:"previous",value:function(){0!==this.progress&&(this.loadPage(this.progress),this.progress=this.progress-1,c.A.trigger(this,"pause"))}},{key:"replaceCanvas",value:function(e){var t=document.getElementById("canvas");e.id="canvas",t.parentNode.replaceChild(e,t)}},{key:"loadPage",value:function(e){for(var t="page",n=[t+e],i=1;i<=2;i++)e-i>0&&n.push(t+(e-i)),e+i<this.duration()&&n.push(t+(e+i));for(var o=0,r=n;o<r.length;o++){var a=r[o];this.pages[a]||(this.pages[a]=document.createElement("canvas"),this.renderPage(this.pages[a],parseInt(a.slice(4),10)))}for(var s in this.replaceCanvas(this.pages[t+e],e),this.pages)n.includes(s)||delete this.pages[s]}},{key:"renderPage",value:function(e,t){var n=window.devicePixelRatio||1;this.book.getPage(t).then((function(t){var o=t.getViewport({scale:1}),r=Math.min(window.innerHeight/o.height,window.innerWidth/o.width)*n,a=t.getViewport({scale:r});e.width=a.width,e.height=a.height,window.innerWidth<window.innerHeight?(e.style.width="100%",e.style.height="auto"):(e.style.height="100%",e.style.width="auto");
1var s={canvasContext:e.getContext("2d"),viewport:a};t.render(s).promise.then((function(){i.Ay.hide()}))}))}},{key:"canPlayMediaType",value:function(e){return"book"===(e||"").toLowerCase()}},{key:"canPlayItem",value:function(e){return!!e.Path&&e.Path.toLowerCase().endsWith("pdf")}}],t&&d(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.default=p}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.