UNPKG

rlayers

Version:

React Components for OpenLayers

1 lines 60.5 kB
var rlayers=function(t,e,s,i,r,o,n,l,a,c,h,u,p,d,f,v,g,m,y,b,w,O,x,S,L,P,R,E,j,k,z,T,F,_,A,C,M){"use strict";function D(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var I=D(s),W=D(r),U=D(l),B=D(c),V=D(h),G=D(u),H=D(p),N=D(d),Z=D(f),X=D(v),$=D(g),Y=D(y),q=D(b),K=D(O),J=D(x),Q=D(S),tt=D(L),et=D(P),st=D(R),it=D(E),rt=D(j),ot=D(k),nt=D(z),lt=D(T),at=D(F),ct=D(_),ht=D(A),ut=D(C),pt=D(M);const dt=W.default.createContext({});const ft="undefined"==typeof process||void 0===process.env.RLAYERS_DEBUG?()=>{}:console.debug.bind(window.console),vt="_rlayers_handlers";class gt extends W.default.PureComponent{static getOLObject(t,e){let s=e.get(t);return void 0===s&&(s={},e.set(t,s)),s}get handlers(){return gt.getOLObject(vt,this.ol)}getCurrentEvents(){return Object.keys(this.props).filter((t=>t.startsWith("on"))).map((t=>({event:t.toLowerCase().slice(2),prop:t}))).reduce(((t,e)=>Object.assign(Object.assign({},t),{[e.event]:this.props[e.prop]})),{})}getHandlerProp(t){for(const e of Object.keys(this.props))if(e.toLowerCase()==="on"+t)return e}incrementHandlers(t){}decrementHandlers(t){}attachEventHandlers(){var t;const e=this.handlers,s=Object.keys(null!=e?e:{}),i=null!==(t=this.eventSources)&&void 0!==t?t:[this.ol],r=this.getCurrentEvents(),o=Object.keys(r),n=o.concat(s.filter((t=>!o.includes(t))));for(const t of n){if(void 0!==e[t]&&void 0===r[t]){ft("removing previously installed handler",this,t,e[t]);for(const s of i)s.un(t,e[t]);e[t]=void 0,this.decrementHandlers(t)}if(void 0===e[t]&&void 0!==r[t]){ft("installing handler",this,t,r[t]);const s=this.getHandlerProp(t);if(!s)throw new Error("Internal error");e[t]=t=>this.props[s].call(this,t);for(const s of i)s.on(t,e[t]);this.incrementHandlers(t)}}}attachOldEventHandlers(t){const e=this.handlers,s=this.getCurrentEvents();for(const i of Object.keys(s))s[i]&&(ft("reinstalling existing handler",this,i,s[i]),t.on(i,e[i]))}refresh(t){this.attachEventHandlers()}on(t,e){this.ol.on(t,e),this.incrementHandlers(t)}un(t,e){this.decrementHandlers(t),this.ol.un(t,e)}componentDidMount(){ft("didMount",this),this.refresh()}propsDiff(t){if(null===this.props||null===t)return this.props!==t&&(ft("null props differ",this.props,t),!0);for(const e of Object.keys(this.props))if(this.props[e]!==t[e])return ft("because of",e,this.props[e],t[e]),!0;return!1}componentDidUpdate(t,e,s){this.props!==t&&(ft("willRefresh",this,t,this.props),this.refresh(t))}componentWillUnmount(){var t;const e=this.handlers;ft("willUnmount",this,e);const s=null!==(t=this.eventSources)&&void 0!==t?t:[this.ol];for(const t of Object.keys(null!=e?e:{}))if(ft("cleaning up handler",this,t,e[t]),e[t]){for(const i of s)i.un(t,e[t]);e[t]=void 0,this.decrementHandlers(t)}}render(){return null}}gt.contextType=dt;class mt extends gt{constructor(t,e){var s,i;if(super(t,e),!(null===(i=null===(s=this.context)||void 0===s?void 0:s.map)||void 0===i?void 0:i.addLayer))throw new Error("A layer must be part of a map")}refresh(t){super.refresh(t);for(const e of["visible","opacity","zIndex","minResolution","maxResolution","minZoom","maxZoom"]){const s=e.charAt(0).toUpperCase()+e.substring(1);this.props[e]!==(t&&t[e])&&this.ol["set"+s](this.props[e])}this.source&&this.props.attributions&&this.source.setAttributions(this.props.attributions),this.props.properties&&this.ol.setProperties(this.props.properties)}componentDidMount(){super.componentDidMount(),this.context.map.addLayer(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeLayer(this.ol)}render(){return W.default.createElement("div",{className:"_rlayers_RLayer"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.source,rLayer:this})},this.props.children))}}class yt extends mt{}const bt="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,wt="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new St}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Ot="function"==typeof AbortSignal,xt="function"==typeof wt.AbortSignal,St=Ot?AbortSignal:xt?wt.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){"abort"===t.type&&(this.aborted=!0,this.onabort(t),this._listeners.forEach((e=>e(t)),this))}onabort(){}addEventListener(t,e){"abort"===t&&this._listeners.push(e)}removeEventListener(t,e){"abort"===t&&(this._listeners=this._listeners.filter((t=>t!==e)))}},Lt=new Set,Pt=(t,e)=>{const s=`LRU_CACHE_OPTION_${t}`;jt(s)&&kt(s,`${t} option`,`options.${e}`,At)},Rt=(t,e)=>{const s=`LRU_CACHE_METHOD_${t}`;if(jt(s)){const{prototype:i}=At,{get:r}=Object.getOwnPropertyDescriptor(i,t);kt(s,`${t} method`,`cache.${e}()`,r)}},Et=(...t)=>{"object"==typeof process&&process&&"function"==typeof process.emitWarning?process.emitWarning(...t):console.error(...t)},jt=t=>!Lt.has(t),kt=(t,e,s,i)=>{Lt.add(t);Et(`The ${e} is deprecated. Please use ${s} instead.`,"DeprecationWarning",t,i)},zt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Tt=t=>zt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Ft:null:null;class Ft extends Array{constructor(t){super(t),this.fill(0)}}class _t{constructor(t){if(0===t)return[];const e=Tt(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class At{constructor(t={}){const{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:n,allowStale:l,dispose:a,disposeAfter:c,noDisposeOnSet:h,noUpdateTTL:u,maxSize:p=0,maxEntrySize:d=0,sizeCalculation:f,fetchMethod:v,fetchContext:g,noDeleteOnFetchRejection:m,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:w,ignoreFetchAbort:O}=t,{length:x,maxAge:S,stale:L}=t instanceof At?{}:t;if(0!==e&&!zt(e))throw new TypeError("max option must be a nonnegative integer");const P=e?Tt(e):Array;if(!P)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=p,this.maxEntrySize=d||this.maxSize,this.sizeCalculation=f||x,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=v||null,this.fetchMethod&&"function"!=typeof this.fetchMethod)throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=g,!this.fetchMethod&&void 0!==g)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new P(e),this.prev=new P(e),this.head=0,this.tail=0,this.free=new _t(e),this.initialFill=1,this.size=0,"function"==typeof a&&(this.dispose=a),"function"==typeof c?(this.disposeAfter=c,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!h,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!m,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!O,0!==this.maxEntrySize){if(0!==this.maxSize&&!zt(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!zt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!l||!!L,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!n,this.ttlResolution=zt(i)||0===i?i:1,this.ttlAutopurge=!!r,this.ttl=s||S||0,this.ttl){if(!zt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(0===this.max&&0===this.ttl&&0===this.maxSize)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";if(jt(t)){Lt.add(t);Et("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,At)}}L&&Pt("stale","allowStale"),S&&Pt("maxAge","ttl"),x&&Pt("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Ft(this.max),this.starts=new Ft(this.max),this.setItemTTL=(t,e,s=bt.now())=>{if(this.starts[t]=0!==e?s:0,this.ttls[t]=e,0!==e&&this.ttlAutopurge){const s=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),e+1);s.unref&&s.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?bt.now():0},this.statusTTL=(s,i)=>{s&&(s.ttl=this.ttls[i],s.start=this.starts[i],s.now=t||e(),s.remainingTTL=s.now+s.ttl-s.start)};let t=0;const e=()=>{const e=bt.now();if(this.ttlResolution>0){t=e;const s=setTimeout((()=>t=0),this.ttlResolution);s.unref&&s.unref()}return e};this.getRemainingTTL=s=>{const i=this.keyMap.get(s);return void 0===i?0:0===this.ttls[i]||0===this.starts[i]?1/0:this.starts[i]+this.ttls[i]-(t||e())},this.isStale=s=>0!==this.ttls[s]&&0!==this.starts[s]&&(t||e())-this.starts[s]>this.ttls[s]}updateItemAge(t){}statusTTL(t,e){}setItemTTL(t,e,s){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Ft(this.max),this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t],this.sizes[t]=0},this.requireSize=(t,e,s,i)=>{if(this.isBackgroundFetch(e))return 0;if(!zt(s)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof i)throw new TypeError("sizeCalculation must be a function");if(s=i(e,t),!zt(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return s},this.addItemSize=(t,e,s)=>{if(this.sizes[t]=e,this.maxSize){const e=this.maxSize-this.sizes[t];for(;this.calculatedSize>e;)this.evict(!0)}this.calculatedSize+=this.sizes[t],s&&(s.entrySize=e,s.totalCalculatedSize=this.calculatedSize)}}removeItemSize(t){}addItemSize(t,e){}requireSize(t,e,s,i){if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.tail;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.head);)e=this.prev[e]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.head;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.tail);)e=this.next[e]}isValidIndex(t){return void 0!==t&&this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes())void 0===this.valList[t]||void 0===this.keyList[t]||this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*rentries(){for(const t of this.rindexes())void 0===this.valList[t]||void 0===this.keyList[t]||this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*keys(){for(const t of this.indexes())void 0===this.keyList[t]||this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*rkeys(){for(const t of this.rindexes())void 0===this.keyList[t]||this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*values(){for(const t of this.indexes())void 0===this.valList[t]||this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}*rvalues(){for(const t of this.rindexes())void 0===this.valList[t]||this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}[Symbol.iterator](){return this.entries()}find(t,e){for(const s of this.indexes()){const i=this.valList[s],r=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(void 0!==r&&t(r,this.keyList[s],this))return this.get(this.keyList[s],e)}}forEach(t,e=this){for(const s of this.indexes()){const i=this.valList[s],r=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.keyList[s],this)}}rforEach(t,e=this){for(const s of this.rindexes()){const i=this.valList[s],r=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.keyList[s],this)}}get prune(){return Rt("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),t=!0);return t}dump(){const t=[];for(const e of this.indexes({allowStale:!0})){const s=this.keyList[e],i=this.valList[e],r=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(void 0===r)continue;const o={value:r};if(this.ttls){o.ttl=this.ttls[e];const t=bt.now()-this.starts[e];o.start=Math.floor(Date.now()-t)}this.sizes&&(o.size=this.sizes[e]),t.unshift([s,o])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=bt.now()-t}this.set(e,s.value,s)}}dispose(t,e,s){}set(t,e,{ttl:s=this.ttl,start:i,noDisposeOnSet:r=this.noDisposeOnSet,size:o=0,sizeCalculation:n=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,status:a}={}){if(o=this.requireSize(t,e,o,n),this.maxEntrySize&&o>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.delete(t),this;let c=0===this.size?void 0:this.keyMap.get(t);if(void 0===c)c=this.newIndex(),this.keyList[c]=t,this.valList[c]=e,this.keyMap.set(t,c),this.next[this.tail]=c,this.prev[c]=this.tail,this.tail=c,this.size++,this.addItemSize(c,o,a),a&&(a.set="add"),l=!1;else{this.moveToTail(c);const s=this.valList[c];if(e!==s){if(this.isBackgroundFetch(s)?s.__abortController.abort(new Error("replaced")):r||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(c),this.valList[c]=e,this.addItemSize(c,o,a),a){a.set="replace";const t=s&&this.isBackgroundFetch(s)?s.__staleWhileFetching:s;void 0!==t&&(a.oldValue=t)}}else a&&(a.set="update")}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),l||this.setItemTTL(c,s,i),this.statusTTL(a,c),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max&&0!==this.max?this.evict(!1):0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(!0),t}}evict(t){const e=this.head,s=this.keyList[e],i=this.valList[e];return this.isBackgroundFetch(i)?i.__abortController.abort(new Error("evicted")):(this.dispose(i,s,"evict"),this.disposeAfter&&this.disposed.push([i,s,"evict"])),this.removeItemSize(e),t&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(s),this.size--,e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas,status:s}={}){const i=this.keyMap.get(t);if(void 0!==i){if(!this.isStale(i))return e&&this.updateItemAge(i),s&&(s.has="hit"),this.statusTTL(s,i),!0;s&&(s.has="stale",this.statusTTL(s,i))}else s&&(s.has="miss");return!1}peek(t,{allowStale:e=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(e||!this.isStale(s))){const t=this.valList[s];return this.isBackgroundFetch(t)?t.__staleWhileFetching:t}}backgroundFetch(t,e,s,i){const r=void 0===e?void 0:this.valList[e];if(this.isBackgroundFetch(r))return r;const o=new wt;s.signal&&s.signal.addEventListener("abort",(()=>o.abort(s.signal.reason)));const n={signal:o.signal,options:s,context:i},l=(i,r=!1)=>{const{aborted:l}=o.signal,h=s.ignoreFetchAbort&&void 0!==i;return s.status&&(l&&!r?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,h&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),!l||h||r?(this.valList[e]===c&&(void 0===i?c.__staleWhileFetching?this.valList[e]=c.__staleWhileFetching:this.delete(t):(s.status&&(s.status.fetchUpdated=!0),this.set(t,i,n.options))),i):a(o.signal.reason)},a=i=>{const{aborted:r}=o.signal,n=r&&s.allowStaleOnFetchAbort,l=n||s.allowStaleOnFetchRejection,a=l||s.noDeleteOnFetchRejection;if(this.valList[e]===c){!a||void 0===c.__staleWhileFetching?this.delete(t):n||(this.valList[e]=c.__staleWhileFetching)}if(l)return s.status&&void 0!==c.__staleWhileFetching&&(s.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw i};s.status&&(s.status.fetchDispatched=!0);const c=new Promise(((e,i)=>{this.fetchMethod(t,r,n).then((t=>e(t)),i),o.signal.addEventListener("abort",(()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(e(),s.allowStaleOnFetchAbort&&(e=t=>l(t,!0)))}))})).then(l,(t=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=t),a(t))));return c.__abortController=o,c.__staleWhileFetching=r,c.__returned=null,void 0===e?(this.set(t,c,{...n.options,status:void 0}),e=this.keyMap.get(t)):this.valList[e]=c,c}isBackgroundFetch(t){return t&&"object"==typeof t&&"function"==typeof t.then&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||null===t.__returned)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:n=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,fetchContext:d=this.fetchContext,forceRefresh:f=!1,status:v,signal:g}={}){if(!this.fetchMethod)return v&&(v.fetch="get"),this.get(t,{allowStale:e,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:v});const m={allowStale:e,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:r,noDisposeOnSet:o,size:n,sizeCalculation:l,noUpdateTTL:a,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:p,ignoreFetchAbort:u,status:v,signal:g};let y=this.keyMap.get(t);if(void 0===y){v&&(v.fetch="miss");const e=this.backgroundFetch(t,y,m,d);return e.__returned=e}{const i=this.valList[y];if(this.isBackgroundFetch(i)){const t=e&&void 0!==i.__staleWhileFetching;return v&&(v.fetch="inflight",t&&(v.returnedStale=!0)),t?i.__staleWhileFetching:i.__returned=i}const r=this.isStale(y);if(!f&&!r)return v&&(v.fetch="hit"),this.moveToTail(y),s&&this.updateItemAge(y),this.statusTTL(v,y),i;const o=this.backgroundFetch(t,y,m,d),n=void 0!==o.__staleWhileFetching,l=n&&e;return v&&(v.fetch=n&&r?"stale":"refresh",l&&r&&(v.returnedStale=!0)),l?o.__staleWhileFetching:o.__returned=o}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:r}={}){const o=this.keyMap.get(t);if(void 0!==o){const n=this.valList[o],l=this.isBackgroundFetch(n);return this.statusTTL(r,o),this.isStale(o)?(r&&(r.get="stale"),l?(r&&(r.returnedStale=e&&void 0!==n.__staleWhileFetching),e?n.__staleWhileFetching:void 0):(i||this.delete(t),r&&(r.returnedStale=e),e?n:void 0)):(r&&(r.get="hit"),l?n.__staleWhileFetching:(this.moveToTail(o),s&&this.updateItemAge(o),n))}r&&(r.get="miss")}connect(t,e){this.prev[e]=t,this.next[t]=e}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return Rt("del","delete"),this.delete}delete(t){let e=!1;if(0!==this.size){const s=this.keyMap.get(t);if(void 0!==s)if(e=!0,1===this.size)this.clear();else{this.removeItemSize(s);const e=this.valList[s];this.isBackgroundFetch(e)?e.__abortController.abort(new Error("deleted")):(this.dispose(e,t,"delete"),this.disposeAfter&&this.disposed.push([e,t,"delete"])),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(const t of this.rindexes({allowStale:!0})){const e=this.valList[t];if(this.isBackgroundFetch(e))e.__abortController.abort(new Error("deleted"));else{const s=this.keyList[t];this.dispose(e,s,"delete"),this.disposeAfter&&this.disposed.push([e,s,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Rt("reset","clear"),this.clear}get length(){return((t,e)=>{const s=`LRU_CACHE_PROPERTY_${t}`;if(jt(s)){const{prototype:i}=At,{get:r}=Object.getOwnPropertyDescriptor(i,t);kt(s,`${t} property`,`cache.${e}`,r)}})("length","size"),this.size}static get AbortController(){return wt}static get AbortSignal(){return St}}var Ct=At;class Mt extends W.default.PureComponent{constructor(t,e){super(t,e),this.style=(t,e)=>{if(this.ol!==this.style)return this.ol;let s;if(this.cache){s=this.props.cacheId(t,e);const i=this.cache.get(s);if(i)return i}const i=new V.default({zIndex:this.props.zIndex}),r=W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{style:i})},this.props.render(t,e));return B.default.render(r,document.createElement("div")),this.cache&&this.cache.set(s,i),i},t.render?this.ol=this.style:this.ol=new V.default({zIndex:t.zIndex}),t.render&&t.cacheSize&&t.cacheId&&(this.cache=new Ct({max:t.cacheSize}))}componentDidMount(){this.refresh()}componentDidUpdate(t,e,s){this.props!==t&&(ft("willRefresh",this,t,this.props),this.refresh(t))}refresh(t){var e,s,i,r,o,n,l;if(!t||(null==t?void 0:t.render)!==this.props.render){if(null===(e=this.context)||void 0===e?void 0:e.styleArray){if(this.ol===this.style)throw new Error("An RStyleArray must contain only static RStyles");this.context.styleArray.includes(this.ol)||this.context.styleArray.push(this.ol)}else(null===(i=null===(s=this.context)||void 0===s?void 0:s.feature)||void 0===i?void 0:i.setStyle)?this.context.feature.setStyle(this.ol):(null===(o=null===(r=this.context)||void 0===r?void 0:r.vectorlayer)||void 0===o?void 0:o.setStyle)?this.context.vectorlayer.setStyle(this.ol):(null===(l=null===(n=this.context)||void 0===n?void 0:n.vectortilelayer)||void 0===l?void 0:l.setStyle)&&this.context.vectortilelayer.setStyle(this.ol);this.cache&&this.cache.clear()}this.ol instanceof V.default&&(!t||t.zIndex!==this.props.zIndex)&&this.ol.setZIndex(this.props.zIndex)}render(){return this.props.render?null:W.default.createElement("div",{className:"_rlayers_RStyle"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}static getStyle(t){return null==t?t:"function"==typeof t.style?(e,s)=>t.style(e,s):Object.keys(t).includes("current")?(e,s)=>t.current.style(e,s):t}static getStyleStatic(t){if(null==t)return t;let e;if("function"==typeof t.style&&(e=t),!Object.keys(t).includes("current")||(e=t.current,null!=e)){if(e){if(void 0!==e.ol&&"function"!=typeof e.ol)return e.ol;throw new TypeError("RStyle is dynamic and cannot be converted to Style")}if("function"==typeof t)throw new TypeError("StyleLike is dynamic and cannot be converted to Style");return t}}}Mt.contextType=dt;class Dt extends e.MapBrowserEvent{}class It extends U.default{}class Wt extends gt{constructor(t,s){var i,r;if(super(t,s),!(null===(i=null==this?void 0:this.context)||void 0===i?void 0:i.vectorlayer))throw new Error("An RFeature must be part of a vector layer");t.feature?this.ol=t.feature:this.ol=new e.Feature(Object.assign(Object.assign({},null!==(r=t.properties)&&void 0!==r?r:{}),{geometry:t.geometry,style:Mt.getStyle(t.style)})),Wt.initEventRelay(this.context.map),this.onchange=()=>this.forceUpdate()}static initEventRelay(t){for(const e of Wt.pointerEvents)t.on(e,Wt.eventRelay)}incrementHandlers(t){var e;const s=gt.getOLObject(Ut,this.context.vectorlayer);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){gt.getOLObject(Ut,this.context.vectorlayer)[t]--}static dispatchEvent(t,e){var s;if(!t.feature)return!0;if(t.feature.dispatchEvent){const s=t.feature.dispatchEvent(e);if(s)return s}e.target||(e.target=t.feature);const i=null===(s=t.layer)||void 0===s?void 0:s.get(vt)[e.type];return!i||i.call(null,e)}static eventRelay(t){const e=[];if(t.map.forEachFeatureAtPixel(t.pixel,((t,s)=>e.push({feature:t,layer:s})&&!1),{hitTolerance:Wt.hitTolerance,layerFilter:e=>{var s,i,r,o,n;const l=gt.getOLObject(Ut,e);switch(t.type){case"click":return l.click>0;case"dblclick":return l.dblclick>0;case"singleclick":return l.singleclick>0;case"pointermove":return(null!==(s=l.pointermove)&&void 0!==s?s:0)+(null!==(i=l.pointerenter)&&void 0!==i?i:0)+(null!==(r=l.pointerleave)&&void 0!==r?r:0)>0;case"pointerdrag":return(null!==(o=l.pointerdrag)&&void 0!==o?o:0)+(null!==(n=l.pointerdragend)&&void 0!==n?n:0)>0}return Object.keys(l).reduce(((t,e)=>t+l[e]),0)>0}}),t.dragging){Wt.lastFeaturesDragged.length||(Wt.lastFeaturesDragged=[...e]);for(const t of Wt.lastFeaturesDragged)e.find((e=>e.feature===t.feature))||e.push(t)}else{for(const e of Wt.lastFeaturesDragged)Wt.dispatchEvent(e,new Dt("pointerdragend",t.map,t.originalEvent));Wt.lastFeaturesDragged=[]}if("pointermove"===t.type){for(const s of Wt.lastFeaturesEntered)e.find((t=>t.feature===s.feature))||(Wt.dispatchEvent(s,new Dt("pointerleave",t.map,t.originalEvent)),s.feature=null,s.layer=null);Wt.lastFeaturesEntered=Wt.lastFeaturesEntered.filter((t=>t.feature));for(const s of e)Wt.lastFeaturesEntered.find((t=>t.feature===s.feature))||(Wt.dispatchEvent(s,new Dt("pointerenter",t.map,t.originalEvent)),Wt.lastFeaturesEntered.push(s))}for(const s of e)if(!1===Wt.dispatchEvent(s,new Dt(t.type,t.map,t.originalEvent)))return!1;return!0}refresh(t){super.refresh(t),void 0!==this.props.feature&&this.props.feature!==this.ol&&(ft("replacing bound feature",this.ol),this.componentWillUnmount(),this.ol=this.props.feature,this.componentDidMount()),this.props.properties!==(null==t?void 0:t.properties)&&this.ol.setProperties(this.props.properties),this.props.geometry!==(null==t?void 0:t.geometry)&&this.ol.setGeometry(this.props.geometry),this.props.style!==(null==t?void 0:t.style)&&this.ol.setStyle(Mt.getStyle(this.props.style))}componentDidMount(){ft("didMount",this.ol),super.componentDidMount(),this.ol.on("change",this.onchange),this.context.vectorsource.addFeature(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.ol.un("change",this.onchange),this.context.vectorsource.removeFeature(this.ol)}render(){var t,e;const s=null===(e=null===(t=this.ol)||void 0===t?void 0:t.getGeometry())||void 0===e?void 0:e.getExtent(),i=s&&a.getCenter(s);return W.default.createElement("div",{className:"_rlayers_RFeature"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{feature:this.ol,rFeature:this,location:i})},this.props.children))}}Wt.pointerEvents=["click","pointerdrag","pointermove","singleclick","dblclick"],Wt.lastFeaturesEntered=[],Wt.lastFeaturesDragged=[],Wt.hitTolerance=3;const Ut="_rlayers_feature_handlers";class Bt extends mt{constructor(t,e){super(t,e),Wt.initEventRelay(this.context.map),this.eventSources=this.createSource(t),super.refresh()}createSource(t){throw new Error("RLayerBaseVector is an abstract class")}refresh(t){super.refresh(t),(null==t?void 0:t.style)!==this.props.style&&this.ol.setStyle(Mt.getStyle(this.props.style))}incrementHandlers(t){var e;const s=gt.getOLObject(Ut,this.ol);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){gt.getOLObject(Ut,this.ol)[t]--}render(){return W.default.createElement("div",{className:"_rlayers_RLayerVector"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.source,vectorlayer:this.ol,vectorsource:this.source,rLayer:this,rLayerVector:this})},this.props.children))}}class Vt extends W.default.PureComponent{constructor(t,e){if(super(t,e),!this.context)throw new Error("A style property must be part of a style");this.ol=this.create(t)}create(t){throw new Error("RBaseStyle is an abstract class")}refresh(t){if(ft("refreshStyle",this),t)for(const e of this.classProps){const s=e.charAt(0).toUpperCase()+e.substring(1);(t&&t[e])!==this.props[e]&&(this.ol["set"+s]?this.ol["set"+s](this.props[e]):console.error(`Underlying OpenLayers object does not support updating of ${e} after object creation. If you are using an anonymous constant array or object, consider assigning its value to a constant and then passing the constant or use React.useMemo() to avoid this warning and improve performance.`))}}set(t){}componentDidMount(){this.set(this.ol)}componentDidUpdate(t,e,s){t!==this.props&&this.refresh(t)}componentWillUnmount(){this.set(null)}render(){return null}}Vt.contextType=dt,Vt.classProps=[];class Gt extends Vt{create(t){return this.classProps=Gt.classProps,new m.Stroke(t)}set(t){if(this.context.style.setStroke)return this.context.style.setStroke(t);throw new Error("Parent element does not support a stroke")}}Gt.classProps=["color","width","lineCap","lineJoin","lineDash"];class Ht extends Vt{create(t){return this.classProps=Ht.classProps,new m.Fill(t)}set(t){if(this.context.style.setFill)return this.context.style.setFill(t);throw new Error("Parent element does not support a fill")}}Ht.classProps=["color"];class Nt extends Vt{create(t){throw new Error("RImage is an abstract class")}set(t){if(!this.context.style.setImage)throw new Error("Parent element does not support an image");this.context.style.setImage(t)}}Nt.classProps=["opacity","rotateWithView","rotation","scale","displacement"];class Zt extends Nt{create(t){throw new Error("RImage is an abstract class")}setStroke(t){this.stroke=t,this.ol=this.create(this.props),super.set(this.ol)}setFill(t){this.fill=t,this.ol=this.create(this.props),super.set(this.ol)}render(){return W.default.createElement("div",{className:"_rlayers_RStyle"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{style:this})},this.props.children))}}Zt.classProps=Nt.classProps.concat(["radius"]);class Xt extends Zt{create(t){return this.classProps=Xt.classProps,new m.Circle(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}Xt.classProps=Zt.classProps.concat(["radius"]);class $t extends Zt{create(t){return this.classProps=$t.classProps,new m.RegularShape(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}$t.classProps=Zt.classProps.concat(["radius1","radius2","points","angle"]);class Yt extends Vt{create(t){return this.classProps=Yt.classProps,new m.Text(t)}set(t){if(!this.context.style.setText)throw new Error("Parent element does not support a text");this.context.style.setText(t)}render(){return W.default.createElement("div",{className:"_rlayers_RStyle_RText"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}}Yt.classProps=["text","font","offsetY","offsetX","overflow","scale","rotation","textAlign","padding","placement","textBaseline"];class qt extends Vt{create(t){this.classProps=qt.classProps;const e=this.context.style;if(!e.setBackgroundFill||!e.setBackgroundStroke)throw new Error("Parent element does not support a background");return{setFill:e.setBackgroundFill.bind(e),setStroke:e.setBackgroundStroke.bind(e)}}render(){return W.default.createElement("div",{className:"_rlayers_RStyle_RBackground"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}}qt.classProps=[];class Kt extends Nt{create(t){return this.classProps=Kt.classProps,new m.Icon(t)}}Kt.classProps=Nt.classProps.concat(["anchor","anchorXUnits","anchorYUnits","color","crossOrigin","img","offset","offsetOrigin","size","imgSize","src"]);var Jt=Object.freeze({__proto__:null,RBaseStyle:Vt,RStyle:Mt,useRStyle:()=>W.default.useRef(),createRStyle:()=>W.default.createRef(),RStyleArray:class extends Mt{constructor(t,e){super(t,e),this.style=(t,e)=>{if(this.props.render){const s=this.props.render(t,e);W.default.Children.map(s.props.children,(t=>{if(W.default.isValidElement(t)&&t.type!==Mt)throw new TypeError("An RStyleArray should contain only RStyle elements")}));const i=[],r=W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{styleArray:i})},s.props.children);return B.default.render(r,document.createElement("div")),i}return this.ol},this.childRefs=[],t.render?this.ol=this.style:this.ol=[]}refresh(t){super.refresh(t)}render(){return W.default.Children.map(this.props.children,(t=>{if(W.default.isValidElement(t)&&t.type!==Mt)throw new TypeError("An RStyleArray should contain only RStyle elements")})),this.props.render?W.default.createElement(W.default.Fragment,null):W.default.createElement("div",{className:"_rlayers_RStyleArray"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{styleArray:this.ol})},this.props.children))}},RStroke:Gt,RFill:Ht,RCircle:Xt,RRegularShape:$t,RText:Yt,RBackground:qt,RIcon:Kt});class Qt extends yt{}class te extends gt{constructor(t,e){var s;if(super(t,e),!(null===(s=this.context)||void 0===s?void 0:s.map))throw new Error("A control must be part of a map")}toOLProps(t){var e;return{className:t.className,target:null===(e=t.target)||void 0===e?void 0:e.current}}refresh(t){super.refresh(t),this.ol.setProperties(this.toOLProps(this.props))}componentDidMount(){super.componentDidMount(),this.context.map.addControl(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeControl(this.ol)}}var ee=Object.freeze({__proto__:null,RScaleLine:class extends te{constructor(t,e){super(t,e),this.ol=new w.ScaleLine(this.toOLProps(t))}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{minWidth:t.minWidth,bar:t.bar,text:t.text,units:null!==(e=t.units)&&void 0!==e?e:"metric"})}},RAttribution:class extends te{constructor(t,e){super(t,e),this.ol=new w.Attribution(this.toOLProps(t))}refresh(t){super.refresh(t),(null==t?void 0:t.collapsed)!==this.props.collapsed&&this.ol.setCollapsed(this.props.collapsed)}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{collapsible:null===(e=t.collapsible)||void 0===e||e,collapsed:t.collapsed})}},RZoom:class extends te{constructor(t,e){super(t,e),this.ol=new w.Zoom(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{duration:t.duration,zoomInLabel:t.zoomInLabel,zoomOutLabel:t.zoomOutLabel,zoomInTipLabel:t.zoomInTipLabel,zoomOutTipLabel:t.zoomOutTipLabel,delta:t.delta})}},RZoomSlider:class extends te{constructor(t,e){super(t,e),this.ol=new w.ZoomSlider(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{duration:t.duration})}},RRotate:class extends te{constructor(t,e){super(t,e),this.ol=new w.Rotate(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{label:t.label,autoHide:t.autoHide})}},RCustom:class extends te{constructor(t,e){super(t,e),this.targetRef=W.default.createRef()}componentDidMount(){this.ol=new w.Control(this.toOLProps(this.props)),super.componentDidMount()}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{element:null===(e=this.targetRef)||void 0===e?void 0:e.current})}render(){return W.default.createElement("div",{className:["ol-control",this.props.className].join(" "),ref:this.targetRef},this.props.children)}},RLayers:class extends te{constructor(t,e){super(t,e),this.onchange=()=>this.forceUpdate(),this.clickCollapse=()=>{this.setState({collapsed:!this.state.collapsed})},this.targetRef=W.default.createRef(),this.state={collapsed:!0,visible:[!0]}}componentDidMount(){this.ol=new w.Control(this.toOLProps(this.props)),super.componentDidMount(),this.context.map.on("change",this.onchange),this.forceUpdate()}componentWillUnmount(){super.componentWillUnmount(),this.context.map.un("change",this.onchange)}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{element:null===(e=this.targetRef)||void 0===e?void 0:e.current})}render(){var t,e;const s=W.default.Children.map(this.props.children,((t,e)=>{var s;if(W.default.isValidElement(t))return null!==(s=this.state.visible[e])&&void 0!==s&&s})),i=W.default.Children.map(this.props.children,(t=>{var e,s;if(W.default.isValidElement(t))return null!==(s=null===(e=t.props.properties)||void 0===e?void 0:e.label)&&void 0!==s?s:"no label"}));return W.default.createElement(W.default.Fragment,null,W.default.createElement("div",{className:["ol-control",null!==(t=this.props.className)&&void 0!==t?t:"ol-layers-control"].join(" "),ref:this.targetRef},W.default.createElement("span",{onClick:this.clickCollapse},null!==(e=this.props.element)&&void 0!==e?e:W.default.createElement("button",null,"=")),this.state.collapsed?null:W.default.createElement("div",null,i.map(((t,e)=>W.default.createElement("div",{key:e},W.default.createElement("input",{type:"radio",id:e.toString(),name:t,value:e.toString(),checked:s[e],onChange:()=>{for(const t in s)s[t]=!1;s[e]=!0,this.setState({visible:[...s],collapsed:!0})}}),W.default.createElement("label",{htmlFor:e.toString()},t)))))),W.default.Children.map(this.props.children,((t,e)=>W.default.isValidElement(t)?W.default.cloneElement(t,{visible:s[e]}):t)))}},ROverviewMap:class extends te{constructor(t,e){super(t,e),this.ol=new w.OverviewMap(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{collapsible:t.collapsible,collapsed:t.collapsed,label:t.label,collapseLabel:t.collapseLabel})}refresh(t){super.refresh(t),(null==t?void 0:t.collapsed)!==this.props.collapsed&&this.ol.setCollapsed(this.props.collapsed)}render(){return W.default.createElement("div",{className:this.props.className,style:{width:this.props.width,height:this.props.height}},W.default.createElement(dt.Provider,{value:{map:this.ol.getOverviewMap()}},this.props.children))}},RFullScreen:class extends te{constructor(t,e){super(t,e),this.ol=new w.FullScreen(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{source:t.source,label:t.label,labelActive:t.labelActive,tipLabel:t.tipLabel})}},RMousePosition:class extends te{constructor(t,e){super(t,e),this.ol=new K.default(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{coordinateFormat:t.coordinateFormat,projection:t.projection,placeholder:t.placeholder||"&nbsp"})}},RZoomToExtent:class extends te{constructor(t,e){super(t,e),this.ol=new J.default(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{extent:t.extent,label:t.label,tipLabel:t.tipLabel})}}});class se extends gt{constructor(t,e){var s,i;if(super(t,e),!(null===(i=null===(s=this.context)||void 0===s?void 0:s.map)||void 0===i?void 0:i.addInteraction))throw new Error("An interaction must be part of a map");this.ol=this.createOL(t)}createOL(t){throw new Error("RBaseInteraction should not be directly instantiated")}refresh(t){for(const e of this.classProps)if(t&&t[e]!==this.props[e]){ft("Replacing interaction",this,t),this.componentWillUnmount(),this.ol=this.createOL(this.props),this.componentDidMount();break}super.refresh(t)}componentDidMount(){super.componentDidMount(),this.context.map.addInteraction(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeInteraction(this.ol)}}se.classProps=[];class ie extends se{}ie.classProps=["handleDownEvent","handleDragEvent","handleMoveEvent","handleUpEvent"];class re extends ie{createOL(t){return this.classProps=re.classProps,new Q.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}re.classProps=["className","condition","minArea","boxEndCondition"];class oe extends ie{createOL(t){return this.classProps=oe.classProps,new tt.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}oe.classProps=["features","layers","filter","hitTolerance"];class ne extends ie{createOL(t){var e;if(!(null===(e=null==this?void 0:this.context)||void 0===e?void 0:e.vectorsource))throw new Error("A Draw interaction must be part of a vector layer");return this.classProps=ne.classProps,new et.default(Object.assign({type:t.type,source:this.context.vectorsource},Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{})))}}ne.classProps=["condition","finishCondition","freehandCondition","style","stopClick","maxPoints","minPoints","snapTolerance"];class le extends ie{createOL(t){var e;if(!(null===(e=null==this?void 0:this.context)||void 0===e?void 0:e.vectorsource))throw new Error("A Modify interaction must be part of a vector layer");return this.classProps=le.classProps,new st.default(Object.assign({source:this.context.vectorsource},Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{})))}}le.classProps=["condition","deleteCondition","insertVertexCondition","style","pixelTolerance","hitDetection"];class ae extends se{createOL(t){return this.classProps=ae.classProps,new it.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}ae.classProps=["duration","delta"];class ce extends se{createOL(t){return this.classProps=ce.classProps,new rt.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}ce.classProps=["condition","kinetic"];class he extends se{createOL(t){return this.classProps=he.classProps,new ot.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}he.classProps=["condition","duration"];class ue extends se{createOL(t){return this.classProps=ue.classProps,new nt.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}ue.classProps=["className","condition","duration","out","minArea"];class pe extends se{createOL(t){return this.classProps=pe.classProps,new lt.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}pe.classProps=["condition","maxDelta","duration","useAnchor","constrainResolution"];class de extends se{createOL(t){return this.classProps=de.classProps,new at.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}de.classProps=["threshold","duration"];class fe extends se{createOL(t){return this.classProps=fe.classProps,new ct.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}fe.classProps=["duration"];class ve extends se{createOL(t){return this.classProps=ve.classProps,new ht.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}ve.classProps=["condition","duration","pixelDelta"];class ge extends se{createOL(t){return this.classProps=ge.classProps,new ut.default(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}ge.classProps=["condition","duration","delta"];var me=Object.freeze({__proto__:null,RBaseInteraction:se,RPointer:ie,RDragBox:re,RTranslate:oe,RDraw:ne,RModify:le,RDoubleClickZoom:ae,RDragPan:ce,RDragRotate:he,RDragZoom:ue,RMouseWheelZoom:pe,RPinchRotate:de,RPinchZoom:fe,RKeyboardPan:ve,RKeyboardZoom:ge});class ye extends gt{constructor(t,s){var i;if(super(t,s),!(null===(i=this.context)||void 0===i?void 0:i.location))throw new Error("An overlay must be part of a location provider (ie RFeature)");this.ol=new e.Overlay({autoPan:t.autoPan,offset:t.offset,positioning:t.positioning}),this.containerRef=W.default.createRef()}setPosition(){var t;if(this.ol.setPosition(this.context.location),this.props.autoPosition&&(null===(t=this.containerRef)||void 0===t?void 0:t.current)){this.containerRef.current.style.position="absolute";const t=this.context.map.getPixelFromCoordinate(this.context.location),e=this.context.map.getSize();t[0]>e[0]/2?(this.containerRef.current.style.left=null,this.containerRef.current.style.right="0px"):(this.containerRef.current.style.left="0px",this.containerRef.current.style.right=null),t[1]>e[1]/2?(this.containerRef.current.style.top=null,this.containerRef.current.style.bottom="0px"):(this.containerRef.current.style.top="0px",this.containerRef.current.style.bottom=null)}}refresh(t){super.refresh(t),this.ol.setElement(this.containerRef.current),this.setPosition(),this.props.offset!==(null==t?void 0:t.offset)&&this.ol.setOffset(this.props.offset),this.props.positioning!==(null==t?void 0:t.positioning)&&this.ol.setPositioning(this.props.positioning)}componentDidMount(){super.componentDidMount(),this.context.map.addOverlay(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeOverlay(this.ol)}render(){return this.setPosition(),W.default.createElement("div",{className:"_rlayers_ROverlay"},W.default.createElement("div",{ref:this.containerRef,className:this.props.className,onClick:this.props.onClick},this.props.children))}}return Object.defineProperty(t,"MapBrowserEvent",{enumerable:!0,get:function(){return e.MapBrowserEvent}}),Object.defineProperty(t,"MapEvent",{enumerable:!0,get:function(){return e.MapEvent}}),Object.defineProperty(t,"RenderEvent",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(t,"VectorSourceEvent",{enumerable:!0,get:function(){return i.VectorSourceEvent}}),t.RContext=dt,t.RControl=ee,t.RFeature=Wt,t.RFeatureBaseEvent=It,t.RFeatureUIEvent=Dt,t.RGeolocation=class extends gt{constructor(t,e){var s,i;if(super(t,e),!(null===(s=null==this?void 0:this.context)||void 0===s?void 0:s.map))throw new Error("A Geolocation must be part of a map");const r=null!==(i=t.projection)&&void 0!==i?i:this.context.map.getView().getProjection();this.ol=new pt.default(Object.assign(Object.assign({},t),{projection:r}))}},t.RInteraction=me,t.RLayer=mt,t.RLayerBaseVector=Bt,t.RLayerCluster=class extends Bt{createSource(t){return this.cluster=new n.Vector({features:this.props.features,url:this.props.url,format:this.props.format,loader:this.props.loader,wrapX:this.props.wrapX,strategy:this.props.strategy}),this.source=new n.Cluster({source:this.cluster,distance:this.props.distance}),this.ol=new o.Vector(Object.assign(Object.assign({},t),{source:this.source,style:Mt.getStyle(t.style)})),[this.ol,this.source,this.cluster]}refresh(t){super.refresh(t),(null==t?void 0:t.distance)!==this.props.distance&&this.source.setDistance(this.props.distance),(null==t?void 0:t.url)!==this.props.url&&(this.cluster.setUrl(this.props.url),this.cluster.refresh())}render(){return W.default.createElement("div",{className:"_rlayers_RLayerCluster"},W.default.createElement(dt.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.cluster,vectorlayer:this.ol,vectorsource:this.cluster,rLayer:this,rLayerVector:this})},this.props.children))}},t.RLayerGraticule=class extends mt{constructor(t,e){super(t,e),this.createSource()}createSource(){var t,e,s,i,r,o;const n=null===(e=null===(t=Mt.getStyleStatic(this.props.strokeStyle))||void 0===t?void 0:t.getStroke)||void 0===e?void 0:e.call(t),l=null===(i=null===(s=Mt.getStyleStatic(this.props.lonLabelStyle))||void 0===s?void 0:s.getText)||void 0===i?void 0:i.call(s),a=null===(o=null===(r=Mt.getStyleStatic(this.props.latLabelStyle))||void 0===r?void 0:r.getText)||void 0===o?void 0:o.call(r);this.ol=new $.default(Object.assign(Object.assign({},this.props),{strokeStyle:n,lonLabelStyle:l,latLabelStyle:a})),this.eventSources=[this.ol]}refresh(t){super.refresh(t);const e=this.context.map.removeLayer(this.ol);this.createSource(),this.attachOldEventHandlers(this.ol),e&&this.context.map.addLayer(this.ol)}},t.RLayerHeatmap=class extends Bt{createSource(t){return this.source=new n.Vector({features:this.props.features,url:this.props.url,format:this.props.format,loader:this.props.loader,wrapX:this.props.wrapX,strategy:this.props.strategy}),this.ol=new o.Heatmap(Object.assign(Object.assign({},t),{source:this.source})),[this.ol,this.source]}refresh(t){super.refresh(t),(null==t?void 0:t.blur)!==this.props.blur&&this.ol.setBlur(this.props.blur),(null==t?void 0:t.radius)!==this.props.radius&&this.ol.setRadius(this.props.radius)}},t.RLayerImage=class extends mt{constructor(t,e){super(t,e),this.createSource(),this.ol=new N.default({source:this.source}),this.eventSources=[this.ol,this.source]}createSource(){const t={url:this.props.url,projection:this.props.projection,imageExtent:this.props.extent,imageSize:this.props.size};this.source=new X.default(t),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),this.props.url&&(null==t?void 0:t.url)!==this.props.url&&(this.createSource(),this.ol.setSource(this.source),this.eventSources=[this.ol,this.source],this.attachOldEventHandlers(this.source))}},t.RLayerTile=class extends yt{constructor(t,e){super(t,e),this.createSource(),this.ol=new o.Tile({source:this.source}),this.eventSources=[this.ol,this.source]}createSource(){this.source=new n.XYZ({url:this.props.url,interpolate:!this.props.noIterpolation,projection:this.props.projection,tileGrid:this.props.tileGrid,crossOrigin:this.props.crossOrigin}),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),(null==t?void 0:t.tileGrid)===this.props.tileGrid&&(null==t?void 0:t.url)===this.props.url||(this.createSource(),this.ol.setSource(this.source),this.attachOldEventHandlers(this.source))}},t.RLayerTileJSON=class extends yt{constructor(t,e){super(t,e),this.source=new n.TileJSON({url:this.props.url,tileSize:this.props.tileSize}),this.ol=new o.Tile({source:this.source}),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),this.props.url&