"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8487],{35336:function(e,t,i){var r=i(15492),o=i(22954),n=i(60310),a=i(95284),s=i(90776),l=i(17985);function f(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,r=new Array(t);i1,r=i&&e.imageInfo.profile[1].supports?e.imageInfo.profile[1].supports:[],o=i&&e.imageInfo.profile[1].formats?e.imageInfo.profile[1].formats:[],n=i&&e.imageInfo.profile[1].qualities?e.imageInfo.profile[1].qualities:[];return{url:e.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===e.imageInfo.sizes?void 0:e.imageInfo.sizes.map((function(e){return[e.width,e.height]})),tileSize:void 0===e.imageInfo.tiles?void 0:[e.imageInfo.tiles.map((function(e){return e.width}))[0],e.imageInfo.tiles.map((function(e){return void 0===e.height?e.width:e.height}))[0]],resolutions:void 0===e.imageInfo.tiles?void 0:e.imageInfo.tiles.map((function(e){return e.scaleFactors}))[0],supports:[].concat(u(t.supports),u(r)),formats:[].concat(u(t.formats),u(o)),qualities:[].concat(u(t.qualities),u(n))}},I[m]=function(e){var t=e.getComplianceLevelSupportedFeatures(),i=void 0===e.imageInfo.extraFormats?t.formats:[].concat(u(t.formats),u(e.imageInfo.extraFormats)),r=void 0!==e.imageInfo.preferredFormats&&Array.isArray(e.imageInfo.preferredFormats)&&e.imageInfo.preferredFormats.length>0?e.imageInfo.preferredFormats.filter((function(e){return(0,l.q9)(["jpg","png","gif"],e)})).reduce((function(e,t){return void 0===e&&(0,l.q9)(i,t)?t:e}),void 0):void 0;return{url:e.imageInfo.id,sizes:void 0===e.imageInfo.sizes?void 0:e.imageInfo.sizes.map((function(e){return[e.width,e.height]})),tileSize:void 0===e.imageInfo.tiles?void 0:[e.imageInfo.tiles.map((function(e){return e.width}))[0],e.imageInfo.tiles.map((function(e){return e.height}))[0]],resolutions:void 0===e.imageInfo.tiles?void 0:e.imageInfo.tiles.map((function(e){return e.scaleFactors}))[0],supports:void 0===e.imageInfo.extraFeatures?t.supports:[].concat(u(t.supports),u(e.imageInfo.extraFeatures)),formats:i,qualities:void 0===e.imageInfo.extraQualities?t.qualities:[].concat(u(t.qualities),u(e.imageInfo.extraQualities)),preferredFormat:r}};var b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.setImageInfo(t)}var t,i,r;return t=e,(i=[{key:"setImageInfo",value:function(e){this.imageInfo="string"==typeof e?JSON.parse(e):e}},{key:"getImageApiVersion",value:function(){if(void 0!==this.imageInfo){var e=this.imageInfo["@context"]||"ol-no-context";"string"==typeof e&&(e=[e]);for(var t=0;t0&&"string"==typeof this.imageInfo.profile[0]&&v.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}},{key:"getComplianceLevelFromProfile",value:function(e){var t=this.getComplianceLevelEntryFromProfile(e);if(void 0!==t){var i=t.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}}},{key:"getComplianceLevelSupportedFeatures",value:function(){if(void 0!==this.imageInfo){var e=this.getImageApiVersion(),t=this.getComplianceLevelFromProfile(e);return void 0===t?y.none.none:y[e][t]}}},{key:"getTileSourceOptions",value:function(e){var t=e||{},i=this.getImageApiVersion();if(void 0!==i){var r=void 0===i?void 0:I[i](this);if(void 0!==r)return{url:r.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:r.sizes,format:void 0!==t.format&&(0,l.q9)(r.formats,t.format)?t.format:void 0!==r.preferredFormat?r.preferredFormat:"jpg",supports:r.supports,quality:t.quality&&(0,l.q9)(r.qualities,t.quality)?t.quality:(0,l.q9)(r.qualities,"native")?"native":"default",resolutions:Array.isArray(r.resolutions)?r.resolutions.sort((function(e,t){return t-e})):void 0,tileSize:r.tileSize}}}}])&&f(t.prototype,i),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),z=i(86923),B=i(7877);function q(e){return(q="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})(e)}function j(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return w(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return w(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i0&&!isNaN(v[1])&&v[1]>0,60);var d,I,b,q=v[0],w=v[1],x=i.tileSize,P=i.tilePixelRatio||1,S=i.format||"jpg",A=i.quality||(i.version==p?"native":"default"),C=i.resolutions||[],F=i.supports||[],M=i.extent||[0,-w,q,0],W=null!=h&&Array.isArray(h)&&h.length>0,E=void 0!==x&&("number"==typeof x&&Number.isInteger(x)&&x>0||Array.isArray(x)&&x.length>0),_=null!=F&&Array.isArray(F)&&((0,l.q9)(F,"regionByPx")||(0,l.q9)(F,"regionByPct"))&&((0,l.q9)(F,"sizeByWh")||(0,l.q9)(F,"sizeByH")||(0,l.q9)(F,"sizeByW")||(0,l.q9)(F,"sizeByPct"));if(C.sort((function(e,t){return t-e})),E||_)if(null!=x&&("number"==typeof x&&Number.isInteger(x)&&x>0?(d=x,I=x):Array.isArray(x)&&x.length>0&&((1==x.length||null==x[1]&&Number.isInteger(x[0]))&&(d=x[0],I=x[0]),2==x.length&&(Number.isInteger(x[0])&&Number.isInteger(x[1])?(d=x[0],I=x[1]):null==x[0]&&Number.isInteger(x[1])&&(d=x[1],I=x[1])))),void 0!==d&&void 0!==I||(d=a.S,I=a.S),0==C.length)for(var L=b=Math.max(Math.ceil(Math.log(q/d)/Math.LN2),Math.ceil(Math.log(w/I)/Math.LN2));L>=0;L--)C.push(Math.pow(2,L));else{var k=Math.max.apply(Math,j(C));b=Math.round(Math.log(k)/Math.LN2)}else if(d=q,I=w,C=[],W){h.sort((function(e,t){return e[0]-t[0]})),b=-1;for(var N=[],T=0;T0&&C[C.length-1]==R?N.push(T):(C.push(R),b++)}if(N.length>0)for(var $=0;$b)){var a=e[1],s=e[2],f=C[n];if(!(void 0===a||void 0===s||void 0===f||a<0||Math.ceil(q/f/d)<=a||s<0||Math.ceil(w/f/I)<=s)){if(_||E){var u=a*d*f,p=s*I*f,g=d*f,v=I*f,z=d,B=I;if(u+g>q&&(g=q-u),p+v>w&&(v=w-p),u+d*f>q&&(z=Math.floor((q-u+f-1)/f)),p+I*f>w&&(B=Math.floor((w-p+f-1)/f)),0==u&&g==q&&0==p&&v==w)r="full";else if(!_||(0,l.q9)(F,"regionByPx"))r=u+","+p+","+g+","+v;else if((0,l.q9)(F,"regionByPct")){r="pct:"+O(u/q*100)+","+O(p/w*100)+","+O(g/q*100)+","+O(v/w*100)}y!=m||_&&!(0,l.q9)(F,"sizeByWh")?!_||(0,l.q9)(F,"sizeByW")?o=z+",":(0,l.q9)(F,"sizeByH")?o=","+B:(0,l.q9)(F,"sizeByWh")?o=z+","+B:(0,l.q9)(F,"sizeByPct")&&(o="pct:"+O(100/f)):o=z+","+B}else if(r="full",W){var j=h[n][0],x=h[n][1];o=y==m?j==q&&x==w?"max":j+","+x:j==q?"full":j+","}else o=y==m?"max":"full";return c+r+"/"+o+"/0/"+A+"."+S}}},transition:i.transition})).zDirection=i.zDirection,t}return t=u,i&&x(t.prototype,i),o&&x(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}(o.Z),M=i(41376),W=i(42010),E=i(54354),_=new W.Z,L=new M.Z({layers:[_],target:"map"}),k=document.getElementById("iiif-notification"),N=document.getElementById("imageInfoUrl");function T(e){fetch(e).then((function(e){e.json().then((function(e){var t=new b(e).getTileSourceOptions();if(void 0!==t&&void 0!==t.version){t.zDirection=-1;var i=new F(t);_.setSource(i),L.setView(new E.ZP({resolutions:i.getTileGrid().getResolutions(),extent:i.getTileGrid().getExtent(),constrainOnlyCenter:!0})),L.getView().fit(i.getTileGrid().getExtent()),k.textContent=""}else k.textContent="Data seems to be no valid IIIF image information."})).catch((function(e){k.textContent="Could not read image info json. "+e}))})).catch((function(){k.textContent="Could not read data from URL."}))}document.getElementById("display").addEventListener("click",(function(){T(N.value)})),T(N.value)}},function(e){var t=function(t){return e(e.s=t)};t(9877),t(35336)}]); //# sourceMappingURL=iiif.js.map