(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerpolicy&&(r.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?r.credentials="include":s.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();class Es{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const ve=Es,nt={PROPERTYCHANGE:"propertychange"};class Cs{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const un=Cs;function cn(i,e){return i>e?1:i0){for(s=1;s0?s-1:s:i[s-1]-e0||t&&o===0)})}function vt(){return!0}function St(){return!1}function it(){}function xs(i){let e=!1,t,n,s;return function(){const r=Array.prototype.slice.call(arguments);return(!e||this!==s||!Mt(r,n))&&(e=!0,s=this,n=r,t=i.apply(this,arguments)),t}}function At(i){for(const e in i)delete i[e]}function Ps(i){let e;for(e in i)return!1;return!e}class Ls extends un{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),s=n[e]||(n[e]=[]);s.includes(t)||s.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=t?new ve(e):e;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let h=0,u=s.length;h0:!1}removeEventListener(e,t){const n=this.listeners_&&this.listeners_[e];if(n){const s=n.indexOf(t);s!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[s]=it,++this.pendingRemovals_[e]):(n.splice(s,1),n.length===0&&delete this.listeners_[e]))}}}const gn=Ls,v={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function x(i,e,t,n,s){if(n&&n!==i&&(t=t.bind(n)),s){const o=t;t=function(){i.removeEventListener(e,t),o.apply(this,arguments)}}const r={target:i,type:e,listener:t};return i.addEventListener(e,t),r}function xt(i,e,t,n){return x(i,e,t,n,!0)}function A(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),At(i))}class Ot extends gn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(v.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,s=new Array(n);for(let r=0;r0;)this.pop()}extend(e){for(let t=0,n=e.length;tthis.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new gt($.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,s=t.length;n=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new gt($.REMOVE,t,e)),t}setAt(e,t){const n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const s=this.array_[e];this.array_[e]=t,this.dispatchEvent(new gt($.REMOVE,s,e)),this.dispatchEvent(new gt($.ADD,t,e))}updateLength_(){this.set(jn.LENGTH,this.array_.length)}assertUnique_(e,t){for(let n=0,s=this.array_.length;ns&&(l=l|z.RIGHT),ar&&(l=l|z.ABOVE),l===z.UNKNOWN&&(l=z.INTERSECTING),l}function De(){return[1/0,1/0,-1/0,-1/0]}function We(i,e,t,n,s){return s?(s[0]=i,s[1]=e,s[2]=t,s[3]=n,s):[i,e,t,n]}function Nt(i){return We(1/0,1/0,-1/0,-1/0,i)}function Zs(i,e){const t=i[0],n=i[1];return We(t,n,t,n,e)}function Ks(i,e,t,n,s){const r=Nt(s);return Mi(r,i,e,t,n)}function Qt(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function Us(i,e){return e[0]i[2]&&(i[2]=e[2]),e[1]i[3]&&(i[3]=e[3]),i}function Ct(i,e){e[0]i[2]&&(i[2]=e[0]),e[1]i[3]&&(i[3]=e[1])}function Mi(i,e,t,n,s){for(;te[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function _n(i){return i[2]=o&&_<=l),!n&&!!(r&z.RIGHT)&&!(s&z.RIGHT)&&(p=g-(d-l)*f,n=p>=a&&p<=h),!n&&!!(r&z.BELOW)&&!(s&z.BELOW)&&(_=d-(g-a)/f,n=_>=o&&_<=l),!n&&!!(r&z.LEFT)&&!(s&z.LEFT)&&(p=g-(d-o)*f,n=p>=a&&p<=h)}return n}function G(i,e,t){return Math.min(Math.max(i,e),t)}function Ws(i,e,t,n,s,r){const o=s-t,a=r-n;if(o!==0||a!==0){const l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=s,n=r):l>0&&(t+=o*l,n+=a*l)}return je(i,e,t,n)}function je(i,e,t,n){const s=t-i,r=n-e;return s*s+r*r}function Bs(i){const e=i.length;for(let n=0;nr&&(r=l,s=a)}if(r===0)return null;const o=i[s];i[s]=i[n],i[n]=o;for(let a=n+1;a=0;n--){t[n]=i[n][e]/i[n][n];for(let s=n-1;s>=0;s--)i[s][e]-=i[s][n]*t[n]}return t}function Rt(i){return i*Math.PI/180}function Ye(i,e){const t=i%e;return t*e<0?t+e:t}function $s(i,e,t){return i+t*(e-i)}function Ai(i,e){const t=Math.pow(10,e);return Math.round(i*t)/t}function ft(i,e){return Math.floor(Ai(i,e))}function _t(i,e){return Math.ceil(Ai(i,e))}const qs=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Js=/^([a-z]*)$|^hsla?\(.*\)$/i;function Qs(i){return typeof i=="string"?i:ir(i)}function er(i){const e=document.createElement("div");if(e.style.color=i,e.style.color!==""){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}const tr=function(){const e={};let t=0;return function(n){let s;if(e.hasOwnProperty(n))s=e[n];else{if(t>=1024){let r=0;for(const o in e)(r++&3)===0&&(delete e[o],--t)}s=nr(n),e[n]=s,++t}return s}}();function Wn(i){return Array.isArray(i)?i:tr(i)}function nr(i){let e,t,n,s,r;if(Js.exec(i)&&(i=er(i)),qs.exec(i)){const o=i.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;e=parseInt(i.substr(1+0*a,a),16),t=parseInt(i.substr(1+1*a,a),16),n=parseInt(i.substr(1+2*a,a),16),l?s=parseInt(i.substr(1+3*a,a),16):s=255,a==1&&(e=(e<<4)+e,t=(t<<4)+t,n=(n<<4)+n,l&&(s=(s<<4)+s)),r=[e,t,n,s/255]}else i.startsWith("rgba(")?(r=i.slice(5,-1).split(",").map(Number),Bn(r)):i.startsWith("rgb(")?(r=i.slice(4,-1).split(",").map(Number),r.push(1),Bn(r)):w(!1,14);return r}function Bn(i){return i[0]=G(i[0]+.5|0,0,255),i[1]=G(i[1]+.5|0,0,255),i[2]=G(i[2]+.5|0,0,255),i[3]=G(i[3],0,1),i}function ir(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*100)/100;return"rgba("+e+","+t+","+n+","+s+")"}class sr{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],--this.cacheSize_)}}}get(e,t,n){const s=$n(e,t,n);return s in this.cache_?this.cache_[s]:null}set(e,t,n,s){const r=$n(e,t,n);this.cache_[r]=s,++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function $n(i,e,t){const n=t?Qs(t):"null";return e+":"+i+":"+n}const Oi=new sr,L={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class rr extends se{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[L.OPACITY]=e.opacity!==void 0?e.opacity:1,w(typeof t[L.OPACITY]=="number",64),t[L.VISIBLE]=e.visible!==void 0?e.visible:!0,t[L.Z_INDEX]=e.zIndex,t[L.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[L.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[L.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[L.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=G(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return S()}getLayerStatesArray(e){return S()}getExtent(){return this.get(L.EXTENT)}getMaxResolution(){return this.get(L.MAX_RESOLUTION)}getMinResolution(){return this.get(L.MIN_RESOLUTION)}getMinZoom(){return this.get(L.MIN_ZOOM)}getMaxZoom(){return this.get(L.MAX_ZOOM)}getOpacity(){return this.get(L.OPACITY)}getSourceState(){return S()}getVisible(){return this.get(L.VISIBLE)}getZIndex(){return this.get(L.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(L.EXTENT,e)}setMaxResolution(e){this.set(L.MAX_RESOLUTION,e)}setMinResolution(e){this.set(L.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(L.MAX_ZOOM,e)}setMinZoom(e){this.set(L.MIN_ZOOM,e)}setOpacity(e){w(typeof e=="number",64),this.set(L.OPACITY,e)}setVisible(e){this.set(L.VISIBLE,e)}setZIndex(e){this.set(L.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Ni=rr,Ce={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class or extends Ni{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(L.SOURCE,this.handleSourcePropertyChange_);const n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(L.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(A(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=x(e,v.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}render(e,t){const n=this.getRenderer();if(n.prepareFrame(e))return this.rendered=!0,n.renderFrame(e,t)}unrender(){this.rendered=!1}setMapInternal(e){e||this.unrender(),this.set(L.MAP,e)}getMapInternal(){return this.get(L.MAP)}setMap(e){this.mapPrecomposeKey_&&(A(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(A(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=x(e,Ce.PRECOMPOSE,function(t){const s=t.frameState.layerStatesArray,r=this.getLayerState(!1);w(!s.some(function(o){return o.layer===r.layer}),67),s.push(r)},this),this.mapRenderKey_=x(this,v.CHANGE,e.render,e),this.changed())}setSource(e){this.set(L.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function mn(i,e){if(!i.visible)return!1;const t=e.resolution;if(t=i.maxResolution)return!1;const n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}const Tn=or;function ar(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function Pt(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function pn(i,e){const t=Math.cos(e),n=Math.sin(e),s=i[0]*t-i[1]*n,r=i[1]*t+i[0]*n;return i[0]=s,i[1]=r,i}function lr(i,e){return i[0]*=e,i[1]*=e,i}function hr(i,e){if(e.canWrapX()){const t=F(e.getExtent()),n=ur(i,e,t);n&&(i[0]-=n*t)}return i}function ur(i,e,t){const n=e.getExtent();let s=0;return e.canWrapX()&&(i[0]n[2])&&(t=t||F(n),s=Math.floor((i[0]-n[0])/t)),s}class cr extends un{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){S()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,s=e.pixelToCoordinateTransform;st(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),bi(s,n)}forEachFeatureAtCoordinate(e,t,n,s,r,o,a,l){let h;const u=t.viewState;function c(m,R,b,P){return r.call(o,R,m?b:null,P)}const d=u.projection,g=hr(e.slice(),d),f=[[0,0]];if(d.canWrapX()&&s){const m=d.getExtent(),R=F(m);f.push([-R,0],[R,0])}const _=t.layerStatesArray,p=_.length,E=[],T=[];for(let m=0;m=0;--R){const b=_[R],P=b.layer;if(P.hasRenderer()&&mn(b,u)&&a.call(l,P)){const I=P.getRenderer(),k=P.getSource();if(I&&k){const K=k.getWrapX()?g:e,Q=c.bind(null,b.managed);T[0]=K[0]+f[m][0],T[1]=K[1]+f[m][1],h=I.forEachFeatureAtCoordinate(T,t,n,Q,E)}if(h)return h}}if(E.length===0)return;const y=1/E.length;return E.forEach((m,R)=>m.distanceSq+=R*y),E.sort((m,R)=>m.distanceSq-R.distanceSq),E.some(m=>h=m.callback(m.feature,m.layer,m.geometry)),h}hasFeatureAtCoordinate(e,t,n,s,r,o){return this.forEachFeatureAtCoordinate(e,t,n,s,vt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(e){S()}scheduleExpireIconCache(e){Oi.canExpireCache()&&e.postRenderFunctions.push(dr)}}function dr(i,e){Oi.expire()}const gr=cr;class fr extends ve{constructor(e,t,n,s){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=s}}const Fi=fr,mt="ol-hidden",_r="ol-selectable",Xt="ol-unselectable",yn="ol-control",qn="ol-collapsed";function Be(i,e,t,n){let s;return t&&t.length?s=t.shift():Pi?s=new OffscreenCanvas(i||300,e||300):s=document.createElement("canvas"),i&&(s.width=i),e&&(s.height=e),s.getContext("2d",n)}function En(i){const e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function mr(i){let e=i.offsetWidth;const t=getComputedStyle(i);return e+=parseInt(t.marginLeft,10)+parseInt(t.marginRight,10),e}function Tr(i){let e=i.offsetHeight;const t=getComputedStyle(i);return e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),e}function Jn(i,e){const t=e.parentNode;t&&t.replaceChild(i,e)}function Lt(i){return i&&i.parentNode?i.parentNode.removeChild(i):null}function Gi(i){for(;i.lastChild;)i.removeChild(i.lastChild)}function pr(i,e){const t=i.childNodes;for(let n=0;;++n){const s=t[n],r=e[n];if(!s&&!r)break;if(s!==r){if(!s){i.appendChild(r);continue}if(!r){i.removeChild(s),--n;continue}i.insertBefore(r,s)}}}const yr=new se;class Er extends gr{constructor(e){super(e),this.fontChangeListenerKey_=x(yr,nt.PROPERTYCHANGE,e.redrawText.bind(e)),this.element_=document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Xt+" ol-layers";const n=e.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const s=new Fi(e,void 0,t);n.dispatchEvent(s)}}disposeInternal(){A(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Ce.PRECOMPOSE,e);const t=e.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),n=e.viewState;this.children_.length=0;const s=[];let r=null;for(let o=0,a=t.length;o=0;--o)s[o].renderDeclutter(e);pr(this.element_,this.children_),this.dispatchRenderEvent(Ce.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}}const Cr=Er;class ye extends ve{constructor(e,t){super(e),this.layer=t}}const Yt={LAYERS:"layers"};class Cn extends Ni{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Yt.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new ge(n.slice(),{unique:!0}):w(typeof n.getArray=="function",43):n=new ge(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(A),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(x(e,$.ADD,this.handleLayersAdd_,this),x(e,$.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(A);At(this.listenerKeys_);const t=e.getArray();for(let n=0,s=t.length;n{this.clickTimeoutId_=void 0;const n=new pe(M.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==M.POINTERUP||t.type==M.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==t.target){delete this.trackedTouches_[s];break}}else(t.type==M.POINTERDOWN||t.type==M.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new pe(M.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(A),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new pe(M.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.down_={};for(const n in e){const s=e[n];this.down_[n]=typeof s=="function"?it:s}if(this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(x(n,M.POINTERMOVE,this.handlePointerMove_,this),x(n,M.POINTERUP,this.handlePointerUp_,this),x(this.element_,M.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(x(this.element_.getRootNode(),M.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new pe(M.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new pe(M.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(A(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(v.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(A(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(A),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Pr=xr,ce={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Z={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},bt=1/0;class Lr{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,At(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(e){w(!(this.keyFunction_(e)in this.queuedElements_),31);const t=this.priorityFunction_(e);return t!=bt?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,s=t.length,r=t[e],o=n[e],a=e;for(;e>1;){const l=this.getLeftChildIndex_(e),h=this.getRightChildIndex_(e),u=he;){const a=this.getParentIndex_(t);if(s[a]>o)n[t]=n[a],s[t]=s[a],t=a;else break}n[t]=r,s[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let s=0;const r=t.length;let o,a,l;for(a=0;a0;)r=this.dequeue()[0],o=r.getKey(),s=r.getState(),s===C.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++n,r.load())}}const wr=Dr;function Ir(i,e,t,n,s){if(!i||!(t in i.wantedTiles)||!i.wantedTiles[t][e.getKey()])return bt;const r=i.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}const B={ANIMATING:0,INTERACTING:1},q={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Mr=42,Rn=256,ot={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Sr{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ot[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const ki=Sr,lt=6378137,Ze=Math.PI*lt,Ar=[-Ze,-Ze,Ze,Ze],Or=[-180,-85,180,85],Tt=lt*Math.log(Math.tan(Math.PI/2));class Ae extends ki{constructor(e){super({code:e,units:"m",extent:Ar,global:!0,worldExtent:Or,getPointResolution:function(t,n){return t/Math.cosh(n[1]/lt)}})}}const Qn=[new Ae("EPSG:3857"),new Ae("EPSG:102100"),new Ae("EPSG:102113"),new Ae("EPSG:900913"),new Ae("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ae("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Nr(i,e,t){const n=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(n));for(let s=0;sTt?r=Tt:r<-Tt&&(r=-Tt),e[s+1]=r}return e}function Fr(i,e,t){const n=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(n));for(let s=0;szi.warn||console.warn(...i)}let on=!0;function Zi(i){on=!(i===void 0?!0:i)}function vn(i,e){if(e!==void 0){for(let t=0,n=i.length;t=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(on=!1,Xi("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Wr(i,e){return i}function Ke(i,e){return i}function Br(){si(Qn),si(ti),Hr(ti,Qn,Nr,Fr)}Br();function ri(i,e,t){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,u=a?a[0]:0,c=a?a[1]:0;let d=i[0]+l/2+u,g=i[2]-l/2+u,f=i[1]+h/2+c,_=i[3]-h/2+c;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=G(n[0],d,g),E=G(n[1],f,_);if(o&&t&&s){const T=30*s;p+=-T*Math.log(1+Math.max(0,d-n[0])/T)+T*Math.log(1+Math.max(0,n[0]-g)/T),E+=-T*Math.log(1+Math.max(0,f-n[1])/T)+T*Math.log(1+Math.max(0,n[1]-_)/T)}return[p,E]}}function $r(i){return i}function Ln(i,e,t,n){const s=F(e)/t[0],r=ie(e)/t[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function bn(i,e,t){let n=Math.min(i,e);const s=50;return n*=Math.log(1+s*Math.max(0,i/e-1))/s+1,t&&(n=Math.max(n,t),n/=Math.log(1+s*Math.max(0,t/i-1))/s+1),G(n,t/2,e*2)}function qr(i,e,t,n){return e=e!==void 0?e:!0,function(s,r,o,a){if(s!==void 0){const l=i[0],h=i[i.length-1],u=t?Ln(l,t,o,n):l;if(a)return e?bn(s,u,h):G(s,h,u);const c=Math.min(u,s),d=Math.floor(dn(i,c,r));return i[d]>u&&d1)c=t;else if(d>0){for(let g=0;gs&&(s=h),r=a,o=l}return s}function co(i,e,t,n,s){for(let r=0,o=t.length;r0;){const c=h.pop(),d=h.pop();let g=0;const f=i[d],_=i[d+1],p=i[c],E=i[c+1];for(let T=d+n;Tg&&(u=T,g=R)}g>s&&(l[(u-e)/n]=1,d+n0&&_>g)&&(f<0&&p0&&p>f)){h=c,u=d;continue}r[o++]=h,r[o++]=u,a=h,l=u,h=c,u=d}return r[o++]=h,r[o++]=u,o}function po(i,e,t,n,s,r,o,a){for(let l=0,h=t.length;lr&&(h-a)*(r-l)-(s-a)*(u-l)>0&&o++:u<=r&&(h-a)*(r-l)-(s-a)*(u-l)<0&&o--,a=h,l=u}return o!==0}function $i(i,e,t,n,s,r){if(t.length===0||!be(i,e,t[0],n,s,r))return!1;for(let o=1,a=t.length;oE&&(h=(u+c)/2,$i(i,e,t,n,h,f)&&(p=h,E=T)),u=c}return isNaN(p)&&(p=s[r]),o?(o.push(p,f,E),o):[p,f,E]}function xo(i,e,t,n,s){let r;for(e+=n;e=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:xo(i,e,t,n,function(o,a){return Vs(s,o,a)}):!1}function Ji(i,e,t,n,s){return!!(qi(i,e,t,n,s)||be(i,e,t,n,s[0],s[1])||be(i,e,t,n,s[0],s[3])||be(i,e,t,n,s[2],s[1])||be(i,e,t,n,s[2],s[3]))}function Po(i,e,t,n,s){if(!Ji(i,e,t[0],n,s))return!1;if(t.length===1)return!0;for(let r=1,o=t.length;r0}function bo(i,e,t,n,s){s=s!==void 0?s:!1;for(let r=0,o=t.length;r1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let s=0;for(;s0}getInteracting(){return this.hints_[B.INTERACTING]>0}cancelAnimations(){this.setHint(B.ANIMATING,-this.hints_[B.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t=0;--n){const s=this.animations_[n];let r=!0;for(let o=0,a=s.length;o0?h/l.duration:1;u>=1?(l.complete=!0,u=1):r=!1;const c=l.easing(u);if(l.sourceCenter){const d=l.sourceCenter[0],g=l.sourceCenter[1],f=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const p=d+c*(f-d),E=g+c*(_-g);this.targetCenter_=[p,E]}if(l.sourceResolution&&l.targetResolution){const d=c===1?l.targetResolution:l.sourceResolution+c*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),f=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(f,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=c===1?Ye(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+c*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(B.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&pt(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-t[0],s[1]-t[1]],pn(n,e-this.getRotation()),ar(n,t)),n}calculateCenterZoom(e,t){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=t[0]-e*(t[0]-s[0])/r,a=t[1]-e*(t[1]-s[1])/r;n=[o,a]}return n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],s=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(s*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(s*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&an(e,this.getProjection())}getCenterInternal(){return this.get(q.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Wr(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();w(t,1);const n=this.getResolution();w(n!==void 0,2);const s=this.getRotation();return w(s!==void 0,3),tn(t,n,s,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(q.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Ke(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=F(e)/t[0],s=ie(e)/t[1];return Math.max(n,s)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(t/n)/Math.log(e);return function(r){return t/Math.pow(e,r*s)}}getRotation(){return this.get(q.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/t;return function(o){return Math.log(n/o)/t/r}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=Vt(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],t,n)}return{center:s.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,s;if(this.resolutions_){const r=dn(this.resolutions_,e,1);t=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return t+Math.log(n/e)/Math.log(s)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const t=G(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,G(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(w(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function",24),Array.isArray(e)){w(!_n(e),25);const s=Ke(e,this.getProjection());n=gi(s)}else if(e.getType()==="Circle"){const s=Ke(e.getExtent(),this.getProjection());n=gi(s),n.rotate(this.getRotation(),rt(s))}else n=e;this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),s=Math.sin(-t),r=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,h=-1/0,u=-1/0;for(let c=0,d=r.length;c0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Mt(t,this.renderedAttributions_)){Gi(this.ulElement_);for(let s=0,r=t.length;s0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:$e}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const r=this.element.classList.contains(mt);!r&&n===0?this.element.classList.add(mt):r&&n!==0&&this.element.classList.remove(mt)}this.label_.style.transform=s}this.rotation_=n}}const Go=Fo;class ko extends Mn{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,s=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",r=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",h=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=s,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(v.CLICK,this.handleClick_.bind(this,n),!1);const c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=h,c.appendChild(typeof a=="string"?document.createTextNode(a):a),c.addEventListener(v.CLICK,this.handleClick_.bind(this,-n),!1);const d=t+" "+Xt+" "+yn,g=this.element;g.className=d,g.appendChild(u),g.appendChild(c),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const r=n.getConstrainedZoom(s+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:r,duration:this.duration_,easing:$e})):n.setZoom(r)}}}const zo=ko;function Xo(i){i=i||{};const e=new ge;return(i.zoom!==void 0?i.zoom:!0)&&e.push(new zo(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&e.push(new Go(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&e.push(new No(i.attributionOptions)),e}const fi={ACTIVE:"active"};class Zo extends se{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(fi.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(fi.ACTIVE,e)}setMap(e){this.map_=e}}function Ko(i,e,t){const n=i.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:no,center:i.getConstrainedCenter(s)})}}function Sn(i,e,t,n){const s=i.getZoom();if(s===void 0)return;const r=i.getConstrainedZoom(s+e),o=i.getResolutionForZoom(r);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:$e})}const ht=Zo;class Uo extends ht{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==M.DBLCLICK){const n=e.originalEvent,s=e.map,r=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=s.getView();Sn(a,o,r,this.duration_),n.preventDefault(),t=!0}return!t}}const jo=Uo;class Yo extends ht{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==M.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==M.POINTERUP){const n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==M.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==M.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function An(i){const e=i.length;let t=0,n=0;for(let s=0;s0&&this.condition_(e)){const n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}const Jo=qo;class Qo extends ut{constructor(e){e=e||{},super({stopDown:St}),this.condition_=e.condition?e.condition:Ho,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!Wt(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===Dn)return;const s=t.getSize(),r=e.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return Wt(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return Wt(e)&&ts(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const ea=Qo;class ta extends un{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(e[0],t[0])+n,s.top=Math.min(e[1],t[1])+n,s.width=Math.abs(t[0]-e[0])+n,s.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const e=this.startPixel_,t=this.endPixel_,s=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new at([s])}getGeometry(){return this.geometry_}}const na=ta,yt={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Bt extends ve{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}}class ia extends ut{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.box_=new na(e.className||"ol-dragbox"),this.minArea_=e.minArea!==void 0?e.minArea:64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition?e.condition:ts,this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const s=n[0]-t[0],r=n[1]-t[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Bt(yt.BOXDRAG,e.coordinate,e))}handleUpEvent(e){this.box_.setMap(null);const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Bt(t?yt.BOXEND:yt.BOXCANCEL,e.coordinate,e)),!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Bt(yt.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}}const sa=ia;class ra extends sa{constructor(e){e=e||{};const t=e.condition?e.condition:Bo;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=n.rotatedExtentForGeometry(s),o=n.getResolutionForExtentInternal(r),a=n.getResolution()/o;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:$e})}}const oa=ra,Le={LEFT:37,UP:38,RIGHT:39,DOWN:40};class aa extends ht{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return ns(t)&&is(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==v.KEYDOWN){const n=e.originalEvent,s=n.keyCode;if(this.condition_(e)&&(s==Le.DOWN||s==Le.LEFT||s==Le.RIGHT||s==Le.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==Le.DOWN?h=-a:s==Le.LEFT?l=-a:s==Le.RIGHT?l=a:h=a;const u=[l,h];pn(u,o.getRotation()),Ko(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}}const la=aa;class ha extends ht{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:is,this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==v.KEYDOWN||e.type==v.KEYPRESS){const n=e.originalEvent,s=n.charCode;if(this.condition_(e)&&(s=="+".charCodeAt(0)||s=="-".charCodeAt(0))){const r=e.map,o=s=="+".charCodeAt(0)?this.delta_:-this.delta_,a=r.getView();Sn(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}}const ua=ha;class ca{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]0&&this.points_[n+2]>e;)n-=3;const s=this.points_[t+2]-this.points_[n+2];if(s<1e3/60)return!1;const r=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const da=ca;class ga extends ht{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:Wo;this.condition_=e.onFocusOnly?ln(es,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(e){if(!this.condition_(e)||e.type!==v.WHEEL)return!0;const n=e.map,s=e.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.coordinate);let r;if(e.type==v.WHEEL&&(r=s.deltaY,As&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=xi),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-G(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Sn(t,n,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}const fa=ga;class _a extends ut{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=St),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const n=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=r;const o=e.map,a=o.getView();a.getConstraints().rotation!==Dn&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(An(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}const ma=_a;class Ta extends ut{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=St),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const n=this.targetPointers[0],s=this.targetPointers[1],r=n.clientX-s.clientX,o=n.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,h=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(An(this.targetPointers))),l.render(),h.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const n=e.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}const pa=Ta;function ya(i){i=i||{};const e=new ge,t=new da(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&e.push(new ea),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&e.push(new jo({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&e.push(new Jo({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&e.push(new ma),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&e.push(new pa({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(e.push(new la),e.push(new ua({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&e.push(new fa({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&e.push(new oa({duration:i.zoomDuration})),e}function _i(i){return i[0]>0&&i[1]>0}function Ea(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function de(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}function ss(i){if(i instanceof Tn){i.setMapInternal(null);return}i instanceof Zt&&i.getLayers().forEach(ss)}function rs(i,e){if(i instanceof Tn){i.setMapInternal(e);return}if(i instanceof Zt){const t=i.getLayers().getArray();for(let n=0,s=t.length;nthis.updateSize()),this.controls=t.controls||Xo(),this.interactions=t.interactions||ya({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new wr(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Z.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Z.VIEW,this.handleViewChanged_),this.addChangeListener(Z.SIZE,this.handleSizeChanged_),this.addChangeListener(Z.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const n=this;e.view&&!(e.view instanceof Ee)&&e.view.then(function(s){n.setView(new Ee(s))}),this.controls.addEventListener($.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener($.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener($.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener($.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener($.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener($.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){rs(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};const r=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:vt,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,t,null,o,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(s){n.push(s)},t),n}getAllLayers(){const e=[];function t(n){n.forEach(function(s){s instanceof Zt?t(s.getLayers()):e.push(s)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const s=t.layerFilter!==void 0?t.layerFilter:vt,r=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,o,s,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=n.width/s[0],o=n.height/s[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/r,(a.clientY-n.top)/o]}getTarget(){return this.get(Z.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return an(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?W(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Z.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof ge){t.setLayers(e);return}const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let s=this.maxTilesLoading_,r=s;if(e){const o=e.viewHints;if(o[B.ANIMATING]||o[B.INTERACTING]){const a=Date.now()-e.time>8;s=a?0:8,r=a?0:2}}t.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new ye("removelayer",t)),this.set(Z.LAYERGROUP,e)}setSize(e){this.set(Z.SIZE,e)}setTarget(e){this.set(Z.TARGET,e)}setView(e){if(!e||e instanceof Ee){this.set(Z.VIEW,e);return}this.set(Z.VIEW,new Ee);const t=this;e.then(function(n){t.setView(new Ee(n))})}updateSize(){const e=this.getTargetElement();let t;if(e){const s=getComputedStyle(e),r=e.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=e.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(t=[r,o],!_i(t)&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Xi("No map visible because the map container's width or height are 0."))}const n=this.getSize();t&&(!n||!Mt(t,n))&&(this.setSize(t),this.updateViewportSize_())}updateViewportSize_(){const e=this.getView();if(e){let t;const n=getComputedStyle(this.viewport_);n.width&&n.height&&(t=[parseInt(n.width,10),parseInt(n.height,10)]),e.setViewportSize(t)}}}function Ra(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new Zt({layers:i.layers});t[Z.LAYERGROUP]=n,t[Z.TARGET]=i.target,t[Z.VIEW]=i.view instanceof Ee?i.view:new Ee;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new ge(i.controls.slice()):(w(typeof i.controls.getArray=="function",47),s=i.controls));let r;i.interactions!==void 0&&(Array.isArray(i.interactions)?r=new ge(i.interactions.slice()):(w(typeof i.interactions.getArray=="function",48),r=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new ge(i.overlays.slice()):(w(typeof i.overlays.getArray=="function",49),o=i.overlays):o=new ge,{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:t}}const va=Ca;class xa extends gn{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.interimTile=null,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(v.CHANGE)}release(){this.state===C.ERROR&&this.setState(C.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==C.LOADED)return this.transition_=0,e;e=e.interimTile}while(e);return this}refreshInterimChain(){if(!this.interimTile)return;let e=this.interimTile,t=this;do{if(e.getState()==C.LOADED){e.interimTile=null;break}else e.getState()==C.LOADING?t=e:e.getState()==C.IDLE?t.interimTile=e.interimTile:t=e;e=t.interimTile}while(e)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==C.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){S()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;const s=t-n+1e3/60;return s>=this.transition_?1:ji(s/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const os=xa,et={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Pa(i,e,t){const n=i;let s=!0,r=!1,o=!1;const a=[xt(n,v.LOAD,function(){o=!0,r||e()})];return n.src&&Gs?(r=!0,n.decode().then(function(){s&&e()}).catch(function(l){s&&(o?e():t())})):a.push(xt(n,v.ERROR,t)),function(){s=!1,a.forEach(A)}}class La extends os{constructor(e,t,n,s,r,o){super(e,t,o),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(e){this.image_=e,this.state=C.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=C.ERROR,this.unlistenImage_(),this.image_=ba(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=C.LOADED:this.state=C.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==C.ERROR&&(this.state=C.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==C.IDLE&&(this.state=C.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Pa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function ba(){const i=Be(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}const as=La,Da=.5,wa=10,mi=.25;class Ia{constructor(e,t,n,s,r,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=wt(this.targetProj_,this.sourceProj_);this.transformInv_=function(T){const y=T[0]+"/"+T[1];return a[y]||(a[y]=l(T)),a[y]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&F(s)==F(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?F(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?F(this.targetProj_.getExtent()):null;const h=we(n),u=kt(n),c=Gt(n),d=Ft(n),g=this.transformInv_(h),f=this.transformInv_(u),_=this.transformInv_(c),p=this.transformInv_(d),E=wa+(o?Math.max(0,Math.ceil(Math.log2(en(n)/(o*o*256*256)))):0);if(this.addQuad_(h,u,c,d,g,f,_,p,E),this.wrapsXInSource_){let T=1/0;this.triangles_.forEach(function(y,m,R){T=Math.min(T,y.source[0][0],y.source[1][0],y.source[2][0])}),this.triangles_.forEach(y=>{if(Math.max(y.source[0][0],y.source[1][0],y.source[2][0])-T>this.sourceWorldWidth_/2){const m=[[y.source[0][0],y.source[0][1]],[y.source[1][0],y.source[1][1]],[y.source[2][0],y.source[2][1]]];m[0][0]-T>this.sourceWorldWidth_/2&&(m[0][0]-=this.sourceWorldWidth_),m[1][0]-T>this.sourceWorldWidth_/2&&(m[1][0]-=this.sourceWorldWidth_),m[2][0]-T>this.sourceWorldWidth_/2&&(m[2][0]-=this.sourceWorldWidth_);const R=Math.min(m[0][0],m[1][0],m[2][0]);Math.max(m[0][0],m[1][0],m[2][0])-R.5&&c<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=Hn([e,t,n,s]);f=F(p)/this.targetWorldWidth_>mi||f}!g&&this.sourceProj_.isGlobal()&&c&&(f=c>mi||f)}if(!f&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!zt(u,this.maxSourceExtent_))return;let _=0;if(!f&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)f=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!f){const p=[(e[0]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(p);let T;g?T=(Ye(r[0],d)+Ye(a[0],d))/2-Ye(E[0],d):T=(r[0]+a[0])/2-E[0];const y=(r[1]+a[1])/2-E[1];f=T*T+y*y>this.errorThresholdSquared_}if(f){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const p=[(t[0]+n[0])/2,(t[1]+n[1])/2],E=this.transformInv_(p),T=[(s[0]+e[0])/2,(s[1]+e[1])/2],y=this.transformInv_(T);this.addQuad_(e,t,p,T,r,o,E,y,h-1),this.addQuad_(T,p,n,s,y,E,a,l,h-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],E=this.transformInv_(p),T=[(n[0]+s[0])/2,(n[1]+s[1])/2],y=this.transformInv_(T);this.addQuad_(e,p,T,s,r,E,y,l,h-1),this.addQuad_(p,t,n,T,E,o,a,y,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(e,n,s,r,a,l),(_&14)==0&&this.addTriangle_(e,n,t,r,a,o),_&&((_&13)==0&&this.addTriangle_(t,s,e,o,l,r),(_&7)==0&&this.addTriangle_(t,s,n,o,l,a))}calculateSourceExtent(){const e=De();return this.triangles_.forEach(function(t,n,s){const r=t.source;Ct(e,r[0]),Ct(e,r[1]),Ct(e,r[2])}),e}getTriangles(){return this.triangles_}}const Ma=Ia;let $t;const Ve=[];function Ti(i,e,t,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,s)),i.restore()}function qt(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Sa(){if($t===void 0){const i=Be(6,6,Ve);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Ti(i,4,5,4,0),Ti(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;$t=qt(e,0)||qt(e,4)||qt(e,8),En(i),Ve.push(i.canvas)}return $t}function pi(i,e,t,n){const s=Ui(t,e,i);let r=ii(e,n,t);const o=e.getMetersPerUnit();o!==void 0&&(r*=o);const a=i.getMetersPerUnit();a!==void 0&&(r/=a);const l=i.getExtent();if(!l||fn(l,s)){const h=ii(i,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Aa(i,e,t,n){const s=rt(t);let r=pi(i,e,s,n);return(!isFinite(r)||r<=0)&&Si(t,function(o){return r=pi(i,e,o,n),isFinite(r)&&r>0}),r}function Oa(i,e,t,n,s,r,o,a,l,h,u,c){const d=Be(Math.round(t*i),Math.round(t*e),Ve);if(c||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(t,t);function g(m){return Math.round(m*t)/t}d.globalCompositeOperation="lighter";const f=De();l.forEach(function(m,R,b){Us(f,m.extent)});const _=F(f),p=ie(f),E=Be(Math.round(t*_/n),Math.round(t*p/n),Ve);c||(E.imageSmoothingEnabled=!1);const T=t/n;l.forEach(function(m,R,b){const P=m.extent[0]-f[0],I=-(m.extent[3]-f[3]),k=F(m.extent),K=ie(m.extent);m.image.width>0&&m.image.height>0&&E.drawImage(m.image,h,h,m.image.width-2*h,m.image.height-2*h,P*T,I*T,k*T,K*T)});const y=we(o);return a.getTriangles().forEach(function(m,R,b){const P=m.source,I=m.target;let k=P[0][0],K=P[0][1],Q=P[1][0],fe=P[1][1],_e=P[2][0],qe=P[2][1];const ee=g((I[0][0]-y[0])/r),re=g(-(I[0][1]-y[1])/r),D=g((I[1][0]-y[0])/r),H=g(-(I[1][1]-y[1])/r),oe=g((I[2][0]-y[0])/r),te=g(-(I[2][1]-y[1])/r),xe=k,U=K;k=0,K=0,Q-=xe,fe-=U,_e-=xe,qe-=U;const ne=[[Q,fe,0,0,D-ee],[_e,qe,0,0,oe-ee],[0,0,Q,fe,H-re],[0,0,_e,qe,te-re]],N=Bs(ne);if(!!N){if(d.save(),d.beginPath(),Sa()||!c){d.moveTo(D,H);const O=4,Ie=ee-D,me=re-H;for(let j=0;j{t&&t.getState()==C.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=C.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),s=typeof n=="number"?n:n[0],r=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Oa(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=C.LOADED}this.changed()}load(){if(this.state==C.IDLE){this.state=C.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const n=t.getState();if(n==C.IDLE||n==C.LOADING){e++;const s=x(t,v.CHANGE,function(r){const o=t.getState();(o==C.LOADED||o==C.ERROR||o==C.EMPTY)&&(A(s),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,n,s){t.getState()==C.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(A),this.sourcesListenerKeys_=null}release(){this.canvas_&&(En(this.canvas_.getContext("2d")),Ve.push(this.canvas_),this.canvas_=null),super.release()}}const hn=Na;class Fa{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return w(n!==void 0,15),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return w(t!==void 0,15),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){if(!!this.containsKey(e))return this.entries_[e].value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){w(!(e in this.entries_),16);const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}const Ga=Fa;function yi(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Kt(i,e,t){return i+"/"+e+"/"+t}function ls(i){return Kt(i[0],i[1],i[2])}function ka(i){return i.split("/").map(Number)}function za(i){return(i[1]<t||t>e.getMaxZoom())return!1;const r=e.getFullTileRange(t);return r?r.containsXY(n,s):!0}class Za extends Ga{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(e){for(;this.canExpireCache()&&!(this.peekLast().getKey()in e);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const e=this.peekFirstKey(),n=ka(e)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove(ls(s.tileCoord)),s.release())})}}const hs=Za,Jt={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Ka extends se{constructor(e){super(),this.projection=J(e.projection),this.attributions_=Ei(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(n,s){t.viewResolver=n,t.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Ei(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Ei(i){return i?Array.isArray(i)?function(e){return i}:typeof i=="function"?i:function(e){return[i]}:null}const Ua=Ka;class us{constructor(e,t,n,s){this.minX=e,this.maxX=t,this.minY=n,this.maxY=s}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function Ne(i,e,t,n,s){return s!==void 0?(s.minX=i,s.maxX=e,s.minY=t,s.maxY=n,s):new us(i,e,t,n)}const cs=us,Fe=[0,0,0],Te=5;class ja{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,w(vs(this.resolutions_,function(s,r){return r-s},!0),17);let t;if(!e.origins){for(let s=0,r=this.resolutions_.length-1;s=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),r=Ne(o,o,a,a,n)):r=this.getTileRangeForExtentAndZ(l,h,n),t(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]this.maxZoom||t0?n:Math.max(r/t[0],s/t[1]);const o=e+1,a=new Array(o);for(let l=0;ln.highWaterMark&&(n.highWaterMark=e)}useTile(e,t,n,s){}}class $a extends ve{constructor(e,t){super(e),this.tile=t}}const qa=Ba;function Ja(i,e){const t=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(!!o)return i.replace(t,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,function(){const h=o[0],u=e.getFullTileRange(h);return w(u,55),(u.getHeight()-o[2]-1).toString()})}}function Qa(i,e){const t=i.length,n=new Array(t);for(let s=0;sthis.getTileInternal(p,E,T,y,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return _.key=c,h?(_.interimTile=h,_.refreshInterimChain(),a.replace(u,_)):a.set(u,_),_}getTileInternal(e,t,n,s,r){let o=null;const a=Kt(e,t,n),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(e,t,n,s,r,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(e,t,n,s,r,l),h.getState()==C.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const n=J(e);if(n){const s=Y(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function sl(i,e){i.getImage().src=e}const rl=il;class ol extends rl{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:Va({extent:On(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:e.opaque,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const al=ol,ll='© OpenStreetMap contributors.';class hl extends al{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[ll];const n=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",s=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:n,interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,opaque:e.opaque!==void 0?e.opaque:!0,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:s,wrapX:e.wrapX,zDirection:e.zDirection})}}const ul=hl,X={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class cl extends se{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+_r,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(X.ELEMENT,this.handleElementChanged),this.addChangeListener(X.MAP,this.handleMapChanged),this.addChangeListener(X.OFFSET,this.handleOffsetChanged),this.addChangeListener(X.POSITION,this.handlePositionChanged),this.addChangeListener(X.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(X.ELEMENT)}getId(){return this.id}getMap(){return this.get(X.MAP)||null}getOffset(){return this.get(X.OFFSET)}getPosition(){return this.get(X.POSITION)}getPositioning(){return this.get(X.POSITIONING)}handleElementChanged(){Gi(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(Lt(this.element),A(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=x(e,ce.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(X.ELEMENT,e)}setMap(e){this.set(X.MAP,e)}setOffset(e){this.set(X.OFFSET,e)}setPosition(e){this.set(X.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(X.POSITION))return;const n=this.getRect(t.getTargetElement(),t.getSize()),s=this.getElement(),r=this.getRect(s,[mr(s),Tr(s)]);e=e||{};const o=e.margin===void 0?20:e.margin;if(!wi(n,r)){const a=r[0]-n[0],l=n[2]-r[2],h=r[1]-n[1],u=n[3]-r[3],c=[0,0];if(a<0?c[0]=a-o:l<0&&(c[0]=Math.abs(l)+o),h<0?c[1]=h-o:u<0&&(c[1]=Math.abs(u)+o),c[0]!==0||c[1]!==0){const d=t.getView().getCenterInternal(),g=t.getPixelFromCoordinateInternal(d);if(!g)return;const f=[g[0]+c[0],g[1]+c[1]],_=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(f),duration:_.duration,easing:_.easing})}}}getRect(e,t){const n=e.getBoundingClientRect(),s=n.left+window.pageXOffset,r=n.top+window.pageYOffset;return[s,r,s+t[0],r+t[1]]}setPositioning(e){this.set(X.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const n=e.getPixelFromCoordinate(t),s=e.getSize();this.updateRenderedPosition(n,s)}updateRenderedPosition(e,t){const n=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=Math.round(e[0]+s[0])+"px",a=Math.round(e[1]+s[1])+"px";let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const u=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=u&&(this.rendered.transform_=u,n.transform=u)}getOptions(){return this.options}}const dl=cl,Et={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class gl extends Tn{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getPreload(){return this.get(Et.PRELOAD)}setPreload(e){this.set(Et.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Et.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Et.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const fl=gl;class _l extends Ri{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return S()}getData(e){return null}prepareFrame(e){return S()}renderFrame(e,t){return S()}loadedTileCallback(e,t,n){e[t]||(e[t]={}),e[t][n.tileCoord.toString()]=n}createLoadedTileFinder(e,t,n){return(s,r)=>{const o=this.loadedTileCallback.bind(this,n,s);return e.forEachLoadedTile(t,s,r,o)}}forEachFeatureAtCoordinate(e,t,n,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){e.target.getState()===et.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=et.LOADED&&t!=et.ERROR&&e.addEventListener(v.CHANGE,this.boundHandleImageChange_),t==et.IDLE&&(e.load(),t=e.getState()),t==et.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const ml=_l;let Xe=null;function Tl(){Xe=Be(1,1,void 0,{willReadFrequently:!0})}class pl extends ml{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ue(),this.pixelTransform=Ue(),this.inversePixelTransform=Ue(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,n){Xe||Tl(),Xe.clearRect(0,0,1,1);let s;try{Xe.drawImage(e,t,n,1,1,0,0,1,1),s=Xe.getImageData(0,0,1,1).data}catch{return Xe=null,null}return s}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){const s=this.getLayer().getClassName();let r,o;if(e&&e.className===s&&(!n||e&&e.style.backgroundColor&&Mt(Wn(e.style.backgroundColor),Wn(n)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===t?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){r=document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=Be();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const s=we(n),r=kt(n),o=Gt(n),a=Ft(n);W(t.coordinateToPixelTransform,s),W(t.coordinateToPixelTransform,r),W(t.coordinateToPixelTransform,o),W(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;W(l,s),W(l,r),W(l,o),W(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}dispatchRenderEvent_(e,t,n){const s=this.getLayer();if(s.hasListener(e)){const r=new Fi(e,this.inversePixelTransform,n,t);s.dispatchEvent(r)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(Ce.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(Ce.POSTRENDER,e,t)}getRenderTransform(e,t,n,s,r,o,a){const l=r/2,h=o/2,u=s/t,c=-u,d=-e[0]+a,g=-e[1];return st(this.tempTransform,l,h,u,c,-n,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const yl=pl;class El extends yl{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=De(),this.tmpTileRange_=new cs(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),n=e.getState(),s=t.getUseInterimTilesOnError();return n==C.LOADED||n==C.EMPTY||n==C.ERROR&&!s}getTile(e,t,n,s){const r=s.pixelRatio,o=s.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(e,t,n,r,o);return h.getState()==C.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),s=W(t.pixelToCoordinateTransform,e.slice()),r=n.getExtent();if(r&&!fn(r,s))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,h=n.getRenderSource(),u=h.getTileGridForProjection(l.projection),c=h.getTilePixelRatio(t.pixelRatio);for(let d=u.getZForResolution(l.resolution);d>=u.getMinZoom();--d){const g=u.getTileCoordForCoordAndZ(s,d),f=h.getTile(d,g[1],g[2],o,a);if(!(f instanceof as||f instanceof hn)||f instanceof hn&&f.getState()===C.EMPTY)return null;if(f.getState()!==C.LOADED)continue;const _=u.getOrigin(d),p=de(u.getTileSize(d)),E=u.getResolution(d),T=Math.floor(c*((s[0]-_[0])/E-g[1]*p[0])),y=Math.floor(c*((_[1]-s[1])/E-g[2]*p[1])),m=Math.round(c*h.getGutterForProjection(l.projection));return this.getImageData(f.getImage(),T+m,y+m)}return null}loadedTileCallback(e,t,n){return this.isDrawableTile(n)?super.loadedTileCallback(e,t,n):!1}prepareFrame(e){return!!this.getLayer().getSource()}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex],s=e.viewState,r=s.projection,o=s.resolution,a=s.center,l=s.rotation,h=e.pixelRatio,u=this.getLayer(),c=u.getSource(),d=c.getRevision(),g=c.getTileGridForProjection(r),f=g.getZForResolution(o,c.zDirection),_=g.getResolution(f);let p=e.extent;const E=e.viewState.resolution,T=c.getTilePixelRatio(h),y=Math.round(F(p)/E*h),m=Math.round(ie(p)/E*h),R=n.extent&&Ke(n.extent);R&&(p=tt(p,Ke(n.extent)));const b=_*y/2/T,P=_*m/2/T,I=[a[0]-b,a[1]-P,a[0]+b,a[1]+P],k=g.getTileRangeForExtentAndZ(p,f),K={};K[f]={};const Q=this.createLoadedTileFinder(c,r,K),fe=this.tmpExtent,_e=this.tmpTileRange_;this.newTiles_=!1;const qe=l?nn(s.center,E,l,e.size):void 0;for(let ne=k.minX;ne<=k.maxX;++ne)for(let N=k.minY;N<=k.maxY;++N){if(l&&!g.tileCoordIntersectsViewport([f,ne,N],qe))continue;const O=this.getTile(f,ne,N,e);if(this.isDrawableTile(O)){const j=Y(this);if(O.getState()==C.LOADED){K[f][O.tileCoord.toString()]=O;let Me=O.inTransition(j);Me&&n.opacity!==1&&(O.endTransition(j),Me=!1),!this.newTiles_&&(Me||!this.renderedTiles.includes(O))&&(this.newTiles_=!0)}if(O.getAlpha(j,e.time)===1)continue}const Ie=g.getTileCoordChildTileRange(O.tileCoord,_e,fe);let me=!1;Ie&&(me=Q(f+1,Ie)),me||g.forEachTileCoordParentTileRange(O.tileCoord,Q,_e,fe)}const ee=_/o*h/T;st(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-y/2,-m/2);const re=zs(this.pixelTransform);this.useContainer(t,re,this.getBackground(e));const D=this.context,H=D.canvas;bi(this.inversePixelTransform,this.pixelTransform),st(this.tempTransform,y/2,m/2,ee,ee,0,-y/2,-m/2),H.width!=y||H.height!=m?(H.width=y,H.height=m):this.containerReused||D.clearRect(0,0,y,m),R&&this.clipUnrotated(D,e,R),c.getInterpolate()||(D.imageSmoothingEnabled=!1),this.preRender(D,e),this.renderedTiles.length=0;let oe=Object.keys(K).map(Number);oe.sort(cn);let te,xe,U;n.opacity===1&&(!this.containerReused||c.getOpaque(e.viewState.projection))?oe=oe.reverse():(te=[],xe=[]);for(let ne=oe.length-1;ne>=0;--ne){const N=oe[ne],O=c.getTilePixelSize(N,h,r),me=g.getResolution(N)/_,j=O[0]*me*ee,Me=O[1]*me*ee,Ut=g.getTileCoordForCoordAndZ(we(I),N),Fn=g.getTileCoordExtent(Ut),ct=W(this.tempTransform,[T*(Fn[0]-I[0])/_,T*(I[3]-Fn[3])/_]),_s=T*c.getGutterForProjection(r),Gn=K[N];for(const ms in Gn){const Se=Gn[ms],kn=Se.tileCoord,zn=Ut[1]-kn[1],Ts=Math.round(ct[0]-(zn-1)*j),Xn=Ut[2]-kn[2],ps=Math.round(ct[1]-(Xn-1)*Me),ae=Math.round(ct[0]-zn*j),le=Math.round(ct[1]-Xn*Me),Je=Ts-ae,Qe=ps-le,Zn=f===N,Kn=Zn&&Se.getAlpha(Y(this),e.time)!==1;let jt=!1;if(!Kn)if(te){U=[ae,le,ae+Je,le,ae+Je,le+Qe,ae,le+Qe];for(let dt=0,ys=te.length;dt",Ci[he]=new dl({position:Vr([Ge[he].TrainLongitude,Ge[he].TrainLatitude]),positioning:"center-center",element:document.getElementById(String(Ge[he].TrainCode)),stopEvent:!1}),Pl.addOverlay(Ci[he]); //# sourceMappingURL=index.235aa467.js.map