@europeana/map 0.1.1-map.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/europeana-map.app.iife.js +1 -1
- package/dist/europeana-map.app.iife.js.map +1 -1
- package/dist/europeana-map.app.js +1 -1
- package/dist/europeana-map.app.js.map +1 -1
- package/dist/europeana-map.component.iife.js.map +1 -1
- package/dist/europeana-map.component.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,5 +18,5 @@ var EuropeanaMap=(function(){"use strict";var pt;function xc(n){const e=Object.c
|
|
|
18
18
|
`)return q.push(`
|
|
19
19
|
`,""),q;if(B==2)return q.push(Wf(Me,ee),fe),q;Me=Xf(Me,fe,Q,ee).split(`
|
|
20
20
|
`);for(let Fe=0,$e=Me.length;Fe<$e;++Fe)Fe>0&&q.push(`
|
|
21
|
-
`,""),q.push(Me[Fe],fe);return q},[]):V=Bf(Z,R).trim(),he=te(M,"paint","text-opacity",F,g,P)}if(V&&he&&!O){E||(++oe,k=y[oe],(!k||!k.getText()||k.getFill()||k.getStroke())&&(k=new At,y[oe]=k),k.setImage(void 0),k.setGeometry(void 0));const Y=U_(M,F,"text",g);k.getText()||k.setText(b),b=k.getText(),(!b||"getDeclutterMode"in b&&b.getDeclutterMode()!==Y)&&(b=new Ao({padding:[2,2,2,2],declutterMode:Y}),k.setText(b));const Z=te(M,"layout","text-transform",F,g,P);Z=="uppercase"?V=Array.isArray(V)?V.map((Je,Vt)=>Vt%2?Je:Je.toUpperCase()):V.toUpperCase():Z=="lowercase"&&(V=Array.isArray(V)?V.map((Je,Vt)=>Vt%2?Je:Je.toLowerCase()):V.toLowerCase());const q=Array.isArray(V)?V:B==2?Wf(V,ee):Xf(V,U,Q,ee);if(b.setText(q),b.setFont(U),b.setRotation(jf(te(M,"layout","text-rotate",F,g,P))),typeof b.setKeepUpright=="function"){const Je=te(M,"layout","text-keep-upright",F,g,P);b.setKeepUpright(Je)}const ae=te(M,"layout","text-anchor",F,g,P),ce=E||B==1?"point":te(M,"layout","symbol-placement",F,g,P);let se;if(ce==="line-center"?(b.setPlacement("line"),se="center"):b.setPlacement(ce),ce==="line"&&typeof b.setRepeat=="function"){const Je=te(M,"layout","symbol-spacing",F,g,P);b.setRepeat(Je*2)}b.setOverflow(ce==="point");let fe=te(M,"paint","text-halo-width",F,g,P);const Me=te(M,"layout","text-offset",F,g,P),Fe=te(M,"paint","text-translate",F,g,P);let $e=0,Tt=0;if(ce=="point"){se="center",ae.indexOf("left")!==-1?(se="left",Tt=fe):ae.indexOf("right")!==-1&&(se="right",Tt=-fe);const Je=te(M,"layout","text-rotation-alignment",F,g,P);b.setRotateWithView(Je=="map")}else b.setMaxAngle(jf(te(M,"layout","text-max-angle",F,g,P))*V.length/q.length),b.setRotateWithView(!1);b.setTextAlign(se);let ke="middle";ae.indexOf("bottom")==0?(ke="bottom",$e=-fe-.5*($-1)*N):ae.indexOf("top")==0&&(ke="top",$e=fe+.5*($-1)*N),b.setTextBaseline(ke);const Ve=te(M,"layout","text-justify",F,g,P);b.setJustify(Ve==="auto"?void 0:Ve),b.setOffsetX(Me[0]*N+Tt+Fe[0]),b.setOffsetY(Me[1]*N+$e+Fe[1]);const je=b.getFill()||new Qt;je.setColor(ji(te(M,"paint","text-color",F,g,P),he)),b.setFill(je);const ut=ji(te(M,"paint","text-halo-color",F,g,P),he);if(ut&&fe>0){const Je=b.getStroke()||new Qn;Je.setColor(ut),fe*=2;const Vt=.5*N;Je.setWidth(fe<=Vt?fe:Vt),b.setStroke(Je)}else b.setStroke(void 0);const Ot=te(M,"layout","text-padding",F,g,P),Lt=b.getPadding();Ot!==Lt[0]&&(Lt[0]=Ot,Lt[1]=Ot,Lt[2]=Ot,Lt[3]=Ot),k.setZIndex(He)}}}if(oe>-1)return y.length=oe+1,y};return n.setStyle(_),n.set("mapbox-layers",h),n.set("mapbox-source",m),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),_}const QS=Qe.parse("#000000"),eI=Qe.parse("#FFFFFF"),tI=Qe.parse("#000000");function nI(n){return new Of({source:new kf({operationType:"image",operation:zS,sources:[n]})})}function iI(n){return new Of({source:new kf({operationType:"image",operation:NS,sources:[n]})})}function rI(n,e,t,i){n.getSource().on("beforeoperations",function(r){Ft.zoom=cc(r.resolution,t.resolutions||dn),Ft.distanceFromCenter=0;const s=r.data;s.saturation=te(e,"paint","raster-saturation",at,i),s.contrast=te(e,"paint","raster-contrast",at,i),s.brightnessHigh=te(e,"paint","raster-brightness-max",at,i),s.brightnessLow=te(e,"paint","raster-brightness-min",at,i),s.hueRotate=te(e,"paint","raster-hue-rotate",at,i)})}function sI(n,e,t,i,r){n.getSource().on("beforeoperations",function(s){const o=s.data;o.resolution=wu(i.projection||"EPSG:3857",s.resolution,zt(s.extent),"m");const a=cc(s.resolution,i.resolutions||dn);Ft.zoom=a,Ft.distanceFromCenter=0,o.zoom=a,o.encoding=e.encoding,o.method=te(t,"paint","hillshade-method",at,r)||"standard",o.exaggeration=te(t,"paint","hillshade-exaggeration",at,r);let l=te(t,"paint","hillshade-illumination-direction",at,r);l==null&&(l=335),o.azimuths=Array.isArray(l)?l:[l],o.sunAz=o.azimuths[0];let c=te(t,"paint","hillshade-illumination-altitude",at,r);c==null&&(c=45),o.altitudes=Array.isArray(c)?c:[c];function u(f){return f&&f.values?f.values[0]:f}function h(f){const d=t.paint?.[f];if(Array.isArray(d)&&d.length>0&&typeof d[0]=="string"&&Qe.parse(d[0])!==void 0)return d.map(p=>Qe.parse(p));let g=te(t,"paint",f,at,r);return g=u(g),g?[g]:void 0}o.highlightColors=h("hillshade-highlight-color"),o.highlightColor=o.highlightColors?.[0]||eI,o.highlightColors||(o.highlightColors=[o.highlightColor]),o.shadowColors=h("hillshade-shadow-color"),o.shadowColor=o.shadowColors?.[0]||QS,o.shadowColors||(o.shadowColors=[o.shadowColor]),o.accentColor=u(te(t,"paint","hillshade-accent-color",at,r))||tI})}const oI=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];function aI(n,e,t){let i=null;return function(r){n.paint&&"raster-opacity"in n.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete t[n.id],lI(n,e,i,t))}}function lI(n,e,t,i){Ft.zoom=t,Ft.distanceFromCenter=0;const r=te(n,"paint","raster-opacity",at,i);e.setOpacity(r)}const cI=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function uI(n,e=512){return n.getExtent()?El({extent:n.getExtent(),tileSize:e,maxZoom:22}).getResolutions():dn}function $_(n,e){return e.accessToken||(e=Object.assign({},e),new URL(n).searchParams.forEach((i,r)=>{e.accessToken=i,e.accessTokenParam=r})),e}function hI(n,e,t="",i={},r=void 0){let s,o,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,i=a):l=t,typeof i=="string"?(s=i,a={}):(s=i.styleUrl,a=i),a.updateSource===!1&&(c=!1),r||(r=a.resolutions),!s&&typeof e=="string"&&!e.trim().startsWith("{")&&(s=e),s&&(s=s.startsWith("data:")?location.href:sc(s,a.accessToken),a=$_(s,a)),new Promise(function(u,h){k_(e,a).then(function(f){if(f.version!=8)return h(new Error("glStyle version 8 required."));if(!(n instanceof ic||n instanceof Jo))return h(new Error("Can only apply to VectorLayer or VectorTileLayer"));const d=n instanceof Jo?"vector":"geojson";if(l?Array.isArray(l)?o=f.layers.find(function(x){return x.id===l[0]}).source:o=l:(o=f.layers.find(function(x){return x.source&&f.sources[x.source].type===d}).source,l=o),!o)return h(new Error(`No ${d} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(n instanceof Jo)return Z_(f.sources[o],s,a).then(function(R){const C=n.getSource();C?R!==C&&(C.setTileUrlFunction(R.getTileUrlFunction()),typeof C.setUrls=="function"&&typeof R.getUrls=="function"&&C.setUrls(R.getUrls()),C.format_||(C.format_=R.format_),C.getAttributions()||C.setAttributions(R.getAttributions()),C.getTileLoadFunction()===b_&&C.setTileLoadFunction(R.getTileLoadFunction()),Et(C.getProjection(),R.getProjection())&&(C.tileGrid=R.getTileGrid())):n.setSource(R);const S=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&S.getMinZoom()>0&&n.setMaxResolution(ea(Math.max(0,S.getMinZoom()-1e-12),S.getResolutions()))});const x=f.sources[o];let w=n.getSource();(!w||w.get("mapbox-source")!==x)&&(w=H_(x,s,a));const T=n.getSource();return T?w!==T&&(T.getAttributions()||T.setAttributions(w.getAttributions()),T.format_||(T.format_=w.getFormat()),T.url_=w.getUrl()):n.setSource(w),Promise.resolve()}let p,m;const y={},_={};function v(){if(!m&&(!f.sprite||y)){if(a.projection&&!r){const R=Le(a.projection).getUnits();R!=="m"&&(r=dn.map(C=>C/bi[R]))}let x;const w=n.getSource();w instanceof Af&&w.format_ instanceof Qy&&(x=w.format_.layerName_),m=JS(n,f,l,r,y,_,(T,R=a.webfonts)=>$S(T,R),a.getImage,x),n.getStyle()?g().then(u).catch(h):h(new Error(`Nothing to show for source [${o}]`))}else m?(n.setStyle(m),g().then(u).catch(h)):h(new Error("Something went wrong trying to apply style."))}if(f.sprite){const x=ES(f.sprite,a.accessToken,s||location.href);p=vt?1:window.devicePixelRatio>=1.5?.5:1;const w=p==.5?"@2x":"";Promise.all(x.map(function(T){const R=new URL(T.url);let C=R.origin+R.pathname+w+".json"+R.search;return new Promise(function(S,L){Rs("Sprite",C,a).then(S).catch(function(B){C=R.origin+R.pathname+".json"+R.search,Rs("Sprite",C,a).then(S).catch(L)})}).then(function(S){S===void 0&&h(new Error("No sprites found."));let L;if(L=R.origin+R.pathname+w+".png"+R.search,a.transformRequest){const B=a.transformRequest(L,"SpriteImage")||L;(B instanceof Request||B instanceof Promise)&&(L=B)}_[T.id]=L;for(const B in S){const K=T.id=="default"?B:`${T.id}:${B}`;y[K]=S[B]}}).catch(function(S){h(new Error(`Sprites cannot be loaded: ${C}: ${S.message}`))})})).then(v).catch(h)}else v()}).catch(h)})}const fI=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function K_(n,e){if(!e.ref)return e;const t=n.find(r=>r.id===e.ref);if(!t)return e;const i=Object.assign({},e);for(const r of fI)!(r in i)&&r in t&&(i[r]=t[r]);return i}function dI(n,e){const t=n.bounds;if(t){const i=bu([t[0],t[1]],e),r=bu([t[2],t[3]],e);return[i[0],i[1],r[0],r[1]]}return Le(e).getExtent()}function Y_(n,e,t){const i=new y_({tileJSON:e,tileSize:n.tileSize||e.tileSize||512}),r=i.getTileJSON(),s=i.getTileGrid(),o=Le(t.projection||"EPSG:3857"),a=dI(r,o),l=o.getExtent(),c=r.minzoom||0,u=r.maxzoom||22,h={attributions:i.getAttributions(),projection:o,tileGrid:new wl({origin:l?$n(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:uI(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?h.urls=r.tiles:h.url=r.tiles,h}function gI(n,e,t,i){const r={id:n.id,type:n.type},s=n.paint||{};r.paint=s,Ft.zoom=cc(e,t.resolutions||dn),Ft.distanceFromCenter=0;let o;const a=te(r,"paint","background-color",at,i);return s["background-opacity"]!==void 0&&(o=te(r,"paint","background-opacity",at,i)),te(r,"layout","visibility",at,i)==="none"?void 0:ji(a,o)}function pI(n,e,t){const i=vt?{style:{}}:document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new Zr({source:new ls({}),render(r){const s=gI(n,r.viewState.resolution,e,t);return i.style.backgroundColor=s,i}})}function Z_(n,e,t){return new Promise(function(i,r){z_(n,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=Y_(n,s,t);a.tileLoadFunction=o,a.format=new Qy({layerName:"mvt:layer"});const l=new Af(a);l.set("mapbox-source",n),i(l)}).catch(r)})}function mI(n,e,t){const i=new Jo({declutter:!0,visible:!1});return Z_(n,e,t).then(function(r){i.setSource(r)}).catch(function(r){i.setSource(void 0)}),i}function q_(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function yI(n,e,t){return new Promise(function(i,r){z_(n,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=new y_({interpolate:t.interpolate===void 0?!0:t.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:s});a.tileGrid=Y_(n,s,t).tileGrid,t.projection&&(a.projection=Le(t.projection));const l=a.getTileUrlFunction();o&&a.setTileLoadFunction(o),a.setTileUrlFunction(function(c,u,h){const f=q_(h);let d=l(c,u,h);if(d.indexOf(f)!=-1){const g=a.getTileGrid().getTileCoordExtent(c);d=d.replace(f,g.toString())}return d}),a.set("mapbox-source",n),i(a)}).catch(function(s){r(s)})})}function $f(n,e,t){const i=new Nh;return yI(n,e,t).then(function(r){i.setSource(r)}).catch(function(){i.setSource(void 0)}),i}function H_(n,e,t){const i=t.projection?new Zy({dataProjection:t.projection}):new Zy,r=n.data,s={};if(typeof r=="string"){const[a]=oc(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(h,f,d)=>{const g=q_(d);return a.replace(g,`${h.join(",")}`)},u=new Cs({attributions:n.attribution,format:i,loader:(h,f,d,g,p)=>{const m=typeof c=="function"?c(h,f,d):c;Rs("GeoJSON",m,t).then(y=>{const _=u.getFormat().readFeatures(y,{featureProjection:d});u.addFeatures(_),g(_)}).catch(y=>{u.removeLoadedExtent(h),p()})},strategy:yS});return u.set("mapbox-source",n),u}const l=new Cs({attributions:n.attribution,format:i,url:a,loader:(c,u,h,f,d)=>{Rs("GeoJSON",a,t).then(g=>{const p=l.getFormat().readFeatures(g,{featureProjection:h});l.addFeatures(p),f(p)}).catch(g=>{l.removeLoadedExtent(c),d()})}});return l}s.features=i.readFeatures(r,{featureProjection:oo()||"EPSG:3857"});const o=new Cs(Object.assign({attributions:n.attribution,format:i},s));return o.set("mapbox-source",n),o}function _I(n,e,t){return new ic({declutter:!0,source:H_(n,e,t),visible:!1})}function xI(n,e,t){function i(){const r=e.get("mapbox-style");if(!r)return;const s=Ym(r.layers),o=n.get("mapbox-layers"),a=s.filter(function(l){return o.includes(l.id)}).some(function(l){return!l.layout||te(l,"layout","visibility",at,t)==="visible"});n.get("visible")!==a&&n.setVisible(a)}n.on("change",i),i()}function vI(n,e,t,i){t=K_(n.layers,t);const r=Gf(n),s=t.type;let o=t.source;const a=n.sources[o];let l;if(s=="background")l=pI(t,i,r),o=void 0;else if(a.type=="vector")l=mI(a,e,i);else if(a.type=="raster"){if(!!Object.keys(t.paint||{}).find(u=>oI.includes(u))){const u=$f(a,e,i);l=nI(u),rI(l,t,i,r)}else l=$f(a,e,i);l.setVisible(t.layout?te(t,"layout","visibility",at,r)!=="none":!0),l.on("prerender",aI(t,l,r))}else if(a.type=="geojson")l=_I(a,e,i);else if(a.type=="raster-dem"&&t.type=="hillshade"){const c=$f(a,e,i);l=iI(c),sI(l,a,t,i,r),l.setVisible(t.layout?te(t,"layout","visibility",at,r)!=="none":!0)}return l&&l.set("mapbox-source",o),l}function J_(n,e,t,i){n.schema&&Object.assign(Pf,Object.keys(n.schema).reduce((h,f)=>(h[f]=n.schema[f]?.default,h),{}));const r=[];let s=null;if(e instanceof is){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const h=i.projection?Le(i.projection):s.getProjection();s=new un(Object.assign(s.getProperties(),{maxResolution:dn[0]/bi[h.getUnits()],projection:i.projection||s.getProjection()})),e.setView(s)}"center"in n&&!s.getCenter()&&s.setCenter(bu(n.center,s.getProjection())),"zoom"in n&&s.getZoom()===void 0&&s.setResolution(dn[0]/bi[s.getProjection().getUnits()]/Math.pow(2,n.zoom)),(!s.getCenter()||s.getZoom()===void 0)&&s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",n),e.set("mapbox-metadata",{styleUrl:t,options:i});const o=n.layers;let a=[],l,c,u;for(let h=0,f=o.length;h<f;++h){const d=K_(o,o[h]),g=d.type;if(cI.includes(g))u=d.source,(!u||u!=c)&&(a.length&&(r.push(Q_(l,a,n,t,e,i)),a=[]),l=vI(n,t,d,i),l instanceof ic||l instanceof Jo||(a=[]),c=l.get("mapbox-source")),a.push(d.id);else{console.warn(`layers[${h}].type "${g}" not supported`);continue}}return r.push(Q_(l,a,n,t,e,i)),Promise.all(r)}function wI(n,e,t={}){let i,r;if(vt){if(!(n instanceof is)&&!(n instanceof Mi))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");r=n}else typeof n=="string"||n instanceof HTMLElement?r=new is({target:n}):r=n;if(typeof e=="string"){const s=e.startsWith("data:")?location.href:sc(e,t.accessToken);t=$_(s,t),i=new Promise(function(o,a){k_(e,t).then(function(l){J_(l,r,s,t).then(function(){o(r)}).catch(a)}).catch(function(l){a(new Error(`Could not load ${e}: ${l.message}`))})})}else i=new Promise(function(s,o){J_(e,r,!t.styleUrl||t.styleUrl.startsWith("data:")?location.href:sc(t.styleUrl,t.accessToken),t).then(function(){s(r)}).catch(o)});return i}function Q_(n,e,t,i,r,s={}){let o=24,a=0;const l=t.layers;for(let c=0,u=l.length;c<u;++c){const h=l[c];e.indexOf(h.id)!==-1&&(o=Math.min("minzoom"in h?h.minzoom:0,o),a=Math.max("maxzoom"in h?h.maxzoom:24,a))}return new Promise(function(c,u){const h=function(){const d=n.getSource();if(!d||d.getState()==="error"){u(new Error("Error accessing data for source "+n.get("mapbox-source")));return}if("getTileGrid"in d){const g=d.getTileGrid();if(g){const p=g.getMinZoom();(o>0||p>0)&&n.setMaxResolution(Math.min(ea(Math.max(0,o-1e-12),dn),ea(Math.max(0,p-1e-12),g.getResolutions()))),a<24&&n.setMinResolution(ea(a,dn))}}else o>0&&n.setMaxResolution(ea(Math.max(0,o-1e-12),dn));d instanceof Cs||d instanceof Af?hI(n,t,e,Object.assign({styleUrl:i},s)).then(function(){xI(n,r,Gf(t)),c()}).catch(u):c()};n.set("mapbox-layers",e);const f=r.getLayers();f.getArray().indexOf(n)===-1&&f.push(n),n.getSource()?h():n.once("change:source",h)})}const EI="EPSG:3857",bI=[9.254419,50.102223],CI=({centre:n,map:e,style:t,target:i}={})=>{const r=wa(e);ow();const s=()=>{const l=Ns(t);if(l){const c=new Mi;return wI(c,l),c}else return new Nh({source:new mC})},o=()=>new un({center:Ns(n)||bI,minZoom:1,projection:EI,zoom:4}),a=()=>{r.value||(r.value=new is),r.value.setTarget(i),r.value.setView(o()),r.value.setLayers([s()])};return pi(wa(t),()=>{r.value?.setLayers([s()])}),Gd(()=>{a()}),{map:r}};class TI extends Cs{constructor(e){e=e||{},super({attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=e.distance!==void 0?e.distance:20,this.minDistance=e.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=e.geometryFunction||function(t){const i=t.getGeometry();return Oe(!i||i.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),i},this.createCustomCluster_=e.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(e.source||null)}clear(e){this.features.length=0,super.clear(e)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(e,t,i){this.source?.loadFeatures(e,t,i),t!==this.resolution&&(this.resolution=t,this.refresh())}setDistance(e){this.updateDistance(e,this.minDistance)}setMinDistance(e){this.updateDistance(this.distance,e)}getMinDistance(){return this.minDistance}setSource(e){this.source&&this.source.removeEventListener(de.CHANGE,this.boundRefresh_),this.source=e,e&&e.addEventListener(de.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(e,t){const i=e===0?0:Math.min(t,e)/e,r=e!==this.distance||this.interpolationRatio!==i;this.distance=e,this.minDistance=t,this.interpolationRatio=i,r&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const e=Bt(),t=this.distance*this.resolution,i=this.source.getFeatures(),r={};for(let s=0,o=i.length;s<o;s++){const a=i[s];if(!(_e(a)in r)){const l=this.geometryFunction(a);if(l){const c=l.getCoordinates();cu(c,e),Vn(e,t,e);const u=this.source.getFeaturesInExtent(e).filter(function(h){const f=_e(h);return f in r?!1:(r[f]=!0,!0)});this.features.push(this.createCluster(u,e))}}}}createCluster(e,t){const i=[0,0];for(let a=e.length-1;a>=0;--a){const l=this.geometryFunction(e[a]);l?Hg(i,l.getCoordinates()):e.splice(a,1)}Jg(i,1/e.length);const r=zt(t),s=this.interpolationRatio,o=new Zn([i[0]*(1-s)+r[0]*s,i[1]*(1-s)+r[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,e):new ws({geometry:o,features:e})}}const RI=({data:n,map:e,pointIconSrc:t}={})=>{const i=wa(e),r=Ki(()=>n.value.features.map(c=>new ws({geometry:new Zn(c.geometry.coordinates),name:c.id}))),s={},o=c=>{const h=c.get("features").length;return s[h]||(t&&h===1?s[h]=new At({image:new hr({src:t,width:32,height:32})}):s[h]=new At({image:new ts({radius:14,stroke:new Qn({color:"#000"}),fill:new Qt({color:"#000"})}),text:new Ao({text:h.toString(),fill:new Qt({color:"#fff"}),font:'700 0.875rem "Open Sans", "Arial", sans-serif'})})),s[h]},a=()=>new ic({source:new TI({distance:Number.parseInt(40,10),minDistance:Number.parseInt(20,10),source:new Cs({features:r.value})}),style:o}),l=()=>{n.value?.features?.length===1&&i.value.getView().setCenter(n.value.features[0].geometry.coordinates)};Cx(()=>{i.value&&n.value&&(i.value.addLayer(a()),l())})},SI="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2058_7122)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%2012C10.9%2012%2010%2011.1%2010%2010C10%208.9%2010.9%208%2012%208C13.1%208%2014%208.9%2014%2010C14%2011.1%2013.1%2012%2012%2012ZM12%202C16.2%202%2020%205.22%2020%2010.2C20%2013.52%2017.33%2017.45%2012%2022C6.67%2017.45%204%2013.52%204%2010.2C4%205.22%207.8%202%2012%202Z'%20fill='black'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2058_7122'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Kf="europeana-map-map",II={__name:"EuropeanaMap",props:{json:{type:String,default:null},style:{type:String,default:null},url:{type:String,default:null}},setup(n){const e=Fr("map",null),t=Fr("config",null),i=n,r=kc(null),s=Ki(()=>i.url||t?.value?.url),o=Ki(()=>i.json||t?.value?.json),a=Ki(()=>i.style||t?.value?.style);if(o.value)r.value=JSON.parse(o.value);else if(s.value)Gb(s.value).json().then(l=>{r.value=l.data.value});else throw new Error("No data JSON or URL supplied.");return CI({map:e,style:a,target:Kf}),RI({data:r,map:e,pointIconSrc:SI}),(l,c)=>(f1(),p1("div",{id:Kf,class:ha(Kf)}))}};class MI{#t;#n;#e=ya({});constructor(e,t={}){this.#n=new is,this.#e.url=t.url,this.#e.style=t.style,this.#e.json=t.json,this.#t=nv(II),this.#t.provide("config",Ki(()=>this.#e)),this.#t.provide("map",this.#n),this.#t.mount(e)}get config(){return this.#e}get app(){return this.#t}get olMap(){return this.#n}set(e,t){Object.hasOwn(this.config,e)&&(this.#e[e]=t)}}return MI})();
|
|
21
|
+
`,""),q.push(Me[Fe],fe);return q},[]):V=Bf(Z,R).trim(),he=te(M,"paint","text-opacity",F,g,P)}if(V&&he&&!O){E||(++oe,k=y[oe],(!k||!k.getText()||k.getFill()||k.getStroke())&&(k=new At,y[oe]=k),k.setImage(void 0),k.setGeometry(void 0));const Y=U_(M,F,"text",g);k.getText()||k.setText(b),b=k.getText(),(!b||"getDeclutterMode"in b&&b.getDeclutterMode()!==Y)&&(b=new Ao({padding:[2,2,2,2],declutterMode:Y}),k.setText(b));const Z=te(M,"layout","text-transform",F,g,P);Z=="uppercase"?V=Array.isArray(V)?V.map((Je,Vt)=>Vt%2?Je:Je.toUpperCase()):V.toUpperCase():Z=="lowercase"&&(V=Array.isArray(V)?V.map((Je,Vt)=>Vt%2?Je:Je.toLowerCase()):V.toLowerCase());const q=Array.isArray(V)?V:B==2?Wf(V,ee):Xf(V,U,Q,ee);if(b.setText(q),b.setFont(U),b.setRotation(jf(te(M,"layout","text-rotate",F,g,P))),typeof b.setKeepUpright=="function"){const Je=te(M,"layout","text-keep-upright",F,g,P);b.setKeepUpright(Je)}const ae=te(M,"layout","text-anchor",F,g,P),ce=E||B==1?"point":te(M,"layout","symbol-placement",F,g,P);let se;if(ce==="line-center"?(b.setPlacement("line"),se="center"):b.setPlacement(ce),ce==="line"&&typeof b.setRepeat=="function"){const Je=te(M,"layout","symbol-spacing",F,g,P);b.setRepeat(Je*2)}b.setOverflow(ce==="point");let fe=te(M,"paint","text-halo-width",F,g,P);const Me=te(M,"layout","text-offset",F,g,P),Fe=te(M,"paint","text-translate",F,g,P);let $e=0,Tt=0;if(ce=="point"){se="center",ae.indexOf("left")!==-1?(se="left",Tt=fe):ae.indexOf("right")!==-1&&(se="right",Tt=-fe);const Je=te(M,"layout","text-rotation-alignment",F,g,P);b.setRotateWithView(Je=="map")}else b.setMaxAngle(jf(te(M,"layout","text-max-angle",F,g,P))*V.length/q.length),b.setRotateWithView(!1);b.setTextAlign(se);let ke="middle";ae.indexOf("bottom")==0?(ke="bottom",$e=-fe-.5*($-1)*N):ae.indexOf("top")==0&&(ke="top",$e=fe+.5*($-1)*N),b.setTextBaseline(ke);const Ve=te(M,"layout","text-justify",F,g,P);b.setJustify(Ve==="auto"?void 0:Ve),b.setOffsetX(Me[0]*N+Tt+Fe[0]),b.setOffsetY(Me[1]*N+$e+Fe[1]);const je=b.getFill()||new Qt;je.setColor(ji(te(M,"paint","text-color",F,g,P),he)),b.setFill(je);const ut=ji(te(M,"paint","text-halo-color",F,g,P),he);if(ut&&fe>0){const Je=b.getStroke()||new Qn;Je.setColor(ut),fe*=2;const Vt=.5*N;Je.setWidth(fe<=Vt?fe:Vt),b.setStroke(Je)}else b.setStroke(void 0);const Ot=te(M,"layout","text-padding",F,g,P),Lt=b.getPadding();Ot!==Lt[0]&&(Lt[0]=Ot,Lt[1]=Ot,Lt[2]=Ot,Lt[3]=Ot),k.setZIndex(He)}}}if(oe>-1)return y.length=oe+1,y};return n.setStyle(_),n.set("mapbox-layers",h),n.set("mapbox-source",m),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),_}const QS=Qe.parse("#000000"),eI=Qe.parse("#FFFFFF"),tI=Qe.parse("#000000");function nI(n){return new Of({source:new kf({operationType:"image",operation:zS,sources:[n]})})}function iI(n){return new Of({source:new kf({operationType:"image",operation:NS,sources:[n]})})}function rI(n,e,t,i){n.getSource().on("beforeoperations",function(r){Ft.zoom=cc(r.resolution,t.resolutions||dn),Ft.distanceFromCenter=0;const s=r.data;s.saturation=te(e,"paint","raster-saturation",at,i),s.contrast=te(e,"paint","raster-contrast",at,i),s.brightnessHigh=te(e,"paint","raster-brightness-max",at,i),s.brightnessLow=te(e,"paint","raster-brightness-min",at,i),s.hueRotate=te(e,"paint","raster-hue-rotate",at,i)})}function sI(n,e,t,i,r){n.getSource().on("beforeoperations",function(s){const o=s.data;o.resolution=wu(i.projection||"EPSG:3857",s.resolution,zt(s.extent),"m");const a=cc(s.resolution,i.resolutions||dn);Ft.zoom=a,Ft.distanceFromCenter=0,o.zoom=a,o.encoding=e.encoding,o.method=te(t,"paint","hillshade-method",at,r)||"standard",o.exaggeration=te(t,"paint","hillshade-exaggeration",at,r);let l=te(t,"paint","hillshade-illumination-direction",at,r);l==null&&(l=335),o.azimuths=Array.isArray(l)?l:[l],o.sunAz=o.azimuths[0];let c=te(t,"paint","hillshade-illumination-altitude",at,r);c==null&&(c=45),o.altitudes=Array.isArray(c)?c:[c];function u(f){return f&&f.values?f.values[0]:f}function h(f){const d=t.paint?.[f];if(Array.isArray(d)&&d.length>0&&typeof d[0]=="string"&&Qe.parse(d[0])!==void 0)return d.map(p=>Qe.parse(p));let g=te(t,"paint",f,at,r);return g=u(g),g?[g]:void 0}o.highlightColors=h("hillshade-highlight-color"),o.highlightColor=o.highlightColors?.[0]||eI,o.highlightColors||(o.highlightColors=[o.highlightColor]),o.shadowColors=h("hillshade-shadow-color"),o.shadowColor=o.shadowColors?.[0]||QS,o.shadowColors||(o.shadowColors=[o.shadowColor]),o.accentColor=u(te(t,"paint","hillshade-accent-color",at,r))||tI})}const oI=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];function aI(n,e,t){let i=null;return function(r){n.paint&&"raster-opacity"in n.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete t[n.id],lI(n,e,i,t))}}function lI(n,e,t,i){Ft.zoom=t,Ft.distanceFromCenter=0;const r=te(n,"paint","raster-opacity",at,i);e.setOpacity(r)}const cI=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function uI(n,e=512){return n.getExtent()?El({extent:n.getExtent(),tileSize:e,maxZoom:22}).getResolutions():dn}function $_(n,e){return e.accessToken||(e=Object.assign({},e),new URL(n).searchParams.forEach((i,r)=>{e.accessToken=i,e.accessTokenParam=r})),e}function hI(n,e,t="",i={},r=void 0){let s,o,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,i=a):l=t,typeof i=="string"?(s=i,a={}):(s=i.styleUrl,a=i),a.updateSource===!1&&(c=!1),r||(r=a.resolutions),!s&&typeof e=="string"&&!e.trim().startsWith("{")&&(s=e),s&&(s=s.startsWith("data:")?location.href:sc(s,a.accessToken),a=$_(s,a)),new Promise(function(u,h){k_(e,a).then(function(f){if(f.version!=8)return h(new Error("glStyle version 8 required."));if(!(n instanceof ic||n instanceof Jo))return h(new Error("Can only apply to VectorLayer or VectorTileLayer"));const d=n instanceof Jo?"vector":"geojson";if(l?Array.isArray(l)?o=f.layers.find(function(x){return x.id===l[0]}).source:o=l:(o=f.layers.find(function(x){return x.source&&f.sources[x.source].type===d}).source,l=o),!o)return h(new Error(`No ${d} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(n instanceof Jo)return Z_(f.sources[o],s,a).then(function(R){const C=n.getSource();C?R!==C&&(C.setTileUrlFunction(R.getTileUrlFunction()),typeof C.setUrls=="function"&&typeof R.getUrls=="function"&&C.setUrls(R.getUrls()),C.format_||(C.format_=R.format_),C.getAttributions()||C.setAttributions(R.getAttributions()),C.getTileLoadFunction()===b_&&C.setTileLoadFunction(R.getTileLoadFunction()),Et(C.getProjection(),R.getProjection())&&(C.tileGrid=R.getTileGrid())):n.setSource(R);const S=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&S.getMinZoom()>0&&n.setMaxResolution(ea(Math.max(0,S.getMinZoom()-1e-12),S.getResolutions()))});const x=f.sources[o];let w=n.getSource();(!w||w.get("mapbox-source")!==x)&&(w=H_(x,s,a));const T=n.getSource();return T?w!==T&&(T.getAttributions()||T.setAttributions(w.getAttributions()),T.format_||(T.format_=w.getFormat()),T.url_=w.getUrl()):n.setSource(w),Promise.resolve()}let p,m;const y={},_={};function v(){if(!m&&(!f.sprite||y)){if(a.projection&&!r){const R=Le(a.projection).getUnits();R!=="m"&&(r=dn.map(C=>C/bi[R]))}let x;const w=n.getSource();w instanceof Af&&w.format_ instanceof Qy&&(x=w.format_.layerName_),m=JS(n,f,l,r,y,_,(T,R=a.webfonts)=>$S(T,R),a.getImage,x),n.getStyle()?g().then(u).catch(h):h(new Error(`Nothing to show for source [${o}]`))}else m?(n.setStyle(m),g().then(u).catch(h)):h(new Error("Something went wrong trying to apply style."))}if(f.sprite){const x=ES(f.sprite,a.accessToken,s||location.href);p=vt?1:window.devicePixelRatio>=1.5?.5:1;const w=p==.5?"@2x":"";Promise.all(x.map(function(T){const R=new URL(T.url);let C=R.origin+R.pathname+w+".json"+R.search;return new Promise(function(S,L){Rs("Sprite",C,a).then(S).catch(function(B){C=R.origin+R.pathname+".json"+R.search,Rs("Sprite",C,a).then(S).catch(L)})}).then(function(S){S===void 0&&h(new Error("No sprites found."));let L;if(L=R.origin+R.pathname+w+".png"+R.search,a.transformRequest){const B=a.transformRequest(L,"SpriteImage")||L;(B instanceof Request||B instanceof Promise)&&(L=B)}_[T.id]=L;for(const B in S){const K=T.id=="default"?B:`${T.id}:${B}`;y[K]=S[B]}}).catch(function(S){h(new Error(`Sprites cannot be loaded: ${C}: ${S.message}`))})})).then(v).catch(h)}else v()}).catch(h)})}const fI=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function K_(n,e){if(!e.ref)return e;const t=n.find(r=>r.id===e.ref);if(!t)return e;const i=Object.assign({},e);for(const r of fI)!(r in i)&&r in t&&(i[r]=t[r]);return i}function dI(n,e){const t=n.bounds;if(t){const i=bu([t[0],t[1]],e),r=bu([t[2],t[3]],e);return[i[0],i[1],r[0],r[1]]}return Le(e).getExtent()}function Y_(n,e,t){const i=new y_({tileJSON:e,tileSize:n.tileSize||e.tileSize||512}),r=i.getTileJSON(),s=i.getTileGrid(),o=Le(t.projection||"EPSG:3857"),a=dI(r,o),l=o.getExtent(),c=r.minzoom||0,u=r.maxzoom||22,h={attributions:i.getAttributions(),projection:o,tileGrid:new wl({origin:l?$n(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:uI(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?h.urls=r.tiles:h.url=r.tiles,h}function gI(n,e,t,i){const r={id:n.id,type:n.type},s=n.paint||{};r.paint=s,Ft.zoom=cc(e,t.resolutions||dn),Ft.distanceFromCenter=0;let o;const a=te(r,"paint","background-color",at,i);return s["background-opacity"]!==void 0&&(o=te(r,"paint","background-opacity",at,i)),te(r,"layout","visibility",at,i)==="none"?void 0:ji(a,o)}function pI(n,e,t){const i=vt?{style:{}}:document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new Zr({source:new ls({}),render(r){const s=gI(n,r.viewState.resolution,e,t);return i.style.backgroundColor=s,i}})}function Z_(n,e,t){return new Promise(function(i,r){z_(n,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=Y_(n,s,t);a.tileLoadFunction=o,a.format=new Qy({layerName:"mvt:layer"});const l=new Af(a);l.set("mapbox-source",n),i(l)}).catch(r)})}function mI(n,e,t){const i=new Jo({declutter:!0,visible:!1});return Z_(n,e,t).then(function(r){i.setSource(r)}).catch(function(r){i.setSource(void 0)}),i}function q_(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function yI(n,e,t){return new Promise(function(i,r){z_(n,e,t).then(function({tileJson:s,tileLoadFunction:o}){const a=new y_({interpolate:t.interpolate===void 0?!0:t.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:s});a.tileGrid=Y_(n,s,t).tileGrid,t.projection&&(a.projection=Le(t.projection));const l=a.getTileUrlFunction();o&&a.setTileLoadFunction(o),a.setTileUrlFunction(function(c,u,h){const f=q_(h);let d=l(c,u,h);if(d.indexOf(f)!=-1){const g=a.getTileGrid().getTileCoordExtent(c);d=d.replace(f,g.toString())}return d}),a.set("mapbox-source",n),i(a)}).catch(function(s){r(s)})})}function $f(n,e,t){const i=new Nh;return yI(n,e,t).then(function(r){i.setSource(r)}).catch(function(){i.setSource(void 0)}),i}function H_(n,e,t){const i=t.projection?new Zy({dataProjection:t.projection}):new Zy,r=n.data,s={};if(typeof r=="string"){const[a]=oc(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(h,f,d)=>{const g=q_(d);return a.replace(g,`${h.join(",")}`)},u=new Cs({attributions:n.attribution,format:i,loader:(h,f,d,g,p)=>{const m=typeof c=="function"?c(h,f,d):c;Rs("GeoJSON",m,t).then(y=>{const _=u.getFormat().readFeatures(y,{featureProjection:d});u.addFeatures(_),g(_)}).catch(y=>{u.removeLoadedExtent(h),p()})},strategy:yS});return u.set("mapbox-source",n),u}const l=new Cs({attributions:n.attribution,format:i,url:a,loader:(c,u,h,f,d)=>{Rs("GeoJSON",a,t).then(g=>{const p=l.getFormat().readFeatures(g,{featureProjection:h});l.addFeatures(p),f(p)}).catch(g=>{l.removeLoadedExtent(c),d()})}});return l}s.features=i.readFeatures(r,{featureProjection:oo()||"EPSG:3857"});const o=new Cs(Object.assign({attributions:n.attribution,format:i},s));return o.set("mapbox-source",n),o}function _I(n,e,t){return new ic({declutter:!0,source:H_(n,e,t),visible:!1})}function xI(n,e,t){function i(){const r=e.get("mapbox-style");if(!r)return;const s=Ym(r.layers),o=n.get("mapbox-layers"),a=s.filter(function(l){return o.includes(l.id)}).some(function(l){return!l.layout||te(l,"layout","visibility",at,t)==="visible"});n.get("visible")!==a&&n.setVisible(a)}n.on("change",i),i()}function vI(n,e,t,i){t=K_(n.layers,t);const r=Gf(n),s=t.type;let o=t.source;const a=n.sources[o];let l;if(s=="background")l=pI(t,i,r),o=void 0;else if(a.type=="vector")l=mI(a,e,i);else if(a.type=="raster"){if(!!Object.keys(t.paint||{}).find(u=>oI.includes(u))){const u=$f(a,e,i);l=nI(u),rI(l,t,i,r)}else l=$f(a,e,i);l.setVisible(t.layout?te(t,"layout","visibility",at,r)!=="none":!0),l.on("prerender",aI(t,l,r))}else if(a.type=="geojson")l=_I(a,e,i);else if(a.type=="raster-dem"&&t.type=="hillshade"){const c=$f(a,e,i);l=iI(c),sI(l,a,t,i,r),l.setVisible(t.layout?te(t,"layout","visibility",at,r)!=="none":!0)}return l&&l.set("mapbox-source",o),l}function J_(n,e,t,i){n.schema&&Object.assign(Pf,Object.keys(n.schema).reduce((h,f)=>(h[f]=n.schema[f]?.default,h),{}));const r=[];let s=null;if(e instanceof is){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const h=i.projection?Le(i.projection):s.getProjection();s=new un(Object.assign(s.getProperties(),{maxResolution:dn[0]/bi[h.getUnits()],projection:i.projection||s.getProjection()})),e.setView(s)}"center"in n&&!s.getCenter()&&s.setCenter(bu(n.center,s.getProjection())),"zoom"in n&&s.getZoom()===void 0&&s.setResolution(dn[0]/bi[s.getProjection().getUnits()]/Math.pow(2,n.zoom)),(!s.getCenter()||s.getZoom()===void 0)&&s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",n),e.set("mapbox-metadata",{styleUrl:t,options:i});const o=n.layers;let a=[],l,c,u;for(let h=0,f=o.length;h<f;++h){const d=K_(o,o[h]),g=d.type;if(cI.includes(g))u=d.source,(!u||u!=c)&&(a.length&&(r.push(Q_(l,a,n,t,e,i)),a=[]),l=vI(n,t,d,i),l instanceof ic||l instanceof Jo||(a=[]),c=l.get("mapbox-source")),a.push(d.id);else{console.warn(`layers[${h}].type "${g}" not supported`);continue}}return r.push(Q_(l,a,n,t,e,i)),Promise.all(r)}function wI(n,e,t={}){let i,r;if(vt){if(!(n instanceof is)&&!(n instanceof Mi))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");r=n}else typeof n=="string"||n instanceof HTMLElement?r=new is({target:n}):r=n;if(typeof e=="string"){const s=e.startsWith("data:")?location.href:sc(e,t.accessToken);t=$_(s,t),i=new Promise(function(o,a){k_(e,t).then(function(l){J_(l,r,s,t).then(function(){o(r)}).catch(a)}).catch(function(l){a(new Error(`Could not load ${e}: ${l.message}`))})})}else i=new Promise(function(s,o){J_(e,r,!t.styleUrl||t.styleUrl.startsWith("data:")?location.href:sc(t.styleUrl,t.accessToken),t).then(function(){s(r)}).catch(o)});return i}function Q_(n,e,t,i,r,s={}){let o=24,a=0;const l=t.layers;for(let c=0,u=l.length;c<u;++c){const h=l[c];e.indexOf(h.id)!==-1&&(o=Math.min("minzoom"in h?h.minzoom:0,o),a=Math.max("maxzoom"in h?h.maxzoom:24,a))}return new Promise(function(c,u){const h=function(){const d=n.getSource();if(!d||d.getState()==="error"){u(new Error("Error accessing data for source "+n.get("mapbox-source")));return}if("getTileGrid"in d){const g=d.getTileGrid();if(g){const p=g.getMinZoom();(o>0||p>0)&&n.setMaxResolution(Math.min(ea(Math.max(0,o-1e-12),dn),ea(Math.max(0,p-1e-12),g.getResolutions()))),a<24&&n.setMinResolution(ea(a,dn))}}else o>0&&n.setMaxResolution(ea(Math.max(0,o-1e-12),dn));d instanceof Cs||d instanceof Af?hI(n,t,e,Object.assign({styleUrl:i},s)).then(function(){xI(n,r,Gf(t)),c()}).catch(u):c()};n.set("mapbox-layers",e);const f=r.getLayers();f.getArray().indexOf(n)===-1&&f.push(n),n.getSource()?h():n.once("change:source",h)})}const EI="EPSG:3857",bI=[9.254419,50.102223],CI=({centre:n,map:e,style:t,target:i}={})=>{const r=wa(e);ow();const s=()=>{const l=Ns(t);if(l){const c=new Mi;return wI(c,l),c}else return new Nh({source:new mC})},o=()=>new un({center:Ns(n)||bI,minZoom:1,projection:EI,zoom:4}),a=()=>{r.value||(r.value=new is),r.value.setTarget(i),r.value.setView(o()),r.value.setLayers([s()])};return pi(wa(t),()=>{r.value?.setLayers([s()])}),Gd(()=>{a()}),{map:r}};class TI extends Cs{constructor(e){e=e||{},super({attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=e.distance!==void 0?e.distance:20,this.minDistance=e.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=e.geometryFunction||function(t){const i=t.getGeometry();return Oe(!i||i.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),i},this.createCustomCluster_=e.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(e.source||null)}clear(e){this.features.length=0,super.clear(e)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(e,t,i){this.source?.loadFeatures(e,t,i),t!==this.resolution&&(this.resolution=t,this.refresh())}setDistance(e){this.updateDistance(e,this.minDistance)}setMinDistance(e){this.updateDistance(this.distance,e)}getMinDistance(){return this.minDistance}setSource(e){this.source&&this.source.removeEventListener(de.CHANGE,this.boundRefresh_),this.source=e,e&&e.addEventListener(de.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(e,t){const i=e===0?0:Math.min(t,e)/e,r=e!==this.distance||this.interpolationRatio!==i;this.distance=e,this.minDistance=t,this.interpolationRatio=i,r&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const e=Bt(),t=this.distance*this.resolution,i=this.source.getFeatures(),r={};for(let s=0,o=i.length;s<o;s++){const a=i[s];if(!(_e(a)in r)){const l=this.geometryFunction(a);if(l){const c=l.getCoordinates();cu(c,e),Vn(e,t,e);const u=this.source.getFeaturesInExtent(e).filter(function(h){const f=_e(h);return f in r?!1:(r[f]=!0,!0)});this.features.push(this.createCluster(u,e))}}}}createCluster(e,t){const i=[0,0];for(let a=e.length-1;a>=0;--a){const l=this.geometryFunction(e[a]);l?Hg(i,l.getCoordinates()):e.splice(a,1)}Jg(i,1/e.length);const r=zt(t),s=this.interpolationRatio,o=new Zn([i[0]*(1-s)+r[0]*s,i[1]*(1-s)+r[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,e):new ws({geometry:o,features:e})}}const RI=({data:n,map:e,pointIconSrc:t}={})=>{const i=wa(e),r=Ki(()=>n.value.features.map(c=>new ws({geometry:new Zn(c.geometry.coordinates),name:c.id}))),s={},o=c=>{const h=c.get("features").length;return s[h]||(t&&h===1?s[h]=new At({image:new hr({src:t,width:32,height:32})}):s[h]=new At({image:new ts({radius:14,stroke:new Qn({color:"#000"}),fill:new Qt({color:"#000"})}),text:new Ao({text:h.toString(),fill:new Qt({color:"#fff"}),font:'700 0.875rem "Open Sans", "Arial", sans-serif'})})),s[h]},a=()=>new ic({source:new TI({distance:Number.parseInt(40,10),minDistance:Number.parseInt(20,10),source:new Cs({features:r.value})}),style:o}),l=()=>{n.value?.features?.length===1&&i.value.getView().setCenter(n.value.features[0].geometry.coordinates)};Cx(()=>{i.value&&n.value&&(i.value.addLayer(a()),l())})},SI="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2058_7122)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%2012C10.9%2012%2010%2011.1%2010%2010C10%208.9%2010.9%208%2012%208C13.1%208%2014%208.9%2014%2010C14%2011.1%2013.1%2012%2012%2012ZM12%202C16.2%202%2020%205.22%2020%2010.2C20%2013.52%2017.33%2017.45%2012%2022C6.67%2017.45%204%2013.52%204%2010.2C4%205.22%207.8%202%2012%202Z'%20fill='black'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2058_7122'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Kf="europeana-map-map",II={__name:"EuropeanaMap",props:{json:{type:String,default:null},style:{type:String,default:null},url:{type:String,default:null}},setup(n){const e=Fr("map",null),t=Fr("config",null),i=n,r=kc(null),s=Ki(()=>i.url||t?.value?.url),o=Ki(()=>i.json||t?.value?.json),a=Ki(()=>i.style||t?.value?.style);if(o.value)r.value=JSON.parse(o.value);else if(s.value)Gb(s.value).json().then(l=>{r.value=l.data.value});else throw new Error("No data JSON or URL supplied.");return CI({map:e,style:a,target:Kf}),RI({data:r,map:e,pointIconSrc:SI}),(l,c)=>(f1(),p1("div",{id:Kf,class:ha(Kf)}))}};class MI{#t;#n;#e=ya({});constructor(e,t={}){this.#n=new is,this.#e.url=t.url,this.#e.style=t.style,this.#e.json=t.json,this.#t=nv(II),this.#t.provide("config",Ki(()=>this.#e)),this.#t.provide("map",this.#n),this.#t.mount(e)}get config(){return this.#e}get app(){return this.#t}get olMap(){return this.#n}set(e,t){Object.hasOwn(this.#e,e)&&(this.#e[e]=t)}}return MI})();
|
|
22
22
|
//# sourceMappingURL=europeana-map.app.iife.js.map
|