ship_tblr.e53cacd7.js 254 KB

12345678910
  1. class Ko{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Dt=Ko,Te={PROPERTYCHANGE:"propertychange"};class Zo{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var gn=Zo;function bu(s,t,e){let i,n;e=e||ne;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 ne(s,t){return s>t?1:s<t?-1:0}function _n(s,t,e){const i=s.length;if(s[0]<=t)return 0;if(t<=s[i-1])return i-1;{let n;if(e>0){for(n=1;n<i;++n)if(s[n]<t)return n-1}else if(e<0){for(n=1;n<i;++n)if(s[n]<=t)return n}else for(n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return typeof e=="function"?e(t,s[n-1],s[n])>0?n-1:n:s[n-1]-t<t-s[n]?n-1:n}return i-1}}function Uo(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function As(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 se(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 Vo(s,t,e){const i=t||ne;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 Ue(){return!0}function Si(){return!1}function re(){}function jo(s){let t=!1,e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!se(r,i))&&(t=!0,n=this,i=r,e=s.apply(this,arguments)),e}}function Ve(s){for(const t in s)delete s[t]}function je(s){let t;for(t in s)return!1;return!t}class Ho extends gn{constructor(t){super();this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new Dt(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;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,re);delete o[i]}return l}disposeInternal(){this.listeners_&&Ve(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]=re,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}}var wi=Ho,P={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function G(s,t,e,i,n){if(i&&i!==s&&(e=e.bind(i)),n){const o=e;e=function(){s.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function Li(s,t,e,i){return G(s,t,e,i,!0)}function V(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),Ve(s))}class Ai extends wi{constructor(){super();this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=G(this,t[r],e);return n}else return G(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]=Li(this,t[r],e)}else i=Li(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)$o(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)}}Ai.prototype.on;Ai.prototype.once;Ai.prototype.un;function $o(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)V(s[t]);else V(s)}var Ms=Ai;function X(){throw new Error("Unimplemented abstract method.")}let qo=0;function Y(s){return s.ol_uid||(s.ol_uid=String(++qo))}class bs extends Dt{constructor(t,e,i){super(t);this.key=e,this.oldValue=i}}class Jo extends Ms{constructor(t){super();this.on,this.once,this.un,Y(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 bs(i,t,e)),i=Te.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new bs(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],je(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var vt=Jo,B={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"};const Qo={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"};class ta extends Error{constructor(t){const e=Qo[t];super(e);this.code=t,this.name="AssertionError",this.message=e}}var Os=ta;function N(s,t){if(!s)throw new Os(t)}function $(s,t,e){return Math.min(Math.max(s,t),e)}function ea(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 ve(s,t,e,i)}function ve(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function ia(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 Mi(s){return s*Math.PI/180}function Ie(s,t){const e=s%t;return e*t<0?e+t:e}function oe(s,t,e){return s+e*(t-s)}function Ps(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function bi(s,t){return Math.floor(Ps(s,t))}function Oi(s,t){return Math.ceil(Ps(s,t))}class na extends vt{constructor(t){super();this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[B.OPACITY]=t.opacity!==void 0?t.opacity:1,N(typeof e[B.OPACITY]=="number",64),e[B.VISIBLE]=t.visible!==void 0?t.visible:!0,e[B.Z_INDEX]=t.zIndex,e[B.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[B.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[B.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[B.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=$(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return X()}getLayerStatesArray(t){return X()}getExtent(){return this.get(B.EXTENT)}getMaxResolution(){return this.get(B.MAX_RESOLUTION)}getMinResolution(){return this.get(B.MIN_RESOLUTION)}getMinZoom(){return this.get(B.MIN_ZOOM)}getMaxZoom(){return this.get(B.MAX_ZOOM)}getOpacity(){return this.get(B.OPACITY)}getSourceState(){return X()}getVisible(){return this.get(B.VISIBLE)}getZIndex(){return this.get(B.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(B.EXTENT,t)}setMaxResolution(t){this.set(B.MAX_RESOLUTION,t)}setMinResolution(t){this.set(B.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(B.MAX_ZOOM,t)}setMinZoom(t){this.set(B.MIN_ZOOM,t)}setOpacity(t){N(typeof t=="number",64),this.set(B.OPACITY,t)}setVisible(t){this.set(B.VISIBLE,t)}setZIndex(t){this.set(B.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var Ds=na,Zt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class sa extends Ds{constructor(t){const e=Object.assign({},t);delete e.source;super(e);this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(B.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(B.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed()}handleSourcePropertyChange_(){this.sourceChangeKey_&&(V(this.sourceChangeKey_),this.sourceChangeKey_=null);const t=this.getSource();t&&(this.sourceChangeKey_=G(t,P.CHANGE,this.handleSourceChange_,this)),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise(e=>e([]))}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}render(t,e){const i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(B.MAP,t)}getMapInternal(){return this.get(B.MAP)}setMap(t){this.mapPrecomposeKey_&&(V(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(V(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=G(t,Zt.PRECOMPOSE,function(e){const n=e.frameState.layerStatesArray,r=this.getLayerState(!1);N(!n.some(function(o){return o.layer===r.layer}),67),n.push(r)},this),this.mapRenderKey_=G(this,P.CHANGE,t.render,t),this.changed())}setSource(t){this.set(B.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function mn(s,t){if(!s.visible)return!1;const e=t.resolution;if(e<s.minResolution||e>=s.maxResolution)return!1;const i=t.zoom;return i>s.minZoom&&i<=s.maxZoom}var Pi=sa;function ra(s,t,e,i,n){Fs(s,t,e||0,i||s.length-1,n||oa)}function Fs(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));Fs(s,t,c,u,n)}var d=s[t],f=e,g=i;for(He(s,e,t),n(s[i],d)>0&&He(s,e,i);f<g;){for(He(s,f,g),f++,g--;n(s[f],d)<0;)f++;for(;n(s[g],d)>0;)g--}n(s[e],d)===0?He(s,e,g):(g++,He(s,g,i)),g<=t&&(e=g+1),t<=g&&(i=g-1)}}function He(s,t,e){var i=s[t];s[t]=s[e],s[e]=i}function oa(s,t){return s<t?-1:s>t?1:0}class ks{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Fi(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?n(a):a;Fi(t,l)&&(e.leaf?i.push(a):yn(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Fi(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(Fi(t,o)){if(e.leaf||yn(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=we([]),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=aa(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&yn(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=we(t.slice(e,i+1)),Se(a,this.toBBox),a;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),a=we([]),a.leaf=!1,a.height=n;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Ns(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Ns(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,n-1))}}return Se(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=pn(h),u=ca(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),qe(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=we(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Se(i,this.toBBox),Se(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=we([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Se(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=$e(t,0,a,this.toBBox),h=$e(t,a,i,this.toBBox),c=ua(l,h),u=pn(l)+pn(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:la,r=t.leaf?this.compareMinY:ha,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=$e(t,0,e,r),a=$e(t,i-e,i,r);let l=Di(o)+Di(a);for(let h=e;h<i-e;h++){const c=t.children[h];qe(o,t.leaf?r(c):c),l+=Di(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];qe(a,t.leaf?r(c):c),l+=Di(a)}return l}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)qe(e[n],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Se(t[e],this.toBBox)}}function aa(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 Se(s,t){$e(s,0,s.children.length,t,s)}function $e(s,t,e,i,n){n||(n=we(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];qe(n,s.leaf?i(o):o)}return n}function qe(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 la(s,t){return s.minX-t.minX}function ha(s,t){return s.minY-t.minY}function pn(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function Di(s){return s.maxX-s.minX+(s.maxY-s.minY)}function ca(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 ua(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 yn(s,t){return s.minX<=t.minX&&s.minY<=t.minY&&t.maxX<=s.maxX&&t.maxY<=s.maxY}function Fi(s,t){return t.minX<=s.maxX&&t.minY<=s.maxY&&t.maxX>=s.minX&&t.maxY>=s.minY}function we(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ns(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;ra(s,o,t,e,n),r.push(t,o,o,e)}}var J={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Gs(s){return s[0]>0&&s[1]>0}function da(s,t,e){return e===void 0&&(e=[0,0]),e[0]=s[0]*t+.5|0,e[1]=s[1]*t+.5|0,e}function ft(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}class xn{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ft(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new xn({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return X()}getImage(t){return X()}getHitDetectionImage(){return X()}getPixelRatio(t){return 1}getImageState(){return X()}getImageSize(){return X()}getOrigin(){return X()}getSize(){return X()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ft(t)}listenImageChange(t){X()}load(){X()}unlistenImageChange(t){X()}}var Xs=xn;const fa=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ga=/^([a-z]*)$|^hsla?\(.*\)$/i;function Ws(s){return typeof s=="string"?s:zs(s)}function _a(s){const t=document.createElement("div");if(t.style.color=s,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}else return""}const ma=function(){const s=1024,t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=s){let r=0;for(const o in t)(r++&3)==0&&(delete t[o],--e)}n=pa(i),t[i]=n,++e}return n}}();function ki(s){return Array.isArray(s)?s:ma(s)}function pa(s){let t,e,i,n,r;if(ga.exec(s)&&(s=_a(s)),fa.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),Ys(r)):s.startsWith("rgb(")?(r=s.slice(4,-1).split(",").map(Number),r.push(1),Ys(r)):N(!1,14);return r}function Ys(s){return s[0]=$(s[0]+.5|0,0,255),s[1]=$(s[1]+.5|0,0,255),s[2]=$(s[2]+.5|0,0,255),s[3]=$(s[3],0,1),s}function zs(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*100)/100;return"rgba("+t+","+e+","+i+","+n+")"}function It(s){return Array.isArray(s)?zs(s):s}const Ut=typeof navigator!="undefined"&&typeof navigator.userAgent!="undefined"?navigator.userAgent.toLowerCase():"",ya=Ut.includes("firefox"),xa=Ut.includes("safari")&&!Ut.includes("chrom");xa&&(Ut.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Ut));const Ea=Ut.includes("webkit")&&!Ut.includes("edge"),Ca=Ut.includes("macintosh"),Bs=typeof devicePixelRatio!="undefined"?devicePixelRatio:1,En=typeof WorkerGlobalScope!="undefined"&&typeof OffscreenCanvas!="undefined"&&self instanceof WorkerGlobalScope,Ra=typeof Image!="undefined"&&Image.prototype.decode,Ks=function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s}();function gt(s,t,e,i){let n;return e&&e.length?n=e.shift():En?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}function Zs(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Us(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Cn(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}function Ta(s){for(;s.lastChild;)s.removeChild(s.lastChild)}function va(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}const Ni="ol-hidden",Gi="ol-unselectable",Rn="ol-control",Vs="ol-collapsed",Ia=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"),js=["style","variant","weight","size","lineHeight","family"],Hs=function(s){const t=s.match(Ia);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,n=js.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[js[i]]=r)}return e.families=e.family.split(/,\s?/),e},$s="10px sans-serif",Ft="#000",Xi="round",Je=[],Qe=0,Le="round",ti=10,ei="#000",ii="center",Wi="middle",ae=[0,0,0,0],ni=1,kt=new vt;let Ae=null,Tn;const vn={},Sa=function(){const s=100,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 f=0;f<i;++f){const g=e[f];if(o=Yi(h+" "+c+" "+t+g,n),u!=g){const _=Yi(h+" "+c+" "+t+u+","+g,n);d=d&&_!=o}}return!!d}function l(){let h=!0;const c=kt.getKeys();for(let u=0,d=c.length;u<d;++u){const f=c[u];kt.get(f)<s&&(a.apply(this,f.split(`
  2. `))?(Ve(vn),Ae=null,Tn=void 0,kt.set(f,s)):(kt.set(f,kt.get(f)+1,!0),h=!1))}h&&(clearInterval(r),r=void 0)}return function(h){const c=Hs(h);if(!c)return;const u=c.families;for(let d=0,f=u.length;d<f;++d){const g=u[d],_=c.style+`
  3. `+c.weight+`
  4. `+g;kt.get(_)===void 0&&(kt.set(_,s,!0),a(c.style,c.weight,g)||(kt.set(_,0,!0),r===void 0&&(r=setInterval(l,32))))}}}(),wa=function(){let s;return function(t){let e=vn[t];if(e==null){if(En){const i=Hs(t),n=qs(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);vn[t]=e}return e}}();function qs(s,t){return Ae||(Ae=gt(1,1)),s!=Tn&&(Ae.font=s,Tn=Ae.font),Ae.measureText(t)}function Yi(s,t){return qs(s,t).width}function Js(s,t,e){if(t in e)return e[t];const i=t.split(`
  5. `).reduce((n,r)=>Math.max(n,Yi(s,r)),0);return e[t]=i,i}function La(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,f=Yi(d,u);e.push(f),o+=f;const g=wa(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function Aa(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]),Ma(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 Ma(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 In extends Xs{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 In({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=gt(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 T=n;n=r,r=T}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 f=e/2/d,g=e/2*(c/u),m=Math.sqrt((n+f)*(n+f)+g*g)-n;if(this.radius2_===void 0||t==="bevel")return m*2;const p=n*Math.sin(a),y=Math.sqrt(n*n-p*p),x=r-y,C=Math.sqrt(p*p+x*x)/p;if(C<=i){const T=C*e/2-r-n;return 2*Math.max(m,T)}return m*2}createRenderOptions(){let t=Le,e=0,i=null,n=0,r,o=0;this.stroke_&&(r=this.stroke_.getColor(),r===null&&(r=ei),r=It(r),o=this.stroke_.getWidth(),o===void 0&&(o=ni),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=Le),e=this.stroke_.getMiterLimit(),e===void 0&&(e=ti));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=It(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=ki(e)),e===null?i=1:Array.isArray(e)&&(i=e.length===4?e[3]:1),i===0){const n=gt(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())}}var Qs=In;class Sn extends Qs{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 Sn({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()}}var tr=Sn;class wn{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null}clone(){const t=this.getColor();return new wn({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}var Ln=wn;class An{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 An({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}}var er=An;class zi{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ir,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 zi({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_=ir,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function ba(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 Mn=null;function Oa(s,t){if(!Mn){const e=new Ln({color:"rgba(255,255,255,0.4)"}),i=new er({color:"#3399CC",width:1.25});Mn=[new zi({image:new tr({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Mn}function ir(s){return s.getGeometry()}var bn=zi;class Pa{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=nr(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=nr(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function nr(s,t,e){const i=e?Ws(e):"null";return t+":"+s+":"+i}const Bi=new Pa;var tt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function sr(s){const t=xt();for(let e=0,i=s.length;e<i;++e)ri(t,s[e]);return t}function On(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 rr(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function or(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 Ki(s,t){return ar(s,t[0],t[1])}function Me(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function ar(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Pn(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=tt.UNKNOWN;return o<e?l=l|tt.LEFT:o>n&&(l=l|tt.RIGHT),a<i?l=l|tt.BELOW:a>r&&(l=l|tt.ABOVE),l===tt.UNKNOWN&&(l=tt.INTERSECTING),l}function xt(){return[1/0,1/0,-1/0,-1/0]}function Nt(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Zi(s){return Nt(1/0,1/0,-1/0,-1/0,s)}function Da(s,t){const e=s[0],i=s[1];return Nt(e,i,e,i,t)}function Fa(s,t,e,i,n){const r=Zi(n);return lr(r,s,t,e,i)}function si(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function ka(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 ri(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 lr(s,t,e,i,n){for(;e<i;e+=n)Na(s,t[e],t[e+1]);return s}function Na(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 hr(s,t){let e;return e=t(Ui(s)),e||(e=t(Vi(s)),e)||(e=t(ji(s)),e)||(e=t(le(s)),e)?e:!1}function Dn(s){let t=0;return Nn(s)||(t=U(s)*St(s)),t}function Ui(s){return[s[0],s[1]]}function Vi(s){return[s[2],s[1]]}function be(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Ga(s,t){let e;return t==="bottom-left"?e=Ui(s):t==="bottom-right"?e=Vi(s):t==="top-left"?e=le(s):t==="top-right"?e=ji(s):N(!1,13),e}function Fn(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=kn(s,t,e,i);return Nt(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 kn(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],f=s[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function St(s){return s[3]-s[1]}function oi(s,t,e){const i=e||xt();return lt(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]):Zi(i),i}function le(s){return[s[0],s[3]]}function ji(s){return[s[2],s[3]]}function U(s){return s[2]-s[0]}function lt(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function Nn(s){return s[2]<s[0]||s[3]<s[1]}function Xa(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Wa(s,t,e){let i=!1;const n=Pn(s,t),r=Pn(s,e);if(n===tt.INTERSECTING||r===tt.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],f=e[1],g=(f-u)/(d-c);let _,m;!!(r&tt.ABOVE)&&!(n&tt.ABOVE)&&(_=d-(f-h)/g,i=_>=o&&_<=l),!i&&!!(r&tt.RIGHT)&&!(n&tt.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=h),!i&&!!(r&tt.BELOW)&&!(n&tt.BELOW)&&(_=d-(f-a)/g,i=_>=o&&_<=l),!i&&!!(r&tt.LEFT)&&!(n&tt.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=h)}return i}function cr(s,t){const e=t.getExtent(),i=be(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=U(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Ya(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]]];cr(s,t);const i=U(e);if(U(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 ur(s,t,e){const i=s;let n=!0,r=!1,o=!1;const a=[Li(i,P.LOAD,function(){o=!0,r||t()})];return i.src&&Ra?(r=!0,i.decode().then(function(){n&&t()}).catch(function(l){n&&(o?t():e())})):a.push(Li(i,P.ERROR,e)),function(){n=!1,a.forEach(V)}}let ai=null;class za extends wi{constructor(t,e,i,n,r,o){super();this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===J.LOADED){ai||(ai=gt(1,1)),ai.drawImage(this.image_,0,0);try{ai.getImageData(0,0,1,1),this.tainted_=!1}catch{ai=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=J.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=J.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=gt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===J.IDLE){this.image_||this.initializeImage_(),this.imageState_=J.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=ur(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=Ws(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 Ba(s,t,e,i,n,r){let o=Bi.get(t,i,r);return o||(o=new za(s,t,e,i,n,r),Bi.set(t,i,r,o)),o}class Gn extends Xs{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode});this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;N(!(a!==void 0&&o),4),N(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||Y(o)),N(a!==void 0&&a.length>0,6);const l=t.src!==void 0?J.IDLE:J.LOADED;this.color_=t.color!==void 0?ki(t.color):null,this.iconImage_=Ba(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null}clone(){const t=this.getScale();return new Gn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}listenImageChange(t){this.iconImage_.addEventListener(P.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(P.CHANGE,t)}}var dr=Gn;const Ka="#333";class Xn{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=ft(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Ln({color:Ka}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new Xn({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ft(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var Za=Xn;function fr(s){return new bn({fill:li(s,""),stroke:hi(s,""),text:Ua(s),image:Va(s)})}function li(s,t){const e=s[t+"fill-color"];if(!!e)return new Ln({color:e})}function hi(s,t){const e=s[t+"stroke-width"],i=s[t+"stroke-color"];if(!(!e&&!i))return new er({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 Ua(s){const t=s["text-value"];return t?new Za({text:t,font:s["text-font"],maxAngle:s["text-max-angle"],offsetX:s["text-offset-x"],offsetY:s["text-offset-y"],overflow:s["text-overflow"],placement:s["text-placement"],scale:s["text-scale"],rotateWithView:s["text-rotate-with-view"],rotation:s["text-rotation"],textAlign:s["text-align"],justify:s["text-justify"],textBaseline:s["text-baseline"],padding:s["text-padding"],fill:li(s,"text-"),backgroundFill:li(s,"text-background-"),stroke:hi(s,"text-"),backgroundStroke:hi(s,"text-background-")}):void 0}function Va(s){const t=s["icon-src"],e=s["icon-img"];if(t||e)return new dr({src:t,img:e,imgSize:s["icon-img-size"],anchor:s["icon-anchor"],anchorOrigin:s["icon-anchor-origin"],anchorXUnits:s["icon-anchor-x-units"],anchorYUnits:s["icon-anchor-y-units"],color:s["icon-color"],crossOrigin:s["icon-cross-origin"],offset:s["icon-offset"],displacement:s["icon-displacement"],opacity:s["icon-opacity"],scale:s["icon-scale"],rotation:s["icon-rotation"],rotateWithView:s["icon-rotate-with-view"],size:s["icon-size"],declutterMode:s["icon-declutter-mode"]});const i=s["shape-points"];if(i){const r="shape-";return new Qs({points:i,fill:li(s,r),stroke:hi(s,r),radius:s["shape-radius"],radius1:s["shape-radius1"],radius2:s["shape-radius2"],angle:s["shape-angle"],displacement:s["shape-displacement"],rotation:s["shape-rotation"],rotateWithView:s["shape-rotate-with-view"],scale:s["shape-scale"],declutterMode:s["shape-declutter-mode"]})}const n=s["circle-radius"];if(n){const r="circle-";return new tr({radius:n,fill:li(s,r),stroke:hi(s,r),displacement:s["circle-displacement"],scale:s["circle-scale"],rotation:s["circle-rotation"],rotateWithView:s["circle-rotate-with-view"],declutterMode:s["circle-declutter-mode"]})}}const gr={RENDER_ORDER:"renderOrder"};class ja extends Pi{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting;super(e);this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(gr.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 ks(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(gr.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=Oa;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof bn)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 bn?n[r]=o:n[r]=fr(o)}e=n}else e=fr(t);this.style_=e,this.styleFunction_=t===null?void 0:ba(this.style_),this.changed()}}var Ha=ja;const ci={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},Hi=[ci.FILL],Vt=[ci.STROKE],he=[ci.BEGIN_PATH],_r=[ci.CLOSE_PATH];var b=ci;class $a{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){}}var mr=$a;function Oe(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 $i(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++]=Oe(s,t,l,i,n[r]),t=l}return n.length=r,n}function pr(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?[]:$i(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}class qa extends mr{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],Ki(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 f=!0,g,_,m;for(g=e+n;g<i;g+=n)d[0]=t[g],d[1]=t[g+1],m=Pn(h,d),m!==_?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):m===tt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],_=m;return(r&&f||g===e+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 f=t.getEndss();d=0;for(let g=0,_=f.length;g<_;++g){const m=[];d=this.drawCustomCoordinates_(l,d,f[g],o,m),u.push(m)}this.instructions.push([b.CUSTOM,a,u,t,i,pr]),this.hitDetectionInstructions.push([b.CUSTOM,a,u,t,n||i,pr]);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([b.CUSTOM,a,c,t,i,$i]),this.hitDetectionInstructions.push([b.CUSTOM,a,c,t,n||i,$i]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([b.CUSTOM,a,h,t,i,Oe]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,n||i,Oe]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([b.CUSTOM,a,h,t,i,Oe]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,n||i,Oe]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([b.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,n||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[b.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[b.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==b.END_GEOMETRY?o=e:r==b.BEGIN_GEOMETRY&&(n[2]=e,Uo(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const n=t.getColor();i.fillStyle=It(n||Ft)}else i.fillStyle=void 0;if(e){const n=e.getColor();i.strokeStyle=It(n||ei);const r=e.getLineCap();i.lineCap=r!==void 0?r:Xi;const o=e.getLineDash();i.lineDash=o?o.slice():Je;const a=e.getLineDashOffset();i.lineDashOffset=a||Qe;const l=e.getLineJoin();i.lineJoin=l!==void 0?l:Le;const h=e.getWidth();i.lineWidth=h!==void 0?h:ni;const c=e.getMiterLimit();i.miterLimit=c!==void 0?c:ti,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=[b.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[b.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,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&&!se(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=[b.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=rr(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;On(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var ui=qa;class Ja extends ui{constructor(t,e,i,n){super(t,e,i,n);this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([b.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([b.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([b.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([b.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}var Qa=Ja;class tl extends ui{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[b.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([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Je,Qe],he);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Vt),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],he);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(Vt),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Vt),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Vt),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(he)}}var el=tl;function yr(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 f=0;const g=s[d],_=s[d+1],m=s[u],p=s[u+1];for(let y=d+i;y<u;y+=i){const x=s[y],E=s[y+1],C=ea(x,E,g,_,m,p);C>f&&(c=y,f=C)}f>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 Ou(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=yr(s,t,c,i,n,r,o),a.push(o),t=c}return o}function ce(s,t){return t*Math.round(s/t)}function il(s,t,e,i,n,r,o){if(t==e)return o;let a=ce(s[t],n),l=ce(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=ce(s[t],n),c=ce(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=ce(s[t],n),d=ce(s[t+1],n);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function xr(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=il(s,t,c,i,n,r,o),a.push(o),t=c}return o}function Pu(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=xr(s,t,c,i,n,r,o,u),a.push(u),t=c[c.length-1]}return o}class nl extends ui{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(he),this.hitDetectionInstructions.push(he);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,n,!0,!a),f=[b.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(_r),this.hitDetectionInstructions.push(_r)),e=c}return o&&(this.instructions.push(Hi),this.hitDetectionInstructions.push(Hi)),a&&(this.instructions.push(Vt),this.hitDetectionInstructions.push(Vt)),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([b.SET_FILL_STYLE,Ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[b.CIRCLE,l];this.instructions.push(he,h),this.hitDetectionInstructions.push(he,h),i.fillStyle!==void 0&&(this.instructions.push(Hi),this.hitDetectionInstructions.push(Hi)),i.strokeStyle!==void 0&&(this.instructions.push(Vt),this.hitDetectionInstructions.push(Vt)),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([b.SET_FILL_STYLE,Ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);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([b.SET_FILL_STYLE,Ft]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);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]=ce(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)}}var Er=nl;function sl(s,t,e,i,n){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,_,m,p,y,x;for(u=e;u<i;u+=n){const E=t[u],C=t[u+1];g!==void 0&&(y=E-g,x=C-_,f=Math.sqrt(y*y+x*x),m!==void 0&&(l+=d,c=Math.acos((m*y+p*x)/(d*f)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=f,m=y,p=x),g=E,_=C}return l+=f,l>a?[h,u]:[r,o]}const di={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class rl extends ui{constructor(t,e,i,n){super(t,e,i,n);this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!lt(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const _=t.getEndss();u=[];for(let m=0,p=_.length;m<p;++m)u.push(_[m][0])}this.beginGeometry(t,e);const d=r.textAlign;let f=0,g;for(let _=0,m=u.length;_<m;++_){if(d==null){const y=sl(r.maxAngle,h,f,u[_],c);f=y[0],g=y[1]}else g=u[_];for(let y=f;y<g;y+=c)o.push(h[y],h[y+1]);const p=o.length;f=u[_],this.drawChars_(a,p),a=p}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 m=t.getFlatInteriorPoints();h=[];for(let p=0,y=m.length;p<y;p+=3)r.overflow||u.push(m[p+2]/this.resolution),h.push(m[p],m[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 m=a/2;u=u.filter((p,y)=>{const x=o[(m+y)*2]===h[y*c]&&o[(m+y)*2+1]===h[y*c+1];return x||--m,x})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let f=r.padding;if(f!=ae&&(r.scale[0]<0||r.scale[1]<0)){let m=r.padding[0],p=r.padding[1],y=r.padding[2],x=r.padding[3];r.scale[0]<0&&(p=-p,x=-x),r.scale[1]<0&&(m=-m,y=-y),f=[m,p,y,x]}const g=this.pixelRatio;this.instructions.push([b.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==ae?ae:f.map(function(m){return m*g}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const _=1/g;this.hitDetectionInstructions.push([b.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,void 0,this.declutterImageWithText_,f,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||ii,justify:e.justify,textBaseline:e.textBaseline||Wi,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=di[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([b.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([b.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,1,c,r,d,u,o,1/l])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=It(o.getColor()||Ft)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const g=a.getLineDash(),_=a.getLineDashOffset(),m=a.getWidth(),p=a.getMiterLimit();r.lineCap=a.getLineCap()||Xi,r.lineDash=g?g.slice():Je,r.lineDashOffset=_===void 0?Qe:_,r.lineJoin=a.getLineJoin()||Le,r.lineWidth=m===void 0?ni:m,r.miterLimit=p===void 0?ti:p,r.strokeStyle=It(a.getColor()||ei)}i=this.textState_;const l=t.getFont()||$s;Sa(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Wi,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||ae,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:Y(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+Y(n.fillStyle):""}this.declutterImageWithText_=e}}const ol={Circle:Er,Default:ui,Image:Qa,LineString:el,Polygon:Er,Text:rl};class al{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=ol[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}var Cr=al;class ll extends Ms{constructor(t){super();this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return X()}getData(t){return null}prepareFrame(t){return X()}renderFrame(t,e){return X()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return function(n,r){const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,o)}.bind(this)}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){t.target.getState()===J.LOADED&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=J.LOADED&&e!=J.ERROR&&t.addEventListener(P.CHANGE,this.boundHandleImageChange_),e==J.IDLE&&(t.load(),e=t.getState()),e==J.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}var hl=ll;class cl extends Dt{constructor(t,e,i,n){super(t);this.inversePixelTransform=e,this.frameState=i,this.context=n}}var Rr=cl;new Array(6);function wt(){return[1,0,0,1,0,0]}function Du(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=s[4],a=s[5],l=t[0],h=t[1],c=t[2],u=t[3],d=t[4],f=t[5];return s[0]=e*l+n*h,s[1]=i*l+r*h,s[2]=e*c+n*u,s[3]=i*c+r*u,s[4]=e*d+n*f+o,s[5]=i*d+r*f+a,s}function ul(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 dl(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function et(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function fl(s,t,e){return ul(s,t,0,0,e,0,0)}function jt(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Wn(s,t){const e=gl(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 gl(s){return s[0]*s[3]-s[1]*s[2]}let Tr;function vr(s){const t="matrix("+s.join(", ")+")";if(En)return t;const e=Tr||(Tr=document.createElement("div"));return e.style.transform=t,e.style.transform}const Ir=[];let Pe=null;function _l(){const s=document.createElement("canvas");s.width=1,s.height=1,Pe=s.getContext("2d")}class ml extends hl{constructor(t){super(t);this.container=null,this.renderedResolution,this.tempTransform=wt(),this.pixelTransform=wt(),this.inversePixelTransform=wt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){Pe||_l(),Pe.clearRect(0,0,1,1);let n;try{Pe.drawImage(t,e,i,1,1,0,0,1,1),n=Pe.getImageData(0,0,1,1).data}catch{return Pe=null,null}return n}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&se(ki(t.style.backgroundColor),ki(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){r=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=gt();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=le(i),r=ji(i),o=Vi(i),a=Ui(i);et(e.coordinateToPixelTransform,n),et(e.coordinateToPixelTransform,r),et(e.coordinateToPixelTransform,o),et(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;et(l,n),et(l,r),et(l,o),et(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Rr(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Zt.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Zt.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,o,a){const l=r/2,h=o/2,c=n/e,u=-c,d=-t[0]+a,f=-t[1];return jt(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}var Sr=ml;function ue(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 wr(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 f=s[d]-h,g=s[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let _=d+2;_<d+i;++_)o[u++]=s[_]}return o&&o.length!=u&&(o.length=u),o}function pl(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,f=s[u+1]-h;a[c++]=l+n*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=s[g]}return a&&a.length!=c&&(a.length=c),a}function yl(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}function xl(s,t,e,i,n,r,o,a,l,h,c,u){let d=s[t],f=s[t+1],g=0,_=0,m=0,p=0;function y(){g=d,_=f,t+=i,d=s[t],f=s[t+1],p+=m,m=Math.sqrt((d-g)*(d-g)+(f-_)*(f-_))}do y();while(t<e-i&&p+m<r);let x=m===0?0:(r-p)/m;const E=oe(g,d,x),C=oe(_,f,x),T=t-i,I=p,S=r+a*l(h,n,c);for(;t<e-i&&p+m<S;)y();x=m===0?0:(S-p)/m;const A=oe(g,d,x),O=oe(_,f,x);let W;if(u){const M=[E,C,A,O];wr(M,0,4,2,u,M,M),W=M[0]>M[2]}else W=E>A;const k=Math.PI,F=[],q=T+i===t;t=T,m=0,p=I,d=s[t],f=s[t+1];let w;if(q){y(),w=Math.atan2(f-_,d-g),W&&(w+=w>0?-k:k);const M=(A+E)/2,v=(O+C)/2;return F[0]=[M,v,(S-r)/2,w,n],F}n=n.replace(/\n/g," ");for(let M=0,v=n.length;M<v;){y();let D=Math.atan2(f-_,d-g);if(W&&(D+=D>0?-k:k),w!==void 0){let z=D-w;if(z+=z>k?-2*k:z<-k?2*k:0,Math.abs(z)>o)return null}w=D;const j=M;let Z=0;for(;M<v;++M){const z=W?v-M-1:M,K=a*l(h,n[z],c);if(t+i<e&&p+m<r+Z+K/2)break;Z+=K}if(M===j)continue;const Q=W?n.substring(v-j,v-M):n.substring(j,M);x=m===0?0:(r+Z/2-p)/m;const R=oe(g,d,x),ct=oe(_,f,x);F.push([R,ct,Z/2,D,Q]),r+=Z}return F}function El(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 De=xt(),Ht=[],Gt=[],Xt=[],$t=[];function Lr(s){return s[3].declutterBox}const Cl=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 Ar(s,t){return(t==="start"||t==="end")&&!Cl.test(s)&&(t=t==="start"?"left":"right"),di[t]}function Rl(s,t,e){return e>0&&s.push(`
  7. `,""),s.push(t,""),s}class Tl{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=wt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?di[l.justify]:Ar(Array.isArray(t)?t[0]:t,l.textAlign||ii),f=n&&o.lineWidth?o.lineWidth:0,g=u?t:t.split(`
  8. `).reduce(Rl,[]),{width:_,height:m,widths:p,heights:y,lineWidths:x}=La(l,g),E=_+f,C=[],T=(E+2)*c[0],I=(m+f)*c[1],S={width:T<0?Math.floor(T):Math.ceil(T),height:I<0?Math.floor(I):Math.ceil(I),contextInstructions:C};(c[0]!=1||c[1]!=1)&&C.push("scale",c),n&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",f),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),i&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const A=.5-d;let O=d*E+A*f;const W=[],k=[];let F=0,q=0,w=0,M=0,v;for(let D=0,j=g.length;D<j;D+=2){const Z=g[D];if(Z===`
  9. `){q+=F,F=0,O=d*E+A*f,++M;continue}const Q=g[D+1]||l.font;Q!==v&&(n&&W.push("font",Q),i&&k.push("font",Q),v=Q),F=Math.max(F,y[w]);const R=[Z,O+A*p[w]+d*(p[w]-x[M]),.5*(f+F)+q];O+=p[w],n&&W.push("strokeText",R),i&&k.push("fillText",R),++w}return Array.prototype.push.apply(C,W),Array.prototype.push.apply(C,k),this.labels_[r]=S,S}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,f,g,_,m){a*=d[0],l*=d[1];let p=i-a,y=n-l;const x=r+h>t?t-h:r,E=o+c>e?e-c:o,C=g[3]+x*d[0]+g[1],T=g[0]+E*d[1]+g[2],I=p-g[3],S=y-g[0];(_||u!==0)&&(Ht[0]=I,$t[0]=I,Ht[1]=S,Gt[1]=S,Gt[0]=I+C,Xt[0]=Gt[0],Xt[1]=S+T,$t[1]=Xt[1]);let A;return u!==0?(A=jt(wt(),i,n,1,1,u,-i,-n),et(A,Ht),et(A,Gt),et(A,Xt),et(A,$t),Nt(Math.min(Ht[0],Gt[0],Xt[0],$t[0]),Math.min(Ht[1],Gt[1],Xt[1],$t[1]),Math.max(Ht[0],Gt[0],Xt[0],$t[0]),Math.max(Ht[1],Gt[1],Xt[1],$t[1]),De)):Nt(Math.min(I,I+C),Math.min(S,S+T),Math.max(I,I+C),Math.max(S,S+T),De),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:De[0],minY:De[1],maxX:De[2],maxY:De[3],value:m},canvasTransform:A,scale:d}}replayImageOrLabel_(t,e,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=t.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,Ht,Gt,Xt,$t,o,a),Aa(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=et(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Ar(Array.isArray(t)?t[0]:t,r.textAlign||ii),c=di[r.textBaseline||Wi],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,n,r,o,a,l){let h;this.pixelCoordinates_&&se(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=ue(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),dl(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,f,g,_,m,p,y,x,E,C,T,I,S,A=0,O=0,W=null,k=null;const F=this.coordinateCache_,q=this.viewRotation_,w=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:q},v=this.instructions!=n||this.overlaps?0:200;let D,j,Z,Q;for(;c<u;){const R=n[c];switch(R[0]){case b.BEGIN_GEOMETRY:D=R[1],Q=R[3],D.getGeometry()?a!==void 0&&!lt(a,Q.getExtent())?c=R[2]+1:++c:c=R[2];break;case b.BEGIN_PATH:A>v&&(this.fill_(t),A=0),O>v&&(t.stroke(),O=0),!A&&!O&&(t.beginPath(),m=NaN,p=NaN),++c;break;case b.CIRCLE:d=R[1];const z=h[d],K=h[d+1],Yt=h[d+2],Tt=h[d+3],it=Yt-z,Mt=Tt-K,pe=Math.sqrt(it*it+Mt*Mt);t.moveTo(z+pe,K),t.arc(z,K,pe,0,2*Math.PI,!0),++c;break;case b.CLOSE_PATH:t.closePath(),++c;break;case b.CUSTOM:d=R[1],f=R[2];const yi=R[3],ye=R[4],xi=R.length==6?R[5]:void 0;M.geometry=yi,M.feature=D,c in F||(F[c]=[]);const zt=F[c];xi?xi(h,d,f,2,zt):(zt[0]=h[d],zt[1]=h[d+1],zt.length=2),ye(zt,M),++c;break;case b.DRAW_IMAGE:d=R[1],f=R[2],E=R[3],g=R[4],_=R[5];let ze=R[6];const Bt=R[7],Ei=R[8],Ci=R[9],Ri=R[10];let xe=R[11];const cn=R[12];let ot=R[13];const _t=R[14],yt=R[15];if(!E&&R.length>=20){C=R[19],T=R[20],I=R[21],S=R[22];const ut=this.drawLabelWithPointPlacement_(C,T,I,S);E=ut.label,R[3]=E;const Re=R[23];g=(ut.anchorX-Re)*this.pixelRatio,R[4]=g;const mt=R[24];_=(ut.anchorY-mt)*this.pixelRatio,R[5]=_,ze=E.height,R[6]=ze,ot=E.width,R[13]=ot}let bt;R.length>25&&(bt=R[25]);let Ee,ie,Kt;R.length>17?(Ee=R[16],ie=R[17],Kt=R[18]):(Ee=ae,ie=!1,Kt=!1),Ri&&w?xe+=q:!Ri&&!w&&(xe-=q);let Ce=0;for(;d<f;d+=2){if(bt&&bt[Ce++]<ot/this.pixelRatio)continue;const ut=this.calculateImageOrLabelDimensions_(E.width,E.height,h[d],h[d+1],ot,ze,g,_,Ei,Ci,xe,cn,r,Ee,ie||Kt,D),Re=[t,e,E,ut,Bt,ie?W:null,Kt?k:null];if(l){if(_t==="none")continue;if(_t==="obstacle"){l.insert(ut.declutterBox);continue}else{let mt,Ot;if(yt){const dt=f-d;if(!yt[dt]){yt[dt]=Re;continue}if(mt=yt[dt],delete yt[dt],Ot=Lr(mt),l.collides(Ot))continue}if(l.collides(ut.declutterBox))continue;mt&&(l.insert(Ot),this.replayImageOrLabel_.apply(this,mt)),l.insert(ut.declutterBox)}}this.replayImageOrLabel_.apply(this,Re)}++c;break;case b.DRAW_CHARS:const Ti=R[1],rt=R[2],un=R[3],Yo=R[4];S=R[5];const zo=R[6],vs=R[7],Is=R[8];I=R[9];const dn=R[10];C=R[11],T=R[12];const Ss=[R[13],R[13]],fn=this.textStates[T],Be=fn.font,Ke=[fn.scale[0]*vs,fn.scale[1]*vs];let Ze;Be in this.widths_?Ze=this.widths_[Be]:(Ze={},this.widths_[Be]=Ze);const ws=El(h,Ti,rt,2),Ls=Math.abs(Ke[0])*Js(Be,C,Ze);if(Yo||Ls<=ws){const ut=this.textStates[T].textAlign,Re=(ws-Ls)*di[ut],mt=xl(h,Ti,rt,2,C,Re,zo,Math.abs(Ke[0]),Js,Be,Ze,w?0:this.viewRotation_);t:if(mt){const Ot=[];let dt,vi,Ii,at,pt;if(I)for(dt=0,vi=mt.length;dt<vi;++dt){pt=mt[dt],Ii=pt[4],at=this.createLabel(Ii,T,"",I),g=pt[2]+(Ke[0]<0?-dn:dn),_=un*at.height+(.5-un)*2*dn*Ke[1]/Ke[0]-Is;const Pt=this.calculateImageOrLabelDimensions_(at.width,at.height,pt[0],pt[1],at.width,at.height,g,_,0,0,pt[3],Ss,!1,ae,!1,D);if(l&&l.collides(Pt.declutterBox))break t;Ot.push([t,e,at,Pt,1,null,null])}if(S)for(dt=0,vi=mt.length;dt<vi;++dt){pt=mt[dt],Ii=pt[4],at=this.createLabel(Ii,T,S,""),g=pt[2],_=un*at.height-Is;const Pt=this.calculateImageOrLabelDimensions_(at.width,at.height,pt[0],pt[1],at.width,at.height,g,_,0,0,pt[3],Ss,!1,ae,!1,D);if(l&&l.collides(Pt.declutterBox))break t;Ot.push([t,e,at,Pt,1,null,null])}l&&l.load(Ot.map(Lr));for(let Pt=0,Bo=Ot.length;Pt<Bo;++Pt)this.replayImageOrLabel_.apply(this,Ot[Pt])}}++c;break;case b.END_GEOMETRY:if(o!==void 0){D=R[1];const ut=o(D,Q);if(ut)return ut}++c;break;case b.FILL:v?A++:this.fill_(t),++c;break;case b.MOVE_TO_LINE_TO:for(d=R[1],f=R[2],j=h[d],Z=h[d+1],y=j+.5|0,x=Z+.5|0,(y!==m||x!==p)&&(t.moveTo(j,Z),m=y,p=x),d+=2;d<f;d+=2)j=h[d],Z=h[d+1],y=j+.5|0,x=Z+.5|0,(d==f-2||y!==m||x!==p)&&(t.lineTo(j,Z),m=y,p=x);++c;break;case b.SET_FILL_STYLE:W=R,this.alignFill_=R[2],A&&(this.fill_(t),A=0,O&&(t.stroke(),O=0)),t.fillStyle=R[1],++c;break;case b.SET_STROKE_STYLE:k=R,O&&(t.stroke(),O=0),this.setStrokeStyle_(t,R),++c;break;case b.STROKE:v?O++:t.stroke(),++c;break;default:++c;break}}A&&this.fill_(t),O&&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)}}var vl=Tl;const Yn=["Polygon","Circle","LineString","Image","Text","Default"];class Il{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_=wt(),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 vl(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=jt(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=gt(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=xt(),ri(u,t),On(u,e*(this.renderBuffer_+n),u));const d=Sl(n);let f;function g(C,T){const I=c.getImageData(0,0,a,a).data;for(let S=0,A=d.length;S<A;S++)if(I[d[S]]>0){if(!o||f!=="Image"&&f!=="Text"||o.includes(C)){const O=(d[S]-3)/4,W=n-O%a,k=n-(O/a|0),F=r(C,T,W*W+k*k);if(F)return F}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(ne);let m,p,y,x,E;for(m=_.length-1;m>=0;--m){const C=_[m].toString();for(y=this.executorsByZIndex_[C],p=Yn.length-1;p>=0;--p)if(f=Yn[p],x=y[f],x!==void 0&&(E=x.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return ue(a,0,8,2,t,a),a}isEmpty(){return je(this.executorsByZIndex_)}execute(t,e,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(ne),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||Yn;let h,c,u,d,f,g;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const _=l[h].toString();for(f=this.executorsByZIndex_[_],u=0,d=o.length;u<d;++u){const m=o[u];g=f[m],g!==void 0&&g.execute(t,e,i,n,r,a)}}this.maxExtent_&&t.restore()}}const zn={};function Sl(s){if(zn[s]!==void 0)return zn[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 zn[s]=n,n}var Mr=Il,nt={ANIMATING:0,INTERACTING:1};const fi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class wl{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_}}var br=wl;const gi=6378137,Fe=Math.PI*gi,Ll=[-Fe,-Fe,Fe,Fe],Al=[-180,-85,180,85],qi=gi*Math.log(Math.tan(Math.PI/2));class ke extends br{constructor(t){super({code:t,units:"m",extent:Ll,global:!0,worldExtent:Al,getPointResolution:function(e,i){return e/Math.cosh(i[1]/gi)}})}}const Or=[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 Ml(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]=Fe*s[n]/180;let r=gi*Math.log(Math.tan(Math.PI*(+s[n+1]+90)/360));r>qi?r=qi:r<-qi&&(r=-qi),t[n+1]=r}return t}function bl(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]/Fe,t[n+1]=360*Math.atan(Math.exp(s[n+1]/gi))/Math.PI-90;return t}const Ol=6378137,Pr=[-180,-90,180,90],Pl=Math.PI*Ol/180;class de extends br{constructor(t,e){super({code:t,units:"degrees",extent:Pr,axisOrientation:e,global:!0,metersPerUnit:Pl,worldExtent:Pr})}}const Dr=[new de("CRS:84"),new de("EPSG:4326","neu"),new de("urn:ogc:def:crs:OGC:1.3:CRS84"),new de("urn:ogc:def:crs:OGC:2:84"),new de("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new de("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new de("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Bn={};function Dl(s){return Bn[s]||Bn[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Fl(s,t){Bn[s]=t}let Ne={};function Ji(s,t,e){const i=s.getCode(),n=t.getCode();i in Ne||(Ne[i]={}),Ne[i][n]=e}function kl(s,t){let e;return s in Ne&&t in Ne[s]&&(e=Ne[s][t]),e}function Nl(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Qi(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 Kn(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function Gl(s,t){return s[0]*=t,s[1]*=t,s}function Fr(s,t){if(t.canWrapX()){const e=U(t.getExtent()),i=Xl(s,t,e);i&&(s[0]-=i*e)}return s}function Xl(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||U(i),n=Math.floor((s[0]-i[0])/e)),n}const Wl=63710088e-1;function kr(s,t,e){e=e||Wl;const i=Mi(s[1]),n=Mi(t[1]),r=(n-i)/2,o=Mi(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}let Zn=!0;function Nr(s){Zn=!(s===void 0?!0:s)}function Un(s,t,e){if(t!==void 0){for(let i=0,n=s.length;i<n;++i)t[i]=s[i];t=t}else t=s.slice();return t}function Gr(s,t,e){if(t!==void 0&&s!==t){for(let i=0,n=s.length;i<n;++i)t[i]=s[i];s=t}return s}function Yl(s){Fl(s.getCode(),s),Ji(s,s,Un)}function zl(s){s.forEach(Yl)}function Et(s){return typeof s=="string"?Dl(s):s||null}function Xr(s,t,e,i){s=Et(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=jn(s,Et("EPSG:4326"));if(a===Gr&&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=kr(h.slice(0,2),h.slice(2,4)),u=kr(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 Wr(s){zl(s),s.forEach(function(t){s.forEach(function(e){t!==e&&Ji(t,e,Un)})})}function Bl(s,t,e,i){s.forEach(function(n){t.forEach(function(r){Ji(n,r,e),Ji(r,n,i)})})}function Vn(s,t){return s?typeof s=="string"?Et(s):s:Et(t)}function Fu(s,t){return Nr(),Yr(s,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Ge(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||jn(s,t)===Un)&&e}function jn(s,t){const e=s.getCode(),i=t.getCode();let n=kl(e,i);return n||(n=Gr),n}function tn(s,t){const e=Et(s),i=Et(t);return jn(e,i)}function Yr(s,t,e){return tn(t,e)(s,void 0,s.length)}function Hn(s,t){return s}function Wt(s,t){return Zn&&!Qi(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Zn=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function zr(s,t){return s}function fe(s,t){return s}function Kl(){Wr(Or),Wr(Dr),Bl(Dr,Or,Ml,bl)}Kl();const Br=wt();class Zl extends vt{constructor(){super();this.extent_=xt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=jo(function(t,e,i){if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return X()}closestPointXY(t,e,i,n){return X()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return X()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zi(e),this.extentRevision_=this.getRevision()}return Xa(this.extent_,t)}rotate(t,e){X()}scale(t,e,i){X()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return X()}getType(){return X()}applyTransform(t){X()}intersectsExtent(t){return X()}translate(t,e){X()}transform(t,e){const i=Et(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=St(h)/St(l);return jt(Br,h[0],h[3],c,-c,0,0,0),ue(r,0,r.length,a,Br,o),tn(i,e)(r,o,a)}:tn(i,e);return this.applyTransform(n),this}}var Ul=Zl;class Vl extends Ul{constructor(){super();this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return Fa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return X()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Kr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){X()}setLayout(t,e,i){let n;if(t)n=Kr(t);else{for(let r=0;r<i;++r)if(e.length===0){this.layout="XY",this.stride=2;return}else e=e[0];n=e.length,t=jl(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();wr(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();pl(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();yl(i,0,i.length,n,t,e,i),this.changed()}}}function jl(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function Kr(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function Hl(s,t,e){const i=s.getFlatCoordinates();if(i){const n=s.getStride();return ue(i,0,i.length,n,t,e)}else return null}var $n=Vl;class $l extends mr{constructor(t,e,i,n,r,o,a){super();this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,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_=wt()}drawImages_(t,e,i,n){if(!this.image_)return;const r=ue(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.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;jt(a,g,_,1,1,h,-g,-_),o.setTransform.apply(o,a),o.translate(g,_),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,f,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=ue(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(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=ue(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(!!lt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Hl(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||!lt(this.extent_,i.getExtent())||(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_)),!!lt(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(!!lt(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_)),!!lt(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_)),!!lt(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),se(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:ii;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:It(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||Je;this.strokeState_={lineCap:n!==void 0?n:Xi,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Qe)*this.pixelRatio_,lineJoin:a!==void 0?a:Le,lineWidth:(l!==void 0?l:ni)*this.pixelRatio_,miterLimit:h!==void 0?h:ti,strokeStyle:It(i||ei)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:It(f||Ft)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Xi,lineDash:_||Je,lineDashOffset:m||Qe,lineJoin:p!==void 0?p:Le,lineWidth:y!==void 0?y:ni,miterLimit:x!==void 0?x:ti,strokeStyle:It(f||ei)}}const n=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:n!==void 0?n:$s,textAlign:u!==void 0?u:ii,textBaseline:d!==void 0?d:Wi},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}var ql=$l;const Lt=.5;function Jl(s,t,e,i,n,r,o){const a=s[0]*Lt,l=s[1]*Lt,h=gt(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new ql(h,Lt,n,null,o),d=e.length,f=Math.floor((256*256*256-1)/d),g={};for(let m=1;m<=d;++m){const p=e[m-1],y=p.getStyleFunction()||i;if(!i)continue;let x=y(p,r);if(!x)continue;Array.isArray(x)||(x=[x]);const E=m*f,C="#"+("000000"+E.toString(16)).slice(-6);for(let T=0,I=x.length;T<I;++T){const S=x[T],A=S.getGeometryFunction()(p);if(!A||!lt(n,A.getExtent()))continue;const O=S.clone(),W=O.getFill();W&&W.setColor(C);const k=O.getStroke();k&&(k.setColor(C),k.setLineDash(null)),O.setText(void 0);const F=S.getImage();if(F&&F.getOpacity()!==0){const M=F.getImageSize();if(!M)continue;const v=gt(M[0],M[1],void 0,{alpha:!1}),D=v.canvas;v.fillStyle=C,v.fillRect(0,0,D.width,D.height),O.setImage(new dr({img:D,imgSize:M,anchor:F.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:F.getOrigin(),opacity:1,size:F.getSize(),scale:F.getScale(),rotation:F.getRotation(),rotateWithView:F.getRotateWithView()}))}const q=O.getZIndex()||0;let w=g[q];w||(w={},g[q]=w,w.Polygon=[],w.Circle=[],w.LineString=[],w.Point=[]),w[A.getType().replace("Multi","")].push(A,O)}}const _=Object.keys(g).map(Number).sort(ne);for(let m=0,p=_.length;m<p;++m){const y=g[_[m]];for(const x in y){const E=y[x];for(let C=0,T=E.length;C<T;C+=2){u.setStyle(E[C+1]);for(let I=0,S=t.length;I<S;++I)u.setTransform(t[I]),u.drawGeometry(E[C])}}}return h.getImageData(0,0,c.width,c.height)}function Ql(s,t,e){const i=[];if(e){const n=Math.floor(Math.round(s[0])*Lt),r=Math.floor(Math.round(s[1])*Lt),o=($(n,0,e.width-1)+$(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 th=.5,Zr={Point:hh,LineString:oh,Polygon:uh,MultiPoint:ch,MultiLineString:ah,MultiPolygon:lh,GeometryCollection:rh,Circle:nh};function eh(s,t){return parseInt(Y(s),10)-parseInt(Y(t),10)}function ih(s,t){const e=qn(s,t);return e*e}function qn(s,t){return th*s/t}function nh(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 Ur(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 sh(s,t,e,i,r,o),a}function sh(s,t,e,i,n,r){const o=e.getGeometryFunction()(t);if(!o)return;const a=o.simplifyTransformed(i,n);e.getRenderer()?Vr(s,a,e,t):Zr[a.getType()](s,a,e,t,r)}function Vr(s,t,e,i){if(t.getType()=="GeometryCollection"){const r=t.getGeometries();for(let o=0,a=r.length;o<a;++o)Vr(s,r[o],e,i);return}s.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer())}function rh(s,t,e,i,n){const r=t.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o)Zr[r[o].getType()](s,r[o],e,i,n)}function oh(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 ah(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 lh(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 hh(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 ch(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 uh(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 dh extends Sr{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_=xt(),this.wrappedRenderedExtent_=xt(),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,f=e.viewHints,g=!(f[nt.ANIMATING]||f[nt.INTERACTING]),_=this.compositionContext_,m=Math.round(e.size[0]*d),p=Math.round(e.size[1]*d),y=u.getWrapX()&&l.canWrapX(),x=y?U(c):null,E=y?Math.ceil((n[2]-c[2])/x)+1:1;let C=y?Math.floor((n[0]-c[0])/x):0;do{const T=this.getRenderTransform(o,a,h,d,m,p,C*x);t.execute(_,1,T,h,g,void 0,i)}while(++C<E)}setupCompositionContext_(){if(this.opacity_!==1){const t=gt(this.context.canvas.width,this.context.canvas.height,Ir);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,Zs(this.compositionContext_),Ir.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];fl(this.pixelTransform,1/i,1/i),Wn(this.inversePixelTransform,this.pixelTransform);const r=vr(this.pixelTransform);this.useContainer(e,r,this.getBackground(t));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;if((!l||l.isEmpty())&&(!h||h.isEmpty()))return null;const c=Math.round(t.size[0]*i),u=Math.round(t.size[1]*i);a.width!=c||a.height!=u?(a.width=c,a.height=u,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,c,u),this.preRender(o,t);const d=t.viewState;d.projection,this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1,g=!0;if(n.extent&&this.clipping){const _=fe(n.extent);g=lt(_,t.extent),f=g&&!Me(_,t.extent),f&&this.clipUnrotated(this.compositionContext_,t,_)}return g&&this.renderWorlds(l,t),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,t),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(function(e){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];et(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]*Lt,d=i[1]*Lt;c.push(this.getRenderTransform(n,r,o,Lt,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Me(g,l)){let _=l[0];const m=U(g);let p=0,y;for(;_<g[0];)--p,y=m*p,c.push(this.getRenderTransform(n,r,o,Lt,u,d,y).slice()),_+=m;for(p=0,_=l[2];_>g[2];)++p,y=m*p,c.push(this.getRenderTransform(n,r,o,Lt,u,d,y).slice()),_-=m}this.hitDetectionImageData_=Jl(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(Ql(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,_){const m=Y(f),p=h[m];if(p){if(p!==!0&&_<p.distanceSq){if(_===0)return h[m]=!0,r.splice(r.lastIndexOf(p),1),n(f,l,g);p.geometry=g,p.distanceSq=_}}else{if(_===0)return h[m]=!0,n(f,l,g);r.push(h[m]={feature:f,layer:l,geometry:g,distanceSq:_,callback:n})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(f=>u=f.forEachFeatureAtCoordinate(t,o,a,i,c,f===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(g=>g.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[nt.ANIMATING],r=t.viewHints[nt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=eh);const m=h.center.slice(),p=On(l,g*u),y=p.slice(),x=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Me(E,t.extent)){const w=U(E),M=Math.max(U(p)/2,w);p[0]=E[0]-M,p[2]=E[2]+M,Fr(m,c);const v=cr(x[0],c);v[0]<E[0]&&v[2]<E[2]?x.push([v[0]+w,v[1],v[2]+w,v[3]]):v[0]>E[0]&&v[2]>E[2]&&x.push([v[0]-w,v[1],v[2]-w,v[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&Me(this.wrappedRenderedExtent_,p))return se(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new Cr(qn(u,d),p,u,d);let T;this.getLayer().getDeclutter()&&(T=new Cr(qn(u,d),p,u,d));let I;for(let w=0,M=x.length;w<M;++w)i.loadFeatures(x[w],u,c);const S=ih(u,d);let A=!0;const O=function(w){let M;const v=w.getStyleFunction()||e.getStyleFunction();if(v&&(M=v(w,u)),M){const D=this.renderFeature(w,S,M,C,I,T);A=A&&!D}}.bind(this),W=zr(p),k=i.getFeaturesInExtent(W);_&&k.sort(_);for(let w=0,M=k.length;w<M;++w)O(k[w]);this.renderedFeatures_=k,this.ready=A;const F=C.finish(),q=new Mr(p,u,d,i.getOverlaps(),F,e.getRenderBuffer());return T&&(this.declutterExecutorGroup=new Mr(p,u,d,i.getOverlaps(),T.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=m,this.renderedProjection_=c,this.replayGroup_=q,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=Ur(n,t,i[l],e,this.boundHandleStyleImageChange_,r,o)||a;else a=Ur(n,t,i,e,this.boundHandleStyleImageChange_,r,o);return a}}var fh=dh;class gh extends Ha{constructor(t){super(t)}createRenderer(){return new fh(this)}}var ku=gh,ht={ADD:"add",REMOVE:"remove"};const jr={LENGTH:"length"};class en extends Dt{constructor(t,e,i){super(t);this.element=e,this.index=i}}class _h extends vt{constructor(t,e){super();if(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(jr.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(ht.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<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(ht.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new en(ht.REMOVE,n,t)),this.dispatchEvent(new en(ht.ADD,e,t))}updateLength_(){this.set(jr.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 Os(58)}}var At=_h;class mh{constructor(t){this.rbush_=new ks(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_[Y(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_[Y(a)]=l}this.rbush_.load(i)}remove(t){const e=Y(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[Y(e)],n=[i.minX,i.minY,i.maxX,i.maxY];si(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 je(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Nt(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]}}var Hr=mh;class ph extends vt{constructor(t){super();this.projection=Et(t.projection),this.attributions_=$r(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(){return X()}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=$r(t),this.changed()}setState(t){this.state_=t,this.changed()}}function $r(s){return s?Array.isArray(s)?function(t){return s}:typeof s=="function"?s:function(t){return[s]}:null}var qr=ph,Ct={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function yh(s,t){return[[-1/0,-1/0,1/0,1/0]]}let xh=!1;function Eh(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=xh,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 Jr(s,t){return function(e,i,n,r,o){const a=this;Eh(s,t,e,i,n,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||re)}}class qt extends Dt{constructor(t,e,i){super(t);this.feature=e,this.features=i}}class Ch extends qr{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_=re,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_=Jr(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:yh;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Hr:null,this.loadedExtentsRtree_=new Hr,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),!e&&i===void 0&&(i=new At(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Y(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new qt(Ct.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[G(e,P.CHANGE,this.handleFeatureChange_,this),G(e,Te.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=Y(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=Y(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(Ct.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new qt(Ct.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Ct.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Ct.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(ht.ADD,function(i){e||(e=!0,this.addFeature(i.element),e=!1)}.bind(this)),t.addEventListener(ht.REMOVE,function(i){e||(e=!0,this.removeFeature(i.element),e=!1)}.bind(this)),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(V);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=function(n){this.removeFeatureInternal(n)}.bind(this);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 qt(Ct.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(),je(this.nullGeometryFeatures_)||As(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=Ya(t,e);return[].concat(...n.map(r=>this.featuresRtree_.getInExtent(r)))}else return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Ue,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,n,o,a),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=Y(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 qt(Ct.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:Y(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&je(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 Me(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new qt(Ct.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,function(c){--this.loadingExtentsCount_,this.dispatchEvent(new qt(Ct.FEATURESLOADEND,void 0,c))}.bind(this),function(){--this.loadingExtentsCount_,this.dispatchEvent(new qt(Ct.FEATURESLOADERROR))}.bind(this)),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(si(n.extent,t))return i=n,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=Y(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=Y(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(V),delete this.featureChangeKeys_[e];const n=t.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new qt(Ct.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){N(this.format_,7),this.url_=t,this.setLoader(Jr(t,this.format_))}}var Nu=Ch,nn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Rh extends Pi{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError;super(e);this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(nn.PRELOAD)}setPreload(t){this.set(nn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(nn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(nn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var Th=Rh,L={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Qr(s){return Math.pow(s,3)}function Xe(s){return 1-Qr(1-s)}function vh(s){return 3*s*s-2*s*s*s}function Ih(s){return s}class Sh extends wi{constructor(t,e,i){super();i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(P.CHANGE)}release(){this.state===L.ERROR&&this.setState(L.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==L.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==L.LOADED){t.interimTile=null;break}else t.getState()==L.LOADING?e=t:t.getState()==L.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==L.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){X()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const n=e-i+1e3/60;return n>=this.transition_?1:Qr(n/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}var to=Sh;class wh extends to{constructor(t,e,i,n,r,o){super(t,e,o);this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=L.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=L.ERROR,this.unlistenImage_(),this.image_=Lh(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=L.LOADED:this.state=L.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==L.ERROR&&(this.state=L.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==L.IDLE&&(this.state=L.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ur(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Lh(){const s=gt(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}var eo=wh;const Ah=.5,Mh=10,io=.25;class bh{constructor(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=tn(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const x=y[0]+"/"+y[1];return a[x]||(a[x]=l(y)),a[x]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&U(n)==U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const h=le(i),c=ji(i),u=Vi(i),d=Ui(i),f=this.transformInv_(h),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=Mh+(o?Math.max(0,Math.ceil(Math.log2(Dn(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,_,m,p),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(x,E,C){y=Math.min(y,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(function(x){if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-y>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-y>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-y>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-y>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const C=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-C<this.sourceWorldWidth_/2&&(x.source=E)}}.bind(this))}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=sr([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=sr([t,e,i,n]);g=U(m)/this.targetWorldWidth_>io||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>io||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!lt(c,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!g){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(m);let y;f?y=(Ie(r[0],d)+Ie(a[0],d))/2-Ie(p[0],d):y=(r[0]+a[0])/2-p[0];const x=(r[1]+a[1])/2-p[1];g=y*y+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(m),y=[(n[0]+t[0])/2,(n[1]+t[1])/2],x=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,x,h-1),this.addQuad_(y,m,i,n,x,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],x=this.transformInv_(y);this.addQuad_(t,m,y,n,r,p,x,l,h-1),this.addQuad_(m,e,i,y,p,o,a,x,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,n,r,a,l),(_&14)==0&&this.addTriangle_(t,i,e,r,a,o),_&&((_&13)==0&&this.addTriangle_(e,n,t,o,l,r),(_&7)==0&&this.addTriangle_(e,n,i,o,l,a))}calculateSourceExtent(){const t=xt();return this.triangles_.forEach(function(e,i,n){const r=e.source;ri(t,r[0]),ri(t,r[1]),ri(t,r[2])}),t}getTriangles(){return this.triangles_}}var Oh=bh;let Jn;const no=[];function so(s,t,e,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(t,e),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(t,i)+1,Math.max(e,n)),s.restore()}function Qn(s,t){return Math.abs(s[t*4]-210)>2||Math.abs(s[t*4+3]-.75*255)>2}function Ph(){if(Jn===void 0){const s=document.createElement("canvas").getContext("2d");s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",so(s,4,5,4,0),so(s,4,5,0,5);const t=s.getImageData(0,0,3,3).data;Jn=Qn(t,0)||Qn(t,4)||Qn(t,8)}return Jn}function ro(s,t,e,i){const n=Yr(e,t,s);let r=Xr(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||Ki(l,n)){const h=Xr(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Dh(s,t,e,i){const n=be(e);let r=ro(s,t,n,i);return(!isFinite(r)||r<=0)&&hr(e,function(o){return r=ro(s,t,o,i),isFinite(r)&&r>0}),r}function Fh(s,t,e,i,n,r,o,a,l,h,c,u){const d=gt(Math.round(e*s),Math.round(e*t),no);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(e,e);function f(E){return Math.round(E*e)/e}d.globalCompositeOperation="lighter";const g=xt();l.forEach(function(E,C,T){ka(g,E.extent)});const _=U(g),m=St(g),p=gt(Math.round(e*_/i),Math.round(e*m/i));u||(p.imageSmoothingEnabled=!1);const y=e/i;l.forEach(function(E,C,T){const I=E.extent[0]-g[0],S=-(E.extent[3]-g[3]),A=U(E.extent),O=St(E.extent);E.image.width>0&&E.image.height>0&&p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,I*y,S*y,A*y,O*y)});const x=le(o);return a.getTriangles().forEach(function(E,C,T){const I=E.source,S=E.target;let A=I[0][0],O=I[0][1],W=I[1][0],k=I[1][1],F=I[2][0],q=I[2][1];const w=f((S[0][0]-x[0])/r),M=f(-(S[0][1]-x[1])/r),v=f((S[1][0]-x[0])/r),D=f(-(S[1][1]-x[1])/r),j=f((S[2][0]-x[0])/r),Z=f(-(S[2][1]-x[1])/r),Q=A,R=O;A=0,O=0,W-=Q,k-=R,F-=Q,q-=R;const ct=[[W,k,0,0,v-w],[F,q,0,0,j-w],[0,0,W,k,D-M],[0,0,F,q,Z-M]],z=ia(ct);if(!!z){if(d.save(),d.beginPath(),Ph()||!u){d.moveTo(v,D);const K=4,Yt=w-v,Tt=M-D;for(let it=0;it<K;it++)d.lineTo(v+f((it+1)*Yt/K),D+f(it*Tt/(K-1))),it!=K-1&&d.lineTo(v+f((it+1)*Yt/K),D+f((it+1)*Tt/(K-1)));d.lineTo(j,Z)}else d.moveTo(v,D),d.lineTo(w,M),d.lineTo(j,Z);d.clip(),d.transform(z[0],z[2],z[1],z[3],w,M),d.translate(g[0]-Q,g[3]-R),d.scale(i/e,-i/e),d.drawImage(p.canvas,0,0),d.restore()}}),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(E,C,T){const I=E.target,S=(I[0][0]-x[0])/r,A=-(I[0][1]-x[1])/r,O=(I[1][0]-x[0])/r,W=-(I[1][1]-x[1])/r,k=(I[2][0]-x[0])/r,F=-(I[2][1]-x[1])/r;d.beginPath(),d.moveTo(O,W),d.lineTo(S,A),d.lineTo(k,F),d.closePath(),d.stroke()}),d.restore()),d.canvas}class kh extends to{constructor(t,e,i,n,r,o,a,l,h,c,u,d){super(r,L.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 f=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const m=g?oi(f,g):f;if(Dn(m)===0){this.state=L.EMPTY;return}const p=t.getExtent();p&&(_?_=oi(_,p):_=p);const y=n.getResolution(this.wrappedTileCoord_[0]),x=Dh(t,i,m,y);if(!isFinite(x)||x<=0){this.state=L.EMPTY;return}const E=c!==void 0?c:Ah;if(this.triangulation_=new Oh(t,i,m,_,x*E,y),this.triangulation_.getTriangles().length===0){this.state=L.EMPTY;return}this.sourceZ_=e.getZForResolution(x);let C=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(C[1]=$(C[1],_[1],_[3]),C[3]=$(C[3],_[1],_[3])):C=oi(C,_)),!Dn(C))this.state=L.EMPTY;else{const T=e.getTileRangeForExtentAndZ(C,this.sourceZ_);for(let I=T.minX;I<=T.maxX;I++)for(let S=T.minY;S<=T.maxY;S++){const A=h(this.sourceZ_,I,S,a);A&&this.sourceTiles_.push(A)}this.sourceTiles_.length===0&&(this.state=L.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==L.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,t.length===0)this.state=L.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_=Fh(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=L.LOADED}this.changed()}load(){if(this.state==L.IDLE){this.state=L.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){const r=e.getState();if(r==L.IDLE||r==L.LOADING){t++;const o=G(e,P.CHANGE,function(a){const l=e.getState();(l==L.LOADED||l==L.ERROR||l==L.EMPTY)&&(V(o),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,i,n){e.getState()==L.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(V),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Zs(this.canvas_.getContext("2d")),no.push(this.canvas_),this.canvas_=null),super.release()}}var ts=kh;class oo{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 We(s,t,e,i,n){return n!==void 0?(n.minX=s,n.maxX=t,n.minY=e,n.maxY=i,n):new oo(s,t,e,i)}var ao=oo;class Nh extends Sr{constructor(t){super(t);this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=xt(),this.tmpTileRange_=new ao(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==L.LOADED||i==L.EMPTY||i==L.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,i,r,o);return h.getState()==L.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=et(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Ki(r,n))return null;const o=e.pixelRatio,a=e.viewState.projection,l=e.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const f=c.getTileCoordForCoordAndZ(n,d),g=h.getTile(d,f[1],f[2],o,a);if(!(g instanceof eo||g instanceof ts)||g instanceof ts&&g.getState()===L.EMPTY)return null;if(g.getState()!==L.LOADED)continue;const _=c.getOrigin(d),m=ft(c.getTileSize(d)),p=c.getResolution(d),y=Math.floor(u*((n[0]-_[0])/p-f[1]*m[0])),x=Math.floor(u*((_[1]-n[1])/p-f[2]*m[1])),E=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),y+E,x+E)}return null}loadedTileCallback(t,e,i){return this.isDrawableTile(i)?super.loadedTileCallback(t,e,i):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),f=u.getTileGridForProjection(r),g=f.getZForResolution(o,u.zDirection),_=f.getResolution(g);let m=t.extent;const p=t.viewState.resolution,y=u.getTilePixelRatio(h),x=Math.round(U(m)/p*h),E=Math.round(St(m)/p*h),C=i.extent&&fe(i.extent);C&&(m=oi(m,fe(i.extent)));const T=_*x/2/y,I=_*E/2/y,S=[a[0]-T,a[1]-I,a[0]+T,a[1]+I],A=f.getTileRangeForExtentAndZ(m,g),O={};O[g]={};const W=this.createLoadedTileFinder(u,r,O),k=this.tmpExtent,F=this.tmpTileRange_;this.newTiles_=!1;const q=l?kn(n.center,p,l,t.size):void 0;for(let ct=A.minX;ct<=A.maxX;++ct)for(let z=A.minY;z<=A.maxY;++z){if(l&&!f.tileCoordIntersectsViewport([g,ct,z],q))continue;const K=this.getTile(g,ct,z,t);if(this.isDrawableTile(K)){const it=Y(this);if(K.getState()==L.LOADED){O[g][K.tileCoord.toString()]=K;let Mt=K.inTransition(it);Mt&&i.opacity!==1&&(K.endTransition(it),Mt=!1),!this.newTiles_&&(Mt||!this.renderedTiles.includes(K))&&(this.newTiles_=!0)}if(K.getAlpha(it,t.time)===1)continue}const Yt=f.getTileCoordChildTileRange(K.tileCoord,F,k);let Tt=!1;Yt&&(Tt=W(g+1,Yt)),Tt||f.forEachTileCoordParentTileRange(K.tileCoord,W,F,k)}const w=_/o*h/y;jt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-E/2);const M=vr(this.pixelTransform);this.useContainer(e,M,this.getBackground(t));const v=this.context,D=v.canvas;Wn(this.inversePixelTransform,this.pixelTransform),jt(this.tempTransform,x/2,E/2,w,w,0,-x/2,-E/2),D.width!=x||D.height!=E?(D.width=x,D.height=E):this.containerReused||v.clearRect(0,0,x,E),C&&this.clipUnrotated(v,t,C),u.getInterpolate()||(v.imageSmoothingEnabled=!1),this.preRender(v,t),this.renderedTiles.length=0;let j=Object.keys(O).map(Number);j.sort(ne);let Z,Q,R;i.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?j=j.reverse():(Z=[],Q=[]);for(let ct=j.length-1;ct>=0;--ct){const z=j[ct],K=u.getTilePixelSize(z,h,r),Tt=f.getResolution(z)/_,it=K[0]*Tt*w,Mt=K[1]*Tt*w,pe=f.getTileCoordForCoordAndZ(le(S),z),yi=f.getTileCoordExtent(pe),ye=et(this.tempTransform,[y*(yi[0]-S[0])/_,y*(S[3]-yi[3])/_]),xi=y*u.getGutterForProjection(r),zt=O[z];for(const ze in zt){const Bt=zt[ze],Ei=Bt.tileCoord,Ci=pe[1]-Ei[1],Ri=Math.round(ye[0]-(Ci-1)*it),xe=pe[2]-Ei[2],cn=Math.round(ye[1]-(xe-1)*Mt),ot=Math.round(ye[0]-Ci*it),_t=Math.round(ye[1]-xe*Mt),yt=Ri-ot,bt=cn-_t,Ee=g===z,ie=Ee&&Bt.getAlpha(Y(this),t.time)!==1;let Kt=!1;if(!ie)if(Z){R=[ot,_t,ot+yt,_t,ot+yt,_t+bt,ot,_t+bt];for(let Ce=0,Ti=Z.length;Ce<Ti;++Ce)if(g!==z&&z<Q[Ce]){const rt=Z[Ce];lt([ot,_t,ot+yt,_t+bt],[rt[0],rt[3],rt[4],rt[7]])&&(Kt||(v.save(),Kt=!0),v.beginPath(),v.moveTo(R[0],R[1]),v.lineTo(R[2],R[3]),v.lineTo(R[4],R[5]),v.lineTo(R[6],R[7]),v.moveTo(rt[6],rt[7]),v.lineTo(rt[4],rt[5]),v.lineTo(rt[2],rt[3]),v.lineTo(rt[0],rt[1]),v.clip())}Z.push(R),Q.push(z)}else v.clearRect(ot,_t,yt,bt);this.drawTileImage(Bt,t,ot,_t,yt,bt,xi,Ee),Z&&!ie?(Kt&&v.restore(),this.renderedTiles.unshift(Bt)):this.renderedTiles.push(Bt),this.updateUsedTiles(t.usedTiles,u,Bt)}}return this.renderedRevision=d,this.renderedResolution=_,this.extentChanged=!this.renderedExtent_||!si(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=h,this.renderedProjection=r,this.manageTilePyramid(t,u,f,h,r,m,g,c.getPreload()),this.scheduleExpireCache(t,u),this.postRender(v,t),i.extent&&v.restore(),v.imageSmoothingEnabled=!0,M!==D.style.transform&&(D.style.transform=M),this.container}drawTileImage(t,e,i,n,r,o,a,l){const h=this.getTileImage(t);if(!h)return;const c=Y(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(l?t.getAlpha(c,e.time):1),f=d!==this.context.globalAlpha;f&&(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),f&&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=Y(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=Y(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,r,o,a,l,h){const c=Y(e);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=t.tileQueue,f=i.getMinZoom(),g=t.viewState.rotation,_=g?kn(t.viewState.center,t.viewState.resolution,g,t.size):void 0;let m=0,p,y,x,E,C,T;for(T=f;T<=a;++T)for(y=i.getTileRangeForExtentAndZ(o,T,y),x=i.getResolution(T),E=y.minX;E<=y.maxX;++E)for(C=y.minY;C<=y.maxY;++C)g&&!i.tileCoordIntersectsViewport([T,E,C],_)||(a-T<=l?(++m,p=e.getTile(T,E,C,n,r),p.getState()==L.IDLE&&(u[p.getKey()]=!0,d.isKeyQueued(p.getKey())||d.enqueue([p,c,i.getTileCoordCenter(p.tileCoord),x])),h!==void 0&&h(p)):e.useTile(T,E,C,r));e.updateCacheSize(m,r)}}var Gh=Nh;class Xh extends Th{constructor(t){super(t)}createRenderer(){return new Gh(this)}}var Gu=Xh;class Wh{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}}var Yh=Wh;function lo(s,t,e,i){return i!==void 0?(i[0]=s,i[1]=t,i[2]=e,i):[s,t,e]}function sn(s,t,e){return s+"/"+t+"/"+e}function ho(s){return sn(s[0],s[1],s[2])}function zh(s){return s.split("/").map(Number)}function Bh(s){return(s[1]<<s[0])+s[2]}function Kh(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 Zh extends Yh{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=zh(t)[0];this.forEach(function(n){n.tileCoord[0]!==i&&(this.remove(ho(n.tileCoord)),n.release())}.bind(this))}}var co=Zh,es={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};const Uh=42,is=256;function Vh(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 jh(s,t,e,i,n){return!hr(n,function(o){return!ge(s,t,e,i,o[0],o[1])})}function ge(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 ns(s,t,e,i,n,r){if(e.length===0||!ge(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o<a;++o)if(ge(s,e[o-1],e[o],i,n,r))return!1;return!0}function Xu(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(ns(s,t,l,i,n,r))return!0;t=l[l.length-1]}return!1}function ss(s,t,e,i,n){const r=lr(xt(),s,t,e,i);return lt(n,r)?Me(n,r)||r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:Vh(s,t,e,i,function(o,a){return Wa(n,o,a)}):!1}function Wu(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){if(ss(s,t,e[r],i,n))return!0;t=e[r]}return!1}function uo(s,t,e,i,n){return!!(ss(s,t,e,i,n)||ge(s,t,e,i,n[0],n[1])||ge(s,t,e,i,n[0],n[3])||ge(s,t,e,i,n[2],n[1])||ge(s,t,e,i,n[2],n[3]))}function fo(s,t,e,i,n){if(!uo(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(jh(s,e[r-1],e[r],i,n)&&!ss(s,e[r-1],e[r],i,n))return!1;return!0}function Yu(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(fo(s,t,a,i,n))return!0;t=a[a.length-1]}return!1}const Hh=[0,0,0],Jt=5;class $h{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,N(Vo(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_=le(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:is,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 ao(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=We(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return We(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 We(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 We(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return We(h,u,c,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeExtent(t,e,i){const n=this.getOrigin(t),r=this.getResolution(t),o=ft(this.getTileSize(t),this.tmpSize_),a=n[0]+e.minX*o[0]*r,l=n[0]+(e.maxX+1)*o[0]*r,h=n[1]+e.minY*o[1]*r,c=n[1]+(e.maxY+1)*o[1]*r;return Nt(a,h,l,c,i)}getTileRangeForExtentAndZ(t,e,i){const n=Hh;this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,n);const r=n[1],o=n[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,n),We(r,n[1],o,n[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=ft(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=ft(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 Nt(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=ft(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=Oi(c,Jt)-1,u=Oi(u,Jt)-1):(c=bi(c,Jt),u=bi(u,Jt)),lo(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=ft(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return n?(h=Oi(h,Jt)-1,c=Oi(c,Jt)-1):(h=bi(h,Jt),c=bi(c,Jt)),lo(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=_n(this.resolutions_,t,e||0);return $(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return uo(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}}var go=$h;function _o(s){let t=s.getDefaultTileGrid();return t||(t=tc(s),s.setDefaultTileGrid(t)),t}function qh(s,t,e){const i=t[0],n=s.getTileCoordCenter(t),r=rs(e);if(Ki(r,n))return t;{const o=U(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}}function Jh(s,t,e,i){i=i!==void 0?i:"top-left";const n=mo(s,t,e);return new go({extent:s,origin:Ga(s,i),resolutions:n,tileSize:e})}function Qh(s){const t=s||{},e=t.extent||Et("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:mo(e,t.maxZoom,t.tileSize,t.maxResolution)};return new go(i)}function mo(s,t,e,i){t=t!==void 0?t:Uh,e=ft(e!==void 0?e:is);const n=St(s),r=U(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 tc(s,t,e,i){const n=rs(s);return Jh(n,t,e,i)}function rs(s){s=Et(s);let t=s.getExtent();if(!t){const e=180*fi.degrees/s.getMetersPerUnit();t=Nt(-e,-e,e,e)}return t}class ec extends qr{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&&ft(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new co(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=sn(e,c,u),h=!1,r.containsKey(l)&&(a=r.get(l),h=a.getState()===L.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(){return this.tileGrid?this.tileGrid.getResolutions():null}getTile(t,e,i,n,r){return X()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:_o(t)}getTileCacheForProjection(t){const e=this.getProjection();return N(e===null||Ge(e,t),68),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=ft(n.getTileSize(t),this.tmpSize);return r==1?o:da(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=qh(i,t,e)),Kh(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 ic extends Dt{constructor(t,e){super(t);this.tile=e}}var nc=ec;function sc(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 rc(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=sc(s[n],t);return oc(i)}function oc(s){return s.length===1?s[0]:function(t,e,i){if(t){const n=Bh(t),r=Ie(n,s.length);return s[r](t,e,i)}else return}}function ac(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 os extends nc{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===os.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=Y(e),n=e.getState();let r;n==L.LOADING?(this.tileLoadingKeys_[i]=!0,r=es.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==L.ERROR?es.TILELOADERROR:n==L.LOADED?es.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new ic(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e!="undefined"?this.setKey(e):this.changed()}setUrl(t){const e=ac(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
  10. `);this.generateTileUrlFunction_?this.setTileUrlFunction(rc(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=sn(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}var lc=os;class hc extends lc{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:cc,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:eo,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&&!Ge(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&&!Ge(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Ge(e,t)))return this.tileGrid;{const i=Y(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=_o(t)),this.tileGridForProjection[i]}}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Ge(e,t))return this.tileCache;{const i=Y(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new co(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?L.IDLE:L.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(P.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||Ge(o,r))return this.getTileInternal(t,e,i,n,o||r);{const a=this.getTileCacheForProjection(r),l=[t,e,i];let h;const c=ho(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;{const d=this.getTileGridForProjection(o),f=this.getTileGridForProjection(r),g=this.getTileCoordForTileUrlFunction(l,r),_=new ts(o,d,r,f,l,g,this.getTilePixelRatio(n),this.getGutter(),function(m,p,y,x){return this.getTileInternal(m,p,y,x,o)}.bind(this),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=sn(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()==L.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=Et(t);if(i){const n=Y(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function cc(s,t){s.getImage().src=t}var uc=hc;class dc extends uc{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Qh({extent:rs(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection});this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}var zu=dc;class as extends vt{constructor(t){super();if(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 as(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_&&(V(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=G(t,P.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?fc(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 fc(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}}}var Bu=as;function po(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 f=0;f<i;++f)o[f]=oe(s[t+f],s[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function yo(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=ve(r,o,a,l);h>n&&(n=h),r=a,o=l}return n}function xo(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=yo(s,t,a,i,n),t=a}return n}function Ku(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=xo(s,t,a,i,n),t=a[a.length-1]}return n}function Eo(s,t,e,i,n,r,o,a,l,h,c){if(t==e)return h;let u,d;if(n===0)if(d=ve(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}else return h;c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(po(s,f-i,f,i,o,a,c),d=ve(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/n|0,1);if(r&&(po(s,e-i,t,i,o,a,c),d=ve(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 Co(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 f=e[u];h=Eo(s,t,f,i,n,r,o,a,l,h,c),t=f}return h}function Zu(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 f=e[u];h=Co(s,t,f,i,n,r,o,a,l,h,c),t=f[f.length-1]}return h}function gc(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}function Ro(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 To(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Ro(s,t,e[o],i);n[r++]=l,t=l}return n.length=r,n}function Uu(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=To(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 vo(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 Io(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=vo(s,t,a,i),t=a}return n}function Vu(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=Io(s,t,a,i),t=a[a.length-1]}return n}class rn extends $n{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 rn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<or(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Eo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return vo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Oe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=yr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new rn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ro(this.flatCoordinates,0,t,this.stride),this.changed()}}var So=rn;class ls extends $n{constructor(t,e){super();this.setCoordinates(t,e)}clone(){const t=new ls(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=ve(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}else return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return Da(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return ar(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=gc(this.flatCoordinates,0,t,this.stride),this.changed()}}var _c=ls;function wo(s,t,e,i,n,r,o){let a,l,h,c,u,d,f;const g=n[r+1],_=[];for(let y=0,x=e.length;y<x;++y){const E=e[y];for(c=s[E-i],d=s[E-i+1],a=t;a<E;a+=i)u=s[a],f=s[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,_.push(h)),c=u,d=f}let m=NaN,p=-1/0;for(_.sort(ne),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,ns(s,t,e,i,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=n[r]),o?(o.push(m,g,p),o):[m,g,p]}function ju(s,t,e,i,n){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=wo(s,t,l,i,n,2*o,r),t=l[l.length-1]}return r}function mc(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 Lo(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 Ao(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=Lo(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 Hu(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!Ao(s,t,a,i,n))return!1;a.length&&(t=a[a.length-1])}return!0}function hs(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=Lo(s,t,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&mc(s,t,a,i),t=a}return t}function $u(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r)t=hs(s,t,e[r],i,n);return t}class _i extends $n{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?As(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new _i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<or(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(xo(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Co(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return ns(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Io(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),hs(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,$i(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=be(this.getExtent());this.flatInteriorPoint_=wo(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new _c(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new So(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 So(e.slice(r,l),t);n.push(h),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ao(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=hs(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=xr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new _i(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return fo(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=To(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}var pc=_i;function Mo(s){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 _i(r,"XY",[r.length])}class yc{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_}}var xc=yc;class Ec extends gn{constructor(t){super();this.map_=t}dispatchRenderEvent(t,e){X()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;jt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Wn(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,o,a,l){let h;const c=e.viewState;function u(E,C,T,I){return r.call(o,C,E?T:null,I)}const d=c.projection,f=Fr(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&n){const E=d.getExtent(),C=U(E);g.push([-C,0],[C,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let C=m-1;C>=0;--C){const T=_[C],I=T.layer;if(I.hasRenderer()&&mn(T,c)&&a.call(l,I)){const S=I.getRenderer(),A=I.getSource();if(S&&A){const O=A.getWrapX()?f:t,W=u.bind(null,T.managed);y[0]=O[0]+g[E][0],y[1]=O[1]+g[E][1],h=S.forEachFeatureAtCoordinate(y,e,i,W,p)}if(h)return h}}if(p.length===0)return;const x=1/p.length;return p.forEach((E,C)=>E.distanceSq+=C*x),p.sort((E,C)=>E.distanceSq-C.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,r,o){return this.forEachFeatureAtCoordinate(t,e,i,n,Ue,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){X()}scheduleExpireIconCache(t){Bi.canExpireCache()&&t.postRenderFunctions.push(Cc)}}function Cc(s,t){Bi.expire()}var Rc=Ec;class Tc extends Rc{constructor(t){super(t);this.fontChangeListenerKey_=G(kt,Te.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Gi+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Rr(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){V(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Zt.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let o=0,a=e.length;o<a;++o){const l=e[o];t.layerIndex=o;const h=l.layer,c=h.getSourceState();if(!mn(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))}for(let o=n.length-1;o>=0;--o)n[o].renderDeclutter(t);va(this.element_,this.children_),this.dispatchRenderEvent(Zt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}}var vc=Tc;class Qt extends Dt{constructor(t,e){super(t);this.layer=e}}const cs={LAYERS:"layers"};class us extends Ds{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(cs.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new At(i.slice(),{unique:!0}):N(typeof i.getArray=="function",43):i=new At(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(V),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(G(t,ht.ADD,this.handleLayersAdd_,this),G(t,ht.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(V);Ve(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i<n;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Qt("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[G(t,Te.PROPERTYCHANGE,this.handleLayerChange_,this),G(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof us&&e.push(G(t,"addlayer",this.handleLayerGroupAdd_,this),G(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Y(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Qt("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Qt("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Qt("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=Y(e);this.listenerKeys_[i].forEach(V),delete this.listenerKeys_[i],this.dispatchEvent(new Qt("removelayer",e)),this.changed()}getLayers(){return this.get(cs.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 Qt("removelayer",i[n]))}this.set(cs.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=oi(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}var on=us;class Ic extends Dt{constructor(t,e,i){super(t);this.map=e,this.frameState=i!==void 0?i:null}}var Ye=Ic;class Sc extends Ye{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()}}var te=Sc,H={SINGLECLICK:"singleclick",CLICK:P.CLICK,DBLCLICK:P.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ds={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class wc extends wi{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_=G(i,ds.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=G(i,ds.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,Ks?{passive:!1}:!1)}emulateClick_(t){let e=new te(H.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new te(H.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;const i=new te(H.SINGLECLICK,this.map_,t);this.dispatchEvent(i)}.bind(this),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==H.POINTERUP||e.type==H.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==H.POINTERDOWN||e.type==H.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new te(H.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(V),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 te(H.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.down_={};for(const i in t){const n=t[i];this.down_[i]=typeof n=="function"?re:n}if(this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(G(i,H.POINTERMOVE,this.handlePointerMove_,this),G(i,H.POINTERUP,this.handlePointerUp_,this),G(this.element_,H.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(G(this.element_.getRootNode(),H.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new te(H.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 te(H.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_&&(V(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(V(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(V),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var Lc=wc,ee={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},st={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const an=1/0;class Ac{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ve(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){N(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=an?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t<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==an?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,e[n++]=o);e.length=n,i.length=n,this.heapify_()}}var Mc=Ac;class bc extends Mc{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(P.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===L.LOADED||i===L.ERROR||i===L.EMPTY){i!==L.ERROR&&e.removeEventListener(P.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===L.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}var Oc=bc;function Pc(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return an;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}var Rt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function bo(s,t,e){return function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,h=t?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,f=s[2]-l/2+c,g=s[1]+h/2+u,_=s[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=$(i[0],d,f),p=$(i[1],g,_);if(o&&e&&n){const y=30*n;m+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-_)/y)}return[m,p]}}function Dc(s){return s}function fs(s,t,e,i){const n=U(t)/e[0],r=St(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function gs(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),$(i,e/2,t*2)}function Fc(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?fs(l,e,o,i):l;if(a)return t?gs(n,c,h):$(n,h,c);const u=Math.min(c,n),d=Math.floor(_n(s,u,r));return s[d]>c&&d<s.length-1?s[d+1]:s[d]}else return}}function kc(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?fs(t,n,l,r):t;if(h)return i?gs(o,c,e):$(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(s)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),_=Math.floor(Math.log(t/g)/Math.log(s)+f),m=Math.max(d,_),p=t/Math.pow(s,m);return $(p,e,c)}else return}}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?fs(s,i,a,n):s;return!e||!l?$(r,t,h):gs(r,h,t)}else return}}function _s(s){if(s!==void 0)return 0}function Po(s){if(s!==void 0)return s}function Nc(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 Gc(s){return s=s||Mi(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=s?0:t}}const ms=0;class Xc extends vt{constructor(t){super();this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Vn(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&&Nr(),t.center&&(t.center=Wt(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 Rt)delete e[a];this.setProperties(e,!0);const i=Yc(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=Wc(t),r=i.constraint,o=zc(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.getCenter();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=Wt(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Wt(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&&ln(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||vh,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=Ie(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Bc(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(nt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[nt.ANIMATING]>0}getInteracting(){return this.hints_[nt.INTERACTING]>0}cancelAnimations(){this.setHint(nt.ANIMATING,-this.hints_[nt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const n=this.animations_[e];if(n[0].callback&&ln(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],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Ie(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(nt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&ln(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-e[0],n[1]-e[1]],Kn(i,t-this.getRotation()),Nl(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-n[0])/r,a=e[1]-t*(e[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}else return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Hn(t,this.getProjection())}getCenterInternal(){return this.get(Rt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return zr(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();N(e,1);const i=this.getResolution();N(i!==void 0,2);const n=this.getRotation();return N(n!==void 0,3),Fn(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Rt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(fe(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=U(t)/e[0],n=St(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(r){return e/Math.pow(t,r*n)}}getRotation(){return this.get(Rt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(o){return Math.log(i/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=ps(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,n;if(this.resolutions_){const r=_n(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return e+Math.log(i/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=$(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,$(t-e,0,1))}else return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(N(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){N(!Nn(t),25);const n=fe(t,this.getProjection());i=Mo(n)}else if(t.getType()==="Circle"){const n=fe(t.getExtent(),this.getProjection());i=Mo(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 f=r[u]*i-r[u+1]*n,g=r[u]*n+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const 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 f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,_=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:re;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),ln(m,!0))}centerOn(t,e,i){this.centerOnInternal(Wt(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(ps(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=ps(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=Hn(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&&Wt(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=Wt(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&&Wt(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(Rt.ROTATION)!==n&&this.set(Rt.ROTATION,n),this.get(Rt.RESOLUTION)!==o&&(this.set(Rt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Rt.CENTER)||!Qi(this.get(Rt.CENTER),a))&&this.set(Rt.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()||!Qi(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Xe,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(nt.INTERACTING,1)}endInteraction(t,e,i){i=i&&Wt(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.setHint(nt.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 ln(s,t){setTimeout(function(){s(t)},0)}function Wc(s){if(s.extent!==void 0){const e=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return bo(s.extent,s.constrainOnlyCenter,e)}const t=Vn(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,bo(e,!1,!1)}return Dc}function Yc(s){let t,e,i;const n=28,r=2;let o=s.minZoom!==void 0?s.minZoom:ms,a=s.maxZoom!==void 0?s.maxZoom:n;const l=s.zoomFactor!==void 0?s.zoomFactor:r,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=Vn(s.projection,"EPSG:3857"),f=d.getExtent();let g=s.constrainOnlyCenter,_=s.extent;if(!h&&!_&&d.isGlobal()&&(g=!1,_=f),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=Fc(m,c,!g&&_,u):t=Oo(e,i,c,!g&&_,u)}else{const p=(f?Math.max(U(f),St(f)):360*fi.degrees/d.getMetersPerUnit())/is/Math.pow(r,ms),y=p/Math.pow(r,n-ms);e=s.maxResolution,e!==void 0?o=0:e=p/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=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),s.constrainResolution?t=kc(l,e,i,c,!g&&_,u):t=Oo(e,i,c,!g&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function zc(s){if(s.enableRotation!==void 0?s.enableRotation:!0){const e=s.constrainRotation;return e===void 0||e===!0?Gc():e===!1?Po:typeof e=="number"?Nc(e):Po}else return _s}function Bc(s){return!(s.sourceCenter&&s.targetCenter&&!Qi(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function ps(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]}var _e=Xc;class Kc extends vt{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(){Cn(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&Cn(this.element);for(let e=0,i=this.listenerKeys.length;e<i;++e)V(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==re&&this.listenerKeys.push(G(t,ee.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}var ys=Kc;class Zc extends ys{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(P.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Gi+" "+Rn+(this.collapsed_&&this.collapsible_?" "+Vs:"")+(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={},i=[];let n=!0;const r=t.layerStatesArray;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(!mn(l,t.viewState))continue;const h=l.layer.getSource();if(!h)continue;const c=h.getAttributions();if(!c)continue;const u=c(t);if(!!u)if(n=n&&h.getAttributionsCollapsible()!==!1,Array.isArray(u))for(let d=0,f=u.length;d<f;++d)u[d]in e||(i.push(u[d]),e[u[d]]=!0);else u in e||(i.push(u),e[u]=!0)}return this.overrideCollapsible_||this.setCollapsible(n),i}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),!se(e,this.renderedAttributions_)){Ta(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(Vs),this.collapsed_?Us(this.collapseLabel_,this.label_):Us(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)}}var Uc=Zc;class Vc extends ys{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(P.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Gi+" "+Rn,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(Ni)}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:Xe}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Ni);!r&&i===0?this.element.classList.add(Ni):r&&i!==0&&this.element.classList.remove(Ni)}this.label_.style.transform=n}this.rotation_=i}}var jc=Vc;class Hc extends ys{constructor(t){t=t||{};super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,n=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(P.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Gi+" "+Rn,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:Xe})):i.setZoom(r)}}}var $c=Hc;function qc(s){s=s||{};const t=new At;return(s.zoom!==void 0?s.zoom:!0)&&t.push(new $c(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&t.push(new jc(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&t.push(new Uc(s.attributionOptions)),t}var Do={ACTIVE:"active"};class Jc extends vt{constructor(t){super();this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Do.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Do.ACTIVE,t)}setMap(t){this.map_=t}}function Qc(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:Ih,center:s.getConstrainedCenter(n)})}}function xs(s,t,e,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+t),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:Xe})}var mi=Jc;class tu extends mi{constructor(t){super();t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==H.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();xs(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}var eu=tu;class iu extends mi{constructor(t){t=t||{};super(t);t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==H.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==H.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==H.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==H.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Es(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[e/t,i/t]}var pi=iu;function Cs(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 nu=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},su=function(s){const t=s.map.getTargetElement(),e=s.map.getOwnerDocument().activeElement;return t.contains(e)},Fo=function(s){return s.map.getTargetElement().hasAttribute("tabindex")?su(s):!0},ru=Ue,ko=function(s){const t=s.originalEvent;return t.button==0&&!(Ea&&Ca&&t.ctrlKey)},No=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},ou=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Go=function(s){const t=s.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Rs=function(s){const t=s.originalEvent;return N(t!==void 0,56),t.pointerType=="mouse"},au=function(s){const t=s.originalEvent;return N(t!==void 0,56),t.isPrimary&&t.button===0};class lu extends pi{constructor(t){super({stopDown:Si});t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Cs(No,au);this.condition_=t.onFocusOnly?Cs(Fo,e):e,this.noKinetic_=!1}handleDragEvent(t){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());const e=this.targetPointers,i=Es(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(i[0],i[1]),this.lastCentroid){const n=[this.lastCentroid[0]-i[0],i[1]-this.lastCentroid[1]],o=t.map.getView();Gl(n,o.getResolution()),Kn(n,o.getRotation()),o.adjustCenterInternal(n)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=i,this.lastPointersCount_=e.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:Xe})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}else 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}else return!1}}var hu=lu;class cu extends pi{constructor(t){t=t||{};super({stopDown:Si});this.condition_=t.condition?t.condition:nu,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Rs(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===_s)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 Rs(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Rs(t)&&ko(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}var uu=cu;class du extends gn{constructor(t){super();this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new pc([n])}getGeometry(){return this.geometry_}}var fu=du;const hn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Ts extends Dt{constructor(t,e,i){super(t);this.coordinate=e,this.mapBrowserEvent=i}}class gu extends pi{constructor(t){super();this.on,this.once,this.un,t=t||{},this.box_=new fu(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:ko,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 Ts(hn.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Ts(e?hn.BOXEND:hn.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ts(hn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}var _u=gu;class mu extends _u{constructor(t){t=t||{};const e=t.condition?t.condition:ou;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea});this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:Xe})}}var pu=mu,me={LEFT:37,UP:38,RIGHT:39,DOWN:40};class yu extends mi{constructor(t){super();t=t||{},this.defaultCondition_=function(e){return No(e)&&Go(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN){const i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(n==me.DOWN||n==me.LEFT||n==me.RIGHT||n==me.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;n==me.DOWN?h=-a:n==me.LEFT?l=-a:n==me.RIGHT?l=a:h=a;const c=[l,h];Kn(c,o.getRotation()),Qc(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}var xu=yu;class Eu extends mi{constructor(t){super();t=t||{},this.condition_=t.condition?t.condition:Go,this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN||t.type==P.KEYPRESS){const i=t.originalEvent,n=i.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const r=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_,a=r.getView();xs(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var Cu=Eu;class Ru extends mi{constructor(t){t=t||{};super(t);this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:ru;this.condition_=t.onFocusOnly?Cs(Fo,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==P.WHEEL)return!0;const i=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let r;if(t.type==P.WHEEL&&(r=n.deltaY,ya&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=Bs),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-$(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),xs(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Tu=Ru;class vu extends pi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Si);super(e);this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(this.lastAngle_!==void 0){const c=r-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=r;const o=t.map,a=o.getView();if(a.getConstraints().rotation===_s)return;const l=o.getViewport().getBoundingClientRect(),h=Es(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}else return!1}}var Iu=vu;class Su extends pi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Si);super(e);this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e);const c=l.getViewport().getBoundingClientRect(),u=Es(this.targetPointers);u[0]-=c.left,u[1]-=c.top,this.anchor_=l.getCoordinateFromPixelInternal(u),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}else return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}else return!1}}var wu=Su;function Lu(s){s=s||{};const t=new At,e=new xc(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&t.push(new uu),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&t.push(new eu({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&t.push(new hu({onFocusOnly:s.onFocusOnly,kinetic:e})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&t.push(new Iu),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&t.push(new wu({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(t.push(new xu),t.push(new Cu({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&t.push(new Tu({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&t.push(new pu({duration:s.zoomDuration})),t}function Xo(s){if(s instanceof Pi){s.setMapInternal(null);return}s instanceof on&&s.getLayers().forEach(Xo)}function Wo(s,t){if(s instanceof Pi){s.setMapInternal(t);return}if(s instanceof on){const e=s.getLayers().getArray();for(let i=0,n=e.length;i<n;++i)Wo(e[i],t)}}class Au extends vt{constructor(t){super();t=t||{},this.on,this.once,this.un;const e=Mu(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:Bs,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=wt(),this.pixelToCoordinateTransform_=wt(),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.controls=e.controls||qc(),this.interactions=e.interactions||Lu({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Oc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(st.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(st.VIEW,this.handleViewChanged_),this.addChangeListener(st.SIZE,this.handleSizeChanged_),this.addChangeListener(st.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof _e)&&t.view.then(function(n){i.setView(new _e(n))}),this.controls.addEventListener(ht.ADD,function(n){n.element.setMap(this)}.bind(this)),this.controls.addEventListener(ht.REMOVE,function(n){n.element.setMap(null)}.bind(this)),this.interactions.addEventListener(ht.ADD,function(n){n.element.setMap(this)}.bind(this)),this.interactions.addEventListener(ht.REMOVE,function(n){n.element.setMap(null)}.bind(this)),this.overlays_.addEventListener(ht.ADD,function(n){this.addOverlayInternal_(n.element)}.bind(this)),this.overlays_.addEventListener(ht.REMOVE,function(n){const r=n.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],n.element.setMap(null)}.bind(this)),this.controls.forEach(function(n){n.setMap(this)}.bind(this)),this.interactions.forEach(function(n){n.setMap(this)}.bind(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){Wo(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.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:Ue,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 on?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:Ue,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 e=this.viewport_.getBoundingClientRect(),i="changedTouches"in t?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]}getTarget(){return this.get(st.TARGET)}getTargetElement(){const t=this.getTarget();return t!==void 0?typeof t=="string"?document.getElementById(t):t:null}getCoordinateFromPixel(t){return Hn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?et(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(st.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof At){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=Wt(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?et(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(st.SIZE)}getView(){return this.get(st.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 Pc(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new te(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ds.POINTERDOWN||i===P.WHEEL||i===P.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[nt.ANIMATING]||o[nt.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(Zt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Zt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ye(ee.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ye(ee.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 e=0,i=this.targetChangeHandlerKeys_.length;e<i;++e)V(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(P.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,Cn(this.viewport_)}const t=this.getTargetElement();if(!t)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{t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new vc(this)),this.mapBrowserEventHandler_=new Lc(this,this.moveTolerance_);for(const n in H)this.mapBrowserEventHandler_.addEventListener(H[n],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(P.WHEEL,this.boundHandleBrowserEvent_,Ks?{passive:!1}:!1);const e=this.getOwnerDocument().defaultView,i=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.targetChangeHandlerKeys_=[G(i,P.KEYDOWN,this.handleBrowserEvent,this),G(i,P.KEYPRESS,this.handleBrowserEvent,this),G(e,P.RESIZE,this.updateSize,this)]}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(V(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(V(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=G(t,Te.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=G(t,P.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(V),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Qt("addlayer",t)),this.layerGroupPropertyListenerKeys_=[G(t,Te.PROPERTYCHANGE,this.render,this),G(t,P.CHANGE,this.render,this),G(t,"addlayer",this.handleLayerAdd_,this),G(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_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Xo(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&&Gs(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:Fn(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:Y(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Fn(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_||!Nn(this.previousExtent_)&&!si(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ye(ee.MOVESTART,this,n)),this.previousExtent_=Zi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[nt.ANIMATING]&&!r.viewHints[nt.INTERACTING]&&!si(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ye(ee.MOVEEND,this,r)),rr(r.extent,this.previousExtent_))),this.dispatchEvent(new Ye(ee.POSTRENDER,this,r)),this.renderComplete_=this.hasListener(ee.LOADSTART)||this.hasListener(ee.LOADEND)||this.hasListener(Zt.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 Qt("removelayer",e)),this.set(st.LAYERGROUP,t)}setSize(t){this.set(st.SIZE,t)}setTarget(t){this.set(st.TARGET,t)}setView(t){if(!t||t instanceof _e){this.set(st.VIEW,t);return}this.set(st.VIEW,new _e);const e=this;t.then(function(i){e.setView(new _e(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(n)&&!isNaN(r)&&(e=[n,r],!Gs(e)&&!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(e),this.updateViewportSize_()}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function Mu(s){let t=null;s.keyboardEventTarget!==void 0&&(t=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const e={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new on({layers:s.layers});e[st.LAYERGROUP]=i,e[st.TARGET]=s.target,e[st.VIEW]=s.view instanceof _e?s.view:new _e;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new At(s.controls.slice()):(N(typeof s.controls.getArray=="function",47),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new At(s.interactions.slice()):(N(typeof s.interactions.getArray=="function",48),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new At(s.overlays.slice()):(N(typeof s.overlays.getArray=="function",49),o=s.overlays):o=new At,{controls:n,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}var qu=Au,Ju="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAzCAYAAAB8F5OAAAAAWUlEQVRYhe3YOwrAMBADUcn3v7NcuHECgeBPwGSmXl6xpRwp6kus0eyL1fAZ8Ck7ZTnatRV3khdnY537FnBwcHBwcHDw3+Pg4ODg4B/jtxljWYevFruWIkkV0WQUXM8Qu78AAAAASUVORK5CYII=";export{ju as $,xo as A,Co as B,ql as C,$i as D,P as E,Bu as F,Ul as G,Ou as H,dr as I,Wu as J,To as K,ve as L,qu as M,ar as N,Fa as O,_c as P,xt as Q,Ku as R,bn as S,Gu as T,Zu as U,_e as V,Xu as W,zu as X,Vu as Y,$u as Z,pr as _,Nu as a,Hu as a0,Pu as a1,pc as a2,Yu as a3,Uu as a4,Et as a5,Ge as a6,X as a7,N as a8,je as a9,er as aa,tr as ab,ku as b,Za as c,Ln as d,bu as e,Fu as f,$n as g,As as h,or as i,Eo as j,Vh as k,oe as l,yo as m,Oe as n,El as o,yr as p,ss as q,Ro as r,Ju as s,Du as t,ih as u,V as v,G as w,Zi as x,ka as y,be as z};