class Fo{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Dt=Fo,Re={PROPERTYCHANGE:"propertychange"};class ko{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var gn=ko;function Te(s,t){return s>t?1:s0){for(n=1;n0?n-1:n:s[n-1]-t0||e&&o===0)})}function Ue(){return!0}function Si(){return!1}function se(){}function Xo(s){let t=!1,e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ne(r,i))&&(t=!0,n=this,i=r,e=s.apply(this,arguments)),e}}function Ve(s){for(const t in s)delete s[t]}function je(s){let t;for(t in s)return!1;return!t}class Wo extends gn{constructor(t){super();this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new Dt(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h0:!1}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=se,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}}var wi=Wo,P={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 G(s,t,e,i,n){if(i&&i!==s&&(e=e.bind(i)),n){const o=e;e=function(){s.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function Li(s,t,e,i){return G(s,t,e,i,!0)}function V(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),Ve(s))}class Ai extends wi{constructor(){super();this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return ve(s,t,e,i)}function ve(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Vo(s){const t=s.length;for(let i=0;ir&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function Mi(s){return s*Math.PI/180}function Ie(s,t){const e=s%t;return e*t<0?e+t:e}function re(s,t,e){return s+e*(t-s)}function Ms(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Oi(s,t){return Math.floor(Ms(s,t))}function bi(s,t){return Math.ceil(Ms(s,t))}class jo extends vt{constructor(t){super();this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[B.OPACITY]=t.opacity!==void 0?t.opacity:1,N(typeof e[B.OPACITY]=="number",64),e[B.VISIBLE]=t.visible!==void 0?t.visible:!0,e[B.Z_INDEX]=t.zIndex,e[B.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[B.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[B.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[B.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=$(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return X()}getLayerStatesArray(t){return X()}getExtent(){return this.get(B.EXTENT)}getMaxResolution(){return this.get(B.MAX_RESOLUTION)}getMinResolution(){return this.get(B.MIN_RESOLUTION)}getMinZoom(){return this.get(B.MIN_ZOOM)}getMaxZoom(){return this.get(B.MAX_ZOOM)}getOpacity(){return this.get(B.OPACITY)}getSourceState(){return X()}getVisible(){return this.get(B.VISIBLE)}getZIndex(){return this.get(B.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(B.EXTENT,t)}setMaxResolution(t){this.set(B.MAX_RESOLUTION,t)}setMinResolution(t){this.set(B.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(B.MAX_ZOOM,t)}setMinZoom(t){this.set(B.MIN_ZOOM,t)}setOpacity(t){N(typeof t=="number",64),this.set(B.OPACITY,t)}setVisible(t){this.set(B.VISIBLE,t)}setZIndex(t){this.set(B.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var Os=jo,Zt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class Ho extends Os{constructor(t){const e=Object.assign({},t);delete e.source;super(e);this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(B.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(B.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed()}handleSourcePropertyChange_(){this.sourceChangeKey_&&(V(this.sourceChangeKey_),this.sourceChangeKey_=null);const t=this.getSource();t&&(this.sourceChangeKey_=G(t,P.CHANGE,this.handleSourceChange_,this)),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise(e=>e([]))}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}render(t,e){const i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(B.MAP,t)}getMapInternal(){return this.get(B.MAP)}setMap(t){this.mapPrecomposeKey_&&(V(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(V(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=G(t,Zt.PRECOMPOSE,function(e){const n=e.frameState.layerStatesArray,r=this.getLayerState(!1);N(!n.some(function(o){return o.layer===r.layer}),67),n.push(r)},this),this.mapRenderKey_=G(this,P.CHANGE,t.render,t),this.changed())}setSource(t){this.set(B.SOURCE,t)}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(s,t){if(!s.visible)return!1;const e=t.resolution;if(e=s.maxResolution)return!1;const i=t.zoom;return i>s.minZoom&&i<=s.maxZoom}var Pi=Ho;function $o(s,t,e,i,n){bs(s,t,e||0,i||s.length-1,n||qo)}function bs(s,t,e,i,n){for(;i>e;){if(i-e>600){var r=i-e+1,o=t-e+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/r+h)),u=Math.min(i,Math.floor(t+(r-o)*l/r+h));bs(s,t,c,u,n)}var d=s[t],f=e,g=i;for(He(s,e,t),n(s[i],d)>0&&He(s,e,i);f0;)g--}n(s[e],d)===0?He(s,e,g):(g++,He(s,g,i)),g<=t&&(e=g+1),t<=g&&(i=g-1)}}function He(s,t,e){var i=s[t];s[t]=s[e],s[e]=i}function qo(s,t){return st?1:0}class Ps{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Fi(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=we(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Se(i,this.toBBox),Se(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=we([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Se(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=$e(t,0,a,this.toBBox),h=$e(t,a,i,this.toBBox),c=ia(l,h),u=pn(l)+pn(h);c=e;h--){const c=t.children[h];qe(a,t.leaf?r(c):c),l+=Di(a)}return l}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)qe(e[n],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Se(t[e],this.toBBox)}}function Jo(s,t,e){if(!e)return t.indexOf(s);for(let i=0;i=s.minX&&t.maxY>=s.minY}function we(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ds(s,t,e,i,n){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;$o(s,o,t,e,n),r.push(t,o,o,e)}}var J={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Fs(s){return s[0]>0&&s[1]>0}function na(s,t,e){return e===void 0&&(e=[0,0]),e[0]=s[0]*t+.5|0,e[1]=s[1]*t+.5|0,e}function ft(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}class xn{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ft(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new xn({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return X()}getImage(t){return X()}getHitDetectionImage(){return X()}getPixelRatio(t){return 1}getImageState(){return X()}getImageSize(){return X()}getOrigin(){return X()}getSize(){return X()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ft(t)}listenImageChange(t){X()}load(){X()}unlistenImageChange(t){X()}}var ks=xn;const sa=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ra=/^([a-z]*)$|^hsla?\(.*\)$/i;function Ns(s){return typeof s=="string"?s:Xs(s)}function oa(s){const t=document.createElement("div");if(t.style.color=s,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}else return""}const aa=function(){const s=1024,t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=s){let r=0;for(const o in t)(r++&3)==0&&(delete t[o],--e)}n=la(i),t[i]=n,++e}return n}}();function ki(s){return Array.isArray(s)?s:aa(s)}function la(s){let t,e,i,n,r;if(ra.exec(s)&&(s=oa(s)),sa.exec(s)){const o=s.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;t=parseInt(s.substr(1+0*a,a),16),e=parseInt(s.substr(1+1*a,a),16),i=parseInt(s.substr(1+2*a,a),16),l?n=parseInt(s.substr(1+3*a,a),16):n=255,a==1&&(t=(t<<4)+t,e=(e<<4)+e,i=(i<<4)+i,l&&(n=(n<<4)+n)),r=[t,e,i,n/255]}else s.startsWith("rgba(")?(r=s.slice(5,-1).split(",").map(Number),Gs(r)):s.startsWith("rgb(")?(r=s.slice(4,-1).split(",").map(Number),r.push(1),Gs(r)):N(!1,14);return r}function Gs(s){return s[0]=$(s[0]+.5|0,0,255),s[1]=$(s[1]+.5|0,0,255),s[2]=$(s[2]+.5|0,0,255),s[3]=$(s[3],0,1),s}function Xs(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*100)/100;return"rgba("+t+","+e+","+i+","+n+")"}function It(s){return Array.isArray(s)?Xs(s):s}const Ut=typeof navigator!="undefined"&&typeof navigator.userAgent!="undefined"?navigator.userAgent.toLowerCase():"",ha=Ut.includes("firefox"),ca=Ut.includes("safari")&&!Ut.includes("chrom");ca&&(Ut.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Ut));const ua=Ut.includes("webkit")&&!Ut.includes("edge"),da=Ut.includes("macintosh"),Ws=typeof devicePixelRatio!="undefined"?devicePixelRatio:1,En=typeof WorkerGlobalScope!="undefined"&&typeof OffscreenCanvas!="undefined"&&self instanceof WorkerGlobalScope,fa=typeof Image!="undefined"&&Image.prototype.decode,Ys=function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s}();function gt(s,t,e,i){let n;return e&&e.length?n=e.shift():En?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}function zs(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Bs(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Cn(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}function ga(s){for(;s.lastChild;)s.removeChild(s.lastChild)}function _a(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}const Ni="ol-hidden",Gi="ol-unselectable",Rn="ol-control",Ks="ol-collapsed",ma=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Zs=["style","variant","weight","size","lineHeight","family"],Us=function(s){const t=s.match(ma);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,n=Zs.length;iMath.max(n,Yi(s,r)),0);return e[t]=i,i}function xa(s,t){const e=[],i=[],n=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===` `||h===c){r=Math.max(r,o),n.push(o),o=0,a+=l;continue}const d=t[h+1]||s.font,f=Yi(d,u);e.push(f),o+=f;const g=ya(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function Ea(s,t,e,i,n,r,o,a,l,h,c){s.save(),e!==1&&(s.globalAlpha*=e),t&&s.setTransform.apply(s,t),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),Ca(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function Ca(s,t){const e=s.contextInstructions;for(let i=0,n=e.length;ithis.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)==0&&!i.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=tr(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=tr(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function tr(s,t,e){const i=e?Ns(e):"null";return t+":"+s+":"+i}const Bi=new va;var tt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function er(s){const t=xt();for(let e=0,i=s.length;en&&(l=l|tt.RIGHT),ar&&(l=l|tt.ABOVE),l===tt.UNKNOWN&&(l=tt.INTERSECTING),l}function xt(){return[1/0,1/0,-1/0,-1/0]}function Nt(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Zi(s){return Nt(1/0,1/0,-1/0,-1/0,s)}function Ia(s,t){const e=s[0],i=s[1];return Nt(e,i,e,i,t)}function Sa(s,t,e,i,n){const r=Zi(n);return rr(r,s,t,e,i)}function si(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function wa(s,t){return t[0]s[2]&&(s[2]=t[2]),t[1]s[3]&&(s[3]=t[3]),s}function ri(s,t){t[0]s[2]&&(s[2]=t[0]),t[1]s[3]&&(s[3]=t[1])}function rr(s,t,e,i,n){for(;et[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function Nn(s){return s[2]=o&&_<=l),!i&&!!(r&tt.RIGHT)&&!(n&tt.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=h),!i&&!!(r&tt.BELOW)&&!(n&tt.BELOW)&&(_=d-(f-a)/g,i=_>=o&&_<=l),!i&&!!(r&tt.LEFT)&&!(n&tt.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=h)}return i}function ar(s,t){const e=t.getExtent(),i=Oe(s);if(t.canWrapX()&&(i[0]=e[2])){const n=U(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function ba(s,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[e[0],s[1],e[2],s[3]]];ar(s,t);const i=U(e);if(U(s)>i)return[[e[0],s[1],e[2],s[3]]];if(s[0]e[2])return[[s[0],s[1],e[2],s[3]],[e[0],s[1],s[2]-i,s[3]]]}return[s]}function lr(s,t,e){const i=s;let n=!0,r=!1,o=!1;const a=[Li(i,P.LOAD,function(){o=!0,r||t()})];return i.src&&fa?(r=!0,i.decode().then(function(){n&&t()}).catch(function(l){n&&(o?t():e())})):a.push(Li(i,P.ERROR,e)),function(){n=!1,a.forEach(V)}}let ai=null;class Pa extends wi{constructor(t,e,i,n,r,o){super();this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===J.LOADED){ai||(ai=gt(1,1)),ai.drawImage(this.image_,0,0);try{ai.getImageData(0,0,1,1),this.tainted_=!1}catch{ai=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=J.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=J.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=gt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===J.IDLE){this.image_||this.initializeImage_(),this.imageState_=J.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=lr(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==J.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Ns(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Da(s,t,e,i,n,r){let o=Bi.get(t,i,r);return o||(o=new Pa(s,t,e,i,n,r),Bi.set(t,i,r,o)),o}class Gn extends ks{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode});this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;N(!(a!==void 0&&o),4),N(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||Y(o)),N(a!==void 0&&a.length>0,6);const l=t.src!==void 0?J.IDLE:J.LOADED;this.color_=t.color!==void 0?ki(t.color):null,this.iconImage_=Da(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null}clone(){const t=this.getScale();return new Gn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}listenImageChange(t){this.iconImage_.addEventListener(P.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(P.CHANGE,t)}}var hr=Gn;const Fa="#333";class Xn{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=ft(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Ln({color:Fa}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new Xn({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ft(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var ka=Xn;function cr(s){return new On({fill:li(s,""),stroke:hi(s,""),text:Na(s),image:Ga(s)})}function li(s,t){const e=s[t+"fill-color"];if(!!e)return new Ln({color:e})}function hi(s,t){const e=s[t+"stroke-width"],i=s[t+"stroke-color"];if(!(!e&&!i))return new Js({width:e,color:i,lineCap:s[t+"stroke-line-cap"],lineJoin:s[t+"stroke-line-join"],lineDash:s[t+"stroke-line-dash"],lineDashOffset:s[t+"stroke-line-dash-offset"],miterLimit:s[t+"stroke-miter-limit"]})}function Na(s){const t=s["text-value"];return t?new ka({text:t,font:s["text-font"],maxAngle:s["text-max-angle"],offsetX:s["text-offset-x"],offsetY:s["text-offset-y"],overflow:s["text-overflow"],placement:s["text-placement"],scale:s["text-scale"],rotateWithView:s["text-rotate-with-view"],rotation:s["text-rotation"],textAlign:s["text-align"],justify:s["text-justify"],textBaseline:s["text-baseline"],padding:s["text-padding"],fill:li(s,"text-"),backgroundFill:li(s,"text-background-"),stroke:hi(s,"text-"),backgroundStroke:hi(s,"text-background-")}):void 0}function Ga(s){const t=s["icon-src"],e=s["icon-img"];if(t||e)return new hr({src:t,img:e,imgSize:s["icon-img-size"],anchor:s["icon-anchor"],anchorOrigin:s["icon-anchor-origin"],anchorXUnits:s["icon-anchor-x-units"],anchorYUnits:s["icon-anchor-y-units"],color:s["icon-color"],crossOrigin:s["icon-cross-origin"],offset:s["icon-offset"],displacement:s["icon-displacement"],opacity:s["icon-opacity"],scale:s["icon-scale"],rotation:s["icon-rotation"],rotateWithView:s["icon-rotate-with-view"],size:s["icon-size"],declutterMode:s["icon-declutter-mode"]});const i=s["shape-points"];if(i){const r="shape-";return new $s({points:i,fill:li(s,r),stroke:hi(s,r),radius:s["shape-radius"],radius1:s["shape-radius1"],radius2:s["shape-radius2"],angle:s["shape-angle"],displacement:s["shape-displacement"],rotation:s["shape-rotation"],rotateWithView:s["shape-rotate-with-view"],scale:s["shape-scale"],declutterMode:s["shape-declutter-mode"]})}const n=s["circle-radius"];if(n){const r="circle-";return new qs({radius:n,fill:li(s,r),stroke:hi(s,r),displacement:s["circle-displacement"],scale:s["circle-scale"],rotation:s["circle-rotation"],rotateWithView:s["circle-rotate-with-view"],declutterMode:s["circle-declutter-mode"]})}}const ur={RENDER_ORDER:"renderOrder"};class Xa extends Pi{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting;super(e);this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ur.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Ps(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(ur.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=Ta;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof On)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;ra&&(this.instructions.push([O.CUSTOM,a,h,t,i,be]),this.hitDetectionInstructions.push([O.CUSTOM,a,h,t,n||i,be]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([O.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([O.CUSTOM,a,h,t,n||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,r,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!ne(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ir(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;bn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var ui=za;class Ba extends ui{constructor(t,e,i,n){super(t,e,i,n);this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([O.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([O.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}var Ka=Ba;class Za extends ui{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[O.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Je,Qe],le);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Vt),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],le);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c0;){const u=h.pop(),d=h.pop();let f=0;const g=s[d],_=s[d+1],m=s[u],p=s[u+1];for(let y=d+i;yf&&(c=y,f=C)}f>n&&(l[(c-t)/i]=1,d+i0&&_>f)&&(g<0&&m0&&m>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function Ha(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;ls&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=f,m=y,p=x),g=E,_=C}return l+=f,l>a?[h,u]:[r,o]}const di={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Ja extends ui{constructor(t,e,i,n){super(t,e,i,n);this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!lt(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const _=t.getEndss();u=[];for(let m=0,p=_.length;m{const x=o[(m+y)*2]===h[y*c]&&o[(m+y)*2+1]===h[y*c+1];return x||--m,x})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let f=r.padding;if(f!=oe&&(r.scale[0]<0||r.scale[1]<0)){let m=r.padding[0],p=r.padding[1],y=r.padding[2],x=r.padding[3];r.scale[0]<0&&(p=-p,x=-x),r.scale[1]<0&&(m=-m,y=-y),f=[m,p,y,x]}const g=this.pixelRatio;this.instructions.push([O.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==oe?oe:f.map(function(m){return m*g}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const _=1/g;this.hitDetectionInstructions.push([O.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,void 0,this.declutterImageWithText_,f,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||ii,justify:e.justify,textBaseline:e.textBaseline||Wi,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=di[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([O.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,1,c,r,d,u,o,1/l])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=It(o.getColor()||Ft)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const g=a.getLineDash(),_=a.getLineDashOffset(),m=a.getWidth(),p=a.getMiterLimit();r.lineCap=a.getLineCap()||Xi,r.lineDash=g?g.slice():Je,r.lineDashOffset=_===void 0?Qe:_,r.lineJoin=a.getLineJoin()||Le,r.lineWidth=m===void 0?ni:m,r.miterLimit=p===void 0?ti:p,r.strokeStyle=It(a.getColor()||ei)}i=this.textState_;const l=t.getFont()||Vs;pa(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Wi,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||oe,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:Y(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+Y(n.fillStyle):""}this.declutterImageWithText_=e}}const Qa={Circle:_r,Default:ui,Image:Ka,LineString:Ua,Polygon:_r,Text:Ja};class tl{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(r===void 0){const o=Qa[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}var mr=tl;class el extends ws{constructor(t){super();this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return X()}getData(t){return null}prepareFrame(t){return X()}renderFrame(t,e){return X()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return function(n,r){const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,o)}.bind(this)}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){t.target.getState()===J.LOADED&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=J.LOADED&&e!=J.ERROR&&t.addEventListener(P.CHANGE,this.boundHandleImageChange_),e==J.IDLE&&(t.load(),e=t.getState()),e==J.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}var il=el;class nl extends Dt{constructor(t,e,i,n){super(t);this.inversePixelTransform=e,this.frameState=i,this.context=n}}var pr=nl;new Array(6);function wt(){return[1,0,0,1,0,0]}function sl(s,t,e,i,n,r,o){return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s[4]=r,s[5]=o,s}function rl(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function et(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function ol(s,t,e){return sl(s,t,0,0,e,0,0)}function jt(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Wn(s,t){const e=al(t);N(e!==0,32);const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function al(s){return s[0]*s[3]-s[1]*s[2]}let yr;function xr(s){const t="matrix("+s.join(", ")+")";if(En)return t;const e=yr||(yr=document.createElement("div"));return e.style.transform=t,e.style.transform}const Er=[];let Pe=null;function ll(){const s=document.createElement("canvas");s.width=1,s.height=1,Pe=s.getContext("2d")}class hl extends il{constructor(t){super(t);this.container=null,this.renderedResolution,this.tempTransform=wt(),this.pixelTransform=wt(),this.inversePixelTransform=wt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){Pe||ll(),Pe.clearRect(0,0,1,1);let n;try{Pe.drawImage(t,e,i,1,1,0,0,1,1),n=Pe.getImageData(0,0,1,1).data}catch{return Pe=null,null}return n}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ne(ki(t.style.backgroundColor),ki(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,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=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=gt();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&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ae(i),r=ji(i),o=Vi(i),a=Ui(i);et(e.coordinateToPixelTransform,n),et(e.coordinateToPixelTransform,r),et(e.coordinateToPixelTransform,o),et(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;et(l,n),et(l,r),et(l,o),et(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new pr(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Zt.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Zt.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,o,a){const l=r/2,h=o/2,c=n/e,u=-c,d=-t[0]+a,f=-t[1];return jt(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}var Cr=hl;function ce(s,t,e,i,n,r){r=r||[];let o=0;for(let a=t;aM[2]}else W=E>A;const k=Math.PI,F=[],q=T+i===t;t=T,m=0,p=I,d=s[t],f=s[t+1];let w;if(q){y(),w=Math.atan2(f-_,d-g),W&&(w+=w>0?-k:k);const M=(A+E)/2,v=(b+C)/2;return F[0]=[M,v,(S-r)/2,w,n],F}n=n.replace(/\n/g," ");for(let M=0,v=n.length;M0?-k:k),w!==void 0){let z=D-w;if(z+=z>k?-2*k:z<-k?2*k:0,Math.abs(z)>o)return null}w=D;const j=M;let Z=0;for(;M0&&s.push(` `,""),s.push(t,""),s}class ml{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=wt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?di[l.justify]:vr(Array.isArray(t)?t[0]:t,l.textAlign||ii),f=n&&o.lineWidth?o.lineWidth:0,g=u?t:t.split(` `).reduce(_l,[]),{width:_,height:m,widths:p,heights:y,lineWidths:x}=xa(l,g),E=_+f,C=[],T=(E+2)*c[0],I=(m+f)*c[1],S={width:T<0?Math.floor(T):Math.ceil(T),height:I<0?Math.floor(I):Math.ceil(I),contextInstructions:C};(c[0]!=1||c[1]!=1)&&C.push("scale",c),n&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",f),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),i&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const A=.5-d;let b=d*E+A*f;const W=[],k=[];let F=0,q=0,w=0,M=0,v;for(let D=0,j=g.length;Dt?t-h:r,E=o+c>e?e-c:o,C=g[3]+x*d[0]+g[1],T=g[0]+E*d[1]+g[2],I=p-g[3],S=y-g[0];(_||u!==0)&&(Ht[0]=I,$t[0]=I,Ht[1]=S,Gt[1]=S,Gt[0]=I+C,Xt[0]=Gt[0],Xt[1]=S+T,$t[1]=Xt[1]);let A;return u!==0?(A=jt(wt(),i,n,1,1,u,-i,-n),et(A,Ht),et(A,Gt),et(A,Xt),et(A,$t),Nt(Math.min(Ht[0],Gt[0],Xt[0],$t[0]),Math.min(Ht[1],Gt[1],Xt[1],$t[1]),Math.max(Ht[0],Gt[0],Xt[0],$t[0]),Math.max(Ht[1],Gt[1],Xt[1],$t[1]),De)):Nt(Math.min(I,I+C),Math.min(S,S+T),Math.max(I,I+C),Math.max(S,S+T),De),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:De[0],minY:De[1],maxX:De[2],maxY:De[3],value:m},canvasTransform:A,scale:d}}replayImageOrLabel_(t,e,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=t.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,Ht,Gt,Xt,$t,o,a),Ea(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=et(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=vr(Array.isArray(t)?t[0]:t,r.textAlign||ii),c=di[r.textBaseline||Wi],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,n,r,o,a,l){let h;this.pixelCoordinates_&&ne(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=ce(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),rl(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,f,g,_,m,p,y,x,E,C,T,I,S,A=0,b=0,W=null,k=null;const F=this.coordinateCache_,q=this.viewRotation_,w=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:q},v=this.instructions!=n||this.overlaps?0:200;let D,j,Z,Q;for(;cv&&(this.fill_(t),A=0),b>v&&(t.stroke(),b=0),!A&&!b&&(t.beginPath(),m=NaN,p=NaN),++c;break;case O.CIRCLE:d=R[1];const z=h[d],K=h[d+1],Yt=h[d+2],Tt=h[d+3],it=Yt-z,Mt=Tt-K,me=Math.sqrt(it*it+Mt*Mt);t.moveTo(z+me,K),t.arc(z,K,me,0,2*Math.PI,!0),++c;break;case O.CLOSE_PATH:t.closePath(),++c;break;case O.CUSTOM:d=R[1],f=R[2];const yi=R[3],pe=R[4],xi=R.length==6?R[5]:void 0;M.geometry=yi,M.feature=D,c in F||(F[c]=[]);const zt=F[c];xi?xi(h,d,f,2,zt):(zt[0]=h[d],zt[1]=h[d+1],zt.length=2),pe(zt,M),++c;break;case O.DRAW_IMAGE:d=R[1],f=R[2],E=R[3],g=R[4],_=R[5];let ze=R[6];const Bt=R[7],Ei=R[8],Ci=R[9],Ri=R[10];let ye=R[11];const cn=R[12];let ot=R[13];const _t=R[14],yt=R[15];if(!E&&R.length>=20){C=R[19],T=R[20],I=R[21],S=R[22];const ut=this.drawLabelWithPointPlacement_(C,T,I,S);E=ut.label,R[3]=E;const Ce=R[23];g=(ut.anchorX-Ce)*this.pixelRatio,R[4]=g;const mt=R[24];_=(ut.anchorY-mt)*this.pixelRatio,R[5]=_,ze=E.height,R[6]=ze,ot=E.width,R[13]=ot}let Ot;R.length>25&&(Ot=R[25]);let xe,ie,Kt;R.length>17?(xe=R[16],ie=R[17],Kt=R[18]):(xe=oe,ie=!1,Kt=!1),Ri&&w?ye+=q:!Ri&&!w&&(ye-=q);let Ee=0;for(;d0){if(!o||f!=="Image"&&f!=="Text"||o.includes(C)){const b=(d[S]-3)/4,W=n-b%a,k=n-(b/a|0),F=r(C,T,W*W+k*k);if(F)return F}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Te);let m,p,y,x,E;for(m=_.length-1;m>=0;--m){const C=_[m].toString();for(y=this.executorsByZIndex_[C],p=Yn.length-1;p>=0;--p)if(f=Yn[p],x=y[f],x!==void 0&&(E=x.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return ce(a,0,8,2,t,a),a}isEmpty(){return je(this.executorsByZIndex_)}execute(t,e,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Te),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||Yn;let h,c,u,d,f,g;for(a&&l.reverse(),h=0,c=l.length;he)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*t+(s+o))*4+3),r>0&&l.push(((s-r)*t+(s+o))*4+3),o>0&&(l.push(((s+r)*t+(s-o))*4+3),r>0&&l.push(((s-r)*t+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;nqi?r=qi:r<-qi&&(r=-qi),t[n+1]=r}return t}function vl(s,t,e){const i=s.length;e=e>1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;n=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function Kn(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function Ol(s,t){return s[0]*=t,s[1]*=t,s}function Mr(s,t){if(t.canWrapX()){const e=U(t.getExtent()),i=bl(s,t,e);i&&(s[0]-=i*e)}return s}function bl(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]i[2])&&(e=e||U(i),n=Math.floor((s[0]-i[0])/e)),n}const Pl=63710088e-1;function Or(s,t,e){e=e||Pl;const i=Mi(s[1]),n=Mi(t[1]),r=(n-i)/2,o=Mi(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}let Zn=!0;function br(s){Zn=!(s===void 0?!0:s)}function Un(s,t,e){if(t!==void 0){for(let i=0,n=s.length;i=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Zn=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function Nr(s,t){return s}function de(s,t){return s}function Nl(){Fr(wr),Fr(Ar),kl(Ar,wr,Tl,vl)}Nl();const Gr=wt();class Gl extends vt{constructor(){super();this.extent_=xt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Xo(function(t,e,i){if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return X()}closestPointXY(t,e,i,n){return X()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return X()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zi(e),this.extentRevision_=this.getRevision()}return Ma(this.extent_,t)}rotate(t,e){X()}scale(t,e,i){X()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return X()}getType(){return X()}applyTransform(t){X()}intersectsExtent(t){return X()}translate(t,e){X()}transform(t,e){const i=Et(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=St(h)/St(l);return jt(Gr,h[0],h[3],c,-c,0,0,0),ce(r,0,r.length,a,Gr,o),tn(i,e)(r,o,a)}:tn(i,e);return this.applyTransform(n),this}}var Xl=Gl;class Wl extends Xl{constructor(){super();this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return Sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return X()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().lengthu*this.pixelRatio_),lineDashOffset:(o||Qe)*this.pixelRatio_,lineJoin:a!==void 0?a:Le,lineWidth:(l!==void 0?l:ni)*this.pixelRatio_,miterLimit:h!==void 0?h:ti,strokeStyle:It(i||ei)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:It(f||Ft)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Xi,lineDash:_||Je,lineDashOffset:m||Qe,lineJoin:p!==void 0?p:Le,lineWidth:y!==void 0?y:ni,miterLimit:x!==void 0?x:ti,strokeStyle:It(f||ei)}}const n=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:n!==void 0?n:Vs,textAlign:u!==void 0?u:ii,textBaseline:d!==void 0?d:Wi},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}var Kl=Bl;const Lt=.5;function Zl(s,t,e,i,n,r,o){const a=s[0]*Lt,l=s[1]*Lt,h=gt(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new Kl(h,Lt,n,null,o),d=e.length,f=Math.floor((256*256*256-1)/d),g={};for(let m=1;m<=d;++m){const p=e[m-1],y=p.getStyleFunction()||i;if(!i)continue;let x=y(p,r);if(!x)continue;Array.isArray(x)||(x=[x]);const E=m*f,C="#"+("000000"+E.toString(16)).slice(-6);for(let T=0,I=x.length;Tg[2];)++p,y=m*p,c.push(this.getRenderTransform(n,r,o,Lt,u,d,y).slice()),_-=m}this.hitDetectionImageData_=Zl(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(Ul(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,_){const m=Y(f),p=h[m];if(p){if(p!==!0&&_u=f.forEachFeatureAtCoordinate(t,o,a,i,c,f===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(g=>g.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[nt.ANIMATING],r=t.viewHints[nt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=jl);const m=h.center.slice(),p=bn(l,g*u),y=p.slice(),x=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Me(E,t.extent)){const w=U(E),M=Math.max(U(p)/2,w);p[0]=E[0]-M,p[2]=E[2]+M,Mr(m,c);const v=ar(x[0],c);v[0]E[0]&&v[2]>E[2]&&x.push([v[0]-w,v[1],v[2]-w,v[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&Me(this.wrappedRenderedExtent_,p))return ne(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new mr(qn(u,d),p,u,d);let T;this.getLayer().getDeclutter()&&(T=new mr(qn(u,d),p,u,d));let I;for(let w=0,M=x.length;w0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new en(ht.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new en(ht.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new en(ht.REMOVE,n,t)),this.dispatchEvent(new en(ht.ADD,e,t))}updateLength_(){this.set(Br.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i=200&&a.status<300){const h=t.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:n}),t.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Vr(s,t){return function(e,i,n,r,o){const a=this;fh(s,t,e,i,n,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||se)}}class qt extends Dt{constructor(t,e,i){super(t);this.feature=e,this.features=i}}class gh extends Ur{constructor(t){t=t||{};super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0});this.on,this.once,this.un,this.loader_=se,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(N(this.format_,7),this.loader_=Vr(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:uh;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Kr:null,this.loadedExtentsRtree_=new Kr,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),!e&&i===void 0&&(i=new At(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Y(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new qt(Ct.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[G(e,P.CHANGE,this.handleFeatureChange_,this),G(e,Re.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return n!==void 0&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(N(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let r=0,o=t.length;rthis.featuresRtree_.getInExtent(r)))}else return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Ue,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,n,o,a),a0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,function(n){if(si(n.extent,t))return i=n,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=Y(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=Y(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(V),delete this.featureChangeKeys_[e];const n=t.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new qt(Ct.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){N(this.format_,7),this.url_=t,this.setLoader(Vr(t,this.format_))}}var bu=gh,nn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class _h extends Pi{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError;super(e);this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(nn.PRELOAD)}setPreload(t){this.set(nn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(nn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(nn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var mh=_h,L={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function jr(s){return Math.pow(s,3)}function Xe(s){return 1-jr(1-s)}function ph(s){return 3*s*s-2*s*s*s}function yh(s){return s}class xh extends wi{constructor(t,e,i){super();i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(P.CHANGE)}release(){this.state===L.ERROR&&this.setState(L.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==L.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==L.LOADED){t.interimTile=null;break}else t.getState()==L.LOADING?e=t:t.getState()==L.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==L.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){X()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const n=e-i+1e3/60;return n>=this.transition_?1:jr(n/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}var Hr=xh;class Eh extends Hr{constructor(t,e,i,n,r,o){super(t,e,o);this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=L.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=L.ERROR,this.unlistenImage_(),this.image_=Ch(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=L.LOADED:this.state=L.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==L.ERROR&&(this.state=L.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==L.IDLE&&(this.state=L.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=lr(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Ch(){const s=gt(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}var $r=Eh;const Rh=.5,Th=10,qr=.25;class vh{constructor(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=tn(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const x=y[0]+"/"+y[1];return a[x]||(a[x]=l(y)),a[x]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&U(n)==U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const h=ae(i),c=ji(i),u=Vi(i),d=Ui(i),f=this.transformInv_(h),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=Th+(o?Math.max(0,Math.ceil(Math.log2(Dn(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,_,m,p),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(x,E,C){y=Math.min(y,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(function(x){if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-y>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-y>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-y>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-y>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const C=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-C.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=er([t,e,i,n]);g=U(m)/this.targetWorldWidth_>qr||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>qr||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!lt(c,this.maxSourceExtent_))return;let _=0;if(!g&&(!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)g=!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(!g){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(m);let y;f?y=(Ie(r[0],d)+Ie(a[0],d))/2-Ie(p[0],d):y=(r[0]+a[0])/2-p[0];const x=(r[1]+a[1])/2-p[1];g=y*y+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(m),y=[(n[0]+t[0])/2,(n[1]+t[1])/2],x=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,x,h-1),this.addQuad_(y,m,i,n,x,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],x=this.transformInv_(y);this.addQuad_(t,m,y,n,r,p,x,l,h-1),this.addQuad_(m,e,i,y,p,o,a,x,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,n,r,a,l),(_&14)==0&&this.addTriangle_(t,i,e,r,a,o),_&&((_&13)==0&&this.addTriangle_(e,n,t,o,l,r),(_&7)==0&&this.addTriangle_(e,n,i,o,l,a))}calculateSourceExtent(){const t=xt();return this.triangles_.forEach(function(e,i,n){const r=e.source;ri(t,r[0]),ri(t,r[1]),ri(t,r[2])}),t}getTriangles(){return this.triangles_}}var Ih=vh;let Jn;const Jr=[];function Qr(s,t,e,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(t,e),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(t,i)+1,Math.max(e,n)),s.restore()}function Qn(s,t){return Math.abs(s[t*4]-210)>2||Math.abs(s[t*4+3]-.75*255)>2}function Sh(){if(Jn===void 0){const s=document.createElement("canvas").getContext("2d");s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",Qr(s,4,5,4,0),Qr(s,4,5,0,5);const t=s.getImageData(0,0,3,3).data;Jn=Qn(t,0)||Qn(t,4)||Qn(t,8)}return Jn}function to(s,t,e,i){const n=kr(e,t,s);let r=Dr(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||Ki(l,n)){const h=Dr(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function wh(s,t,e,i){const n=Oe(e);let r=to(s,t,n,i);return(!isFinite(r)||r<=0)&&or(e,function(o){return r=to(s,t,o,i),isFinite(r)&&r>0}),r}function Lh(s,t,e,i,n,r,o,a,l,h,c,u){const d=gt(Math.round(e*s),Math.round(e*t),Jr);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(e,e);function f(E){return Math.round(E*e)/e}d.globalCompositeOperation="lighter";const g=xt();l.forEach(function(E,C,T){wa(g,E.extent)});const _=U(g),m=St(g),p=gt(Math.round(e*_/i),Math.round(e*m/i));u||(p.imageSmoothingEnabled=!1);const y=e/i;l.forEach(function(E,C,T){const I=E.extent[0]-g[0],S=-(E.extent[3]-g[3]),A=U(E.extent),b=St(E.extent);E.image.width>0&&E.image.height>0&&p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,I*y,S*y,A*y,b*y)});const x=ae(o);return a.getTriangles().forEach(function(E,C,T){const I=E.source,S=E.target;let A=I[0][0],b=I[0][1],W=I[1][0],k=I[1][1],F=I[2][0],q=I[2][1];const w=f((S[0][0]-x[0])/r),M=f(-(S[0][1]-x[1])/r),v=f((S[1][0]-x[0])/r),D=f(-(S[1][1]-x[1])/r),j=f((S[2][0]-x[0])/r),Z=f(-(S[2][1]-x[1])/r),Q=A,R=b;A=0,b=0,W-=Q,k-=R,F-=Q,q-=R;const ct=[[W,k,0,0,v-w],[F,q,0,0,j-w],[0,0,W,k,D-M],[0,0,F,q,Z-M]],z=Vo(ct);if(!!z){if(d.save(),d.beginPath(),Sh()||!u){d.moveTo(v,D);const K=4,Yt=w-v,Tt=M-D;for(let it=0;itthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function We(s,t,e,i,n){return n!==void 0?(n.minX=s,n.maxX=t,n.minY=e,n.maxY=i,n):new eo(s,t,e,i)}var io=eo;class Mh extends Cr{constructor(t){super(t);this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=xt(),this.tmpTileRange_=new io(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==L.LOADED||i==L.EMPTY||i==L.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,i,r,o);return h.getState()==L.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=et(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Ki(r,n))return null;const o=e.pixelRatio,a=e.viewState.projection,l=e.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const f=c.getTileCoordForCoordAndZ(n,d),g=h.getTile(d,f[1],f[2],o,a);if(!(g instanceof $r||g instanceof ts)||g instanceof ts&&g.getState()===L.EMPTY)return null;if(g.getState()!==L.LOADED)continue;const _=c.getOrigin(d),m=ft(c.getTileSize(d)),p=c.getResolution(d),y=Math.floor(u*((n[0]-_[0])/p-f[1]*m[0])),x=Math.floor(u*((_[1]-n[1])/p-f[2]*m[1])),E=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),y+E,x+E)}return null}loadedTileCallback(t,e,i){return this.isDrawableTile(i)?super.loadedTileCallback(t,e,i):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),f=u.getTileGridForProjection(r),g=f.getZForResolution(o,u.zDirection),_=f.getResolution(g);let m=t.extent;const p=t.viewState.resolution,y=u.getTilePixelRatio(h),x=Math.round(U(m)/p*h),E=Math.round(St(m)/p*h),C=i.extent&&de(i.extent);C&&(m=oi(m,de(i.extent)));const T=_*x/2/y,I=_*E/2/y,S=[a[0]-T,a[1]-I,a[0]+T,a[1]+I],A=f.getTileRangeForExtentAndZ(m,g),b={};b[g]={};const W=this.createLoadedTileFinder(u,r,b),k=this.tmpExtent,F=this.tmpTileRange_;this.newTiles_=!1;const q=l?kn(n.center,p,l,t.size):void 0;for(let ct=A.minX;ct<=A.maxX;++ct)for(let z=A.minY;z<=A.maxY;++z){if(l&&!f.tileCoordIntersectsViewport([g,ct,z],q))continue;const K=this.getTile(g,ct,z,t);if(this.isDrawableTile(K)){const it=Y(this);if(K.getState()==L.LOADED){b[g][K.tileCoord.toString()]=K;let Mt=K.inTransition(it);Mt&&i.opacity!==1&&(K.endTransition(it),Mt=!1),!this.newTiles_&&(Mt||!this.renderedTiles.includes(K))&&(this.newTiles_=!0)}if(K.getAlpha(it,t.time)===1)continue}const Yt=f.getTileCoordChildTileRange(K.tileCoord,F,k);let Tt=!1;Yt&&(Tt=W(g+1,Yt)),Tt||f.forEachTileCoordParentTileRange(K.tileCoord,W,F,k)}const w=_/o*h/y;jt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-E/2);const M=xr(this.pixelTransform);this.useContainer(e,M,this.getBackground(t));const v=this.context,D=v.canvas;Wn(this.inversePixelTransform,this.pixelTransform),jt(this.tempTransform,x/2,E/2,w,w,0,-x/2,-E/2),D.width!=x||D.height!=E?(D.width=x,D.height=E):this.containerReused||v.clearRect(0,0,x,E),C&&this.clipUnrotated(v,t,C),u.getInterpolate()||(v.imageSmoothingEnabled=!1),this.preRender(v,t),this.renderedTiles.length=0;let j=Object.keys(b).map(Number);j.sort(Te);let Z,Q,R;i.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?j=j.reverse():(Z=[],Q=[]);for(let ct=j.length-1;ct>=0;--ct){const z=j[ct],K=u.getTilePixelSize(z,h,r),Tt=f.getResolution(z)/_,it=K[0]*Tt*w,Mt=K[1]*Tt*w,me=f.getTileCoordForCoordAndZ(ae(S),z),yi=f.getTileCoordExtent(me),pe=et(this.tempTransform,[y*(yi[0]-S[0])/_,y*(S[3]-yi[3])/_]),xi=y*u.getGutterForProjection(r),zt=b[z];for(const ze in zt){const Bt=zt[ze],Ei=Bt.tileCoord,Ci=me[1]-Ei[1],Ri=Math.round(pe[0]-(Ci-1)*it),ye=me[2]-Ei[2],cn=Math.round(pe[1]-(ye-1)*Mt),ot=Math.round(pe[0]-Ci*it),_t=Math.round(pe[1]-ye*Mt),yt=Ri-ot,Ot=cn-_t,xe=g===z,ie=xe&&Bt.getAlpha(Y(this),t.time)!==1;let Kt=!1;if(!ie)if(Z){R=[ot,_t,ot+yt,_t,ot+yt,_t+Ot,ot,_t+Ot];for(let Ee=0,Ti=Z.length;Ee0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return N(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return N(e!==void 0,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(!!this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){N(!(t in this.entries_),16);const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}var Dh=Ph;function no(s,t,e,i){return i!==void 0?(i[0]=s,i[1]=t,i[2]=e,i):[s,t,e]}function sn(s,t,e){return s+"/"+t+"/"+e}function so(s){return sn(s[0],s[1],s[2])}function Fh(s){return s.split("/").map(Number)}function kh(s){return(s[1]<e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,n):!0}class Gh extends Dh{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),i=Fh(t)[0];this.forEach(function(n){n.tileCoord[0]!==i&&(this.remove(so(n.tileCoord)),n.release())}.bind(this))}}var ro=Gh,es={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};const Xh=42,is=256;function Wh(s,t,e,i,n){let r;for(t+=i;tr&&(h-a)*(r-l)-(n-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(n-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function oo(s,t,e,i,n,r){if(e.length===0||!fe(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:Wh(s,t,e,i,function(o,a){return Oa(n,o,a)}):!1}function lo(s,t,e,i,n){return!!(ao(s,t,e,i,n)||fe(s,t,e,i,n[0],n[1])||fe(s,t,e,i,n[0],n[3])||fe(s,t,e,i,n[2],n[1])||fe(s,t,e,i,n[2],n[3]))}function zh(s,t,e,i,n){if(!lo(s,t,e[0],i,n))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),r=We(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?i:Math.max(r/e[0],n/e[1]);const o=t+1,a=new Array(o);for(let l=0;li.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class $h extends Dt{constructor(t,e){super(t);this.tile=e}}var qh=Hh;function Jh(s,t){const e=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return s.replace(e,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(r,function(){const h=o[0],c=t.getFullTileRange(h);return N(c,55),(c.getHeight()-o[2]-1).toString()})}}function Qh(s,t){const e=s.length,i=new Array(e);for(let n=0;n1)u=e;else if(d>0){for(let f=0;fn&&(n=h),r=a,o=l}return n}function lc(s,t,e,i,n){for(let r=0,o=e.length;rp&&(h=(c+u)/2,oo(s,t,e,i,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=n[r]),o?(o.push(m,g,p),o):[m,g,p]}function _c(s,t,e,i){for(;t0}function mc(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var yc=pc;class xc extends gn{constructor(t){super();this.map_=t}dispatchRenderEvent(t,e){X()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;jt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Wn(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,o,a,l){let h;const c=e.viewState;function u(E,C,T,I){return r.call(o,C,E?T:null,I)}const d=c.projection,f=Mr(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&n){const E=d.getExtent(),C=U(E);g.push([-C,0],[C,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let E=0;E=0;--C){const T=_[C],I=T.layer;if(I.hasRenderer()&&mn(T,c)&&a.call(l,I)){const S=I.getRenderer(),A=I.getSource();if(S&&A){const b=A.getWrapX()?f:t,W=u.bind(null,T.managed);y[0]=b[0]+g[E][0],y[1]=b[1]+g[E][1],h=S.forEachFeatureAtCoordinate(y,e,i,W,p)}if(h)return h}}if(p.length===0)return;const x=1/p.length;return p.forEach((E,C)=>E.distanceSq+=C*x),p.sort((E,C)=>E.distanceSq-C.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,r,o){return this.forEachFeatureAtCoordinate(t,e,i,n,Ue,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){X()}scheduleExpireIconCache(t){Bi.canExpireCache()&&t.postRenderFunctions.push(Ec)}}function Ec(s,t){Bi.expire()}var Cc=xc;class Rc extends Cc{constructor(t){super(t);this.fontChangeListenerKey_=G(kt,Re.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Gi+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new pr(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){V(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Zt.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let o=0,a=e.length;o=0;--o)n[o].renderDeclutter(t);_a(this.element_,this.children_),this.dispatchRenderEvent(Zt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}}var Tc=Rc;class Qt extends Dt{constructor(t,e){super(t);this.layer=e}}const as={LAYERS:"layers"};class ls extends Os{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e);this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(as.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new At(i.slice(),{unique:!0}):N(typeof i.getArray=="function",43):i=new At(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(V),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(G(t,ht.ADD,this.handleLayersAdd_,this),G(t,ht.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(V);Ve(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;ithis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(V(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(V(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(V),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var wc=Sc,ee={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},st={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const an=1/0;class Lc{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ve(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){N(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=an?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=ht;){const a=this.getParentIndex_(e);if(n[a]>o)i[e]=i[a],n[e]=n[a],e=a;else break}i[e]=r,n[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let o,a,l;for(a=0;a0;)r=this.dequeue()[0],o=r.getKey(),n=r.getState(),n===L.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}var Oc=Mc;function bc(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return an;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}var Rt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ro(s,t,e){return function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,h=t?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,f=s[2]-l/2+c,g=s[1]+h/2+u,_=s[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=$(i[0],d,f),p=$(i[1],g,_);if(o&&e&&n){const y=30*n;m+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-_)/y)}return[m,p]}}function Pc(s){return s}function cs(s,t,e,i){const n=U(t)/e[0],r=St(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function us(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),$(i,e/2,t*2)}function Dc(s,t,e,i){return t=t!==void 0?t:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],h=s[s.length-1],c=e?cs(l,e,o,i):l;if(a)return t?us(n,c,h):$(n,h,c);const u=Math.min(c,n),d=Math.floor(_n(s,u,r));return s[d]>c&&d1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let n=0;for(;n0}getInteracting(){return this.hints_[nt.INTERACTING]>0}cancelAnimations(){this.setHint(nt.ANIMATING,-this.hints_[nt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Ie(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(nt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&ln(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-e[0],n[1]-e[1]],Kn(i,t-this.getRotation()),Ml(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-n[0])/r,a=e[1]-t*(e[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}else return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Hn(t,this.getProjection())}getCenterInternal(){return this.get(Rt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Nr(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();N(e,1);const i=this.getResolution();N(i!==void 0,2);const n=this.getRotation();return N(n!==void 0,3),Fn(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Rt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(de(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=U(t)/e[0],n=St(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(r){return e/Math.pow(t,r*n)}}getRotation(){return this.get(Rt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(o){return Math.log(i/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=gs(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,n;if(this.resolutions_){const r=_n(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return e+Math.log(i/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=$(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,$(t-e,0,1))}else return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(N(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){N(!Nn(t),25);const n=de(t,this.getProjection());i=Co(n)}else if(t.getType()==="Circle"){const n=de(t.getExtent(),this.getProjection());i=Co(n),i.rotate(this.getRotation(),Oe(n))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ne(e,this.renderedAttributions_)){ga(this.ulElement_);for(let n=0,r=e.length;n0&&i%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:Xe}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Ni);!r&&i===0?this.element.classList.add(Ni):r&&i!==0&&this.element.classList.remove(Ni)}this.label_.style.transform=n}this.rotation_=i}}var Vc=Uc;class jc extends _s{constructor(t){t=t||{};super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,n=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(P.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Gi+" "+Rn,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:Xe})):i.setZoom(r)}}}var Hc=jc;function $c(s){s=s||{};const t=new At;return(s.zoom!==void 0?s.zoom:!0)&&t.push(new Hc(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&t.push(new Vc(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&t.push(new Zc(s.attributionOptions)),t}var Io={ACTIVE:"active"};class qc extends vt{constructor(t){super();this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Io.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Io.ACTIVE,t)}setMap(t){this.map_=t}}function Jc(s,t,e){const i=s.getCenterInternal();if(i){const n=[i[0]+t[0],i[1]+t[1]];s.animateInternal({duration:e!==void 0?e:250,easing:yh,center:s.getConstrainedCenter(n)})}}function ms(s,t,e,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+t),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:Xe})}var mi=qc;class Qc extends mi{constructor(t){super();t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==H.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();ms(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}var tu=Qc;class eu extends mi{constructor(t){t=t||{};super(t);t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==H.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==H.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==H.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==H.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function ps(s){const t=s.length;let e=0,i=0;for(let n=0;n0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}else return!1}}var lu=au;class hu extends pi{constructor(t){t=t||{};super({stopDown:Si});this.condition_=t.condition?t.condition:iu,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!xs(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ds)return;const n=e.getSize(),r=t.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return xs(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return xs(t)&&wo(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}var cu=hu;class uu extends gn{constructor(t){super();this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new _i([n])}getGeometry(){return this.geometry_}}var du=uu;const hn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Es extends Dt{constructor(t,e,i){super(t);this.coordinate=e,this.mapBrowserEvent=i}}class fu extends pi{constructor(t){super();this.on,this.once,this.un,t=t||{},this.box_=new du(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:wo,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Es(hn.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Es(e?hn.BOXEND:hn.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Es(hn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}var gu=fu;class _u extends gu{constructor(t){t=t||{};const e=t.condition?t.condition:ru;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea});this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:Xe})}}var mu=_u,_e={LEFT:37,UP:38,RIGHT:39,DOWN:40};class pu extends mi{constructor(t){super();t=t||{},this.defaultCondition_=function(e){return Lo(e)&&Ao(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN){const i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(n==_e.DOWN||n==_e.LEFT||n==_e.RIGHT||n==_e.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;n==_e.DOWN?h=-a:n==_e.LEFT?l=-a:n==_e.RIGHT?l=a:h=a;const c=[l,h];Kn(c,o.getRotation()),Jc(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}var yu=pu;class xu extends mi{constructor(t){super();t=t||{},this.condition_=t.condition?t.condition:Ao,this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN||t.type==P.KEYPRESS){const i=t.originalEvent,n=i.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const r=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_,a=r.getView();ms(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var Eu=xu;class Cu extends mi{constructor(t){t=t||{};super(t);this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:su;this.condition_=t.onFocusOnly?ys(So,e):e,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 t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==P.WHEEL)return!0;const i=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let r;if(t.type==P.WHEEL&&(r=n.deltaY,ha&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=Ws),n.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=i.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,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-$(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ms(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Ru=Cu;class Tu extends pi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Si);super(e);this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(this.lastAngle_!==void 0){const c=r-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=r;const o=t.map,a=o.getView();if(a.getConstraints().rotation===ds)return;const l=o.getViewport().getBoundingClientRect(),h=ps(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}else return!1}}var vu=Tu;class Iu extends pi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Si);super(e);this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e);const c=l.getViewport().getBoundingClientRect(),u=ps(this.targetPointers);u[0]-=c.left,u[1]-=c.top,this.anchor_=l.getCoordinateFromPixelInternal(u),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}else return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}else return!1}}var Su=Iu;function wu(s){s=s||{};const t=new At,e=new yc(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&t.push(new cu),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&t.push(new tu({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&t.push(new lu({onFocusOnly:s.onFocusOnly,kinetic:e})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&t.push(new vu),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&t.push(new Su({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(t.push(new yu),t.push(new Eu({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&t.push(new Ru({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&t.push(new mu({duration:s.zoomDuration})),t}function Mo(s){if(s instanceof Pi){s.setMapInternal(null);return}s instanceof on&&s.getLayers().forEach(Mo)}function Oo(s,t){if(s instanceof Pi){s.setMapInternal(t);return}if(s instanceof on){const e=s.getLayers().getArray();for(let i=0,n=e.length;i=0;r--){const o=n[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let n=this.maxTilesLoading_,r=n;if(t){const o=t.viewHints;if(o[nt.ANIMATING]||o[nt.INTERACTING]){const a=Date.now()-t.time>8;n=a?0:8,r=a?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Qt("removelayer",e)),this.set(st.LAYERGROUP,t)}setSize(t){this.set(st.SIZE,t)}setTarget(t){this.set(st.TARGET,t)}setView(t){if(!t||t instanceof ge){this.set(st.VIEW,t);return}this.set(st.VIEW,new ge);const e=this;t.then(function(i){e.setView(new ge(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(n)&&!isNaN(r)&&(e=[n,r],!Fs(e)&&!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(e),this.updateViewportSize_()}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function Au(s){let t=null;s.keyboardEventTarget!==void 0&&(t=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const e={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new on({layers:s.layers});e[st.LAYERGROUP]=i,e[st.TARGET]=s.target,e[st.VIEW]=s.view instanceof ge?s.view:new ge;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new At(s.controls.slice()):(N(typeof s.controls.getArray=="function",47),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new At(s.interactions.slice()):(N(typeof s.interactions.getArray=="function",48),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new At(s.overlays.slice()):(N(typeof s.overlays.getArray=="function",49),o=s.overlays):o=new At,{controls:n,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}var ku=Lu,Nu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAzCAYAAAB8F5OAAAAAWUlEQVRYhe3YOwrAMBADUcn3v7NcuHECgeBPwGSmXl6xpRwp6kus0eyL1fAZ8Ck7ZTnatRV3khdnY537FnBwcHBwcHDw3+Pg4ODg4B/jtxljWYevFruWIkkV0WQUXM8Qu78AAAAASUVORK5CYII=";export{Fu as F,hr as I,ku as M,fc as P,On as S,Pu as T,ge as V,Du as X,bu as a,Ou as b,ka as c,Ln as d,Mu as f,Nu as s};