universalviewer
Version:
The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
36 lines (35 loc) • 24.2 kB
JavaScript
import{a as P}from"./chunk-CHPN5XCG.js";import{a as L}from"./chunk-KR4MMTFI.js";import{a as k}from"./chunk-527KPBCP.js";import"./chunk-BYXBJQAS.js";import{b as R,e as D,g,h as F,i as G,j as N,k as Z}from"./chunk-K2YFIJ7N.js";import{a as Y,c as J}from"./chunk-FEXGFX4C.js";import{a as t}from"./chunk-M4MN2QTO.js";import{a as Q,c as s,p as y}from"./chunk-YB7AEQFU.js";import{d as U,g as c}from"./chunk-5XPHF4E5.js";import{d as C}from"./chunk-L67DAW3A.js";var h=class extends k{constructor(n){super(n)}create(){this.setConfig("downloadDialogue"),super.create()}open(n){super.open(n),this.addEntireFileDownloadOptions(),this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show(),this.resize()}isDownloadOptionAvailable(n){return super.isDownloadOptionAvailable(n)}};var o=class o{};o.namespace="pdfExtension.",o.PDF_LOADED=o.namespace+"pdfLoaded",o.PAGE_INDEX_CHANGE=o.namespace+"pageIndexChange",o.SEARCH=o.namespace+"search",o.ZOOM_IN=o.namespace+"zoomIn",o.ZOOM_OUT=o.namespace+"zoomOut";var i=o;var d=Q(),b=class extends R{constructor(A){super(A);this._lastMediaUri=null;this._maxScale=5;this._minScale=.7;this._nextButtonEnabled=!1;this._pageIndex=1;this._pageIndexPending=null;this._pageRendering=!1;this._pdfDoc=null;this._pdfjsLib=null;this._prevButtonEnabled=!1;this._scale=.7}create(){this.setConfig("pdfCenterPanel"),super.create(),this._$pdfContainer=d('<div class="pdfContainer"></div>'),this._$canvas=d("<canvas></canvas>"),this._$progress=d('<progress max="100" value="0"></progress>'),this._canvas=this._$canvas[0],this._ctx=this._canvas.getContext("2d"),this._$prevButton=d(`<button class="btn btn-default paging prev" title="${this.content.previous}">
<i class="uv-icon-prev" aria-hidden="true"></i>
<span class="sr-only">${this.content.previous}</span>
</button>`),this._$nextButton=d(`<button class="btn btn-default paging next" title="${this.content.next}">
<i class="uv-icon-next" aria-hidden="true"></i>
<span class="sr-only">${this.content.next}</span>
</button>`),this._$zoomInButton=d('<button class="btn zoomIn" tabindex="0"></button>'),this._$zoomOutButton=d('<button class="btn zoomOut" tabindex="0"></button>'),s.getBool(this.options.usePdfJs,!1)&&(this.$content.append(this._$progress),this.$content.append(this._$prevButton),this.$content.append(this._$nextButton),this.$content.append(this._$zoomInButton),this.$content.append(this._$zoomOutButton)),this._$pdfContainer.append(this._$canvas),this.$content.prepend(this._$pdfContainer),this.extensionHost.subscribe(t.OPEN_EXTERNAL_RESOURCE,A=>{this.openMedia(A)}),this.extensionHost.subscribe(t.FIRST,()=>{this._pdfDoc&&(this._pageIndex=1,this._queueRenderPage(this._pageIndex))}),this.extensionHost.subscribe(t.PREV,()=>{this._pdfDoc&&(this._pageIndex<=1||(this._pageIndex--,this._queueRenderPage(this._pageIndex)))}),this.extensionHost.subscribe(t.NEXT,()=>{this._pdfDoc&&(this._pageIndex>=this._pdfDoc.numPages||(this._pageIndex++,this._queueRenderPage(this._pageIndex)))}),this.extensionHost.subscribe(t.LAST,()=>{this._pdfDoc&&(this._pageIndex=this._pdfDoc.numPages,this._queueRenderPage(this._pageIndex))}),this.extensionHost.subscribe(t.CANVAS_INDEX_CHANGE,()=>{this._pdfDoc&&(this._pageIndex=1,this._queueRenderPage(this._pageIndex))}),this.extensionHost.subscribe(i.SEARCH,A=>{this._pdfDoc&&(A<1||A>this._pdfDoc.numPages||(this._pageIndex=A,this._queueRenderPage(this._pageIndex)))}),this.extensionHost.subscribe(i.ZOOM_IN,()=>{let A=this._scale+.5;A<this._maxScale?this._scale=A:this._scale=this._maxScale,this._render(this._pageIndex)}),this.extensionHost.subscribe(i.ZOOM_OUT,()=>{let A=this._scale-.5;A>this._minScale?this._scale=A:this._scale=this._minScale,this._render(this._pageIndex)}),this._$prevButton.onPressed(A=>{A.preventDefault(),this._prevButtonEnabled&&this.extensionHost.publish(t.PREV)}),this.disablePrevButton(),this._$nextButton.onPressed(A=>{A.preventDefault(),this._nextButtonEnabled&&this.extensionHost.publish(t.NEXT)}),this.disableNextButton(),this.onAccessibleClick(this._$zoomInButton,()=>{let A=this._scale+.5;A<this._maxScale?this._scale=A:this._scale=this._maxScale,this._render(this._pageIndex)}),this.onAccessibleClick(this._$zoomOutButton,()=>{let A=this._scale-.5;A>this._minScale?this._scale=A:this._scale=this._minScale,this._render(this._pageIndex)})}disablePrevButton(){this._prevButtonEnabled=!1,this._$prevButton.addClass("disabled")}enablePrevButton(){this._prevButtonEnabled=!0,this._$prevButton.removeClass("disabled")}hidePrevButton(){this.disablePrevButton(),this._$prevButton.hide()}showPrevButton(){this.enablePrevButton(),this._$prevButton.show()}disableNextButton(){this._nextButtonEnabled=!1,this._$nextButton.addClass("disabled")}enableNextButton(){this._nextButtonEnabled=!0,this._$nextButton.removeClass("disabled")}hideNextButton(){this.disableNextButton(),this._$nextButton.hide()}showNextButton(){this.enableNextButton(),this._$nextButton.show()}async openMedia(A){await this.extension.getExternalResources(A);let e=null,l=this.extension.helper.getCurrentCanvas(),r=this.extension.getMediaFormats(l),B=l.id;if(r&&r.length?e=r[0].id:e=l.id,e!==this._lastMediaUri){if(this._lastMediaUri=e,!s.getBool(this.options.usePdfJs,!1))window.PDFObject=await import("./pdfobject-P4NUWKLC.js"),window.PDFObject.embed(B,".pdfContainer",{id:"PDF"});else{this._pdfjsLib?(this._$progress[0].setAttribute("value","0"),this._$progress.show(),this._$canvas.hide()):(await U(["//cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"]),this._pdfjsLib=window["pdfjs-dist/build/pdf"],this._pdfjsLib.GlobalWorkerOptions.workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js");let M={url:e,withCredentials:l.externalResource.isAccessControlled()},E=this._pdfjsLib.getDocument(M);E.onProgress=p=>{let x=p.loaded/p.total*100;this._$progress[0].setAttribute("value",String(x)),x===100&&(this._$progress.hide(),this._$canvas.show())},E.promise.then(p=>{this._pdfDoc=p,this._render(this._pageIndex),this.extensionHost.publish(i.PDF_LOADED,p)})}this.extensionHost.publish(c.EXTERNAL_RESOURCE_OPENED),this.extensionHost.publish(c.LOAD)}}_render(A){if(!s.getBool(this.options.usePdfJs,!1))return;this._pageRendering=!0,this._$zoomOutButton.enable(),this._$zoomInButton.enable();let e=this._scale-.5,l=this._scale+.5;e<this._minScale&&this._$zoomOutButton.disable(),l>this._maxScale&&this._$zoomInButton.disable(),this.extension.isMetric("sm")?(this._$zoomOutButton.hide(),this._$zoomInButton.hide()):(this._$zoomOutButton.show(),this._$zoomInButton.show()),this._pdfDoc.getPage(A).then(r=>{this._renderTask&&this._renderTask.cancel(),this._viewport=r.getViewport({scale:this._scale}),this._canvas.height=this._viewport.height,this._canvas.width=this._viewport.width;let B={canvasContext:this._ctx,viewport:this._viewport};this._renderTask=r.render(B),this._renderTask.promise.then(()=>{this.extensionHost.publish(i.PAGE_INDEX_CHANGE,this._pageIndex),this._pageRendering=!1,this._pageIndexPending!==null&&(this._render(this._pageIndexPending),this._pageIndexPending=null),this._pageIndex===1?this.disablePrevButton():this.enablePrevButton(),this._pageIndex===this._pdfDoc.numPages?this.disableNextButton():this.enableNextButton()}).catch(M=>{})})}_queueRenderPage(A){this._pageRendering?this._pageIndexPending=A:this._render(A)}resize(){super.resize(),this._$pdfContainer.width(this.$content.width()),this._$pdfContainer.height(this.$content.height()),this._$progress.css("top",this.$content.height()/2-this._$progress.height()/2),this._$progress.css("left",this.$content.width()/2-this._$progress.width()/2),this._$prevButton.css({top:(this.$content.height()-this._$prevButton.height())/2,left:this._$prevButton.horizontalMargins()}),this._$nextButton.css({top:(this.$content.height()-this._$nextButton.height())/2,left:this.$content.width()-(this._$nextButton.width()+this._$nextButton.horizontalMargins())}),this._viewport&&this._render(this._pageIndex)}};var a=Q(),v=class extends F{constructor(A){super(A);this.firstButtonEnabled=!1;this.lastButtonEnabled=!1;this.nextButtonEnabled=!1;this.prevButtonEnabled=!1;this._pageIndex=0;this._pdfDoc=null}create(){this.setConfig("pdfHeaderPanel"),super.create(),this.extensionHost.subscribe(i.PAGE_INDEX_CHANGE,A=>{this._pageIndex=A,this.render()}),this.extensionHost.subscribe(i.PDF_LOADED,A=>{this._pdfDoc=A}),this.$prevOptions=a('<div class="prevOptions"></div>'),this.$centerOptions.append(this.$prevOptions),this.$firstButton=a(`
<button class="btn imageBtn first" tabindex="0" title="${this.content.first}">
<i class="uv-icon-first" aria-hidden="true"></i>
<span class="sr-only">${this.content.first}</span>
</button>
`),this.$prevOptions.append(this.$firstButton),this.$firstButton.disable(),this.$prevButton=a(`
<button class="btn imageBtn prev" tabindex="0" title="${this.content.previous}">
<i class="uv-icon-prev" aria-hidden="true"></i>
<span class="sr-only">${this.content.previous}</span>
</button>
`),this.$prevOptions.append(this.$prevButton),this.$prevButton.disable(),this.$search=a('<div class="search"></div>'),this.$centerOptions.append(this.$search),this.$searchText=a('<input class="searchText" maxlength="50" type="text" tabindex="0" aria-label="'+this.content.pageSearchLabel+'"/>'),this.$search.append(this.$searchText),this.$total=a('<span class="total"></span>'),this.$search.append(this.$total),this.$searchButton=a('<button class="go btn btn-primary" tabindex="0">'+this.content.go+"</button>"),this.$search.append(this.$searchButton),this.$searchButton.disable(),this.$nextOptions=a('<div class="nextOptions"></div>'),this.$centerOptions.append(this.$nextOptions),this.$nextButton=a(`
<button class="btn imageBtn next" tabindex="0" title="${this.content.next}">
<i class="uv-icon-next" aria-hidden="true"></i>
<span class="sr-only">${this.content.next}</span>
</button>
`),this.$nextOptions.append(this.$nextButton),this.$nextButton.disable(),this.$lastButton=a(`
<button class="btn imageBtn last" tabindex="0" title="${this.content.last}">
<i class="uv-icon-last" aria-hidden="true"></i>
<span class="sr-only">${this.content.last}</span>
</button>
`),this.$nextOptions.append(this.$lastButton),this.$lastButton.disable(),this.$firstButton.onPressed(()=>{this.extensionHost.publish(t.FIRST)}),this.$prevButton.onPressed(()=>{this.extensionHost.publish(t.PREV)}),this.$nextButton.onPressed(()=>{this.extensionHost.publish(t.NEXT)}),this.$lastButton.onPressed(()=>{this.extensionHost.publish(t.LAST)}),this.$searchText.onEnter(()=>{this.$searchText.blur(),this.search(this.$searchText.val())}),this.$searchText.click(function(){a(this).select()}),this.onAccessibleClick(this.$searchButton,()=>{this.search(this.$searchText.val())})}render(){this._pdfDoc.numPages===1?this.$centerOptions.hide():this.$centerOptions.show(),this.$searchText.val(this._pageIndex);let A=this.content.of;this.$total.html(y.format(A,this._pdfDoc.numPages.toString())),this.$searchButton.enable(),this._pageIndex===1?(this.$firstButton.disable(),this.$firstButton.attr("disabled","disabled"),this.$prevButton.disable(),this.$prevButton.attr("disabled","disabled")):(this.$firstButton.enable(),this.$firstButton.removeAttr("disabled"),this.$prevButton.enable(),this.$prevButton.removeAttr("disabled")),this._pageIndex===this._pdfDoc.numPages?(this.$lastButton.disable(),this.$lastButton.attr("disabled","disabled"),this.$nextButton.disable(),this.$nextButton.attr("disabled","disabled")):(this.$lastButton.enable(),this.$lastButton.removeAttr("disabled"),this.$nextButton.enable(),this.$nextButton.removeAttr("disabled"))}search(A){if(!A){this.extension.showMessage(this.content.emptyValue);return}let e=parseInt(this.$searchText.val(),10);if(isNaN(e)){this.extension.showMessage(this.extension.data.config.modules.genericDialogue.content.invalidNumber);return}this.extensionHost.publish(i.SEARCH,e)}resize(){super.resize()}};var z=Q(),m=class extends g{constructor(n){super(n)}create(){this.setConfig("mobileFooterPanel"),super.create(),this.$zoomOutButton=z(`
<button class="btn imageBtn zoomOut" title="${this.content.zoomOut}">
<i class="uv-icon-zoom-out" aria-hidden="true"></i>${this.content.zoomOut}
</button>
`),this.$zoomInButton=z(`
<button class="btn imageBtn zoomIn" title="${this.content.zoomIn}">
<i class="uv-icon-zoom-in" aria-hidden="true"></i>${this.content.zoomIn}
</button>
`),this.extension.isPdfJsEnabled()&&(this.$mainOptions.prepend(this.$zoomOutButton),this.$mainOptions.prepend(this.$zoomInButton)),this.$zoomInButton.onPressed(()=>{this.extensionHost.publish(i.ZOOM_IN)}),this.$zoomOutButton.onPressed(()=>{this.extensionHost.publish(i.ZOOM_OUT)})}resize(){super.resize(),this.$options.css("left",Math.floor(this.$element.width()/2-this.$options.width()/2))}};var w=class extends N{constructor(n){super(n)}create(){this.setConfig("settingsDialogue"),super.create()}};var I=class extends Z{constructor(n){super(n)}create(){this.setConfig("shareDialogue"),super.create()}update(){super.update(),this.embedCode=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$embedCode.val(this.embedCode)}resize(){super.resize()}};var H=C(Y());var S=C(J());var j={options:{allowStealFocus:!1,authAPIVersion:1,bookmarkThumbHeight:150,bookmarkThumbWidth:90,dropEnabled:!0,footerPanelEnabled:!0,headerPanelEnabled:!0,leftPanelEnabled:!0,limitLocales:!1,metrics:[{type:"sm",minWidth:0},{type:"md",minWidth:768},{type:"lg",minWidth:1024},{type:"xl",minWidth:1280}],multiSelectionMimeType:"application/zip",navigatorEnabled:!0,openTemplate:"http://universalviewer.io?manifest={0}",overrideFullScreen:!1,pagingEnabled:!0,pagingOptionEnabled:!0,pessimisticAccessControl:!1,preserveViewport:!1,rightPanelEnabled:!0,saveUserSettings:!1,clickToZoomEnabled:!0,searchWithinEnabled:!0,termsOfUseEnabled:!1,theme:"uv-en-GB-theme",tokenStorage:"session",useArrowKeysToNavigate:!1,zoomToSearchResultEnabled:!0},modules:{leftPanel:{options:{expandFullEnabled:!1,panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!1},content:{collapse:"$collapse",collapseFull:"$collapseFull",expand:"$expandContents",expandFull:"$expandGallery"}},footerPanel:{options:{bookmarkEnabled:!1,downloadEnabled:!0,embedEnabled:!1,feedbackEnabled:!1,fullscreenEnabled:!0,minimiseButtons:!0,moreInfoEnabled:!0,openEnabled:!1,printEnabled:!1,shareEnabled:!0},content:{bookmark:"$add_to_bookmarks",download:"$download",embed:"$embed",exitFullScreen:"$exitFullScreen",feedback:"$feedback",fullScreen:"$fullScreen",moreInfo:"$moreInfo",open:"$open",share:"$share",openLeftPanel:"$openLeftPanel",closeLeftPanel:"$closeLeftPanel",openRightPanel:"$openRightPanel",closeRightPanel:"$closeRightPanel"}},mobileFooterPanel:{options:{bookmarkEnabled:!1,downloadEnabled:!0,embedEnabled:!1,feedbackEnabled:!1,fullscreenEnabled:!0,minimiseButtons:!0,moreInfoEnabled:!0,openEnabled:!1,printEnabled:!1,shareEnabled:!0},content:{rotateRight:"$rotateRight",moreInfo:"$moreInfo",zoomIn:"$zoomIn",zoomOut:"$zoomOut",bookmark:"$add_to_bookmarks",download:"$download",embed:"$embed",exitFullScreen:"$exitFullScreen",feedback:"$feedback",fullScreen:"$fullScreen",open:"$open",share:"$share",openLeftPanel:"$openLeftPanel",closeLeftPanel:"$closeLeftPanel",openRightPanel:"$openRightPanel",closeRightPanel:"$closeRightPanel"}},genericDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",emptyValue:"$emptyValue",invalidNumber:"$invalidNumber",noMatches:"$noMatches",ok:"$ok",pageNotFound:"$pageNotFound",refresh:"$refresh"}},headerPanel:{options:{centerOptionsEnabled:!0,localeToggleEnabled:!1,settingsButtonEnabled:!0},content:{close:"$close",settings:"$settings",help:"$help"}},helpDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",text:"$placeholder_text text",title:"$help"}},adjustImageDialogue:{options:{topCloseButtonEnabled:!1},content:{title:"$adjustImage",brightness:"$brightness",contrast:"$contrast",saturation:"$saturation",close:"$close",reset:"$reset",remember:"$remember"}},moreInfoRightPanel:{options:{canvasDisplayOrder:"",canvasExclude:"",copyToClipboardEnabled:!1,expandFullEnabled:!1,limitToRange:!1,manifestDisplayOrder:"",manifestExclude:"",panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!1,rtlLanguageCodes:"ar, ara, dv, div, he, heb, ur, urd",showAllLanguages:!1,textLimit:4,textLimitType:"lines",topCloseButtonEnabled:!1},content:{attribution:"$attribution",canvasHeader:"$aboutTheImage",close:"$close",collapse:"$collapseInformation",collapseFull:"$collapseGallery",copiedToClipboard:"$copiedToClipboard",copyToClipboard:"$copyToClipboard",description:"$description",expand:"$expandInformation",expandFull:"$expandGallery",holdingText:"$moduleGoesHere",less:"$less",lessAriaLabelTemplate:"$lessAriaLabelTemplate",license:"$license",logo:"$logo",manifestHeader:"$aboutTheItem",more:"$more",moreAriaLabelTemplate:"$moreAriaLabelTemplate",noData:"$noDataToDisplay",page:"$page",rangeHeader:"$aboutThisSection",title:"$moreInformation"}},centerPanel:{options:{titleEnabled:!0,subtitleEnabled:!0,mostSpecificRequiredStatement:!0,requiredStatementEnabled:!0},content:{attribution:"$attribution",close:"$close",closeAttribution:"$closeAttribution"}},pdfCenterPanel:{options:{titleEnabled:!1,subtitleEnabled:!0,mostSpecificRequiredStatement:!0,requiredStatementEnabled:!0,usePdfJs:!0},content:{attribution:"$attribution",close:"$close",closeAttribution:"$closeAttribution",next:"$next",previous:"$previous"}},resourcesLeftPanel:{options:{elideCount:40,galleryThumbHeight:320,galleryThumbWidth:200,oneColThumbHeight:320,oneColThumbWidth:200,pageModeEnabled:!0,panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!0,thumbsEnabled:!0,thumbsExtraHeight:8,thumbsImageFadeInDuration:300,thumbsLoadRange:15,treeEnabled:!0,twoColThumbHeight:150,twoColThumbWidth:90}},dialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close"}},downloadDialogue:{options:{topCloseButtonEnabled:!1},content:{allPages:"$allPages",close:"$close",currentViewAsJpg:"$currentViewAsJpg",currentViewAsJpgExplanation:"$openNewWindow",download:"$download",downloadSelection:"$downloadSelection",downloadSelectionExplanation:"$downloadSelectionExplanation",editSettings:"$editSettings",entireDocument:"$entireDocument",entireFileAsOriginal:"$entireFile",entireFileAsOriginalWithFormat:"$entireFileWithFormat",individualPages:"$individualPages",noneAvailable:"$noDownloadOptionsAvailable",pagingNote:"$pagingNote",preview:"$preview",selection:"$selection",termsOfUse:"$termsOfUse",title:"$download",wholeImageHighRes:"$wholeImageHighRes",wholeImageHighResExplanation:"$openNewWindow",wholeImageLowResAsJpg:"$wholeImageLowResAsJpg",wholeImageLowResAsJpgExplanation:"$openNewWindow",wholeImagesHighRes:"$wholeImagesHighRes",wholeImagesHighResExplanation:"$wholeImagesHighResExplanation"}},pdfHeaderPanel:{options:{centerOptionsEnabled:!0,localeToggleEnabled:!1,settingsButtonEnabled:!0,helpEnabled:!1,helpUrl:"https://universalviewer.io"},content:{emptyValue:"$pleaseEnterValue",first:"$first",go:"$go",last:"$last",next:"$next",of:"$of",previous:"$previous",pageSearchLabel:"$searchByPageNumber",close:"$close",settings:"$settings",help:"$help"}},shareDialogue:{options:{embedEnabled:!0,shareEnabled:!0,embedPath:"/uv.html",embedTemplate:'<iframe src="{0}" width="{1}" height="{2}" allowfullscreen frameborder="0" title="{3}"></iframe>',instructionsEnabled:!1,shareFrameEnabled:!0,shareManifestsEnabled:!0,topCloseButtonEnabled:!1,copyToClipboardEnabled:!0},content:{close:"$close",copyBtn:"$copyBtn",copyToClipboard:"$copyToClipboard",customSize:"$custom",embed:"$embed",embedInstructions:"$embedInstructions",height:"$height",iiif:"$iiifManifest",share:"$share",shareInstructions:"$shareInstructions",shareLink:"$shareLink",size:"$size",width:"$width",shareUrl:"$shareUrl"}},authDialogue:{options:{topCloseButtonEnabled:!1},content:{cancel:"$cancel",confirm:"$confirm",close:"$close"}},clickThroughDialogue:{options:{topCloseButtonEnabled:!1},content:{viewTerms:"$viewTerms",close:"$close"}},loginDialogue:{options:{topCloseButtonEnabled:!1},content:{login:"$login",logout:"$logout",cancel:"$cancel",close:"$close"}},restrictedDialogue:{options:{topCloseButtonEnabled:!1},content:{cancel:"$cancel",close:"$close"}},settingsDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",locale:"$locale",navigatorEnabled:"$navigatorEnabled",clickToZoomEnabled:"$clickToZoomEnabled",pagingEnabled:"$twoPageView",reducedMotion:"$reducedMotion",truncateThumbnailLabels:"$truncateThumbnailLabels",preserveViewport:"$preserveViewport",title:"$settings",website:"$uvWebsite"}},contentLeftPanel:{}},localisation:{label:"English (GB)",locales:[{name:"cy-GB",label:"Cymraeg"},{name:"en-GB",label:"English (GB)"},{name:"fr-FR",label:"Fran\xE7ais (FR)"},{name:"pl-PL",label:"Polski"},{name:"sv-SE",label:"Svenska"}]},content:{authCORSError:"$authCORSError",authorisationFailedMessage:"$authorisationFailedMessage",canvasIndexOutOfRange:"$canvasIndexOutOfRange",fallbackDegradedLabel:"$fallbackDegradedLabel",fallbackDegradedMessage:"$fallbackDegradedMessage",forbiddenResourceMessage:"$forbiddenResourceMessage",termsOfUse:"$termsOfUse",mediaViewer:"$mediaViewer",skipToDownload:"$skipToDownload"}};var f=class extends D{constructor(){super(...arguments);this.defaultConfig=j}create(){super.create(),this.extensionHost.subscribe(t.CANVAS_INDEX_CHANGE,A=>{this.viewCanvas(A)}),this.extensionHost.subscribe(t.THUMB_SELECTED,A=>{this.extensionHost.publish(t.CANVAS_INDEX_CHANGE,A.index)}),this.extensionHost.subscribe(t.LEFTPANEL_EXPAND_FULL_START,()=>{this.shell.$centerPanel.hide(),this.shell.$rightPanel.hide()}),this.extensionHost.subscribe(t.LEFTPANEL_COLLAPSE_FULL_FINISH,()=>{this.shell.$centerPanel.show(),this.shell.$rightPanel.show(),this.resize()}),this.extensionHost.subscribe(c.EXIT_FULLSCREEN,()=>{setTimeout(()=>{this.resize()},10)})}render(){super.render()}isHeaderPanelEnabled(){return super.isHeaderPanelEnabled()&&s.getBool(this.data.config.modules.pdfCenterPanel.options.usePdfJs,!0)}createModules(){super.createModules(),this.isHeaderPanelEnabled()?this.headerPanel=new v(this.shell.$headerPanel):this.shell.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new L(this.shell.$leftPanel)),this.centerPanel=new b(this.shell.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new G(this.shell.$rightPanel)),this.isFooterPanelEnabled()?(this.footerPanel=new g(this.shell.$footerPanel),this.mobileFooterPanel=new m(this.shell.$mobileFooterPanel)):this.shell.$footerPanel.hide(),this.$downloadDialogue=$('<div class="overlay download" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new h(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$shareDialogue),this.shareDialogue=new I(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new w(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()}bookmark(){super.bookmark();let A=this.helper.getCurrentCanvas(),e=new P;e.index=this.helper.canvasIndex,e.label=S.LanguageMap.getValue(A.getLabel()),e.thumb=A.getProperty("thumbnail"),e.title=this.helper.getLabel(),e.trackingLabel=window.trackingLabel,e.type=H.ExternalResourceType.DOCUMENT,this.fire(t.BOOKMARK,e)}dependencyLoaded(A,e){A===0&&(window.PDFObject=e)}getEmbedScript(A,e,l){let r=new URLSearchParams({manifest:this.helper.manifestUri,c:this.helper.collectionIndex.toString(),m:this.helper.manifestIndex.toString(),cv:this.helper.canvasIndex.toString()});return super.buildEmbedScript(A,e,l,r)}isPdfJsEnabled(){return s.getBool(this.data.config.modules.pdfCenterPanel.options.usePdfJs,!0)}};export{f as default};