xm-olmap 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/xm-map.mjs +25752 -0
- package/dist/xm-map.umd.js +7 -0
- package/index.d.ts +5 -0
- package/package.json +22 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(function(bt,vi){typeof exports=="object"&&typeof module<"u"?vi(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],vi):(bt=typeof globalThis<"u"?globalThis:bt||self,vi(bt.xiaominMap={},bt.vue))})(this,(function(bt,vi){"use strict";var Js=typeof document<"u"?document.currentScript:null;const ft={ANIMATING:0,INTERACTING:1};function Xh(n,t,e){let i,s;e=e||_e;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function _e(n,t){return n>t?1:n<t?-1:0}function zh(n,t){return n<t?1:n>t?-1:0}function qn(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function Yh(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function ie(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function Ae(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Wh(n,t,e){const i=t||_e;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}const gt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function qo(n){const t=St();for(let e=0,i=n.length;e<i;++e)sn(t,n[e]);return t}function Ri(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function $o(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function qe(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function $e(n,t){return Qs(n,t[0],t[1])}function ne(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Qs(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function tr(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=gt.UNKNOWN;return o<e?l=l|gt.LEFT:o>s&&(l=l|gt.RIGHT),a<i?l=l|gt.BELOW:a>r&&(l=l|gt.ABOVE),l===gt.UNKNOWN&&(l=gt.INTERSECTING),l}function St(){return[1/0,1/0,-1/0,-1/0]}function Me(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function nn(n){return Me(1/0,1/0,-1/0,-1/0,n)}function er(n,t){const e=n[0],i=n[1];return Me(e,i,e,i,t)}function ir(n,t,e,i,s){const r=nn(s);return Qo(r,n,t,e,i)}function Si(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Jo(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function sn(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Qo(n,t,e,i,s){for(;e<i;e+=s)jh(n,t[e],t[e+1]);return n}function jh(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function ta(n,t){let e;return e=t($n(n)),e||(e=t(Jn(n)),e)||(e=t(ts(n)),e)||(e=t(Je(n)),e)?e:!1}function nr(n){let t=0;return Ii(n)||(t=U(n)*lt(n)),t}function $n(n){return[n[0],n[1]]}function Jn(n){return[n[2],n[1]]}function Ht(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Bh(n,t){let e;if(t==="bottom-left")e=$n(n);else if(t==="bottom-right")e=Jn(n);else if(t==="top-left")e=Je(n);else if(t==="top-right")e=ts(n);else throw new Error("Invalid corner");return e}function Qn(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=ea(n,t,e,i);return Me(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function ea(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function lt(n){return n[3]-n[1]}function me(n,t,e){const i=e||St();return wt(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):nn(i),i}function Je(n){return[n[0],n[3]]}function ts(n){return[n[2],n[3]]}function U(n){return n[2]-n[0]}function wt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Ii(n){return n[2]<n[0]||n[3]<n[1]}function Vh(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Uh(n,t){const e=(n[2]-n[0])/2*(t-1),i=(n[3]-n[1])/2*(t-1);n[0]-=e,n[2]+=e,n[1]-=i,n[3]+=i}function Kh(n,t,e){let i=!1;const s=tr(n,t),r=tr(n,e);if(s===gt.INTERSECTING||r===gt.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r>.ABOVE&&!(s>.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r>.RIGHT&&!(s>.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r>.BELOW&&!(s>.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r>.LEFT&&!(s>.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function ia(n,t){const e=t.getExtent(),i=Ht(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=U(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function na(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];ia(n,t);const s=U(i);if(U(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function nt(n,t,e){return Math.min(Math.max(n,t),e)}function Zh(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return Qe(n,t,e,i)}function Qe(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Hh(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function sa(n){return n*180/Math.PI}function Pe(n){return n*Math.PI/180}function ti(n,t){const e=n%t;return e*t<0?e+t:e}function Ot(n,t,e){return n+e*(t-n)}function rn(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function ra(n,t){return Math.round(rn(n,t))}function es(n,t){return Math.floor(rn(n,t))}function be(n,t){return Math.ceil(rn(n,t))}function sr(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}function oa(n,t){const e=(""+n).split("."),i=(""+t).split(".");for(let s=0;s<Math.max(e.length,i.length);s++){const r=parseInt(e[s]||"0",10),o=parseInt(i[s]||"0",10);if(r>o)return 1;if(o>r)return-1}return 0}function aa(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function is(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function rr(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function la(n,t){return n[0]*=t,n[1]*=t,n}function ha(n,t){if(t.canWrapX()){const e=U(t.getExtent()),i=qh(n,t,e);i&&(n[0]-=i*e)}return n}function qh(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||U(i),s=Math.floor((n[0]-i[0])/e)),s}const ei=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";ei.includes("safari")&&!ei.includes("chrom")&&(ei.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ei));const $h=ei.includes("webkit")&&!ei.includes("edge"),ca=ei.includes("macintosh"),Jh=typeof devicePixelRatio<"u"?devicePixelRatio:1,Gt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,ua=typeof Image<"u"&&Image.prototype.decode,Qh=typeof createImageBitmap=="function",da=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})();function ct(n,t,e,i){let s;return e&&e.length?s=e.shift():Gt?s=new class extends OffscreenCanvas{style={}}(n??300,t??150):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}let or;function ns(){return or||(or=ct(1,1)),or}function ss(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function tc(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function ec(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function fa(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function ga(n){for(;n.lastChild;)n.lastChild.remove()}function ic(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function _a(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function Oe(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}function ma(...n){console.warn(...n)}const ar={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class lr{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ar[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const on=6378137,Ti=Math.PI*on,nc=[-Ti,-Ti,Ti,Ti],sc=[-180,-85,180,85],rs=on*Math.log(Math.tan(Math.PI/2));class Li extends lr{constructor(t){super({code:t,units:"m",extent:nc,global:!0,worldExtent:sc,getPointResolution:function(e,i){return e/Math.cosh(i[1]/on)}})}}const pa=[new Li("EPSG:3857"),new Li("EPSG:102100"),new Li("EPSG:102113"),new Li("EPSG:900913"),new Li("http://www.opengis.net/def/crs/EPSG/0/3857"),new Li("http://www.opengis.net/gml/srs/epsg.xml#3857")];function rc(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=Ti*n[r]/180;let o=on*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>rs?o=rs:o<-rs&&(o=-rs),t[r+1]=o}return t}function oc(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/Ti,t[r+1]=360*Math.atan(Math.exp(n[r+1]/on))/Math.PI-90;return t}const ac=6378137,ya=[-180,-90,180,90],lc=Math.PI*ac/180;class ii extends lr{constructor(t,e){super({code:t,units:"degrees",extent:ya,axisOrientation:e,global:!0,metersPerUnit:lc,worldExtent:ya})}}const Ea=[new ii("CRS:84"),new ii("EPSG:4326","neu"),new ii("urn:ogc:def:crs:OGC:1.3:CRS84"),new ii("urn:ogc:def:crs:OGC:2:84"),new ii("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ii("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ii("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let hr={};function hc(n){return hr[n]||hr[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function cc(n,t){hr[n]=t}function an(n){for(const t in n)delete n[t]}function ni(n){let t;for(t in n)return!1;return!t}let Ai={};function ln(n,t,e){const i=n.getCode(),s=t.getCode();i in Ai||(Ai[i]={}),Ai[i][s]=e}function cr(n,t){return n in Ai&&t in Ai[n]?Ai[n][t]:null}const os=.9996,Xt=.00669438,as=Xt*Xt,ls=as*Xt,si=Xt/(1-Xt),xa=Math.sqrt(1-Xt),Mi=(1-xa)/(1+xa),wa=Mi*Mi,ur=wa*Mi,dr=ur*Mi,Ca=dr*Mi,va=1-Xt/4-3*as/64-5*ls/256,uc=3*Xt/8+3*as/32+45*ls/1024,dc=15*as/256+45*ls/1024,fc=35*ls/3072,gc=3/2*Mi-27/32*ur+269/512*Ca,_c=21/16*wa-55/32*dr,mc=151/96*ur-417/128*Ca,pc=1097/512*dr,hs=6378137;function yc(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/os/(hs*va),a=o+gc*Math.sin(2*o)+_c*Math.sin(4*o)+mc*Math.sin(6*o)+pc*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Xt*h,m=Math.sqrt(1-Xt*h),_=hs/m,p=(1-Xt)/g,y=si*c**2,w=y*y,E=i/(_*os),x=E*E,S=x*E,C=S*E,v=C*E,I=v*E,L=a-u/p*(x/2-C/24*(5+3*d+10*y-4*w-9*si))+I/720*(61+90*d+298*y+45*f-252*si-3*w);let F=(E-S/6*(1+2*d+y)+v/120*(5-2*y+28*d-3*w+8*si+24*f))/c;return F=sr(F+Pe(Ia(e.number)),-Math.PI,Math.PI),[sa(F),sa(L)]}const Ra=-80,Sa=84,Ec=-180,xc=180;function wc(n,t,e){n=sr(n,Ec,xc),t<Ra?t=Ra:t>Sa&&(t=Sa);const i=Pe(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=Pe(n),c=Ia(e.number),u=Pe(c),d=hs/Math.sqrt(1-Xt*s**2),f=si*r**2,g=r*sr(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,w=y*g,E=hs*(va*i-uc*Math.sin(2*i)+dc*Math.sin(4*i)-fc*Math.sin(6*i)),x=os*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*si))+5e5;let S=os*(E+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+w/720*(61-58*a+l+600*f-330*si)));return e.north||(S+=1e7),[x,S]}function Ia(n){return(n-1)*6-180+3}const Cc=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Ta(n){let t=0;for(const s of Cc){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function La(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function vc(n){return Ta(n)?new lr({code:n,units:"m"}):null}function Rc(n){const t=Ta(n.getCode());return t?{forward:La(wc,t),inverse:La(yc,t)}:null}const Sc=63710088e-1;function Aa(n,t,e){e=e||Sc;const i=Pe(n[1]),s=Pe(t[1]),r=(s-i)/2,o=Pe(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const Ic=[Rc],Tc=[vc];let fr=!0;function Lc(n){fr=!1}function gr(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function _r(n){cc(n.getCode(),n),ln(n,n,gr)}function Ac(n){n.forEach(_r)}function st(n){if(typeof n!="string")return n;const t=hc(n);if(t)return t;for(const e of Tc){const i=e(n);if(i)return i}return null}function Ma(n,t,e,i){n=st(n);let s;const r=n.getPointResolutionFunc();if(r)s=r(t,e);else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=pr(n,st("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=Aa(h.slice(0,2),h.slice(2,4)),u=Aa(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function Pa(n){Ac(n),n.forEach(function(t){n.forEach(function(e){t!==e&&ln(t,e,gr)})})}function Mc(n,t,e,i){n.forEach(function(s){t.forEach(function(r){ln(s,r,e),ln(r,s,i)})})}function mr(n,t){return n?typeof n=="string"?st(n):n:st(t)}function Pc(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function ri(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||pr(n,t)===gr)&&e}function pr(n,t){const e=n.getCode(),i=t.getCode();let s=cr(e,i);if(s)return s;let r=null,o=null;for(const l of Ic)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=yr(r.inverse,o.forward);else{const l=cr(e,a);l&&(s=yr(l,o.forward))}else{const l=cr(a,i);l&&(s=yr(r.inverse,l))}return s&&(_r(n),_r(t),ln(n,t,s)),s}function yr(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function hn(n,t){const e=st(n),i=st(t);return pr(e,i)}function Er(n,t,e){const i=hn(t,e);if(!i){const s=st(t).getCode(),r=st(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function xr(n,t){return n}function pe(n,t){return fr&&!is(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(fr=!1,ma("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function ba(n,t){return n}function se(n,t){return n}function bc(){Pa(pa),Pa(Ea),Mc(Ea,pa,rc,oc)}bc();const zt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},A={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},wr=[NaN,NaN,NaN,0];let Cr;function Oc(){return Cr||(Cr=ct(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Cr}const Dc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Fc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,kc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Nc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function cs(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function cn(n){throw new Error('failed to parse "'+n+'" as color')}function Oa(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(Fc)||n.match(Dc)||n.match(kc);if(r){const o=r[4],a=100/255;return[nt(cs(r[1],a)+.5|0,0,255),nt(cs(r[2],a)+.5|0,0,255),nt(cs(r[3],a)+.5|0,0,255),o!==void 0?nt(cs(o,100),0,1):1]}cn(n)}if(n.startsWith("#")){if(Nc.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}cn(n)}const t=Oc();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&cn(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Oa(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=rn(s[3]/255,3),s}function De(n){return typeof n=="string"?n:Ar(n)}const Gc=1024,un={};let vr=0;function Xc(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Rr(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Sr(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Ir(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Tr(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Da(n){const t=Ir(n[0]),e=Ir(n[1]),i=Ir(n[2]),s=Tr(t*.222488403+e*.716873169+i*.06060791),r=500*(Tr(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-Tr(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function zc(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Sr(t),r=Sr(t+e/500*Math.cos(i)),o=Sr(t-e/200*Math.sin(i)),a=Rr(r*3.021973625-s*1.617392459-o*.404875592),l=Rr(r*-.943766287+s*1.916279586+o*.027607165),h=Rr(r*.069407491-s*.22898585+o*1.159737864);return[nt(a+.5|0,0,255),nt(l+.5|0,0,255),nt(h+.5|0,0,255),n[3]]}function Lr(n){if(n==="none")return wr;if(un.hasOwnProperty(n))return un[n];if(vr>=Gc){let e=0;for(const i in un)(e++&3)===0&&(delete un[i],--vr)}const t=Oa(n);t.length!==4&&cn(n);for(const e of t)isNaN(e)&&cn(n);return un[n]=t,++vr,t}function Pi(n){return Array.isArray(n)?n:Lr(n)}function Ar(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}const G={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class us{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function dn(){return!0}function ds(){return!1}function fn(){}function Fa(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!Ae(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function ka(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class re{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class gn extends us{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_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new re(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=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,fn);delete o[i]}return l}disposeInternal(){this.listeners_&&an(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=fn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function K(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function fs(n,t,e,i){return K(n,t,e,i,!0)}function et(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),an(n))}class Mr extends gn{constructor(t,e,i,s){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof s=="function"?A.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(G.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==A.IDLE&&this.loader){this.state=A.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ka(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||Qh&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=A.LOADED}).catch(i=>{this.state=A.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Yc(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[fs(i,G.LOAD,function(){o=!0,r||t()})];return i.src&&ua?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(fs(i,G.ERROR,e)),function(){s=!1,a.forEach(et)}}function Wc(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function jc(n,t){return t&&(n.src=t),n.src&&ua?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):Wc(n)}class Bc{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.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],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const s=Pr(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=Pr(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=Pr(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===A.IDLE&&s.load(),s.getImageState()===A.LOADING?s.ready().then(()=>{this.patternCache_[o]=ns().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=ns().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Pr(n,t,e){const i=e?Pi(e):"null";return t+":"+n+":"+i}const Yt=new Bc;let _n=null;class Na extends gn{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?A.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===A.LOADED){_n||(_n=ct(1,1,void 0,{willReadFrequently:!0})),_n.drawImage(this.image_,0,0);try{_n.getImageData(0,0,1,1),this.tainted_=!1}catch{_n=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(G.CHANGE)}handleImageError_(){this.imageState_=A.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=A.LOADED,this.size_=[this.image_.width,this.image_.height],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=ct(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_===A.IDLE){this.image_||this.initializeImage_(),this.imageState_=A.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&jc(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==A.LOADED)return;const e=this.image_,i=ct(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=De(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===A.LOADED||this.imageState_===A.ERROR)t();else{const e=()=>{(this.imageState_===A.LOADED||this.imageState_===A.ERROR)&&(this.removeEventListener(G.CHANGE,e),t())};this.addEventListener(G.CHANGE,e)}})),this.ready_}}function gs(n,t,e,i,s,r){let o=t===void 0?void 0:Yt.get(t,e,s);return o||(o=new Na(n,n&&"src"in n?n.src||void 0:t,e,i,s),Yt.set(t,e,s,o,r)),r&&o&&!Yt.getPattern(t,e,s)&&Yt.set(t,e,s,o,r),o}function oe(n){return n?Array.isArray(n)?Ar(n):typeof n=="object"&&"src"in n?Vc(n):n:null}function Vc(n){if(!n.offset||!n.size)return Yt.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=Yt.getPattern(t,void 0,n.color);if(e)return e;const i=Yt.get(n.src,"anonymous",null);if(i.getImageState()!==A.LOADED)return null;const s=ct(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),gs(s.canvas,t,void 0,A.LOADED,n.color,!0),Yt.getPattern(t,void 0,n.color)}function Fe(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=i)s[r++]=n.slice(o,o+i);return s.length=r,s}function mn(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Fe(n,t,l,i,s[r]),t=l}return s.length=r,s}function br(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:mn(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}class Ga{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const bi={PROPERTYCHANGE:"propertychange"};class pn extends gn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(G.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=K(this,t[r],e);return s}return K(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=fs(this,t[r],e)}else i=fs(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Xa(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}pn.prototype.on,pn.prototype.once,pn.prototype.un;function Xa(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)et(n[t]);else et(n)}function X(){throw new Error("Unimplemented abstract method.")}let Uc=0;function q(n){return n.ol_uid||(n.ol_uid=String(++Uc))}class za extends re{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Wt extends pn{constructor(t){super(),this.on,this.once,this.un,q(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new za(i,t,e)),i=bi.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new za(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],ni(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const _s="ol-hidden",Kc="ol-selectable",ms="ol-unselectable",Or="ol-control",Ya="ol-collapsed",Zc=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-z0-9]+?)\\s*$`].join(""),"i"),Wa=["style","variant","weight","size","lineHeight","family"],Dr={normal:400,bold:700},Fr=function(n){const t=n.match(Zc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=Wa.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[Wa[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Dr&&(e.weight=Dr[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},ja="10px sans-serif",It="#000",Oi="round",ye=[],Ee=0,Di="round",yn=10,En="#000",xn="center",ps="middle",oi=[0,0,0,0],wn=1,Fi=new Wt;let Cn=null,Ba;const kr={},Hc=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function qc(n,t,e){return`${n} ${t} 16px "${e}"`}const $c=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=Fr(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Dr[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=Fi.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(an(kr),Fi.set(h,100)):(c+=10,Fi.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Gt?self.fonts:document.fonts);const o=Fr(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Hc.has(h))continue;const c=qc(o.style,o.weight,h);Fi.get(c)===void 0&&(Fi.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),Jc=(function(){let n;return function(t){let e=kr[t];if(e==null){if(Gt){const i=Fr(t),s=Va(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);kr[t]=e}return e}})();function Va(n,t){return Cn||(Cn=ct(1,1)),n!=Ba&&(Cn.font=n,Ba=Cn.font),Cn.measureText(t)}function Ua(n,t){return Va(n,t).width}function Ka(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
2
|
+
`).reduce((s,r)=>Math.max(s,Ua(n,r)),0);return e[t]=i,i}function Qc(n,t){const e=[],i=[],s=[];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===`
|
|
3
|
+
`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Ua(d,u);e.push(f),o+=f;const g=Jc(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function tu(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),eu(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function eu(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}const b={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},ys=[b.FILL],ke=[b.STROKE],ai=[b.BEGIN_PATH],Za=[b.CLOSE_PATH];class vn extends Ga{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],$e(i,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+s;g<i;g+=s)d[0]=t[g],d[1]=t[g+1],_=tr(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===gt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([b.CUSTOM,l,d,t,i,br,r]),this.hitDetectionInstructions.push([b.CUSTOM,l,d,t,s||i,br,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([b.CUSTOM,l,u,t,i,mn,r]),this.hitDetectionInstructions.push([b.CUSTOM,l,u,t,s||i,mn,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([b.CUSTOM,l,c,t,i,Fe,r]),this.hitDetectionInstructions.push([b.CUSTOM,l,c,t,s||i,Fe,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([b.CUSTOM,l,c,t,i,Fe,r]),this.hitDetectionInstructions.push([b.CUSTOM,l,c,t,s||i,Fe,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([b.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([b.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[b.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[b.BEGIN_GEOMETRY,e,0,t,i],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 s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==b.END_GEOMETRY?o=e:r==b.BEGIN_GEOMETRY&&(s[2]=e,Yh(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=oe(i||It)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=oe(i||En);const s=t.getLineCap();e.lineCap=s!==void 0?s:Oi;const r=t.getLineDash();e.lineDash=r?r.slice():ye;const o=t.getLineDashOffset();e.lineDashOffset=o||Ee;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:Di;const l=t.getWidth();e.lineWidth=l!==void 0?l:wn;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:yn,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[b.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[b.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!Ae(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,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=[b.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=$o(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Ri(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class iu extends vn{constructor(t,e,i,s){super(t,e,i,s),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,i){if(!this.image_||this.maxExtent&&!$e(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([b.DRAW_IMAGE,o,a,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([b.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||$e(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([b.DRAW_IMAGE,o,a,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([b.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,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(),s=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_=s[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_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class nu extends vn{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[b.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ye,Ee],ai);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(ke),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ye,Ee],ai);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(ke),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ke),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ke),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ai)}}function Es(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const w=n[y],E=n[y+1],x=Zh(w,E,g,m,_,p);x>f&&(c=y,f=x)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Ha(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Es(n,t,c,i,s,r,o),a.push(o),t=c}return o}function li(n,t){return t*Math.round(n/t)}function su(n,t,e,i,s,r,o){if(t==e)return o;let a=li(n[t],s),l=li(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=li(n[t],s),c=li(n[t+1],s),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=li(n[t],s),d=li(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>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 Nr(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=su(n,t,c,i,s,r,o),a.push(o),t=c}return o}function ru(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=Nr(n,t,c,i,s,r,o,u),a.push(u),t=c[c.length-1]}return o}class qa extends vn{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(ai),this.hitDetectionInstructions.push(ai);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[b.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Za),this.hitDetectionInstructions.push(Za)),e=c}return o&&(this.instructions.push(ys),this.hitDetectionInstructions.push(ys)),a&&(this.instructions.push(ke),this.hitDetectionInstructions.push(ke)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,It]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ye,Ee]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[b.CIRCLE,h];this.instructions.push(ai,c),this.hitDetectionInstructions.push(ai,c),s.fillStyle!==void 0&&(this.instructions.push(ys),this.hitDetectionInstructions.push(ys)),s.strokeStyle!==void 0&&(this.instructions.push(ke),this.hitDetectionInstructions.push(ke)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,It]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ye,Ee]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,It]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ye,Ee]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=li(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function ou(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,m=Ot(h,u,g),_=Ot(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,m=Ot(h,u,g/f),_=Ot(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function au(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,w;for(u=e;u<i;u+=s){const E=t[u],x=t[u+1];g!==void 0&&(y=E-g,w=x-m,f=Math.sqrt(y*y+w*w),_!==void 0&&(l+=d,c=Math.acos((_*y+p*w)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=w),g=E,m=x}return l+=f,l>a?[h,u]:[r,o]}const xs={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class lu extends vn{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[It]={fillStyle:It},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,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,i){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!wt(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=ou(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let w=0,E=y.length;w<E;++w){const x=y[w];let S=0,C=x.length;if(g==null){const I=au(o.maxAngle,x,0,x.length,2);S=I[0],C=I[1]}for(let I=S;I<C;I+=u)a.push(x[I],x[I+1]);const v=a.length;m=d[_],this.drawChars_(l,v),l=v}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();c=[];for(let x=0,S=E.length;x<S;x+=3)o.overflow||d.push(E[x+2]/this.resolution),c.push(E[x],E[x+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let E=l/2;d=d.filter((x,S)=>{const C=a[(E+S)*2]===c[S*u]&&a[(E+S)*2+1]===c[S*u+1];return C||--E,C})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=oi&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],x=o.padding[1],S=o.padding[2],C=o.padding[3];o.scale[0]<0&&(x=-x,C=-C),o.scale[1]<0&&(E=-E,S=-S),_=[E,x,S,C]}const p=this.pixelRatio;this.instructions.push([b.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==oi?oi:_.map(function(E){return E*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,w=g?g.slice(0):null;w&&(w[1]=It),this.hitDetectionInstructions.push([b.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,w,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?It:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={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||xn,justify:e.justify,textBaseline:e.textBaseline||ps,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_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=xs[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([b.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([b.DRAW_CHARS,t,e,h,s.overflow,a&&It,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=oe(o.getColor()||It)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Oi,r.lineDash=m?m.slice():ye,r.lineDashOffset=_===void 0?Ee:_,r.lineJoin=a.getLineJoin()||Di,r.lineWidth=p===void 0?wn:p,r.miterLimit=y===void 0?yn:y,r.strokeStyle=oe(a.getColor()||En)}i=this.textState_;const l=t.getFont()||ja;$c(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.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||ps,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||oi,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=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.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:q(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+q(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const hu={Circle:qa,Default:vn,Image:iu,LineString:nu,Polygon:qa,Text:lu};class cu{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,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 s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=hu[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function Ne(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function $a(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function uu(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function du(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}function $(n,t){if(!n)throw new Error(t)}new Array(6);function qt(){return[1,0,0,1,0,0]}function fu(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function ut(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function ae(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function Ja(n,t){const e=gu(t);$(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function gu(n){return n[0]*n[3]-n[1]*n[2]}const _u=[1e5,1e5,1e5,1e5,2,2];function mu(n){return"matrix("+n.join(", ")+")"}function Gr(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function pu(n,t){const e=Gr(n),i=Gr(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*_u[s])!==0)return!1;return!0}function Xr(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}function yu(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,y=0;function w(){m=f,_=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do w();while(t<e-i&&y+p<r);let E=p===0?0:(r-y)/p;const x=Ot(m,f,E),S=Ot(_,g,E),C=t-i,v=y,I=r+a*l(h,s,c);for(;t<e-i&&y+p<I;)w();E=p===0?0:(I-y)/p;const L=Ot(m,f,E),F=Ot(_,g,E);let D=!1;if(d)if(u){const Y=[x,S,L,F];$a(Y,0,4,2,u,Y,Y),D=Y[0]>Y[2]}else D=x>L;const M=Math.PI,P=[],B=C+i===t;t=C,p=0,y=v,f=n[t],g=n[t+1];let N;if(B){w(),N=Math.atan2(g-_,f-m),D&&(N+=N>0?-M:M);const Y=(L+x)/2,k=(F+S)/2;return P[0]=[Y,k,(I-r)/2,N,s],P}s=s.replace(/\n/g," ");for(let Y=0,k=s.length;Y<k;){w();let V=Math.atan2(g-_,f-m);if(D&&(V+=V>0?-M:M),N!==void 0){let ht=V-N;if(ht+=ht>M?-2*M:ht<-M?2*M:0,Math.abs(ht)>o)return null}N=V;const H=Y;let tt=0;for(;Y<k;++Y){const ht=D?k-Y-1:Y,kt=a*l(h,s[ht],c);if(t+i<e&&y+p<r+tt+kt/2)break;tt+=kt}if(Y===H)continue;const T=D?s.substring(k-H,k-Y):s.substring(H,Y);E=p===0?0:(r+tt/2-y)/p;const Et=Ot(m,f,E),vt=Ot(_,g,E);P.push([Et,vt,tt/2,V,T]),r+=tt}return P}class Qa{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(ns(),{get:(t,e)=>{if(typeof ns()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const ki=St(),Ge=[],xe=[],we=[],Xe=[];function tl(n){return n[3].declutterBox}const el=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function zr(n,t){return t==="start"?t=el.test(n)?"right":"left":t==="end"&&(t=el.test(n)?"left":"right"),xs[t]}function Eu(n,t,e){return e>0&&n.push(`
|
|
4
|
+
`,""),n.push(t,""),n}function xu(n,t,e){return e%2===0&&(n+=t),n}class wu{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=qt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Qa:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?xs[l.justify]:zr(Array.isArray(t)?t[0]:t,l.textAlign||xn),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
|
|
5
|
+
`).reduce(Eu,[]),{width:g,height:m,widths:_,heights:p,lineWidths:y}=Qc(l,f),w=g+d,E=[],x=(w+2)*c[0],S=(m+d)*c[1],C={width:x<0?Math.floor(x):Math.ceil(x),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),s&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",d),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),i&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const v=.5-u;let I=u*w+v*d;const L=[],F=[];let D=0,M=0,P=0,B=0,N;for(let Y=0,k=f.length;Y<k;Y+=2){const V=f[Y];if(V===`
|
|
6
|
+
`){M+=D,D=0,I=u*w+v*d,++B;continue}const H=f[Y+1]||l.font;H!==N&&(s&&L.push("font",H),i&&F.push("font",H),N=H),D=Math.max(D,p[P]);const tt=[V,I+v*_[P]+u*(_[P]-y[B]),.5*(d+D)+M];I+=_[P],s&&L.push("strokeText",tt),i&&F.push("fillText",tt),++P}return Array.prototype.push.apply(E,L),Array.prototype.push.apply(E,F),this.labels_[r]=C,C}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let p=i-a,y=s-l;const w=r+h>t?t-h:r,E=o+c>e?e-c:o,x=g[3]+w*d[0]+g[1],S=g[0]+E*d[1]+g[2],C=p-g[3],v=y-g[0];(m||u!==0)&&(Ge[0]=C,Xe[0]=C,Ge[1]=v,xe[1]=v,xe[0]=C+x,we[0]=xe[0],we[1]=v+S,Xe[1]=we[1]);let I;return u!==0?(I=ae(qt(),i,s,1,1,u,-i,-s),ut(I,Ge),ut(I,xe),ut(I,we),ut(I,Xe),Me(Math.min(Ge[0],xe[0],we[0],Xe[0]),Math.min(Ge[1],xe[1],we[1],Xe[1]),Math.max(Ge[0],xe[0],we[0],Xe[0]),Math.max(Ge[1],xe[1],we[1],Xe[1]),ki)):Me(Math.min(C,C+x),Math.min(v,v+S),Math.max(C,C+x),Math.max(v,v+S),ki),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:w,drawImageH:E,originX:h,originY:c,declutterBox:{minX:ki[0],minY:ki[1],maxX:ki[2],maxY:ki[3],value:_},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,Ge,xe,we,Xe,o,a),tu(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ut(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],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,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=zr(Array.isArray(t)?t[0]:t,r.textAlign||xn),c=xs[r.textBaseline||ps],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,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Ae(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Ne(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),fu(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,y,w,E,x,S,C,v,I,L,F=0,D=0;const M=this.coordinateCache_,P=this.viewRotation_,B=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,N={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:P},Y=this.instructions!=s||this.overlaps?0:200;let k,V,H,tt;for(;u<d;){const T=s[u];switch(T[0]){case b.BEGIN_GEOMETRY:k=T[1],tt=T[3],k.getGeometry()?a!==void 0&&!wt(a,tt.getExtent())?u=T[2]+1:++u:u=T[2],h&&(h.zIndex=T[4]);break;case b.BEGIN_PATH:F>Y&&(this.fill_(t),F=0),D>Y&&(t.stroke(),D=0),!F&&!D&&(t.beginPath(),y=NaN,w=NaN),++u;break;case b.CIRCLE:f=T[1];const vt=c[f],ht=c[f+1],kt=c[f+2],xt=c[f+3],de=kt-vt,ee=xt-ht,Nt=Math.sqrt(de*de+ee*ee);t.moveTo(vt+Nt,ht),t.arc(vt,ht,Nt,0,2*Math.PI,!0),++u;break;case b.CLOSE_PATH:t.closePath(),++u;break;case b.CUSTOM:f=T[1],g=T[2];const Hs=T[3],Bo=T[4],Vn=T[5];N.geometry=Hs,N.feature=k,u in M||(M[u]=[]);const xi=M[u];Vn?Vn(c,f,g,2,xi):(xi[0]=c[f],xi[1]=c[f+1],xi.length=2),h&&(h.zIndex=T[6]),Bo(xi,N),++u;break;case b.DRAW_IMAGE:f=T[1],g=T[2],S=T[3],m=T[4],_=T[5];let Vt=T[6];const fe=T[7],Ji=T[8],Qi=T[9],Un=T[10];let wi=T[11];const tn=T[12];let en=T[13];p=T[14]||"declutter";const _t=T[15];if(!S&&T.length>=20){C=T[19],v=T[20],I=T[21],L=T[22];const Ut=this.drawLabelWithPointPlacement_(C,v,I,L);S=Ut.label,T[3]=S;const Ci=T[23];m=(Ut.anchorX-Ci)*this.pixelRatio,T[4]=m;const Kt=T[24];_=(Ut.anchorY-Kt)*this.pixelRatio,T[5]=_,Vt=S.height,T[6]=Vt,en=S.width,T[13]=en}let Vo;T.length>25&&(Vo=T[25]);let Uo,qs,$s;T.length>17?(Uo=T[16],qs=T[17],$s=T[18]):(Uo=oi,qs=null,$s=null),Un&&B?wi+=P:!Un&&!B&&(wi-=P);let M_=0;for(;f<g;f+=2){if(Vo&&Vo[M_++]<en/this.pixelRatio)continue;const Ut=this.calculateImageOrLabelDimensions_(S.width,S.height,c[f],c[f+1],en,Vt,m,_,Ji,Qi,wi,tn,r,Uo,!!qs||!!$s,k),Ci=[t,e,S,Ut,fe,qs,$s];if(l){let Kt,ge,Zt;if(_t){const at=g-f;if(!_t[at]){_t[at]={args:Ci,declutterMode:p};continue}const Rt=_t[at];Kt=Rt.args,ge=Rt.declutterMode,delete _t[at],Zt=tl(Kt)}let Ie,Te;if(Kt&&(ge!=="declutter"||!l.collides(Zt))&&(Ie=!0),(p!=="declutter"||!l.collides(Ut.declutterBox))&&(Te=!0),ge==="declutter"&&p==="declutter"){const at=Ie&&Te;Ie=at,Te=at}Ie&&(ge!=="none"&&l.insert(Zt),this.replayImageOrLabel_.apply(this,Kt)),Te&&(p!=="none"&&l.insert(Ut.declutterBox),this.replayImageOrLabel_.apply(this,Ci))}else this.replayImageOrLabel_.apply(this,Ci)}++u;break;case b.DRAW_CHARS:const bh=T[1],Oh=T[2],Ko=T[3],P_=T[4];L=T[5];const b_=T[6],Dh=T[7],Fh=T[8];I=T[9];const Zo=T[10];C=T[11],Array.isArray(C)&&(C=C.reduce(xu,"")),v=T[12];const kh=[T[13],T[13]];p=T[14]||"declutter";const O_=T[15],Ho=this.textStates[v],Kn=Ho.font,Zn=[Ho.scale[0]*Dh,Ho.scale[1]*Dh];let Hn;Kn in this.widths_?Hn=this.widths_[Kn]:(Hn={},this.widths_[Kn]=Hn);const Nh=Xr(c,bh,Oh,2),Gh=Math.abs(Zn[0])*Ka(Kn,C,Hn);if(P_||Gh<=Nh){const Ut=this.textStates[v].textAlign,Ci=(Nh-Gh)*zr(C,Ut),Kt=yu(c,bh,Oh,2,C,Ci,b_,Math.abs(Zn[0]),Ka,Kn,Hn,B?0:this.viewRotation_,O_);t:if(Kt){const ge=[];let Zt,Ie,Te,at,Rt;if(I)for(Zt=0,Ie=Kt.length;Zt<Ie;++Zt){Rt=Kt[Zt],Te=Rt[4],at=this.createLabel(Te,v,"",I),m=Rt[2]+(Zn[0]<0?-Zo:Zo),_=Ko*at.height+(.5-Ko)*2*Zo*Zn[1]/Zn[0]-Fh;const Le=this.calculateImageOrLabelDimensions_(at.width,at.height,Rt[0],Rt[1],at.width,at.height,m,_,0,0,Rt[3],kh,!1,oi,!1,k);if(l&&p==="declutter"&&l.collides(Le.declutterBox))break t;ge.push([t,e,at,Le,1,null,null])}if(L)for(Zt=0,Ie=Kt.length;Zt<Ie;++Zt){Rt=Kt[Zt],Te=Rt[4],at=this.createLabel(Te,v,L,""),m=Rt[2],_=Ko*at.height-Fh;const Le=this.calculateImageOrLabelDimensions_(at.width,at.height,Rt[0],Rt[1],at.width,at.height,m,_,0,0,Rt[3],kh,!1,oi,!1,k);if(l&&p==="declutter"&&l.collides(Le.declutterBox))break t;ge.push([t,e,at,Le,1,null,null])}l&&p!=="none"&&l.load(ge.map(tl));for(let Le=0,D_=ge.length;Le<D_;++Le)this.replayImageOrLabel_.apply(this,ge[Le])}}++u;break;case b.END_GEOMETRY:if(o!==void 0){k=T[1];const Ut=o(k,tt,p);if(Ut)return Ut}++u;break;case b.FILL:Y?F++:this.fill_(t),++u;break;case b.MOVE_TO_LINE_TO:for(f=T[1],g=T[2],V=c[f],H=c[f+1],t.moveTo(V,H),y=V+.5|0,w=H+.5|0,f+=2;f<g;f+=2)V=c[f],H=c[f+1],E=V+.5|0,x=H+.5|0,(f==g-2||E!==y||x!==w)&&(t.lineTo(V,H),y=E,w=x);++u;break;case b.SET_FILL_STYLE:this.alignAndScaleFill_=T[2],F&&(this.fill_(t),F=0,D&&(t.stroke(),D=0)),t.fillStyle=T[1],++u;break;case b.SET_STROKE_STYLE:D&&(t.stroke(),D=0),this.setStrokeStyle_(t,T),++u;break;case b.STROKE:Y?D++:t.stroke(),++u;break;default:++u;break}}F&&this.fill_(t),D&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const hi=["Polygon","Circle","LineString","Image","Text","Default"],il=["Image","Text"],Cu=hi.filter(n=>!il.includes(n));class vu{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=qt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new wu(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){s=Math.round(s);const a=s*2+1,l=ae(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ct(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=St(),sn(u,t),Ri(u,e*(this.renderBuffer_+s),u));const d=Ru(s);let f;function g(x,S,C){const v=c.getImageData(0,0,a,a).data;for(let I=0,L=d.length;I<L;I++)if(v[d[I]]>0){if(!o||C==="none"||f!=="Image"&&f!=="Text"||o.includes(x)){const F=(d[I]-3)/4,D=s-F%a,M=s-(F/a|0),P=r(x,S,D*D+M*M);if(P)return P}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(_e);let _,p,y,w,E;for(_=m.length-1;_>=0;--_){const x=m[_].toString();for(y=this.executorsByZIndex_[x],p=hi.length-1;p>=0;--p)if(f=hi[p],w=y[f],w!==void 0&&(E=w.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return Ne(a,0,8,2,t,a),a}isEmpty(){return ni(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?zh:_e),o=o||hi;const h=hi.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],p=f[_];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),w=y?y.getContext():t,E=this.maxExtent_&&_!=="Image"&&_!=="Text";if(E&&(w.save(),this.clip(w,i)),!y||_==="Text"||_==="Image"?p.execute(w,e,i,s,r,a):y.pushFunction(x=>p.execute(x,e,i,s,r,a)),E&&w.restore(),y){y.offset();const x=l[c]*h+hi.indexOf(_);this.deferredZIndexContexts_[x]||(this.deferredZIndexContexts_[x]=[]),this.deferredZIndexContexts_[x].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(_e);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Yr={};function Ru(n){if(Yr[n]!==void 0)return Yr[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r<o;++r)i[r]&&s.push(...i[r]);return Yr[n]=s,s}function nl(n){return n[0]>0&&n[1]>0}function Su(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function Tt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class ws{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Tt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ws({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_=Tt(t)}listenImageChange(t){X()}load(){X()}unlistenImageChange(t){X()}ready(){return Promise.resolve()}}class Cs extends ws{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?A.LOADING:A.LOADED,this.imageState_===A.LOADING&&this.ready().then(()=>this.imageState_=A.LOADED),this.render()}clone(){const t=this.getScale(),e=new Cs({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=Yt.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ct(o,o);this.draw_(r,a,t),s=a.canvas,Yt.set(i,null,null,new Na(s,void 0,null,A.LOADED,null))}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const S=s;s=r,r=S}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),w=r-y,x=Math.sqrt(p*p+w*w)/p;if(x<=i){const S=x*e/2-r-s;return 2*Math.max(_,S)}return _*2}createRenderOptions(){let t=Oi,e=Di,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=oe(this.stroke_.getColor()??En),a=this.stroke_.getWidth()??wn,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Di,t=this.stroke_.getLineCap()??Oi,i=this.stroke_.getMiterLimit()??yn);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=It),e.fillStyle=oe(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=Pi(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=ct(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?i:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=It,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class Rn extends Cs{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Rn({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class Lt{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new Lt({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=gs(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===A.IDLE&&e.load(),e.getImageState()===A.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?q(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Pi(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function sl(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class Sn extends ws{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,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;let a=t.src;$(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||q(o)),$(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),$(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=A.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?A.LOADED:A.IDLE:l=A.LOADING:l=A.LOADED),this.color_=t.color!==void 0?Pi(t.color):null,this.iconImage_=gs(o,a,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,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(sl(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(sl(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Sn({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_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,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 s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[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()}setSrc(t){this.iconImage_=gs(null,t,this.crossOrigin_,A.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==A.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==A.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(G.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(G.CHANGE,t)}ready(){return this.iconImage_.ready()}}class ze{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new ze({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class Dt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ol,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Dt({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=ol,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Iu(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:($(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Wr=null;function rl(n,t){if(!Wr){const e=new Lt({color:"rgba(255,255,255,0.4)"}),i=new ze({color:"#3399CC",width:1.25});Wr=[new Dt({image:new Rn({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Wr}function ol(n){return n.getGeometry()}const Tu="#333";class vs{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Tt(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Lt({color:Tu}),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,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new vs({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Lt?this.getFill().clone():this.getFill(),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,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}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_}getDeclutterMode(){return this.declutterMode_}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}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Tt(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}}const al=qt(),Lu=[NaN,NaN];class ll extends Wt{constructor(){super(),this.extent_=St(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fa((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return X()}closestPointXY(t,e,i,s){return X()}containsXY(t,e){return this.closestPointXY(t,e,Lu,Number.MIN_VALUE)===0}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]))&&nn(e),this.extentRevision_=this.getRevision()}return Vh(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=st(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=lt(h)/lt(l);ae(al,h[0],h[3],c,-c,0,0,0);const u=Ne(r,0,r.length,a,al,o),d=hn(i,e);return d?d(u,u,a):u}:hn(i,e);return this.applyTransform(s),this}}class ci extends ll{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ir(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().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=hl(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){X()}setLayout(t,e,i){let s;if(t)s=hl(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=ui(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();$a(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Ht(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();uu(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();du(i,0,i.length,s,t,e,i),this.changed()}}}function ui(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function hl(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Au(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return Ne(i,0,i.length,s,t,e)}class Mu extends Ga{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?rn(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=qt()}drawImages_(t,e,i,s){if(!this.image_)return;const r=Ne(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;ae(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ne(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=Ne(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!wt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Au(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!wt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(wt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!wt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!wt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Ae(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:xn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:oe(i||It)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||ye;this.strokeState_={lineCap:s!==void 0?s:Oi,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Ee)*this.pixelRatio_,lineJoin:a!==void 0?a:Di,lineWidth:(l!==void 0?l:wn)*this.pixelRatio_,miterLimit:h!==void 0?h:yn,strokeStyle:oe(i||En)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[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:oe(f||It)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Oi,lineDash:m||ye,lineDashOffset:_||Ee,lineJoin:p!==void 0?p:Di,lineWidth:y!==void 0?y:wn,miterLimit:w!==void 0?w:yn,strokeStyle:oe(f||En)}}const s=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:s!==void 0?s:ja,textAlign:u!==void 0?u:xn,textBaseline:d!==void 0?d:ps},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%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]]}}}const le=.5;function Pu(n,t,e,i,s,r,o,a,l){const h=s,c=n[0]*le,u=n[1]*le,d=ct(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Mu(d,le,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),p={};for(let w=1;w<=m;++w){const E=e[w-1],x=E.getStyleFunction()||i;if(!x)continue;let S=x(E,r);if(!S)continue;Array.isArray(S)||(S=[S]);const v=(w*_).toString(16).padStart(7,"#00000");for(let I=0,L=S.length;I<L;++I){const F=S[I],D=F.getGeometryFunction()(E);if(!D||!wt(h,D.getExtent()))continue;const M=F.clone(),P=M.getFill();P&&P.setColor(v);const B=M.getStroke();B&&(B.setColor(v),B.setLineDash(null)),M.setText(void 0);const N=F.getImage();if(N){const H=N.getImageSize();if(!H)continue;const tt=ct(H[0],H[1],void 0,{alpha:!1}),T=tt.canvas;tt.fillStyle=v,tt.fillRect(0,0,T.width,T.height),M.setImage(new Sn({img:T,anchor:N.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:N.getOrigin(),opacity:1,size:N.getSize(),scale:N.getScale(),rotation:N.getRotation(),rotateWithView:N.getRotateWithView()}))}const Y=M.getZIndex()||0;let k=p[Y];k||(k={},p[Y]=k,k.Polygon=[],k.Circle=[],k.LineString=[],k.Point=[]);const V=D.getType();if(V==="GeometryCollection"){const H=D.getGeometriesArrayRecursive();for(let tt=0,T=H.length;tt<T;++tt){const Et=H[tt];k[Et.getType().replace("Multi","")].push(Et,M)}}else k[V.replace("Multi","")].push(D,M)}}const y=Object.keys(p).map(Number).sort(_e);for(let w=0,E=y.length;w<E;++w){const x=p[y[w]];for(const S in x){const C=x[S];for(let v=0,I=C.length;v<I;v+=2){g.setStyle(C[v+1]);for(let L=0,F=t.length;L<F;++L)g.setTransform(t[L]),g.drawGeometry(C[v])}}}return d.getImageData(0,0,f.width,f.height)}function bu(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*le),r=Math.floor(Math.round(n[1])*le),o=(nt(s,0,e.width-1)+nt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}const Ou=.5,cl={Point:Yu,LineString:Gu,Polygon:ju,MultiPoint:Wu,MultiLineString:Xu,MultiPolygon:zu,GeometryCollection:Nu,Circle:Fu};function Du(n,t){return parseInt(q(n),10)-parseInt(q(t),10)}function ul(n,t){const e=dl(n,t);return e*e}function dl(n,t){return Ou*n/t}function Fu(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function fl(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==A.LOADED||f==A.ERROR?d=!1:f==A.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),ku(n,t,e,i,r,o,a),u}function ku(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())gl(n,l,e,t,o);else{const c=cl[l.getType()];c(n,l,e,t,o,r)}}function gl(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)gl(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Nu(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=cl[o[a].getType()];h(n,o[a],e,i,s,r)}}function Gu(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Xu(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function zu(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function Yu(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=A.LOADED)return;const c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,s)}if(l){const c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,s)}}function Wu(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=A.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,s)}if(h){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,s)}}function ju(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}class _l extends re{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const Bu=5;class Vu extends pn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Bu}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return X()}getData(t){return null}prepareFrame(t){return X()}renderFrame(t,e){return X()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===A.LOADED||e.getState()===A.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=A.LOADED&&e!=A.ERROR&&t.addEventListener(G.CHANGE,this.boundHandleImageChange_),e==A.IDLE&&(t.load(),e=t.getState()),e==A.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const ml=[];let Ni=null;function Uu(){Ni=ct(1,1,void 0,{willReadFrequently:!0})}class jr extends Vu{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=qt(),this.pixelTransform=qt(),this.inversePixelTransform=qt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Ni||Uu(),Ni.clearRect(0,0,1,1);let s;try{Ni.drawImage(t,e,i,1,1,0,0,1,1),s=Ni.getImageData(0,0,1,1).data}catch{return Ni=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&Ae(Pi(t.style.backgroundColor),Pi(i)))){const a=t.firstElementChild;Oe(a)&&(o=a.getContext("2d"))}if(o&&pu(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&&(this.container.style.backgroundColor=null),!this.container){r=Gt?_a():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ct();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 s=Je(i),r=ts(i),o=Jn(i),a=$n(i);ut(e.coordinateToPixelTransform,s),ut(e.coordinateToPixelTransform,r),ut(e.coordinateToPixelTransform,o),ut(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ut(l,s),ut(l,r),ut(l,o),ut(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[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()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(U(i)/s*o),l=Math.round(lt(i)/s*o);ae(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),Ja(this.inversePixelTransform,this.pixelTransform);const h=mu(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new _l(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(zt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(zt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Qa),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(zt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(zt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return ae(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Ku extends jr{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=St(),this.wrappedRenderedExtent_=St(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[ft.ANIMATING]||g[ft.INTERACTING]),_=this.context,p=Math.round(U(s)/a*f),y=Math.round(lt(s)/a*f),w=u.getWrapX()&&l.canWrapX(),E=w?U(c):null,x=w?Math.ceil((s[2]-c[2])/E)+1:1;let S=w?Math.floor((s[0]-c[0])/E):0;do{let C=this.getRenderTransform(o,a,0,f,p,y,S*E);e.declutter&&(C=C.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],C,h,m,i===void 0?hi:i?il:Cu,i?d&&e.declutter[d]:void 0)}while(++S<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ct(this.context.canvas.width,this.context.canvas.height,ml))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,ss(this.context),ml.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(zt.PRERENDER)||this.getLayer().hasListener(zt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=se(i.extent);a=wt(l,t.extent),this.clipped_=a&&!ne(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*le,d=i[1]*le;c.push(this.getRenderTransform(s,r,o,le,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!ne(g,l)){let m=l[0];const _=U(g);let p=0,y;for(;m<g[0];)--p,y=_*p,c.push(this.getRenderTransform(s,r,o,le,u,d,y).slice()),m+=_;for(p=0,m=l[2];m>g[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,le,u,d,y).slice()),m-=_}this.hitDetectionImageData_=Pu(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,ul(r,this.renderedPixelRatio_))}e(bu(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=q(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(d=>d.value):null)}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 s=t.viewHints[ft.ANIMATING],r=t.viewHints[ft.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!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 m=e.getRenderOrder();m===void 0&&(m=Du);const _=h.center.slice(),p=Ri(l,g*u),y=p.slice(),w=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!ne(E,t.extent)){const P=U(E),B=Math.max(U(p)/2,P);p[0]=E[0]-B,p[2]=E[2]+B,ha(_,c);const N=ia(w[0],c);N[0]<E[0]&&N[2]<E[2]?w.push([N[0]+P,N[1],N[2]+P,N[3]]):N[0]>E[0]&&N[2]>E[2]&&w.push([N[0]-P,N[1],N[2]-P,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&ne(this.wrappedRenderedExtent_,p))return Ae(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new cu(dl(u,d),p,u,d);let S;for(let P=0,B=w.length;P<B;++P)i.loadFeatures(w[P],u,c);const C=ul(u,d);let v=!0;const I=(P,B)=>{let N;const Y=P.getStyleFunction()||e.getStyleFunction();if(Y&&(N=Y(P,u)),N){const k=this.renderFeature(P,C,N,x,S,this.getLayer().getDeclutter(),B);v=v&&!k}},L=ba(p),F=i.getFeaturesInExtent(L);m&&F.sort(m);for(let P=0,B=F.length;P<B;++P)I(F[P],P);this.renderedFeatures_=F,this.ready=v;const D=x.finish(),M=new vu(p,u,d,i.getOverlaps(),D,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=M,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=fl(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=fl(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}function pl(n,t,e=0,i=n.length-1,s=Zu){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));pl(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(In(n,e,t),s(n[i],r)>0&&In(n,e,i);o<a;){for(In(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?In(n,e,a):(a++,In(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function In(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function Zu(n,t){return n<t?-1:n>t?1:0}let yl=class{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(!Ss(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Ss(t,l)&&(e.leaf?i.push(a):Vr(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Ss(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(Ss(t,o)){if(e.leaf||Vr(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Xi([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=Hu(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&Vr(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=Xi(t.slice(e,i+1)),Gi(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=Xi([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));El(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);El(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return Gi(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=Br(h),u=Ju(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),Ln(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=Xi(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Gi(i,this.toBBox),Gi(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Xi([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Gi(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=Tn(t,0,a,this.toBBox),h=Tn(t,a,i,this.toBBox),c=Qu(l,h),u=Br(l)+Br(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:qu,r=t.leaf?this.compareMinY:$u,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=Tn(t,0,e,r),a=Tn(t,i-e,i,r);let l=Rs(o)+Rs(a);for(let h=e;h<i-e;h++){const c=t.children[h];Ln(o,t.leaf?r(c):c),l+=Rs(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];Ln(a,t.leaf?r(c):c),l+=Rs(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Ln(e[s],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():Gi(t[e],this.toBBox)}};function Hu(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Gi(n,t){Tn(n,0,n.children.length,t,n)}function Tn(n,t,e,i,s){s||(s=Xi(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];Ln(s,n.leaf?i(o):o)}return s}function Ln(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function qu(n,t){return n.minX-t.minX}function $u(n,t){return n.minY-t.minY}function Br(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Rs(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Ju(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Qu(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function Vr(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Ss(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Xi(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function El(n,t,e,i,s){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;pl(n,o,t,e,s),r.push(t,o,o,e)}}let di=0;const Ct=1<<di++,Z=1<<di++,At=1<<di++,$t=1<<di++,fi=1<<di++,An=1<<di++,Is=Math.pow(2,di)-1,Ur={[Ct]:"boolean",[Z]:"number",[At]:"string",[$t]:"color",[fi]:"number[]",[An]:"size"},td=Object.keys(Ur).map(Number).sort(_e);function ed(n){return n in Ur}function Mn(n){const t=[];for(const e of td)Pn(n,e)&&t.push(Ur[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Pn(n,t){return(n&t)===t}function Ye(n,t){return n===t}class dt{constructor(t,e){if(!ed(t))throw new Error(`literal expressions must have a specific type, got ${Mn(t)}`);this.type=t,this.value=e}}class id{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function xl(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function mt(n,t,e){switch(typeof n){case"boolean":{if(Ye(t,At))return new dt(At,n?"true":"false");if(!Pn(t,Ct))throw new Error(`got a boolean, but expected ${Mn(t)}`);return new dt(Ct,n)}case"number":{if(Ye(t,An))return new dt(An,Tt(n));if(Ye(t,Ct))return new dt(Ct,!!n);if(Ye(t,At))return new dt(At,n.toString());if(!Pn(t,Z))throw new Error(`got a number, but expected ${Mn(t)}`);return new dt(Z,n)}case"string":{if(Ye(t,$t))return new dt($t,Lr(n));if(Ye(t,Ct))return new dt(Ct,!!n);if(!Pn(t,At))throw new Error(`got a string, but expected ${Mn(t)}`);return new dt(At,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return fd(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(Ye(t,An)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new dt(An,n)}if(Ye(t,$t)){if(n.length===3)return new dt($t,[...n,1]);if(n.length===4)return new dt($t,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Pn(t,fi))throw new Error(`got an array of numbers, but expected ${Mn(t)}`);return new dt(fi,n)}const R={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},nd={[R.Get]:z(W(1,1/0),wl),[R.Var]:z(W(1,1),sd),[R.Has]:z(W(1,1/0),wl),[R.Id]:z(rd,zi),[R.Concat]:z(W(2,1/0),J(At)),[R.GeometryType]:z(od,zi),[R.LineMetric]:z(zi),[R.Resolution]:z(Kr,zi),[R.Zoom]:z(Kr,zi),[R.Time]:z(Kr,zi),[R.Any]:z(W(2,1/0),J(Ct)),[R.All]:z(W(2,1/0),J(Ct)),[R.Not]:z(W(1,1),J(Ct)),[R.Equal]:z(W(2,2),J(Is)),[R.NotEqual]:z(W(2,2),J(Is)),[R.GreaterThan]:z(W(2,2),J(Z)),[R.GreaterThanOrEqualTo]:z(W(2,2),J(Z)),[R.LessThan]:z(W(2,2),J(Z)),[R.LessThanOrEqualTo]:z(W(2,2),J(Z)),[R.Multiply]:z(W(2,1/0),Cl),[R.Coalesce]:z(W(2,1/0),Cl),[R.Divide]:z(W(2,2),J(Z)),[R.Add]:z(W(2,1/0),J(Z)),[R.Subtract]:z(W(2,2),J(Z)),[R.Clamp]:z(W(3,3),J(Z)),[R.Mod]:z(W(2,2),J(Z)),[R.Pow]:z(W(2,2),J(Z)),[R.Abs]:z(W(1,1),J(Z)),[R.Floor]:z(W(1,1),J(Z)),[R.Ceil]:z(W(1,1),J(Z)),[R.Round]:z(W(1,1),J(Z)),[R.Sin]:z(W(1,1),J(Z)),[R.Cos]:z(W(1,1),J(Z)),[R.Atan]:z(W(1,2),J(Z)),[R.Sqrt]:z(W(1,1),J(Z)),[R.Match]:z(W(4,1/0),vl,ld),[R.Between]:z(W(3,3),J(Z)),[R.Interpolate]:z(W(6,1/0),vl,hd),[R.Case]:z(W(3,1/0),ad,cd),[R.In]:z(W(2,2),ud),[R.Number]:z(W(1,1/0),J(Is)),[R.String]:z(W(1,1/0),J(Is)),[R.Array]:z(W(1,1/0),J(Z)),[R.Color]:z(W(1,4),J(Z)),[R.Band]:z(W(1,3),J(Z)),[R.Palette]:z(W(2,2),dd),[R.ToString]:z(W(1,1),J(Ct|Z|At|$t))};function wl(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new dt(Z,o);break}case"string":{s[r]=new dt(At,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function sd(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new dt(At,i)]}function rd(n,t,e){e.featureId=!0}function od(n,t,e){e.geometryType=!0}function Kr(n,t,e){e.mapState=!0}function zi(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function W(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function Cl(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=mt(n[r+1],t,e);s[r]=o}return s}function J(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=mt(t[o+1],n,i);r[o]=a}return r}}function ad(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function vl(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function ld(n,t,e){const i=n.length-1,s=At|Z|Ct,r=mt(n[1],s,e),o=mt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=mt(n[l+2],r.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=mt(n[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function hd(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new dt(Z,s);let o;try{o=mt(n[2],Z,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const h=mt(n[l+3],Z,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=mt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function cd(n,t,e){const i=mt(n[n.length-1],t,e),s=new Array(n.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=mt(n[r+1],Ct,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=mt(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function ud(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=At}else s=Z;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=mt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[mt(n[1],s,e),...r]}function dd(n,t,e){let i;try{i=mt(n[1],Z,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=mt(s[o],$t,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof dt))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function z(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new id(e,s,...r)}}function fd(n,t,e){const i=n[0],s=nd[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function Rl(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Rl(n.getGeometries()[0]);default:return""}}function Sl(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ce(n,t,e){const i=mt(n,t,e);return Jt(i)}function Jt(n,t){if(n instanceof dt){if(n.type===$t&&typeof n.value=="string"){const i=Lr(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case R.Number:case R.String:case R.Coalesce:return gd(n);case R.Get:case R.Var:case R.Has:return _d(n);case R.Id:return i=>i.featureId;case R.GeometryType:return i=>i.geometryType;case R.Concat:{const i=n.args.map(s=>Jt(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case R.Resolution:return i=>i.resolution;case R.Any:case R.All:case R.Between:case R.In:case R.Not:return pd(n);case R.Equal:case R.NotEqual:case R.LessThan:case R.LessThanOrEqualTo:case R.GreaterThan:case R.GreaterThanOrEqualTo:return md(n);case R.Multiply:case R.Divide:case R.Add:case R.Subtract:case R.Clamp:case R.Mod:case R.Pow:case R.Abs:case R.Floor:case R.Ceil:case R.Round:case R.Sin:case R.Cos:case R.Atan:case R.Sqrt:return yd(n);case R.Case:return Ed(n);case R.Match:return xd(n);case R.Interpolate:return wd(n);case R.ToString:return Cd(n);default:throw new Error(`Unsupported operator ${e}`)}}function gd(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Jt(n.args[r]);switch(e){case R.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case R.Number:case R.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function _d(n,t){const i=n.args[0].value;switch(n.operator){case R.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case R.Var:return s=>s.variables[i];case R.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function md(n,t){const e=n.operator,i=Jt(n.args[0]),s=Jt(n.args[1]);switch(e){case R.Equal:return r=>i(r)===s(r);case R.NotEqual:return r=>i(r)!==s(r);case R.LessThan:return r=>i(r)<s(r);case R.LessThanOrEqualTo:return r=>i(r)<=s(r);case R.GreaterThan:return r=>i(r)>s(r);case R.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function pd(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Jt(n.args[r]);switch(e){case R.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case R.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case R.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case R.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case R.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function yd(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Jt(n.args[r]);switch(e){case R.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case R.Divide:return r=>s[0](r)/s[1](r);case R.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case R.Subtract:return r=>s[0](r)-s[1](r);case R.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case R.Mod:return r=>s[0](r)%s[1](r);case R.Pow:return r=>Math.pow(s[0](r),s[1](r));case R.Abs:return r=>Math.abs(s[0](r));case R.Floor:return r=>Math.floor(s[0](r));case R.Ceil:return r=>Math.ceil(s[0](r));case R.Round:return r=>Math.round(s[0](r));case R.Sin:return r=>Math.sin(s[0](r));case R.Cos:return r=>Math.cos(s[0](r));case R.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case R.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Ed(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Jt(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function xd(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Jt(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function wd(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Jt(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let h=2;h<e;h+=2){const c=i[h](s);let u=i[h+1](s);const d=Array.isArray(u);if(d&&(u=Xc(u)),c>=o)return h===2?u:d?vd(r,o,a,l,c,u):bn(r,o,a,l,c,u);a=c,l=u}return l}}function Cd(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Jt(n.args[r]);if(e===R.ToString)return r=>{const o=s[0](r);return n.args[0].type===$t?Ar(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function bn(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function vd(n,t,e,i,s,r){if(s-e===0)return i;const a=Da(i),l=Da(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[bn(n,t,e,a[0],s,l[0]),bn(n,t,e,a[1],s,l[1]),a[2]+bn(n,t,e,0,s,h),bn(n,t,e,i[3],s,r[3])];return zc(c)}function Rd(n){return!0}function Sd(n){const t=xl(),e=Id(n,t),i=Sl();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=Rl(s.getGeometry())),e(i)}}function Il(n){const t=xl(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Zr(n[o],t);const s=Sl(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function Id(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?Ce(r.filter,Ct,t):Rd;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Zr(r.style[h],t)}else a=[Zr(r.style,t)];i[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&o)){o=!0;for(const h of i[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function Zr(n,t){const e=On(n,"",t),i=Dn(n,"",t),s=Td(n,t),r=Ld(n,t),o=Mt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!ni(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new Dt;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function On(n,t,e){let i;if(t+"fill-pattern-src"in n)i=bd(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=Hr(n,t+"fill-color",e)}if(!i)return null;const s=new Lt;return function(r){const o=i(r);return o===wr?null:(s.setColor(o),s)}}function Dn(n,t,e){const i=Mt(n,t+"stroke-width",e),s=Hr(n,t+"stroke-color",e);if(!i&&!s)return null;const r=ve(n,t+"stroke-line-cap",e),o=ve(n,t+"stroke-line-join",e),a=Tl(n,t+"stroke-line-dash",e),l=Mt(n,t+"stroke-line-dash-offset",e),h=Mt(n,t+"stroke-miter-limit",e),c=new ze;return function(u){if(s){const d=s(u);if(d===wr)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function Td(n,t){const e="text-",i=ve(n,e+"value",t);if(!i)return null;const s=On(n,e,t),r=On(n,e+"background-",t),o=Dn(n,e,t),a=Dn(n,e+"background-",t),l=ve(n,e+"font",t),h=Mt(n,e+"max-angle",t),c=Mt(n,e+"offset-x",t),u=Mt(n,e+"offset-y",t),d=Yi(n,e+"overflow",t),f=ve(n,e+"placement",t),g=Mt(n,e+"repeat",t),m=Ls(n,e+"scale",t),_=Yi(n,e+"rotate-with-view",t),p=Mt(n,e+"rotation",t),y=ve(n,e+"align",t),w=ve(n,e+"justify",t),E=ve(n,e+"baseline",t),x=Yi(n,e+"keep-upright",t),S=Tl(n,e+"padding",t),C=Ms(n,e+"declutter-mode"),v=new vs({declutterMode:C});return function(I){if(v.setText(i(I)),s&&v.setFill(s(I)),r&&v.setBackgroundFill(r(I)),o&&v.setStroke(o(I)),a&&v.setBackgroundStroke(a(I)),l&&v.setFont(l(I)),h&&v.setMaxAngle(h(I)),c&&v.setOffsetX(c(I)),u&&v.setOffsetY(u(I)),d&&v.setOverflow(d(I)),f){const L=f(I);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");v.setPlacement(L)}if(g&&v.setRepeat(g(I)),m&&v.setScale(m(I)),_&&v.setRotateWithView(_(I)),p&&v.setRotation(p(I)),y){const L=y(I);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");v.setTextAlign(L)}if(w){const L=w(I);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");v.setJustify(L)}if(E){const L=E(I);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");v.setTextBaseline(L)}return S&&v.setPadding(S(I)),x&&v.setKeepUpright(x(I)),v}}function Ld(n,t){return"icon-src"in n?Ad(n,t):"shape-points"in n?Md(n,t):"circle-radius"in n?Pd(n,t):null}function Ad(n,t){const e="icon-",i=e+"src",s=Pl(n[i],i),r=Ts(n,e+"anchor",t),o=Ls(n,e+"scale",t),a=Mt(n,e+"opacity",t),l=Ts(n,e+"displacement",t),h=Mt(n,e+"rotation",t),c=Yi(n,e+"rotate-with-view",t),u=Al(n,e+"anchor-origin"),d=Ml(n,e+"anchor-x-units"),f=Ml(n,e+"anchor-y-units"),g=kd(n,e+"color"),m=Dd(n,e+"cross-origin"),_=Fd(n,e+"offset"),p=Al(n,e+"offset-origin"),y=As(n,e+"width"),w=As(n,e+"height"),E=Od(n,e+"size"),x=Ms(n,e+"declutter-mode"),S=new Sn({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:w,width:y,size:E,declutterMode:x});return function(C){return a&&S.setOpacity(a(C)),l&&S.setDisplacement(l(C)),h&&S.setRotation(h(C)),c&&S.setRotateWithView(c(C)),o&&S.setScale(o(C)),r&&S.setAnchor(r(C)),S}}function Md(n,t){const e="shape-",i=e+"points",s=e+"radius",r=qr(n[i],i),o=qr(n[s],s),a=On(n,e,t),l=Dn(n,e,t),h=Ls(n,e+"scale",t),c=Ts(n,e+"displacement",t),u=Mt(n,e+"rotation",t),d=Yi(n,e+"rotate-with-view",t),f=As(n,e+"radius2"),g=As(n,e+"angle"),m=Ms(n,e+"declutter-mode"),_=new Cs({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function Pd(n,t){const e="circle-",i=On(n,e,t),s=Dn(n,e,t),r=Mt(n,e+"radius",t),o=Ls(n,e+"scale",t),a=Ts(n,e+"displacement",t),l=Mt(n,e+"rotation",t),h=Yi(n,e+"rotate-with-view",t),c=Ms(n,e+"declutter-mode"),u=new Rn({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Mt(n,t,e){if(!(t in n))return;const i=Ce(n[t],Z,e);return function(s){return qr(i(s),t)}}function ve(n,t,e){if(!(t in n))return null;const i=Ce(n[t],At,e);return function(s){return Pl(i(s),t)}}function bd(n,t,e){const i=ve(n,t+"pattern-src",e),s=Ll(n,t+"pattern-offset",e),r=Ll(n,t+"pattern-size",e),o=Hr(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function Yi(n,t,e){if(!(t in n))return null;const i=Ce(n[t],Ct,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Hr(n,t,e){if(!(t in n))return null;const i=Ce(n[t],$t,e);return function(s){return bl(i(s),t)}}function Tl(n,t,e){if(!(t in n))return null;const i=Ce(n[t],fi,e);return function(s){return Fn(i(s),t)}}function Ts(n,t,e){if(!(t in n))return null;const i=Ce(n[t],fi,e);return function(s){const r=Fn(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function Ll(n,t,e){if(!(t in n))return null;const i=Ce(n[t],fi,e);return function(s){return Ol(i(s),t)}}function Ls(n,t,e){if(!(t in n))return null;const i=Ce(n[t],fi|Z,e);return function(s){return Nd(i(s),t)}}function As(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function Od(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Tt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function Dd(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Al(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Ml(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function Fd(n,t){const e=n[t];if(e!==void 0)return Fn(e,t)}function Ms(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function kd(n,t){const e=n[t];if(e!==void 0)return bl(e,t)}function Fn(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Pl(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function qr(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function bl(n,t){if(typeof n=="string")return n;const e=Fn(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function Ol(n,t){const e=Fn(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Nd(n,t){return typeof n=="number"?n:Ol(n,t)}const Qt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Dl(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=nt(i[0],d,f),p=nt(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-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]-m)/y)}return[_,p]})}function Gd(n){return n}function Fl(n){return Math.pow(n,3)}function gi(n){return 1-Fl(1-n)}function $r(n){return 3*n*n-2*n*n*n}function Xd(n){return n}function kl(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-r,c=n[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function Nl(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=kl(n,t,a,i),t=a}return s}function zd(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Nl(n,t,a,i),t=a[a.length-1]}return s}function Gl(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Ot(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function Jr(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=Qe(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function Qr(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Jr(n,t,a,i,s),t=a}return s}function Yd(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Qr(n,t,a,i,s),t=a[a.length-1]}return s}function to(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Qe(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(Gl(n,f-i,f,i,o,a,c),d=Qe(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Gl(n,e-i,t,i,o,a,c),d=Qe(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function eo(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=to(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Wd(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=eo(n,t,f,i,s,r,o,a,l,h,c),t=f[f.length-1]}return h}function jd(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function Ps(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function kn(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Ps(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function Xl(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=kn(n,t,e[o],i,s[r]);l.length===0&&(l[0]=t),s[r++]=l,t=l[l.length-1]}return s.length=r,s}class Nn extends ci{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new Nn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<qe(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),to(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return kl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Es(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Nn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ps(this.flatCoordinates,0,t,this.stride),this.changed()}}class he extends ci{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new he(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Qe(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return er(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Qs(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=jd(this.flatCoordinates,0,t,this.stride),this.changed()}}function Bd(n,t,e,i,s){return!ta(s,function(o){return!_i(n,t,e,i,o[0],o[1])})}function _i(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function io(n,t,e,i,s,r){if(e.length===0||!_i(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(_i(n,e[o-1],e[o],i,s,r))return!1;return!0}function Vd(n,t,e,i,s,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(io(n,t,l,i,s,r))return!0;t=l[l.length-1]}return!1}function no(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],m=[];for(let y=0,w=e.length;y<w;++y){const E=e[y];for(c=n[E-i],d=n[E-i+1],a=t;a<E;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,p=-1/0;for(m.sort(_e),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,io(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function zl(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=no(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Yl(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function bs(n,t,e,i,s,r){return r=r??Qo(St(),n,t,e,i),wt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Yl(n,t,e,i,function(o,a){return Kh(s,o,a)}):!1}function Ud(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){if(bs(n,t,e[r],i,s))return!0;t=e[r]}return!1}function Wl(n,t,e,i,s){return!!(bs(n,t,e,i,s)||_i(n,t,e,i,s[0],s[1])||_i(n,t,e,i,s[0],s[3])||_i(n,t,e,i,s[2],s[1])||_i(n,t,e,i,s[2],s[3]))}function jl(n,t,e,i,s){if(!Wl(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Bd(n,e[r-1],e[r],i,s)&&!bs(n,e[r-1],e[r],i,s))return!1;return!0}function Kd(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(jl(n,t,a,i,s))return!0;t=a[a.length-1]}return!1}function Zd(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function so(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function ro(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=so(n,t,a,i);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function Bl(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!ro(n,t,a,i,s))return!1;a.length&&(t=a[a.length-1])}return!0}function Os(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=so(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Zd(n,t,a,i),t=a}return t}function oo(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r)t=Os(n,t,e[r],i,s);return t}function Hd(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=so(n,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class We extends ci{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?ie(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new We(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<qe(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),eo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return io(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Nl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Os(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,mn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ht(this.getExtent());this.flatInteriorPoint_=no(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new he(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Nn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new Nn(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;ro(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Os(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Nr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new We(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return jl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=kn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Vl(n){if(Ii(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new We(r,"XY",[r.length])}function ao(n,t,e,i){const s=U(t)/e[0],r=lt(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function lo(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),nt(i,e/2,t*2)}function qd(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?ao(l,e,o,i):l;if(a)return t?lo(s,c,h):nt(s,h,c);const u=Math.min(c,s),d=Math.floor(qn(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function $d(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=s?ao(t,s,l,r):t;if(h)return i?lo(o,c,e):nt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),p=t/Math.pow(n,_);return nt(p,e,c)}})}function Ul(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?ao(n,i,a,s):n;return!e||!l?nt(r,t,h):lo(r,h,t)}})}function ho(n){if(n!==void 0)return 0}function Kl(n){if(n!==void 0)return n}function Jd(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Qd(n){const t=Pe(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const tf=42,co=256,uo=0;class ce extends Wt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=mr(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&Lc(),t.center&&(t.center=pe(t.center,this.projection_)),t.extent&&(t.extent=se(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Qt)delete e[a];this.setProperties(e,!0);const i=nf(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=ef(t),r=i.constraint,o=sf(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=pe(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=pe(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){i&&Ds(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||$r,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=ti(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}rf(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(ft.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ft.ANIMATING]>0}getInteracting(){return this.hints_[ft.INTERACTING]>0}cancelAnimations(){this.setHint(ft.ANIMATING,-this.hints_[ft.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&Ds(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?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],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,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?ti(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(ft.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&Ds(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 s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],rr(i,t-this.getRotation()),aa(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}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&&xr(t,this.getProjection())}getCenterInternal(){return this.get(Qt.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 ba(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();$(e,"The view center is not defined");const i=this.getResolution();$(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return $(s!==void 0,"The view rotation is not defined"),Qn(e,i,s,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(Qt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(se(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=U(t)/e[0],s=lt(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*s)})}getRotation(){return this.get(Qt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/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 s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=fo(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=qn(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=nt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,nt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if($(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){$(!Ii(t),"Cannot fit empty extent provided as `geometry`");const s=se(t,this.getProjection());i=Vl(s)}else if(t.getType()==="Circle"){const s=se(t.getExtent(),this.getProjection());i=Vl(s),i.rotate(this.getRotation(),Ht(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=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;u<d;u+=o){const f=r[u]*i-r[u+1]*s,g=r[u]*s+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=Ht(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:fn;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),Ds(_,!0))}centerOn(t,e,i){this.centerOnInternal(pe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(fo(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=fo(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=xr(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&pe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=pe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&pe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(Qt.ROTATION)!==s&&this.set(Qt.ROTATION,s),this.get(Qt.RESOLUTION)!==o&&(this.set(Qt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Qt.CENTER)||!is(this.get(Qt.CENTER),a))&&this.set(Qt.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!is(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:gi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ft.INTERACTING,1)}endInteraction(t,e,i){i=i&&pe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ft.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Ds(n,t){setTimeout(function(){n(t)},0)}function ef(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return Dl(n.extent,n.constrainOnlyCenter,e)}const t=mr(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Dl(e,!1,!1)}return Gd}function nf(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:uo,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=mr(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=qd(_,c,!g&&m,u):t=Ul(e,i,c,!g&&m,u)}else{const p=(f?Math.max(U(f),lt(f)):360*ar.degrees/d.getMetersPerUnit())/co/Math.pow(2,uo),y=p/Math.pow(2,28-uo);e=n.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=$d(l,e,i,c,!g&&m,u):t=Ul(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function sf(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?Qd():e===!1?Kl:typeof e=="number"?Jd(e):Kl}return ho}function rf(n){return!(n.sourceCenter&&n.targetCenter&&!is(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function fo(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const Q={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class Gn extends Wt{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[Q.OPACITY]=t.opacity!==void 0?t.opacity:1,$(typeof e[Q.OPACITY]=="number","Layer opacity must be a number"),e[Q.VISIBLE]=t.visible!==void 0?t.visible:!0,e[Q.Z_INDEX]=t.zIndex,e[Q.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[Q.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[Q.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[Q.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=nt(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(Q.EXTENT)}getMaxResolution(){return this.get(Q.MAX_RESOLUTION)}getMinResolution(){return this.get(Q.MIN_RESOLUTION)}getMinZoom(){return this.get(Q.MIN_ZOOM)}getMaxZoom(){return this.get(Q.MAX_ZOOM)}getOpacity(){return this.get(Q.OPACITY)}getSourceState(){return X()}getVisible(){return this.get(Q.VISIBLE)}getZIndex(){return this.get(Q.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Q.EXTENT,t)}setMaxResolution(t){this.set(Q.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Q.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Q.MAX_ZOOM,t)}setMinZoom(t){this.set(Q.MIN_ZOOM,t)}setOpacity(t){$(typeof t=="number","Layer opacity must be a number"),this.set(Q.OPACITY,t)}setVisible(t){this.set(Q.VISIBLE,t)}setZIndex(t){this.set(Q.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Xn extends Gn{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.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Q.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(Q.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(et(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=K(t,G.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof ce?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return go(s,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof ce?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Q.MAP,t)}getMapInternal(){return this.get(Q.MAP)}setMap(t){this.mapPrecomposeKey_&&(et(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(et(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=K(t,zt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=K(this,G.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);$(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Q.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function go(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const Zl={RENDER_ORDER:"renderOrder"};class Hl extends Xn{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?String(t.declutter):void 0,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(Zl.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new yl(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Zl.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?rl:t;const e=of(t);this.styleFunction_=t===null?void 0:Iu(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function of(n){if(n===void 0)return rl;if(!n)return null;if(typeof n=="function"||n instanceof Dt)return n;if(!Array.isArray(n))return Il([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof Dt){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof Dt))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return Sd(s)}return Il(n)}class mi extends Hl{constructor(t){super(t)}createRenderer(){return new Ku(this)}}const Pt={ADD:"add",REMOVE:"remove"},ql={LENGTH:"length"};class Fs extends re{constructor(t,e,i){super(t),this.element=e,this.index=i}}class jt extends Wt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(ql.LENGTH)}insertAt(t,e){if(t<0||t>this.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 Fs(Pt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Fs(Pt.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 s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Fs(Pt.REMOVE,s,t)),this.dispatchEvent(new Fs(Pt.ADD,e,t))}updateLength_(){this.set(ql.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}let af=!1;function lf(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=af,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function $l(n,t){return function(e,i,s,r,o){lf(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function hf(n,t){return[[-1/0,-1/0,1/0,1/0]]}class Re extends Wt{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Re(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(et(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=K(t,G.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?cf(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function cf(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:($(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}function Jl(n,t,e,i){const s=[];let r=St();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ir(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}function ks(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const p=n[_],y=n[_+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,m=Xh(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?n[a+c]:Ot(n[a+c],n[a+i+c],l);return r}function _o(n,t,e,i,s,r){if(e==t)return null;let o;if(s<n[t+i-1])return r?(o=n.slice(t,t+i),o[i-1]=s,o):null;if(n[e-1]<s)return r?(o=n.slice(e-i,e),o[i-1]=s,o):null;if(s==n[t+i-1])return n.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;s<n[(d+1)*i-1]?l=d:a=d+1}const h=n[a*i-1];if(s==h)return n.slice((a-1)*i,(a-1)*i+i);const c=n[(a+1)*i-1],u=(s-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(Ot(n[(a-1)*i+d],n[a*i+d],u));return o.push(s),o}function uf(n,t,e,i,s,r,o){if(o)return _o(n,t,e[e.length-1],i,s,r);let a;if(s<n[i-1])return r?(a=n.slice(0,i),a[i-1]=s,a):null;if(n[n.length-1]<s)return r?(a=n.slice(n.length-i),a[i-1]=s,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(s<n[t+i-1])return null;if(s<=n[c-1])return _o(n,t,c,i,s,!1);t=c}}return null}class Ns extends ll{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(et),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(K(t[e],G.CHANGE,this.changed,this))}clone(){const t=new Ns(mo(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<qe(this.getExtent(),t,e))return s;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)s=r[o].closestPointXY(t,e,i,s);return s}containsXY(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)if(i[s].containsXY(t,e))return!0;return!1}computeExtent(t){nn(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)Jo(t,e[i].getExtent());return t}getGeometries(){return mo(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}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=[],i=this.geometries_;let s=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(s=!0)}return s?new Ns(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)i[s].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Ht(this.getExtent()));const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)s[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(mo(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)i[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function mo(n){return n.map(t=>t.clone())}class Wi extends ci{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){ie(this.flatCoordinates,t),this.changed()}clone(){const t=new Wi(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<qe(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),to(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return Yl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,_o(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ks(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Xr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Es(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Wi(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return bs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ps(this.flatCoordinates,0,t,this.stride),this.changed()}}class Gs extends ci{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const s=t,r=[],o=[];for(let l=0,h=s.length;l<h;++l){const c=s[l];ie(r,c.getFlatCoordinates()),o.push(r.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){ie(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Gs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<qe(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),eo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,uf(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return mn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Wi(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new Wi(t.slice(r,l),i);s.push(h),r=l}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,r=t.length;s<r;++s)i+=Xr(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,r=this.stride;for(let o=0,a=s.length;o<a;++o){const l=s[o],h=ks(e,i,l,r,.5);ie(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Ha(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Gs(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return Ud(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=kn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class Xs extends ci{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){ie(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Xs(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<qe(this.getExtent(),t,e))return s;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=Qe(t,e,r[a],r[a+1]);if(h<s){s=h;for(let c=0;c<o;++c)i[c]=r[a+c];i.length=o}}return s}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new he(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let r=0,o=t.length;r<o;r+=i){const a=new he(t.slice(r,r+i),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,r=e.length;s<r;s+=i){const o=e[s],a=e[s+1];if(Qs(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ps(this.flatCoordinates,0,t,this.stride),this.changed()}}class zs extends ci{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const s=t,r=[],o=[];for(let a=0,l=s.length;a<l;++a){const h=s[a],c=r.length,u=h.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=c;ie(r,h.getFlatCoordinates()),o.push(u)}e=s.length===0?this.getLayout():s[0].getLayout(),t=r,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;ie(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let s=0,r=e.length;s<r;++s)e[s]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const i=new zs(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<qe(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yd(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Wd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Vd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return zd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),oo(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,br(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Jl(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=zl(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Xs(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Bl(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=oo(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=ru(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new zs(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new We(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),h=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const c=new We(e.slice(r,h),t,l);s.push(c),r=h}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return Kd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Xl(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const s=i[i.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const Ql=qt();class Ft{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?er(this.flatCoordinates_):ir(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Ht(this.getExtent());this.flatInteriorPoints_=no(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Hd(this.flatCoordinates_,this.ends_),e=Jl(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=zl(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ks(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=ks(t,e,o,2,.5);ie(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=st(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=lt(i)/lt(e);ae(Ql,i[0],i[3],s,-s,0,0,0),Ne(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Ql,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Ft(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Fa((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=Es(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Ha(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=Nr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new Ft(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Ft.prototype.getFlatCoordinates=Ft.prototype.getOrientedFlatCoordinates;class th{constructor(t){this.rbush_=new yl(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[q(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[q(a)]=l}this.rbush_.load(i)}remove(t){const e=q(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[q(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Si(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return ni(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Me(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class po extends Wt{constructor(t){super(),this.projection=st(t.projection),this.attributions_=eh(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=eh(t),this.changed()}setState(t){this.state_=t,this.changed()}}function eh(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const Bt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class je extends re{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class pi extends po{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_=fn,this.format_=t.format||null,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&&($(this.format_,"`format` must be set when `url` is set"),this.loader_=$l(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:hf;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new th:null,this.loadedExtentsRtree_=new th,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new jt(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=q(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new je(Bt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Ft||(this.featureChangeKeys_[t]=[K(e,G.CHANGE,this.handleFeatureChange_,this),K(e,bi.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof Ft){const r=this.idIndex_[s];r instanceof Ft?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&($(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=q(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=q(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Bt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new je(Bt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Bt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Bt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Pt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Pt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(et);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new je(Bt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(s){const r=s.getGeometry();if(r instanceof Ft||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof Ft||s.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),ni(this.nullGeometryFeatures_)||ie(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=na(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=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||dn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof Ft?0:c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=q(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new je(Bt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:q(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&ni(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(c){return ne(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new je(Bt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new je(Bt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new je(Bt.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(Si(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=q(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(et),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(Bt.REMOVEFEATURE)&&this.dispatchEvent(new je(Bt.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){$(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader($l(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class ji extends re{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class Be extends ji{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const ot={SINGLECLICK:"singleclick",CLICK:G.CLICK,DBLCLICK:G.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},yo={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class df extends gn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=K(i,yo.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=K(i,yo.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(G.TOUCHMOVE,this.boundHandleTouchMove_,da?{passive:!1}:!1)}emulateClick_(t){let e=new Be(ot.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Be(ot.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new Be(ot.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==ot.POINTERUP||e.type==ot.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==ot.POINTERDOWN||e.type==ot.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Be(ot.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(et),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new Be(ot.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(K(i,ot.POINTERMOVE,this.handlePointerMove_,this),K(i,ot.POINTERUP,this.handlePointerUp_,this),K(this.element_,ot.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(K(this.element_.getRootNode(),ot.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Be(ot.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Be(ot.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(et(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(G.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(et(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(et),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Se={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},pt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},O={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},Ys=1/0;class ff{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,an(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 s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){$(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ys?(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_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Ys?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class gf extends ff{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(G.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===O.LOADED||i===O.ERROR||i===O.EMPTY){i!==O.ERROR&&e.removeEventListener(G.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===O.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function _f(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ys;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Eo extends Wt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)et(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==fn&&this.listenerKeys.push(K(t,Se.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class mf extends Eo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(G.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+ms+" "+Or+(this.collapsed_&&this.collapsible_?" "+Ya:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ka(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Ae(e,this.renderedAttributions_)){ga(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ya),this.collapsed_?fa(this.collapseLabel_,this.label_):fa(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class pf extends Eo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(G.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+ms+" "+Or,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(_s)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:gi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(_s);!r&&i===0?this.element.classList.add(_s):r&&i!==0&&this.element.classList.remove(_s)}this.label_.style.transform=s}this.rotation_=i}}class yf extends Eo{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,s=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:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(G.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(G.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+ms+" "+Or,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 s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:gi})):i.setZoom(r)}}}function ih(n){n=n||{};const t=new jt;return(n.zoom===void 0||n.zoom)&&t.push(new yf(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new pf(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new mf(n.attributionOptions)),t}class Ef{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<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)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const nh={ACTIVE:"active"};class zn extends Wt{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(nh.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(nh.ACTIVE,t)}setMap(t){this.map_=t}}function xf(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:Xd,center:n.getConstrainedCenter(s)})}}function xo(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:gi})}class wf extends zn{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==ot.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();xo(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function wo(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const Cf=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},vf=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Rf=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},sh=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Rf(n):!0},Sf=dn,rh=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!($h&&ca&&t.ctrlKey)},oh=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},If=function(n){const t=n.originalEvent;return ca?t.metaKey:t.ctrlKey},Tf=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ah=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Co=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Lf=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class Yn extends zn{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==ot.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==ot.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==ot.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==ot.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 vo(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class Af extends Yn{constructor(t){super({stopDown:ds}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:wo(oh,Lf);this.condition_=t.onFocusOnly?wo(sh,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(vo(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();la(r,a.getResolution()),rr(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:gi})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&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}return!1}}class Mf extends Yn{constructor(t){t=t||{},super({stopDown:ds}),this.condition_=t.condition?t.condition:vf,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Co(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ho)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return Co(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Co(t)&&rh(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Pf extends us{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",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.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(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new We([s])}getGeometry(){return this.geometry_}}const Bi={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Wn extends re{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class bf extends Yn{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Pf(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??rh,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Wn(Bi.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Wn(e?Bi.BOXEND:Bi.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!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 Wn(Bi.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Wn(Bi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Wn(Bi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Of extends bf{constructor(t){t=t||{};const e=t.condition?t.condition:Tf;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 s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:gi})}}const yi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Df extends zn{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return oh(e)&&ah(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==G.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==yi.DOWN||s==yi.LEFT||s==yi.RIGHT||s==yi.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==yi.DOWN?h=-a:s==yi.LEFT?l=-a:s==yi.RIGHT?l=a:h=a;const c=[l,h];rr(c,o.getRotation()),xf(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class Ff extends zn{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!If(e)&&ah(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==G.KEYDOWN||t.type==G.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();xo(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const kf=40,Nf=300;class Gf extends zn{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:Sf;this.condition_=t.onFocusOnly?wo(sh,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_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==G.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=kf;break;case WheelEvent.DOM_DELTA_PAGE:r*=Nf;break}if(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_?i.getCoordinateFromPixel(this.lastAnchor_):null),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=-nt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),xo(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,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)}}class Xf extends Yn{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=ds),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],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==ho&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(vo(this.targetPointers))),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}return!1}}class zf extends Yn{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=ds),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],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.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),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(vo(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}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}return!1}}function Yf(n){n=n||{};const t=new jt,e=new Ef(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new Mf),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new wf({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new Af({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new Xf),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new zf({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new Df),t.push(new Ff({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new Gf({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new Of({duration:n.zoomDuration})),t}const Ve={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Ue extends re{constructor(t,e){super(t),this.layer=e}}const Ro={LAYERS:"layers"};class Vi extends Gn{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(Ro.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new jt(i.slice(),{unique:!0}):$(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new jt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(et),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(K(t,Pt.ADD,this.handleLayersAdd_,this),K(t,Pt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(et);an(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Ue(Ve.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[K(t,bi.PROPERTYCHANGE,this.handleLayerChange_,this),K(t,G.CHANGE,this.handleLayerChange_,this)];t instanceof Vi&&e.push(K(t,Ve.ADDLAYER,this.handleLayerGroupAdd_,this),K(t,Ve.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[q(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ue(Ve.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ue(Ve.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ue(Ve.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=q(e);this.listenerKeys_[i].forEach(et),delete this.listenerKeys_[i],this.dispatchEvent(new Ue(Ve.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Ro.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new Ue(Ve.REMOVELAYER,i[s]))}this.set(Ro.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=me(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Wf extends us{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){X()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;ae(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ja(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,S,C){return r.call(o,x,E?S:null,C)}const d=c.projection,f=ha(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=U(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const S=m[x],C=S.layer;if(C.hasRenderer()&&go(S,c)&&a.call(l,C)){const v=C.getRenderer(),I=C.getSource();if(v&&I){const L=I.getWrapX()?f:t,F=u.bind(null,S.managed);y[0]=L[0]+g[E][0],y[1]=L[1]+g[E][1],h=v.forEachFeatureAtCoordinate(y,e,i,F,p)}if(h)return h}}if(p.length===0)return;const w=1/p.length;return p.forEach((E,x)=>E.distanceSq+=x*w),p.sort((E,x)=>E.distanceSq-x.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,dn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){X()}scheduleExpireIconCache(t){Yt.canExpireCache()&&t.postRenderFunctions.push(jf)}}function jf(n,t){Yt.expire()}class Bf extends Wf{constructor(t){super(t),this.fontChangeListenerKey_=K(Fi,bi.PROPERTYCHANGE,t.redrawText,t),this.element_=Gt?_a():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=ms+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new _l(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){et(this.fontChangeListenerKey_),this.element_.remove(),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((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof Hl&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h<c;++h){const u=e[h];t.layerIndex=h;const d=u.layer,f=d.getSourceState();if(!go(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),ic(this.element_,this.children_);const l=this.getMap().getTargetElement();if(Oe(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!Oe(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),Oe(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...Gr(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;h.setTransform(m,0,0,_,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(zt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function lh(n){if(n instanceof Xn){n.setMapInternal(null);return}n instanceof Vi&&n.getLayers().forEach(lh)}function hh(n,t){if(n instanceof Xn){n.setMapInternal(t);return}if(n instanceof Vi){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)hh(e[i],t)}}let Ui=class extends Wt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Vf(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Jh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=qt(),this.pixelToCoordinateTransform_=qt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Gt||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Gt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Gt?new jt:ih()),this.interactions=e.interactions||(Gt?new jt:Yf({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new gf(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(pt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(pt.VIEW,this.handleViewChanged_),this.addChangeListener(pt.SIZE,this.handleSizeChanged_),this.addChangeListener(pt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof ce)&&t.view.then(function(s){i.setView(new ce(s))}),this.controls.addEventListener(Pt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Pt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Pt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Pt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Pt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Pt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){hh(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:dn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Vi?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:dn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(pt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return xr(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ut(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(pt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof jt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=pe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?ut(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(pt.SIZE)}getView(){return this.get(pt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return _f(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Be(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===yo.POINTERDOWN||i===G.WHEEL||i===G.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[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 s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[ft.ANIMATING]||o[ft.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(zt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(zt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new ji(Se.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new ji(Se.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)et(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(G.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(G.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Oe(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Oe(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Bf(this)),!Oe(e)){this.mapBrowserEventHandler_=new df(this,this.moveTolerance_);for(const s in ot)this.mapBrowserEventHandler_.addEventListener(ot[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(G.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(G.WHEEL,this.boundHandleBrowserEvent_,da?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const s=e.getRootNode();i=s instanceof ShadowRoot?s.host:e}if(this.targetChangeHandlerKeys_=[K(i,G.KEYDOWN,this.handleBrowserEvent,this),K(i,G.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(et(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(et(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=K(t,bi.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=K(t,G.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(et),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ue("addlayer",t)),this.layerGroupPropertyListenerKeys_=[K(t,bi.PROPERTYCHANGE,this.render,this),K(t,G.CHANGE,this.render,this),K(t,"addlayer",this.handleLayerAdd_,this),K(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){lh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&nl(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Qn(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:q(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Qn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!Ii(this.previousExtent_)&&!Si(r.extent,this.previousExtent_))&&(this.dispatchEvent(new ji(Se.MOVESTART,this,s)),this.previousExtent_=nn(this.previousExtent_)),this.previousExtent_&&!r.viewHints[ft.ANIMATING]&&!r.viewHints[ft.INTERACTING]&&!Si(r.extent,this.previousExtent_)&&(this.dispatchEvent(new ji(Se.MOVEEND,this,r)),$o(r.extent,this.previousExtent_))),this.dispatchEvent(new ji(Se.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Se.LOADSTART)||this.hasListener(Se.LOADEND)||this.hasListener(zt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ue("removelayer",e)),this.set(pt.LAYERGROUP,t)}setSize(t){this.set(pt.SIZE,t)}setTarget(t){this.set(pt.TARGET,t)}setView(t){if(!t||t instanceof ce){this.set(pt.VIEW,t);return}this.set(pt.VIEW,new ce);const e=this;t.then(function(i){e.setView(new ce(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(Oe(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!nl(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ma("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!Ae(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Vf(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Vi({layers:n.layers});e[pt.LAYERGROUP]=i,e[pt.TARGET]=n.target,e[pt.VIEW]=n.view instanceof ce?n.view:new ce;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new jt(n.controls.slice()):($(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new jt(n.interactions.slice()):($(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new jt(n.overlays.slice()):($(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new jt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class So extends gn{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(G.CHANGE)}release(){this.setState(O.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==O.EMPTY){if(this.state!==O.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 s=e-i+1e3/60;return s>=this.transition_?1:Fl(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}function Io(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const Uf=new Error("disposed"),Kf=[256,256];class ch extends So{constructor(t){const e=O.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Io(this.data_);return t?[t.width,t.height]:Kf}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==O.IDLE&&this.state!==O.ERROR)return;this.state=O.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=O.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=O.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Uf),this.controller_=null),super.disposeInternal()}}class uh extends So{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,Gt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=O.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=O.ERROR,this.unlistenImage_(),this.image_=Zf(),this.changed()}handleImageLoad_(){if(Gt)this.state=O.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=O.LOADED:this.state=O.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==O.ERROR&&(this.state=O.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==O.IDLE&&(this.state=O.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Yc(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function Zf(){const n=ct(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class To{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.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 Ki(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new To(n,t,e,i)}let Lo;const Zi=[];function dh(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ao(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Hf(){if(Lo===void 0){const n=ct(6,6,Zi);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",dh(n,4,5,4,0),dh(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Lo=Ao(t,0)||Ao(t,4)||Ao(t,8),ss(n),Zi.push(n.canvas)}return Lo}function Ws(n,t,e,i){const s=Er(e,t,n);let r=Ma(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||$e(l,s)){const h=Ma(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function qf(n,t,e,i){const s=Ht(e);let r=Ws(n,t,s,i);return(!isFinite(r)||r<=0)&&ta(e,function(o){return r=Ws(n,t,o,i),isFinite(r)&&r>0}),r}function fh(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ct(Math.round(e*n),Math.round(e*t),Zi);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=St();l.forEach(function(x,S,C){Jo(_,x.extent)});let p;const y=e/i,w=(u?1:1+Math.pow(2,-24))/y;if(!d||l.length!==1||h!==0){if(p=ct(Math.round(U(_)*y),Math.round(lt(_)*y),Zi),u||(p.imageSmoothingEnabled=!1),s&&f){const x=(s[0]-_[0])*y,S=-(s[3]-_[3])*y,C=U(s)*y,v=lt(s)*y;p.rect(x,S,C,v),p.clip()}l.forEach(function(x,S,C){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){p.save();const D=(x.clipExtent[0]-_[0])*y,M=-(x.clipExtent[3]-_[3])*y,P=U(x.clipExtent)*y,B=lt(x.clipExtent)*y;p.rect(u?D:Math.round(D),u?M:Math.round(M),u?P:Math.round(D+P)-Math.round(D),u?B:Math.round(M+B)-Math.round(M)),p.clip()}const v=(x.extent[0]-_[0])*y,I=-(x.extent[3]-_[3])*y,L=U(x.extent)*y,F=lt(x.extent)*y;p.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?v:Math.round(v),u?I:Math.round(I),u?L:Math.round(v+L)-Math.round(v),u?F:Math.round(I+F)-Math.round(I)),x.clipExtent&&p.restore()}})}const E=Je(o);return a.getTriangles().forEach(function(x,S,C){const v=x.source,I=x.target;let L=v[0][0],F=v[0][1],D=v[1][0],M=v[1][1],P=v[2][0],B=v[2][1];const N=m((I[0][0]-E[0])/r),Y=m(-(I[0][1]-E[1])/r),k=m((I[1][0]-E[0])/r),V=m(-(I[1][1]-E[1])/r),H=m((I[2][0]-E[0])/r),tt=m(-(I[2][1]-E[1])/r),T=L,Et=F;L=0,F=0,D-=T,M-=Et,P-=T,B-=Et;const vt=[[D,M,0,0,k-N],[P,B,0,0,H-N],[0,0,D,M,V-Y],[0,0,P,B,tt-Y]],ht=Hh(vt);if(!ht)return;if(g.save(),g.beginPath(),Hf()||!u){g.moveTo(k,V);const xt=4,de=N-k,ee=Y-V;for(let Nt=0;Nt<xt;Nt++)g.lineTo(k+m((Nt+1)*de/xt),V+m(Nt*ee/(xt-1))),Nt!=xt-1&&g.lineTo(k+m((Nt+1)*de/xt),V+m((Nt+1)*ee/(xt-1)));g.lineTo(H,tt)}else g.moveTo(k,V),g.lineTo(N,Y),g.lineTo(H,tt);g.clip(),g.transform(ht[0],ht[2],ht[1],ht[3],N,Y),g.translate(_[0]-T,_[3]-Et);let kt;if(p)kt=p.canvas,g.scale(w,-w);else{const xt=l[0],de=xt.extent;kt=xt.image,g.scale(U(de)/kt.width,-lt(de)/kt.height)}g.drawImage(kt,0,0),g.restore()}),p&&(ss(p),Zi.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(x,S,C){const v=x.target,I=(v[0][0]-E[0])/r,L=-(v[0][1]-E[1])/r,F=(v[1][0]-E[0])/r,D=-(v[1][1]-E[1])/r,M=(v[2][0]-E[0])/r,P=-(v[2][1]-E[1])/r;g.beginPath(),g.moveTo(F,D),g.lineTo(I,L),g.lineTo(M,P),g.closePath(),g.stroke()}),g.restore()),g.canvas}const $f=10,gh=.25;class _h{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?Pc(w=>ut(a,Er(w,this.targetProj_,this.sourceProj_))):hn(this.targetProj_,this.sourceProj_);this.transformInv_=function(w){const E=w[0]+"/"+w[1];return l[E]||(l[E]=h(w)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&U(s)>=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 c=Je(i),u=ts(i),d=Jn(i),f=$n(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),y=$f+(o?Math.max(0,Math.ceil(Math.log2(nr(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,y),this.wrapsXInSource_){let w=1/0;this.triangles_.forEach(function(E,x,S){w=Math.min(w,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-w>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-w>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-w>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-w>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=qo([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=qo([t,e,i,s]);g=U(_)/this.targetWorldWidth_>gh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>gh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!wt(c,this.maxSourceExtent_))return;let m=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(m=(!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),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(ti(r[0],d)+ti(a[0],d))/2-ti(p[0],d):y=(r[0]+a[0])/2-p[0];const w=(r[1]+a[1])/2-p[1];g=y*y+w*w>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],w=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,w,h-1),this.addQuad_(y,_,i,s,w,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],w=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,w,l,h-1),this.addQuad_(_,e,i,y,p,o,a,w,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=St();return this.triangles_.forEach(function(e,i,s){const r=e.source;sn(t,r[0]),sn(t,r[1]),sn(t,r[2])}),t}getTriangles(){return this.triangles_}}const mh=.5;class ph extends So{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,O.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?me(f,g):f;if(nr(_)===0){this.state=O.EMPTY;return}const p=t.getExtent();p&&(m?m=me(m,p):m=p);const y=s.getResolution(this.wrappedTileCoord_[0]),w=qf(t,i,_,y);if(!isFinite(w)||w<=0){this.state=O.EMPTY;return}const E=c!==void 0?c:mh;if(this.triangulation_=new _h(t,i,_,m,w*E,y),this.triangulation_.getTriangles().length===0){this.state=O.EMPTY;return}this.sourceZ_=e.getZForResolution(w);let x=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(x[1]=nt(x[1],m[1],m[3]),x[3]=nt(x[3],m[1],m[3])):x=me(x,m)),!nr(x))this.state=O.EMPTY;else{let S=0,C=0;t.canWrapX()&&(S=U(p),C=Math.floor((x[0]-p[0])/S)),na(x.slice(),t,!0).forEach(I=>{const L=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let F=L.minX;F<=L.maxX;F++)for(let D=L.minY;D<=L.maxY;D++){const M=h(this.sourceZ_,F,D,a);if(M){const P=C*S;this.sourceTiles_.push({tile:M,offset:P})}}++C}),this.sourceTiles_.length===0&&(this.state=O.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==O.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:s,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=O.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=fh(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=O.LOADED}this.changed()}load(){if(this.state==O.IDLE){this.state=O.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==O.IDLE||i==O.LOADING){t++;const s=K(e,G.CHANGE,r=>{const o=e.getState();(o==O.LOADED||o==O.ERROR||o==O.EMPTY)&&(et(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==O.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(et),this.sourcesListenerKeys_=null}release(){this.canvas_&&(ss(this.canvas_.getContext("2d")),Zi.push(this.canvas_),this.canvas_=null),super.release()}}class yh{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof us&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}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 $(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),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 $(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),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){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){$(!(t in this.entries_),"Tried to set a value for a key that is used already");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}}function js(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Jf(n,t,e){return n+"/"+t+"/"+e}function Bs(n,t,e,i,s){return`${q(n)},${t},${Jf(e,i,s)}`}function Eh(n){return Qf(n[0],n[1],n[2])}function Qf(n,t,e){return(t<<n)+e}function tg(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}function Mo(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function eg(n,t,e){const i=n[e];return i?i.delete(t):!1}function xh(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=me(t,se(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=me(t,s))}return t}class ig extends jr{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=St(),this.tempTileRange_=new To(0,0,0,0),this.tempTileCoord_=js(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new yh(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new yh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=Bs(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,s.pixelRatio,c,!u||ri(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ut(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$e(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==O.LOADED)continue;const f=l.getOrigin(c),g=Tt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof uh||d instanceof ph)_=d.getImage();else if(d instanceof ch){if(_=Io(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),w=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+w,y+w)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=q(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?ea(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=h.getResolution(_);for(let w=p.minX;w<=p.maxX;++w)for(let E=p.minY;E<=p.maxY;++E){if(g&&!h.tileCoordIntersectsViewport([_,w,E],m))continue;const x=this.getTile(_,w,E,t);if(!x||!Mo(s,x,_))continue;const C=x.getKey();if(u[C]=!0,x.getState()===O.IDLE&&!t.tileQueue.isKeyQueued(C)){const v=js(_,w,E,this.tempTileCoord_);t.tileQueue.enqueue([x,c,h.getTileCoordCenter(v),y])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=Bs(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===O.LOADED)return c.endTransition(q(this)),Mo(e,c,s),!0}}return!1}findAltTiles_(t,e,i,s){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let u=r.minY;u<=r.maxY;++u){const d=Bs(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===O.LOADED&&(Mo(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,w=i.extent&&se(i.extent);w&&(m=me(m,se(i.extent)));const E=f*p/2/_,x=f*y/2/_,S=[a[0]-E,a[1]-x,a[0]+E,a[1]+x],C={};this.renderedTiles.length=0;const v=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const k=u.getZForResolution(s.nextResolution,c.zDirection),V=xh(t,t.nextExtent);this.enqueueTiles(t,V,k,C,v)}const I=xh(t,m);if(this.enqueueTiles(t,I,d,C,0),v>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,C,v-1)},0),!(d in C))return this.container;const L=q(this),F=t.time;for(const k of C[d]){const V=k.getState();if(V===O.EMPTY)continue;const H=k.tileCoord;if(V===O.LOADED&&k.getAlpha(L,F)===1){k.endTransition(L);continue}if(V!==O.ERROR&&(this.renderComplete=!1),this.findStaleTile_(H,C)){eg(C,k,d),t.animate=!0;continue}if(this.findAltTiles_(u,H,d+1,C))continue;const Et=u.getMinZoom();for(let vt=d-1;vt>=Et&&!this.findAltTiles_(u,H,vt,C);--vt);}const D=f/o*l/_,M=this.getRenderContext(t);ae(this.tempTransform,p/2,y/2,D,D,0,-p/2,-y/2),i.extent&&this.clipUnrotated(M,t,w),c.getInterpolate()||(M.imageSmoothingEnabled=!1),this.preRender(M,t);const P=Object.keys(C).map(Number);P.sort(_e);let B;const N=[],Y=[];for(let k=P.length-1;k>=0;--k){const V=P[k],H=c.getTilePixelSize(V,l,r),T=u.getResolution(V)/f,Et=H[0]*T*D,vt=H[1]*T*D,ht=u.getTileCoordForCoordAndZ(Je(S),V),kt=u.getTileCoordExtent(ht),xt=ut(this.tempTransform,[_*(kt[0]-S[0])/f,_*(S[3]-kt[3])/f]),de=_*c.getGutterForProjection(r);for(const ee of C[V]){if(ee.getState()!==O.LOADED)continue;const Nt=ee.tileCoord,Hs=ht[1]-Nt[1],Bo=Math.round(xt[0]-(Hs-1)*Et),Vn=ht[2]-Nt[2],xi=Math.round(xt[1]-(Vn-1)*vt),Vt=Math.round(xt[0]-Hs*Et),fe=Math.round(xt[1]-Vn*vt),Ji=Bo-Vt,Qi=xi-fe,Un=P.length===1;let wi=!1;B=[Vt,fe,Vt+Ji,fe,Vt+Ji,fe+Qi,Vt,fe+Qi];for(let tn=0,en=N.length;tn<en;++tn)if(!Un&&V<Y[tn]){const _t=N[tn];wt([Vt,fe,Vt+Ji,fe+Qi],[_t[0],_t[3],_t[4],_t[7]])&&(wi||(M.save(),wi=!0),M.beginPath(),M.moveTo(B[0],B[1]),M.lineTo(B[2],B[3]),M.lineTo(B[4],B[5]),M.lineTo(B[6],B[7]),M.moveTo(_t[6],_t[7]),M.lineTo(_t[4],_t[5]),M.lineTo(_t[2],_t[3]),M.lineTo(_t[0],_t[1]),M.clip())}N.push(B),Y.push(V),this.drawTile(ee,t,Vt,fe,Ji,Qi,de,Un),wi&&M.restore(),this.renderedTiles.unshift(ee),this.updateUsedTiles(t.usedTiles,c,ee)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Si(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&M.restore(),M.imageSmoothingEnabled=!0,this.renderComplete){const k=(V,H)=>{const tt=q(c),T=H.wantedTiles[tt],Et=T?Object.keys(T).length:0;this.updateCacheSize(Et),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(k)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let h;if(t instanceof ch){if(h=Io(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=q(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=q(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Vs={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class ng extends Xn{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Vs.PRELOAD)}setPreload(t){this.set(Vs.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Vs.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Vs.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class Ke extends ng{constructor(t){super(t)}createRenderer(){return new ig(this,{cacheSize:this.getCacheSize()})}}const Hi=[0,0,0],Ze=5;class wh{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,$(Wh(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,$(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Je(i)),$(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,$(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:co,$(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new To(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=Ki(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){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return Ki(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return Ki(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return Ki(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Ki(h,u,c,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Hi);const s=Hi[1],r=Hi[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Hi);const o=Hi[1],a=Hi[2];return Ki(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Tt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=Tt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*s,a=i[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return Me(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=Tt(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return s?(c=be(c,Ze)-1,u=be(u,Ze)-1):(c=es(c,Ze),u=es(u,Ze)),js(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=Tt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=be(h,Ze)-1,c=be(c,Ze)-1):(h=es(h,Ze),c=es(c,Ze)),js(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=qn(this.resolutions_,t,e||0);return nt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Wl(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function Ch(n){let t=n.getDefaultTileGrid();return t||(t=ag(n),n.setDefaultTileGrid(t)),t}function sg(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=Po(e);if(!$e(r,s)){const o=U(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function rg(n,t,e,i){i=i!==void 0?i:"top-left";const s=vh(n,t,e);return new wh({extent:n,origin:Bh(n,i),resolutions:s,tileSize:e})}function og(n){const t=n||{},e=t.extent||st("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:vh(e,t.maxZoom,t.tileSize,t.maxResolution)};return new wh(i)}function vh(n,t,e,i){t=t!==void 0?t:tf,e=Tt(e!==void 0?e:co);const s=lt(n),r=U(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function ag(n,t,e,i){const s=Po(n);return rg(s,t,e,i)}function Po(n){n=st(n);let t=n.getExtent();if(!t){const e=180*ar.degrees/n.getMetersPerUnit();t=Me(-e,-e,e,e)}return t}function Rh(n,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const i=e.join("&");return n=n.replace(/[?&]$/,""),n+=n.includes("?")?"&":"?",n+i}const lg=/\{z\}/g,hg=/\{x\}/g,cg=/\{y\}/g,ug=/\{-y\}/g;function dg(n,t,e,i,s){return n.replace(lg,t.toString()).replace(hg,e.toString()).replace(cg,i.toString()).replace(ug,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function fg(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function gg(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return dg(n,o,e[1],e[2],r)})}function _g(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=gg(n[s],t);return mg(i)}function mg(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=Eh(t),r=ti(s,n.length);return n[r](t,e,i)})}class pg extends po{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Tt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||q(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r,o){return X()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Ch(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Tt(s.getTileSize(t),this.tmpSize);return r==1?o:Su(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=sg(s,t,i)),tg(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class yg extends re{constructor(t,e){super(t),this.tile=e}}const bo={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Oo extends pg{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Oo.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=q(e),s=e.getState();let r;s==O.LOADING?(this.tileLoadingKeys_[i]=!0,r=bo.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==O.ERROR?bo.TILELOADERROR:s==O.LOADED?bo.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new yg(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=fg(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
7
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(_g(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Sh extends Oo{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Eg,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:uh,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!ri(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||ri(e,t)))return this.tileGrid;const i=q(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Ch(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?O.IDLE:O.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(G.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||ri(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new ph(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,m,_,p)=>this.getTileInternal(g,m,_,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=Bs(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,i,s,r,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=st(t);if(i){const s=q(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function Eg(n,t){if(Gt){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include"),fetch(t,{mode:i,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{const o=n.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),r.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class Ei extends Sh{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:og({extent:Po(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}var j={};j.create=function(n,t){t=t||{};var e;if(n==="TEXT")e=document.createTextNode(t.html||""),t.parent&&t.parent.appendChild(e);else{e=document.createElement(n),/button/i.test(n)&&e.setAttribute("type","button");for(var i in t)switch(i){case"className":{t.className&&t.className.trim&&e.setAttribute("class",t.className.trim());break}case"text":{e.innerText=t.text;break}case"html":{t.html instanceof Element?e.appendChild(t.html):t.html!==void 0&&(e.innerHTML=t.html);break}case"parent":{t.parent&&t.parent.appendChild(e);break}case"options":{if(/select/i.test(n))for(var s in t.options)j.create("OPTION",{html:s,value:t.options[s],parent:e});break}case"style":{j.setStyle(e,t.style);break}case"change":case"click":{j.addListener(e,i,t[i]);break}case"on":{for(var r in t.on)j.addListener(e,r,t.on[r]);break}case"checked":{e.checked=!!t.checked;break}default:{e.setAttribute(i,t[i]);break}}}return e},j.createSwitch=function(n){var t=j.create("INPUT",{type:"checkbox",on:n.on,click:n.click,change:n.change,parent:n.parent});return Object.assign({input:t},n||{}),t},j.createCheck=function(n){var t=j.create("INPUT",{name:n.name,type:n.type==="radio"?"radio":"checkbox",on:n.on,parent:n.parent});return Object.assign({input:t},n||{}),n.type,t},j.setHTML=function(n,t){t instanceof Element?n.appendChild(t):t!==void 0&&(n.innerHTML=t)},j.appendText=function(n,t){n.appendChild(document.createTextNode(t||""))},j.addListener=function(n,t,e,i){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(s){n.addEventListener(s,e,i)})},j.removeListener=function(n,t,e){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(i){n.removeEventListener(i,e)})},j.show=function(n){n.style.display=""},j.hide=function(n){n.style.display="none"},j.hidden=function(n){return j.getStyle(n,"display")==="none"},j.toggle=function(n){n.style.display=n.style.display==="none"?"":"none"},j.setStyle=function(n,t){for(var e in t)switch(e){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":{typeof t[e]=="number"?n.style[e]=t[e]+"px":n.style[e]=t[e];break}default:n.style[e]=t[e]}},j.getStyle=function(n,t){var e,i=(n.ownerDocument||document).defaultView;if(i&&i.getComputedStyle)t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),e=i.getComputedStyle(n,null).getPropertyValue(t);else if(n.currentStyle&&(t=t.replace(/-(\w)/g,function(s,r){return r.toUpperCase()}),e=n.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(e)))return(function(s){var r=n.style.left,o=n.runtimeStyle.left;return n.runtimeStyle.left=n.currentStyle.left,n.style.left=s||0,s=n.style.pixelLeft+"px",n.style.left=r,n.runtimeStyle.left=o,s})(e);return/px$/.test(e)?parseInt(e):e},j.outerHeight=function(n){return n.offsetHeight+j.getStyle(n,"marginBottom")},j.outerWidth=function(n){return n.offsetWidth+j.getStyle(n,"marginLeft")},j.offsetRect=function(n){var t=n.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}},j.getFixedOffset=function(n){var t={left:0,top:0},e=function(i){if(!i)return t;if(j.getStyle(i,"position")==="absolute"&&j.getStyle(i,"transform")!=="none"){var s=i.getBoundingClientRect();return t.left+=s.left,t.top+=s.top,t}return e(i.offsetParent)};return e(n.offsetParent)},j.positionRect=function(n,t){var e=0,i=0,s=function(r){if(r)return e+=r.offsetLeft,i+=r.offsetTop,s(r.offsetParent);var o={top:n.offsetTop+i,left:n.offsetLeft+e};return t&&(o.top-=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,o.left-=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),o.bottom=o.top+n.offsetHeight,o.right=o.top+n.offsetWidth,o};return s(n.offsetParent)},j.scrollDiv=function(n,t){t=t||{};var e=!1,i=0,s,r=0,o=typeof t.onmove=="function"?t.onmove:function(){},a=t.vertical?"screenY":"screenX",l=t.vertical?"scrollTop":"scrollLeft",h=!1,c,u,d=0,f=function(){w&&(d++,setTimeout(g))},g=function(){if(w){if(d--,d)return;var C=n.clientHeight,v=n.scrollHeight;c=C/v,w.style.height=c*100+"%",w.style.top=n.scrollTop/v*100+"%",y.style.height=C+"px",C>v-.5?y.classList.add("ol-100pc"):y.classList.remove("ol-100pc")}},m=function(C){C.target.classList.contains("ol-noscroll")||(h=!1,e=C[a],r=new Date,n.classList.add("ol-move"),C.preventDefault(),window.addEventListener("pointermove",_),j.addListener(window,["pointerup","pointercancel"],x))},_=function(C){if(e!==!1){var v=(u?-1/c:1)*(e-C[a]);h=h||Math.round(v),n[l]+=v,s=new Date,s-r&&(i=(i+v/(s-r))/2),e=C[a],r=s,v&&o(!0)}else h=!0},p=function(C){var v=C>0?Math.min(100,C/2):Math.max(-100,C/2);C-=v,n[l]+=v,-1<C&&C<1?(h?setTimeout(function(){n.classList.remove("ol-move")}):n.classList.remove("ol-move"),h=!1,o(!1)):setTimeout(function(){p(C)},40)},y,w;if(t.vertical&&t.minibar){var E=function(C){n.removeEventListener("pointermove",E),n.parentNode.classList.add("ol-miniscroll"),w=j.create("DIV"),y=j.create("DIV",{className:"ol-scroll",html:w}),n.parentNode.insertBefore(y,n),w.addEventListener("pointerdown",function(v){u=!0,m(v)}),t.mousewheel&&(j.addListener(y,["mousewheel","DOMMouseScroll","onmousewheel"],function(v){S(v)}),j.addListener(w,["mousewheel","DOMMouseScroll","onmousewheel"],function(v){S(v)})),n.parentNode.addEventListener("pointerenter",f),window.addEventListener("resize",f),C!==!1&&f()};n.parentNode?E(!1):n.addEventListener("pointermove",E),n.addEventListener("scroll",function(){f()})}n.style["touch-action"]="none",n.style.overflow="hidden",n.classList.add("ol-scrolldiv"),j.addListener(n,["pointerdown"],function(C){u=!1,m(C)}),n.addEventListener("click",function(C){n.classList.contains("ol-move")&&(C.preventDefault(),C.stopPropagation())},!0);var x=function(C){r=new Date-r,r>100||u?i=0:r>0&&(i=((i||0)+(e-C[a])/r)/2),p(t.animate===!1?0:i*200),e=!1,i=0,r=0,n.classList.contains("ol-move")?n.classList.remove("ol-hasClick"):(n.classList.add("ol-hasClick"),setTimeout(function(){n.classList.remove("ol-hasClick")},500)),u=!1,window.removeEventListener("pointermove",_),j.removeListener(window,["pointerup","pointercancel"],x)},S=function(C){var v=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));return n.classList.add("ol-move"),n[l]-=v*30,n.classList.remove("ol-move"),!1};return t.mousewheel&&j.addListener(n,["mousewheel","DOMMouseScroll","onmousewheel"],S),{refresh:f}},j.dispatchEvent=function(n,t){var e;try{e=new CustomEvent(n)}catch{e=document.createEvent("CustomEvent"),e.initCustomEvent(n,!0,!0,{})}t.dispatchEvent(e)};const yt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Do extends Wt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+Kc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(yt.ELEMENT,this.handleElementChanged),this.addChangeListener(yt.MAP,this.handleMapChanged),this.addChangeListener(yt.OFFSET,this.handleOffsetChanged),this.addChangeListener(yt.POSITION,this.handlePositionChanged),this.addChangeListener(yt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(yt.ELEMENT)}getId(){return this.id}getMap(){return this.get(yt.MAP)||null}getOffset(){return this.get(yt.OFFSET)}getPosition(){return this.get(yt.POSITION)}getPositioning(){return this.get(yt.POSITIONING)}handleElementChanged(){ga(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),et(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=K(t,Se.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(yt.ELEMENT,t)}setMap(t){this.set(yt.MAP,t)}setOffset(t){this.set(yt.OFFSET,t)}setPosition(t){this.set(yt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(yt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[tc(s),ec(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ne(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(yt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}var rt={};rt.getTransform=function(n){var t=window.getComputedStyle(n,null),e=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("-moz-transform")||t.getPropertyValue("-ms-transform")||t.getPropertyValue("-o-transform")||t.getPropertyValue("transform"),i=e.split("(")[1].split(")")[0].split(","),s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r,o;if(i.length===16)for(r=0;r<4;++r)for(o=0;o<4;++o)s[o][r]=+i[r*4+o];else for(r=0;r<3;++r)for(o=0;o<2;++o)s[o][r]=+i[r*2+o];return s},rt.getTransformOrigin=function(n){for(var t=window.getComputedStyle(n,null),e=t.getPropertyValue("-webkit-transform-origin")||t.getPropertyValue("-moz-transform-origin")||t.getPropertyValue("-ms-transform-origin")||t.getPropertyValue("-o-transform-origin")||t.getPropertyValue("transform-origin"),i=e.split(" "),s=[0,0,0,1],r=0;r<i.length;++r)s[r]=parseInt(i[r]);return s},rt.translateMatrix=function(n,t,e){return[[1,0,0,n],[0,1,0,t],[0,0,1,e],[0,0,0,1]]},rt.identity=function(){return[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]},rt.roundTo=function(n,t){t||(t=1e-10);for(var e=[[],[],[],[]],i=0;i<4;i++)for(var s=0;s<4;s++)e[i][s]=Math.round(n[i][s]/t)*t;return e},rt.multiply=function(n,t){for(var e=[[],[],[],[]],i=0;i<4;++i)for(var s=0;s<4;++s){for(var r=0,o=0;o<4;++o)r+=n[o][i]*t[s][o];e[s][i]=r}return e},rt.computeTransformMatrix=function(n,t){var e=rt.translateMatrix(-t[0],-t[1],-t[2]),i=rt.translateMatrix(t[0],t[1],t[2]),s=rt.multiply(e,n);return rt.multiply(s,i)},rt.transformVertex=function(n,t){for(var e=[t[0],t[1],0,1],i=[],s=0;s<4;++s){i[s]=0;for(var r=0;r<4;++r)i[s]+=+n[s][r]*e[r]}return i},rt.projectVertex=function(n){for(var t=[],e=0;e<4;++e)t[e]=n[e]/n[3];return t},rt.inverse=function(n){var t=n[0][0]*n[1][1]-n[1][0]*n[0][1],e=n[0][0]*n[1][2]-n[1][0]*n[0][2],i=n[0][0]*n[1][3]-n[1][0]*n[0][3],s=n[0][1]*n[1][2]-n[1][1]*n[0][2],r=n[0][1]*n[1][3]-n[1][1]*n[0][3],o=n[0][2]*n[1][3]-n[1][2]*n[0][3],a=n[2][2]*n[3][3]-n[3][2]*n[2][3],l=n[2][1]*n[3][3]-n[3][1]*n[2][3],h=n[2][1]*n[3][2]-n[3][1]*n[2][2],c=n[2][0]*n[3][3]-n[3][0]*n[2][3],u=n[2][0]*n[3][2]-n[3][0]*n[2][2],d=n[2][0]*n[3][1]-n[3][0]*n[2][1],f=1/(t*a-e*l+i*h+s*c-r*u+o*d);if(isNaN(f)||f===1/0)throw new Error("Inverse determinant attempted to divide by zero.");return[[(n[1][1]*a-n[1][2]*l+n[1][3]*h)*f,(-n[0][1]*a+n[0][2]*l-n[0][3]*h)*f,(n[3][1]*o-n[3][2]*r+n[3][3]*s)*f,(-n[2][1]*o+n[2][2]*r-n[2][3]*s)*f],[(-n[1][0]*a+n[1][2]*c-n[1][3]*u)*f,(n[0][0]*a-n[0][2]*c+n[0][3]*u)*f,(-n[3][0]*o+n[3][2]*i-n[3][3]*e)*f,(n[2][0]*o-n[2][2]*i+n[2][3]*e)*f],[(n[1][0]*l-n[1][1]*c+n[1][3]*d)*f,(-n[0][0]*l+n[0][1]*c-n[0][3]*d)*f,(n[3][0]*r-n[3][1]*i+n[3][3]*t)*f,(-n[2][0]*r+n[2][1]*i-n[2][3]*t)*f],[(-n[1][0]*h+n[1][1]*u-n[1][2]*d)*f,(n[0][0]*h-n[0][1]*u+n[0][2]*d)*f,(-n[3][0]*s+n[3][1]*e-n[3][2]*t)*f,(n[2][0]*s-n[2][1]*e+n[2][2]*t)*f]]};var xg=class extends Ui{constructor(t){var e=t.target instanceof Element?t.target:document.getElementById(t.target);window.getComputedStyle(e).position!=="absolute"&&(e.style.position="relative"),e.style.overflow="hidden";var i=j.create("DIV",{className:"ol-perspective-map",parent:e}),s={};Object.assign(s,t),s.target=i,super(s),this._tiltCondition=t.tiltCondition||Cf}getPixelRatio(){return window.devicePixelRatio}setPerspective(t,e){e=e||{},t>30?t=30:t<0&&(t=0);var i=this._angle||0,s=Math.round(t*10)/10,r=this.getTarget().querySelector(".ol-layers").style;cancelAnimationFrame(this._animatedPerspective),requestAnimationFrame((function(o){this._animatePerpective(o,o,r,i,s,e.duration,e.easing||$r)}).bind(this))}_animatePerpective(t,e,i,s,r,o,a){var l,h;o===0?(l=1,h=!0):(l=(e-t)/(o||500),h=l>=1),l=a(l);var c;h?c=this._angle=r:c=this._angle=s+(r-s)*l;var u=c/30;i.transform="translateY(-"+17*u+"%) perspective(200px) rotateX("+c+"deg) scaleY("+(1-u/2)+")",this.getMatrix3D(!0),this.render(),h||requestAnimationFrame((function(d){this._animatePerpective(t,d,i,s,r,o||500,a||$r)}).bind(this)),this.dispatchEvent({type:"change:perspective",angle:c,animating:!h})}handleMapBrowserEvent(t){if(t.pixel=[t.originalEvent.offsetX/this.getPixelRatio(),t.originalEvent.offsetY/this.getPixelRatio()],t.coordinate=this.getCoordinateFromPixel(t.pixel),Ui.prototype.handleMapBrowserEvent.call(this,t),this._tiltCondition(t))switch(t.type){case"pointerdown":{this._dragging=t.originalEvent.offsetY;break}case"pointerup":{this._dragging=!1;break}case"pointerdrag":{if(this._dragging!==!1){var e=t.originalEvent.offsetY>this._dragging?.5:-.5;e&&this.setPerspective((this._angle||0)+e,{duration:0}),this._dragging=t.originalEvent.offsetY}break}}else this._dragging=!1}getMatrix3D(t){if(t){var e=this.getTarget().querySelector(".ol-layers"),i=rt.getTransform(e),s=rt.getTransformOrigin(e);this._matrixTransform=rt.computeTransformMatrix(i,s)}return this._matrixTransform||(this._matrixTransform=rt.identity()),this._matrixTransform}getPixelScreenFromCoordinate(t){var e=this.getPixelFromCoordinate(t),i=this.getMatrix3D(),s=rt.transformVertex(i,e);return s=rt.projectVertex(s),[s[0],s[1]]}getPixelFromPixelScreen(t){var e=rt.inverse(this.getMatrix3D()),i=rt.transformVertex(e,t);return i=rt.projectVertex(i),[i[0],i[1]]}};(function(){var n=Do.prototype.updatePixelPosition;Do.prototype.updatePixelPosition=function(){var t=this.getMap();if(t&&t instanceof xg){var e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}var i=t.getPixelScreenFromCoordinate(e),s=t.getSize();i[0]-=s[0]/4,i[1]-=s[1]/4,this.updateRenderedPosition(i,s)}else n.call(this)}})();let qi="0711195325a7623fc91fa85aa075b7d4";const wg="/sky/map?token=nszx_sk_img&x={x}&y={y}&l={z}",Cg="/sky/map?token=nszx_sk_label&x={x}&y={y}&l={z}",vg=`https://t0.tianditu.gov.cn/img_w/wmts?tk=${qi}&service=wmts&request=gettile&version=1.0.0&layer=img&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,Rg=`https://t0.tianditu.gov.cn/cia_w/wmts?tk=${qi}&service=wmts&request=gettile&version=1.0.0&layer=cia&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,Sg=`https://t0.tianditu.gov.cn/vec_w/wmts?tk=${qi}&service=wmts&request=gettile&version=1.0.0&layer=vec&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,Ig=`https://t0.tianditu.gov.cn/cva_w/wmts?tk=${qi}&service=wmts&request=gettile&version=1.0.0&layer=cva&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,Tg=(n,t)=>{const e=n.getImage();fetch(t).then(i=>{if(console.log(`天地图请求状态码: ${i.status}`),i.status===429){console.error("⚠️ 天地图请求过多,已达到速率限制!"),qi="9ecb10975f45744bbf807e0ad0644816",Lg(),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";return}if(!i.ok)throw new Error(`HTTP错误,状态码: ${i.status}`);return i.blob().then(s=>{const r=URL.createObjectURL(s);e.src=r})}).catch(i=>{console.error("瓦片加载错误:",i),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"})};function Lg(){const n=t=>`https://t0.tianditu.gov.cn/${t}_w/wmts?tk=${qi}&service=wmts&request=gettile&version=1.0.0&layer=${t}&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`;it.tdt_img.getSource().setUrl(n("img")),it.tdt_cia.getSource().setUrl(n("cia")),it.tdt_vec.getSource().setUrl(n("vec")),it.tdt_cva.getSource().setUrl(n("cva"))}const it={sky_map:new Ke({source:new Ei({url:wg}),visible:!1}),sky_note:new Ke({source:new Ei({url:Cg}),visible:!1,zIndex:2}),tdt_img:new Ke({source:new Ei({url:vg,crossOrigin:"anonymous",tileLoadFunction:Tg})}),tdt_cia:new Ke({source:new Ei({url:Rg}),zIndex:2}),tdt_vec:new Ke({source:new Ei({url:Sg}),visible:!1}),tdt_cva:new Ke({source:new Ei({url:Ig}),visible:!1,zIndex:2})},Ag=()=>window.xmMap;let Us=!1,Fo=!0;const Mg=n=>{console.log(n,"laaa"),n==="tdt_img"?Us||(it.sky_map.setVisible(!0),it.sky_note.setVisible(!0),it.tdt_img.setVisible(!1),it.tdt_cia.setVisible(!1),Us=!0,Fo=!1):Fo||(it.sky_map.setVisible(!1),it.sky_note.setVisible(!1),it.tdt_img.setVisible(!0),it.tdt_cia.setVisible(!0),Fo=!0,Us=!1)},Pg=n=>{n?(it.sky_map.setVisible(!1),it.sky_note.setVisible(!1),it.tdt_img.setVisible(!1),it.tdt_cia.setVisible(!1)):Us?(it.sky_map.setVisible(!0),it.sky_note.setVisible(!0)):(it.tdt_img.setVisible(!0),it.tdt_cia.setVisible(!0))};let bg={layers:[it.sky_map,it.sky_note,it.tdt_img,it.tdt_cia],target:"olMap",view:new ce({projection:"EPSG:4326",center:[102.836837,30.38723],zoom:7}),controls:ih({zoom:!1,rotate:!1,attribution:!1}).extend([])};const Og=()=>{let n=new Ui(bg);return window.xmMap=n,n},jn={},Dg=n=>{const{listenType:t,callback:e,removeListener:i,data:s}=n,r=window.xmMap;if(i){const a=jn[t];a&&(a.forEach(l=>r.un([t],l)),delete jn[t]);return}const o=a=>{e&&e(a,s)};r.on([t],o),jn[t]||(jn[t]=[]),jn[t].push(o)},Fg=()=>{window.xmMap?(Zs(!0),window.xmMap.dispose(),console.warn("地图摧毁完成"),window.xmMap=null,window.xmglobalLayer=null):console.warn("地图实例不存在")};class kg{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Re,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?st(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=st(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return X()}readFeature(t,e){return X()}readFeatures(t,e){return X()}readGeometry(t,e){return X()}readProjection(t){return X()}writeFeature(t,e){return X()}writeFeatures(t,e){return X()}writeGeometry(t,e){return X()}}function ko(n,t,e){const i=e?st(e.featureProjection):null,s=e?st(e.dataProjection):null;let r=n;if(i&&s&&!ri(i,s)){t&&(r=n.clone());const o=t?i:s,a=t?s:i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(hn(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let h=0,c=l.length;h<c;++h)l[h]=Math.round(l[h]*o)/o;return l};r===n&&(r=n.clone()),r.applyTransform(a)}return r}const Ng={Point:he,LineString:Wi,Polygon:We,MultiPoint:Xs,MultiLineString:Gs,MultiPolygon:zs};function Gg(n,t,e){return Array.isArray(t[0])?(Bl(n,0,t,e)||(n=n.slice(),oo(n,0,t,e)),n):(ro(n,0,t,e)||(n=n.slice(),Os(n,0,t,e)),n)}function Ih(n,t){const e=n.geometry;if(!e)return[];if(Array.isArray(e))return e.map(r=>Ih({...n,geometry:r})).flat();const i=e.type==="MultiPolygon"?"Polygon":e.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const s=e.layout.length;return ko(new Ft(i,i==="Polygon"?Gg(e.flatCoordinates,e.ends,s):e.flatCoordinates,e.ends?.flat(),s,n.properties||{},n.id).enableSimplifyTransformed(),!1,t)}function No(n,t){if(!n)return null;if(Array.isArray(n)){const i=n.map(s=>No(s,t));return new Ns(i)}const e=Ng[n.type];return ko(new e(n.flatCoordinates,n.layout||"XY",n.ends),!1,t)}class Xg extends kg{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Ks(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Ks(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return X()}readFeaturesFromObject(t,e){return X()}readGeometry(t,e){return this.readGeometryFromObject(Ks(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return X()}readProjection(t){return this.readProjectionFromObject(Ks(t))}readProjectionFromObject(t){return X()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return X()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return X()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return X()}}function Ks(n){if(typeof n=="string"){const t=JSON.parse(n);return t||null}return n!==null?n:null}class Go extends Xg{constructor(t){t=t||{},super(),this.dataProjection=st(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=st(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;t.type==="Feature"?i=t:i={type:"Feature",geometry:t,properties:null};const s=Xo(i.geometry);if(this.featureClass===Ft)return Ih({geometry:s,id:i.id,properties:i.properties},e);const r=new Re;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(No(s,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){const i=t;let s=null;if(i.type==="FeatureCollection"){const r=t;s=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&s.push(h)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return zg(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if(e.type=="name")i=st(e.properties.name);else if(e.type==="EPSG")i=st("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},s=t.getId();if(s!==void 0&&(i.id=s),!t.hasProperties())return i;const r=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=zo(o,e),delete r[t.getGeometryName()]),ni(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let s=0,r=t.length;s<r;++s)i.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return zo(t,this.adaptOptions(e))}}function Xo(n,t){if(!n)return null;let e;switch(n.type){case"Point":{e=Wg(n);break}case"LineString":{e=jg(n);break}case"Polygon":{e=Kg(n);break}case"MultiPoint":{e=Vg(n);break}case"MultiLineString":{e=Bg(n);break}case"MultiPolygon":{e=Ug(n);break}case"GeometryCollection":{e=Yg(n);break}default:throw new Error("Unsupported GeoJSON type: "+n.type)}return e}function zg(n,t){const e=Xo(n);return No(e,t)}function Yg(n,t){return n.geometries.map(function(i){return Xo(i)})}function Wg(n){const t=n.coordinates;return{type:"Point",flatCoordinates:t,layout:ui(t.length)}}function jg(n){const t=n.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:ui(t[0]?.length||2)}}function Bg(n){const t=n.coordinates,e=t[0]?.[0]?.length||2,i=[],s=kn(i,0,t,e);return{type:"MultiLineString",flatCoordinates:i,ends:s,layout:ui(e)}}function Vg(n){const t=n.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:ui(t[0]?.length||2)}}function Ug(n){const t=n.coordinates,e=[],i=t[0]?.[0]?.[0].length||2,s=Xl(e,0,t,i);return{type:"MultiPolygon",flatCoordinates:e,ends:s,layout:ui(i)}}function Kg(n){const t=n.coordinates,e=[],i=t[0]?.[0]?.length,s=kn(e,0,t,i);return{type:"Polygon",flatCoordinates:e,ends:s,layout:ui(i)}}function zo(n,t){n=ko(n,!0,t);const e=n.getType();let i;switch(e){case"Point":{i=Qg(n);break}case"LineString":{i=Hg(n);break}case"Polygon":{i=t_(n,t);break}case"MultiPoint":{i=$g(n);break}case"MultiLineString":{i=qg(n);break}case"MultiPolygon":{i=Jg(n,t);break}case"GeometryCollection":{i=Zg(n,t);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return i}function Zg(n,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:n.getGeometriesArray().map(function(i){return zo(i,t)})}}function Hg(n,t){return{type:"LineString",coordinates:n.getCoordinates()}}function qg(n,t){return{type:"MultiLineString",coordinates:n.getCoordinates()}}function $g(n,t){return{type:"MultiPoint",coordinates:n.getCoordinates()}}function Jg(n,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:n.getCoordinates(e)}}function Qg(n,t){return{type:"Point",coordinates:n.getCoordinates()}}function t_(n,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:n.getCoordinates(e)}}var e_=class extends Wt{constructor(t){super(t),this._listener=[],t&&t.active===!1?this.set("active",!1):this.set("active",!0)}setActive(t){this.set("active",t===!0)}getActive(){return this.get("active")}};(function(){function n(r){this.get("active")&&r.context&&this.precompose(r)}function t(r){this.get("active")&&r.context&&this.postcompose(r)}function e(){if(this.renderSync)try{this.renderSync()}catch{}else this.changed()}function i(r){this.filters_||(this.filters_=[]),this.filters_.push(r),r.addToLayer&&r.addToLayer(this),r.precompose&&r._listener.push({listener:this.on(["precompose","prerender"],n.bind(r)),target:this}),r.postcompose&&r._listener.push({listener:this.on(["postcompose","postrender"],t.bind(r)),target:this}),r._listener.push({listener:r.on("propertychange",e.bind(this)),target:this}),e.call(this)}function s(r){var o;if(this.filters_||(this.filters_=[]),!r){this.filters_.forEach((function(a){this.removeFilter(a)}).bind(this));return}for(o=this.filters_.length-1;o>=0;o--)this.filters_[o]===r&&this.filters_.splice(o,1);for(o=r._listener.length-1;o>=0;o--)r._listener[o].target===this&&(r.removeFromLayer&&r.removeFromLayer(this),Xa(r._listener[o].listener),r._listener.splice(o,1));e.call(this)}Ui.prototype.addFilter=function(r){console.warn("[OL-EXT] addFilter deprecated on map."),i.call(this,r)},Ui.prototype.removeFilter=function(r){s.call(this,r)},Ui.prototype.getFilters=function(){return this.filters_||[]},Gn.prototype.addFilter=function(r){i.call(this,r)},Gn.prototype.removeFilter=function(r){s.call(this,r)},Gn.prototype.getFilters=function(){return this.filters_||[]}})();var i_=class extends e_{constructor(t){if(t=t||{},super(t),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature;break}this.set("inner",t.inner),this._fillColor=t.fill&&De(t.fill.getColor())||"rgba(0,0,0,0.2)",this._shadowColor=t.shadowColor&&De(t.shadowColor)||"rgba(0,0,0,0.5)",this.set("shadowWidth",t.shadowWidth||0),this.set("shadowMapUnits",t.shadowMapUnits===!0)}setFillColor(t){this._fillColor=t&&De(t)||"rgba(0,0,0,0.2)"}setShadowColor(t){this._shadowColor=t&&De(t)||"rgba(0,0,0,0.5)"}drawFeaturePath_(t,e){var i=t.context,s=i.canvas,r=t.frameState.pixelRatio,o;if(t.frameState.coordinateToPixelTransform){var a=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var l=t.inversePixelTransform;o=function(w){return w=[w[0]*a[0]+w[1]*a[1]+a[4],w[0]*a[2]+w[1]*a[3]+a[5]],[w[0]*l[0]-w[1]*l[1]+l[4],-w[0]*l[2]+w[1]*l[3]+l[5]]}}else o=function(w){return[(w[0]*a[0]+w[1]*a[1]+a[4])*r,(w[0]*a[2]+w[1]*a[3]+a[5])*r]}}else a=t.frameState.coordinateToPixelMatrix,o=function(w){return[(w[0]*a[0]+w[1]*a[1]+a[12])*r,(w[0]*a[4]+w[1]*a[5]+a[13])*r]};var h=this.feature_.getGeometry().getCoordinates();this.feature_.getGeometry().getType()==="Polygon"&&(h=[h]);function c(w){for(var E=0;E<h.length;E++)for(var x=h[E],S=0;S<x.length;S++){var C=o([x[S][0][0]+w,x[S][0][1]]);i.moveTo(C[0],C[1]);for(var v=1;v<x[S].length;v++)C=o([x[S][v][0]+w,x[S][v][1]]),i.lineTo(C[0],C[1])}}if(i.beginPath(),e&&(i.moveTo(-100,-100),i.lineTo(s.width+100,-100),i.lineTo(s.width+100,s.height+100),i.lineTo(-100,s.height+100),i.lineTo(-100,-100)),this.get("wrapX")){var u=t.frameState.viewState.projection.getExtent(),d=u[2]-u[0],f=t.frameState.extent,g=this.feature_.getGeometry().getExtent(),m=g[2]-g[1],_=Math.floor((f[0]-m-u[0])/d),p=Math.floor((f[2]+m-u[2])/d)+1;_>p&&([_,p]=[p,_]);for(var y=_;y<=p;y++)c(y*d)}else c(0)}postcompose(t){if(this.feature_){var e=t.context;if(e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this._fillColor,e.fill("evenodd"),this.get("shadowWidth")){var i=this.get("shadowWidth")*t.frameState.pixelRatio;this.get("shadowMapUnits")&&(i/=t.frameState.viewState.resolution),e.clip("evenodd"),e.filter="blur("+i+"px)",e.strokeStyle=this._shadowColor,e.lineCap="round",e.lineJoin="round",e.lineWidth=i,e.stroke()}e.restore()}}};const n_=n=>{const{layerId:t,data:e,innerStyle:i,zIndex:s=3,maskFillColor:r,shadowColor:o,shadowWidth:a}=n,h=new Go().readFeatures(e),c=new Re(h[0].getGeometry());i?c.setStyle(i):c.setStyle(new Dt({fill:new Lt({color:"rgba(0, 0, 0, 0)"})}));const u=new i_({feature:c,fill:new Lt({color:r||"rgba(67, 100, 116, 0.61)"}),shadowWidth:a||0,shadowMapUnits:!0,shadowColor:o||"rgba(0,0,0,0)",wrapX:!0}),d=new pi({features:[c]}),f=new mi({source:d,zIndex:s,renderBuffer:100});return f.addFilter(u),ue(t,f),window.xmMap.addLayer(f),{layer:f,source:d}};class s_ extends jr{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=me(l,se(e.extent,s.projection))),!a[ft.ANIMATING]&&!a[ft.INTERACTING]&&!Ii(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===A.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ut(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$e(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=lt(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,p=this.context.canvas.height,y=this.getRenderContext(t);let w=!1,E=!0;if(h.extent){const I=se(h.extent,u.projection);E=wt(I,t.extent),w=E&&!ne(I,t.extent),w&&this.clipUnrotated(y,t,I)}const x=i.getImage(),S=ae(this.tempTransform,_/2,p/2,g,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const C=x.width*S[0],v=x.height*S[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),E&&C>=.5&&v>=.5){const I=S[4],L=S[5],F=h.opacity;F!==1&&(y.save(),y.globalAlpha=F),y.drawImage(x,0,0,+x.width,+x.height,I,L,C,v),F!==1&&y.restore()}return this.postRender(this.context,t),w&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class r_ extends Xn{constructor(t){t=t||{},super(t)}}class o_ extends r_{constructor(t){super(t)}createRenderer(){return new s_(this)}getData(t){return super.getData(t)}}class a_ extends Mr{constructor(t,e,i,s,r){const o=r!==void 0?A.IDLE:A.LOADED;super(t,e,i,o),this.loader_=r!==void 0?r:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=A.ERROR):this.state=A.LOADED,this.changed()}load(){this.state==A.IDLE&&(this.state=A.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}function Yo(n){return Array.isArray(n)?Math.min(...n):n}class l_ extends Mr{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?me(i,h):i,u=Ht(c),d=Ws(t,e,u,s),f=mh,g=new _h(t,e,c,l,d*f,s),m=g.calculateSourceExtent(),_=Ii(m)?null:o(m,d,r),p=_?A.IDLE:A.EMPTY,y=_?_.getPixelRatio():1;super(i,s,y,p),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==A.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==A.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=lt(this.targetExtent_)/this.targetResolution_;this.canvas_=fh(e,i,this.sourcePixelRatio_,Yo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==A.IDLE){this.state=A.LOADING,this.changed();const t=this.sourceImage_.getState();t==A.LOADED||t==A.ERROR?this.reproject_():(this.sourceListenerKey_=K(this.sourceImage_,G.CHANGE,e=>{const i=this.sourceImage_.getState();(i==A.LOADED||i==A.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){et(this.sourceListenerKey_),this.sourceListenerKey_=null}}const $i=4,Wo={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class h_ extends re{constructor(t,e){super(t),this.image=e}}class c_ extends po{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=qn(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||ri(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&ri(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Si(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new l_(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=u_(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ne(this.wantedExtent_,r)||ne(this.image.getExtent(),r))&&(this.wantedResolution_&&Yo(this.wantedResolution_)===o||Yo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new Mr(r,o,i,this.loader),this.image.addEventListener(G.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case A.LOADING:this.loading=!0,i=Wo.IMAGELOADSTART;break;case A.LOADED:this.loading=!1,i=Wo.IMAGELOADEND;break;case A.ERROR:this.loading=!1,i=Wo.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new h_(i,e))}}function u_(n,t,e,i){const s=t/e,r=Ht(n),o=be(U(n)/s,$i),a=be(lt(n)/s,$i),l=be((i-1)*o/2,$i),h=o+2*l,c=be((i-1)*a/2,$i),u=a+2*c;return Qn(r,s,0,[h,u])}class d_ extends c_{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=t.ratio!==void 0?t.ratio:1.5}getImageInternal(t,e,i,s){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&ne(r.getExtent(),t))return r;t=t.slice(),Uh(t,this.ratio_);const o=U(t)/e,a=lt(t)/e,l=[o*i,a*i],h=this.canvasFunction_.call(this,t,e,i,l,s);return h&&(r=new a_(t,e,i,h)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}}var f_=class extends o_{constructor(t){t=t||{};var e=document.createElement("canvas");super({source:new d_({canvasFunction:function(i,s,r,o){return e.width=o[0],e.height=o[1],e}}),center:t.center||[.5,1],defaultHeight:t.defaultHeight||0,maxResolution:t.maxResolution||1/0}),this._source=t.source,this.height_=this.getHfn(t.height),this.setStyle(t.style),this.on(["postcompose","postrender"],this.onPostcompose_.bind(this))}setStyle(t){if(t instanceof Dt?this._style=t:this._style=new Dt,this._style.getStroke()||this._style.setStroke(new ze({width:1,color:"red"})),this._style.getFill()||this._style.setFill(new Lt({color:"rgba(0,0,255,0.5)"})),this._style.getText()||this._style.setText(new Lt({color:"red"})),t&&t.getGeometry()){var e=t.getGeometry();typeof e=="function"?this.set("geometry",e):this.set("geometry",function(){return e})}else this.set("geometry",function(i){return i.getGeometry()})}getStyle(){return this._style}onPostcompose_(t){var e=t.frameState.viewState.resolution;if(!(e>this.get("maxResolution"))){if(this.res_=e*400,this.animate_){var i=t.frameState.time-this.animate_;i<this.animateDuration_?(this.elapsedRatio_=this.easing_(i/this.animateDuration_),t.frameState.animate=!0):(this.animate_=!1,this.height_=this.toHeight_)}var s=t.frameState.pixelRatio,r=t.context,o=this.matrix_=t.frameState.coordinateToPixelTransform;o||(o=t.frameState.coordinateToPixelMatrix,o[2]=o[4],o[3]=o[5],o[4]=o[12],o[5]=o[13]),this.center_=[r.canvas.width*this.get("center")[0]/s,r.canvas.height*this.get("center")[1]/s];var a=this._source.getFeaturesInExtent(t.frameState.extent);r.save(),r.scale(s,s);var l=this.getStyle();r.lineWidth=l.getStroke().getWidth(),r.lineCap=l.getStroke().getLineCap(),r.strokeStyle=De(l.getStroke().getColor()),r.fillStyle=De(l.getFill().getColor());for(var h=[],c=0;c<a.length;c++)h.push(this.getFeature3D_(a[c],this._getFeatureHeight(a[c])));this.drawFeature3D_(r,h),r.restore()}}getHfn(t){switch(typeof t){case"function":return t;case"string":{var e=this.get("defaultHeight");return(function(i){return Number(i.get(t))||e})}case"number":return(function(){return t});default:return(function(){return 10})}}animate(t){t=t||{},this.toHeight_=this.getHfn(t.height),this.animate_=new Date().getTime(),this.animateDuration_=t.duration||1e3,this.easing_=t.easing||gi,this.changed()}animating(){return this.animate_&&new Date().getTime()-this.animate_>this.animateDuration_&&(this.animate_=!1),!!this.animate_}_getFeatureHeight(t){if(this.animate_){var e=this.height_(t),i=this.toHeight_(t);return e*(1-this.elapsedRatio_)+this.elapsedRatio_*i}else return this.height_(t)}hvector_(t,e){var i=[t[0]*this.matrix_[0]+t[1]*this.matrix_[1]+this.matrix_[4],t[0]*this.matrix_[2]+t[1]*this.matrix_[3]+this.matrix_[5]];return{p0:i,p1:[i[0]+e/this.res_*(i[0]-this.center_[0]),i[1]+e/this.res_*(i[1]-this.center_[1])]}}getFeature3D_(t,e){var i=this.get("geometry")(t),s=i.getCoordinates();switch(i.getType()){case"Polygon":s=[s];case"MultiPolygon":for(var r=[],o=0;o<s.length;o++)for(var a=0;a<s[o].length;a++){for(var l=[],h=0;h<s[o][a].length;h++)l.push(this.hvector_(s[o][a][h],e));r.push(l)}return{type:"MultiPolygon",feature:t,geom:r};case"Point":return{type:"Point",feature:t,geom:this.hvector_(s,e)};default:return{}}}drawFeature3D_(t,e){var i,s,r,o;for(i=0;i<e.length;i++)switch(e[i].type){case"MultiPolygon":{for(s=0;s<e[i].geom.length;s++)for(r=e[i].geom[s],o=0;o<r.length;o++)t.beginPath(),t.moveTo(r[o].p0[0],r[o].p0[1]),t.lineTo(r[o].p1[0],r[o].p1[1]),t.stroke();break}case"Point":{var a=e[i].geom;t.beginPath(),t.moveTo(a.p0[0],a.p0[1]),t.lineTo(a.p1[0],a.p1[1]),t.stroke();break}}for(i=0;i<e.length;i++)switch(e[i].type){case"MultiPolygon":{for(t.beginPath(),s=0;s<e[i].geom.length;s++){if(r=e[i].geom[s],s==0)for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=1;o<r.length;o++)t.lineTo(r[o].p1[0],r[o].p1[1]);else for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=r.length-2;o>=0;o--)t.lineTo(r[o].p1[0],r[o].p1[1]);t.closePath()}t.fill("evenodd"),t.stroke();break}case"Point":{r=e[i];var l=r.feature.get("label");if(l){var h=r.geom.p1,c=t.measureText(l),u=Number(t.font.match(/\d+(\.\d+)?/g).join([]));t.fillRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.strokeRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.save(),t.fillStyle=De(this._style.getText().getFill().getColor()),t.textAlign="center",t.textBaseline="bottom",t.fillText(l,h[0],h[1]),t.restore()}break}}}};const g_=n=>{const{layerId:t,data:e}=n,s=new Go().readFeatures(e),r=new Re(s[0].getGeometry()),o=new pi({features:[r]}),a=new f_({source:o,style:new Dt({fill:new Lt({color:"rgba(255, 255, 255, 0)"}),stroke:new ze({color:"blue",width:1})}),defaultHeight:-1e-4,maxResolution:10,height:1e-4,center:[102.836837,30.38723]});return window.xmMap.addLayer(a),ue(t,a),a};class __ extends pi{constructor(t){t=t||{},super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=t.distance!==void 0?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(e){const i=e.getGeometry();return $(!i||i.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),i},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(G.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(G.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=t===0?0:Math.min(e,t)/t,s=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,s&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const t=St(),e=this.distance*this.resolution,i=this.source.getFeatures(),s={};for(let r=0,o=i.length;r<o;r++){const a=i[r];if(!(q(a)in s)){const l=this.geometryFunction(a);if(l){const h=l.getCoordinates();er(h,t),Ri(t,e,t);const c=this.source.getFeaturesInExtent(t).filter(function(u){const d=q(u);return d in s?!1:(s[d]=!0,!0)});this.features.push(this.createCluster(c,t))}}}}createCluster(t,e){const i=[0,0];for(let a=t.length-1;a>=0;--a){const l=this.geometryFunction(t[a]);l?aa(i,l.getCoordinates()):t.splice(a,1)}la(i,1/t.length);const s=Ht(e),r=this.interpolationRatio,o=new he([i[0]*(1-r)+s[0]*r,i[1]*(1-r)+s[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(o,t):new Re({geometry:o,features:t})}}const jo="1.3.0";function m_(n,t,e,i,s){s.WIDTH=e[0],s.HEIGHT=e[1];const r=i.getAxisOrientation(),o=oa(s.VERSION,"1.3")>=0;s[o?"CRS":"SRS"]=i.getCode();const a=o&&r.startsWith("ne")?[t[1],t[0],t[3],t[2]]:t;return s.BBOX=a.join(","),Rh(n,s)}function p_(n,t,e,i,s,r,o){r=Object.assign({REQUEST:"GetMap"},r);const a=t/e,l=[ra(U(n)/a,$i),ra(lt(n)/a,$i)];if(e!=1)switch(o){case"geoserver":const c=90*e+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+c:r.FORMAT_OPTIONS="dpi:"+c;break;case"mapserver":r.MAP_RESOLUTION=90*e;break;case"carmentaserver":case"qgis":r.DPI=90*e;break;default:throw new Error("Unknown `serverType` configured")}return m_(s,n,l,i,r)}function Th(n,t){return Object.assign({REQUEST:t,SERVICE:"WMS",VERSION:jo,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},n)}class y_ extends Sh{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=St(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,s){const r=st(i),o=this.getProjection()||r;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=Er(t,r,o),h=Ws(o,r,t,e),c=a.getZForResolution(h,this.zDirection),u=a.getResolution(c),d=a.getTileCoordForCoordAndZ(l,c);if(a.getResolutions().length<=d[0])return;let f=a.getTileCoordExtent(d,this.tmpExtent_);const g=this.gutter_;g!==0&&(f=Ri(f,u*g,f));const m={QUERY_LAYERS:this.params_.LAYERS};Object.assign(m,Th(this.params_,"GetFeatureInfo"),s);const _=Math.floor((l[0]-f[0])/u),p=Math.floor((f[3]-l[1])/u);return m[this.v13_?"I":"X"]=_,m[this.v13_?"J":"Y"]=p,this.getRequestUrl_(d,f,1,o||r,m)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:jo,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;i.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,r=28e-5;i.SCALE=t*s/r}return Object.assign(i,e),Rh(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,s,r){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=ti(Eh(t),o.length);a=o[l]}return p_(e,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(t[0]),i,s,a,r,this.serverType_)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||jo;this.v13_=oa(t,"1.3")>=0}tileUrlFunction(t,e,i){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(i)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const r=s.getResolution(t[0]);let o=s.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=Ri(o,r*a,o));const l=Object.assign({},Th(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,i,l)}}const E_=n=>{let t;typeof n=="string"?t=JSON.parse(n):t=n;const i=new Go().readFeatures(t),s=[];return i.forEach(r=>{s.push(new Re(r.getGeometry()))}),s},x_=n=>{const{layerId:t,data:e,customStyle:i,zIndex:s=3}=n;let r=E_(e);const o=new pi({features:r}),a=new mi({source:o,style:i,zIndex:s});return a.setVisible(!0),ue(t,a),window.xmMap.addLayer(a),{layer:a,source:o}},w_=n=>{const{layerId:t,url:e,zIndex:i=3}=n,s=new Ke({source:new Ei({url:e}),zIndex:i});return ue(t,s),window.xmMap.addLayer(s),s},C_=n=>{const{layerId:t,url:e,zIndex:i=3,LAYERS:s}=n,r=new Ke({source:new y_({url:e,params:{SERVICE:"WMS",VERSION:"1.1.1",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0,LAYERS:s,exceptions:"application/vnd.ogc.se_inimage",SRS:"EPSG:4326",STYLES:"",WIDTH:"768",HEIGHT:"567",BBOX:"94.50439453125,23.961181640625,111.37939453125,36.419677734375"}}),zIndex:i});return ue(t,r),window.xmMap.addLayer(r),r};let v_=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACN1JREFUeF7NWwuMXFUZ/v47c+9sN9RIYnmUnTtt6Pbe2WrRCk2gxVKf0Wgp0VAiUmjA8OgD0QSKjwDxQSEBlbeCtioY8RFra3xWW1SoKdhAsTsz3W3cubNuxappoCk7Z2bub+7ujOzOzL33nHtndr3JZpM93//6zn9e/zlLmKFvMKMvI6Y1xNQH4j4C+hhIe+YJKDEwCqZRJvZ+dg0UKwdnwjXqlpGhRUi5ZWMta/QuMH8IwAJFWyMg+gW5/ActJXb2D6OsKC8F7zgB+UzPQsC9EoxPALCkvAgHFUB4EtCesovjfwuHyyM6RsDQWZhXS6XuArMX+Fx5F5SQr4HoyUS5fEf/P3BcSdIH3BECcn3JS6BpjxOwqBNOhelgYBiu+8nsaHVfGDasPTYBhbR+ExM9HGaoG+3EvNEqVR6JozsWAQVTX8+g78RxIK4sga+2nMp3o+qJTICX9qRpe6Ma7qQcu+7qqMMhEgFDGX1ZjWk/AEMhkBMg7HOZniGqHai6iVe08fIrnrzbkzozqdXOZE4s14hXgXEJgDcr6BYJ4gv7I+wdlAnw1veaMJ4DsEzSQcGMB4Sb+Pp5f399VEbmpXPm9Bla7WYibFEg+WDCEBep7heUCSiYxlYG7pYJBMABl/jGqLs6b/eoMT0KYLmMPQJutxyxTQbbwCgRMJROnVuDux9E8ySM7LYdsUYCFwrJm8YuAB8JBTIfT0C7sL9UPhqKrQOUCMin9YdBdFOYcgbuyjrizjCcSnvONO4k4I5QGeZH7FJlYyhOlYDcgp4FmuvmGOgJVk6P2U75RlkHVHB5M/UowDcEyRAw7mpaNjsyPiKjWzoDJHvgxdc1sfodIzjhZ7yQ0a8Daxcwu4sBLKnjDhNpR0Du81ax8oSf7PC5p51RrYg/A1gYFJxKBkoTkM8YBTA8p30/l3HZQEnsbAfIW5iLU/ouEHlLnP/HvA+9lTV2Aa+11WOmbgb4a4E6CEfsopA6iEkRILPpIeBpyxFXtHNs4qBkGP+USckGJiHEGX4Hnrxp5MNOmrKbIykC8mnjUhDa9mzD4aB9ecHUf8ug96oQQOA9llN5X/ssMO4BcGtwJmGtXRI/C7MpRcCgqa/XQvb8fj0W57DkR+rQOXP6aolaKXA4gq8ekDgjSBGQM1ObCfxAgMF/2454S7v2gmn8ld+Y7MI6ZFo7AYctR7y1nVDONP5DwOl+Chm0JeuUHwwzKEVAPmN8HowvBih72XbE0uZ2b+kk141VwWFNW9huSSuYxiADWV+fCF+wi+JLHSGgkEltYuYgNp+zHbGi2dhg2linEX4Q5kRgKjOuGCiJp5sx+bS+N2hFIaLNVrH8UJhtqQzIZYyPEuPHfsoIOGo5oqUaNGimPqWBvxrmRPBYplsGnHLLspdPG16d0HdZZsLHskXxkzDbcgT0GW8jDYcClJ20HdFSByyk9QuY6ECYE0HtxLzcKlWeb8kA03g1qPbILpZmR8XLYbalCPCU5E3DG8u+pe2kS/2LRsvDUw3uBZJnm4ZXvFQ5209VceKYI+atBqpT/zhkGgM14HBAcCO2IwJ3iw1ZeQLSqSdAfK2fUQ20ZXGbWTdnGrtI5iTXRjEDu7NtTpSh23Kmb9ml8nVhve+1yxNgGpcDaJmM/meE8Uu7JLwLkGlfwUyuZGh/lHGmGUNwL7ac6p9adYYuretsR/xQxqY0AfV0HgTQ76uY+Fq7WPl2c3suo99HTJ+WcaiBYeL7s8XKZ1rHfuhZYOiYIwaah42fbWkC6vOAV225LSCQAlXFSmsM/2ohwTTuJmCrDAkMbMs64vZmrORp8B7bEVJ2lIaAB5aZ1Qn0TcspX98u0JypvxPANvI5FzB4D4CtWafyl3byedPwyt9XBZHot2p0JAPqWfBrAO8P7km6xW6zdjdkhvtSi2oJ9BNP3iQxYThRw1DzKjLVRujENwn+je2ID8hkWQOjNAQ8oZypX0+gxySMXG474kcSuFCIzHF8gkjwDVmn8o1QhVMAygQcPAvzeg3jRQDzJQzFJiGf1jeAqGVibWN77JQQb1+meGmqTMBkFkgWKCe9vM12xL0SZE2DDM+fk64lqrcy0SYZWZUy2FR9kQgYyfSePc7VFySzwNtuPAvGvbW55V8tGYQICsirHlVTqXXE7BU8Jl6QSHxjPZQ8f0Hx1DEJ7DRIJAIiZEHDqLd/389Ee+DiUCqZfMlrKFer50HDUmL3gwBdDEBXCSRq73s2IhOgngUqISlhI/d+LAJiZIFSdGHgOL0fm4D/gyyI1fuxCZjtLIjb+x0h4PA8nJboNbxZvqUmGJa+sdoJh2qnxIolx3Eyjp7Ik+BUowVTv4pBkZ+pRAmAwOstp/K9KLKx9wHtjOYzxk/BWBvXISl5wk67KC6TwoaAOpIBno28mVwBaC3Fi0442arDXWk71Wc7obtjBHjOFDL6faxY+FANgojvt9oUSlT1NPAdJaC+LHrvh1TfBcv6P9JDyYuibHn9DHSUgMksSG1k5tALCdmIp01YRJusYrmjjzI7TkB9b7CbgA9HCdJPhoGfZx0R/k5I0WhXCCj06ctZo2cQ+pxG2ttxcnmVNVqJdcnSzlpXCJgYCmnjs0z4snSIAUBifM4qia90Qlezjq4RMLE0hlxgSgXEvM8uVVZLYSOAuktApufdYPd3Efx6Q4S099jF8d/H0hGUXd1S3NCbU7gPaPbF736gkz53NQM8R8fmo/fVpOFNiOcrOv7Cm6pi1fwxnFKUU4J3nYDJuSC1BsShD5amec50qV0qe09ku/rNCAFeBLm0/iDJVniZH8qWKpu7Gnld+YwRUL/X84aCHRJYPqkbqxYdPan0rjAqWTNGgOfgkYzxcZfxVJCzGuHKxUXx/agBqcrNKAETQ8E0thNwTTtHGdiRdcQG1SDi4GeegMmnc97/GjWfGEdY01bLvvKOE/RU2RknoD4hXkNE26c6wswbsqXKjk4FJqtnVgjwnCuYxnauDwUCdlgznPoNgmaNgPor0ol/u5uN1J91AhpDwfs9G6nfIOC/gAk7bjiR6jcAAAAASUVORK5CYII=",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Js&&Js.tagName.toUpperCase()==="SCRIPT"&&Js.src||new URL("xm-map.umd.js",document.baseURI).href);const Lh=n=>{const{style:t,title:e,customStyle:i}=n;let s=null,r=null;if(t?.gradient){r=document.createElement("canvas"),s=r.getContext("2d");const a=s.createLinearGradient(0,0,r.width,0);a.addColorStop(0,t.gradient[0]),a.addColorStop(1,t.gradient[t.gradient.length-1]),s.fillStyle=a,s.fillRect(0,0,r.width,r.height)}let o;return i?o=i:o=new Dt({image:new Sn({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"pixels",width:t?.iconSrc&&typeof t?.width=="number"&&!Number.isNaN(t.width)?t.width:30,height:t?.iconSrc&&typeof t?.height=="number"&&!Number.isNaN(t.height)?t.height:30,src:t?.iconSrc||v_.pathname}),text:new vs({text:e||"默认点",fill:new Lt({color:t?.textColor||"#FFF"}),offsetY:t?.iconSrc?t?.offsetY:50,offsetX:t?.iconSrc?t?.offsetX:-35,textAlign:t?.textAlign||"left",padding:t?.padding||[5,5,5,5],font:t?.textFont?`${t?.textFont} MicrosoftYaHei`:"16px MicrosoftYaHei",backgroundFill:new Lt({color:t?.textbackground||(s?s.createPattern(r,"repeat"):"rgba(0, 0, 0, 0)")}),stroke:new ze({color:t?.textStrokeColor||"",width:t?.textStrokeWidth||0}),backgroundStroke:new ze({color:t?.backgroundStrokeColor||"rgba(0, 0, 0, 0)",width:t?.backgroundStrokeWidth||0})})}),o},R_=n=>{const{id:t,className:e,style:i}=n;let s=null,r=null;if(t&&(s=document.getElementById(t)),!s){s=document.createElement("div"),s.id="popupContain",e&&(s.className=e),i&&Object.assign(s.style,i),r=document.createElement("div"),r.id="popupContent";const a={position:"absolute",width:"13rem",backgroundColor:"#fff",borderRadius:"10px",zIndex:"50",padding:"0.625rem",border:"1px solid #ddd",paddingLeft:"1.5rem",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)"};Object.assign(s.style,a),s.appendChild(r),r.innerHTML="<p>这个是示例信息</p>"}const o=new Do({element:s,positioning:"bottom-center",stopEvent:!1,offset:[10,10]});return window.xmMap.addOverlay(o),{overlay:o,contentElement:r}},Ah=(n,t)=>{const{data:e,style:i,iconOutStyle:s,setStyleCallBack:r,customStyle:o,noStyle:a,overlay:l,HoverBack:h,ClickBack:c}=n;if(console.log(n,"接收的参数option"),e.length===0)return[];const u=window.xmMap.getTargetElement(),d=e.map(f=>{let g=Number(f.lng),m=Number(f.lat);!g&&!m&&console.warn("坐标格式错误");const _=[g,m],p=new he(_);var y=new Re({geometry:p,properties:{...f}});let w=[];if(!a){if(s&&typeof s=="boolean"?w.push(new Dt({image:new Rn({radius:9,fill:new Lt({color:"#fff"})})})):s&&typeof s=="function"&&w.push(s(f)),r&&typeof r=="function")w.push(r(f));else{let E=Lh({style:i,title:f.rsnm,customStyle:o});w.push(E)}y.setStyle(w)}return He.xmMapListener({listenType:"pointermove",removeListener:!0}),l&&h&&He.xmMapListener({listenType:"pointermove",callback:async E=>{const x=E.pixel,S=window.xmMap.forEachFeatureAtPixel(x,C=>C);if(S&&S.getGeometry()instanceof he){const C=S?.getGeometry()?.getCoordinates();u.style.cursor="pointer",await h(E,S.getProperties()),l.setPosition(C)}else u.style.cursor="",l.setPosition(void 0)}}),y});return c&&(He.xmMapListener({listenType:"click",removeListener:!0}),He.xmMapListener({listenType:"click",callback:f=>{const g=f.pixel,m=window.xmMap.forEachFeatureAtPixel(g,_=>_);m&&m.getGeometry()instanceof he&&(m?.getGeometry()?.getCoordinates(),l&&h&&(u.style.cursor="",l.setPosition(void 0)),c(f,m.getProperties()))}})),t&&(He.xmMapListener({...t,removeListener:!0}),He.xmMapListener({...t,data:d})),d},S_=n=>{let t=Ah(n);return new pi({features:t})},I_=n=>{const{layerId:t,features:e,zIndex:i=3,style:s}=n,r=new pi({features:e});let o;return s?o=new mi({source:r,zIndex:i,style:s}):o=new mi({source:r,zIndex:i}),ue(t,o),window.xmMap.addLayer(o),o},T_=n=>{const{data:t,distance:e}=n;let i=He.xmPointSource({data:t,noStyle:!0});return new __({distance:e,minDistance:100,source:i})},L_=n=>{const{layerId:t,source:e,zIndex:i=3,styleCallBack:s}=n,r=new mi({source:e,zIndex:i,style:s});return ue(t,r),window.xmMap.addLayer(r),r};let te=new Map;const ue=(n,t)=>{if(!n)return console.error("图层ID不能为空");te.has(n)&&(console.warn(`图层ID ${n} 已存在,可能导致覆盖现有图层`),console.log("现有图层IDs:",Array.from(te.keys()))),te.set(n,t),console.log(te,"现有图层集合")},Bn=n=>{const t=te.get(n);return t||console.warn(`图层ID ${n} 不存在`),t},Mh=n=>{if(te.has(n)){let t=Bn(n);window.xmMap.removeLayer(t),te.delete(n)}else console.warn(`图层中没有当前ID${n}的图层`)},Zs=(n=!1)=>{n?(te.clear(),console.warn("清空了当前的图层集合,不会销毁地图,不会移除图层,需手动调用usexmMapProps.destroyMap方法摧毁图层")):(te.forEach(t=>{window.xmMap.removeLayer(t)}),te.clear())},Ph=(n,t)=>{te.has(n)?Bn(n).setVisible(t):console.warn(`图层中没有当前ID${n}的图层`)},He={getMap:Ag,changeBaseMap:Mg,closeBaseMap:Pg,xmMapListener:Dg,xmMask:n_,xmVector3DLayer:g_,xmEmptyLayer:n=>{const{layerId:t="globalLayer",zIndex:e=2,style:i}=n,s=new pi;let r;return i?r=new mi({source:s,zIndex:e,style:i}):r=new mi({source:s,zIndex:e}),ue(t,r),window.xmMap.addLayer(r),t||(console.warn("生成了一个空图层放在了全局,如果需要使用,可以通过globalLayer这个id获取"),window.xmglobalLayer=r),r},getLayerSource:(n="globalLayer")=>Bn(n).getSource(),addLayerToMap:ue,getLayerById:Bn,removeLayerById:Mh,removeAllLayer:Zs,setVisibleLayerById:Ph,xmGeoJSONLayer:x_,xmXYZTileLayer:w_,xmWMSTileLayer:C_,xmPointStyle:Lh,xmaddOverlay:R_,xmPointFeature:Ah,xmPointSource:S_,xmPointLayer:I_,clusterPointSource:T_,xmClusterLayer:L_,moveToPoint:n=>{window.xmMap.getView().animate({center:n,zoom:13,duration:1e3})},toHome:(n,t,e)=>{const i=[n,t],s=e;window.xmMap.getView().animate({center:i,zoom:s,duration:2e3})}},A_=()=>{vi.onMounted(()=>{Og()}),vi.onBeforeUnmount(()=>{Zs(!0),Fg()})};bt.addLayerToMap=ue,bt.getLayerById=Bn,bt.removeAllLayer=Zs,bt.removeLayerById=Mh,bt.setVisibleLayerById=Ph,bt.usexmMapProps=He,bt.usexmMapWorld=A_,Object.defineProperty(bt,Symbol.toStringTag,{value:"Module"})}));
|