@dullcat/ol-helper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/ol-helper.cjs.js +12 -0
- package/dist/ol-helper.d.ts +6 -0
- package/dist/ol-helper.es.js +15244 -0
- package/dist/ol-helper.umd.js +12 -0
- package/dist/olHelper.d.ts +74 -0
- package/package.json +96 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var yl=Object.defineProperty;var pl=(s,t,e)=>t in s?yl(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var je=(s,t,e)=>(pl(s,typeof t!="symbol"?t+"":t,e),e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class xl{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const Mt=xl,hi={PROPERTYCHANGE:"propertychange"};class El{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const Ks=El;function Cl(s,t,e){let i,n;e=e||Oe;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function Oe(s,t){return s>t?1:s<t?-1:0}function Us(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function Tl(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function Dt(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function ie(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}function Rl(s,t,e){const i=t||Oe;return s.every(function(n,r){if(r===0)return!0;const o=i(s[r-1],n);return!(o>0||e&&o===0)})}function pe(){return!0}function fi(){return!1}function ci(){}function Sl(s){let t=!1,e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ie(r,i))&&(t=!0,n=this,i=r,e=s.apply(this,arguments)),e}}function _i(s){for(const t in s)delete s[t]}function Mi(s){let t;for(t in s)return!1;return!t}class wl extends Ks{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new Mt(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h<c;++h)if("handleEvent"in n[h]?l=n[h].handleEvent(r):l=n[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,ci);delete o[i]}return l}disposeInternal(){this.listeners_&&_i(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){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=ci,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}}const zn=wl,O={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Y(s,t,e,i,n){if(i&&i!==s&&(e=e.bind(i)),n){const o=e;e=function(){s.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function Tn(s,t,e,i){return Y(s,t,e,i,!0)}function q(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),_i(s))}class Bn extends zn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(O.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Y(this,t[r],e);return n}return Y(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=Tn(this,t[r],e)}else i=Tn(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Il(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}Bn.prototype.on;Bn.prototype.once;Bn.prototype.un;function Il(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)q(s[t]);else q(s)}const Uo=Bn;function A(){throw new Error("Unimplemented abstract method.")}let vl=0;function k(s){return s.ol_uid||(s.ol_uid=String(++vl))}class Zr extends Mt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Ll extends Uo{constructor(t){super(),this.on,this.once,this.un,k(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_)||{}}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Zr(i,t,e)),i=hi.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Zr(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[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],Mi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Yt=Ll,Ml={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class Pl extends Error{constructor(t){const e=Ml[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}const Zo=Pl,tt={ADD:"add",REMOVE:"remove"},Hr={LENGTH:"length"};class en extends Mt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Fl extends Yt{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=0,n=this.array_.length;i<n;++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,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Hr.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 en(tt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++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 en(tt.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new en(tt.REMOVE,n,t)),this.dispatchEvent(new en(tt.ADD,e,t))}updateLength_(){this.set(Hr.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Zo(58)}}const Ct=Fl,xe=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Al=xe.includes("firefox"),Dl=xe.includes("safari")&&!xe.includes("chrom");Dl&&(xe.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(xe));const Ol=xe.includes("webkit")&&!xe.includes("edge"),Ho=xe.includes("macintosh"),qo=typeof devicePixelRatio<"u"?devicePixelRatio:1,Zs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,bl=typeof Image<"u"&&Image.prototype.decode,$o=function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s}();function N(s,t){if(!s)throw new Zo(t)}new Array(6);function Nt(){return[1,0,0,1,0,0]}function kl(s,t,e,i,n,r,o){return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s[4]=r,s[5]=o,s}function Gl(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function st(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function Nl(s,t,e){return kl(s,t,0,0,e,0,0)}function Ee(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Hs(s,t){const e=Xl(t);N(e!==0,32);const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function Xl(s){return s[0]*s[3]-s[1]*s[2]}let qr;function Jo(s){const t="matrix("+s.join(", ")+")";if(Zs)return t;const e=qr||(qr=document.createElement("div"));return e.style.transform=t,e.style.transform}const nt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function xt(s){const t=vt();for(let e=0,i=s.length;e<i;++e)Ii(t,s[e]);return t}function Vn(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function Qo(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Ge(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function jn(s,t){return qs(s,t[0],t[1])}function ei(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function qs(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function ws(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=nt.UNKNOWN;return o<e?l=l|nt.LEFT:o>n&&(l=l|nt.RIGHT),a<i?l=l|nt.BELOW:a>r&&(l=l|nt.ABOVE),l===nt.UNKNOWN&&(l=nt.INTERSECTING),l}function vt(){return[1/0,1/0,-1/0,-1/0]}function te(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Wi(s){return te(1/0,1/0,-1/0,-1/0,s)}function En(s,t){const e=s[0],i=s[1];return te(e,i,e,i,t)}function ta(s,t,e,i,n){const r=Wi(n);return ea(r,s,t,e,i)}function Pi(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function $s(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Ii(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function ea(s,t,e,i,n){for(;e<i;e+=n)Wl(s,t[e],t[e+1]);return s}function Wl(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Js(s,t){let e;return e=t(ui(s)),e||(e=t(Yi(s)),e)||(e=t(zi(s)),e)||(e=t(ne(s)),e)?e:!1}function Is(s){let t=0;return Kn(s)||(t=H(s)*Wt(s)),t}function ui(s){return[s[0],s[1]]}function Yi(s){return[s[2],s[1]]}function be(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Yl(s,t){let e;return t==="bottom-left"?e=ui(s):t==="bottom-right"?e=Yi(s):t==="top-left"?e=ne(s):t==="top-right"?e=zi(s):N(!1,13),e}function vs(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=Ls(s,t,e,i);return te(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),n)}function Ls(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,h=n*a,c=r*o,u=r*a,d=s[0],g=s[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function Wt(s){return s[3]-s[1]}function vi(s,t,e){const i=e||vt();return ht(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):Wi(i),i}function ne(s){return[s[0],s[3]]}function zi(s){return[s[2],s[3]]}function H(s){return s[2]-s[0]}function ht(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function Kn(s){return s[2]<s[0]||s[3]<s[1]}function zl(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Bl(s,t,e){let i=!1;const n=ws(s,t),r=ws(s,e);if(n===nt.INTERSECTING||r===nt.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],h=s[3],c=t[0],u=t[1],d=e[0],g=e[1],f=(g-u)/(d-c);let _,m;!!(r&nt.ABOVE)&&!(n&nt.ABOVE)&&(_=d-(g-h)/f,i=_>=o&&_<=l),!i&&!!(r&nt.RIGHT)&&!(n&nt.RIGHT)&&(m=g-(d-l)*f,i=m>=a&&m<=h),!i&&!!(r&nt.BELOW)&&!(n&nt.BELOW)&&(_=d-(g-a)/f,i=_>=o&&_<=l),!i&&!!(r&nt.LEFT)&&!(n&nt.LEFT)&&(m=g-(d-o)*f,i=m>=a&&m<=h)}return i}function ia(s,t){const e=t.getExtent(),i=be(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=H(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Vl(s,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[e[0],s[1],e[2],s[3]]];ia(s,t);const i=H(e);if(H(s)>i)return[[e[0],s[1],e[2],s[3]]];if(s[0]<e[0])return[[s[0]+i,s[1],e[2],s[3]],[e[0],s[1],s[2],s[3]]];if(s[2]>e[2])return[[s[0],s[1],e[2],s[3]],[e[0],s[1],s[2]-i,s[3]]]}return[s]}function Q(s,t,e){return Math.min(Math.max(s,t),e)}function jl(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return qt(s,t,e,i)}function qt(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Kl(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let h=i;h<t+1;h++)i==h?s[a][h]=0:s[a][h]+=l*s[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function Cn(s){return s*Math.PI/180}function Pe(s,t){const e=s%t;return e*t<0?e+t:e}function Et(s,t,e){return s+e*(t-s)}function Un(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function nn(s,t){return Math.floor(Un(s,t))}function sn(s,t){return Math.ceil(Un(s,t))}const Ul=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Zl=/^([a-z]*)$|^hsla?\(.*\)$/i;function na(s){return typeof s=="string"?s:sa(s)}function Hl(s){const t=document.createElement("div");if(t.style.color=s,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}return""}const ql=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let r=0;for(const o in t)(r++&3)===0&&(delete t[o],--e)}n=$l(i),t[i]=n,++e}return n}}();function Rn(s){return Array.isArray(s)?s:ql(s)}function $l(s){let t,e,i,n,r;if(Zl.exec(s)&&(s=Hl(s)),Ul.exec(s)){const o=s.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;t=parseInt(s.substr(1+0*a,a),16),e=parseInt(s.substr(1+1*a,a),16),i=parseInt(s.substr(1+2*a,a),16),l?n=parseInt(s.substr(1+3*a,a),16):n=255,a==1&&(t=(t<<4)+t,e=(e<<4)+e,i=(i<<4)+i,l&&(n=(n<<4)+n)),r=[t,e,i,n/255]}else s.startsWith("rgba(")?(r=s.slice(5,-1).split(",").map(Number),$r(r)):s.startsWith("rgb(")?(r=s.slice(4,-1).split(",").map(Number),r.push(1),$r(r)):N(!1,14);return r}function $r(s){return s[0]=Q(s[0]+.5|0,0,255),s[1]=Q(s[1]+.5|0,0,255),s[2]=Q(s[2]+.5|0,0,255),s[3]=Q(s[3],0,1),s}function sa(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*100)/100;return"rgba("+t+","+e+","+i+","+n+")"}class Jl{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Jr(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=Jr(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Jr(s,t,e){const i=e?na(e):"null";return t+":"+s+":"+i}const Sn=new Jl,K={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 Ql extends Yt{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[K.OPACITY]=t.opacity!==void 0?t.opacity:1,N(typeof e[K.OPACITY]=="number",64),e[K.VISIBLE]=t.visible!==void 0?t.visible:!0,e[K.Z_INDEX]=t.zIndex,e[K.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[K.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[K.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[K.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=Q(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 A()}getLayerStatesArray(t){return A()}getExtent(){return this.get(K.EXTENT)}getMaxResolution(){return this.get(K.MAX_RESOLUTION)}getMinResolution(){return this.get(K.MIN_RESOLUTION)}getMinZoom(){return this.get(K.MIN_ZOOM)}getMaxZoom(){return this.get(K.MAX_ZOOM)}getOpacity(){return this.get(K.OPACITY)}getSourceState(){return A()}getVisible(){return this.get(K.VISIBLE)}getZIndex(){return this.get(K.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(K.EXTENT,t)}setMaxResolution(t){this.set(K.MAX_RESOLUTION,t)}setMinResolution(t){this.set(K.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(K.MAX_ZOOM,t)}setMinZoom(t){this.set(K.MIN_ZOOM,t)}setOpacity(t){N(typeof t=="number",64),this.set(K.OPACITY,t)}setVisible(t){this.set(K.VISIBLE,t)}setZIndex(t){this.set(K.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const ra=Ql,Xt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},at={ANIMATING:0,INTERACTING:1},Ft={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},th=42,Qs=256,Fi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class eh{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_||Fi[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 oa=eh,Bi=6378137,ii=Math.PI*Bi,ih=[-ii,-ii,ii,ii],nh=[-180,-85,180,85],rn=Bi*Math.log(Math.tan(Math.PI/2));class Ke extends oa{constructor(t){super({code:t,units:"m",extent:ih,global:!0,worldExtent:nh,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Bi)}})}}const Qr=[new Ke("EPSG:3857"),new Ke("EPSG:102100"),new Ke("EPSG:102113"),new Ke("EPSG:900913"),new Ke("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ke("http://www.opengis.net/gml/srs/epsg.xml#3857")];function sh(s,t,e){const i=s.length;e=e>1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;n<i;n+=e){t[n]=ii*s[n]/180;let r=Bi*Math.log(Math.tan(Math.PI*(+s[n+1]+90)/360));r>rn?r=rn:r<-rn&&(r=-rn),t[n+1]=r}return t}function rh(s,t,e){const i=s.length;e=e>1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;n<i;n+=e)t[n]=180*s[n]/ii,t[n+1]=360*Math.atan(Math.exp(s[n+1]/Bi))/Math.PI-90;return t}const oh=6378137,to=[-180,-90,180,90],ah=Math.PI*oh/180;class Re extends oa{constructor(t,e){super({code:t,units:"degrees",extent:to,axisOrientation:e,global:!0,metersPerUnit:ah,worldExtent:to})}}const eo=[new Re("CRS:84"),new Re("EPSG:4326","neu"),new Re("urn:ogc:def:crs:OGC:1.3:CRS84"),new Re("urn:ogc:def:crs:OGC:2:84"),new Re("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Re("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Re("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ms={};function lh(s){return Ms[s]||Ms[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function hh(s,t){Ms[s]=t}let ri={};function wn(s,t,e){const i=s.getCode(),n=t.getCode();i in ri||(ri[i]={}),ri[i][n]=e}function ch(s,t){let e;return s in ri&&t in ri[s]&&(e=ri[s][t]),e}function uh(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function aa(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],h=r[1],c=l-o,u=h-a,d=c===0&&u===0?0:(c*(e-o)+u*(i-a))/(c*c+u*u||0);let g,f;return d<=0?(g=o,f=a):d>=1?(g=l,f=h):(g=o+d*c,f=a+d*u),[g,f]}function wt(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function tr(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function dh(s,t){return s[0]*=t,s[1]*=t,s}function ke(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function In(s,t){return Math.sqrt(ke(s,t))}function gh(s,t){return ke(s,aa(s,t))}function la(s,t){if(t.canWrapX()){const e=H(t.getExtent()),i=fh(s,t,e);i&&(s[0]-=i*e)}return s}function fh(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||H(i),n=Math.floor((s[0]-i[0])/e)),n}const _h=63710088e-1;function io(s,t,e){e=e||_h;const i=Cn(s[1]),n=Cn(t[1]),r=(n-i)/2,o=Cn(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const ha={info:1,warn:2,error:3,none:4};let mh=ha.info;function ca(...s){mh>ha.warn||console.warn(...s)}let Ps=!0;function yh(s){Ps=!(s===void 0?!0:s)}function er(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function ua(s,t){if(t!==void 0&&s!==t){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];s=t}return s}function ph(s){hh(s.getCode(),s),wn(s,s,er)}function xh(s){s.forEach(ph)}function ct(s){return typeof s=="string"?lh(s):s||null}function no(s,t,e,i){s=ct(s);let n;const r=s.getPointResolutionFunc();if(r){if(n=r(t,e),i&&i!==s.getUnits()){const o=s.getMetersPerUnit();o&&(n=n*o/Fi[i])}}else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=nr(s,ct("EPSG:4326"));if(a===ua&&o!=="degrees")n=t*s.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=io(h.slice(0,2),h.slice(2,4)),u=io(h.slice(4,6),h.slice(6,8));n=(c+u)/2}const l=i?Fi[i]:s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function so(s){xh(s),s.forEach(function(t){s.forEach(function(e){t!==e&&wn(t,e,er)})})}function Eh(s,t,e,i){s.forEach(function(n){t.forEach(function(r){wn(n,r,e),wn(r,n,i)})})}function ir(s,t){return s?typeof s=="string"?ct(s):s:ct(t)}function Ie(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||nr(s,t)===er)&&e}function nr(s,t){const e=s.getCode(),i=t.getCode();let n=ch(e,i);return n||(n=ua),n}function vn(s,t){const e=ct(s),i=ct(t);return nr(e,i)}function Ch(s,t,e){return vn(t,e)(s,void 0,s.length)}function di(s,t){return s}function $(s,t){return Ps&&!wt(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Ps=!1,ca("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function sr(s,t){return s}function fe(s,t){return s}function Th(){so(Qr),so(eo),Eh(eo,Qr,sh,rh)}Th();function ro(s,t,e){return function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,h=t?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,g=s[2]-l/2+c,f=s[1]+h/2+u,_=s[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let m=Q(i[0],d,g),y=Q(i[1],f,_);if(o&&e&&n){const p=30*n;m+=-p*Math.log(1+Math.max(0,d-i[0])/p)+p*Math.log(1+Math.max(0,i[0]-g)/p),y+=-p*Math.log(1+Math.max(0,f-i[1])/p)+p*Math.log(1+Math.max(0,i[1]-_)/p)}return[m,y]}}function Rh(s){return s}function rr(s,t,e,i){const n=H(t)/e[0],r=Wt(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function or(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),Q(i,e/2,t*2)}function Sh(s,t,e,i){return t=t!==void 0?t:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],h=s[s.length-1],c=e?rr(l,e,o,i):l;if(a)return t?or(n,c,h):Q(n,h,c);const u=Math.min(c,n),d=Math.floor(Us(s,u,r));return s[d]>c&&d<s.length-1?s[d+1]:s[d]}}}function wh(s,t,e,i,n,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=n?rr(t,n,l,r):t;if(h)return i?or(o,c,e):Q(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(s)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(t/f)/Math.log(s)+g),m=Math.max(d,_),y=t/Math.pow(s,m);return Q(y,e,c)}}}function oo(s,t,e,i,n){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=i?rr(s,i,a,n):s;return!e||!l?Q(r,t,h):or(r,h,t)}}}function ar(s){if(s!==void 0)return 0}function ao(s){if(s!==void 0)return s}function Ih(s){const t=2*Math.PI/s;return function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function vh(s){return s=s||Cn(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=s?0:t}}function da(s){return Math.pow(s,3)}function mi(s){return 1-da(1-s)}function Lh(s){return 3*s*s-2*s*s*s}function Mh(s){return s}function Fe(s,t,e,i,n,r){r=r||[];let o=0;for(let a=t;a<e;a+=i){const l=s[a],h=s[a+1];r[o++]=n[0]*l+n[2]*h+n[4],r[o++]=n[1]*l+n[3]*h+n[5]}return r&&r.length!=o&&(r.length=o),r}function lr(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const g=s[d]-h,f=s[d+1]-c;o[u++]=h+g*a-f*l,o[u++]=c+g*l+f*a;for(let _=d+2;_<d+i;++_)o[u++]=s[_]}return o&&o.length!=u&&(o.length=u),o}function Ph(s,t,e,i,n,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=s[u]-l,g=s[u+1]-h;a[c++]=l+n*d,a[c++]=h+r*g;for(let f=u+2;f<u+i;++f)a[c++]=s[f]}return a&&a.length!=c&&(a.length=c),a}function Fh(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=s[h]}return o&&o.length!=a&&(o.length=a),o}const lo=Nt();class Ah extends Yt{constructor(){super(),this.extent_=vt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Sl(function(t,e,i){if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return A()}closestPointXY(t,e,i,n){return A()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return A()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Wi(e),this.extentRevision_=this.getRevision()}return zl(this.extent_,t)}rotate(t,e){A()}scale(t,e,i){A()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return A()}getType(){return A()}applyTransform(t){A()}intersectsExtent(t){return A()}translate(t,e){A()}transform(t,e){const i=ct(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=Wt(h)/Wt(l);return Ee(lo,h[0],h[3],c,-c,0,0,0),Fe(r,0,r.length,a,lo,o),vn(i,e)(r,o,a)}:vn(i,e);return this.applyTransform(n),this}}const ga=Ah;class Ce extends ga{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return ta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return A()}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=Ln(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){A()}setLayout(t,e,i){let n;if(t)n=Ln(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}n=e.length,t=Dh(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();lr(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=be(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Ph(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Fh(i,0,i.length,n,t,e,i),this.changed()}}}function Dh(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function Ln(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function Oh(s,t,e){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return Fe(i,0,i.length,n,t,e)}function ho(s,t,e,i,n,r,o){const a=s[t],l=s[t+1],h=s[e]-a,c=s[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((n-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let g=0;g<i;++g)o[g]=Et(s[t+g],s[e+g],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function hr(s,t,e,i,n){let r=s[t],o=s[t+1];for(t+=i;t<e;t+=i){const a=s[t],l=s[t+1],h=qt(r,o,a,l);h>n&&(n=h),r=a,o=l}return n}function cr(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=hr(s,t,a,i,n),t=a}return n}function bh(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=cr(s,t,a,i,n),t=a[a.length-1]}return n}function ur(s,t,e,i,n,r,o,a,l,h,c){if(t==e)return h;let u,d;if(n===0){if(d=qt(o,a,s[t],s[t+1]),d<h){for(u=0;u<i;++u)l[u]=s[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(ho(s,g-i,g,i,o,a,c),d=qt(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/n|0,1);if(r&&(ho(s,e-i,t,i,o,a,c),d=qt(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 dr(s,t,e,i,n,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=ur(s,t,g,i,n,r,o,a,l,h,c),t=g}return h}function kh(s,t,e,i,n,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=dr(s,t,g,i,n,r,o,a,l,h,c),t=g[g.length-1]}return h}function fa(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}function Zn(s,t,e,i){for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0;a<i;++a)s[t++]=o[a]}return t}function gr(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Zn(s,t,e[o],i);n[r++]=l,t=l}return n.length=r,n}function Gh(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=gr(s,t,e[o],i,n[r]);l.length===0&&(l[0]=t),n[r++]=l,t=l[l.length-1]}return n.length=r,n}function fr(s,t,e,i,n,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=s[t],r[o++]=s[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 g=0;const f=s[d],_=s[d+1],m=s[u],y=s[u+1];for(let p=d+i;p<u;p+=i){const x=s[p],E=s[p+1],C=jl(x,E,f,_,m,y);C>g&&(c=p,g=C)}g>n&&(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++]=s[t+u*i],r[o++]=s[t+u*i+1]);return o}function Nh(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=fr(s,t,c,i,n,r,o),a.push(o),t=c}return o}function we(s,t){return t*Math.round(s/t)}function Xh(s,t,e,i,n,r,o){if(t==e)return o;let a=we(s[t],n),l=we(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=we(s[t],n),c=we(s[t+1],n),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=we(s[t],n),d=we(s[t+1],n);if(t+=i,u==h&&d==c)continue;const g=h-a,f=c-l,_=u-a,m=d-l;if(g*m==f*_&&(g<0&&_<g||g==_||g>0&&_>g)&&(f<0&&m<f||f==m||f>0&&m>f)){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 _a(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Xh(s,t,c,i,n,r,o),a.push(o),t=c}return o}function Wh(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=_a(s,t,c,i,n,r,o,u),a.push(u),t=c[c.length-1]}return o}function _e(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ai(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=_e(s,t,l,i,n[r]),t=l}return n.length=r,n}function Fs(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ai(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}function ma(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=o*a-r*l,r=a,o=l}return n/2}function ya(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=ma(s,t,a,i),t=a}return n}function Yh(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=ya(s,t,a,i),t=a[a.length-1]}return n}class Mn extends Ce{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 Mn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ur(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return ma(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return _e(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=fr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Mn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Zn(this.flatCoordinates,0,t,this.stride),this.changed()}}const co=Mn;class _r extends Ce{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new _r(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=qt(t,e,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return En(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=fa(this.flatCoordinates,0,t,this.stride),this.changed()}}const $t=_r;function zh(s,t,e,i,n){return!Js(n,function(o){return!ve(s,t,e,i,o[0],o[1])})}function ve(s,t,e,i,n,r){let o=0,a=s[e-i],l=s[e-i+1];for(;t<e;t+=i){const h=s[t],c=s[t+1];l<=r?c>r&&(h-a)*(r-l)-(n-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(n-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function mr(s,t,e,i,n,r){if(e.length===0||!ve(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o<a;++o)if(ve(s,e[o-1],e[o],i,n,r))return!1;return!0}function Bh(s,t,e,i,n,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(mr(s,t,l,i,n,r))return!0;t=l[l.length-1]}return!1}function pa(s,t,e,i,n,r,o){let a,l,h,c,u,d,g;const f=n[r+1],_=[];for(let p=0,x=e.length;p<x;++p){const E=e[p];for(c=s[E-i],d=s[E-i+1],a=t;a<E;a+=i)u=s[a],g=s[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,_.push(h)),c=u,d=g}let m=NaN,y=-1/0;for(_.sort(Oe),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const p=Math.abs(u-c);p>y&&(h=(c+u)/2,mr(s,t,e,i,h,f)&&(m=h,y=p)),c=u}return isNaN(m)&&(m=n[r]),o?(o.push(m,f,y),o):[m,f,y]}function Vh(s,t,e,i,n){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=pa(s,t,l,i,n,2*o,r),t=l[l.length-1]}return r}function xa(s,t,e,i,n){let r;for(t+=i;t<e;t+=i)if(r=n(s.slice(t-i,t),s.slice(t,t+i)),r)return r;return!1}function Hn(s,t,e,i,n){const r=ea(vt(),s,t,e,i);return ht(n,r)?ei(n,r)||r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:xa(s,t,e,i,function(o,a){return Bl(n,o,a)}):!1}function jh(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){if(Hn(s,t,e[r],i,n))return!0;t=e[r]}return!1}function Ea(s,t,e,i,n){return!!(Hn(s,t,e,i,n)||ve(s,t,e,i,n[0],n[1])||ve(s,t,e,i,n[0],n[3])||ve(s,t,e,i,n[2],n[1])||ve(s,t,e,i,n[2],n[3]))}function Ca(s,t,e,i,n){if(!Ea(s,t,e[0],i,n))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(zh(s,e[r-1],e[r],i,n)&&!Hn(s,e[r-1],e[r],i,n))return!1;return!0}function Kh(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(Ca(s,t,a,i,n))return!0;t=a[a.length-1]}return!1}function Uh(s,t,e,i){for(;t<e-i;){for(let n=0;n<i;++n){const r=s[t+n];s[t+n]=s[e-i+n],s[e-i+n]=r}t+=i,e-=i}}function Ta(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=(a-r)*(l+o),r=a,o=l}return n===0?void 0:n>0}function Ra(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ta(s,t,a,i);if(r===0){if(n&&l||!n&&!l)return!1}else if(n&&!l||!n&&l)return!1;t=a}return!0}function Zh(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!Ra(s,t,a,i,n))return!1;a.length&&(t=a[a.length-1])}return!0}function As(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ta(s,t,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&Uh(s,t,a,i),t=a}return t}function uo(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r)t=As(s,t,e[r],i,n);return t}class Lt extends Ce{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?Dt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Lt(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(cr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dr(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return mr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return ya(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),As(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Ai(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=be(this.getExtent());this.flatInteriorPoint_=pa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new $t(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new co(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_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new co(e.slice(r,l),t);n.push(h),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ra(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=As(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=_a(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Lt(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Ca(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=gr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function go(s){if(Kn(s))throw new Error("Cannot create polygon from empty extent");const t=s[0],e=s[1],i=s[2],n=s[3],r=[t,e,t,n,i,n,i,e,t,e];return new Lt(r,"XY",[r.length])}function Hh(s,t,e){t=t||32;const i=s.getStride(),n=s.getLayout(),r=s.getCenter(),o=i*(t+1),a=new Array(o);for(let c=0;c<o;c+=i){a[c]=0,a[c+1]=0;for(let u=2;u<i;u++)a[c+u]=r[u]}const l=[a.length],h=new Lt(a,n,l);return Sa(h,r,s.getRadius(),e),h}function Sa(s,t,e,i){const n=s.getFlatCoordinates(),r=s.getStride(),o=n.length/r-1,a=i||0;for(let l=0;l<=o;++l){const h=l*r,c=a+Pe(l,o)*2*Math.PI/o;n[h]=t[0]+e*Math.cos(c),n[h+1]=t[1]+e*Math.sin(c)}s.changed()}const os=0;class qh extends Yt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ir(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&&yh(),t.center&&(t.center=$(t.center,this.projection_)),t.extent&&(t.extent=fe(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Ft)delete e[a];this.setProperties(e,!0);const i=Jh(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 n=$h(t),r=i.constraint,o=Qh(t);this.constraints_={center:n,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 n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(n[3]-e[3]+e[1]-n[1]),a=r/2*(n[0]-e[0]+e[2]-n[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 n=arguments[i];n.center&&(n=Object.assign({},n),n.center=$(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=$(n.anchor,this.getProjection())),e[i]=n}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 n=0;for(;n<e&&!this.isDef();++n){const c=arguments[n];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(n===e){i&&on(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;n<e;++n){const c=arguments[n],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Lh,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=Pe(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}tc(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(at.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[at.ANIMATING]>0}getInteracting(){return this.hints_[at.INTERACTING]>0}cancelAnimations(){this.setHint(at.ANIMATING,-this.hints_[at.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const n=this.animations_[e];if(n[0].callback&&on(n[0].callback,!1),!t)for(let r=0,o=n.length;r<o;++r){const a=n[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 n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o<a;++o){const l=n[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],g=l.sourceCenter[1],f=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(f-d),y=g+u*(_-g);this.targetCenter_=[m,y]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),f=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(f,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Pe(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(at.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&on(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-e[0],n[1]-e[1]],tr(i,t-this.getRotation()),uh(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-n[0])/r,a=e[1]-t*(e[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}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&&di(t,this.getProjection())}getCenterInternal(){return this.get(Ft.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 sr(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();N(e,1);const i=this.getResolution();N(i!==void 0,2);const n=this.getRotation();return N(n!==void 0,3),vs(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Ft.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(fe(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=H(t)/e[0],n=Wt(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(r){return e/Math.pow(t,r*n)}}getRotation(){return this.get(Ft.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(o){return Math.log(i/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=as(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}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,n;if(this.resolutions_){const r=Us(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return e+Math.log(i/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=Q(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Q(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(N(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){N(!Kn(t),25);const n=fe(t,this.getProjection());i=go(n)}else if(t.getType()==="Circle"){const n=fe(t.getExtent(),this.getProjection());i=go(n),i.rotate(this.getRotation(),be(n))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const g=r[u]*i-r[u+1]*n,f=r[u]*n+r[u+1]*i;a=Math.min(a,g),l=Math.min(l,f),h=Math.max(h,g),c=Math.max(c,f)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const n=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]-n[1]-n[3],i[1]-n[0]-n[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=be(a);d[0]+=(n[1]-n[3])/2*l,d[1]+=(n[0]-n[2])/2*l;const g=d[0]*u-d[1]*c,f=d[1]*u+d[0]*c,_=this.getConstrainedCenter([g,f],l),m=e.callback?e.callback:ci;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),on(m,!0))}centerOn(t,e,i){this.centerOnInternal($(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(as(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=as(t,n,[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=di(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&&$(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,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=$(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&$(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,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,n,r));this.get(Ft.ROTATION)!==n&&this.set(Ft.ROTATION,n),this.get(Ft.RESOLUTION)!==o&&(this.set(Ft.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ft.CENTER)||!wt(this.get(Ft.CENTER),a))&&this.set(Ft.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,n,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()||!wt(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:mi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(at.INTERACTING,1)}endInteraction(t,e,i){i=i&&$(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){!this.getInteracting()||(this.setHint(at.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 on(s,t){setTimeout(function(){s(t)},0)}function $h(s){if(s.extent!==void 0){const e=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return ro(s.extent,s.constrainOnlyCenter,e)}const t=ir(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,ro(e,!1,!1)}return Rh}function Jh(s){let t,e,i,o=s.minZoom!==void 0?s.minZoom:os,a=s.maxZoom!==void 0?s.maxZoom:28;const l=s.zoomFactor!==void 0?s.zoomFactor:2,h=s.multiWorld!==void 0?s.multiWorld:!1,c=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,u=s.showFullExtent!==void 0?s.showFullExtent:!1,d=ir(s.projection,"EPSG:3857"),g=d.getExtent();let f=s.constrainOnlyCenter,_=s.extent;if(!h&&!_&&d.isGlobal()&&(f=!1,_=g),s.resolutions!==void 0){const m=s.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],s.constrainResolution?t=Sh(m,c,!f&&_,u):t=oo(e,i,c,!f&&_,u)}else{const y=(g?Math.max(H(g),Wt(g)):360*Fi.degrees/d.getMetersPerUnit())/Qs/Math.pow(2,os),p=y/Math.pow(2,28-os);e=s.maxResolution,e!==void 0?o=0:e=y/Math.pow(l,o),i=s.minResolution,i===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?i=e/Math.pow(l,a):i=y/Math.pow(l,a):i=p),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),s.constrainResolution?t=wh(l,e,i,c,!f&&_,u):t=oo(e,i,c,!f&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function Qh(s){if(s.enableRotation!==void 0?s.enableRotation:!0){const e=s.constrainRotation;return e===void 0||e===!0?vh():e===!1?ao:typeof e=="number"?Ih(e):ao}return ar}function tc(s){return!(s.sourceCenter&&s.targetCenter&&!wt(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function as(s,t,e,i,n){const r=Math.cos(-n);let o=Math.sin(-n),a=s[0]*r-s[1]*o,l=s[1]*r+s[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 bt=qh;class ec extends ra{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(K.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(K.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_&&(q(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Y(t,O.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 bt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let n;e.layerStatesArray?n=e.layerStatesArray.find(o=>o.layer===this):n=this.getLayerState();const r=this.getExtent();return yr(n,e.viewState)&&(!r||ht(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const n=t instanceof bt?t.getViewStateAndExtent():t;let r=e(n);return Array.isArray(r)||(r=[r]),r}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(K.MAP,t)}getMapInternal(){return this.get(K.MAP)}setMap(t){this.mapPrecomposeKey_&&(q(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(q(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Y(t,Xt.PRECOMPOSE,function(e){const n=e.frameState.layerStatesArray,r=this.getLayerState(!1);N(!n.some(function(o){return o.layer===r.layer}),67),n.push(r)},this),this.mapRenderKey_=Y(this,O.CHANGE,t.render,t),this.changed())}setSource(t){this.set(K.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function yr(s,t){if(!s.visible)return!1;const e=t.resolution;if(e<s.minResolution||e>=s.maxResolution)return!1;const i=t.zoom;return i>s.minZoom&&i<=s.maxZoom}const qn=ec;class ic extends Ks{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){A()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Ee(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Hs(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,o,a,l){let h;const c=e.viewState;function u(E,C,R,I){return r.call(o,C,E?R:null,I)}const d=c.projection,g=la(t.slice(),d),f=[[0,0]];if(d.canWrapX()&&n){const E=d.getExtent(),C=H(E);f.push([-C,0],[C,0])}const _=e.layerStatesArray,m=_.length,y=[],p=[];for(let E=0;E<f.length;E++)for(let C=m-1;C>=0;--C){const R=_[C],I=R.layer;if(I.hasRenderer()&&yr(R,c)&&a.call(l,I)){const w=I.getRenderer(),L=I.getSource();if(w&&L){const D=L.getWrapX()?g:t,z=u.bind(null,R.managed);p[0]=D[0]+f[E][0],p[1]=D[1]+f[E][1],h=w.forEachFeatureAtCoordinate(p,e,i,z,y)}if(h)return h}}if(y.length===0)return;const x=1/y.length;return y.forEach((E,C)=>E.distanceSq+=C*x),y.sort((E,C)=>E.distanceSq-C.distanceSq),y.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,r,o){return this.forEachFeatureAtCoordinate(t,e,i,n,pe,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){A()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Sn.canExpireCache()&&t.postRenderFunctions.push(nc)}}function nc(s,t){Sn.expire()}const sc=ic;class rc extends Mt{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}const wa=rc,an="ol-hidden",$n="ol-unselectable",pr="ol-control",fo="ol-collapsed",oc=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),_o=["style","variant","weight","size","lineHeight","family"],Ia=function(s){const t=s.match(oc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,n=_o.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[_o[i]]=r)}return e.families=e.family.split(/,\s?/),e};function ut(s,t,e,i){let n;return e&&e.length?n=e.shift():Zs?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}function Jn(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function mo(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Ds(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}function ac(s){for(;s.lastChild;)s.removeChild(s.lastChild)}function lc(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}const va="10px sans-serif",ft="#000",Pn="round",Jt=[],Qt=0,gi="round",Di=10,Oi="#000",bi="center",Fn="middle",Le=[0,0,0,0],ki=1,Zt=new Yt;let $e=null,Os;const bs={},hc=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10\uF013";let r,o;function a(h,c,u){let d=!0;for(let g=0;g<i;++g){const f=e[g];if(o=An(h+" "+c+" "+t+f,n),u!=f){const _=An(h+" "+c+" "+t+u+","+f,n);d=d&&_!=o}}return!!d}function l(){let h=!0;const c=Zt.getKeys();for(let u=0,d=c.length;u<d;++u){const g=c[u];Zt.get(g)<100&&(a.apply(this,g.split(`
|
|
2
|
+
`))?(_i(bs),$e=null,Os=void 0,Zt.set(g,100)):(Zt.set(g,Zt.get(g)+1,!0),h=!1))}h&&(clearInterval(r),r=void 0)}return function(h){const c=Ia(h);if(!c)return;const u=c.families;for(let d=0,g=u.length;d<g;++d){const f=u[d],_=c.style+`
|
|
3
|
+
`+c.weight+`
|
|
4
|
+
`+f;Zt.get(_)===void 0&&(Zt.set(_,100,!0),a(c.style,c.weight,f)||(Zt.set(_,0,!0),r===void 0&&(r=setInterval(l,32))))}}}(),cc=function(){let s;return function(t){let e=bs[t];if(e==null){if(Zs){const i=Ia(t),n=La(t,"\u017Dg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=t,document.body.appendChild(s),e=s.offsetHeight,document.body.removeChild(s);bs[t]=e}return e}}();function La(s,t){return $e||($e=ut(1,1)),s!=Os&&($e.font=s,Os=$e.font),$e.measureText(t)}function An(s,t){return La(s,t).width}function yo(s,t,e){if(t in e)return e[t];const i=t.split(`
|
|
5
|
+
`).reduce((n,r)=>Math.max(n,An(s,r)),0);return e[t]=i,i}function uc(s,t){const e=[],i=[],n=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
|
|
6
|
+
`||h===c){r=Math.max(r,o),n.push(o),o=0,a+=l;continue}const d=t[h+1]||s.font,g=An(d,u);e.push(g),o+=g;const f=cc(d);i.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function dc(s,t,e,i,n,r,o,a,l,h,c){s.save(),e!==1&&(s.globalAlpha*=e),t&&s.setTransform.apply(s,t),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),gc(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function gc(s,t){const e=s.contextInstructions;for(let i=0,n=e.length;i<n;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class fc extends sc{constructor(t){super(t),this.fontChangeListenerKey_=Y(Zt,hi.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=$n+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new wa(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){q(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Xt.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let r=null;for(let o=0,a=e.length;o<a;++o){const l=e[o];t.layerIndex=o;const h=l.layer,c=h.getSourceState();if(!yr(l,i)||c!="ready"&&c!="undefined"){h.unrender();continue}const u=h.render(t,r);!u||(u!==r&&(this.children_.push(u),r=u),"getDeclutter"in h&&n.push(h))}this.flushDeclutterItems(t),lc(this.element_,this.children_),this.dispatchRenderEvent(Xt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let i=e.length-1;i>=0;--i)e[i].renderDeclutter(t);e.length=0}}const _c=fc;class ge extends Mt{constructor(t,e){super(t),this.layer=e}}const ls={LAYERS:"layers"};class xr extends ra{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(ls.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Ct(i.slice(),{unique:!0}):N(typeof i.getArray=="function",43):i=new Ct(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(q),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Y(t,tt.ADD,this.handleLayersAdd_,this),Y(t,tt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(q);_i(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i<n;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ge("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[Y(t,hi.PROPERTYCHANGE,this.handleLayerChange_,this),Y(t,O.CHANGE,this.handleLayerChange_,this)];t instanceof xr&&e.push(Y(t,"addlayer",this.handleLayerGroupAdd_,this),Y(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[k(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ge("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ge("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ge("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=k(e);this.listenerKeys_[i].forEach(q),delete this.listenerKeys_[i],this.dispatchEvent(new ge("removelayer",e)),this.changed()}getLayers(){return this.get(ls.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let n=0,r=i.length;n<r;++n)this.dispatchEvent(new ge("removelayer",i[n]))}this.set(ls.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 n=this.getLayerState();let r=n.zIndex;!t&&n.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=n.opacity,l.visible=l.visible&&n.visible,l.maxResolution=Math.min(l.maxResolution,n.maxResolution),l.minResolution=Math.max(l.minResolution,n.minResolution),l.minZoom=Math.max(l.minZoom,n.minZoom),l.maxZoom=Math.min(l.maxZoom,n.maxZoom),n.extent!==void 0&&(l.extent!==void 0?l.extent=vi(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const Qn=xr;class mc extends Mt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}const Je=mc;class yc extends Je{constructor(t,e,i,n,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!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 Ht=yc,W={SINGLECLICK:"singleclick",CLICK:O.CLICK,DBLCLICK:O.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ks={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class pc extends zn{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_=Y(i,ks.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Y(i,ks.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(O.TOUCHMOVE,this.boundHandleTouchMove_,$o?{passive:!1}:!1)}emulateClick_(t){let e=new Ht(W.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ht(W.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new Ht(W.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==W.POINTERUP||e.type==W.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==e.target){delete this.trackedTouches_[n];break}}else(e.type==W.POINTERDOWN||e.type==W.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ht(W.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(q),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 Ht(W.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(Y(i,W.POINTERMOVE,this.handlePointerMove_,this),Y(i,W.POINTERUP,this.handlePointerUp_,this),Y(this.element_,W.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(Y(this.element_.getRootNode(),W.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ht(W.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 Ht(W.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_&&(q(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(O.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(q(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(q),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const xc=pc,de={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ot={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Dn=1/0;class Ec{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_i(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){N(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=Dn?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t<n>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<n&&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_,n=this.priorities_,r=i[e],o=n[e];for(;e>t;){const a=this.getParentIndex_(e);if(n[a]>o)i[e]=i[a],n[e]=n[a],e=a;else break}i[e]=r,n[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Dn?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,e[n++]=o);e.length=n,i.length=n,this.heapify_()}}const Cc=Ec,M={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Tc extends Cc{constructor(t,e){super(function(i){return t.apply(null,i)},function(i){return 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(O.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===M.LOADED||i===M.ERROR||i===M.EMPTY){i!==M.ERROR&&e.removeEventListener(O.CHANGE,this.boundHandleTileChange_);const n=e.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0,n,r,o;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;)r=this.dequeue()[0],o=r.getKey(),n=r.getState(),n===M.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}const Rc=Tc;function Sc(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return Dn;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}class wc extends Yt{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(){Ds(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&Ds(this.element);for(let e=0,i=this.listenerKeys.length;e<i;++e)q(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==ci&&this.listenerKeys.push(Y(t,de.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}const Er=wc;class Ic extends Er{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);const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",n=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"\u203A",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=n):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(O.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+$n+" "+pr+(this.collapsed_&&this.collapsible_?" "+fo:"")+(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=Array.from(new Set(this.getMap().getAllLayers().flatMap(n=>n.getAttributions(t)))),i=!this.getMap().getAllLayers().some(n=>n.getSource()&&n.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ie(e,this.renderedAttributions_)){ac(this.ulElement_);for(let n=0,r=e.length;n<r;++n){const o=document.createElement("li");o.innerHTML=e[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(fo),this.collapsed_?mo(this.collapseLabel_,this.label_):mo(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)}}const vc=Ic;class Lc extends Er{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:"\u21E7",n=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));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(O.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+$n+" "+pr,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(an)}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:mi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(an);!r&&i===0?this.element.classList.add(an):r&&i!==0&&this.element.classList.remove(an)}this.label_.style.transform=n}this.rotation_=i}}const Mc=Lc;class Pc extends Er{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,n=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(O.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(O.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+$n+" "+pr,g=this.element;g.className=d,g.appendChild(c),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:mi})):i.setZoom(r)}}}const Fc=Pc;function Ac(s){s=s||{};const t=new Ct;return(s.zoom!==void 0?s.zoom:!0)&&t.push(new Fc(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&t.push(new Mc(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&t.push(new vc(s.attributionOptions)),t}const Gs={ACTIVE:"active"};class Dc extends Yt{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(Gs.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Gs.ACTIVE,t)}setMap(t){this.map_=t}}function Oc(s,t,e){const i=s.getCenterInternal();if(i){const n=[i[0]+t[0],i[1]+t[1]];s.animateInternal({duration:e!==void 0?e:250,easing:Mh,center:s.getConstrainedCenter(n)})}}function Cr(s,t,e,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+t),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:mi})}const yi=Dc;class bc extends yi{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==W.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();Cr(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}const kc=bc;class Gc extends yi{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==W.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==W.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==W.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==W.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 Tr(s){const t=s.length;let e=0,i=0;for(let n=0;n<t;n++)e+=s[n].clientX,i+=s[n].clientY;return{clientX:e/t,clientY:i/t}}const Ne=Gc;function Ns(s){const t=arguments;return function(e){let i=!0;for(let n=0,r=t.length;n<r&&(i=i&&t[n](e),!!i);++n);return i}}const Nc=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Xc=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Wc=function(s){const t=s.map.getTargetElement(),e=s.map.getOwnerDocument().activeElement;return t.contains(e)},Ma=function(s){return s.map.getTargetElement().hasAttribute("tabindex")?Wc(s):!0},On=pe,po=function(s){return s.type==W.CLICK},Pa=function(s){const t=s.originalEvent;return t.button==0&&!(Ol&&Ho&&t.ctrlKey)},Xs=fi,Rr=function(s){return s.type==W.SINGLECLICK},Sr=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Yc=function(s){const t=s.originalEvent;return Ho?t.metaKey:t.ctrlKey},wr=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Fa=function(s){const t=s.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},hs=function(s){const t=s.originalEvent;return N(t!==void 0,56),t.pointerType=="mouse"},Aa=function(s){const t=s.originalEvent;return N(t!==void 0,56),t.isPrimary&&t.button===0};class zc extends Ne{constructor(t){super({stopDown:fi}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Ns(Sr,Aa);this.condition_=t.onFocusOnly?Ns(Ma,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Tr(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const r=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],a=t.map.getView();dh(r,a.getResolution()),tr(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,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 n=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(r),a[1]-n*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:mi})}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}}const Bc=zc;class Vc extends Ne{constructor(t){t=t||{},super({stopDown:fi}),this.condition_=t.condition?t.condition:Xc,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!hs(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ar)return;const n=e.getSize(),r=t.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return hs(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return hs(t)&&Pa(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const jc=Vc;class Kc extends Ks{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new Lt([n])}getGeometry(){return this.geometry_}}const Uc=Kc,ln={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class cs extends Mt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Zc extends Ne{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Uc(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Pa,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new cs(ln.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new cs(e?ln.BOXEND:ln.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new cs(ln.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}const Hc=Zc;class qc extends Hc{constructor(t){t=t||{};const e=t.condition?t.condition:wr;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:mi})}}const $c=qc,Se={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Jc extends yi{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Sr(e)&&Fa(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==O.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Se.DOWN||n==Se.LEFT||n==Se.RIGHT||n==Se.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;n==Se.DOWN?h=-a:n==Se.LEFT?l=-a:n==Se.RIGHT?l=a:h=a;const c=[l,h];tr(c,o.getRotation()),Oc(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}const Qc=Jc;class tu extends yi{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Yc(e)&&Fa(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==O.KEYDOWN||t.type==O.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==="+"||n==="-")){const r=t.map,o=n==="+"?this.delta_:-this.delta_,a=r.getView();Cr(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const eu=tu;class iu{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 n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const nu=iu;class su extends yi{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:On;this.condition_=t.onFocusOnly?Ns(Ma,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==O.WHEEL)return!0;const i=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let r;if(t.type==O.WHEEL&&(r=n.deltaY,Al&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=qo),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-Q(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Cr(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}const ru=su;class ou extends Ne{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=fi),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(this.lastAngle_!==void 0){const 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!==ar&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Tr(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}}const au=ou;class lu extends Ne{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=fi),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Tr(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}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}}const hu=lu;function Da(s){s=s||{};const t=new Ct,e=new nu(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&t.push(new jc),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&t.push(new kc({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&t.push(new Bc({onFocusOnly:s.onFocusOnly,kinetic:e})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&t.push(new au),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&t.push(new hu({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(t.push(new Qc),t.push(new eu({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&t.push(new ru({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&t.push(new $c({duration:s.zoomDuration})),t}function xo(s){return s[0]>0&&s[1]>0}function cu(s,t,e){return e===void 0&&(e=[0,0]),e[0]=s[0]*t+.5|0,e[1]=s[1]*t+.5|0,e}function It(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}function Oa(s){if(s instanceof qn){s.setMapInternal(null);return}s instanceof Qn&&s.getLayers().forEach(Oa)}function ba(s,t){if(s instanceof qn){s.setMapInternal(t);return}if(s instanceof Qn){const e=s.getLayers().getArray();for(let i=0,n=e.length;i<n;++i)ba(e[i],t)}}class uu extends Yt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=du(t);this.renderComplete_,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:qo,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Nt(),this.pixelToCoordinateTransform_=Nt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,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,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Ac(),this.interactions=e.interactions||Da({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Rc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ot.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ot.VIEW,this.handleViewChanged_),this.addChangeListener(ot.SIZE,this.handleSizeChanged_),this.addChangeListener(ot.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof bt)&&t.view.then(function(n){i.setView(new bt(n))}),this.controls.addEventListener(tt.ADD,n=>{n.element.setMap(this)}),this.controls.addEventListener(tt.REMOVE,n=>{n.element.setMap(null)}),this.interactions.addEventListener(tt.ADD,n=>{n.element.setMap(this)}),this.interactions.addEventListener(tt.REMOVE,n=>{n.element.setMap(null)}),this.overlays_.addEventListener(tt.ADD,n=>{this.addOverlayInternal_(n.element)}),this.overlays_.addEventListener(tt.REMOVE,n=>{const r=n.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],n.element.setMap(null)}),this.controls.forEach(n=>{n.setMap(this)}),this.interactions.forEach(n=>{n.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){ba(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 n=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:pe,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(n){i.push(n)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(n){n instanceof Qn?e(n.getLayers()):t.push(n)})}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 n=e.layerFilter!==void 0?e.layerFilter:pe,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=i.width/n[0],o=i.height/n[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(ot.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return di(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?st(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(ot.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ct){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 n=t[e];if(!n.visible)continue;const r=n.layer.getRenderer();if(r&&!r.ready)return!0;const o=n.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=$(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?st(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ot.SIZE)}getView(){return this.get(ot.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,n){return Sc(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Ht(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ks.POINTERDOWN||i===O.WHEEL||i===O.KEYDOWN){const n=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():n,o=e.target;if(this.overlayContainerStopEvent_.contains(o)||!(r===n?n.documentElement:r).contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const n=this.getInteractions().getArray().slice();for(let r=n.length-1;r>=0;r--){const o=n[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let n=this.maxTilesLoading_,r=n;if(t){const o=t.viewHints;if(o[at.ANIMATING]||o[at.INTERACTING]){const a=Date.now()-t.time>8;n=a?0:8,r=a?0:2}}e.getTilesLoading()<n&&(e.reprioritize(),e.loadMoreTiles(n,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_===!0?(this.hasListener(Xt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Xt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Je(de.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Je(de.LOADSTART,this,t))));const i=this.postRenderFunctions_;for(let n=0,r=i.length;n<r;++n)i[n](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,n=this.targetChangeHandlerKeys_.length;i<n;++i)q(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(O.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(O.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,Ds(this.viewport_)}if(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{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new _c(this)),this.mapBrowserEventHandler_=new xc(this,this.moveTolerance_);for(const r in W)this.mapBrowserEventHandler_.addEventListener(W[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(O.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(O.WHEEL,this.boundHandleBrowserEvent_,$o?{passive:!1}:!1);const i=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[Y(i,O.KEYDOWN,this.handleBrowserEvent,this),Y(i,O.KEYPRESS,this.handleBrowserEvent,this)];const n=e.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.observe(n.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(q(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(q(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=Y(t,hi.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Y(t,O.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(q),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ge("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Y(t,hi.PROPERTYCHANGE,this.render,this),Y(t,O.CHANGE,this.render,this),Y(t,"addlayer",this.handleLayerAdd_,this),Y(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(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const n=t[e].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;!t||this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Oa(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(e!==void 0&&xo(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_,declutterTree:null,extent:vs(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:k(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=vs(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),n&&(!this.previousExtent_||!Kn(this.previousExtent_)&&!Pi(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Je(de.MOVESTART,this,n)),this.previousExtent_=Wi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[at.ANIMATING]&&!r.viewHints[at.INTERACTING]&&!Pi(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Je(de.MOVEEND,this,r)),Qo(r.extent,this.previousExtent_))),this.dispatchEvent(new Je(de.POSTRENDER,this,r)),this.renderComplete_=this.hasListener(de.LOADSTART)||this.hasListener(de.LOADEND)||this.hasListener(Xt.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ge("removelayer",e)),this.set(ot.LAYERGROUP,t)}setSize(t){this.set(ot.SIZE,t)}setTarget(t){this.set(ot.TARGET,t)}setView(t){if(!t||t instanceof bt){this.set(ot.VIEW,t);return}this.set(ot.VIEW,new bt);const e=this;t.then(function(i){e.setView(new bt(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const n=getComputedStyle(t),r=t.offsetWidth-parseFloat(n.borderLeftWidth)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)-parseFloat(n.borderRightWidth),o=t.offsetHeight-parseFloat(n.borderTopWidth)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)-parseFloat(n.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[r,o],!xo(e)&&!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ca("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!ie(e,i))&&(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function du(s){let t=null;s.keyboardEventTarget!==void 0&&(t=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const e={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new Qn({layers:s.layers});e[ot.LAYERGROUP]=i,e[ot.TARGET]=s.target,e[ot.VIEW]=s.view instanceof bt?s.view:new bt;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new Ct(s.controls.slice()):(N(typeof s.controls.getArray=="function",47),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new Ct(s.interactions.slice()):(N(typeof s.interactions.getArray=="function",48),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new Ct(s.overlays.slice()):(N(typeof s.overlays.getArray=="function",49),o=s.overlays):o=new Ct,{controls:n,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Eo=uu;function gu(s,t,e,i,n){ka(s,t,e||0,i||s.length-1,n||fu)}function ka(s,t,e,i,n){for(;i>e;){if(i-e>600){var r=i-e+1,o=t-e+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/r+h)),u=Math.min(i,Math.floor(t+(r-o)*l/r+h));ka(s,t,c,u,n)}var d=s[t],g=e,f=i;for(Ti(s,e,t),n(s[i],d)>0&&Ti(s,e,i);g<f;){for(Ti(s,g,f),g++,f--;n(s[g],d)<0;)g++;for(;n(s[f],d)>0;)f--}n(s[e],d)===0?Ti(s,e,f):(f++,Ti(s,f,i)),f<=t&&(e=f+1),t<=f&&(i=f-1)}}function Ti(s,t,e){var i=s[t];s[t]=s[e],s[e]=i}function fu(s,t){return s<t?-1:s>t?1:0}class Ga{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(!cn(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?n(a):a;cn(t,l)&&(e.leaf?i.push(a):ds(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!cn(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],o=e.leaf?this.toBBox(r):r;if(cn(t,o)){if(e.leaf||ds(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=Qe([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=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=_u(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&ds(i,n)?(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,n){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=Qe(t.slice(e,i+1)),Ue(a,this.toBBox),a;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),a=Qe([]),a.leaf=!1,a.height=n;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Co(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Co(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const g=Math.min(d+l-1,u);a.children.push(this._build(t,d,g,n-1))}}return Ue(a,this.toBBox),a}_chooseSubtree(t,e,i,n){for(;n.push(e),!(e.leaf||n.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=us(h),u=pu(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 n=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(n,this.data,e,r);for(o.children.push(t),wi(o,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=Qe(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Ue(i,this.toBBox),Ue(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Qe([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ue(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=Si(t,0,a,this.toBBox),h=Si(t,a,i,this.toBBox),c=xu(l,h),u=us(l)+us(h);c<r?(r=c,n=a,o=u<o?u:o):c===r&&u<o&&(o=u,n=a)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:mu,r=t.leaf?this.compareMinY:yu,o=this._allDistMargin(t,e,i,n),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,o=Si(t,0,e,r),a=Si(t,i-e,i,r);let l=hn(o)+hn(a);for(let h=e;h<i-e;h++){const c=t.children[h];wi(o,t.leaf?r(c):c),l+=hn(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];wi(a,t.leaf?r(c):c),l+=hn(a)}return l}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)wi(e[n],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Ue(t[e],this.toBBox)}}function _u(s,t,e){if(!e)return t.indexOf(s);for(let i=0;i<t.length;i++)if(e(s,t[i]))return i;return-1}function Ue(s,t){Si(s,0,s.children.length,t,s)}function Si(s,t,e,i,n){n||(n=Qe(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=t;r<e;r++){const o=s.children[r];wi(n,s.leaf?i(o):o)}return n}function wi(s,t){return s.minX=Math.min(s.minX,t.minX),s.minY=Math.min(s.minY,t.minY),s.maxX=Math.max(s.maxX,t.maxX),s.maxY=Math.max(s.maxY,t.maxY),s}function mu(s,t){return s.minX-t.minX}function yu(s,t){return s.minY-t.minY}function us(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function hn(s){return s.maxX-s.minX+(s.maxY-s.minY)}function pu(s,t){return(Math.max(t.maxX,s.maxX)-Math.min(t.minX,s.minX))*(Math.max(t.maxY,s.maxY)-Math.min(t.minY,s.minY))}function xu(s,t){const e=Math.max(s.minX,t.minX),i=Math.max(s.minY,t.minY),n=Math.min(s.maxX,t.maxX),r=Math.min(s.maxY,t.maxY);return Math.max(0,n-e)*Math.max(0,r-i)}function ds(s,t){return s.minX<=t.minX&&s.minY<=t.minY&&t.maxX<=s.maxX&&t.maxY<=s.maxY}function cn(s,t){return t.minX<=s.maxX&&t.minY<=s.maxY&&t.maxX>=s.minX&&t.maxY>=s.minY}function Qe(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Co(s,t,e,i,n){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;gu(s,o,t,e,n),r.push(t,o,o,e)}}const J={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Ir{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=It(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Ir({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 A()}getImage(t){return A()}getHitDetectionImage(){return A()}getPixelRatio(t){return 1}getImageState(){return A()}getImageSize(){return A()}getOrigin(){return A()}getSize(){return A()}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_=It(t)}listenImageChange(t){A()}load(){A()}unlistenImageChange(t){A()}}const Na=Ir;function Gt(s){return Array.isArray(s)?sa(s):s}class vr extends Na{constructor(t){const e=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:1,rotateWithView:e,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.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius!==void 0?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new vr({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_;if(!t)return null;const 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.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(t){let e=this.canvas_[t];if(!e){const i=this.renderOptions_,n=ut(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvas_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return J.LOADED}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 n=this.radius_,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const R=n;n=r,r=R}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=n-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const g=e/2/d,f=e/2*(c/u),m=Math.sqrt((n+g)*(n+g)+f*f)-n;if(this.radius2_===void 0||t==="bevel")return m*2;const y=n*Math.sin(a),p=Math.sqrt(n*n-y*y),x=r-p,C=Math.sqrt(y*y+x*x)/y;if(C<=i){const R=C*e/2-r-n;return 2*Math.max(m,R)}return m*2}createRenderOptions(){let t=gi,e=0,i=null,n=0,r,o=0;this.stroke_&&(r=this.stroke_.getColor(),r===null&&(r=Oi),r=Gt(r),o=this.stroke_.getWidth(),o===void 0&&(o=ki),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=gi),e=this.stroke_.getMiterLimit(),e===void 0&&(e=Di));const a=this.calculateLineJoinSize_(t,o,e),l=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*l+a);return{strokeStyle:r,strokeWidth:o,size:h,lineDash:i,lineDashOffset:n,lineJoin:t,miterLimit:e}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvas_={},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 n=this.fill_.getColor();n===null&&(n=ft),e.fillStyle=Gt(n),e.fill()}this.stroke_&&(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())}createHitDetectionCanvas_(t){if(this.fill_){let e=this.fill_.getColor(),i=0;if(typeof e=="string"&&(e=Rn(e)),e===null?i=1:Array.isArray(e)&&(i=e.length===4?e[3]:1),i===0){const n=ut(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=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 n=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:n;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=ft,e.fill(),this.stroke_&&(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())}}const Xa=vr;class Lr extends Xa{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 Lr({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()}}const Vi=Lr;class Mr{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null}clone(){const t=this.getColor();return new Mr({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}const ee=Mr;class Pr{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 Pr({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}}const Ae=Pr;class me{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=To,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 me({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),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_=To,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Eu(s){let t;if(typeof s=="function")t=s;else{let e;Array.isArray(s)?e=s:(N(typeof s.getZIndex=="function",41),e=[s]),t=function(){return e}}return t}let gs=null;function Cu(s,t){if(!gs){const e=new ee({color:"rgba(255,255,255,0.4)"}),i=new Ae({color:"#3399CC",width:1.25});gs=[new me({image:new Vi({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return gs}function Fr(){const s={},t=[255,255,255,1],e=[0,153,255,1],i=3;return s.Polygon=[new me({fill:new ee({color:[255,255,255,.5]})})],s.MultiPolygon=s.Polygon,s.LineString=[new me({stroke:new Ae({color:t,width:i+2})}),new me({stroke:new Ae({color:e,width:i})})],s.MultiLineString=s.LineString,s.Circle=s.Polygon.concat(s.LineString),s.Point=[new me({image:new Vi({radius:i*2,fill:new ee({color:e}),stroke:new Ae({color:t,width:i/2})}),zIndex:1/0})],s.MultiPoint=s.Point,s.GeometryCollection=s.Polygon.concat(s.LineString,s.Point),s}function To(s){return s.getGeometry()}const Gi=me;function Wa(s,t,e){const i=s;let n=!0,r=!1,o=!1;const a=[Tn(i,O.LOAD,function(){o=!0,r||t()})];return i.src&&bl?(r=!0,i.decode().then(function(){n&&t()}).catch(function(l){n&&(o?t():e())})):a.push(Tn(i,O.ERROR,e)),function(){n=!1,a.forEach(q)}}let Ri=null;class Tu extends zn{constructor(t,e,i,n,r,o){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===J.LOADED){Ri||(Ri=ut(1,1,void 0,{willReadFrequently:!0})),Ri.drawImage(this.image_,0,0);try{Ri.getImageData(0,0,1,1),this.tainted_=!1}catch{Ri=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(O.CHANGE)}handleImageError_(){this.imageState_=J.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=J.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ut(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===J.IDLE){this.image_||this.initializeImage_(),this.imageState_=J.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=Wa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==J.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=na(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Ru(s,t,e,i,n,r){let o=Sn.get(t,i,r);return o||(o=new Tu(s,t,e,i,n,r),Sn.set(t,i,r,o)),o}function Ro(s,t,e,i){return e!==void 0&&i!==void 0?[e/s,i/t]:e!==void 0?e/s:i!==void 0?i/t:1}class Ar extends Na{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;N(!(a!==void 0&&o),4),N(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||k(o)),N(a!==void 0&&a.length>0,6),N(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),69);const l=t.src!==void 0?J.IDLE:J.LOADED;if(this.color_=t.color!==void 0?Rn(t.color):null,this.iconImage_=Ru(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,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 instanceof HTMLCanvasElement||u.src&&u.complete)h=u.width,c=u.height;else{this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(Ro(g[0],g[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(Ro(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 Ar({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale: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 n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==J.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()==J.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(O.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(O.CHANGE,t)}}const Ya=Ar,Su="#333";class Dr{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=It(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 ee({color:Su}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new Dr({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=It(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 wu=Dr;function So(s){return new Gi({fill:Ni(s,""),stroke:Xi(s,""),text:Iu(s),image:vu(s)})}function Ni(s,t){const e=s[t+"fill-color"];if(!!e)return e==="none"?null:new ee({color:e})}function Xi(s,t){const e=s[t+"stroke-width"],i=s[t+"stroke-color"];if(!(!e&&!i))return new Ae({width:e,color:i,lineCap:s[t+"stroke-line-cap"],lineJoin:s[t+"stroke-line-join"],lineDash:s[t+"stroke-line-dash"],lineDashOffset:s[t+"stroke-line-dash-offset"],miterLimit:s[t+"stroke-miter-limit"]})}function Iu(s){const t=s["text-value"];return t?new wu({text:t,font:s["text-font"],maxAngle:s["text-max-angle"],offsetX:s["text-offset-x"],offsetY:s["text-offset-y"],overflow:s["text-overflow"],placement:s["text-placement"],repeat:s["text-repeat"],scale:s["text-scale"],rotateWithView:s["text-rotate-with-view"],rotation:s["text-rotation"],textAlign:s["text-align"],justify:s["text-justify"],textBaseline:s["text-baseline"],padding:s["text-padding"],fill:Ni(s,"text-"),backgroundFill:Ni(s,"text-background-"),stroke:Xi(s,"text-"),backgroundStroke:Xi(s,"text-background-")}):void 0}function vu(s){const t=s["icon-src"],e=s["icon-img"];if(t||e)return new Ya({src:t,img:e,imgSize:s["icon-img-size"],anchor:s["icon-anchor"],anchorOrigin:s["icon-anchor-origin"],anchorXUnits:s["icon-anchor-x-units"],anchorYUnits:s["icon-anchor-y-units"],color:s["icon-color"],crossOrigin:s["icon-cross-origin"],offset:s["icon-offset"],displacement:s["icon-displacement"],opacity:s["icon-opacity"],scale:s["icon-scale"],width:s["icon-width"],height:s["icon-height"],rotation:s["icon-rotation"],rotateWithView:s["icon-rotate-with-view"],size:s["icon-size"],declutterMode:s["icon-declutter-mode"]});const i=s["shape-points"];if(i){const r="shape-";return new Xa({points:i,fill:Ni(s,r),stroke:Xi(s,r),radius:s["shape-radius"],radius1:s["shape-radius1"],radius2:s["shape-radius2"],angle:s["shape-angle"],displacement:s["shape-displacement"],rotation:s["shape-rotation"],rotateWithView:s["shape-rotate-with-view"],scale:s["shape-scale"],declutterMode:s["shape-declutter-mode"]})}const n=s["circle-radius"];if(n){const r="circle-";return new Vi({radius:n,fill:Ni(s,r),stroke:Xi(s,r),displacement:s["circle-displacement"],scale:s["circle-scale"],rotation:s["circle-rotation"],rotateWithView:s["circle-rotate-with-view"],declutterMode:s["circle-declutter-mode"]})}}const wo={RENDER_ORDER:"renderOrder"};class Lu extends qn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(wo.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Ga(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(wo.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=Cu;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof Gi)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const o=t[r];o instanceof Gi?n[r]=o:n[r]=So(o)}e=n}else e=So(t);this.style_=e,this.styleFunction_=t===null?void 0:Eu(this.style_),this.changed()}}const Mu=Lu,ji={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},un=[ji.FILL],ye=[ji.STROKE],Me=[ji.BEGIN_PATH],Io=[ji.CLOSE_PATH],P=ji;class Pu{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const za=Pu;class Fu extends za{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,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(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)n[0]=t[a],n[1]=t[a+1],jn(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(t,e,i,n,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=n);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let g=!0,f,_,m;for(f=e+n;f<i;f+=n)d[0]=t[f],d[1]=t[f+1],m=ws(h,d),m!==_?(g&&(a[l++]=c,a[l++]=u,g=!1),a[l++]=d[0],a[l++]=d[1]):m===nt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],g=!1):g=!0,c=d[0],u=d[1],_=m;return(r&&g||f===e+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,n,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const g=t.getEndss();d=0;for(let f=0,_=g.length;f<_;++f){const m=[];d=this.drawCustomCoordinates_(l,d,g[f],o,m),u.push(m)}this.instructions.push([P.CUSTOM,a,u,t,i,Fs]),this.hitDetectionInstructions.push([P.CUSTOM,a,u,t,n||i,Fs]);break;case"Polygon":case"MultiLineString":c=[],l=r=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([P.CUSTOM,a,c,t,i,Ai]),this.hitDetectionInstructions.push([P.CUSTOM,a,c,t,n||i,Ai]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([P.CUSTOM,a,h,t,i,_e]),this.hitDetectionInstructions.push([P.CUSTOM,a,h,t,n||i,_e]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([P.CUSTOM,a,h,t,i,_e]),this.hitDetectionInstructions.push([P.CUSTOM,a,h,t,n||i,_e]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([P.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([P.CUSTOM,a,h,t,n||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[P.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[P.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,r,o=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==P.END_GEOMETRY?o=e:r==P.BEGIN_GEOMETRY&&(n[2]=e,Tl(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const n=t.getColor();i.fillStyle=Gt(n||ft)}else i.fillStyle=void 0;if(e){const n=e.getColor();i.strokeStyle=Gt(n||Oi);const r=e.getLineCap();i.lineCap=r!==void 0?r:Pn;const o=e.getLineDash();i.lineDash=o?o.slice():Jt;const a=e.getLineDashOffset();i.lineDashOffset=a||Qt;const l=e.getLineJoin();i.lineJoin=l!==void 0?l:gi;const h=e.getWidth();i.lineWidth=h!==void 0?h:ki;const c=e.getMiterLimit();i.miterLimit=c!==void 0?c:Di,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[P.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[P.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!ie(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[P.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Qo(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Vn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const Ki=Fu;class Au extends Ki{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([P.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([P.DRAW_IMAGE,r,o,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){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([P.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([P.DRAW_IMAGE,r,o,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(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Du=Au;class Ou extends Ki{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[P.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([P.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Jt,Qt],Me);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ye),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([P.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Jt,Qt],Me);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(ye),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ye),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ye),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Me)}}const bu=Ou;class ku extends Ki{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Me),this.hitDetectionInstructions.push(Me);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,n,!0,!a),g=[P.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(Io),this.hitDetectionInstructions.push(Io)),e=c}return o&&(this.instructions.push(un),this.hitDetectionInstructions.push(un)),a&&(this.instructions.push(ye),this.hitDetectionInstructions.push(ye)),e}drawCircle(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_FILL_STYLE,ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Jt,Qt]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[P.CIRCLE,l];this.instructions.push(Me,h),this.hitDetectionInstructions.push(Me,h),i.fillStyle!==void 0&&(this.instructions.push(un),this.hitDetectionInstructions.push(un)),i.strokeStyle!==void 0&&(this.instructions.push(ye),this.hitDetectionInstructions.push(ye)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_FILL_STYLE,ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Jt,Qt]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_FILL_STYLE,ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([P.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Jt,Qt]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinatess_(a,h,o[c],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=we(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}const vo=ku;function Gu(s,t,e,i,n){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<s&&o+n<i;){const[h,c]=l.slice(-2),u=t[o+n],d=t[o+n+1],g=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=g,a>=s){const f=(s-a+g)/g,_=Et(h,u,f),m=Et(c,d,f);l.push(_,m),r.push(l),l=[_,m],a==s&&(o+=n),a=0}else if(a<s)l.push(t[o+n],t[o+n+1]),o+=n;else{const f=g-a,_=Et(h,u,f/g),m=Et(c,d,f/g);l.push(_,m),r.push(l),l=[_,m],a=0,o+=n}}return a>0&&r.push(l),r}function Nu(s,t,e,i,n){let r=e,o=e,a=0,l=0,h=e,c,u,d,g,f,_,m,y,p,x;for(u=e;u<i;u+=n){const E=t[u],C=t[u+1];f!==void 0&&(p=E-f,x=C-_,g=Math.sqrt(p*p+x*x),m!==void 0&&(l+=d,c=Math.acos((m*p+y*x)/(d*g)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=g,m=p,y=x),f=E,_=C}return l+=g,l>a?[h,u]:[r,o]}const bn={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Xu extends Ki{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ft]={fillStyle:ft},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!ht(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const _=t.getEndss();u=[];for(let m=0,y=_.length;m<y;++m)u.push(_[m][0])}this.beginGeometry(t,e);const d=r.repeat,g=d?void 0:r.textAlign;let f=0;for(let _=0,m=u.length;_<m;++_){let y;d?y=Gu(d*this.resolution,h,f,u[_],c):y=[h.slice(f,u[_])];for(let p=0,x=y.length;p<x;++p){const E=y[p];let C=0,R=E.length;if(g==null){const w=Nu(r.maxAngle,E,0,E.length,2);C=w[0],R=w[1]}for(let w=C;w<R;w+=c)o.push(E[w],E[w+1]);const I=o.length;f=u[_],this.drawChars_(a,I),a=I}}this.endGeometry(e)}else{let u=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),r.overflow||u.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const y=t.getFlatInteriorPoints();h=[];for(let p=0,x=y.length;p<x;p+=3)r.overflow||u.push(y[p+2]/this.resolution),h.push(y[p],y[p+1]);if(h.length===0)return;c=2;break}const d=this.appendFlatPointCoordinates(h,c);if(d===a)return;if(u&&(d-a)/2!==h.length/c){let y=a/2;u=u.filter((p,x)=>{const E=o[(y+x)*2]===h[x*c]&&o[(y+x)*2+1]===h[x*c+1];return E||--y,E})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&this.updateFillStyle(this.state,this.createFill),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let g=r.padding;if(g!=Le&&(r.scale[0]<0||r.scale[1]<0)){let y=r.padding[0],p=r.padding[1],x=r.padding[2],E=r.padding[3];r.scale[0]<0&&(p=-p,E=-E),r.scale[1]<0&&(y=-y,x=-x),g=[y,p,x,E]}const f=this.pixelRatio;this.instructions.push([P.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==Le?Le:g.map(function(y){return y*f}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const _=1/f,m=this.state.fillStyle;r.backgroundFill&&(this.state.fillStyle=ft,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([P.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,void 0,this.declutterImageWithText_,g,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ft:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),r.backgroundFill&&(this.state.fillStyle=m,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||bi,justify:e.justify,textBaseline:e.textBaseline||Fn,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=bn[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([P.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([P.DRAW_CHARS,t,e,h,n.overflow,a&&ft,n.maxAngle,1,c,r,d,u,o,1/l])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Gt(o.getColor()||ft)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const f=a.getLineDash(),_=a.getLineDashOffset(),m=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Pn,r.lineDash=f?f.slice():Jt,r.lineDashOffset=_===void 0?Qt:_,r.lineJoin=a.getLineJoin()||gi,r.lineWidth=m===void 0?ki:m,r.miterLimit=y===void 0?Di:y,r.strokeStyle=Gt(a.getColor()||Oi)}i=this.textState_;const l=t.getFont()||va;hc(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()||Fn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Le,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),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.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:k(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_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+k(n.fillStyle):""}this.declutterImageWithText_=e}}const Wu={Circle:vo,Default:Ki,Image:Du,LineString:bu,Polygon:vo,Text:Xu};class Yu{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(r===void 0){const o=Wu[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}const Lo=Yu;class zu extends Uo{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return A()}getData(t){return null}prepareFrame(t){return A()}renderFrame(t,e){return A()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,o)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===J.LOADED||e.getState()===J.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=J.LOADED&&e!=J.ERROR&&t.addEventListener(O.CHANGE,this.boundHandleImageChange_),e==J.IDLE&&(t.load(),e=t.getState()),e==J.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Bu=zu,Mo=[];let ti=null;function Vu(){ti=ut(1,1,void 0,{willReadFrequently:!0})}class ju extends Bu{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Nt(),this.pixelTransform=Nt(),this.inversePixelTransform=Nt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){ti||Vu(),ti.clearRect(0,0,1,1);let n;try{ti.drawImage(t,e,i,1,1,0,0,1,1),n=ti.getImageData(0,0,1,1).data}catch{return ti=null,null}return n}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ie(Rn(t.style.backgroundColor),Rn(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ut();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),r=zi(i),o=Yi(i),a=ui(i);st(e.coordinateToPixelTransform,n),st(e.coordinateToPixelTransform,r),st(e.coordinateToPixelTransform,o),st(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;st(l,n),st(l,r),st(l,o),st(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new wa(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Xt.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Xt.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,o,a){const l=r/2,h=o/2,c=n/e,u=-c,d=-t[0]+a,g=-t[1];return Ee(this.tempTransform,l,h,c,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Ba=ju;function Ku(s,t,e,i,n,r,o,a,l,h,c,u){let d=s[t],g=s[t+1],f=0,_=0,m=0,y=0;function p(){f=d,_=g,t+=i,d=s[t],g=s[t+1],y+=m,m=Math.sqrt((d-f)*(d-f)+(g-_)*(g-_))}do p();while(t<e-i&&y+m<r);let x=m===0?0:(r-y)/m;const E=Et(f,d,x),C=Et(_,g,x),R=t-i,I=y,w=r+a*l(h,n,c);for(;t<e-i&&y+m<w;)p();x=m===0?0:(w-y)/m;const L=Et(f,d,x),D=Et(_,g,x);let z;if(u){const F=[E,C,L,D];lr(F,0,4,2,u,F,F),z=F[0]>F[2]}else z=E>L;const X=Math.PI,G=[],et=R+i===t;t=R,m=0,y=I,d=s[t],g=s[t+1];let v;if(et){p(),v=Math.atan2(g-_,d-f),z&&(v+=v>0?-X:X);const F=(L+E)/2,S=(D+C)/2;return G[0]=[F,S,(w-r)/2,v,n],G}n=n.replace(/\n/g," ");for(let F=0,S=n.length;F<S;){p();let b=Math.atan2(g-_,d-f);if(z&&(b+=b>0?-X:X),v!==void 0){let V=b-v;if(V+=V>X?-2*X:V<-X?2*X:0,Math.abs(V)>o)return null}v=b;const U=F;let j=0;for(;F<S;++F){const V=z?S-F-1:F,Z=a*l(h,n[V],c);if(t+i<e&&y+m<r+j+Z/2)break;j+=Z}if(F===U)continue;const it=z?n.substring(S-U,S-F):n.substring(U,F);x=m===0?0:(r+j/2-y)/m;const T=Et(f,d,x),_t=Et(_,g,x);G.push([T,_t,j/2,b,it]),r+=j}return G}function Va(s,t,e,i){let n=s[t],r=s[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=s[a],h=s[a+1];o+=Math.sqrt((l-n)*(l-n)+(h-r)*(h-r)),n=l,r=h}return o}const Ze=vt(),le=[],Kt=[],Ut=[],he=[];function Po(s){return s[3].declutterBox}const Fo=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function fs(s,t){return t==="start"?t=Fo.test(s)?"right":"left":t==="end"&&(t=Fo.test(s)?"left":"right"),bn[t]}function Uu(s,t,e){return e>0&&s.push(`
|
|
7
|
+
`,""),s.push(t,""),s}class Zu{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Nt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?bn[l.justify]:fs(Array.isArray(t)?t[0]:t,l.textAlign||bi),g=n&&o.lineWidth?o.lineWidth:0,f=u?t:t.split(`
|
|
8
|
+
`).reduce(Uu,[]),{width:_,height:m,widths:y,heights:p,lineWidths:x}=uc(l,f),E=_+g,C=[],R=(E+2)*c[0],I=(m+g)*c[1],w={width:R<0?Math.floor(R):Math.ceil(R),height:I<0?Math.floor(I):Math.ceil(I),contextInstructions:C};(c[0]!=1||c[1]!=1)&&C.push("scale",c),n&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",g),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),i&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const L=.5-d;let D=d*E+L*g;const z=[],X=[];let G=0,et=0,v=0,F=0,S;for(let b=0,U=f.length;b<U;b+=2){const j=f[b];if(j===`
|
|
9
|
+
`){et+=G,G=0,D=d*E+L*g,++F;continue}const it=f[b+1]||l.font;it!==S&&(n&&z.push("font",it),i&&X.push("font",it),S=it),G=Math.max(G,p[v]);const T=[j,D+L*y[v]+d*(y[v]-x[F]),.5*(g+G)+et];D+=y[v],n&&z.push("strokeText",T),i&&X.push("fillText",T),++v}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,X),this.labels_[r]=w,w}replayTextBackground_(t,e,i,n,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignFill_=o[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,o,a,l,h,c,u,d,g,f,_,m){a*=d[0],l*=d[1];let y=i-a,p=n-l;const x=r+h>t?t-h:r,E=o+c>e?e-c:o,C=f[3]+x*d[0]+f[1],R=f[0]+E*d[1]+f[2],I=y-f[3],w=p-f[0];(_||u!==0)&&(le[0]=I,he[0]=I,le[1]=w,Kt[1]=w,Kt[0]=I+C,Ut[0]=Kt[0],Ut[1]=w+R,he[1]=Ut[1]);let L;return u!==0?(L=Ee(Nt(),i,n,1,1,u,-i,-n),st(L,le),st(L,Kt),st(L,Ut),st(L,he),te(Math.min(le[0],Kt[0],Ut[0],he[0]),Math.min(le[1],Kt[1],Ut[1],he[1]),Math.max(le[0],Kt[0],Ut[0],he[0]),Math.max(le[1],Kt[1],Ut[1],he[1]),Ze)):te(Math.min(I,I+C),Math.min(w,w+R),Math.max(I,I+C),Math.max(w,w+R),Ze),g&&(y=Math.round(y),p=Math.round(p)),{drawImageX:y,drawImageY:p,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:Ze[0],minY:Ze[1],maxX:Ze[2],maxY:Ze[3],value:m},canvasTransform:L,scale:d}}replayImageOrLabel_(t,e,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=t.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,le,Kt,Ut,he,o,a),dc(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=st(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=fs(Array.isArray(t)?t[0]:t,r.textAlign||bi),c=bn[r.textBaseline||Fn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],g=h*d+2*(.5-h)*u,f=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:g,anchorY:f}}execute_(t,e,i,n,r,o,a,l){let h;this.pixelCoordinates_&&ie(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Fe(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Gl(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,f,_,m,y,p,x,E,C,R,I,w,L=0,D=0,z=null,X=null;const G=this.coordinateCache_,et=this.viewRotation_,v=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:et},S=this.instructions!=n||this.overlaps?0:200;let b,U,j,it;for(;c<u;){const T=n[c];switch(T[0]){case P.BEGIN_GEOMETRY:b=T[1],it=T[3],b.getGeometry()?a!==void 0&&!ht(a,it.getExtent())?c=T[2]+1:++c:c=T[2];break;case P.BEGIN_PATH:L>S&&(this.fill_(t),L=0),D>S&&(t.stroke(),D=0),!L&&!D&&(t.beginPath(),m=NaN,y=NaN),++c;break;case P.CIRCLE:d=T[1];const V=h[d],Z=h[d+1],se=h[d+2],Ot=h[d+3],rt=se-V,zt=Ot-Z,Xe=Math.sqrt(rt*rt+zt*zt);t.moveTo(V+Xe,Z),t.arc(V,Z,Xe,0,2*Math.PI,!0),++c;break;case P.CLOSE_PATH:t.closePath(),++c;break;case P.CUSTOM:d=T[1],g=T[2];const Ui=T[3],We=T[4],Zi=T.length==6?T[5]:void 0;F.geometry=Ui,F.feature=b,c in G||(G[c]=[]);const re=G[c];Zi?Zi(h,d,g,2,re):(re[0]=h[d],re[1]=h[d+1],re.length=2),We(re,F),++c;break;case P.DRAW_IMAGE:d=T[1],g=T[2],E=T[3],f=T[4],_=T[5];let pi=T[6];const oe=T[7],Hi=T[8],qi=T[9],$i=T[10];let Ye=T[11];const is=T[12];let dt=T[13];const Tt=T[14],Pt=T[15];if(!E&&T.length>=20){C=T[19],R=T[20],I=T[21],w=T[22];const mt=this.drawLabelWithPointPlacement_(C,R,I,w);E=mt.label,T[3]=E;const Ve=T[23];f=(mt.anchorX-Ve)*this.pixelRatio,T[4]=f;const Rt=T[24];_=(mt.anchorY-Rt)*this.pixelRatio,T[5]=_,pi=E.height,T[6]=pi,dt=E.width,T[13]=dt}let Bt;T.length>25&&(Bt=T[25]);let ze,Te,ae;T.length>17?(ze=T[16],Te=T[17],ae=T[18]):(ze=Le,Te=!1,ae=!1),$i&&v?Ye+=et:!$i&&!v&&(Ye-=et);let Be=0;for(;d<g;d+=2){if(Bt&&Bt[Be++]<dt/this.pixelRatio)continue;const mt=this.calculateImageOrLabelDimensions_(E.width,E.height,h[d],h[d+1],dt,pi,f,_,Hi,qi,Ye,is,r,ze,Te||ae,b),Ve=[t,e,E,mt,oe,Te?z:null,ae?X:null];if(l){if(Tt==="none")continue;if(Tt==="obstacle"){l.insert(mt.declutterBox);continue}else{let Rt,Vt;if(Pt){const yt=g-d;if(!Pt[yt]){Pt[yt]=Ve;continue}if(Rt=Pt[yt],delete Pt[yt],Vt=Po(Rt),l.collides(Vt))continue}if(l.collides(mt.declutterBox))continue;Rt&&(l.insert(Vt),this.replayImageOrLabel_.apply(this,Rt)),l.insert(mt.declutterBox)}}this.replayImageOrLabel_.apply(this,Ve)}++c;break;case P.DRAW_CHARS:const Ji=T[1],lt=T[2],ns=T[3],fl=T[4];w=T[5];const _l=T[6],Br=T[7],Vr=T[8];I=T[9];const ss=T[10];C=T[11],R=T[12];const jr=[T[13],T[13]],rs=this.textStates[R],xi=rs.font,Ei=[rs.scale[0]*Br,rs.scale[1]*Br];let Ci;xi in this.widths_?Ci=this.widths_[xi]:(Ci={},this.widths_[xi]=Ci);const Kr=Va(h,Ji,lt,2),Ur=Math.abs(Ei[0])*yo(xi,C,Ci);if(fl||Ur<=Kr){const mt=this.textStates[R].textAlign,Ve=(Kr-Ur)*fs(C,mt),Rt=Ku(h,Ji,lt,2,C,Ve,_l,Math.abs(Ei[0]),yo,xi,Ci,v?0:this.viewRotation_);t:if(Rt){const Vt=[];let yt,Qi,tn,gt,St;if(I)for(yt=0,Qi=Rt.length;yt<Qi;++yt){St=Rt[yt],tn=St[4],gt=this.createLabel(tn,R,"",I),f=St[2]+(Ei[0]<0?-ss:ss),_=ns*gt.height+(.5-ns)*2*ss*Ei[1]/Ei[0]-Vr;const jt=this.calculateImageOrLabelDimensions_(gt.width,gt.height,St[0],St[1],gt.width,gt.height,f,_,0,0,St[3],jr,!1,Le,!1,b);if(l&&l.collides(jt.declutterBox))break t;Vt.push([t,e,gt,jt,1,null,null])}if(w)for(yt=0,Qi=Rt.length;yt<Qi;++yt){St=Rt[yt],tn=St[4],gt=this.createLabel(tn,R,w,""),f=St[2],_=ns*gt.height-Vr;const jt=this.calculateImageOrLabelDimensions_(gt.width,gt.height,St[0],St[1],gt.width,gt.height,f,_,0,0,St[3],jr,!1,Le,!1,b);if(l&&l.collides(jt.declutterBox))break t;Vt.push([t,e,gt,jt,1,null,null])}l&&l.load(Vt.map(Po));for(let jt=0,ml=Vt.length;jt<ml;++jt)this.replayImageOrLabel_.apply(this,Vt[jt])}}++c;break;case P.END_GEOMETRY:if(o!==void 0){b=T[1];const mt=o(b,it);if(mt)return mt}++c;break;case P.FILL:S?L++:this.fill_(t),++c;break;case P.MOVE_TO_LINE_TO:for(d=T[1],g=T[2],U=h[d],j=h[d+1],p=U+.5|0,x=j+.5|0,(p!==m||x!==y)&&(t.moveTo(U,j),m=p,y=x),d+=2;d<g;d+=2)U=h[d],j=h[d+1],p=U+.5|0,x=j+.5|0,(d==g-2||p!==m||x!==y)&&(t.lineTo(U,j),m=p,y=x);++c;break;case P.SET_FILL_STYLE:z=T,this.alignFill_=T[2],L&&(this.fill_(t),L=0,D&&(t.stroke(),D=0)),t.fillStyle=T[1],++c;break;case P.SET_STROKE_STYLE:X=T,D&&(t.stroke(),D=0),this.setStrokeStyle_(t,T),++c;break;case P.STROKE:S?D++:t.stroke(),++c;break;default:++c;break}}L&&this.fill_(t),D&&t.stroke()}execute(t,e,i,n,r,o){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,1,e,this.hitDetectionInstructions,!0,n,r)}}const Hu=Zu,_s=["Polygon","Circle","LineString","Image","Text","Default"];class qu{constructor(t,e,i,n,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Nt(),this.createExecutors_(r)}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){for(const e in t){let i=this.executorsByZIndex_[e];i===void 0&&(i={},this.executorsByZIndex_[e]=i);const n=t[e];for(const r in n){const o=n[r];i[r]=new Hu(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let n=0,r=t.length;n<r;++n)if(t[n]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,o){n=Math.round(n);const a=n*2+1,l=Ee(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ut(a,a,void 0,{willReadFrequently:!0}));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=vt(),Ii(u,t),Vn(u,e*(this.renderBuffer_+n),u));const d=$u(n);let g;function f(C,R){const I=c.getImageData(0,0,a,a).data;for(let w=0,L=d.length;w<L;w++)if(I[d[w]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(C)){const D=(d[w]-3)/4,z=n-D%a,X=n-(D/a|0),G=r(C,R,z*z+X*X);if(G)return G}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Oe);let m,y,p,x,E;for(m=_.length-1;m>=0;--m){const C=_[m].toString();for(p=this.executorsByZIndex_[C],y=_s.length-1;y>=0;--y)if(g=_s[y],x=p[g],x!==void 0&&(E=x.executeHitDetection(c,l,i,f,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return Fe(a,0,8,2,t,a),a}isEmpty(){return Mi(this.executorsByZIndex_)}execute(t,e,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Oe),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||_s;let h,c,u,d,g,f;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const _=l[h].toString();for(g=this.executorsByZIndex_[_],u=0,d=o.length;u<d;++u){const m=o[u];f=g[m],f!==void 0&&f.execute(t,e,i,n,r,a)}}this.maxExtent_&&t.restore()}}const ms={};function $u(s){if(ms[s]!==void 0)return ms[s];const t=s*2+1,e=s*s,i=new Array(e+1);for(let r=0;r<=s;++r)for(let o=0;o<=s;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*t+(s+o))*4+3),r>0&&l.push(((s-r)*t+(s+o))*4+3),o>0&&(l.push(((s+r)*t+(s-o))*4+3),r>0&&l.push(((s-r)*t+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r<o;++r)i[r]&&n.push(...i[r]);return ms[s]=n,n}const Ao=qu;class Ju extends za{constructor(t,e,i,n,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Un(Math.atan2(n[1],n[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_=Nt()}drawImages_(t,e,i,n){if(!this.image_)return;const r=Fe(t,e,i,n,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_,g=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const f=d+this.imageAnchorX_,_=g+this.imageAnchorY_;Ee(a,f,_,1,1,h,-f,-_),o.setTransform.apply(o,a),o.translate(f,_),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.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Fe(t,e,i,n,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+=n){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(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.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,n,r){const o=this.context_,a=Fe(t,e,i,n,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,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Oh(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),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,n=e.length;i<n;++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_)),!!ht(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(!!ht(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=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_(n,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_)),!!ht(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_)),!!ht(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 n=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];n=this.drawRings_(i,n,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),ie(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_,n=t.textAlign?t.textAlign:bi;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:Gt(i||ft)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),n=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||Jt;this.strokeState_={lineCap:n!==void 0?n:Pn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Qt)*this.pixelRatio_,lineJoin:a!==void 0?a:gi,lineWidth:(l!==void 0?l:ki)*this.pixelRatio_,miterLimit:h!==void 0?h:Di,strokeStyle:Gt(i||Oi)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:Gt(g||ft)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),f=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),y=i.getLineJoin(),p=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:f!==void 0?f:Pn,lineDash:_||Jt,lineDashOffset:m||Qt,lineJoin:y!==void 0?y:gi,lineWidth:p!==void 0?p:ki,miterLimit:x!==void 0?x:Di,strokeStyle:Gt(g||Oi)}}const n=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:n!==void 0?n:va,textAlign:u!==void 0?u:bi,textBaseline:d!==void 0?d:Fn},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,f,_)=>g+=_%2?" ":f,""):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 Qu=Ju,kt=.5;function td(s,t,e,i,n,r,o){const a=s[0]*kt,l=s[1]*kt,h=ut(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new Qu(h,kt,n,null,o),d=e.length,g=Math.floor((256*256*256-1)/d),f={};for(let m=1;m<=d;++m){const y=e[m-1],p=y.getStyleFunction()||i;if(!p)continue;let x=p(y,r);if(!x)continue;Array.isArray(x)||(x=[x]);const C=(m*g).toString(16).padStart(7,"#00000");for(let R=0,I=x.length;R<I;++R){const w=x[R],L=w.getGeometryFunction()(y);if(!L||!ht(n,L.getExtent()))continue;const D=w.clone(),z=D.getFill();z&&z.setColor(C);const X=D.getStroke();X&&(X.setColor(C),X.setLineDash(null)),D.setText(void 0);const G=w.getImage();if(G){const S=G.getImageSize();if(!S)continue;const b=ut(S[0],S[1],void 0,{alpha:!1}),U=b.canvas;b.fillStyle=C,b.fillRect(0,0,U.width,U.height),D.setImage(new Ya({img:U,imgSize:S,anchor:G.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:G.getOrigin(),opacity:1,size:G.getSize(),scale:G.getScale(),rotation:G.getRotation(),rotateWithView:G.getRotateWithView()}))}const et=D.getZIndex()||0;let v=f[et];v||(v={},f[et]=v,v.Polygon=[],v.Circle=[],v.LineString=[],v.Point=[]);const F=L.getType();if(F==="GeometryCollection"){const S=L.getGeometriesArrayRecursive();for(let b=0,U=S.length;b<U;++b){const j=S[b];v[j.getType().replace("Multi","")].push(j,D)}}else v[F.replace("Multi","")].push(L,D)}}const _=Object.keys(f).map(Number).sort(Oe);for(let m=0,y=_.length;m<y;++m){const p=f[_[m]];for(const x in p){const E=p[x];for(let C=0,R=E.length;C<R;C+=2){u.setStyle(E[C+1]);for(let I=0,w=t.length;I<w;++I)u.setTransform(t[I]),u.drawGeometry(E[C])}}}return h.getImageData(0,0,c.width,c.height)}function ed(s,t,e){const i=[];if(e){const n=Math.floor(Math.round(s[0])*kt),r=Math.floor(Math.round(s[1])*kt),o=(Q(n,0,e.width-1)+Q(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 id=.5,ja={Point:ud,LineString:ld,Polygon:gd,MultiPoint:dd,MultiLineString:hd,MultiPolygon:cd,GeometryCollection:ad,Circle:rd};function nd(s,t){return parseInt(k(s),10)-parseInt(k(t),10)}function sd(s,t){const e=Ws(s,t);return e*e}function Ws(s,t){return id*s/t}function rd(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Do(s,t,e,i,n,r,o){let a=!1;const l=e.getImage();if(l){const h=l.getImageState();h==J.LOADED||h==J.ERROR?l.unlistenImageChange(n):(h==J.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return od(s,t,e,i,r,o),a}function od(s,t,e,i,n,r){const o=e.getGeometryFunction()(t);if(!o)return;const a=o.simplifyTransformed(i,n);if(e.getRenderer())Ka(s,a,e,t);else{const h=ja[a.getType()];h(s,a,e,t,r)}}function Ka(s,t,e,i){if(t.getType()=="GeometryCollection"){const r=t.getGeometries();for(let o=0,a=r.length;o<a;++o)Ka(s,r[o],e,i);return}s.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer())}function ad(s,t,e,i,n){const r=t.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o){const l=ja[r[o].getType()];l(s,r[o],e,i,n)}}function ld(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i)}const o=e.getText();if(o&&o.getText()){const a=(n||s).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function hd(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i)}const o=e.getText();if(o&&o.getText()){const a=(n||s).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function cd(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(o||r){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function ud(s,t,e,i,n){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=J.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawPoint(t,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}function dd(s,t,e,i,n){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=J.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawMultiPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawMultiPoint(t,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}function gd(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}class fd extends Ba{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=vt(),this.wrappedRenderedExtent_=vt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=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=e.pixelRatio,g=e.viewHints,f=!(g[at.ANIMATING]||g[at.INTERACTING]),_=this.compositionContext_,m=Math.round(e.size[0]*d),y=Math.round(e.size[1]*d),p=u.getWrapX()&&l.canWrapX(),x=p?H(c):null,E=p?Math.ceil((n[2]-c[2])/x)+1:1;let C=p?Math.floor((n[0]-c[0])/x):0;do{const R=this.getRenderTransform(o,a,h,d,m,y,C*x);t.execute(_,1,R,h,f,void 0,i)}while(++C<E)}setupCompositionContext_(){if(this.opacity_!==1){const t=ut(this.context.canvas.width,this.context.canvas.height,Mo);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,Jn(this.compositionContext_),Mo.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];Nl(this.pixelTransform,1/i,1/i),Hs(this.inversePixelTransform,this.pixelTransform);const r=Jo(this.pixelTransform);this.useContainer(e,r,this.getBackground(t));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;let c=l&&!l.isEmpty()||h&&!h.isEmpty();if(!c&&!(this.getLayer().hasListener(Xt.PRERENDER)||this.getLayer().hasListener(Xt.POSTRENDER)))return null;const u=Math.round(t.size[0]*i),d=Math.round(t.size[1]*i);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,u,d),this.preRender(o,t);const g=t.viewState;g.projection,this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1;if(c&&n.extent&&this.clipping){const _=fe(n.extent);c=ht(_,t.extent),f=c&&!ei(_,t.extent),f&&this.clipUnrotated(this.compositionContext_,t,_)}return c&&this.renderWorlds(l,t),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];st(this.pixelTransform,i);const n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*kt,d=i[1]*kt;c.push(this.getRenderTransform(n,r,o,kt,u,d,0).slice());const g=h.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!ei(f,l)){let _=l[0];const m=H(f);let y=0,p;for(;_<f[0];)--y,p=m*y,c.push(this.getRenderTransform(n,r,o,kt,u,d,p).slice()),_+=m;for(y=0,_=l[2];_>f[2];)++y,p=m*y,c.push(this.getRenderTransform(n,r,o,kt,u,d,p).slice()),_-=m}this.hitDetectionImageData_=td(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(ed(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(g,f,_){const m=k(g),y=h[m];if(y){if(y!==!0&&_<y.distanceSq){if(_===0)return h[m]=!0,r.splice(r.lastIndexOf(y),1),n(g,l,f);y.geometry=f,y.distanceSq=_}}else{if(_===0)return h[m]=!0,n(g,l,f);r.push(h[m]={feature:g,layer:l,geometry:f,distanceSq:_,callback:n})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(g=>u=g.forEachFeatureAtCoordinate(t,o,a,i,c,g===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(f=>f.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[at.ANIMATING],r=t.viewHints[at.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,g=e.getRevision(),f=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=nd);const m=h.center.slice(),y=Vn(l,f*u),p=y.slice(),x=[y.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!ei(E,t.extent)){const v=H(E),F=Math.max(H(y)/2,v);y[0]=E[0]-F,y[2]=E[2]+F,la(m,c);const S=ia(x[0],c);S[0]<E[0]&&S[2]<E[2]?x.push([S[0]+v,S[1],S[2]+v,S[3]]):S[0]>E[0]&&S[2]>E[2]&&x.push([S[0]-v,S[1],S[2]-v,S[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==_&&ei(this.wrappedRenderedExtent_,y))return ie(this.renderedExtent_,p)||(this.hitDetectionImageData_=null,this.renderedExtent_=p),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new Lo(Ws(u,d),y,u,d);let R;this.getLayer().getDeclutter()&&(R=new Lo(Ws(u,d),y,u,d));let I;for(let v=0,F=x.length;v<F;++v)i.loadFeatures(x[v],u,c);const w=sd(u,d);let L=!0;const D=v=>{let F;const S=v.getStyleFunction()||e.getStyleFunction();if(S&&(F=S(v,u)),F){const b=this.renderFeature(v,w,F,C,I,R);L=L&&!b}},z=sr(y),X=i.getFeaturesInExtent(z);_&&X.sort(_);for(let v=0,F=X.length;v<F;++v)D(X[v]);this.renderedFeatures_=X,this.ready=L;const G=C.finish(),et=new Ao(y,u,d,i.getOverlaps(),G,e.getRenderBuffer());return R&&(this.declutterExecutorGroup=new Ao(y,u,d,i.getOverlaps(),R.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=_,this.renderedExtent_=p,this.wrappedRenderedExtent_=y,this.renderedCenter_=m,this.renderedProjection_=c,this.replayGroup_=et,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Do(n,t,i[l],e,this.boundHandleStyleImageChange_,r,o)||a;else a=Do(n,t,i,e,this.boundHandleStyleImageChange_,r,o);return a}}const _d=fd;class md extends Mu{constructor(t){super(t)}createRenderer(){return new _d(this)}}const oi=md;class yd{constructor(t){this.rbush_=new Ga(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_[k(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const o=t[n],a=e[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[k(a)]=l}this.rbush_.load(i)}remove(t){const e=k(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[k(e)],n=[i.minX,i.minY,i.maxX,i.maxY];Pi(n,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(n){return n.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 n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return Mi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return te(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]}}const Ys=yd;class pd extends Yt{constructor(t){super(),this.projection=ct(t.projection),this.attributions_=Oo(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?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,n){e.viewResolver=i,e.viewRejector=n})}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_=Oo(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Oo(s){return s?Array.isArray(s)?function(t){return s}:typeof s=="function"?s:function(t){return[s]}:null}const Ua=pd,pt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function xd(s,t){return[[-1/0,-1/0,1/0,1/0]]}let Ed=!1;function Cd(s,t,e,i,n,r,o){const a=new XMLHttpRequest;a.open("GET",typeof s=="function"?s(e,i,n):s,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Ed,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:n}),t.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function bo(s,t){return function(e,i,n,r,o){const a=this;Cd(s,t,e,i,n,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||ci)}}class ce extends Mt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Td extends Ua{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_=ci,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(N(this.format_,7),this.loader_=bo(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:xd;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Ys:null,this.loadedExtentsRtree_=new Ys,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),!e&&i===void 0&&(i=new Ct(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=k(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ce(pt.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Y(e,O.CHANGE,this.handleFeatureChange_,this),Y(e,hi.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return n!==void 0&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(N(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=k(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=k(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(pt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new ce(pt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(pt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(pt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(tt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(tt.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(q);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=n=>{this.removeFeatureInternal(n)};this.featuresRtree_.forEach(i);for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ce(pt.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(n){if(n.getGeometry().intersectsCoordinate(t))return e(n)})}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){if(i.getGeometry().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(),Mi(this.nullGeometryFeatures_)||Dt(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 n=Vl(t,e);return[].concat(...n.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||pe,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,n,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+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=k(e),n=e.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=n.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 ce(pt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:k(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Mi(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];n.forEachInExtent(l,function(c){return ei(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ce(pt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ce(pt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ce(pt.FEATURESLOADERROR))}),n.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_;let i;e.forEachInExtent(t,function(n){if(Pi(n.extent,t))return i=n,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=k(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=k(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(q),delete this.featureChangeKeys_[e];const n=t.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new ce(pt.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){N(this.format_,7),this.url_=t,this.setLoader(bo(t,this.format_))}}const kn=Td;class Or extends Yt{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 Or(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_&&(q(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=Y(t,O.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Rd(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 Rd(s){if(typeof s=="function")return s;let t;return Array.isArray(s)?t=s:(N(typeof s.getZIndex=="function",41),t=[s]),function(){return t}}const At=Or,Sd={SELECT:"select"};class wd extends Mt{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const dn={};class br extends yi{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:Rr,this.addCondition_=t.addCondition?t.addCondition:Xs,this.removeCondition_=t.removeCondition?t.removeCondition:Xs,this.toggleCondition_=t.toggleCondition?t.toggleCondition:wr,this.multi_=t.multi?t.multi:!1,this.filter_=t.filter?t.filter:pe,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=t.style!==void 0?t.style:Id(),this.features_=t.features||new Ct;let e;if(t.layers)if(typeof t.layers=="function")e=t.layers;else{const i=t.layers;e=function(n){return i.includes(n)}}else e=pe;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[k(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[k(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(tt.ADD,this.boundAddFeature_),this.features_.addEventListener(tt.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(tt.ADD,this.boundAddFeature_),this.features_.removeEventListener(tt.REMOVE,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const i=this.getMap().getAllLayers().find(function(n){if(n instanceof oi&&n.getSource()&&n.getSource().hasFeature(e))return n});i&&this.addFeatureLayerAssociation_(e,i)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=k(t);e in dn||(dn[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let n=e.length-1;n>=0;--n){const r=e[n];if(r!==this&&r instanceof br&&r.getStyle()&&r.getFeatures().getArray().lastIndexOf(t)!==-1){t.setStyle(r.getStyle());return}}const i=k(t);t.setStyle(dn[i]),delete dn[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[k(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,o=t.map,a=this.getFeatures(),l=[],h=[];if(r){_i(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,(c,u)=>{if(!(!(c instanceof At)||!this.filter_(c,u)))return this.addFeatureLayerAssociation_(c,u),h.push(c),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=a.getLength()-1;c>=0;--c){const u=a.item(c),d=h.indexOf(u);d>-1?h.splice(d,1):(a.remove(u),l.push(u))}h.length!==0&&a.extend(h)}else{o.forEachFeatureAtPixel(t.pixel,(c,u)=>{if(!(!(c instanceof At)||!this.filter_(c,u)))return(e||n)&&!a.getArray().includes(c)?(this.addFeatureLayerAssociation_(c,u),h.push(c)):(i||n)&&a.getArray().includes(c)&&(l.push(c),this.removeFeatureLayerAssociation_(c)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=l.length-1;c>=0;--c)a.remove(l[c]);a.extend(h)}return(h.length>0||l.length>0)&&this.dispatchEvent(new wd(Sd.SELECT,h,l,t)),!0}}function Id(){const s=Fr();return Dt(s.Polygon,s.LineString),Dt(s.GeometryCollection,s.LineString),function(t){return t.getGeometry()?s[t.getGeometry().getType()]:null}}const vd=br;class Gn extends ga{constructor(t){super(),this.geometries_=t||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(q),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(!!this.geometries_)for(let t=0,e=this.geometries_.length;t<e;++t)this.changeEventsKeys_.push(Y(this.geometries_[t],O.CHANGE,this.changed,this))}clone(){const t=new Gn(null);return t.setGeometries(this.geometries_),t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ge(this.getExtent(),t,e))return n;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)n=r[o].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Wi(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)$s(t,e[i].getExtent());return t}getGeometries(){return ko(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(n=!0)}if(n){const r=new Gn(null);return r.setGeometriesArray(e),r}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=be(this.getExtent()));const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(ko(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function ko(s){const t=[];for(let e=0,i=s.length;e<i;++e)t.push(s[e].clone());return t}const Nn=Gn;function Za(s,t,e,i,n,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=n;else if(h!==0){let c=s[t],u=s[t+1],d=0;const g=[0];for(let m=t+i;m<e;m+=i){const y=s[m],p=s[m+1];d+=Math.sqrt((y-c)*(y-c)+(p-u)*(p-u)),g.push(d),c=y,u=p}const f=n*d,_=Cl(g,f);_<0?(l=(f-g[-_-2])/(g[-_-1]-g[-_-2]),a=t+(-_-2)*i):a=t+_*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?s[a+c]:Et(s[a+c],s[a+i+c],l);return r}function zs(s,t,e,i,n,r){if(e==t)return null;let o;if(n<s[t+i-1])return r?(o=s.slice(t,t+i),o[i-1]=n,o):null;if(s[e-1]<n)return r?(o=s.slice(e-i,e),o[i-1]=n,o):null;if(n==s[t+i-1])return s.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;n<s[(d+1)*i-1]?l=d:a=d+1}const h=s[a*i-1];if(n==h)return s.slice((a-1)*i,(a-1)*i+i);const c=s[(a+1)*i-1],u=(n-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(Et(s[(a-1)*i+d],s[a*i+d],u));return o.push(n),o}function Ld(s,t,e,i,n,r,o){if(o)return zs(s,t,e[e.length-1],i,n,r);let a;if(n<s[i-1])return r?(a=s.slice(0,i),a[i-1]=n,a):null;if(s[s.length-1]<n)return r?(a=s.slice(s.length-i),a[i-1]=n,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(n<s[t+i-1])return null;if(n<=s[c-1])return zs(s,t,c,i,n,!1);t=c}}return null}class Xn extends Ce{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){this.flatCoordinates?Dt(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new Xn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ur(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return xa(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,zs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return _e(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Va(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=fr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Xn(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Zn(this.flatCoordinates,0,t,this.stride),this.changed()}}const De=Xn;class Wn extends Ce{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{let n=this.getLayout();const r=t,o=[],a=[];for(let l=0,h=r.length;l<h;++l){const c=r[l];l===0&&(n=c.getLayout()),Dt(o,c.getFlatCoordinates()),a.push(o.length)}this.setFlatCoordinates(n,o),this.ends_=a}}appendLineString(t){this.flatCoordinates?Dt(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Wn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(cr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dr(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}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,Ld(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Ai(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new De(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,n=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new De(t.slice(r,l),i);n.push(h),r=l}return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=Za(e,i,l,r,.5);Dt(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Nh(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Wn(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return jh(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=gr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}const kr=Wn;class Gr extends Ce{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?Dt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new Gr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ge(this.getExtent(),t,e))return n;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=qt(t,e,r[a],r[a+1]);if(h<n){n=h;for(let c=0;c<o;++c)i[c]=r[a+c];i.length=o}}return n}getCoordinates(){return _e(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new $t(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,o=t.length;r<o;r+=i){const a=new $t(t.slice(r,r+i),e);n.push(a)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i){const o=e[n],a=e[n+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=Zn(this.flatCoordinates,0,t,this.stride),this.changed()}}const Nr=Gr;function Md(s,t,e,i){const n=[];let r=vt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ta(s,t,l[0],i),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return n}class Yn extends Ce{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])){let n=this.getLayout();const r=t,o=[],a=[];for(let l=0,h=r.length;l<h;++l){const c=r[l];l===0&&(n=c.getLayout());const u=o.length,d=c.getEnds();for(let g=0,f=d.length;g<f;++g)d[g]+=u;Dt(o,c.getFlatCoordinates()),a.push(d)}e=n,t=o,i=a}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;Dt(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let n=0,r=e.length;n<r;++n)e[n]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=this.endss_[n].slice();const i=new Yn(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(bh(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),kh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Bh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Yh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),uo(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Fs(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Md(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Vh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Nr(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Zh(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=uo(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Wh(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Yn(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(),n=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new Lt(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];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 Lt(e.slice(r,h),t,l);n.push(c),r=h}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return Kh(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Gh(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const n=i[i.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const Xr=Yn;class Pd{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?ct(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=ct(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},t)}getType(){return A()}readFeature(t,e){return A()}readFeatures(t,e){return A()}readGeometry(t,e){return A()}readProjection(t){return A()}writeFeature(t,e){return A()}writeFeatures(t,e){return A()}writeGeometry(t,e){return A()}}function Go(s,t,e){const i=e?ct(e.featureProjection):null,n=e?ct(e.dataProjection):null;let r;if(i&&n&&!Ie(i,n)?r=(t?s.clone():s).transform(t?i:n,t?n:i):r=s,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===s&&(r=s.clone()),r.applyTransform(a)}return r}class Fd extends Pd{constructor(){super()}getType(){return"text"}readFeature(t,e){return this.readFeatureFromText(gn(t),this.adaptOptions(e))}readFeatureFromText(t,e){return A()}readFeatures(t,e){return this.readFeaturesFromText(gn(t),this.adaptOptions(e))}readFeaturesFromText(t,e){return A()}readGeometry(t,e){return this.readGeometryFromText(gn(t),this.adaptOptions(e))}readGeometryFromText(t,e){return A()}readProjection(t){return this.readProjectionFromText(gn(t))}readProjectionFromText(t){return this.dataProjection}writeFeature(t,e){return this.writeFeatureText(t,this.adaptOptions(e))}writeFeatureText(t,e){return A()}writeFeatures(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))}writeFeaturesText(t,e){return A()}writeGeometry(t,e){return this.writeGeometryText(t,this.adaptOptions(e))}writeGeometryText(t,e){return A()}}function gn(s){return typeof s=="string"?s:""}const Ad=Fd,Dd={POINT:$t,LINESTRING:De,POLYGON:Lt,MULTIPOINT:Nr,MULTILINESTRING:kr,MULTIPOLYGON:Xr},Ha="EMPTY",qa="Z",$a="M",Od="ZM",B={START:0,TEXT:1,LEFT_PAREN:2,RIGHT_PAREN:3,NUMBER:4,COMMA:5,EOF:6},bd={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class kd{constructor(t){this.wkt=t,this.index_=-1}isAlpha_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=e!==void 0?e:!1,t>="0"&&t<="9"||t=="."&&!e}isWhiteSpace_(t){return t==" "||t==" "||t=="\r"||t==`
|
|
10
|
+
`}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i=t,n;if(t=="(")n=B.LEFT_PAREN;else if(t==",")n=B.COMMA;else if(t==")")n=B.RIGHT_PAREN;else if(this.isNumeric_(t)||t=="-")n=B.NUMBER,i=this.readNumber_();else if(this.isAlpha_(t))n=B.TEXT,i=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t==="")n=B.EOF;else throw new Error("Unexpected character: "+t)}return{position:e,value:i,type:n}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do t=="."?i=!0:(t=="e"||t=="E")&&(n=!0),t=this.nextChar_();while(this.isNumeric_(t,i)||!n&&(t=="e"||t=="E")||n&&(t=="-"||t=="+"));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do t=this.nextChar_();while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class Gd{constructor(t){this.lexer_=t,this.token_={position:0,type:B.START},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(B.TEXT)){const i=e.value;i===qa?t="XYZ":i===$a?t="XYM":i===Od&&(t="XYZM"),t!=="XY"&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(B.LEFT_PAREN)){const t=[];do t.push(this.parseGeometry_());while(this.match(B.COMMA));if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(B.LEFT_PAREN)){const t=this.parsePoint_();if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(B.LEFT_PAREN)){const t=this.parsePointList_();if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(B.LEFT_PAREN)){const t=this.parseLineStringTextList_();if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(B.LEFT_PAREN)){let t;if(this.token_.type==B.LEFT_PAREN?t=this.parsePointTextList_():t=this.parsePointList_(),this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(B.LEFT_PAREN)){const t=this.parseLineStringTextList_();if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(B.LEFT_PAREN)){const t=this.parsePolygonTextList_();if(this.match(B.RIGHT_PAREN))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i<e;++i){const n=this.token_;if(this.match(B.NUMBER))t.push(n.value);else break}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())}parsePointList_(){const t=[this.parsePoint_()];for(;this.match(B.COMMA);)t.push(this.parsePoint_());return t}parsePointTextList_(){const t=[this.parsePointText_()];for(;this.match(B.COMMA);)t.push(this.parsePointText_());return t}parseLineStringTextList_(){const t=[this.parseLineStringText_()];for(;this.match(B.COMMA);)t.push(this.parseLineStringText_());return t}parsePolygonTextList_(){const t=[this.parsePolygonText_()];for(;this.match(B.COMMA);)t.push(this.parsePolygonText_());return t}isEmptyGeometry_(){const t=this.isTokenType(B.TEXT)&&this.token_.value==Ha;return t&&this.consume_(),t}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const t=this.token_;if(this.match(B.TEXT)){const e=t.value;this.layout_=this.parseGeometryLayout_();const i=this.isEmptyGeometry_();if(e=="GEOMETRYCOLLECTION"){if(i)return new Nn([]);const o=this.parseGeometryCollectionText_();return new Nn(o)}const n=Dd[e];if(!n)throw new Error("Invalid geometry type: "+e);let r;if(i)e=="POINT"?r=[NaN,NaN]:r=[];else switch(e){case"POINT":{r=this.parsePointText_();break}case"LINESTRING":{r=this.parseLineStringText_();break}case"POLYGON":{r=this.parsePolygonText_();break}case"MULTIPOINT":{r=this.parseMultiPointText_();break}case"MULTILINESTRING":{r=this.parseMultiLineStringText_();break}case"MULTIPOLYGON":{r=this.parseMultiPolygonText_();break}}return new n(r,this.layout_)}throw new Error(this.formatErrorMessage_())}}class Nd extends Ad{constructor(t){super(),t=t||{},this.splitCollection_=t.splitCollection!==void 0?t.splitCollection:!1}parse_(t){const e=new kd(t);return new Gd(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),n=new At;return n.setGeometry(i),n}readFeaturesFromText(t,e){let i=[];const n=this.readGeometryFromText(t,e);this.splitCollection_&&n.getType()=="GeometryCollection"?i=n.getGeometriesArray():i=[n];const r=[];for(let o=0,a=i.length;o<a;++o){const l=new At;l.setGeometry(i[o]),r.push(l)}return r}readGeometryFromText(t,e){const i=this.parse_(t);return Go(i,!1,e)}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):""}writeFeaturesText(t,e){if(t.length==1)return this.writeFeatureText(t[0],e);const i=[];for(let r=0,o=t.length;r<o;++r)i.push(t[r].getGeometry());const n=new Nn(i);return this.writeGeometryText(n,e)}writeGeometryText(t,e){return tl(Go(t,!0,e))}}function Ja(s){const t=s.getCoordinates();return t.length===0?"":t.join(" ")}function Xd(s){const t=[],e=s.getPoints();for(let i=0,n=e.length;i<n;++i)t.push("("+Ja(e[i])+")");return t.join(",")}function Wd(s){const t=[],e=s.getGeometries();for(let i=0,n=e.length;i<n;++i)t.push(tl(e[i]));return t.join(",")}function Wr(s){const t=s.getCoordinates(),e=[];for(let i=0,n=t.length;i<n;++i)e.push(t[i].join(" "));return e.join(",")}function Yd(s){const t=[],e=s.getLineStrings();for(let i=0,n=e.length;i<n;++i)t.push("("+Wr(e[i])+")");return t.join(",")}function Qa(s){const t=[],e=s.getLinearRings();for(let i=0,n=e.length;i<n;++i)t.push("("+Wr(e[i])+")");return t.join(",")}function zd(s){const t=[],e=s.getPolygons();for(let i=0,n=e.length;i<n;++i)t.push("("+Qa(e[i])+")");return t.join(",")}function Bd(s){const t=s.getLayout();let e="";return(t==="XYZ"||t==="XYZM")&&(e+=qa),(t==="XYM"||t==="XYZM")&&(e+=$a),e}const Vd={Point:Ja,LineString:Wr,Polygon:Qa,MultiPoint:Xd,MultiLineString:Yd,MultiPolygon:zd,GeometryCollection:Wd};function tl(s){const t=s.getType(),e=Vd[t],i=e(s);let n=bd[t];if(typeof s.getFlatCoordinates=="function"){const r=Bd(s);r.length>0&&(n+=" "+r)}return i.length===0?n+" "+Ha:n+"("+i+")"}const ys=Nd;class ts extends Ce{constructor(t,e,i){super(),i!==void 0&&e===void 0?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new ts(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=t-r[0],a=e-r[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=r[0]+h*o,i[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=r[c]}return i.length=this.stride,l}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],r=e-i[1];return n*n+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return te(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){const e=this.getExtent();if(ht(t,e)){const i=this.getCenter();return t[0]<=i[0]&&t[2]>=i[0]||t[1]<=i[1]&&t[3]>=i[1]?!0:Js(t,this.intersectsCoordinate.bind(this))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let r=1;r<e;++r)n[e+r]=t[r];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let r=fa(n,0,t,this.stride);n[r++]=n[0]+e;for(let o=1,a=this.stride;o<a;++o)n[r++]=n[o];n.length=r,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(lr(i,0,i.length,n,t,e,i)),this.changed()}}ts.prototype.transform;const el=ts,fn={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class _n extends Mt{constructor(t,e){super(t),this.feature=e}}function jd(s,t){const e=[];for(let i=0;i<t.length;++i){const r=t[i].getGeometry();il(s,r,e)}return e}function mn(s,t){return qt(s[0],s[1],t[0],t[1])}function ni(s,t){const e=s.length;return t<0?s[t+e]:t>=e?s[t-e]:s[t]}function yn(s,t,e){let i,n;t<e?(i=t,n=e):(i=e,n=t);const r=Math.ceil(i),o=Math.floor(n);if(r>o){const l=si(s,i),h=si(s,n);return mn(l,h)}let a=0;if(i<r){const l=si(s,i),h=ni(s,r);a+=mn(l,h)}if(o<n){const l=ni(s,o),h=si(s,n);a+=mn(l,h)}for(let l=r;l<o-1;++l){const h=ni(s,l),c=ni(s,l+1);a+=mn(h,c)}return a}function il(s,t,e){if(t instanceof De){pn(s,t.getCoordinates(),!1,e);return}if(t instanceof kr){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)pn(s,i[n],!1,e);return}if(t instanceof Lt){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)pn(s,i[n],!0,e);return}if(t instanceof Xr){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)pn(s,o[a],!0,e)}return}if(t instanceof Nn){const i=t.getGeometries();for(let n=0;n<i.length;++n)il(s,i[n],e);return}}const ps={index:-1,endIndex:NaN};function Kd(s,t,e,i){const n=s[0],r=s[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<t.targets.length;++u){const d=t.targets[u],g=d.coordinates;let f=1/0,_;for(let m=0;m<g.length-1;++m){const y=g[m],p=g[m+1],x=nl(n,r,y,p);x.squaredDistance<f&&(f=x.squaredDistance,_=m+x.along)}f<o&&(o=f,d.ring&&t.targetIndex===u&&(d.endIndex>d.startIndex?_<d.startIndex&&(_+=g.length):d.endIndex<d.startIndex&&_>d.startIndex&&(_-=g.length)),l=_,a=u)}const h=t.targets[a];let c=h.ring;if(t.targetIndex===a&&c){const u=si(h.coordinates,l),d=e.getPixelFromCoordinate(u);In(d,t.startPx)>i&&(c=!1)}if(c){const u=h.coordinates,d=u.length,g=h.startIndex,f=l;if(g<f){const _=yn(u,g,f);yn(u,g,f-d)<_&&(l-=d)}else{const _=yn(u,g,f);yn(u,g,f+d)<_&&(l+=d)}}return ps.index=a,ps.endIndex=l,ps}function pn(s,t,e,i){const n=s[0],r=s[1];for(let o=0,a=t.length-1;o<a;++o){const l=t[o],h=t[o+1],c=nl(n,r,l,h);if(c.squaredDistance===0){const u=o+c.along;i.push({coordinates:t,ring:e,startIndex:u,endIndex:u});return}}}const xs={along:0,squaredDistance:0};function nl(s,t,e,i){const n=e[0],r=e[1],o=i[0],a=i[1],l=o-n,h=a-r;let c=0,u=n,d=r;return(l!==0||h!==0)&&(c=Q(((s-n)*l+(t-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),xs.along=c,xs.squaredDistance=Un(qt(s,t,u,d),10),xs}function si(s,t){const e=s.length;let i=Math.floor(t);const n=t-i;i>=e?i-=e:i<0&&(i+=e);let r=i+1;r>=e&&(r-=e);const o=s[i],a=o[0],l=o[1],h=s[r],c=h[0]-a,u=h[1]-l;return[a+c*n,l+u*n]}class Ud extends Ne{constructor(t){const e=t;e.stopDown||(e.stopDown=fi),super(e),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=$d(this.type_),this.stopClick_=!!t.stopClick,this.minPoints_=t.minPoints?t.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:pe,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=function(r,o,a){const l=o||new el([NaN,NaN]),h=$(r[0]),c=ke(h,$(r[r.length-1]));return l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_),l};else{let r;n==="Point"?r=$t:n==="LineString"?r=De:n==="Polygon"&&(r=Lt),i=function(o,a,l){return a?n==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new r(o,this.geometryLayout_),a}}}this.geometryFunction_=i,this.dragVertexDelay_=t.dragVertexDelay!==void 0?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new oi({source:new kn({useSpatialIndex:!1,wrapX:t.wrapX?t.wrapX:!1}),style:t.style?t.style:Zd(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:Sr,this.freehandCondition_,t.freehand?this.freehandCondition_=On:this.freehandCondition_=t.freehandCondition?t.freehandCondition:wr,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(Gs.ACTIVE,this.updateState_)}setTrace(t){let e;t?t===!0?e=On:e=t:e=Xs,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===O.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(t);let e=t.type===W.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&t.type===W.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&t.type===W.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===W.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===W.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):(t.originalEvent.pointerType==="mouse"||t.type===W.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(t)):t.type===W.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Ht(W.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))},this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active){this.deactivateTrace_();return}const e=this.getMap(),i=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),n=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=xt([i,n]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=jd(t.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:t.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex,n=t.startIndex<=e;i===n?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),i=r-n+1}else{const n=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),i=n-r+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const r=Math.ceil(e);let o=Math.floor(i);o===i&&(o-=1);for(let a=r;a<=o;++a)n.push(ni(t.coordinates,a))}else{const r=Math.floor(e);let o=Math.ceil(i);o===i&&(o+=1);for(let a=r;a>=o;--a)n.push(ni(t.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active||e.targetIndex===-1&&In(e.startPx,t.pixel)<this.snapTolerance_)return;const i=Kd(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==i.index){if(e.targetIndex!==-1){const l=e.targets[e.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=e.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}e.targetIndex=i.index;const n=e.targets[e.targetIndex];n.endIndex=i.endIndex;const r=si(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(t){let e=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const i=this.traceState_.active;if(this.toggleTraceState_(t),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():!this.freehand_&&(!n||this.mode_==="Point")&&(this.atFinish_(t.pixel,i)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],o=n*n+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(t.coordinate.slice());return}this.updateTrace_(t),this.modifyDrawing_(t.coordinate)}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")n=!e&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;n=a[0].length>this.minPoints_,r=[a[0][0],a[0][a[0].length-2]],e?r=[a[0][0]]:r=[a[0][0],a[0][a[0].length-2]]}if(n){const a=this.getMap();for(let l=0,h=r.length;l<h;l++){const c=r[l],u=a.getPixelFromCoordinate(c),d=t[0]-u[0],g=t[1]-u[1],f=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(d*d+g*g)<=f,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new At(new $t(t)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new At);const e=t.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new De(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(t){const e=this.getMap().getView().getProjection(),i=Ln(this.geometryLayout_);for(;t.length<i;)t.push(0);this.finishCoordinate_=t,this.mode_==="Point"?this.sketchCoords_=t.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new At(new De(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new At,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new _n(fn.DRAWSTART,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),i=this.sketchFeature_.getGeometry(),n=e.getView().getProjection(),r=Ln(this.geometryLayout_);let o,a;for(;t.length<r;)t.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=t[0],a[1]=t[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,r;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=t.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r<t;++r){let o;if(n==="LineString"||n==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,e,i),e.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,e,i)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_==="LineString"?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_==="Polygon"&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_==="MultiPoint"?t.setGeometry(new Nr([e])):this.type_==="MultiLineString"?t.setGeometry(new kr([e])):this.type_==="MultiPolygon"&&t.setGeometry(new Xr([e])),this.dispatchEvent(new _n(fn.DRAWEND,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new _n(fn.DRAWABORT,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(t[0]);let n;if(e==="LineString"||e==="Circle")n=this.sketchCoords_;else if(e==="Polygon")n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&n.shift(),n.pop();for(let o=0;o<t.length;o++)this.addToDrawing_(t[o]);const r=t[t.length-1];this.addToDrawing_(r),this.modifyDrawing_(r)}extend(t){const i=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=i.getCoordinates();const n=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=n.slice(),this.sketchCoords_.push(n.slice()),this.sketchPoint_=new At(new $t(n)),this.updateSketchFeatures_(),this.dispatchEvent(new _n(fn.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();(!t||!e)&&this.abortDrawing(),this.overlay_.setMap(e?t:null)}}function Zd(){const s=Fr();return function(t,e){return s[t.getGeometry().getType()]}}function Hd(s,t){return function(e,i,n){const r=$(e[0]),o=$(e[e.length-1]),a=Math.sqrt(ke(r,o));i=i||Hh(new el(r),s);let l=t;if(!t&&t!==0){const h=o[0]-r[0],c=o[1]-r[1];l=Math.atan2(c,h)}return Sa(i,r,a,l),i}}function qd(){return function(s,t,e){const i=xt([s[0],s[s.length-1]].map(function(r){return $(r)})),n=[[ui(i),Yi(i),zi(i),ne(i),ui(i)]];return t?t.setCoordinates(n):t=new Lt(n),t}}function $d(s){switch(s){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+s)}}const Jd=Ud,No=0,Li=1,Xo=[0,0,0,0],ai=[],Es={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class Cs extends Mt{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}class Qd extends Ne{constructor(t){super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:Aa,this.defaultDeleteCondition_=function(i){return Nc(i)&&Rr(i)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:On,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Ys,this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new oi({source:new kn({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:eg(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let e;if(t.features?e=t.features:t.source&&(this.source_=t.source,e=new Ct(this.source_.getFeatures()),this.source_.addEventListener(pt.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(pt.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(tt.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(tt.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=t.snapToPointer===void 0?!this.hitDetection_:t.snapToPointer}addFeature_(t){const e=t.getGeometry();if(e){const n=this.SEGMENT_WRITERS_[e.getType()];n&&n(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),t.addEventListener(O.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Ct;const i=this.featuresBeingModified_.getArray();for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0,l=o.length;a<l;++a){const h=o[a].feature;h&&!i.includes(h)&&this.featuresBeingModified_.push(h)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new Cs(Es.MODIFYSTART,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(O.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach(function(n){t===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const r=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===r&&this.dragSegments_.splice(o,1);e.remove(r)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n],a={feature:t,geometry:e,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(e.getExtent(),a)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length-1;n<r;++n){const o=i.slice(n,n+2),a={feature:t,geometry:e,index:n,segment:o};this.rBush_.insert(xt(o),a)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(xt(h),c)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(xt(h),c)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,u=h.length-1;c<u;++c){const d=h.slice(c,c+2),g={feature:t,geometry:e,depth:[a,n],index:c,segment:d};this.rBush_.insert(xt(d),g)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:No,segment:[i,i]},r={feature:t,geometry:e,index:Li,segment:[i,i]},o=[n,r];n.featureSegments=o,r.featureSegments=o,this.rBush_.insert(En(i),n);let a=e;this.rBush_.insert(a.getExtent(),r)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let n=0;n<i.length;++n){const r=i[n],o=this.SEGMENT_WRITERS_[r.getType()];o(t,r)}}createOrUpdateVertexFeature_(t,e,i){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(t):(n=new At(new $t(t)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",e),n.set("geometries",i),n}handleEvent(t){if(!t.originalEvent)return!0;this.lastPointerEvent_=t;let e;return!t.map.getView().getInteracting()&&t.type==W.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(t.type!=W.SINGLECLICK||!this.ignoreNextSingleClick_?e=this.removePoint():e=!0),t.type==W.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_);const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[];for(let r=0,o=this.dragSegments_.length;r<o;++r){const a=this.dragSegments_[r],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const u=l.depth;let d;const g=l.segment,f=a[1];for(;e.length<c.getStride();)e.push(g[f][e.length]);switch(c.getType()){case"Point":d=e,g[0]=e,g[1]=e;break;case"MultiPoint":d=c.getCoordinates(),d[l.index]=e,g[0]=e,g[1]=e;break;case"LineString":d=c.getCoordinates(),d[l.index+f]=e,g[f]=e;break;case"MultiLineString":d=c.getCoordinates(),d[u[0]][l.index+f]=e,g[f]=e;break;case"Polygon":d=c.getCoordinates(),d[u[0]][l.index+f]=e,g[f]=e;break;case"MultiPolygon":d=c.getCoordinates(),d[u[1]][u[0]][l.index+f]=e,g[f]=e;break;case"Circle":if(g[0]=e,g[1]=e,l.index===No)this.changingFeature_=!0,c.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0,t.map.getView().getProjection();let _=In($(c.getCenter()),$(e));c.setRadius(_),this.changingFeature_=!1}break}d&&this.setGeometryCoordinates_(c,d)}this.createOrUpdateVertexFeature_(e,i,n)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate;this.handlePointerAtPixel_(t.pixel,t.map,e),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){t.map.getView().getProjection();const n=[],r=i.getGeometry().getCoordinates(),o=xt([r]),a=this.rBush_.getInExtent(o),l={};a.sort(tg);for(let h=0,c=a.length;h<c;++h){const u=a[h],d=u.segment;let g=k(u.geometry);const f=u.depth;if(f&&(g+="-"+f.join("-")),l[g]||(l[g]=new Array(2)),u.geometry.getType()==="Circle"&&u.index===Li){const _=Yo(e,u);wt(_,r)&&!l[g][0]&&(this.dragSegments_.push([u,0]),l[g][0]=u);continue}if(wt(d[0],r)&&!l[g][0]){this.dragSegments_.push([u,0]),l[g][0]=u;continue}if(wt(d[1],r)&&!l[g][1]){if(l[g][0]&&l[g][0].index===0){let _=u.geometry.getCoordinates();switch(u.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":_=_[f[1]];case"Polygon":if(u.index!==_[f[0]].length-2)continue;break}}this.dragSegments_.push([u,1]),l[g][1]=u;continue}k(d)in this.vertexSegments_&&!l[g][0]&&!l[g][1]&&this.insertVertexCondition_(t)&&n.push(u)}n.length&&this.willModifyFeatures_(t,[n]);for(let h=n.length-1;h>=0;--h)this.insertVertex_(n[h],r)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()==="Circle"){const r=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=r,o.segment[1]=r,a.segment[0]=r,a.segment[1]=r,this.rBush_.update(En(r),o);let l=n;this.rBush_.update(l.getExtent(),a)}else this.rBush_.update(xt(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new Cs(Es.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t);e.getView().getProjection();const r=function(l,h){return Wo(n,l)-Wo(n,h)};let o,a;if(this.hitDetection_){const l=typeof this.hitDetection_=="object"?h=>h===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,(h,c,u)=>{u&&(u=new $t(di(u.getCoordinates())));const d=u||h.getGeometry();if(d.getType()==="Point"&&h instanceof At&&this.features_.getArray().includes(h)){a=d;const g=h.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:h,geometry:a,segment:[g,g]}]}return!0},{layerFilter:l})}if(!o){const l=fe(En(n,Xo)),h=e.getView().getResolution()*this.pixelTolerance_,c=sr(Vn(l,h,Xo));o=this.rBush_.getInExtent(c)}if(o&&o.length>0){const l=o.sort(r)[0],h=l.segment;let c=Yo(n,l);const u=e.getPixelFromCoordinate(c);let d=In(t,u);if(a||d<=this.pixelTolerance_){const g={};if(g[k(h)]=!0,this.snapToPointer_||(this.delta_[0]=c[0]-n[0],this.delta_[1]=c[1]-n[1]),l.geometry.getType()==="Circle"&&l.index===Li)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(c,[l.feature],[l.geometry]);else{const f=e.getPixelFromCoordinate(h[0]),_=e.getPixelFromCoordinate(h[1]),m=ke(u,f),y=ke(u,_);d=Math.sqrt(Math.min(m,y)),this.snappedToVertex_=d<=this.pixelTolerance_,this.snappedToVertex_&&(c=m>y?h[1]:h[0]),this.createOrUpdateVertexFeature_(c,[l.feature],[l.geometry]);const p={};p[k(l.geometry)]=!0;for(let x=1,E=o.length;x<E;++x){const C=o[x].segment;if(wt(h[0],C[0])&&wt(h[1],C[1])||wt(h[0],C[1])&&wt(h[1],C[0])){const R=k(o[x].geometry);R in p||(p[R]=!0,g[k(C)]=!0)}else break}}this.vertexSegments_=g;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,r=t.geometry,o=t.depth,a=t.index;let l;for(;e.length<r.getStride();)e.push(0);switch(r.getType()){case"MultiLineString":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"Polygon":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"MultiPolygon":l=r.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,e);break;case"LineString":l=r.getCoordinates(),l.splice(a+1,0,e);break;default:return}this.setGeometryCoordinates_(r,l);const h=this.rBush_;h.remove(t),this.updateSegmentIndices_(r,a,o,1);const c={segment:[i[0],e],feature:n,geometry:r,depth:o,index:a};h.insert(xt(c.segment),c),this.dragSegments_.push([c,1]);const u={segment:[e,i[1]],feature:n,geometry:r,depth:o,index:a+1};h.insert(xt(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=W.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_);const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Cs(Es.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i=!1,n,r,o,a,l,h,c,u,d,g,f;for(l=t.length-1;l>=0;--l)o=t[l],g=o[0],f=k(g.feature),g.depth&&(f+="-"+g.depth.join("-")),f in e||(e[f]={}),o[1]===0?(e[f].right=g,e[f].index=g.index):o[1]==1&&(e[f].left=g,e[f].index=g.index+1);for(f in e){switch(d=e[f].right,c=e[f].left,h=e[f].index,u=h-1,c!==void 0?g=c:g=d,u<0&&(u=0),a=g.geometry,r=a.getCoordinates(),n=r,i=!1,a.getType()){case"MultiLineString":r[g.depth[0]].length>2&&(r[g.depth[0]].splice(h,1),i=!0);break;case"LineString":r.length>2&&(r.splice(h,1),i=!0);break;case"MultiPolygon":n=n[g.depth[1]];case"Polygon":n=n[g.depth[0]],n.length>4&&(h==n.length-1&&(h=0),n.splice(h,1),i=!0,h===0&&(n.pop(),n.push(n[0]),u=n.length-1));break}if(i){this.setGeometryCoordinates_(a,r);const _=[];if(c!==void 0&&(this.rBush_.remove(c),_.push(c.segment[0])),d!==void 0&&(this.rBush_.remove(d),_.push(d.segment[1])),c!==void 0&&d!==void 0){const m={depth:g.depth,feature:g.feature,geometry:g.geometry,index:u,segment:_};this.rBush_.insert(xt(m.segment),m)}this.updateSegmentIndices_(a,h,g.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return i}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),function(r){r.geometry===t&&(i===void 0||r.depth===void 0||ie(r.depth,i))&&r.index>e&&(r.index+=n)})}}function tg(s,t){return s.index-t.index}function Wo(s,t,e){const i=t.geometry;if(i.getType()==="Circle"){let r=i;if(t.index===Li){const o=ke(r.getCenter(),$(s)),a=Math.sqrt(o)-r.getRadius();return a*a}}const n=$(s);return ai[0]=$(t.segment[0]),ai[1]=$(t.segment[1]),gh(n,ai)}function Yo(s,t,e){const i=t.geometry;if(i.getType()==="Circle"&&t.index===Li)return di(i.getClosestPoint($(s)));const n=$(s);return ai[0]=$(t.segment[0]),ai[1]=$(t.segment[1]),di(aa(n,ai))}function eg(){const s=Fr();return function(t,e){return s.Point}}const ig=Qd,Bs=new Gi({fill:new ee({color:"rgba(255, 0, 0,0.1)"}),stroke:new Ae({color:"rgba(255, 0, 0)",width:8}),image:new Vi({radius:5,fill:new ee({color:"rgba(255, 0, 0)"})}),zIndex:99999});function ng(s){return new Gi({fill:new ee({color:Yr(s)}),stroke:new Ae({color:s,width:8}),image:new Vi({radius:5,fill:new ee({color:s})}),zIndex:99999})}function Yr(s,t=.2,e=!1){if(t<0||t>1)throw new Error("\u900F\u660E\u5EA6\u5FC5\u987B\u57280-1\u4E4B\u95F4");const i=s.trim().toLowerCase();let n,r,o,a=1;const l=c=>c.length===3?c.split("").map(u=>parseInt(u+u,16)):c.length===6?[parseInt(c.substring(0,2),16),parseInt(c.substring(2,4),16),parseInt(c.substring(4,6),16)]:c.length===8?[parseInt(c.substring(0,2),16),parseInt(c.substring(2,4),16),parseInt(c.substring(4,6),16),parseInt(c.substring(6,8),16)/255]:null;if(i.startsWith("#")){const c=i.substring(1),u=l(c);if(!u)throw new Error("\u65E0\u6548\u7684\u5341\u516D\u8FDB\u5236\u989C\u8272\u683C\u5F0F");[n,r,o]=u,u.length===4&&(a=u[3])}else if(i.startsWith("rgb")){const c=i.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(!c)throw new Error("\u65E0\u6548\u7684RGB\u989C\u8272\u683C\u5F0F");if(n=parseInt(c[1]),r=parseInt(c[2]),o=parseInt(c[3]),n<0||n>255||r<0||r>255||o<0||o>255)throw new Error("RGB\u503C\u5FC5\u987B\u57280-255\u8303\u56F4\u5185");if(c[4]&&(a=parseFloat(c[4]),a<0||a>1))throw new Error("\u900F\u660E\u5EA6\u5FC5\u987B\u57280-1\u4E4B\u95F4")}else try{const c=document.createElement("div");c.style.color=s,document.body.appendChild(c);const u=window.getComputedStyle(c).color;return document.body.removeChild(c),Yr(u,t,e)}catch{throw new Error("\u65E0\u6CD5\u89E3\u6790\u7684\u989C\u8272\u683C\u5F0F")}const h=a*t;if(e){const c=d=>{const g=Math.round(d).toString(16);return g.length===1?"0"+g:g},u=c(h*255);return`#${c(n)}${c(r)}${c(o)}${u}`}return`rgba(${n}, ${r}, ${o}, ${h.toFixed(3)})`}const xn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class sg extends qn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(xn.PRELOAD)}setPreload(t){this.set(xn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(xn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(xn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const rg=sg;class og extends zn{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(O.CHANGE)}release(){this.state===M.ERROR&&this.setState(M.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==M.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==M.LOADED){t.interimTile=null;break}else t.getState()==M.LOADING?e=t:t.getState()==M.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==M.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){A()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const n=e-i+1e3/60;return n>=this.transition_?1:da(n/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}const sl=og;class ag extends sl{constructor(t,e,i,n,r,o){super(t,e,o),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=M.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=M.ERROR,this.unlistenImage_(),this.image_=lg(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=M.LOADED:this.state=M.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==M.ERROR&&(this.state=M.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==M.IDLE&&(this.state=M.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Wa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function lg(){const s=ut(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}const rl=ag,hg=.5,cg=10,zo=.25;class ug{constructor(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=vn(this.targetProj_,this.sourceProj_);this.transformInv_=function(p){const x=p[0]+"/"+p[1];return a[x]||(a[x]=l(p)),a[x]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&H(n)>=H(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?H(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?H(this.targetProj_.getExtent()):null;const h=ne(i),c=zi(i),u=Yi(i),d=ui(i),g=this.transformInv_(h),f=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),y=cg+(o?Math.max(0,Math.ceil(Math.log2(Is(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,g,f,_,m,y),this.wrapsXInSource_){let p=1/0;this.triangles_.forEach(function(x,E,C){p=Math.min(p,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-p>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-p>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-p>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-p>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const C=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-C<this.sourceWorldWidth_/2&&(x.source=E)}})}a={}}addTriangle_(t,e,i,n,r,o){this.triangles_.push({source:[n,r,o],target:[t,e,i]})}addQuad_(t,e,i,n,r,o,a,l,h){const c=xt([r,o,a,l]),u=this.sourceWorldWidth_?H(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=xt([t,e,i,n]);f=H(m)/this.targetWorldWidth_>zo||f}!g&&this.sourceProj_.isGlobal()&&u&&(f=u>zo||f)}if(!f&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ht(c,this.maxSourceExtent_))return;let _=0;if(!f&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)f=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!f){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(m);let p;g?p=(Pe(r[0],d)+Pe(a[0],d))/2-Pe(y[0],d):p=(r[0]+a[0])/2-y[0];const x=(r[1]+a[1])/2-y[1];f=p*p+x*x>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(m),p=[(n[0]+t[0])/2,(n[1]+t[1])/2],x=this.transformInv_(p);this.addQuad_(t,e,m,p,r,o,y,x,h-1),this.addQuad_(p,m,i,n,x,y,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(m),p=[(i[0]+n[0])/2,(i[1]+n[1])/2],x=this.transformInv_(p);this.addQuad_(t,m,p,n,r,y,x,l,h-1),this.addQuad_(m,e,i,p,y,o,a,x,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,n,r,a,l),(_&14)==0&&this.addTriangle_(t,i,e,r,a,o),_&&((_&13)==0&&this.addTriangle_(e,n,t,o,l,r),(_&7)==0&&this.addTriangle_(e,n,i,o,l,a))}calculateSourceExtent(){const t=vt();return this.triangles_.forEach(function(e,i,n){const r=e.source;Ii(t,r[0]),Ii(t,r[1]),Ii(t,r[2])}),t}getTriangles(){return this.triangles_}}const dg=ug;let Ts;const li=[];function Bo(s,t,e,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(t,e),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(t,i)+1,Math.max(e,n)),s.restore()}function Rs(s,t){return Math.abs(s[t*4]-210)>2||Math.abs(s[t*4+3]-.75*255)>2}function gg(){if(Ts===void 0){const s=ut(6,6,li);s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",Bo(s,4,5,4,0),Bo(s,4,5,0,5);const t=s.getImageData(0,0,3,3).data;Ts=Rs(t,0)||Rs(t,4)||Rs(t,8),Jn(s),li.push(s.canvas)}return Ts}function Vo(s,t,e,i){const n=Ch(e,t,s);let r=no(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||jn(l,n)){const h=no(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function fg(s,t,e,i){const n=be(e);let r=Vo(s,t,n,i);return(!isFinite(r)||r<=0)&&Js(e,function(o){return r=Vo(s,t,o,i),isFinite(r)&&r>0}),r}function _g(s,t,e,i,n,r,o,a,l,h,c,u){const d=ut(Math.round(e*s),Math.round(e*t),li);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(e,e);function g(E){return Math.round(E*e)/e}d.globalCompositeOperation="lighter";const f=vt();l.forEach(function(E,C,R){$s(f,E.extent)});const _=H(f),m=Wt(f),y=ut(Math.round(e*_/i),Math.round(e*m/i),li);u||(y.imageSmoothingEnabled=!1);const p=e/i;l.forEach(function(E,C,R){const I=E.extent[0]-f[0],w=-(E.extent[3]-f[3]),L=H(E.extent),D=Wt(E.extent);E.image.width>0&&E.image.height>0&&y.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,I*p,w*p,L*p,D*p)});const x=ne(o);return a.getTriangles().forEach(function(E,C,R){const I=E.source,w=E.target;let L=I[0][0],D=I[0][1],z=I[1][0],X=I[1][1],G=I[2][0],et=I[2][1];const v=g((w[0][0]-x[0])/r),F=g(-(w[0][1]-x[1])/r),S=g((w[1][0]-x[0])/r),b=g(-(w[1][1]-x[1])/r),U=g((w[2][0]-x[0])/r),j=g(-(w[2][1]-x[1])/r),it=L,T=D;L=0,D=0,z-=it,X-=T,G-=it,et-=T;const _t=[[z,X,0,0,S-v],[G,et,0,0,U-v],[0,0,z,X,b-F],[0,0,G,et,j-F]],V=Kl(_t);if(!!V){if(d.save(),d.beginPath(),gg()||!u){d.moveTo(S,b);const Z=4,se=v-S,Ot=F-b;for(let rt=0;rt<Z;rt++)d.lineTo(S+g((rt+1)*se/Z),b+g(rt*Ot/(Z-1))),rt!=Z-1&&d.lineTo(S+g((rt+1)*se/Z),b+g((rt+1)*Ot/(Z-1)));d.lineTo(U,j)}else d.moveTo(S,b),d.lineTo(v,F),d.lineTo(U,j);d.clip(),d.transform(V[0],V[2],V[1],V[3],v,F),d.translate(f[0]-it,f[3]-T),d.scale(i/e,-i/e),d.drawImage(y.canvas,0,0),d.restore()}}),Jn(y),li.push(y.canvas),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(E,C,R){const I=E.target,w=(I[0][0]-x[0])/r,L=-(I[0][1]-x[1])/r,D=(I[1][0]-x[0])/r,z=-(I[1][1]-x[1])/r,X=(I[2][0]-x[0])/r,G=-(I[2][1]-x[1])/r;d.beginPath(),d.moveTo(D,z),d.lineTo(w,L),d.lineTo(X,G),d.closePath(),d.stroke()}),d.restore()),d.canvas}class mg extends sl{constructor(t,e,i,n,r,o,a,l,h,c,u,d){super(r,M.IDLE,{interpolate:!!d}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const m=f?vi(g,f):g;if(Is(m)===0){this.state=M.EMPTY;return}const y=t.getExtent();y&&(_?_=vi(_,y):_=y);const p=n.getResolution(this.wrappedTileCoord_[0]),x=fg(t,i,m,p);if(!isFinite(x)||x<=0){this.state=M.EMPTY;return}const E=c!==void 0?c:hg;if(this.triangulation_=new dg(t,i,m,_,x*E,p),this.triangulation_.getTriangles().length===0){this.state=M.EMPTY;return}this.sourceZ_=e.getZForResolution(x);let C=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(C[1]=Q(C[1],_[1],_[3]),C[3]=Q(C[3],_[1],_[3])):C=vi(C,_)),!Is(C))this.state=M.EMPTY;else{const R=e.getTileRangeForExtentAndZ(C,this.sourceZ_);for(let I=R.minX;I<=R.maxX;I++)for(let w=R.minY;w<=R.maxY;w++){const L=h(this.sourceZ_,I,w,a);L&&this.sourceTiles_.push(L)}this.sourceTiles_.length===0&&(this.state=M.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==M.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=M.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n=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_=_g(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=M.LOADED}this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.getState();if(i==M.IDLE||i==M.LOADING){t++;const n=Y(e,O.CHANGE,function(r){const o=e.getState();(o==M.LOADED||o==M.ERROR||o==M.EMPTY)&&(q(n),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(n)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,i,n){e.getState()==M.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(q),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Jn(this.canvas_.getContext("2d")),li.push(this.canvas_),this.canvas_=null),super.release()}}const Vs=mg;class ol{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}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 He(s,t,e,i,n){return n!==void 0?(n.minX=s,n.maxX=t,n.minY=e,n.maxY=i,n):new ol(s,t,e,i)}const al=ol;class yg extends Ba{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=vt(),this.tmpTileRange_=new al(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==M.LOADED||i==M.EMPTY||i==M.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,i,r,o);return h.getState()==M.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=st(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!jn(r,n))return null;const o=e.pixelRatio,a=e.viewState.projection,l=e.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const g=c.getTileCoordForCoordAndZ(n,d),f=h.getTile(d,g[1],g[2],o,a);if(!(f instanceof rl||f instanceof Vs)||f instanceof Vs&&f.getState()===M.EMPTY)return null;if(f.getState()!==M.LOADED)continue;const _=c.getOrigin(d),m=It(c.getTileSize(d)),y=c.getResolution(d),p=Math.floor(u*((n[0]-_[0])/y-g[1]*m[0])),x=Math.floor(u*((_[1]-n[1])/y-g[2]*m[1])),E=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(f.getImage(),p+E,x+E)}return null}loadedTileCallback(t,e,i){return this.isDrawableTile(i)?super.loadedTileCallback(t,e,i):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),f=g.getZForResolution(o,u.zDirection),_=g.getResolution(f);let m=t.extent;const y=t.viewState.resolution,p=u.getTilePixelRatio(h),x=Math.round(H(m)/y*h),E=Math.round(Wt(m)/y*h),C=i.extent&&fe(i.extent);C&&(m=vi(m,fe(i.extent)));const R=_*x/2/p,I=_*E/2/p,w=[a[0]-R,a[1]-I,a[0]+R,a[1]+I],L=g.getTileRangeForExtentAndZ(m,f),D={};D[f]={};const z=this.createLoadedTileFinder(u,r,D),X=this.tmpExtent,G=this.tmpTileRange_;this.newTiles_=!1;const et=l?Ls(n.center,y,l,t.size):void 0;for(let _t=L.minX;_t<=L.maxX;++_t)for(let V=L.minY;V<=L.maxY;++V){if(l&&!g.tileCoordIntersectsViewport([f,_t,V],et))continue;const Z=this.getTile(f,_t,V,t);if(this.isDrawableTile(Z)){const rt=k(this);if(Z.getState()==M.LOADED){D[f][Z.tileCoord.toString()]=Z;let zt=Z.inTransition(rt);zt&&i.opacity!==1&&(Z.endTransition(rt),zt=!1),!this.newTiles_&&(zt||!this.renderedTiles.includes(Z))&&(this.newTiles_=!0)}if(Z.getAlpha(rt,t.time)===1)continue}const se=g.getTileCoordChildTileRange(Z.tileCoord,G,X);let Ot=!1;se&&(Ot=z(f+1,se)),Ot||g.forEachTileCoordParentTileRange(Z.tileCoord,z,G,X)}const v=_/o*h/p;Ee(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-E/2);const F=Jo(this.pixelTransform);this.useContainer(e,F,this.getBackground(t));const S=this.context,b=S.canvas;Hs(this.inversePixelTransform,this.pixelTransform),Ee(this.tempTransform,x/2,E/2,v,v,0,-x/2,-E/2),b.width!=x||b.height!=E?(b.width=x,b.height=E):this.containerReused||S.clearRect(0,0,x,E),C&&this.clipUnrotated(S,t,C),u.getInterpolate()||(S.imageSmoothingEnabled=!1),this.preRender(S,t),this.renderedTiles.length=0;let U=Object.keys(D).map(Number);U.sort(Oe);let j,it,T;i.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?U=U.reverse():(j=[],it=[]);for(let _t=U.length-1;_t>=0;--_t){const V=U[_t],Z=u.getTilePixelSize(V,h,r),Ot=g.getResolution(V)/_,rt=Z[0]*Ot*v,zt=Z[1]*Ot*v,Xe=g.getTileCoordForCoordAndZ(ne(w),V),Ui=g.getTileCoordExtent(Xe),We=st(this.tempTransform,[p*(Ui[0]-w[0])/_,p*(w[3]-Ui[3])/_]),Zi=p*u.getGutterForProjection(r),re=D[V];for(const pi in re){const oe=re[pi],Hi=oe.tileCoord,qi=Xe[1]-Hi[1],$i=Math.round(We[0]-(qi-1)*rt),Ye=Xe[2]-Hi[2],is=Math.round(We[1]-(Ye-1)*zt),dt=Math.round(We[0]-qi*rt),Tt=Math.round(We[1]-Ye*zt),Pt=$i-dt,Bt=is-Tt,ze=f===V,Te=ze&&oe.getAlpha(k(this),t.time)!==1;let ae=!1;if(!Te)if(j){T=[dt,Tt,dt+Pt,Tt,dt+Pt,Tt+Bt,dt,Tt+Bt];for(let Be=0,Ji=j.length;Be<Ji;++Be)if(f!==V&&V<it[Be]){const lt=j[Be];ht([dt,Tt,dt+Pt,Tt+Bt],[lt[0],lt[3],lt[4],lt[7]])&&(ae||(S.save(),ae=!0),S.beginPath(),S.moveTo(T[0],T[1]),S.lineTo(T[2],T[3]),S.lineTo(T[4],T[5]),S.lineTo(T[6],T[7]),S.moveTo(lt[6],lt[7]),S.lineTo(lt[4],lt[5]),S.lineTo(lt[2],lt[3]),S.lineTo(lt[0],lt[1]),S.clip())}j.push(T),it.push(V)}else S.clearRect(dt,Tt,Pt,Bt);this.drawTileImage(oe,t,dt,Tt,Pt,Bt,Zi,ze),j&&!Te?(ae&&S.restore(),this.renderedTiles.unshift(oe)):this.renderedTiles.push(oe),this.updateUsedTiles(t.usedTiles,u,oe)}}return this.renderedRevision=d,this.renderedResolution=_,this.extentChanged=!this.renderedExtent_||!Pi(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=h,this.renderedProjection=r,this.manageTilePyramid(t,u,g,h,r,m,f,c.getPreload()),this.scheduleExpireCache(t,u),this.postRender(S,t),i.extent&&S.restore(),S.imageSmoothingEnabled=!0,F!==b.style.transform&&(b.style.transform=F),this.container}drawTileImage(t,e,i,n,r,o,a,l){const h=this.getTileImage(t);if(!h)return;const c=k(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(l?t.getAlpha(c,e.time):1),g=d!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,r,o),g&&this.context.restore(),d!==u.opacity?e.animate=!0:l&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=function(n,r,o){const a=k(n);a in o.usedTiles&&n.expireCache(o.viewState.projection,o.usedTiles[a])}.bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const n=k(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,r,o,a,l,h){const c=k(e);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=t.tileQueue,g=i.getMinZoom(),f=t.viewState.rotation,_=f?Ls(t.viewState.center,t.viewState.resolution,f,t.size):void 0;let m=0,y,p,x,E,C,R;for(R=g;R<=a;++R)for(p=i.getTileRangeForExtentAndZ(o,R,p),x=i.getResolution(R),E=p.minX;E<=p.maxX;++E)for(C=p.minY;C<=p.maxY;++C)f&&!i.tileCoordIntersectsViewport([R,E,C],_)||(a-R<=l?(++m,y=e.getTile(R,E,C,n,r),y.getState()==M.IDLE&&(u[y.getKey()]=!0,d.isKeyQueued(y.getKey())||d.enqueue([y,c,i.getTileCoordCenter(y.tileCoord),x])),h!==void 0&&h(y)):e.useTile(R,E,C,r));e.updateCacheSize(m,r)}}const pg=yg;class xg extends rg{constructor(t){super(t)}createRenderer(){return new pg(this)}}const Eg=xg;class Cg{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return N(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return N(e!==void 0,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(!!this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){N(!(t in this.entries_),16);const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}const Tg=Cg;function jo(s,t,e,i){return i!==void 0?(i[0]=s,i[1]=t,i[2]=e,i):[s,t,e]}function es(s,t,e){return s+"/"+t+"/"+e}function ll(s){return es(s[0],s[1],s[2])}function Rg(s){return s.split("/").map(Number)}function Sg(s){return(s[1]<<s[0])+s[2]}function wg(s,t){const e=s[0],i=s[1],n=s[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,n):!0}class Ig extends Tg{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),i=Rg(t)[0];this.forEach(n=>{n.tileCoord[0]!==i&&(this.remove(ll(n.tileCoord)),n.release())})}}const hl=Ig,Ss={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},qe=[0,0,0],ue=5;class vg{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,N(Rl(this.resolutions_,function(n,r){return r-n},!0),17);let e;if(!t.origins){for(let n=0,r=this.resolutions_.length-1;n<r;++n)if(!e)e=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+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,N(this.origins_.length==this.resolutions_.length,20));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ne(i)),N(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,N(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Qs,N(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),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(function(n,r){const o=new al(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[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},this):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let r=n.minX,o=n.maxX;r<=o;++r)for(let a=n.minY,l=n.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,n){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,n);h>=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),r=He(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 He(r,r+1,o,o+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],o=t[2];if(e===n)return He(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-n),h=Math.floor(r*l),c=Math.floor(o*l);if(e<n)return He(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return He(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,qe);const n=qe[1],r=qe[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,qe);const o=qe[1],a=qe[2];return He(n,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=It(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=It(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*n,a=i[1]-(t[2]+1)*r[1]*n,l=o+r[0]*n,h=a+r[1]*n;return te(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=It(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return n?(c=sn(c,ue)-1,u=sn(u,ue)-1):(c=nn(c,ue),u=nn(u,ue)),jo(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=It(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return n?(h=sn(h,ue)-1,c=sn(c,ue)-1):(h=nn(h,ue),c=nn(c,ue)),jo(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=Us(this.resolutions_,t,e||0);return Q(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Ea(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}}const cl=vg;function ul(s){let t=s.getDefaultTileGrid();return t||(t=Fg(s),s.setDefaultTileGrid(t)),t}function Lg(s,t,e){const i=t[0],n=s.getTileCoordCenter(t),r=dl(e);if(!jn(r,n)){const o=H(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}return t}function Mg(s,t,e,i){i=i!==void 0?i:"top-left";const n=Pg(s,t,e);return new cl({extent:s,origin:Yl(s,i),resolutions:n,tileSize:e})}function Pg(s,t,e,i){t=t!==void 0?t:th,e=It(e!==void 0?e:Qs);const n=Wt(s),r=H(s);i=i>0?i:Math.max(r/e[0],n/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 Fg(s,t,e,i){const n=dl(s);return Mg(n,t,e,i)}function dl(s){s=ct(s);let t=s.getExtent();if(!t){const e=180*Fi.degrees/s.getMetersPerUnit();t=te(-e,-e,e,e)}return t}class Ag extends Ua{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.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&It(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new hl(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let u=i.minY;u<=i.maxY;++u)l=es(e,c,u),h=!1,r.containsKey(l)&&(a=r.get(l),h=a.getState()===M.LOADED,h&&(h=n(a)!==!1)),h||(o=!1);return o}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return A()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:ul(t)}getTileCacheForProjection(t){const e=this.getProjection();return N(e===null||Ie(e,t),68),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=It(n.getTileSize(t),this.tmpSize);return r==1?o:cu(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=Lg(i,t,e)),wg(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class Dg extends Mt{constructor(t,e){super(t),this.tile=e}}const Og=Ag;function bg(s,t){const e=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(!!o)return s.replace(e,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(r,function(){const h=o[0],c=t.getFullTileRange(h);return N(c,55),(c.getHeight()-o[2]-1).toString()})}}function kg(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=bg(s[n],t);return js(i)}function js(s){return s.length===1?s[0]:function(t,e,i){if(!t)return;const n=Sg(t),r=Pe(n,s.length);return s[r](t,e,i)}}function gl(s){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(s);if(e){const i=e[1].charCodeAt(0),n=e[2].charCodeAt(0);let r;for(r=i;r<=n;++r)t.push(s.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(s),e){const i=parseInt(e[2],10);for(let n=parseInt(e[1],10);n<=i;n++)t.push(s.replace(e[0],n.toString()));return t}return t.push(s),t}class zr extends Og{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,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===zr.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=k(e),n=e.getState();let r;n==M.LOADING?(this.tileLoadingKeys_[i]=!0,r=Ss.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==M.ERROR?Ss.TILELOADERROR:n==M.LOADED?Ss.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Dg(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=gl(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
11
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(kg(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=es(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const Gg=zr;class Ng extends Gg{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Xg,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:rl,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const n in this.tileCacheForProjection){const r=this.tileCacheForProjection[n];r.expireCache(r==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Ie(e,t)))return this.tileGrid;const i=k(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=ul(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Ie(e,t))return this.tileCache;const i=k(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new hl(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,n,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,n,r):void 0,c=new this.tileClass(a,h!==void 0?M.IDLE:M.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(O.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||Ie(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let h;const c=ll(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(o),g=this.getTileGridForProjection(r),f=this.getTileCoordForTileUrlFunction(l,r),_=new Vs(o,d,r,g,l,f,this.getTilePixelRatio(n),this.getGutter(),(m,y,p,x)=>this.getTileInternal(m,y,p,x,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return _.key=u,h?(_.interimTile=h,_.refreshInterimChain(),a.replace(c,_)):a.set(c,_),_}getTileInternal(t,e,i,n,r){let o=null;const a=es(t,e,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(t,e,i,n,r,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(t,e,i,n,r,l),h.getState()==M.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}}setTileGridForProjection(t,e){const i=ct(t);if(i){const n=k(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function Xg(s,t){s.getImage().src=t}const Wg=Ng;function Ko(s,t){const e=[];Object.keys(t).forEach(function(n){t[n]!==null&&t[n]!==void 0&&e.push(n+"="+encodeURIComponent(t[n]))});const i=e.join("&");return s=s.replace(/[?&]$/,""),s+=s.includes("?")?"&":"?",s+i}class Yg extends cl{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}const zg=Yg;class Bg extends Wg{constructor(t){const e=t.requestEncoding!==void 0?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;n===void 0&&t.url!==void 0&&(n=gl(t.url)),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:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:t.wrapX!==void 0?t.wrapX:!1,transition:t.transition,zDirection:t.zDirection}),this.version_=t.version!==void 0?t.version:"1.0.0",this.format_=t.format!==void 0?t.format:"image/jpeg",this.dimensions_=t.dimensions!==void 0?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=js(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
|
|
12
|
+
`);this.setTileUrlFunction(js(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e=="KVP"?Ko(t,i):t.replace(/\{(\w+?)\}/g,function(o,a){return a.toLowerCase()in i?i[a.toLowerCase()]:o});const n=this.tileGrid,r=this.dimensions_;return function(o,a,l){if(!o)return;const h={TileMatrix:n.getMatrixId(o[0]),TileCol:o[1],TileRow:o[2]};Object.assign(h,r);let c=t;return e=="KVP"?c=Ko(c,h):c=c.replace(/\{(\w+?)\}/g,function(u,d){return h[d]}),c}}}const Vg=Bg;function jg(s,t,e=!0){const n=ct("EPSG:4326").getExtent(),r=H(n)/256,o=[],a=[];for(let h=0;h<19;++h)o[h]=r/Math.pow(2,h),a[h]=h;let l=t.split("_")[0];return new Eg({properties:{name:t,type:"baseLayer"},source:new Vg({url:"http://t{0-7}.tianditu.gov.cn/"+t+"/wmts?tk="+s,layer:l,style:"default",matrixSet:"c",format:"tiles",crossOrigin:"anonymous",wrapX:!0,tileGrid:new zg({origin:ne(n),resolutions:o.slice(6,20),matrixIds:a.slice(6,20).map(h=>h.toString())})}),visible:e})}class Kg{constructor(t,e={}){je(this,"map");je(this,"layerHandles",new Map);je(this,"selectHandles",new Map);je(this,"highLightLayer",new oi({properties:{name:"highLightLayer"},style:Bs,source:new kn({features:[]}),zIndex:100,declutter:!0}));je(this,"highlightInfo",{id:null,idKey:null,layerName:null,selectName:null});if(!t)throw new Error("target is not defined");this.initMap(t,e)}initMap(t,e={}){let i={maxZoom:22,minZoom:8,zoom:18,projection:"EPSG:4326"};if(Object.assign(i,e),this.map=new Eo({target:t,view:new bt(i),layers:[this.highLightLayer],controls:[],interactions:Da({doubleClickZoom:!1})}),!(this.map instanceof Eo))throw new Error("new map error");this.map.on("moveend",n=>{var r;(r=this.layerHandles)==null||r.forEach(o=>{o==null||o.updateFunc()})})}refreshMap(){var t;(t=this.layerHandles)==null||t.forEach(e=>{e==null||e.updateFunc()})}setMapCenter(t,e){this.map.getView().setCenter(t),e&&this.map.getView().setZoom(e)}toWkt(t){let e=new ys().readGeometry(t);this.map.getView().fit(e.getExtent(),{padding:[50,50,50,50]})}getLayerByName(t){let e=null,i=this.map.getLayers().getArray();for(let n=0;n<i.length;n++)if(i[n].get("name")==t){e=i[n];break}return e}getLayerByProperty(t,e){return this.map.getLayers().getArray().filter(n=>n.get(t)==e)}createUniLayer(t,e=[],i={}){let n={declutter:!0,zIndex:1,properties:{name:t},source:new kn({features:e})};Object.assign(n,i);let r=new oi(n),o=this.getLayerByName(t);return o&&this.map.removeLayer(o),this.map.addLayer(r),r}wktTempRender(t,e,i){t=Array.isArray(t)?t:[t];let n=new ys().readFeatures(t);n.forEach(r=>{var o;e&&r.setProperties(e),(o=this.highLightLayer.getSource())==null||o.addFeature(r),i&&(typeof i=="function"?r.setStyle(i(r,this.map.getView().getResolution())):r.setStyle(i))}),this.locateFeature(n)}createUpdateLayer(t,e=n=>{},i={}){let n=this.createUniLayer(t,[],i),r={layerName:t,layer:n,updateFunc:()=>e(n)};this.layerHandles.set(t,r)}updateLayerFromFeatures(t,e){var h,c,u;let i=e.getSource();if(!i)throw Error(`Unable to preprocessing feature: ${e}`);let n=this.map.getView().calculateExtent(),r=i.getFeaturesInExtent(n),o=i.getFeatures(),a=(h=this.map.getView().getZoom())!=null?h:18,l=[];if(this.selectHandles.forEach(d=>l=l.concat(d.getFeatures().getArray())),o.forEach((d,g)=>{if(l.find(m=>d.getId()===m.getId()))return;if(d.get("max_zoom")<=a||d.get("min_zoom")>a||!d.get("max_zoom")||!d.get("min_zoom")){i.removeFeature(d);return}r.find(m=>d.getId()===m.getId())||i.removeFeature(d)}),i.addFeatures(t),e.get("name")===this.highlightInfo.layerName){let d=(u=(c=e.getSource())==null?void 0:c.getFeatures())!=null?u:[];this.setHighlightFeature(d)}}getMapInfo(t={}){let e=this.map.getView().getZoom(),i=this.map.getView().calculateExtent(this.map.getSize());if(!e)throw Error(`Unable to get map info for zoom ${e}`);return{zoom:e,xmin:i[0],ymin:i[1],xmax:i[2],ymax:i[3],...t}}compareMapInfo(t,e){return["zoom","xmin","ymin","ymax","xmax"].forEach(n=>{if(t[n]!=e[n])return!1}),!0}setHighlightFeature(t){var i,n;let e;if(this.highlightInfo.id&&this.highlightInfo.idKey)for(let r=0;r<t.length;r++){let o=t[r],a=o.get(this.highlightInfo.idKey);if(this.highlightInfo.idKey=="id"&&!a&&(a=o.getId()),this.highlightInfo.id===a){if(this.highlightInfo.selectName){let l=this.selectHandles.get(this.highlightInfo.selectName);l==null||l.getFeatures().clear(),l==null||l.getFeatures().push(o)}else(i=this.highLightLayer.getSource())==null||i.clear(),(n=this.highLightLayer.getSource())==null||n.addFeature(o);e=o,this.resetHighLightInfo();break}}return e}resetHighLightInfo(){this.highlightInfo={id:null,idKey:null,layerName:null,selectName:null}}locateAndHighlight(t,e){var a,l;if(!(t.id&&t.idKey&&t.layerName))throw Error("Please input the correct parameters.");Object.assign(this.highlightInfo,t);let i=()=>{var c,u;let h=this.getLayerByName(t.layerName);if(h&&h instanceof oi){let d=(u=(c=h==null?void 0:h.getSource())==null?void 0:c.getFeatures())!=null?u:[],g=this.setHighlightFeature(d);g&&this.locateFeature(g)}};if(!e){i();return}let n=(a=this.map.getView().getCenter())!=null?a:null,r=new ys().readFeature(e);this.locateFeature(r);let o=(l=this.map.getView().getCenter())!=null?l:null;n&&o&&wt(n,o)&&i()}locateFeature(t){if(!t)return;const e=Array.isArray(t)?t:[t];if(e.length===0)return;let i=e[0].getGeometry().getExtent();e.slice(1).forEach(n=>{$s(i,n.getGeometry().getExtent())}),H(i)===0?this.map.getView().fit(i,{maxZoom:18}):this.map.getView().fit(i,{padding:[100,100,100,100]})}useSelect(t,e={}){let i="click",n=u=>{},r={multi:!1,layers:()=>!0,style:Bs,hitTolerance:10,condition:u=>i==="click"?Rr(u):i==="multiSelect"?po(u):!1,toggleCondition:u=>i==="multiSelect"?po(u):!1};Object.assign(r,e);let o=new vd(r);return o.on("select",u=>{let d=this.selectHandles.keys(),g=[];d.forEach(f=>{let _=this.selectHandles.get(f);_&&_.getActive()&&(g.push(f),_.setActive(!1))}),n(u),g.forEach(f=>{var _;(_=this.selectHandles.get(f))==null||_.setActive(!0)})}),this.selectHandles.get("name")&&this.map.removeInteraction(o),this.selectHandles.set(t,o),this.map.addInteraction(o),{remove:()=>{this.map.removeInteraction(o),this.selectHandles.delete(t)},setSelectMod:u=>{i=u},getSelectMod:()=>i,setEventFunc:u=>{n=u},selectInstance:o}}setSelectActive(t,e){if(!Array.isArray(t)&&!Array.isArray(e)||!(t!=null&&t.length)&&!(e!=null&&e.length))throw new Error("\u5FC5\u987B\u81F3\u5C11\u6307\u5B9A activeLayerNameArray \u6216 inactiveLayerNameArray");let i=this.selectHandles.keys();Array.isArray(t)&&t.forEach(n=>{var r;(r=this.selectHandles.get(n))==null||r.setActive(!0)}),Array.isArray(e)&&e.forEach(n=>{var r;(r=this.selectHandles.get(n))==null||r.setActive(!1)}),!Array.isArray(t)&&Array.isArray(e)&&i.forEach(n=>{var r;e.find(o=>o===n)||(r=this.selectHandles.get(n))==null||r.setActive(!1)}),!Array.isArray(e)&&Array.isArray(t)&&i.forEach(n=>{var r;t.find(o=>o===n)||(r=this.selectHandles.get(n))==null||r.setActive(!0)})}clearAllSelect(){var t;this.selectHandles.forEach(e=>{e.getFeatures().clear()}),(t=this.highLightLayer.getSource())==null||t.clear()}useDraw(t,e={}){let i=c=>{},n,r;t==="Square"?(t="Circle",n=Hd(4)):t==="Box"&&(t="LineString",r=2,n=qd());let o={source:this.highLightLayer.getSource(),type:t,geometryFunction:n,maxPoints:r,stopClick:!0};Object.assign(o,e);let a=new Jd(o);return this.map.addInteraction(a),a.on("drawend",c=>{i(c)}),{drawInstance:a,setEventFunc:c=>{i=c},remove:()=>{this.map.removeInteraction(a)}}}useModify(t={}){let e={source:this.highLightLayer.getSource()};Object.assign(e,t);let i=new ig(e);i.on("modifyend",a=>{n(a)}),this.map.addInteraction(i);let n=a=>{};return{modifyInstance:i,setEventFunc:a=>{n=a},remove:()=>{this.map.removeInteraction(i)}}}clearHighLightSource(){var t;(t=this.highLightLayer.getSource())==null||t.clear()}}exports.colorStyleFunc=ng;exports.default=Kg;exports.highLightStyle=Bs;exports.setColorOpacity=Yr;exports.td4326WMTSPreset=jg;
|