UNPKG

universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

3 lines 179 kB
import{a as le,c as kt,e as Ft,f as Dt,g as Ut}from"./chunk-FEXGFX4C.js";import{a as y}from"./chunk-M4MN2QTO.js";import{a as H,b as Mt,c as P,d as wt,f as Y,i as Nt,l as Ot,m as Bt,n as U,o as dt,p as St,q as G}from"./chunk-YB7AEQFU.js";import{b as V,e as j,f as Ht,g as w}from"./chunk-5XPHF4E5.js";import{c as ae,d as et}from"./chunk-L67DAW3A.js";var te=ae((ht,Lt)=>{(function(a,o){typeof ht=="object"&&typeof Lt=="object"?Lt.exports=o():typeof define=="function"&&define.amd?define("IIIFMetadataComponent",[],o):typeof ht=="object"?ht.IIIFMetadataComponent=o():a.IIIFMetadataComponent=o()})(typeof self<"u"?self:ht,function(){return function(a){var o={};function l(u){if(o[u])return o[u].exports;var i=o[u]={i:u,l:!1,exports:{}};return a[u].call(i.exports,i,i.exports,l),i.l=!0,i.exports}return l.m=a,l.c=o,l.d=function(u,i,c){l.o(u,i)||Object.defineProperty(u,i,{enumerable:!0,get:c})},l.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},l.t=function(u,i){if(1&i&&(u=l(u)),8&i||4&i&&typeof u=="object"&&u&&u.__esModule)return u;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:u}),2&i&&typeof u!="string")for(var s in u)l.d(c,s,function(m){return u[m]}.bind(null,s));return c},l.n=function(u){var i=u&&u.__esModule?function(){return u.default}:function(){return u};return l.d(i,"a",i),i},l.o=function(u,i){return Object.prototype.hasOwnProperty.call(u,i)},l.p="",l(l.s=1)}([function(a,o,l){"use strict";l.r(o),l.d(o,"Async",function(){return i}),l.d(o,"Bools",function(){return c}),l.d(o,"Clipboard",function(){return s}),l.d(o,"Colors",function(){return m}),l.d(o,"Dates",function(){return b}),l.d(o,"Device",function(){return h}),l.d(o,"Documents",function(){return f}),l.d(o,"Events",function(){return d}),l.d(o,"Files",function(){return e}),l.d(o,"Keyboard",function(){return t}),l.d(o,"Maths",function(){return n}),l.d(o,"Size",function(){return r}),l.d(o,"Dimensions",function(){return p}),l.d(o,"Numbers",function(){return v}),l.d(o,"Objects",function(){return I}),l.d(o,"Storage",function(){return x}),l.d(o,"StorageItem",function(){return S}),l.d(o,"StorageType",function(){return u}),l.d(o,"Strings",function(){return O}),l.d(o,"Urls",function(){return C});var u,i=function(){function _(){}return _.waitFor=function(g,E,T,A,L,R){A||(A=200),L||(L=100),R||(R=0),(R+=1)>L?T&&T():g()?E():setTimeout(function(){_.waitFor(g,E,T,A,L,R)},A)},_}(),c=function(){function _(){}return _.getBool=function(g,E){return g??E},_}(),s=function(){function _(){}return _.supportsCopy=function(){return document.queryCommandSupported&&document.queryCommandSupported("copy")},_.copy=function(g){g=_.convertBrToNewLine(g);var E=document.createElement("textarea");E.value=g,_.hideButKeepEnabled(E),document.body.appendChild(E),E.focus(),E.select(),document.execCommand("copy"),document.body.removeChild(E)},_.hideButKeepEnabled=function(g){g.style.position="fixed",g.style.top="0",g.style.left="0",g.style.width="2em",g.style.height="2em",g.style.padding="0",g.style.border="none",g.style.outline="none",g.style.boxShadow="none",g.style.background="transparent"},_.convertBrToNewLine=function(g){return g=g.replace(/<br\s*[\/]?>/gi,` `)},_}(),m=function(){function _(){}return _.float32ColorToARGB=function(g){return[(4278190080&g)>>>24,(16711680&g)>>>16,(65280&g)>>>8,255&g]},_._componentToHex=function(g){var E=g.toString(16);return E.length==1?"0"+E:E},_.rgbToHexString=function(g){return _.coalesce(g),"#"+_._componentToHex(g[0])+_._componentToHex(g[1])+_._componentToHex(g[2])},_.argbToHexString=function(g){return"#"+_._componentToHex(g[0])+_._componentToHex(g[1])+_._componentToHex(g[2])+_._componentToHex(g[3])},_.coalesce=function(g){for(var E=1;E<g.length;E++)g[E]===void 0&&(g[E]=g[E-1])},_}(),b=function(){function _(){}return _.getTimeStamp=function(){return new Date().getTime()},_}(),h=function(){function _(){}return _.getPixelRatio=function(g){return(window.devicePixelRatio||1)/(g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1)},_.isTouch=function(){return"ontouchstart"in window||window.navigator.msMaxTouchPoints>0},_}(),f=function(){function _(){}return _.isInIFrame=function(){try{return window.self!==window.top}catch{return!0}},_.supportsFullscreen=function(){var g=document.documentElement;return(g.requestFullscreen||g.mozRequestFullScreen||g.webkitRequestFullScreen||g.msRequestFullscreen)!==void 0},_.isHidden=function(){return!!_.getHiddenProp()},_.getHiddenProp=function(){var g=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var E=0;E<g.length;E++)if(g[E]+"Hidden"in document)return g[E]+"Hidden";return null},_}(),d=function(){function _(){}return _.debounce=function(g,E){return E=E||100,function(){if(!g.debouncing){var T=Array.prototype.slice.apply(arguments);g.lastReturnVal=g.apply(window,T),g.debouncing=!0}return clearTimeout(g.debounceTimeout),g.debounceTimeout=setTimeout(function(){g.debouncing=!1},E),g.lastReturnVal}},_}(),e=function(){function _(){}return _.simplifyMimeType=function(g){switch(g){case"text/plain":return"txt";case"image/jpeg":return"jpg";case"application/msword":return"doc";case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return"docx";default:var E=g.split("/");return E[E.length-1]}},_}(),t=function(){function _(){}return _.getCharCode=function(g){return typeof g.which=="number"?g.which:g.keyCode},_}(),n=function(){function _(){}return _.normalise=function(g,E,T){return(g-E)/(T-E)},_.median=function(g){g.sort(function(T,A){return T-A});var E=Math.floor(g.length/2);return g.length%2?g[E]:(g[E-1]+g[E])/2},_.clamp=function(g,E,T){return Math.min(Math.max(g,E),T)},_}(),r=function(_,g){this.width=_,this.height=g},p=function(){function _(){}return _.fitRect=function(g,E,T,A){var L,R=0,q=0;return E/g<A/T?(R=g*(L=T/g),q=E*L):(R=g*(L=A/E),q=E*L),new r(Math.floor(R),Math.floor(q))},_.hitRect=function(g,E,T,A,L,R){return L>g&&L<g+T&&R>E&&R<E+A},_}(),v=function(){function _(){}return _.numericalInput=function(g){return g.keyCode==46||g.keyCode==8||g.keyCode==9||g.keyCode==27||g.keyCode==65&&g.ctrlKey===!0||g.keyCode>=35&&g.keyCode<=39||!(g.shiftKey||(g.keyCode<48||g.keyCode>57)&&(g.keyCode<96||g.keyCode>105))||(g.preventDefault(),!1)},_}(),I=function(){function _(){}return _.toPlainObject=function(g){g=Object(g);var E={};for(var T in g)E[T]=g[T];return E},_}(),x=function(){function _(){}return _.clear=function(g){switch(g===void 0&&(g=u.MEMORY),g){case u.MEMORY:this._memoryStorage={};break;case u.SESSION:sessionStorage.clear();break;case u.LOCAL:localStorage.clear()}},_.clearExpired=function(g){g===void 0&&(g=u.MEMORY);for(var E=this.getItems(g),T=0;T<E.length;T++){var A=E[T];this._isExpired(A)&&this.remove(A.key)}},_.get=function(g,E){E===void 0&&(E=u.MEMORY);var T=null;switch(E){case u.MEMORY:T=this._memoryStorage[g];break;case u.SESSION:T=sessionStorage.getItem(g);break;case u.LOCAL:T=localStorage.getItem(g)}if(!T)return null;var A=null;try{A=JSON.parse(T)}catch{return null}return A?this._isExpired(A)?null:(A.key=g,A):null},_._isExpired=function(g){return!(new Date().getTime()<g.expiresAt)},_.getItems=function(g){g===void 0&&(g=u.MEMORY);var E=[];switch(g){case u.MEMORY:for(var T=Object.keys(this._memoryStorage),A=0;A<T.length;A++)(R=this.get(T[A],u.MEMORY))&&E.push(R);break;case u.SESSION:for(A=0;A<sessionStorage.length;A++)(L=sessionStorage.key(A))&&(R=this.get(L,u.SESSION))&&E.push(R);break;case u.LOCAL:for(A=0;A<localStorage.length;A++){var L,R;(L=localStorage.key(A))&&(R=this.get(L,u.LOCAL))&&E.push(R)}}return E},_.remove=function(g,E){switch(E===void 0&&(E=u.MEMORY),E){case u.MEMORY:delete this._memoryStorage[g];break;case u.SESSION:sessionStorage.removeItem(g);break;case u.LOCAL:localStorage.removeItem(g)}},_.set=function(g,E,T,A){A===void 0&&(A=u.MEMORY);var L=1e3*T,R=new S;switch(R.value=E,R.expiresAt=new Date().getTime()+L,A){case u.MEMORY:this._memoryStorage[g]=JSON.stringify(R);break;case u.SESSION:sessionStorage.setItem(g,JSON.stringify(R));break;case u.LOCAL:localStorage.setItem(g,JSON.stringify(R))}return R},_._memoryStorage={},_}(),S=function(){};(function(_){_.MEMORY="memory",_.SESSION="session",_.LOCAL="local"})(u||(u={}));var O=function(){function _(){}return _.ellipsis=function(g,E){if(g.length<=E)return g;var T=g.substr(0,E),A=T.lastIndexOf(" ");return A!=-1&&(T=T.substr(0,Math.min(T.length,A))),T+"&hellip;"},_.htmlDecode=function(g){var E=document.createElement("div");return E.innerHTML=g,E.firstChild.nodeValue},_.format=function(g){for(var E=[],T=1;T<arguments.length;T++)E[T-1]=arguments[T];for(var A=0;A<E.length;A++){var L=new RegExp("\\{"+A+"\\}","gm");g=g.replace(L,E[A])}return g},_.isAlphanumeric=function(g){return/^[a-zA-Z0-9]*$/.test(g)},_.toCssClass=function(g){return g.replace(/[^a-z0-9]/g,function(E){var T=E.charCodeAt(0);return T==32?"-":T>=65&&T<=90?"_"+E.toLowerCase():"__"+("000"+T.toString(16)).slice(-4)})},_.toFileName=function(g){return g.replace(/[^a-z0-9]/gi,"_").toLowerCase()},_.utf8_to_b64=function(g){return window.btoa(unescape(encodeURIComponent(g)))},_}(),C=function(){function _(){}return _.getHashParameter=function(g,E){return E||(E=window.document),E&&E.location?this.getHashParameterFromString(g,E.location.hash):null},_.getHashParameterFromString=function(g,E){var T=new RegExp("#.*[?&]"+g+"=([^&]+)(&|$)").exec(E);return T?decodeURIComponent(T[1].replace(/\+/g," ")):null},_.setHashParameter=function(g,E,T){if(T||(T=window.document),T&&T.location){var A="#?"+this.updateURIKeyValuePair(T.location.hash.replace("#?",""),g,E),L=T.URL;L.indexOf("#")!=-1&&(L=L.substr(0,L.indexOf("#"))),T.location.replace(L+A)}},_.getQuerystringParameter=function(g,E){return E||(E=window),this.getQuerystringParameterFromString(g,E.location.search)},_.getQuerystringParameterFromString=function(g,E){g=g.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var T=new RegExp("[\\?&]"+g+"=([^&#]*)").exec(E);return T?decodeURIComponent(T[1].replace(/\+/g," ")):null},_.setQuerystringParameter=function(g,E,T){if(T||(T=window.document),T&&T.location){var A=this.updateURIKeyValuePair(T.location.hash.replace("#?",""),g,E);window.location.search=A}},_.updateURIKeyValuePair=function(g,E,T){E=encodeURIComponent(E),T=encodeURIComponent(T);var A=g.split("&");A[0]==""&&A.shift();for(var L,R=A.length;R--;)if((L=A[R].split("="))[0]==E){L[1]=T,A[R]=L.join("=");break}return R<0&&(A[A.length]=[E,T].join("=")),A.join("&")},_.getUrlParts=function(g){var E=document.createElement("a");return E.href=g,E},_.convertToRelativeUrl=function(g){var E=this.getUrlParts(g),T=E.pathname+E.searchWithin;return T.startsWith("/")||(T="/"+T),T},_}()},function(a,o,l){a.exports=l(2)},function(a,o,l){"use strict";var u,i=this&&this.__extends||(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var p in r)Object.prototype.hasOwnProperty.call(r,p)&&(n[p]=r[p])})(e,t)},function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(o,"__esModule",{value:!0}),o.Events=o.MetadataComponent=o.LimitType=void 0;var c,s=l(3),m=l(4),b=l(0),h=l(5);(function(e){e.LINES="lines",e.CHARS="chars"})(c||(o.LimitType=c={}));var f=function(e){function t(n){var r=e.call(this,n)||this;return r._data=r.data(),r._data=r.options.data,r._init(),r._resize(),r}return i(t,e),t.prototype._init=function(){return e.prototype._init.call(this),this._$element=$(this.el),this._$metadataGroupTemplate=$('<div class="group"> <div class="header"></div> <div class="items"></div> </div>'),this._$metadataItemTemplate=$('<div class="item"> <div class="label"></div> <div class="values"></div> </div>'),this._$metadataItemValueTemplate=$('<div class="value"></div>'),this._$metadataItemURIValueTemplate=$('<a class="value" href="" target="_blank"></a>'),this._$copyTextTemplate=$('<div class="copyText" alt="'+this.options.data.content.copyToClipboard+'" title="'+this.options.data.content.copyToClipboard+'"> <div class="copiedText">'+this.options.data.content.copiedToClipboard+" </div> </div>"),this._$metadataGroups=$('<div class="groups"></div>'),this._$element.append(this._$metadataGroups),this._$noData=$('<div class="noData">'+this.options.data.content.noData+"</div>"),this._$element.append(this._$noData),!0},t.prototype.data=function(){return{aggregateValues:"",canvases:null,canvasDisplayOrder:"",metadataGroupOrder:"",canvasExclude:"",canvasLabels:"",content:{attribution:"Attribution",canvasHeader:"About the canvas",copiedToClipboard:"Copied to clipboard",copyToClipboard:"Copy to clipboard",description:"Description",imageHeader:"About the image",less:"less",lessAriaLabelTemplate:"Less information: Hide {0}",license:"License",rights:"Rights",logo:"Logo",manifestHeader:"About the item",more:"more",moreAriaLabelTemplate:"More information: Reveal {0}",noData:"No data to display",rangeHeader:"About the range",sequenceHeader:"About the sequence"},copiedMessageDuration:2e3,copyToClipboardEnabled:!1,helper:null,licenseFormatter:null,limit:4,limitType:c.LINES,limitToRange:!1,manifestDisplayOrder:"",manifestExclude:"",range:null,rtlLanguageCodes:"ar, ara, dv, div, he, heb, ur, urd",sanitizer:function(n){return n},showAllLanguages:!1}},t.prototype._getManifestGroup=function(){return this._metadataGroups.filter(function(n){return n.resource.isManifest()})[0]},t.prototype._getCanvasGroups=function(){return this._metadataGroups.filter(function(n){return n.resource.isCanvas()})},t.prototype.set=function(n){var r=this;if(this._data=Object.assign(this._data,n),this._data&&this._data.helper){var p,v={canvases:this._data.canvases,licenseFormatter:this._data.licenseFormatter,range:this._data.range};if(this._metadataGroups=this._data.helper.getMetadata(v),this._data.manifestDisplayOrder&&((p=this._getManifestGroup()).items=this._sortItems(p.items,this._readCSV(this._data.manifestDisplayOrder))),this._data.canvasDisplayOrder&&this._getCanvasGroups().forEach(function(x,S){x.items=r._sortItems(x.items,r._readCSV(r._data.canvasDisplayOrder))}),this._data.metadataGroupOrder&&(this._metadataGroups=this._sortGroups(this._metadataGroups,this._readCSV(this._data.metadataGroupOrder))),this._data.canvasLabels&&this._label(this._getCanvasGroups(),this._readCSV(this._data.canvasLabels,!1)),this._data.manifestExclude&&((p=this._getManifestGroup()).items=this._exclude(p.items,this._readCSV(this._data.manifestExclude))),this._data.canvasExclude&&this._getCanvasGroups().forEach(function(x,S){x.items=r._exclude(x.items,r._readCSV(r._data.canvasExclude))}),this._data.limitToRange){var I=[];this._metadataGroups.forEach(function(x,S){x.resource.isRange()&&I.push(x)}),I.length&&(this._metadataGroups=I)}this._render()}},t.prototype._sortItems=function(n,r){var p=this,v=[],I=n.slice(0);return r.forEach(function(x,S){var O=I.filter(function(_){return p._normalise(_.getLabel())===x})[0];if(O){v.push(O);var C=I.indexOf(O);C>-1&&I.splice(C,1)}}),I.forEach(function(x,S){v.push(x)}),v},t.prototype._sortGroups=function(n,r){var p=[],v=n.slice(0);return r.forEach(function(I,x){var S=v.filter(function(C){return C.resource.getIIIFResourceType().toLowerCase()==I.toLowerCase()})[0];if(S){p.push(S);var O=v.indexOf(S);O>-1&&v.splice(O,1)}}),p},t.prototype._label=function(n,r){n.forEach(function(p,v){p.label=r[v]})},t.prototype._exclude=function(n,r){var p=this;return r.forEach(function(v,I){var x=n.filter(function(O){return p._normalise(O.getLabel())===v})[0];if(x){var S=n.indexOf(x);S>-1&&n.splice(S,1)}}),n},t.prototype._normalise=function(n){return n?n.toLowerCase().replace(/ /g,""):null},t.prototype._render=function(){var n=this;this._metadataGroups.length?(this._$noData.hide(),this._$metadataGroups.empty(),this._metadataGroups.forEach(function(r,p){var v=n._buildMetadataGroup(r);n._$metadataGroups.append(v);var I=v.find(".value"),x=v.find(".item");n._data.limit&&n._data.content&&(n._data.limitType===c.LINES?(0,h.default)(x,n._data.limit,n._data.content.less,n._data.content.more,function(){},n._data.content.lessAriaLabelTemplate,n._data.content.moreAriaLabelTemplate):n._data.limitType===c.CHARS&&I.ellipsisHtmlFixed(n._data.limit,function(){}))})):this._$noData.show()},t.prototype._buildMetadataGroup=function(n){var r=this._$metadataGroupTemplate.clone(),p=r.find(">.header");if(this._data.content){if(n.resource.isManifest()&&this._data.content.manifestHeader)(I=this._sanitize(this._data.content.manifestHeader))&&p.html(I);else if(n.resource.isSequence()&&this._data.content.sequenceHeader)(I=this._sanitize(this._data.content.sequenceHeader))&&p.html(I);else if(n.resource.isRange()&&this._data.content.rangeHeader)(I=this._sanitize(this._data.content.rangeHeader))&&p.html(I);else if(n.resource.isCanvas()&&(n.label||this._data.content.canvasHeader)){var v=n.label||this._data.content.canvasHeader;p.html(this._sanitize(v))}else if(n.resource.isAnnotation()&&this._data.content.imageHeader){var I;(I=this._sanitize(this._data.content.imageHeader))&&p.html(I)}}p.text()||p.hide();for(var x=r.find(".items"),S=0;S<n.items.length;S++){var O=n.items[S],C=this._buildMetadataItem(O);x.append(C)}return r},t.prototype._buildMetadataItem=function(n){var r,p,v=this._$metadataItemTemplate.clone(),I=v.find(".label"),x=v.find(".values"),S=n.getLabel(),O=S,C=new RegExp("/w+:(/?/?)[^s]+/gm","i");if(this._data.content&&O&&n.isRootLevel)switch(O.toLowerCase()){case"attribution":O=this._data.content.attribution;break;case"description":O=this._data.content.description;break;case"license":O=this._data.content.license;break;case"logo":O=this._data.content.logo;break;case"rights":O=this._data.content.rights}O=this._sanitize(O),I.html(O),this._addReadingDirection(I,this._getLabelLocale(n)),v.addClass(b.Strings.toCssClass(O));var _=this._getValueLocale(n),g=(r=n.value)===null||r===void 0?void 0:r.getValue(_);if(!S||S.toLowerCase()!=="license"&&S.toLowerCase()!=="rights"||C.exec(g)===null)if(this._data.showAllLanguages&&n.value&&n.value.length>1)for(var E=[],T=0;T<n.value.length;T++){var A=n.value[T]._locale;if(A&&!E.includes(A)){var L=n.getValue(A,"<br/>");L&&(p=this._buildMetadataItemValue(L,A),E.push(A),x.append(p))}}else{for(var R=this._getValueLocale(n),q=!1,$t=0,Rt=n.getValues(R);$t<Rt.length;$t++){var pt;(pt=Rt[$t])&&(q=!0,p=this._buildMetadataItemValue(pt,R),x.append(p))}q||(pt=n.getValue())&&(p=this._buildMetadataItemValue(pt,R),x.append(p))}else p=this._buildMetadataItemURIValue(g),x.append(p);this._data.copyToClipboardEnabled&&b.Clipboard.supportsCopy()&&I.text()&&this._addCopyButton(v,I,x);var Pt=this;return v.find("a.iiif-viewer-link").length>0&&v.on("click","a.iiif-viewer-link",function(rt){rt.preventDefault();var at=$(rt.target),re=at.attr("data-uv-navigate")||at.prop("href");Pt.fire(d.IIIF_VIEWER_LINK_CLICKED,re)}),v.find("[data-uv-navigate]").length>0&&v.on("click","[data-uv-navigate]",function(rt){rt.preventDefault();var at=$(rt.target).attr("data-uv-navigate")||null;at&&Pt.fire(d.IIIF_VIEWER_LINK_CLICKED,at)}),v},t.prototype._getLabelLocale=function(n){var r;if(!this._data||!this._data.helper)return"";var p=this._data.helper.options.locale;if(!((r=n.label)===null||r===void 0)&&r.length){var v=n.label[0].locale;if(v.toLowerCase()!==p.toLowerCase())return v}return p},t.prototype._getValueLocale=function(n){return this._data&&this._data.helper?this._data.helper.options.locale:""},t.prototype._buildMetadataItemValue=function(n,r){n=(n=this._sanitize(n)).replace(` `,"<br>");var p=this._$metadataItemValueTemplate.clone();return p.html(n),p.find("a").each(function(){var v=$(this);v.hasClass("iiif-viewer-link")||v.prop("target","_blank")}),r&&(p.prop("lang",r),this._addReadingDirection(p,r)),p},t.prototype._buildMetadataItemURIValue=function(n){n=this._sanitize(n);var r=this._$metadataItemURIValueTemplate.clone();return r.prop("href",n),r.text(n),r},t.prototype._addReadingDirection=function(n,r){r=s.Utils.getInexactLocale(r),this._readCSV(this._data.rtlLanguageCodes).filter(function(p){return p===r}).length>0&&(n.prop("dir","rtl"),n.addClass("rtl"))},t.prototype._addCopyButton=function(n,r,p){var v=this._$copyTextTemplate.clone(),I=v.children();r.append(v),b.Device.isTouch()?v.show():(n.on("mouseenter",function(){v.show()}),n.on("mouseleave",function(){v.hide()}),v.on("mouseleave",function(){I.hide()}));var x=this,S=p.text();v.on("click",function(O){x._copyItemValues(v,S)})},t.prototype._copyItemValues=function(n,r){b.Clipboard.copy(r);var p=n.find(".copiedText");p.show(),setTimeout(function(){p.hide()},this._data.copiedMessageDuration)},t.prototype._readCSV=function(n,r){r===void 0&&(r=!0);var p=[];if(n&&(p=n.split(","),r))for(var v=0;v<p.length;v++)p[v]=this._normalise(p[v]);return p},t.prototype._sanitize=function(n){return this._data.sanitizer?this._data.sanitizer(n):null},t.prototype._resize=function(){},t}(m.BaseComponent);o.MetadataComponent=f;var d=function(){function e(){}return e.IIIF_VIEWER_LINK_CLICKED="iiifViewerLinkClicked",e}();o.Events=d},function(a,o,l){typeof self<"u",a.exports=function(u){var i={};function c(s){if(i[s])return i[s].exports;var m=i[s]={i:s,l:!1,exports:{}};return u[s].call(m.exports,m,m.exports,c),m.l=!0,m.exports}return c.m=u,c.c=i,c.d=function(s,m,b){c.o(s,m)||Object.defineProperty(s,m,{enumerable:!0,get:b})},c.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},c.t=function(s,m){if(1&m&&(s=c(s)),8&m||4&m&&typeof s=="object"&&s&&s.__esModule)return s;var b=Object.create(null);if(c.r(b),Object.defineProperty(b,"default",{enumerable:!0,value:s}),2&m&&typeof s!="string")for(var h in s)c.d(b,h,function(f){return s[f]}.bind(null,h));return b},c.n=function(s){var m=s&&s.__esModule?function(){return s.default}:function(){return s};return c.d(m,"a",m),m},c.o=function(s,m){return Object.prototype.hasOwnProperty.call(s,m)},c.p="",c(c.s=7)}([function(u,i,c){"use strict";var s=this&&this.__createBinding||(Object.create?function(b,h,f,d){d===void 0&&(d=f);var e=Object.getOwnPropertyDescriptor(h,f);e&&!("get"in e?!h.__esModule:e.writable||e.configurable)||(e={enumerable:!0,get:function(){return h[f]}}),Object.defineProperty(b,d,e)}:function(b,h,f,d){d===void 0&&(d=f),b[d]=h[f]}),m=this&&this.__exportStar||function(b,h){for(var f in b)f==="default"||Object.prototype.hasOwnProperty.call(h,f)||s(h,b,f)};Object.defineProperty(i,"__esModule",{value:!0}),m(c(9),i),m(c(10),i),m(c(11),i),m(c(12),i),m(c(13),i),m(c(14),i),m(c(15),i),m(c(16),i),m(c(17),i),m(c(31),i),m(c(32),i),m(c(33),i),m(c(34),i),m(c(35),i),m(c(36),i),m(c(37),i),m(c(38),i),m(c(39),i),m(c(40),i),m(c(41),i),m(c(42),i),m(c(45),i),m(c(46),i),m(c(47),i),m(c(48),i),m(c(49),i),m(c(50),i),m(c(51),i),m(c(52),i),m(c(53),i),m(c(54),i),m(c(55),i),m(c(56),i),m(c(57),i),m(c(3),i)},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),function(s){s.BOOKMARKING="oa:bookmarking",s.CLASSIFYING="oa:classifying",s.COMMENTING="oa:commenting",s.DESCRIBING="oa:describing",s.EDITING="oa:editing",s.HIGHLIGHTING="oa:highlighting",s.IDENTIFYING="oa:identifying",s.LINKING="oa:linking",s.MODERATING="oa:moderating",s.PAINTING="sc:painting",s.QUESTIONING="oa:questioning",s.REPLYING="oa:replying",s.TAGGING="oa:tagging",s.TRANSCRIBING="oad:transcribing"}(i.AnnotationMotivation||(i.AnnotationMotivation={})),function(s){s.AUTO_ADVANCE="auto-advance",s.CONTINUOUS="continuous",s.FACING_PAGES="facing-pages",s.HIDDEN="hidden",s.INDIVIDUALS="individuals",s.MULTI_PART="multi-part",s.NO_NAV="no-nav",s.NON_PAGED="non-paged",s.PAGED="paged",s.REPEAT="repeat",s.SEQUENCE="sequence",s.THUMBNAIL_NAV="thumbnail-nav",s.TOGETHER="together",s.UNORDERED="unordered"}(i.Behavior||(i.Behavior={})),function(s){s.CANVAS="canvas",s.CHOICE="choice",s.OA_CHOICE="oa:choice",s.CONTENT_AS_TEXT="contentastext",s.DATASET="dataset",s.DOCUMENT="document",s.IMAGE="image",s.MODEL="model",s.MOVING_IMAGE="movingimage",s.PDF="pdf",s.PHYSICAL_OBJECT="physicalobject",s.SOUND="sound",s.TEXT="text",s.TEXTUALBODY="textualbody",s.VIDEO="video"}(i.ExternalResourceType||(i.ExternalResourceType={})),function(s){s.ANNOTATION="annotation",s.CANVAS="canvas",s.COLLECTION="collection",s.MANIFEST="manifest",s.RANGE="range",s.SEQUENCE="sequence"}(i.IIIFResourceType||(i.IIIFResourceType={})),function(s){s.AUDIO_MP4="audio/mp4",s.CORTO="application/corto",s.DICOM="application/dicom",s.DRACO="application/draco",s.EPUB="application/epub+zip",s.GIRDER="image/vnd.kitware.girder",s.GLB="model/gltf-binary",s.GLTF="model/gltf+json",s.IIIF_PRESENTATION_2='application/ld+json;profile="http://iiif.io/api/presentation/2/context.json"',s.IIIF_PRESENTATION_3='application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"',s.JPG="image/jpeg",s.M3U8="application/vnd.apple.mpegurl",s.MP3="audio/mp3",s.MPEG_DASH="application/dash+xml",s.OBJ="text/plain",s.OPF="application/oebps-package+xml",s.PDF="application/pdf",s.PLY="application/ply",s.THREEJS="application/vnd.threejs+json",s.USDZ="model/vnd.usd+zip",s.VIDEO_MP4="video/mp4",s.WAV="audio/wav",s.WEBM="video/webm"}(i.MediaType||(i.MediaType={})),function(s){s.DOC="application/msword",s.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.PDF="application/pdf"}(i.RenderingFormat||(i.RenderingFormat={})),function(s){s.IMAGE_0_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/compliance.html#level0",s.IMAGE_0_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",s.IMAGE_0_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/compliance.html#level2",s.IMAGE_0_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/conformance.html#level0",s.IMAGE_0_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",s.IMAGE_0_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/conformance.html#level2",s.IMAGE_1_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",s.IMAGE_1_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",s.IMAGE_1_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",s.IMAGE_1_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",s.IMAGE_1_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",s.IMAGE_1_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",s.IMAGE_1_LEVEL_0="http://iiif.io/api/image/1/level0.json",s.IMAGE_1_PROFILE_LEVEL_0="http://iiif.io/api/image/1/profiles/level0.json",s.IMAGE_1_LEVEL_1="http://iiif.io/api/image/1/level1.json",s.IMAGE_1_PROFILE_LEVEL_1="http://iiif.io/api/image/1/profiles/level1.json",s.IMAGE_1_LEVEL_2="http://iiif.io/api/image/1/level2.json",s.IMAGE_1_PROFILE_LEVEL_2="http://iiif.io/api/image/1/profiles/level2.json",s.IMAGE_2_LEVEL_0="http://iiif.io/api/image/2/level0.json",s.IMAGE_2_PROFILE_LEVEL_0="http://iiif.io/api/image/2/profiles/level0.json",s.IMAGE_2_LEVEL_1="http://iiif.io/api/image/2/level1.json",s.IMAGE_2_PROFILE_LEVEL_1="http://iiif.io/api/image/2/profiles/level1.json",s.IMAGE_2_LEVEL_2="http://iiif.io/api/image/2/level2.json",s.IMAGE_2_PROFILE_LEVEL_2="http://iiif.io/api/image/2/profiles/level2.json",s.AUTH_0_CLICK_THROUGH="http://iiif.io/api/auth/0/login/clickthrough",s.AUTH_0_LOGIN="http://iiif.io/api/auth/0/login",s.AUTH_0_LOGOUT="http://iiif.io/api/auth/0/logout",s.AUTH_0_RESTRICTED="http://iiif.io/api/auth/0/login/restricted",s.AUTH_0_TOKEN="http://iiif.io/api/auth/0/token",s.AUTH_1_CLICK_THROUGH="http://iiif.io/api/auth/1/clickthrough",s.AUTH_1_EXTERNAL="http://iiif.io/api/auth/1/external",s.AUTH_1_KIOSK="http://iiif.io/api/auth/1/kiosk",s.AUTH_1_LOGIN="http://iiif.io/api/auth/1/login",s.AUTH_1_LOGOUT="http://iiif.io/api/auth/1/logout",s.AUTH_1_PROBE="http://iiif.io/api/auth/1/probe",s.AUTH_1_TOKEN="http://iiif.io/api/auth/1/token",s.SEARCH_0="http://iiif.io/api/search/0/search",s.SEARCH_0_AUTO_COMPLETE="http://iiif.io/api/search/0/autocomplete",s.SEARCH_1="http://iiif.io/api/search/1/search",s.SEARCH_1_AUTO_COMPLETE="http://iiif.io/api/search/1/autocomplete",s.TRACKING_EXTENSIONS="http://universalviewer.io/tracking-extensions-profile",s.UI_EXTENSIONS="http://universalviewer.io/ui-extensions-profile",s.PRINT_EXTENSIONS="http://universalviewer.io/print-extensions-profile",s.SHARE_EXTENSIONS="http://universalviewer.io/share-extensions-profile",s.DOWNLOAD_EXTENSIONS="http://universalviewer.io/download-extensions-profile",s.OTHER_MANIFESTATIONS="http://iiif.io/api/otherManifestations.json",s.IXIF="http://wellcomelibrary.org/ld/ixif/0/alpha.json"}(i.ServiceProfile||(i.ServiceProfile={})),function(s){s.IMAGE_SERVICE_2="ImageService2",s.IMAGE_SERVICE_3="ImageService3"}(i.ServiceType||(i.ServiceType={})),function(s){s.BOTTOM_TO_TOP="bottom-to-top",s.LEFT_TO_RIGHT="left-to-right",s.RIGHT_TO_LEFT="right-to-left",s.TOP_TO_BOTTOM="top-to-bottom"}(i.ViewingDirection||(i.ViewingDirection={})),function(s){s.CONTINUOUS="continuous",s.INDIVIDUALS="individuals",s.NON_PAGED="non-paged",s.PAGED="paged",s.TOP="top"}(i.ViewingHint||(i.ViewingHint={}))},function(u,i,c){var s=c(21).Symbol;u.exports=s},function(u,i,c){"use strict";var s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(p,v){function I(O){try{S(r.next(O))}catch(C){v(C)}}function x(O){try{S(r.throw(O))}catch(C){v(C)}}function S(O){var C;O.done?p(O.value):(C=O.value,C instanceof n?C:new n(function(_){_(C)})).then(I,x)}S((r=r.apply(e,t||[])).next())})},m=this&&this.__generator||function(e,t){var n,r,p,v={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},I=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return I.next=x(0),I.throw=x(1),I.return=x(2),typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function x(S){return function(O){return function(C){if(n)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(v=0)),v;)try{if(n=1,r&&(p=2&C[0]?r.return:C[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,C[1])).done)return p;switch(r=0,p&&(C=[2&C[0],p.value]),C[0]){case 0:case 1:p=C;break;case 4:return v.label++,{value:C[1],done:!1};case 5:v.label++,r=C[1],C=[0];continue;case 7:C=v.ops.pop(),v.trys.pop();continue;default:if(!((p=(p=v.trys).length>0&&p[p.length-1])||C[0]!==6&&C[0]!==2)){v=0;continue}if(C[0]===3&&(!p||C[1]>p[0]&&C[1]<p[3])){v.label=C[1];break}if(C[0]===6&&v.label<p[1]){v.label=p[1],p=C;break}if(p&&v.label<p[2]){v.label=p[2],v.ops.push(C);break}p[2]&&v.ops.pop(),v.trys.pop();continue}C=t.call(e,v)}catch(_){C=[6,_],r=0}finally{n=p=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([S,O])}}};Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=void 0;var b=c(0),h=c(1),f=c(43);c(44);var d=function(){function e(){}return e.getMediaType=function(t){return(t=(t=t.toLowerCase()).split(";")[0]).trim()},e.getImageQuality=function(t){return t===h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_LEVEL_1||t===h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_LEVEL_2||t===h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2?"native":"default"},e.getInexactLocale=function(t){return t.indexOf("-")!==-1?t.substr(0,t.indexOf("-")):t},e.getLocalisedValue=function(t,n){if(!Array.isArray(t))return t;for(var r=0;r<t.length;r++){var p=t[r];if(n===p["@language"])return p["@value"]}var v=n.substr(0,n.indexOf("-"));for(r=0;r<t.length;r++){var I=t[r];if(I["@language"]===v)return I["@value"]}return null},e.generateTreeNodeIds=function(t,n){var r;n===void 0&&(n=0),r=t.parentNode?t.parentNode.id+"-"+n:"0",t.id=r;for(var p=0;p<t.nodes.length;p++){var v=t.nodes[p];e.generateTreeNodeIds(v,p)}},e.normaliseType=function(t){return(t=(t||"").toLowerCase()).indexOf(":")!==-1?t.split(":")[1]:t},e.normaliseUrl=function(t){return(t=t.substr(t.indexOf("://"))).indexOf("#")!==-1&&(t=t.split("#")[0]),t},e.normalisedUrlsMatch=function(t,n){return e.normaliseUrl(t)===e.normaliseUrl(n)},e.isImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.isImageServiceType=function(t){return t!==null&&t.toLowerCase()===h.ServiceType.IMAGE_SERVICE_2.toLowerCase()||t===h.ServiceType.IMAGE_SERVICE_3.toLowerCase()},e.isLevel0ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0))},e.isLevel1ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1))},e.isLevel2ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.parseManifest=function(t,n){return b.Deserialiser.parse(t,n)},e.checkStatus=function(t){if(t.ok)return t;var n=new Error(t.statusText);return n.response=t,Promise.reject(n)},e.loadManifest=function(t){return new Promise(function(n,r){fetch(t).then(e.checkStatus).then(function(p){return p.json()}).then(function(p){n(p)}).catch(function(p){r()})})},e.loadExternalResourcesAuth1=function(t,n,r,p,v,I,x,S){return new Promise(function(O,C){var _=t.map(function(g){return e.loadExternalResourceAuth1(g,n,r,p,v,I,x,S)});Promise.all(_).then(function(){O(t)}).catch(function(g){C(g)})})},e.loadExternalResourceAuth1=function(t,n,r,p,v,I,x,S){return s(this,void 0,void 0,function(){var O;return m(this,function(C){switch(C.label){case 0:return[4,p(t)];case 1:return(O=C.sent())?[4,t.getData(O)]:[3,6];case 2:return C.sent(),t.status!==f.OK?[3,3]:[2,t];case 3:return[4,e.doAuthChain(t,n,r,v,I,x,S)];case 4:C.sent(),C.label=5;case 5:if(t.status===f.OK||t.status===f.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError();case 6:return[4,t.getData()];case 7:return C.sent(),t.status!==f.MOVED_TEMPORARILY&&t.status!==f.UNAUTHORIZED?[3,9]:[4,e.doAuthChain(t,n,r,v,I,x,S)];case 8:C.sent(),C.label=9;case 9:if(t.status===f.OK||t.status===f.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError()}})})},e.doAuthChain=function(t,n,r,p,v,I,x){return s(this,void 0,void 0,function(){var S,O,C,_,g,E,T,A;return m(this,function(L){switch(L.label){case 0:return t.isAccessControlled()?((S=t.externalService)&&(S.options=t.options),(O=t.kioskService)&&(O.options=t.options),(C=t.clickThroughService)&&(C.options=t.options),(_=t.loginService)&&(_.options=t.options),t.isResponseHandled||t.status!==f.MOVED_TEMPORARILY?[3,2]:[4,I(t)]):[2,t];case 1:return L.sent(),[2,t];case 2:return g=null,E=null,(g=S)?(E=g,[4,e.attemptResourceWithToken(t,r,g)]):[3,4];case 3:return L.sent(),[2,t];case 4:return(g=O)?(E=g,(T=n(g))?[4,p(T)]:[3,7]):[3,7];case 5:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 6:return L.sent(),[2,t];case 7:return(g=C)?(E=g,[4,v(t,g)]):[3,11];case 8:return(A=L.sent())?[4,p(A)]:[3,11];case 9:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 10:return L.sent(),[2,t];case 11:return(g=_)?(E=g,[4,v(t,g)]):[3,15];case 12:return(A=L.sent())?[4,p(A)]:[3,15];case 13:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 14:return L.sent(),[2,t];case 15:return E&&x(t,E),[2]}})})},e.attemptResourceWithToken=function(t,n,r){return s(this,void 0,void 0,function(){var p,v;return m(this,function(I){switch(I.label){case 0:return(p=r.getService(h.ServiceProfile.AUTH_1_TOKEN))?[4,n(t,p)]:[3,3];case 1:return(v=I.sent())&&v.accessToken?[4,t.getData(v)]:[3,3];case 2:return I.sent(),[2,t];case 3:return[2]}})})},e.loadExternalResourcesAuth09=function(t,n,r,p,v,I,x,S,O,C){return new Promise(function(_,g){var E=t.map(function(T){return e.loadExternalResourceAuth09(T,n,r,p,v,I,x,S,O,C)});Promise.all(E).then(function(){_(t)}).catch(function(T){g(T)})})},e.loadExternalResourceAuth09=function(t,n,r,p,v,I,x,S,O,C){return new Promise(function(_,g){C&&C.pessimisticAccessControl?t.getData().then(function(){t.isAccessControlled()?t.clickThroughService?(_(r(t)),_(p(t))):v(t).then(function(){I(t,!0).then(function(E){t.getData(E).then(function(){_(O(t))}).catch(function(T){g(e.createInternalServerError(T))})}).catch(function(E){g(e.createInternalServerError(E))})}).catch(function(E){g(e.createInternalServerError(E))}):_(t)}).catch(function(E){g(e.createInternalServerError(E))}):S(t,n).then(function(E){E?t.getData(E).then(function(){t.status===f.OK?_(O(t)):e.authorize(t,n,r,p,v,I,x,S).then(function(){_(O(t))}).catch(function(T){g(e.createAuthorizationFailedError())})}).catch(function(T){g(e.createAuthorizationFailedError())}):e.authorize(t,n,r,p,v,I,x,S).then(function(){_(O(t))}).catch(function(T){g(e.createAuthorizationFailedError())})}).catch(function(E){g(e.createAuthorizationFailedError())})})},e.createError=function(t,n){var r=new Error;return r.message=n,r.name=String(t),r},e.createAuthorizationFailedError=function(){return e.createError(b.StatusCode.AUTHORIZATION_FAILED,"Authorization failed")},e.createRestrictedError=function(){return e.createError(b.StatusCode.RESTRICTED,"Restricted")},e.createInternalServerError=function(t){return e.createError(b.StatusCode.INTERNAL_SERVER_ERROR,t)},e.authorize=function(t,n,r,p,v,I,x,S){return new Promise(function(O,C){t.getData().then(function(){t.isAccessControlled()?S(t,n).then(function(_){_?t.getData(_).then(function(){t.status===f.OK?O(t):e.showAuthInteraction(t,n,r,p,v,I,x,O,C)}).catch(function(g){C(e.createInternalServerError(g))}):I(t,!1).then(function(g){g?x(t,g,n).then(function(){t.getData(g).then(function(){t.status===f.OK?O(t):e.showAuthInteraction(t,n,r,p,v,I,x,O,C)}).catch(function(E){C(e.createInternalServerError(E))})}).catch(function(E){C(e.createInternalServerError(E))}):e.showAuthInteraction(t,n,r,p,v,I,x,O,C)})}).catch(function(_){C(e.createInternalServerError(_))}):O(t)})})},e.showAuthInteraction=function(t,n,r,p,v,I,x,S,O){t.status!==f.MOVED_TEMPORARILY||t.isResponseHandled?t.clickThroughService&&!t.isResponseHandled?r(t).then(function(){I(t,!0).then(function(C){x(t,C,n).then(function(){t.getData(C).then(function(){S(t)}).catch(function(_){O(e.createInternalServerError(_))})}).catch(function(_){O(e.createInternalServerError(_))})}).catch(function(C){O(e.createInternalServerError(C))})}):v(t).then(function(){I(t,!0).then(function(C){x(t,C,n).then(function(){t.getData(C).then(function(){S(t)}).catch(function(_){O(e.createInternalServerError(_))})}).catch(function(_){O(e.createInternalServerError(_))})}).catch(function(C){O(e.createInternalServerError(C))})}):S(t)},e.getService=function(t,n){for(var r=this.getServices(t),p=0;p<r.length;p++){var v=r[p];if(v.getProfile()===n)return v}return null},e.getResourceById=function(t,n){return e.traverseAndFind(t.__jsonld,"@id",n)},e.traverseAndFind=function(t,n,r){if(t.hasOwnProperty(n)&&t[n]===r)return t;for(var p=0;p<Object.keys(t).length;p++)if(typeof t[Object.keys(t)[p]]=="object"){var v=e.traverseAndFind(t[Object.keys(t)[p]],n,r);if(v!=null)return v}},e.getServices=function(t,n){var r=n===void 0?{}:n,p=r.onlyService,v=p!==void 0&&p,I=r.onlyServices,x=I!==void 0&&I,S=r.skipParentResources,O=[];(S===void 0||!S)&&t&&t.options&&t.options.resource&&t.options.resource!==t&&O.push.apply(O,e.getServices(t.options.resource,{onlyServices:!0}));var C=x?[]:(t.__jsonld||t).service||[];if(Array.isArray(C)||(C=[C]),v||C.push.apply(C,(t.__jsonld||t).services||[]),C.length===0)return O;for(var _=0;_<C.length;_++){var g=C[_];if(typeof g=="string"){var E=this.getResourceById(t.options.resource,g);E&&O.push(new b.Service(E.__jsonld||E,t.options))}else O.push(new b.Service(g,t.options))}return O},e.getTemporalComponent=function(t){var n=/t=([^&]+)/g.exec(t),r=null;return n&&n[1]&&(r=n[1].split(",")),r},e}();i.Utils=d},function(u,i,c){var s=c(19),m=c(20);u.exports=function b(h,f,d,e,t){var n=-1,r=h.length;for(d||(d=m),t||(t=[]);++n<r;){var p=h[n];f>0&&d(p)?f>1?b(p,f-1,d,e,t):s(t,p):e||(t[t.length]=p)}return t}},function(u,i){u.exports=function(c){return c!=null&&typeof c=="object"}},function(u,i,c){"use strict";c.r(i),i.default=function(s,m){return m=m||{},new Promise(function(b,h){var f=new XMLHttpRequest,d=[],e=[],t={},n=function(){return{ok:(f.status/100|0)==2,statusText:f.statusText,status:f.status,url:f.responseURL,text:function(){return Promise.resolve(f.responseText)},json:function(){return Promise.resolve(JSON.parse(f.responseText))},blob:function(){return Promise.resolve(new Blob([f.response]))},clone:n,headers:{keys:function(){return d},entries:function(){return e},get:function(p){return t[p.toLowerCase()]},has:function(p){return p.toLowerCase()in t}}}};for(var r in f.open(m.method||"get",s,!0),f.onload=function(){f.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(p,v,I){d.push(v=v.toLowerCase()),e.push([v,I]),t[v]=t[v]?t[v]+","+I:I}),b(n())},f.onerror=h,f.withCredentials=m.credentials=="include",m.headers)f.setRequestHeader(r,m.headers[r]);f.send(m.body||null)})}},function(u,i,c){u.exports=c(8)},function(u,i,c){"use strict";var s=this&&this.__createBinding||(Object.create?function(h,f,d,e){e===void 0&&(e=d);var t=Object.getOwnPropertyDescriptor(f,d);t&&!("get"in t?!f.__esModule:t.writable||t.configurable)||(t={enumerable:!0,get:function(){return f[d]}}),Object.defineProperty(h,e,t)}:function(h,f,d,e){e===void 0&&(e=d),h[e]=f[d]}),m=this&&this.__exportStar||function(h,f){for(var d in h)d==="default"||Object.prototype.hasOwnProperty.call(f,d)||s(f,h,d)};Object.defineProperty(i,"__esModule",{value:!0}),i.parseManifest=i.loadManifest=void 0,m(c(0),i);var b=c(3);i.loadManifest=function(h){return b.Utils.loadManifest(h)},i.parseManifest=function(h,f){return b.Utils.parseManifest(h,f)}},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.JSONLDResource=void 0;var s=function(){function m(b){this.__jsonld=b,this.context=this.getProperty("context"),this.id=this.getProperty("id")}return m.prototype.getProperty=function(b){var h=null;return this.__jsonld&&((h=this.__jsonld[b])||(h=this.__jsonld["@"+b])),h},m}();i.JSONLDResource=s},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.ManifestResource=void 0;var b=c(0),h=c(1),f=function(d){function e(t,n){var r=d.call(this,t)||this;return r.options=n,r}return m(e,d),e.prototype.getIIIFResourceType=function(){return b.Utils.normaliseType(this.getProperty("type"))},e.prototype.getLabel=function(){var t=this.getProperty("label");return t?b.PropertyValue.parse(t,this.options.locale):new b.PropertyValue([],this.options.locale)},e.prototype.getDefaultLabel=function(){return this.getLabel().getValue(this.options.locale)},e.prototype.getMetadata=function(){var t=this.getProperty("metadata"),n=[];if(!t)return n;for(var r=0;r<t.length;r++){var p=t[r],v=new b.LabelValuePair(this.options.locale);v.parse(p),n.push(v)}return n},e.prototype.getRendering=function(t){for(var n=this.getRenderings(),r=0;r<n.length;r++){var p=n[r];if(p.getFormat()===t)return p}return null},e.prototype.getRenderings=function(){var t,n=[];if(!(t=this.__jsonld?this.__jsonld.rendering:this.rendering))return n;Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++){var p=t[r];n.push(new b.Rendering(p,this.options))}return n},e.prototype.getRequiredStatement=function(){var t=null,n=this.getProperty("requiredStatement");return n&&(t=new b.LabelValuePair(this.options.locale)).parse(n),t},e.prototype.getService=function(t){return b.Utils.getService(this,t)},e.prototype.getServices=function(){return b.Utils.getServices(this)},e.prototype.getThumbnail=function(){var t=this.getProperty("thumbnail");return Array.isArray(t)&&(t=t[0]),t?new b.Thumbnail(t,this.options):null},e.prototype.isAnnotation=function(){return this.getIIIFResourceType()===h.IIIFResourceType.ANNOTATION},e.prototype.isCanvas=function(){return this.getIIIFResourceType()===h.IIIFResourceType.CANVAS},e.prototype.isCollection=function(){return this.getIIIFResourceType()===h.IIIFResourceType.COLLECTION},e.prototype.isManifest=function(){return this.getIIIFResourceType()===h.IIIFResourceType.MANIFEST},e.prototype.isRange=function(){return this.getIIIFResourceType()===h.IIIFResourceType.RANGE},e.prototype.isSequence=function(){return this.getIIIFResourceType()===h.IIIFResourceType.SEQUENCE},e}(b.JSONLDResource);i.ManifestResource=f},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.Resource=void 0;var b=c(0),h=function(f){function d(e,t){return f.call(this,e,t)||this}return m(d,f),d.prototype.getFormat=function(){var e=this.getProperty("format");return e?e.toLowerCase():null},d.prototype.getResources=function(){var e=[];if(!this.__jsonld.resources)return e;for(var t=0;t<this.__jsonld.resources.length;t++){var n=this.__jsonld.resources[t],r=new b.Annotation(n,this.options);e.push(r)}return e},d.prototype.getType=function(){var e=this.getProperty("type");return e?b.Utils.normaliseType(e):null},d.prototype.getWidth=function(){return this.getProperty("width")},d.prototype.getHeight=function(){return this.getProperty("height")},d.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},d.prototype.getMaxHeight=function(){return this.getProperty("maxHeight")?null:this.getMaxWidth()},d}(b.ManifestResource);i.Resource=h},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Ob