define("openlayer", [], function(){"use strict";const t={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class e extends Error{constructor(e){const i=t[e];super(i),this.code=e,this.name="AssertionError",this.message=i}}var i=e;function n(t){t.stopPropagation()}var r=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},s="propertychange";var o=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function a(t,e,i){let n,r;i=i||l;let s=0,o=t.length,a=!1;for(;s>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function l(t,e){return t>e?1:t0){for(r=1;r0?r-1:r:t[r-1]-e0||i&&0===s)}))}function f(){return!0}function p(){return!1}function m(){}function _(t){let e,i,n,r=!1;return function(){const s=Array.prototype.slice.call(arguments);return r&&this===n&&d(s,i)||(r=!0,n=this,i=s,e=t.apply(this,arguments)),e}}function y(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function x(t){for(const e in t)delete t[e]}function v(t){let e;for(e in t)return!1;return!e}var S=class extends o{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="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new r(t):t;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let l;i in o||(o[i]=0,a[i]=0),++o[i];for(let t=0,e=n.length;t0)}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=m,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}},w="change",T="error",E="contextmenu",C="click",R="dblclick",b="dragenter",P="dragover",I="drop",L="keydown",F="keypress",M="load",A="touchmove",O="wheel";function N(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function D(t,e,i,n){return N(t,e,i,n,!0)}function G(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),x(t))}class k extends S{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(w)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new q(Z,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new q(Y,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new q(Y,i,t)),this.dispatchEvent(new q(Z,e,t))}updateLength_(){this.set(K,this.array_.length)}assertUnique_(t,e){for(let n=0,r=this.array_.length;nt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){z()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:it(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}};const at="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",lt=at.includes("firefox"),ht=at.includes("safari")&&!at.includes("chrom"),ct=ht&&(at.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(at)),ut=at.includes("webkit")&&!at.includes("edge"),dt=at.includes("macintosh"),gt="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,ft="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,pt="undefined"!=typeof Image&&Image.prototype.decode,mt=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function _t(t,e,i,n){let r;return r=i&&i.length?i.shift():ft?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}function yt(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function xt(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function vt(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function St(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function wt(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function Tt(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function Et(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}function Ct(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?t:null}function Rt(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}let bt=null;function Pt(t){bt||(bt=_t(t.width,t.height,void 0,{willReadFrequently:!0}));const e=bt.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),bt.drawImage(t,i,n),bt.getImageData(0,0,i,n).data}const It=[256,256];var Lt=class extends ot{constructor(t){const e=$;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null}getSize(){if(this.size_)return this.size_;const t=Ct(this.data_);return t?[t.width,t.height]:It}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==$&&this.state!==tt)return;this.state=J,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=Q,t.changed()})).catch((function(e){t.error_=e,t.state=tt,t.changed()}))}};function Ft(t,e){if(!t)throw new i(e)}class Mt extends W{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Mt(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_&&(G(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=N(t,w,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?At(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 At(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Ft("function"==typeof t.getZIndex,41);e=[t]}return function(){return e}}var Ot=Mt;const Nt=new Array(6);function Dt(){return[1,0,0,1,0,0]}function Gt(t){return jt(t,1,0,0,1,0,0)}function kt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function jt(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Bt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function zt(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Ut(t,e){const i=Math.cos(e),n=Math.sin(e);return kt(t,jt(Nt,i,n,-n,i,0,0))}function Xt(t,e,i){return kt(t,jt(Nt,e,0,0,i,0,0))}function Vt(t,e,i){return jt(t,e,0,0,i,0,0)}function Wt(t,e,i){return kt(t,jt(Nt,1,0,0,1,e,i))}function Zt(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Yt(t,e){const i=Kt(e);Ft(0!==i,32);const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return t[0]=o/i,t[1]=-r/i,t[2]=-s/i,t[3]=n/i,t[4]=(s*l-o*a)/i,t[5]=-(n*l-r*a)/i,t}function Kt(t){return t[0]*t[3]-t[1]*t[2]}let qt;function Ht(t){const e="matrix("+t.join(", ")+")";if(ft)return e;const i=qt||(qt=document.createElement("div"));return i.style.transform=e,i.style.transform}var $t=0,Jt=1,Qt=2,te=4,ee=8,ie=16;function ne(t){const e=ue();for(let i=0,n=t.length;ir&&(l|=te),as&&(l|=Qt),l===$t&&(l=Jt),l}function ue(){return[1/0,1/0,-1/0,-1/0]}function de(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function ge(t){return de(1/0,1/0,-1/0,-1/0,t)}function fe(t,e){const i=t[0],n=t[1];return de(i,n,i,n,e)}function pe(t,e,i,n,r){return Se(ge(r),t,e,i,n)}function me(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function _e(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function xe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function ve(t,e){for(let i=0,n=e.length;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ke(t){return t[2]=o&&p<=l),n||!(s&te)||r&te||(m=g-(d-l)*f,n=m>=a&&m<=h),n||!(s&ee)||r&ee||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(s&ie)||r&ie||(m=g-(d-o)*f,n=m>=a&&m<=h)}return n}function Ue(t,e,i,n){let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=De(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Ve(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];Xe(t,e);const n=De(i);if(De(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}const We={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function Ze(t){return We[t]}const Ye={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ke=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,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_||Ye[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}};const qe=6378137,He=Math.PI*qe,$e=[-He,-He,He,He],Je=[-180,-85,180,85],Qe=qe*Math.log(Math.tan(Math.PI/2));class ti extends Ke{constructor(t){super({code:t,units:"m",extent:$e,global:!0,worldExtent:Je,getPointResolution:function(t,e){return t/Math.cosh(e[1]/qe)}})}}const ei=[new ti("EPSG:3857"),new ti("EPSG:102100"),new ti("EPSG:102113"),new ti("EPSG:900913"),new ti("http://www.opengis.net/def/crs/EPSG/0/3857"),new ti("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ii(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;rQe?i=Qe:i<-Qe&&(i=-Qe),e[r+1]=i}return e}function ni(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return xi(t,e,i,n)}function xi(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function vi(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function Si(t){return 180*t/Math.PI}function wi(t){return t*Math.PI/180}function Ti(t,e){const i=t%e;return i*e<0?i+e:i}function Ei(t,e,i){return t+i*(e-t)}function Ci(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ri(t,e){return Math.round(Ci(t,e))}function bi(t,e){return Math.floor(Ci(t,e))}function Pi(t,e){return Math.ceil(Ci(t,e))}function Ii(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let r=n.indexOf(".");return r=-1===r?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function Li(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;tr)return 1;if(r>e)return-1}return 0}function Fi(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Mi(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function Ai(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],c=l-o,u=h-a,d=0===c&&0===u?0:(c*(i-o)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=o,f=a):d>=1?(g=l,f=h):(g=o+d*c,f=a+d*u),[g,f]}function Oi(t,e,i){const n=Ti(e+180,360)-180,r=Math.abs(3600*n),s=i||0;let o=Math.floor(r/3600),a=Math.floor((r-3600*o)/60),l=Ci(r-3600*o-60*a,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let h=o+"°";return 0===a&&0===l||(h+=" "+Ii(a,2)+"′"),0!==l&&(h+=" "+Ii(l,2,s)+"″"),0!==n&&(h+=" "+t.charAt(n<0?1:0)),h}function Ni(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Di(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Gi(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function ki(t,e){return t[0]*=e,t[1]*=e,t}function ji(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Bi(t,e){return Math.sqrt(ji(t,e))}function zi(t,e){return ji(t,Ai(t,e))}function Ui(t,e){return Ni(t,"{x}, {y}",e)}function Xi(t,e){if(e.canWrapX()){const i=De(e.getExtent()),n=Vi(t,e,i);n&&(t[0]-=n*i)}return t}function Vi(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||De(n),r=Math.floor((t[0]-n[0])/i)),r}const Wi=6371008.8;function Zi(t,e,i){i=i||Wi;const n=wi(t[1]),r=wi(e[1]),s=(r-n)/2,o=wi(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Yi(t,e){let i=0;for(let n=0,r=t.length;nHi.warn||console.warn(...t)}function Qi(...t){$i>Hi.error||console.error(...t)}let tn=!0;function en(t){tn=!(void 0===t||t)}function nn(t,e){if(void 0!==e)for(let i=0,n=t.length;i=o?e[s+t]:r[t]}return i}}function gn(t,e,i,n){const r=an(t),s=an(e);pi(r,s,dn(i)),pi(s,r,dn(n))}function fn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return pn(t,e)===nn&&i}function pn(t,e){let i=mi(t.getCode(),e.getCode());return i||(i=rn),i}function mn(t,e){return pn(an(t),an(e))}function _n(t,e,i){return mn(e,i)(t,void 0,t.length)}function yn(t,e,i,n){return Ue(t,mn(e,i),void 0,n)}let xn=null;function vn(t){xn=an(t)}function Sn(){return xn}function wn(t,e){return xn?_n(t,e,xn):t}function Tn(t,e){return xn?_n(t,xn,e):(tn&&!Di(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(tn=!1,Ji("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function En(t,e){return xn?yn(t,e,xn):t}function Cn(t,e){return xn?yn(t,xn,e):t}function Rn(t,e){if(!xn)return t;const i=an(e).getUnits(),n=xn.getUnits();return i&&n?t*Ye[i]/Ye[n]:t}function bn(t,e){if(!xn)return t;const i=an(e).getUnits(),n=xn.getUnits();return i&&n?t*Ye[n]/Ye[i]:t}function Pn(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=De(e);s=Vi(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=_i(n[0],e[0],e[2]),n[1]=_i(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*De(e.getExtent())),r}}function In(){hn(ei),hn(li),cn(li,ei,ii,ni)}function Ln(t,e,i,n,r,s){s=s||[];let o=0;for(let a=e;a1)u=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function zn(t,e,i,n,r){for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;eo&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+nr&&(s[o++]=h,s[o++]=c,a=h,l=c);return h==a&&c==l||(s[o++]=h,s[o++]=c),o}function Qn(t,e){return e*Math.round(t/e)}function tr(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=Qn(t[e],r),c=Qn(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=Qn(t[e],r),l=Qn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e0&&f>d)&&(g<0&&p0&&p>g)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function er(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;ls&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function pr(t,e,i,n,r,s){if(0===i.length)return!1;if(!fr(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;ey&&(c=(u+d)/2,pr(t,e,i,n,c,p)&&(_=c,y=r)),u=d}return isNaN(_)&&(_=r[s]),o?(o.push(_,p,y),o):[_,p,y]}function yr(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||xr(t,e,i,n,(function(t,e){return ze(r,t,e)})))))}function Sr(t,e,i,n,r){for(let s=0,o=i.length;s0}function br(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s0&&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],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}};const ls=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,hs=/^([a-z]*)$|^hsla?\(.*\)$/i;function cs(t){return"string"==typeof t?t:ps(t)}function us(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}const ds=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let i=0;for(const n in t)0==(3&i++)&&(delete t[n],--e)}n=function(t){let e,i,n,r,s;hs.exec(t)&&(t=us(t));if(ls.exec(t)){const o=t.length-1;let a;a=o<=4?1:2;const l=4===o||8===o;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),r=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),s=[e,i,n,r/255]}else t.startsWith("rgba(")?(s=t.slice(5,-1).split(",").map(Number),fs(s)):t.startsWith("rgb(")?(s=t.slice(4,-1).split(",").map(Number),s.push(1),fs(s)):Ft(!1,14);return s}(i),t[i]=n,++e}return n}}();function gs(t){return Array.isArray(t)?t:ds(t)}function fs(t){return t[0]=_i(t[0]+.5|0,0,255),t[1]=_i(t[1]+.5|0,0,255),t[2]=_i(t[2]+.5|0,0,255),t[3]=_i(t[3],0,1),t}function ps(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}function ms(t){return hs.test(t)&&(t=us(t)),ls.test(t)||t.startsWith("rgba(")||t.startsWith("rgb(")}class _s{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];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ys(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=ys(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ys(t,e,i){return e+":"+t+":"+(i?cs(i):"null")}var xs=_s;const vs=new _s;var Ss="opacity",ws="visible",Ts="extent",Es="zIndex",Cs="maxResolution",Rs="minResolution",bs="maxZoom",Ps="minZoom",Is="source",Ls="map";var Fs=class extends W{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Ss]=void 0!==t.opacity?t.opacity:1,Ft("number"==typeof e[Ss],64),e[ws]=void 0===t.visible||t.visible,e[Es]=t.zIndex,e[Cs]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Rs]=void 0!==t.minResolution?t.minResolution:0,e[Ps]=void 0!==t.minZoom?t.minZoom:-1/0,e[bs]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?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:void 0===t||t},i=this.getZIndex();return e.opacity=_i(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,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 z()}getLayerStatesArray(t){return z()}getExtent(){return this.get(Ts)}getMaxResolution(){return this.get(Cs)}getMinResolution(){return this.get(Rs)}getMinZoom(){return this.get(Ps)}getMaxZoom(){return this.get(bs)}getOpacity(){return this.get(Ss)}getSourceState(){return z()}getVisible(){return this.get(ws)}getZIndex(){return this.get(Es)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ts,t)}setMaxResolution(t){this.set(Cs,t)}setMinResolution(t){this.set(Rs,t)}setMaxZoom(t){this.set(bs,t)}setMinZoom(t){this.set(Ps,t)}setOpacity(t){Ft("number"==typeof t,64),this.set(Ss,t)}setVisible(t){this.set(ws,t)}setZIndex(t){this.set(Es,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Ms="prerender",As="postrender",Os="precompose",Ns="postcompose",Ds="rendercomplete";function Gs(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var ks=class extends Fs{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Is,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Is)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(G(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=N(t,w,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}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(Ls,t)}getMapInternal(){return this.get(Ls)}setMap(t){this.mapPrecomposeKey_&&(G(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(G(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=N(t,Os,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Ft(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=N(this,w,t.render,t),this.changed())}setSource(t){this.set(Is,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 js(t,e){vs.expire()}var Bs=class extends o{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){z()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Zt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Yt(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function c(t,e,i,n){return r.call(s,e,t?i:null,n)}const u=h.projection,d=Xi(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=De(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,p=f.length,m=[],_=[];for(let n=0;n=0;--r){const s=f[r],u=s.layer;if(u.hasRenderer()&&Gs(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=c.bind(null,s.managed);_[0]=a[0]+g[n][0],_[1]=a[1]+g[n][1],l=r.forEachFeatureAtCoordinate(_,e,i,h,m)}if(l)return l}}if(0===m.length)return;const y=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*y)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,f,this,r,s)}getMap(){return this.map_}renderFrame(t){z()}scheduleExpireIconCache(t){vs.canExpireCache()&&t.postRenderFunctions.push(js)}};var zs=class extends r{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const Us="ol-hidden",Xs="ol-selectable",Vs="ol-unselectable",Ws="ol-unsupported",Zs="ol-control",Ys="ol-collapsed",Ks=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"),qs=["style","variant","weight","size","lineHeight","family"],Hs=function(t){const e=t.match(Ks);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=qs.length;tMath.max(e,po(t,i))),0);return i[e]=n,n}function _o(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l;continue}const d=e[h+1]||t.font,g=po(d,u);i.push(g),o+=g;const f=go(d);n.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function yo(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t=0;--e)n[e].renderDeclutter(t);Et(this.element_,this.children_),this.dispatchRenderEvent(Ns,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}};class vo extends r{constructor(t,e){super(t),this.layer=e}}const So="layers";class wo extends Fs{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(So,this.handleLayersChanged_),i?Array.isArray(i)?i=new H(i.slice(),{unique:!0}):Ft("function"==typeof i.getArray,43):i=new H(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(G),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(N(t,Z,this.handleLayersAdd_,this),N(t,Y,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(G);x(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{this.clickTimeoutId_=void 0;const e=new Co(Ro.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Ro.POINTERUP||e.type==Ro.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Ro.POINTERDOWN&&e.type!=Ro.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Co(Ro.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_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Co(Ro.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.down_={};for(const e in t){const i=t[e];this.down_[e]="function"==typeof i?m:i}if(0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(N(t,Ro.POINTERMOVE,this.handlePointerMove_,this),N(t,Ro.POINTERUP,this.handlePointerUp_,this),N(this.element_,Ro.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(N(this.element_.getRootNode(),Ro.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Co(Ro.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 Co(Ro.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||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_&&(G(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(A,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(G(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Mo="postrender",Ao="movestart",Oo="moveend",No="loadstart",Do="loadend",Go="layergroup",ko="size",jo="target",Bo="view";const zo=1/0;var Uo=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,x(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(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){Ft(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=zo&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+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 0===this.elements_.length}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],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o0;)n=this.dequeue()[0],r=n.getKey(),i=n.getState(),i!==$||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}};function Vo(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return zo;if(!t.wantedTiles[i][e.getKey()])return zo;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Wo=0,Zo=1,Yo={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const Ko=256;function qo(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let m=_i(n[0],d,g),_=_i(n[1],f,p);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),_+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[m,_]}}function Ho(t){return t}function $o(t,e,i,n){const r=De(e)/i[0],s=Me(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Jo(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),_i(n,i/2,2*e)}function Qo(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],c=t[t.length-1],u=i?$o(l,i,o,n):l;if(a)return e?Jo(r,u,c):_i(r,c,u);const d=Math.min(u,r),g=Math.floor(h(t,d,s));return t[g]>u&&g1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[Zo]>0}cancelAnimations(){let t;this.setHint(Wo,-this.hints_[Wo]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Ti(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(Wo,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&oa(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Gi(i,t-this.getRotation()),Fi(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?wn(t,this.getProjection()):t}getCenterInternal(){return this.get(Yo.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return En(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Ft(e,1);const i=this.getResolution();Ft(void 0!==i,2);const n=this.getRotation();return Ft(void 0!==n,3),Le(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(Yo.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Cn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=De(t)/e[0],n=Me(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(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(Yo.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(t){return Math.log(i/t)/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 t=this.getViewportSizeMinusPadding_();n=ua(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?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 void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=h(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=_i(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,_i(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Ft(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){Ft(!ke(t),25);i=Nr(Cn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Cn(t.getExtent(),this.getProjection());i=Nr(e),i.rotate(this.getRotation(),Pe(e))}else{const e=Sn();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!d(e,this.renderedAttributions_)){Tt(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:nt}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Us);t||0!==i?t&&0!==i&&this.element.classList.remove(Us):this.element.classList.add(Us)}this.label_.style.transform=t}this.rotation_=i}};var ma=class extends ga{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(C,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(C,this.handleClick_.bind(this,-i),!1);const u=e+" "+"ol-unselectable "+Zs,d=this.element;d.className=u,d.appendChild(h),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:nt})):e.setZoom(n)}}};function _a(t){t=t||{};const e=new H;(void 0===t.zoom||t.zoom)&&e.push(new ma(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new pa(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new fa(t.attributionOptions)),e}var ya="active";function xa(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:st,center:t.getConstrainedCenter(r)})}}function va(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:nt})}var Sa=class extends W{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(ya)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(ya,t)}setMap(t){this.map_=t}};var wa=class extends Sa{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Ro.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;va(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function Ta(t){const e=t.length;let i=0,n=0;for(let r=0;r0}}else if(t.type==Ro.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Ro.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 Ca(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}};var Ba=class extends Ea{constructor(t){t=t||{},super({stopDown:p}),this.condition_=t.condition?t.condition:ba,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ga(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ia)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!Ga(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!Ga(t))return!1;if(Fa(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}};var za=class extends o{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 t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.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_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Ar([i])}getGeometry(){return this.geometry_}};const Ua="boxstart",Xa="boxdrag",Va="boxend",Wa="boxcancel";class Za extends r{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}var Ya=class extends Ea{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new za(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Fa,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 Za(Xa,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 Za(e?Va:Wa,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 Za(Ua,t.coordinate,t)),!0)}onBoxEnd(t){}};var Ka=class extends Ya{constructor(t){super({condition:(t=t||{}).condition?t.condition:Na,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:nt})}},qa=37,Ha=38,$a=39,Ja=40;var Qa=class extends Sa{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Oa(t)&&Da(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==L){const i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(n==Ja||n==qa||n==$a||n==Ha)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Ja?a=-s:n==qa?o=-s:n==$a?o=s:a=s;const l=[o,a];Gi(l,r.getRotation()),xa(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}};var tl=class extends Sa{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:Da,this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==L||t.type==F){const i=t.originalEvent,n=i.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const r=t.map,s=n=="+".charCodeAt(0)?this.delta_:-this.delta_;va(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}};var el=class extends Sa{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:La;this.condition_=t.onFocusOnly?Ca(Ia,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))return!0;if(t.type!==O)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==O&&(n=i.deltaY,lt&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=gt),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),va(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 il=class extends Ea{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=p),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?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(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==ia&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Ta(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};var nl=class extends Ea{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=p),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?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,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Ta(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function rl(t){t=t||{};const e=new H,i=new as(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Ba);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new wa({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new ja({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new il);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new nl({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Qa),e.push(new tl({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new el({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ka({duration:t.zoomDuration})),e}function sl(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i}function ol(t){return t[0]>0&&t[1]>0}function al(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function ll(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}function hl(t){t instanceof ks?t.setMapInternal(null):t instanceof To&&t.getLayers().forEach(hl)}function cl(t,e){if(t instanceof ks)t.setMapInternal(e);else if(t instanceof To){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||_a(),this.interactions=e.interactions||rl({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Xo(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Go,this.handleLayerGroupChanged_),this.addChangeListener(Bo,this.handleViewChanged_),this.addChangeListener(ko,this.handleSizeChanged_),this.addChangeListener(jo,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof da||t.view.then((function(t){i.setView(new da(t))})),this.controls.addEventListener(Z,(t=>{t.element.setMap(this)})),this.controls.addEventListener(Y,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(Z,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(Y,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(Z,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(Y,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){cl(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:f,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof To?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:f,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,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=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(jo)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return wn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?zt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Go)}setLayers(t){const e=this.getLayerGroup();if(t instanceof H)return void e.setLayers(t);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=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Wo]||e[Zo]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new vo("removelayer",e)),this.set(Go,t)}setSize(t){this.set(ko,t)}setTarget(t){this.set(jo,t)}setView(t){if(!t||t instanceof da)return void this.set(Bo,t);this.set(Bo,new da);const e=this;t.then((function(t){e.setView(new da(t))}))}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],!ol(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Ji("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&d(e,i)||(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}};const dl="element",gl="map",fl="offset",pl="position",ml="positioning";var _l=class extends W{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(dl,this.handleElementChanged),this.addChangeListener(gl,this.handleMapChanged),this.addChangeListener(fl,this.handleOffsetChanged),this.addChangeListener(pl,this.handlePositionChanged),this.addChangeListener(ml,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(dl)}getId(){return this.id}getMap(){return this.get(gl)||null}getOffset(){return this.get(fl)}getPosition(){return this.get(pl)}getPositioning(){return this.get(ml)}handleElementChanged(){Tt(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(wt(this.element),G(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=N(t,Mo,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(dl,t)}setMap(t){this.set(gl,t)}setOffset(t){this.set(fl,t)}setPosition(t){this.set(pl,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(pl))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[xt(n),vt(n)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!le(i,r)){const n=r[0]-i[0],o=i[2]-r[2],a=r[1]-i[1],l=i[3]-r[3],h=[0,0];if(n<0?h[0]=n-s:o<0&&(h[0]=Math.abs(o)+s),a<0?h[1]=a-s:l<0&&(h[1]=Math.abs(l)+s),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const r=[n[0]+h[0],n[1]+h[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(ml,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${o}) translate(${Math.round(t[0]+n[0])+"px"}, ${Math.round(t[1]+n[1])+"px"})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}};var yl=class{constructor(t){this.highWaterMark=void 0!==t?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 Ft(void 0!==i,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 Ft(void 0!==e,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,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.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){Ft(!(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}};function xl(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function vl(t,e,i){return t+"/"+e+"/"+i}function Sl(t){return vl(t[0],t[1],t[2])}function wl(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return vl(e,i,n)}function Tl(t){return t.split("/").map(Number)}function El(t){return(t[1]<i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}var Rl=class extends yl{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=Tl(this.peekFirstKey())[0];this.forEach((e=>{e.tileCoord[0]!==t&&(this.remove(Sl(e.tileCoord)),e.release())}))}};class bl{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.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Pl(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new bl(t,e,i,n)}var Il=bl;const Ll=[];var Fl=class extends ot{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=X(t);return e in this.context_||(this.context_[e]=_t(1,1,Ll)),this.context_[e]}hasContext(t){return X(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=X(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];yt(e),Ll.push(e.canvas),delete this.context_[t]}super.release()}};var Ml=class extends ot{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==$&&(this.setState(J),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(tt)}setFeatures(t){this.features_=t,this.setState(Q)}setLoader(t){this.loader_=t}};function Al(t){return Array.isArray(t)?ps(t):t}let Ol,Nl=!1;function Dl(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=Nl,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=a.responseText:"xml"==t?(n=a.responseXML,n||(n=(new DOMParser).parseFromString(a.responseText,"application/xml"))):"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}else o()},a.onerror=o,a.send()}function Gl(t,e){return function(i,n,r,s,o){const a=this;Dl(t,e,i,n,r,(function(t,e){a.addFeatures(t),void 0!==s&&s(t)}),o||m)}}function kl(t,e){return[[-1/0,-1/0,1/0,1/0]]}function jl(t,e,i,n){const r=document.createElement("script"),s="olc_"+X(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+s;const a=setTimeout((function(){o(),i&&i()}),1e4);window[s]=function(t){clearTimeout(a),o(),e(t)},document.head.appendChild(r)}class Bl extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class zl extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Ul(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new Bl(n))})),n.addEventListener("error",(function(t){i(new zl(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function Xl(t,e){return e.includes("://")?e:new URL(e,t).href}var Vl=class{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 Wl=class extends Vl{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Ci(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Ln(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;tt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:eo,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:io,strokeStyle:Al(t||no)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);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 s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Al(t||Js)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Qs,lineDash:n||to,lineDashOffset:r||0,lineJoin:void 0!==s?s:eo,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:io,strokeStyle:Al(t||no)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:$s,textAlign:void 0!==c?c:ro,textBaseline:void 0!==u?u:so},this.text_=void 0!==h?Array.isArray(h)?h.reduce(((t,e,i)=>t+(i%2?" ":e)),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}};const Zl={Point:function(t,e,i,n,r){const s=i.getImage(),o=i.getText();let a;if(s){if(s.getImageState()!=ts)return;let l=t;if(r){const h=s.getDeclutterMode();if("none"!==h)if(l=r,"obstacle"===h){const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(s,a),r.drawPoint(e,n)}else o&&o.getText()&&(a={})}const h=l.getBuilder(i.getZIndex(),"Image");h.setImageStyle(s,a),h.drawPoint(e,n)}if(o&&o.getText()){let s=t;r&&(s=r);const l=s.getBuilder(i.getZIndex(),"Text");l.setTextStyle(o,a),l.drawText(e,n)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const r=t.getBuilder(i.getZIndex(),"LineString");r.setFillStrokeStyle(null,s),r.drawLineString(e,n)}const o=i.getText();if(o&&o.getText()){const s=(r||t).getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const r=t.getBuilder(i.getZIndex(),"Polygon");r.setFillStrokeStyle(s,o),r.drawPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const s=(r||t).getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}},MultiPoint:function(t,e,i,n,r){const s=i.getImage(),o=i.getText();let a;if(s){if(s.getImageState()!=ts)return;let l=t;if(r){const h=s.getDeclutterMode();if("none"!==h)if(l=r,"obstacle"===h){const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(s,a),r.drawMultiPoint(e,n)}else o&&o.getText()&&(a={})}const h=l.getBuilder(i.getZIndex(),"Image");h.setImageStyle(s,a),h.drawMultiPoint(e,n)}if(o&&o.getText()){let s=t;r&&(s=r);const l=s.getBuilder(i.getZIndex(),"Text");l.setTextStyle(o,a),l.drawText(e,n)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const r=t.getBuilder(i.getZIndex(),"LineString");r.setFillStrokeStyle(null,s),r.drawMultiLineString(e,n)}const o=i.getText();if(o&&o.getText()){const s=(r||t).getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const r=t.getBuilder(i.getZIndex(),"Polygon");r.setFillStrokeStyle(s,o),r.drawMultiPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const s=(r||t).getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}},GeometryCollection:function(t,e,i,n,r){const s=e.getGeometriesArray();let o,a;for(o=0,a=s.length;o2||Math.abs(t[4*e+3]-191.25)>2}function nh(t,e,i,n){const r=_n(i,e,t);let s=ln(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||ae(l,r)){const e=ln(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function rh(t,e,i,n){const r=Pe(i);let s=nh(t,e,r,n);return(!isFinite(s)||s<=0)&&Ee(i,(function(i){return s=nh(t,e,i,n),isFinite(s)&&s>0})),s}function sh(t,e,i,n,r,s,o,a,l,h,c,u){const d=_t(Math.round(i*t),Math.round(i*e),th);if(u||(d.imageSmoothingEnabled=!1),0===l.length)return d.canvas;function g(t){return Math.round(t*i)/i}d.scale(i,i),d.globalCompositeOperation="lighter";const f=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){ye(f,t.extent)}));const p=De(f),m=Me(f),_=_t(Math.round(i*p/n),Math.round(i*m/n),th);u||(_.imageSmoothingEnabled=!1);const y=i/n;l.forEach((function(t,e,i){const n=t.extent[0]-f[0],r=-(t.extent[3]-f[3]),s=De(t.extent),o=Me(t.extent);t.image.width>0&&t.image.height>0&&_.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*y,r*y,s*y,o*y)}));const x=Oe(o);return a.getTriangles().forEach((function(t,e,r){const o=t.source,a=t.target;let l=o[0][0],h=o[0][1],c=o[1][0],p=o[1][1],m=o[2][0],y=o[2][1];const v=g((a[0][0]-x[0])/s),S=g(-(a[0][1]-x[1])/s),w=g((a[1][0]-x[0])/s),T=g(-(a[1][1]-x[1])/s),E=g((a[2][0]-x[0])/s),C=g(-(a[2][1]-x[1])/s),R=l,b=h;l=0,h=0,c-=R,p-=b,m-=R,y-=b;const P=vi([[c,p,0,0,w-v],[m,y,0,0,E-v],[0,0,c,p,T-S],[0,0,m,y,C-S]]);if(P){if(d.save(),d.beginPath(),function(){if(void 0===Ql){const t=_t(6,6,th);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",eh(t,4,5,4,0),eh(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ql=ih(e,0)||ih(e,4)||ih(e,8),yt(t),th.push(t.canvas)}return Ql}()||!u){d.moveTo(w,T);const t=4,e=v-w,i=S-T;for(let n=0;n{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&c<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=De(ne([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Ge(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;if(d){s=(Ti(r[0],u)+Ti(o[0],u))/2-Ti(n[0],u)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];g=s*s+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,r,s,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,r,c,d,a,l-1),this.addQuad_(h,e,i,u,c,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&f)&&this.addTriangle_(t,i,n,r,o,a),0==(14&f)&&this.addTriangle_(t,i,e,r,o,s),f&&(0==(13&f)&&this.addTriangle_(e,n,t,s,a,r),0==(7&f)&&this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const r=e.source;xe(t,r[0]),xe(t,r[1]),xe(t,r[2])})),t}getTriangles(){return this.triangles_}};var lh=class extends ot{constructor(t,e,i,n,r,s,o,a,l,h,c,u){super(r,$,{interpolate:!!u}),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const p=g?Ae(d,g):d;if(0===Ce(p))return void(this.state=et);const m=t.getExtent();m&&(f=f?Ae(f,m):m);const _=n.getResolution(this.wrappedTileCoord_[0]),y=rh(t,i,p,_);if(!isFinite(y)||y<=0)return void(this.state=et);const x=void 0!==h?h:oh;if(this.triangulation_=new ah(t,i,p,f,y*x,_),0===this.triangulation_.getTriangles().length)return void(this.state=et);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=_i(v[1],f[1],f[3]),v[3]=_i(v[3],f[1],f[3])):v=Ae(v,f)),Ce(v)){const t=e.getTileRangeForExtentAndZ(v,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=l(this.sourceZ_,e,i,o);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=et)}else this.state=et}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==Q&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=tt;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sh(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=Q}this.changed()}load(){if(this.state==$){this.state=J,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==$||i==J){t++;const i=N(e,w,(function(n){const r=e.getState();r!=Q&&r!=tt&&r!=et||(G(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){t.getState()==$&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(G),this.sourcesListenerKeys_=null}release(){this.canvas_&&(yt(this.canvas_.getContext("2d")),th.push(this.canvas_),this.canvas_=null),super.release()}},hh="tileloadstart",ch="tileloadend",uh="tileloaderror";function dh(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var gh=class extends W{constructor(t){super(),this.projection=an(t.projection),this.attributions_=dh(t.attributions),this.attributionsCollapsible_=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=dh(t),this.changed()}setState(t){this.state_=t,this.changed()}};const fh=[0,0,0];var ph=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Ft(g(this.resolutions_,(function(t,e){return e-t}),!0),17),!t.origins)for(let t=0,i=this.resolutions_.length-1;t=this.minZoom;){if(2===this.zoomFactor_?(s=Math.floor(s/2),o=Math.floor(o/2),r=Pl(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}};function Ch(t,e){const i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){const t=o[0],i=e.getFullTileRange(t);Ft(i,55);return(i.getHeight()-o[2]-1).toString()}))}}function Rh(t,e){const i=t.length,n=new Array(i);for(let r=0;rthis.getTileInternal(t,e,i,n,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return f.key=c,l?(f.interimTile=l,f.refreshInterimChain(),o.replace(h,f)):o.set(h,f),f}getTileInternal(t,e,i,n,r){let s=null;const o=vl(t,e,i),a=this.getKey();if(this.tileCache.containsKey(o)){if(s=this.tileCache.get(o),s.key!=a){const l=s;s=this.createTile_(t,e,i,n,r,a),l.getState()==$?s.interimTile=l.interimTile:s.interimTile=l,s.refreshInterimChain(),this.tileCache.replace(o,s)}}else s=this.createTile_(t,e,i,n,r,a),this.tileCache.set(o,s);return s}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=an(t);if(i){const t=X(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}};function Oh(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}var Nh=class extends Ah{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:an("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet;jl("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=wh(this.getProjection()),r=this.hidpi_?2:1,s=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],o=xh({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:s});this.tileGrid=o;const a=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=bh(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",a);return function(t,e,r){if(!t)return;xl(t[0],t[1],t[2],i);let s=n;return l&&(s+="&dpi=d1&device=mobile"),s.replace("{quadkey}",Oh(i))}}))),e.imageryProviders){const t=pn(an("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],r=i.viewState,s=this.getTileGrid(),o=s.getZForResolution(r.resolution,this.zDirection),a=s.getTileCoordForCoordAndZ(r.center,o)[0];return e.imageryProviders.map((function(e){let r=!1;const s=e.coverageAreas;for(let e=0,n=s.length;e=n.zoomMin&&a<=n.zoomMax){const e=n.bbox;if(Ge(Ue([e[1],e[0],e[3],e[2]],t),i.extent)){r=!0;break}}}r&&n.push(e.attribution)})),n.push('Terms of Use'),n}))}this.setState("ready")}};var Dh=class extends Ah{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:xh({extent:wh(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:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}};var Gh=class extends Dh{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.account_=t.account,this.mapId_=t.map||"",this.config_=t.config||{},this.templateCache_={},this.initializeMap_()}getConfig(){return this.config_}updateConfig(t){Object.assign(this.config_,t),this.initializeMap_()}setConfig(t){this.config_=t||{},this.initializeMap_()}initializeMap_(){const t=JSON.stringify(this.config_);if(this.templateCache_[t])return void this.applyTemplate_(this.templateCache_[t]);let e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);const i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}handleInitResponse_(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch(t){return void this.setState("error")}this.applyTemplate_(e),this.templateCache_[t]=e,this.setState("ready")}else this.setState("error")}handleInitError_(t){this.setState("error")}applyTemplate_(t){const e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}};function kh(t,e,i,n,r){jh(t,e,i||0,n||t.length-1,r||zh)}function jh(t,e,i,n,r){for(;n>i;){if(n-i>600){var s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);jh(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}var c=t[e],u=i,d=n;for(Bh(t,i,e),r(t[n],c)>0&&Bh(t,i,n);u0;)d--}0===r(t[i],c)?Bh(t,i,d):Bh(t,++d,n),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function Bh(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function zh(t,e){return te?1:0}class Uh{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Qh(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=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 s=this._chooseSplitIndex(i,r,n),o=tc(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Vh(i,this.toBBox),Vh(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=tc([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Vh(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Wh(t,0,o,this.toBBox),a=Wh(t,o,i,this.toBBox),l=$h(e,a),h=qh(e)+qh(a);l=e;n--){const e=t.children[n];Zh(o,t.leaf?r(e):e),a+=Hh(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Zh(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Vh(t[i],this.toBBox)}}function Xh(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function tc(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ec(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;kh(t,o,e,i,r),s.push(e,o,o,i)}}var ic=class{constructor(t){this.rbush_=new Uh(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_[X(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(Y,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(G)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new cc(sc);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(i){if(i.getGeometry().intersectsCoordinate(t))return e(i)}))}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 t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),v(this.nullGeometryFeatures_)||u(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=Ve(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||f,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new cc(lc,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new cc(hc))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if(me(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=X(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=X(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(G),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new cc(oc,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){Ft(this.format_,7),this.url_=t,this.setLoader(Gl(t,this.format_))}};var dc=class extends uc{constructor(t){super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return Ft("Point"==e.getType(),10),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(w,this.boundRefresh_),this.source=t,t&&t.addEventListener(w,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let r=0,s=i.length;r=0;--e){const n=this.geometryFunction(t[e]);n?Fi(i,n.getCoordinates()):t.splice(e,1)}ki(i,1/t.length);const n=Pe(e),r=this.interpolationRatio,s=new dr([i[0]*(1-r)+n[0]*r,i[1]*(1-r)+n[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(s,t):new Ot({geometry:s,features:t})}};var gc=class extends Lt{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8Array(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),i=this.targetTileGrid_.getExtent();let n=this.sourceTileGrid_.getExtent();const r=i?Ae(e,i):e;if(0===Ce(r))return void(this.state=et);const s=t.sourceProj,o=s.getExtent();o&&(n=n?Ae(n,o):o);const a=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),l=t.targetProj,h=rh(s,l,r,a);if(!isFinite(h)||h<=0)return void(this.state=et);const c=void 0!==t.errorThreshold?t.errorThreshold:oh;if(this.triangulation_=new ah(s,l,r,n,h*c,a),0===this.triangulation_.getTriangles().length)return void(this.state=et);this.sourceZ_=this.sourceTileGrid_.getZForResolution(h);let u=this.triangulation_.calculateSourceExtent();if(n&&(s.canWrapX()?(u[1]=_i(u[1],n[1],n[3]),u[3]=_i(u[3],n[1],n[3])):u=Ae(u,n)),Ce(u)){const e=this.sourceTileGrid_.getTileRangeForExtentAndZ(u,this.sourceZ_),i=t.getTileFunction;for(let t=e.minX;t<=e.maxX;t++)for(let n=e.minY;n<=e.maxY;n++){const e=i(this.sourceZ_,t,n,this.pixelRatio_);e&&this.sourceTiles_.push(e)}0===this.sourceTiles_.length&&(this.state=et)}else this.state=et}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{if(!e||e.getState()!==Q)return;const i=e.getSize(),n=this.gutter_;let r;const s=Rt(e.getData());r=s||Pt(Ct(e.getData()));const o=[i[0]+2*n,i[1]+2*n],a=r instanceof Float32Array,l=o[0]*o[1],h=a?Float32Array:Uint8Array,c=new h(r.buffer),u=h.BYTES_PER_ELEMENT,d=u*c.length/l,g=c.byteLength/o[1],f=Math.floor(g/u/o[0]),p=l*f;let m=c;if(c.length!==p){m=new h(p);let t=0,e=0;const i=o[0]*f;for(let n=0;n=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==$&&i!==J)return;t++;const n=N(e,w,(function(){const i=e.getState();i!=Q&&i!=tt&&i!=et||(G(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t){t.getState()==$&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(G),this.sourcesListenerKeys_=null}};var fc=class extends Eh{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=xh({extent:wh(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,opaque:t.opaque,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?ll(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.tileCacheForProjection_={}}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?ll(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return!e||fn(e,t)?this.gutter_:0}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r){const s=this.getTileCacheForProjection(n),o=vl(t,e,i);if(s.containsKey(o)){const t=s.get(o);if(t&&t.key==this.getKey())return t}const a=this.getTileGrid(),l=Math.max.apply(null,a.getResolutions().map(((t,e)=>{const i=ll(a.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),h=this.getTileGridForProjection(r),c=this.getTileGridForProjection(n),u=[t,e,i],d=this.getTileCoordForTileUrlFunction(u,n),g=Object.assign({sourceProj:r,sourceTileGrid:h,targetProj:n,targetTileGrid:c,tileCoord:u,wrappedTileCoord:d,pixelRatio:l,gutter:this.getGutterForProjection(r),getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,r)},this.tileOptions),f=new gc(g);return f.key=this.getKey(),f}getTile(t,e,i,n,r){const s=this.getProjection();if(s&&r&&!fn(s,r))return this.getReprojTile_(t,e,i,r,s);const o=this.getTileSize(t),a=vl(t,e,i);if(this.tileCache.containsKey(a))return this.tileCache.get(a);const l=this.loader_;const h=Object.assign({tileCoord:[t,e,i],loader:function(){return y((function(){return l(t,e,i)}))},size:o},this.tileOptions),c=new Lt(h);return c.key=this.getKey(),c.addEventListener(w,this.handleTileChange_),this.tileCache.set(a,c),c}handleTileChange_(t){const e=t.target,i=X(e),n=e.getState();let r;n==J?(this.tileLoadingKeys_[i]=!0,r=hh):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==tt?uh:n==Q?ch:void 0),r&&this.dispatchEvent(new Th(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||fn(e,t)))return this.tileGrid;const i=X(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=mh(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=an(t);if(i){const t=X(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}getTileCacheForProjection(t){const e=this.getProjection();if(!e||fn(e,t))return this.tileCache;const i=X(t);return i in this.tileCacheForProjection_||(this.tileCacheForProjection_[i]=new Rl(.1)),this.tileCacheForProjection_[i]}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection_){const n=this.tileCacheForProjection_[t];n.expireCache(n==i?e:{})}}clear(){super.clear();for(const t in this.tileCacheForProjection_)this.tileCacheForProjection_[t].clear()}};function pc(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.PhotometricInterpretation,n=GeoTIFF.globals.photometricInterpretations;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const mc="STATISTICS_MAXIMUM",_c="STATISTICS_MINIMUM";let yc;function xc(t){try{return t.getBoundingBox()}catch(e){const i=t.fileDirectory;return[0,0,i.ImageWidth,i.ImageLength]}}function vc(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function Sc(t,e){try{return t.getResolution(e)}catch(i){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function wc(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=an(t);if(!i){const n=Ze(e.ProjLinearUnitsGeoKey);n&&(i=new Ke({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=an(t);if(!i){const n=Ze(e.GeogAngularUnitsGeoKey);n&&(i=new Ke({code:t,units:n}))}return i}return null}function Tc(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;ni*t)throw new Error(n)}function Rc(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class bc extends fc{constructor(t){super({state:"loading",tileGrid:null,projection:null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t=0;--t){const i=wc(e[t]);if(i){this.projection=i;break}}}configure_(t){let e,i,n,r,s;const o=new Array(t.length),a=new Array(t.length),l=new Array(t.length);let h=0;const c=t.length;for(let u=0;u{4==(4&(t.fileDirectory.NewSubfileType||0))?d.push(t):c.push(t)}));const g=c.length;if(d.length>0&&d.length!==g)throw new Error(`Expected one mask per image found ${d.length} masks and ${g} images`);let f,p;const m=new Array(g),_=new Array(g),y=new Array(g);a[u]=new Array(g),l[u]=new Array(g);for(let t=0;ty.length&&(h=s.length-y.length);const t=s[s.length-1]/y[y.length-1];this.resolutionFactors_[u]=t;const e=y.map((e=>e*t)),i=`Resolution mismatch for source ${u}, got [${e}] but expected [${s}]`;Cc(s.slice(h,s.length),e,.02,i,this.viewRejector)}else s=y,this.resolutionFactors_[u]=1;n?Cc(n.slice(h,n.length),_,.01,`Tile size mismatch for source ${u}`,this.viewRejector):n=_,r?Cc(r.slice(h,r.length),m,0,`Tile size mismatch for source ${u}`,this.viewRejector):r=m,this.sourceImagery_[u]=c.reverse(),this.sourceMasks_[u]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;tl||s>l;)o.push([Math.ceil(r/l),Math.ceil(s/l)]),l+=l;break;case"truncated":let t=r,e=s;for(;t>l||e>l;)o.push([Math.ceil(t/l),Math.ceil(e/l)]),t>>=1,e>>=1;break;default:Ft(!1,53)}o.push([1,1]),o.reverse();const h=[n],c=[0];for(let t=1,e=o.length;t{f=a,this.changed()})),y.src=_}};const Fc="version1",Mc="version2",Ac="version3",Oc={};Oc[Fc]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},Oc[Mc]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},Oc[Ac]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},Oc.none={none:{supports:[],formats:[],qualities:[]}};const Nc=/^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/,Dc=/^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/,Gc=/(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/;const kc={};kc[Fc]=function(t){let e=t.getComplianceLevelSupportedFeatures();return void 0===e&&(e=Oc[Fc].level0),{url:void 0===t.imageInfo["@id"]?void 0:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),supports:e.supports,formats:[...e.formats,void 0===t.imageInfo.formats?[]:t.imageInfo.formats],qualities:[...e.qualities,void 0===t.imageInfo.qualities?[]:t.imageInfo.qualities],resolutions:t.imageInfo.scale_factors,tileSize:void 0!==t.imageInfo.tile_width?void 0!==t.imageInfo.tile_height?[t.imageInfo.tile_width,t.imageInfo.tile_height]:[t.imageInfo.tile_width,t.imageInfo.tile_width]:null!=t.imageInfo.tile_height?[t.imageInfo.tile_height,t.imageInfo.tile_height]:void 0}},kc[Mc]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=Array.isArray(t.imageInfo.profile)&&t.imageInfo.profile.length>1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],r=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],s=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...r],qualities:[...e.qualities,...s]}},kc[Ac]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};var jc=class{constructor(t){this.setImageInfo(t)}setImageInfo(t){this.imageInfo="string"==typeof t?JSON.parse(t):t}getImageApiVersion(){if(void 0===this.imageInfo)return;let t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(let e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&Dc.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}getComplianceLevelFromProfile(t){const e=this.getComplianceLevelEntryFromProfile(t);if(void 0===e)return;const i=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(void 0===this.imageInfo)return;const t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Oc.none.none:Oc[t][e]}getTileSourceOptions(t){const e=t||{},i=this.getImageApiVersion();if(void 0===i)return;const n=void 0===i?void 0:kc[i](this);return void 0!==n?{url:n.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}:void 0}};function Bc(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var zc=class extends Ah{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||Mc,r=e.sizes||[],s=e.size;Ft(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);const o=s[0],a=s[1],l=e.tileSize,h=e.tilePixelRatio||1,c=e.format||"jpg",u=e.quality||(e.version==Fc?"native":"default");let d=e.resolutions||[];const g=e.supports||[],f=e.extent||[0,-a,o,0],p=null!=r&&Array.isArray(r)&&r.length>0,m=void 0!==l&&("number"==typeof l&&Number.isInteger(l)&&l>0||Array.isArray(l)&&l.length>0),_=null!=g&&Array.isArray(g)&&(g.includes("regionByPx")||g.includes("regionByPct"))&&(g.includes("sizeByWh")||g.includes("sizeByH")||g.includes("sizeByW")||g.includes("sizeByPct"));let y,x,v;if(d.sort((function(t,e){return e-t})),m||_)if(null!=l&&("number"==typeof l&&Number.isInteger(l)&&l>0?(y=l,x=l):Array.isArray(l)&&l.length>0&&((1==l.length||null==l[1]&&Number.isInteger(l[0]))&&(y=l[0],x=l[0]),2==l.length&&(Number.isInteger(l[0])&&Number.isInteger(l[1])?(y=l[0],x=l[1]):null==l[0]&&Number.isInteger(l[1])&&(y=l[1],x=l[1])))),void 0!==y&&void 0!==x||(y=Ko,x=Ko),0==d.length){v=Math.max(Math.ceil(Math.log(o/y)/Math.LN2),Math.ceil(Math.log(a/x)/Math.LN2));for(let t=v;t>=0;t--)d.push(Math.pow(2,t))}else{const t=Math.max(...d);v=Math.round(Math.log(t)/Math.LN2)}else if(y=o,x=a,d=[],p){r.sort((function(t,e){return t[0]-e[0]})),v=-1;const t=[];for(let e=0;e0&&d[d.length-1]==i?t.push(e):(d.push(i),v++)}if(t.length>0)for(let e=0;ev)return;const S=t[1],w=t[2],T=d[f];if(!(void 0===S||void 0===w||void 0===T||S<0||Math.ceil(o/T/y)<=S||w<0||Math.ceil(a/T/x)<=w)){if(_||m){const t=S*y*T,e=w*x*T;let i=y*T,r=x*T,s=y,c=x;if(t+i>o&&(i=o-t),e+r>a&&(r=a-e),t+y*T>o&&(s=Math.floor((o-t+T-1)/T)),e+x*T>a&&(c=Math.floor((a-e+T-1)/T)),0==t&&i==o&&0==e&&r==a)l="full";else if(!_||g.includes("regionByPx"))l=t+","+e+","+i+","+r;else if(g.includes("regionByPct")){l="pct:"+Bc(t/o*100)+","+Bc(e/a*100)+","+Bc(i/o*100)+","+Bc(r/a*100)}n!=Ac||_&&!g.includes("sizeByWh")?!_||g.includes("sizeByW")?h=s+",":g.includes("sizeByH")?h=","+c:g.includes("sizeByWh")?h=s+","+c:g.includes("sizeByPct")&&(h="pct:"+Bc(100/T)):h=s+","+c}else if(l="full",p){const t=r[f][0],e=r[f][1];h=n==Ac?t==o&&e==a?"max":t+","+e:t==o?"full":t+","}else h=n==Ac?"max":"full";return i+l+"/"+h+"/0/"+u+"."+c}},transition:e.transition}),this.zDirection=e.zDirection}};var Uc=class extends $r{constructor(t,e,i,n,r,s,o){const a=t.getExtent(),l=e.getExtent(),h=l?Ae(i,l):i,c=nh(t,e,Pe(h),n),u=new ah(t,e,h,a,.5*c,n),d=s(u.calculateSourceExtent(),c,r),g=d?Jr:is,f=d?d.getPixelRatio():1;super(i,n,f,g),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=u,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=d,this.sourcePixelRatio_=f,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Qr&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==ts){const t=De(this.targetExtent_)/this.targetResolution_,e=Me(this.targetExtent_)/this.targetResolution_;this.canvas_=sh(t,e,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==Jr){this.state=Qr,this.changed();const t=this.sourceImage_.getState();t==ts||t==es?this.reproject_():(this.sourceListenerKey_=N(this.sourceImage_,w,(function(t){const e=this.sourceImage_.getState();e!=ts&&e!=es||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}}unlistenSource_(){G(this.sourceListenerKey_),this.sourceListenerKey_=null}};const Xc="imageloadstart",Vc="imageloadend",Wc="imageloaderror";class Zc extends r{constructor(t,e){super(t),this.image=e}}function Yc(t,e){t.getImage().src=e}var Kc=class extends gh{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){t=e[h(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||fn(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&fn(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&me(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Uc(r,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){return z()}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Qr:this.loading=!0,i=Xc;break;case ts:this.loading=!1,i=Vc;break;case es:this.loading=!1,i=Wc;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Zc(i,e))}};function qc(t,e){const i=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))}));const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}var Hc=class extends Kc{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.hidpi_=void 0===t.hidpi||t.hidpi,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:Yc,this.params_=t.params||{},this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getParams(){return this.params_}getImageInternal(t,e,i,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),i=this.hidpi_?i:1;const r=this.image_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&le(r.getExtent(),t))return r;const s={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(s,this.params_);const o=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){const e=this.ratio_*De(t)/2,i=this.ratio_*Me(t)/2;t[0]=o-e,t[1]=a-i,t[2]=o+e,t[3]=a+i}const l=e/i,h=Math.ceil(De(t)/l),c=Math.ceil(Me(t)/l);t[0]=o-l*h/2,t[2]=o+l*h/2,t[1]=a-l*c/2,t[3]=a+l*c/2,this.imageSize_[0]=h,this.imageSize_[1]=c;const u=this.getRequestUrl_(t,this.imageSize_,i,n,s);return this.image_=new rs(t,e,i,u,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(w,this.handleImageChange.bind(this)),this.image_}getImageLoadFunction(){return this.imageLoadFunction_}getRequestUrl_(t,e,i,n,r){const s=n.getCode().split(/:(?=\d+$)/).pop();r.SIZE=e[0]+","+e[1],r.BBOX=t.join(","),r.BBOXSR=s,r.IMAGESR=s,r.DPI=Math.round(90*i);const o=this.url_,a=o.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==o&&Ft(!1,50),qc(a,r)}getUrl(){return this.url_}setImageLoadFunction(t){this.image_=null,this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.image_=null,this.changed()}};var $c=class extends Kc{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&le(r.getExtent(),t))return r;Be(t=t.slice(),this.ratio_);const s=[De(t)/e*i,Me(t)/e*i],o=this.canvasFunction_.call(this,t,e,i,s,n);return o&&(r=new ss(t,e,i,o)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}};var Jc=class extends Kc{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.displayDpi_=void 0!==t.displayDpi?t.displayDpi:96,this.params_=t.params||{},this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:Yc,this.hidpi_=void 0===t.hidpi||t.hidpi,this.metersPerUnit_=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.ratio_=void 0!==t.ratio?t.ratio:1,this.useOverlay_=void 0!==t.useOverlay&&t.useOverlay,this.image_=null,this.renderedRevision_=0}getParams(){return this.params_}getImageInternal(t,e,i,n){e=this.findNearestResolution(e),i=this.hidpi_?i:1;let r=this.image_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&le(r.getExtent(),t))return r;1!=this.ratio_&&Be(t=t.slice(),this.ratio_);const s=[De(t)/e*i,Me(t)/e*i];if(void 0!==this.url_){const o=this.getUrl(this.url_,this.params_,t,s,n);r=new rs(t,e,i,o,this.crossOrigin_,this.imageLoadFunction_),r.addEventListener(w,this.handleImageChange.bind(this))}else r=null;return this.image_=r,this.renderedRevision_=this.getRevision(),r}getImageLoadFunction(){return this.imageLoadFunction_}updateParams(t){Object.assign(this.params_,t),this.changed()}getUrl(t,e,i,n,r){const s=function(t,e,i,n){const r=De(t),s=Me(t),o=e[0],a=e[1],l=.0254/n;if(a*r>o*s)return r*i/(o*l);return s*i/(a*l)}(i,n,this.metersPerUnit_,this.displayDpi_),o=Pe(i),a={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:s,SETVIEWCENTERX:o[0],SETVIEWCENTERY:o[1]};return Object.assign(a,e),qc(t,a)}setImageLoadFunction(t){this.image_=null,this.imageLoadFunction_=t,this.changed()}};var Qc=class extends Kc{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:Yc;super({attributions:t.attributions,interpolate:t.interpolate,projection:an(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new rs(this.imageExtent_,void 0,1,this.url_,e,i),this.imageSize_=t.imageSize?t.imageSize:null,this.image_.addEventListener(w,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return Ge(t,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(t){if(this.image_.getState()==ts){const t=this.image_.getExtent(),e=this.image_.getImage();let i,n;this.imageSize_?(i=this.imageSize_[0],n=this.imageSize_[1]):(i=e.width,n=e.height);const r=De(t),s=Me(t),o=r/i,a=s/n;let l=i,h=n;if(o>a?l=Math.round(r/a):h=Math.round(s/o),l!==i||h!==n){const t=_t(l,h);this.getInterpolate()||(t.imageSmoothingEnabled=!1);const r=t.canvas;t.drawImage(e,0,0,i,n,0,0,r.width,r.height),this.image_.setImage(r)}}super.handleImageChange(t)}};const tu="1.3.0",eu=[101,101];var iu=class extends Kc{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:Yc,this.params_=Object.assign({},t.params),this.v13_=!0,this.updateV13_(),this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getFeatureInfoUrl(t,e,i,n){if(void 0===this.url_)return;const r=an(i),s=this.getProjection();s&&s!==r&&(e=nh(s,r,t,e),t=_n(t,r,s));const o=Le(t,e,0,eu),a={SERVICE:"WMS",VERSION:tu,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(a,this.params_,n);const l=bi((t[0]-o[0])/e,4),h=bi((o[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=h,this.getRequestUrl_(o,eu,1,s||r,a)}getLegendUrl(t,e){if(void 0===this.url_)return;const i={SERVICE:"WMS",VERSION:tu,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),qc(this.url_,i)}getParams(){return this.params_}getImageInternal(t,e,i,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==i||this.hidpi_&&void 0!==this.serverType_||(i=1);const r=e/i,s=Pe(t),o=Le(s,r,0,[Pi(De(t)/r,4),Pi(Me(t)/r,4)]),a=Le(s,r,0,[Pi(this.ratio_*De(t)/r,4),Pi(this.ratio_*Me(t)/r,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==i&&le(l.getExtent(),o))return l;const h={SERVICE:"WMS",VERSION:tu,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Object.assign(h,this.params_),this.imageSize_[0]=Ri(De(a)/r,4),this.imageSize_[1]=Ri(Me(a)/r,4);const c=this.getRequestUrl_(a,this.imageSize_,i,n,h);return this.image_=new rs(a,e,i,c,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(w,this.handleImageChange.bind(this)),this.image_}getImageLoadFunction(){return this.imageLoadFunction_}getRequestUrl_(t,e,i,n,r){if(Ft(void 0!==this.url_,9),r[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(r.STYLES=""),1!=i)switch(this.serverType_){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+t:r.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":r.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":r.DPI=90*i;break;default:Ft(!1,8)}r.WIDTH=e[0],r.HEIGHT=e[1];const s=n.getAxisOrientation();let o;return o=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,r.BBOX=o.join(","),qc(this.url_,r)}getUrl(){return this.url_}setImageLoadFunction(t){this.image_=null,this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.image_=null,this.changed()}updateV13_(){const t=this.params_.VERSION||tu;this.v13_=Li(t,"1.3")>=0}};const nu='© OpenStreetMap contributors.';var ru=class extends Dh{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[nu];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,opaque:void 0===t.opaque||t.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}};var su=class extends ks{constructor(t){super(t=t||{})}};var ou=class extends B{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return z()}getData(t){return null}prepareFrame(t){return z()}renderFrame(t,e){return z()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const s=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,s)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){t.target.getState()===ts&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=ts&&e!=es&&t.addEventListener(w,this.boundHandleImageChange_),e==Jr&&(t.load(),e=t.getState()),e==ts}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}};const au=[];let lu=null;var hu=class extends ou{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;lu||(lu=_t(1,1,void 0,{willReadFrequently:!0})),lu.clearRect(0,0,1,1);try{lu.drawImage(t,e,i,1,1,0,0,1,1),n=lu.getImageData(0,0,1,1).data}catch(t){return lu=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&d(gs(t.style.backgroundColor),gs(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(s=e.getContext("2d"))}if(s&&s.canvas.style.transform===e?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=_t();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Oe(i),r=Ne(i),s=be(i),o=Re(i);zt(e.coordinateToPixelTransform,n),zt(e.coordinateToPixelTransform,r),zt(e.coordinateToPixelTransform,s),zt(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;zt(a,n),zt(a,r),zt(a,s),zt(a,o),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(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new zs(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Ms,t,e)}postRender(t,e){this.dispatchRenderEvent_(As,t,e)}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Zt(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};var cu=class extends hu{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,s=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=Ae(a,Cn(e.extent,n.projection))),!o[Wo]&&!o[Zo]&&!ke(a))if(s){const t=n.projection,e=s.getImage(a,r,i,t);e&&(this.loadImage(e)?this.image_=e:e.getState()===is&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=zt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ae(r,n))return null;const s=this.image_.getExtent(),o=this.image_.getImage(),a=De(s),l=Math.floor(o.width*((n[0]-s[0])/a));if(l<0||l>=o.width)return null;const h=Me(s),c=Math.floor(o.height*((s[3]-n[1])/h));return c<0||c>=o.height?null:this.getImageData(o,l,c)}renderFrame(t,e){const i=this.image_,n=i.getExtent(),r=i.getResolution(),s=i.getPixelRatio(),o=t.layerStatesArray[t.layerIndex],a=t.pixelRatio,l=t.viewState,h=l.center,c=a*r/(l.resolution*s),u=t.extent,d=l.resolution,g=l.rotation,f=Math.round(De(u)/d*a),p=Math.round(Me(u)/d*a);Zt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/a,1/a,g,-f/2,-p/2),Yt(this.inversePixelTransform,this.pixelTransform);const m=Ht(this.pixelTransform);this.useContainer(e,m,this.getBackground(t));const _=this.context,y=_.canvas;y.width!=f||y.height!=p?(y.width=f,y.height=p):this.containerReused||_.clearRect(0,0,f,p);let x=!1,v=!0;if(o.extent){const e=Cn(o.extent,l.projection);v=Ge(e,t.extent),x=v&&!le(e,t.extent),x&&this.clipUnrotated(_,t,e)}const S=i.getImage(),w=Zt(this.tempTransform,f/2,p/2,c,c,0,s*(n[0]-h[0])/r,s*(h[1]-n[3])/r);this.renderedResolution=r*a/s;const T=S.width*w[0],E=S.height*w[3];if(this.getLayer().getSource().getInterpolate()||(_.imageSmoothingEnabled=!1),this.preRender(_,t),v&&T>=.5&&E>=.5){const t=w[4],e=w[5],i=o.opacity;let n;1!==i&&(n=_.globalAlpha,_.globalAlpha=i),_.drawImage(S,0,0,+S.width,+S.height,t,e,T,E),1!==i&&(_.globalAlpha=n)}return this.postRender(_,t),x&&_.restore(),_.imageSmoothingEnabled=!0,m!==y.style.transform&&(y.style.transform=m),this.container}};var uu=class extends su{constructor(t){super(t)}createRenderer(){return new cu(this)}getData(t){return super.getData(t)}},du="preload",gu="useInterimTilesOnError";var fu=class extends ks{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(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(du)}setPreload(t){this.set(du,t)}getUseInterimTilesOnError(){return this.get(gu)}setUseInterimTilesOnError(t){this.set(gu,t)}getData(t){return super.getData(t)}};var pu=class extends hu{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new Il(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==Q||i==et||i==tt&&!n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer();let a=o.getSource().getTile(t,e,i,r,s);return a.getState()==tt&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(a)||(a=a.getInterimTile()),a}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=zt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ae(r,n))return null;const s=e.pixelRatio,o=e.viewState.projection,a=e.viewState,l=i.getRenderSource(),h=l.getTileGridForProjection(a.projection),c=l.getTilePixelRatio(e.pixelRatio);for(let t=h.getZForResolution(a.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=l.getTile(t,e[1],e[2],s,o);if(!(i instanceof os||i instanceof lh)||i instanceof lh&&i.getState()===et)return null;if(i.getState()!==Q)continue;const r=h.getOrigin(t),u=ll(h.getTileSize(t)),d=h.getResolution(t),g=Math.floor(c*((n[0]-r[0])/d-e[1]*u[0])),f=Math.floor(c*((r[1]-n[1])/d-e[2]*u[1])),p=Math.round(c*l.getGutterForProjection(a.projection));return this.getImageData(i.getImage(),g+p,f+p)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),f=g.getZForResolution(s,u.zDirection),p=g.getResolution(f);let m=t.extent;const _=t.viewState.resolution,y=u.getTilePixelRatio(h),x=Math.round(De(m)/_*h),v=Math.round(Me(m)/_*h),S=i.extent&&Cn(i.extent,r);S&&(m=Ae(m,Cn(i.extent,r)));const w=p*x/2/y,T=p*v/2/y,E=[o[0]-w,o[1]-T,o[0]+w,o[1]+T],C=g.getTileRangeForExtentAndZ(m,f),R={};R[f]={};const b=this.createLoadedTileFinder(u,r,R),P=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;const L=a?Fe(n.center,_,a,t.size):void 0;for(let e=C.minX;e<=C.maxX;++e)for(let n=C.minY;n<=C.maxY;++n){if(a&&!g.tileCoordIntersectsViewport([f,e,n],L))continue;const r=this.getTile(f,e,n,t);if(this.isDrawableTile(r)){const e=X(this);if(r.getState()==Q){R[f][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==i.opacity&&(r.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(r)||(this.newTiles_=!0)}if(1===r.getAlpha(e,t.time))continue}const s=g.getTileCoordChildTileRange(r.tileCoord,I,P);let o=!1;s&&(o=b(f+1,s)),o||g.forEachTileCoordParentTileRange(r.tileCoord,b,I,P)}const F=p/s*h/y;Zt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,a,-x/2,-v/2);const M=Ht(this.pixelTransform);this.useContainer(e,M,this.getBackground(t));const A=this.context,O=A.canvas;Yt(this.inversePixelTransform,this.pixelTransform),Zt(this.tempTransform,x/2,v/2,F,F,0,-x/2,-v/2),O.width!=x||O.height!=v?(O.width=x,O.height=v):this.containerReused||A.clearRect(0,0,x,v),S&&this.clipUnrotated(A,t,S),u.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,t),this.renderedTiles.length=0;let N,D,G,k=Object.keys(R).map(Number);k.sort(l),1!==i.opacity||this.containerReused&&!u.getOpaque(t.viewState.projection)?(N=[],D=[]):k=k.reverse();for(let e=k.length-1;e>=0;--e){const i=k[e],n=u.getTilePixelSize(i,h,r),s=g.getResolution(i)/p,o=n[0]*s*F,a=n[1]*s*F,l=g.getTileCoordForCoordAndZ(Oe(E),i),c=g.getTileCoordExtent(l),d=zt(this.tempTransform,[y*(c[0]-E[0])/p,y*(E[3]-c[3])/p]),m=y*u.getGutterForProjection(r),_=R[i];for(const e in _){const n=_[e],r=n.tileCoord,s=l[1]-r[1],h=Math.round(d[0]-(s-1)*o),c=l[2]-r[2],g=Math.round(d[1]-(c-1)*a),p=Math.round(d[0]-s*o),y=Math.round(d[1]-c*a),x=h-p,v=g-y,S=f===i,w=S&&1!==n.getAlpha(X(this),t.time);let T=!1;if(!w)if(N){G=[p,y,p+x,y,p+x,y+v,p,y+v];for(let t=0,e=N.length;tthis._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this._workers.length;if(this._running=r,1===r)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sStamen Design, under CC BY 3.0.',nu],Mu={terrain:{extension:"png",opaque:!0},"terrain-background":{extension:"png",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},Au={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}};var Ou=class extends Dh{constructor(t){const e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),n=Au[i],r=Mu[t.layer],s=void 0!==t.url?t.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+t.layer+"/{z}/{x}/{y}."+r.extension;super({attributions:Fu,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:null!=t.maxZoom?t.maxZoom:n.maxZoom,minZoom:null!=t.minZoom?t.minZoom:n.minZoom,opaque:r.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}};var Nu=class extends Ah{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.params_=t.params||{},this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r,s){const o=this.urls;if(!o)return;const a=r.getCode().split(/:(?=\d+$)/).pop();let l;if(s.SIZE=e[0]+","+e[1],s.BBOX=i.join(","),s.BBOXSR=a,s.IMAGESR=a,s.DPI=Math.round(s.DPI?s.DPI*n:90*n),1==o.length)l=o[0];else{l=o[Ti(El(t),o.length)]}return qc(l.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),s)}getTilePixelRatio(t){return this.hidpi_?t:1}updateParams(t){Object.assign(this.params_,t),this.setKey(this.getKeyForParams_())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_||(e=1);const r=n.getTileCoordExtent(t,this.tmpExtent_);let s=ll(n.getTileSize(t[0]),this.tmpSize);1!=e&&(s=al(s,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.params_),this.getRequestUrl_(t,s,r,e,i,o)}};var Du=class extends Dh{constructor(t){super({opaque:!1,projection:(t=t||{}).projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection,url:t.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,e)=>{const i=t.getTileCoord()[0],n=ll(this.tileGrid.getTileSize(i)),r=_t(n[0],n[1]);r.strokeStyle="grey",r.strokeRect(.5,.5,n[0]+.5,n[1]+.5),r.fillStyle="grey",r.strokeStyle="white",r.textAlign="center",r.textBaseline="middle",r.font="24px sans-serif",r.lineWidth=4,r.strokeText(e,n[0]/2,n[1]/2,n[0]),r.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(r.canvas)}})}};var Gu=class extends Ah{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:an("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)jl(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):Ft(!1,51)}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=an("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=pn(e,i);n=Ue(t.bounds,r)}const r=wh(i),s=t.minzoom||0,o=xh({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=Rh(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return Ge(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}};var ku=class extends Ah{constructor(t){t=t||{};const e=Object.assign({},t.params),i=!("TRANSPARENT"in e)||e.TRANSPARENT;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=an(i),s=this.getProjection();let o=this.getTileGrid();o||(o=this.getTileGridForProjection(r));const a=o.getZForResolution(e,this.zDirection),l=o.getTileCoordForCoordAndZ(t,a);if(o.getResolutions().length<=l[0])return;let h=o.getResolution(l[0]),c=o.getTileCoordExtent(l,this.tmpExtent_),u=ll(o.getTileSize(l[0]),this.tmpSize);const d=this.gutter_;0!==d&&(u=sl(u,d,this.tmpSize),c=re(c,h*d,c)),s&&s!==r&&(h=nh(s,r,t,h),c=yn(c,r,s),t=_n(t,r,s));const g={SERVICE:"WMS",VERSION:tu,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(g,this.params_,n);const f=Math.floor((t[0]-c[0])/h),p=Math.floor((c[3]-t[1])/h);return g[this.v13_?"I":"X"]=f,g[this.v13_?"J":"Y"]=p,this.getRequestUrl_(l,u,c,1,s||r,g)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:tu,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),qc(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r,s){const o=this.urls;if(!o)return;if(s.WIDTH=e[0],s.HEIGHT=e[1],s[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(s.STYLES=""),1!=n)switch(this.serverType_){case"geoserver":const t=90*n+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*n;break;case"carmentaserver":case"qgis":s.DPI=90*n;break;default:Ft(!1,52)}const a=r.getAxisOrientation(),l=i;if(this.v13_&&"ne"==a.substr(0,2)){let t;t=i[0],l[0]=i[1],l[1]=t,t=i[2],l[2]=i[3],l[3]=t}let h;if(s.BBOX=l.join(","),1==o.length)h=o[0];else{h=o[Ti(El(t),o.length)]}return qc(h,s)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||tu;this.v13_=Li(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_),o=ll(n.getTileSize(t[0]),this.tmpSize);const a=this.gutter_;0!==a&&(o=sl(o,a,this.tmpSize),s=re(s,r*a,s)),1!=e&&(o=al(o,e,this.tmpSize));const l={SERVICE:"WMS",VERSION:tu,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(l,this.params_),this.getRequestUrl_(t,o,s,e,i,l)}};class ju extends ot{constructor(t,e,i,n,r,s){super(t,e),this.src_=i,this.extent_=n,this.preemptive_=r,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=s}getImage(){return null}getData(t){if(!this.grid_||!this.keys_)return null;const e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof n)return null;let r=n.charCodeAt(Math.floor(e*n.length));r>=93&&r--,r>=35&&r--,r-=32;let s=null;if(r in this.keys_){const t=this.keys_[r];s=this.data_&&t in this.data_?this.data_[t]:t}return s}forDataAtCoordinate(t,e,i){this.state==et&&!0===i?(this.state=$,D(this,w,(function(i){e(this.getData(t))}),this),this.loadInternal_()):!0===i?setTimeout((()=>{e(this.getData(t))}),0):e(this.getData(t))}getKey(){return this.src_}handleError_(){this.state=tt,this.changed()}handleLoad_(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=Q,this.changed()}loadInternal_(){if(this.state==$)if(this.state=J,this.jsonp_)jl(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(t)}else this.handleError_()}onXHRError_(t){this.handleError_()}load(){this.preemptive_?this.loadInternal_():this.setState(et)}}var Bu=class extends Eh{constructor(t){if(super({projection:an("EPSG:3857"),state:"loading",zDirection:t.zDirection}),this.preemptive_=void 0===t.preemptive||t.preemptive,this.tileUrlFunction_=Ph,this.template_=void 0,this.jsonp_=t.jsonp||!1,t.url)if(this.jsonp_)jl(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):Ft(!1,51)}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTemplate(){return this.template_}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const r=this.tileGrid.getZForResolution(e,this.zDirection),s=this.tileGrid.getTileCoordForCoordAndZ(t,r);this.getTile(s[0],s[1],s[2],1,this.getProjection()).forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=an("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=pn(e,i);n=Ue(t.bounds,r)}const r=wh(i),s=t.minzoom||0,o=xh({extent:r,maxZoom:t.maxzoom||22,minZoom:s});this.tileGrid=o,this.template_=t.template;const a=t.grids;if(a){if(this.tileUrlFunction_=Rh(a,o),void 0!==t.attribution){const e=void 0!==n?n:r;this.setAttributions((function(i){return Ge(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,r){const s=vl(t,e,i);if(this.tileCache.containsKey(s))return this.tileCache.get(s);const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=this.tileUrlFunction_(a,n,r),h=new ju(o,void 0!==l?$:et,void 0!==l?l:"",this.tileGrid.getTileCoordExtent(o),this.preemptive_,this.jsonp_);return this.tileCache.set(s,h),h}useTile(t,e,i){const n=vl(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}};var zu=class extends Fh{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||wh(e),n=t.tileGrid||xh({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Uu,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new Rl(this.tileCache.highWaterMark),this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Ml,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=Tl(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==Q)return;const s=i.getSourceTiles();for(let i=0,n=s.length;i{const n=wl(e),r=i.peek(n);if(r){const e=r.sourceTiles;for(let i=0,n=e.length;i{const r=this.tileUrlFunction(n,t,e),s=this.sourceTileCache.containsKey(r)?this.sourceTileCache.get(r):new this.tileClass(n,r?$:et,r,this.format_,this.tileLoadFunction);i.sourceTiles.push(s);const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===Q||n===tt){const e=s.getKey();e in i.errorTileKeys?s.getState()===Q&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===tt?i.errorTileKeys[e]=!0:s.removeEventListener(w,t),0===i.loadingSourceTiles&&i.setState(v(i.errorTileKeys)?Q:tt)}};s.addEventListener(w,t),i.loadingSourceTiles++}o===$&&(s.extent=l.getTileCoordExtent(n),s.projection=e,s.resolution=l.getResolution(n[0]),this.sourceTileCache.set(r,s),s.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===tt))?tt:Q)}return i.sourceTiles}getTile(t,e,i,n,r){const s=vl(t,e,i),o=this.getKey();let a;if(this.tileCache.containsKey(s)&&(a=this.tileCache.get(s),a.key===o))return a;const l=[t,e,i];let h=this.getTileCoordForTileUrlFunction(l,r);const c=this.getTileGrid().getExtent(),u=this.getTileGridForProjection(r);if(h&&c){const e=u.getTileCoordExtent(h);re(e,-u.getResolution(t),e),Ge(c,e)||(h=null)}let d=!0;if(null!==h){const e=this.tileGrid,i=u.getResolution(t),s=e.getZForResolution(i,1),o=u.getTileCoordExtent(h);re(o,-i,o),e.forEachTileCoord(o,s,(t=>{d=d&&!this.tileUrlFunction(t,n,r)}))}const g=new Fl(l,d?et:$,h,this.getSourceTiles.bind(this,n,r));return g.key=o,a?(g.interimTile=a,g.refreshInterimChain(),this.tileCache.replace(s,g)):this.tileCache.set(s,g),g}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),r=n.map((function(e,i){return t.getOrigin(i)})),s=n.map((function(e,i){return t.getTileSize(i)})),o=43;for(let t=n.length;t0)||i.find((function(i){return e.Identifier==i.TileMatrix||!e.Identifier.includes(":")&&t.Identifier+":"+e.Identifier===i.TileMatrix})),l){r.push(e.Identifier);const t=28e-5*e.ScaleDenominator/h,i=e.TileWidth,l=e.TileHeight;c?s.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):s.push(e.TopLeftCorner),n.push(t),o.push(i==l?i:[i,l]),a.push([e.MatrixWidth,e.MatrixHeight])}})),new Xu({extent:e,origins:s,resolutions:n,matrixIds:r,tileSizes:o,sizes:a})}var Zu=class extends Ah{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=Ih(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=bh(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction(bh(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?qc(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(!i)return;const a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(a,r);let l=t;return l="KVP"==e?qc(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]})),l}}};const Yu=34962,Ku=34963,qu=35044,Hu=35048,$u=5126,Ju=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Qu(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!ct},e);const i=Ju.length;for(let n=0;n{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=X(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),t.renderTargets[e]=!0}}r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const o=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,o),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}};function Ad(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Od(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}const Nd="u_projectionMatrix",Dd="u_offsetScaleMatrix",Gd="u_offsetRotateMatrix",kd="u_time",jd="u_zoom",Bd="u_resolution",zd="u_sizePx",Ud="u_pixelRatio",Xd={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:$u},Vd={};function Wd(t){return"shared/"+t}let Zd=0;function Yd(t){let e=0;for(let i=0;i0)return;const i=Qu(e.canvas).getExtension("WEBGL_lose_context");i&&i.loseContext(),delete Vd[t]}(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(t,e){const i=this.getGL(),n=this.getCanvas(),r=t.size,s=t.pixelRatio;n.width=r[0]*s,n.height=r[1]*s,n.style.width=r[0]+"px",n.style.height=r[1]+"px";for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,e?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(t,e,i){const n=this.getGL(),r=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,r[0],r[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA)}drawElements(t,e){const i=this.getGL();this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}finalizeDraw(t,e,i){for(let n=0,r=this.postProcessPasses_.length;n{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData){r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);(!(i instanceof HTMLImageElement)||i.complete)&&r.prevValue!==i&&(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),e.uniform1i(this.getUniformLocation(r.name),n++)}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,Od(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.getGL().useProgram(t),this.currentProgram_=t,this.uniformLocations_={},this.attribLocations_={},this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.getGL(),n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.getGL(),n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}return s}getUniformLocation(t){return void 0===this.uniformLocations_[t]&&(this.uniformLocations_[t]=this.getGL().getUniformLocation(this.currentProgram_,t)),this.uniformLocations_[t]}getAttributeLocation(t){return void 0===this.attribLocations_[t]&&(this.attribLocations_[t]=this.getGL().getAttribLocation(this.currentProgram_,t)),this.attribLocations_[t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return Gt(e),Zt(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.getGL().uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.getGL().uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.getGL().uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.getGL().uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,i,n,r){const s=this.getAttributeLocation(t);s<0||(this.getGL().enableVertexAttribArray(s),this.getGL().vertexAttribPointer(s,e,i,!1,n,r))}enableAttributes(t){const e=Yd(t);let i=0;for(let n=0;nthis.size_[0]||e>=this.size_[1])return $d[0]=0,$d[1]=0,$d[2]=0,$d[3]=0,$d;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return $d[0]=this.data_[4*i],$d[1]=this.data_[4*i+1],$d[2]=this.data_[4*i+2],$d[3]=this.data_[4*i+3],$d}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)}};function Qd(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function tg(t,e,i,n,r,s){const o=t.getGL();let a,l;if(i instanceof Float32Array){a=o.FLOAT,t.getExtension("OES_texture_float");l=null!==t.getExtension("OES_texture_float_linear")}else a=o.UNSIGNED_BYTE,l=!0;Qd(o,e,s&&l);const h=i.byteLength/n[1];let c,u=1;switch(h%8==0?u=8:h%4==0?u=4:h%2==0&&(u=2),r){case 1:c=o.LUMINANCE;break;case 2:c=o.LUMINANCE_ALPHA;break;case 3:c=o.RGB;break;case 4:c=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,u),o.texImage2D(o.TEXTURE_2D,0,c,n[0],n[1],0,c,a,i),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let eg=null;var ig=class extends S{constructor(t){super(),this.tile,this.textures=[],this.handleTileChange_=this.handleTileChange_.bind(this),this.renderSize_=ll(t.grid.getTileSize(t.tile.tileCoord[0])),this.gutter_=t.gutter||0,this.bandCount=NaN,this.helper_=t.helper;const e=new Id(Yu,qu);e.fromArray([0,1,1,1,1,0,0,0]),this.helper_.flushBufferData(e),this.coords=e,this.setTile(t.tile)}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(w,this.handleTileChange_),this.tile=t,this.textures.length=0,this.loaded=t.getState()===Q,this.loaded)this.uploadTile_();else{if(t instanceof os){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(w,this.handleTileChange_)}}uploadTile_(){const t=this.helper_,e=t.getGL(),i=this.tile;let n;n=i instanceof os||i instanceof lh?i.getImage():i.getData();const r=Ct(n);if(r){const t=e.createTexture();return this.textures.push(t),this.bandCount=4,void function(t,e,i,n){Qd(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}(e,t,r,i.interpolate)}n=Rt(n);const s=i.getSize(),o=[s[0]+2*this.gutter_,s[1]+2*this.gutter_],a=n instanceof Float32Array,l=o[0]*o[1],h=a?Float32Array:Uint8Array,c=h.BYTES_PER_ELEMENT,u=n.byteLength/o[1];this.bandCount=Math.floor(u/c/o[0]);const d=Math.ceil(this.bandCount/4);if(1===d){const r=e.createTexture();return this.textures.push(r),void tg(t,r,n,o,this.bandCount,i.interpolate)}const g=new Array(d);for(let t=0;t=f;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),o=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let g=i.minY;g<=i.maxY;++g){const i=xl(r,e,g,this.tempTileCoord_),f=dg(a,i);let p,m;if(d.containsKey(f)&&(p=d.get(f),m=p.tile),!p||p.tile.key!==a.getKey())if(m=a.getTile(r,e,g,t.pixelRatio,s.projection),p)if(this.isDrawableTile_(m))p.setTile(m);else{const t=m.getInterimTile();p.setTile(t)}else p=new ig({tile:m,grid:l,helper:this.helper,gutter:h}),d.set(f,p);cg(n,p,r);const _=m.getKey();u[_]=!0,m.getState()===$&&(t.tileQueue.isKeyQueued(_)||t.tileQueue.enqueue([m,c,l.getTileCoordCenter(i),o]))}}}renderFrame(t){this.frameState_=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,n=this.getLayer(),r=n.getRenderSource(),s=r.getTileGridForProjection(i.projection),o=r.getGutterForProjection(i.projection),a=ug(t,t.extent),h=s.getZForResolution(i.resolution,r.zDirection),c={},u=n.getPreload();if(t.nextExtent){const e=s.getZForResolution(i.nextResolution,r.zDirection),n=ug(t,t.nextExtent);this.enqueueTiles(t,n,e,c,u)}this.enqueueTiles(t,a,h,c,0),u>0&&setTimeout((()=>{this.enqueueTiles(t,a,h-1,c,u-1)}),0);const d={},g=X(this),f=t.time;let p=!1;const m=c[h];for(let t=0,e=m.length;t=r;--t){if(this.findAltTiles_(s,n,t,c))break}}this.helper.useProgram(this.program_,t),this.helper.prepareDraw(t,!p);const _=Object.keys(c).map(Number).sort(l),y=i.center[0],x=i.center[1];for(let n=0,r=_.length;n0&&(R=s.getTileCoordExtent(c),Ae(R,a,R)),this.helper.setUniformFloatVec4(sg.RENDER_EXTENT,R),this.helper.setUniformFloatValue(sg.RESOLUTION,i.resolution),this.helper.setUniformFloatValue(sg.ZOOM,i.zoom),this.helper.drawElements(0,this.indices_.getSize())}}this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const v=this.helper.getCanvas(),S=this.tileTextureCache_;for(;S.canExpireCache();){S.pop().dispose()}return t.postRenderFunctions.push((function(t,e){r.updateCacheSize(.1,e.viewState.projection),r.expireCache(e.viewState.projection,lg)})),this.postRender(e,t),v}getData(t){if(!this.helper.getGL())return null;const e=this.frameState_;if(!e)return null;const i=this.getLayer(),n=zt(e.pixelToCoordinateTransform,t.slice()),r=e.viewState,s=i.getExtent();if(s&&!ae(Cn(s,r.projection),n))return null;const o=i.getSources(ne([n]),r.resolution);let a,l,h;for(a=o.length-1;a>=0;--a)if(l=o[a],"ready"===l.getState()){if(h=l.getTileGridForProjection(r.projection),l.getWrapX())break;const t=h.getExtent();if(!t||ae(t,n))break}if(a<0)return null;const c=this.tileTextureCache_;for(let t=h.getZForResolution(r.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=dg(l,e);if(!c.containsKey(i))continue;const r=c.get(i),s=r.tile;if((s instanceof lh||s instanceof gc)&&s.getState()===et)return null;if(!r.loaded)continue;const o=h.getOrigin(t),a=ll(h.getTileSize(t)),u=h.getResolution(t),d=(n[0]-o[0])/u-e[1]*a[0],g=(o[1]-n[1])/u-e[2]*a[1];return r.getPixelData(d,g)}return null}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileTextureCache_,a=this.getLayer().getRenderSource();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=dg(a,[i,t,e]);let l=!1;if(o.containsKey(r)){const t=o.get(r);t.loaded&&(cg(n,t,i),l=!0)}l||(s=!1)}return s}clearCache(){const t=this.tileTextureCache_;t.forEach((t=>t.dispose())),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){const t=this.helper;if(t){t.getGL().deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_,delete this.tileTextureCache_,delete this.frameState_}};const fg=1,pg=2,mg=4,_g=8,yg=16,xg=31,vg=0,Sg={};function wg(t){if("number"==typeof t)return fg;if("boolean"==typeof t)return _g;if("string"==typeof t)return ms(t)?mg|pg:pg;if(!Array.isArray(t))throw new Error(`Unhandled value type: ${JSON.stringify(t)}`);const e=t;if(e.every((function(t){return"number"==typeof t})))return 3===e.length||4===e.length?mg|yg:yg;if("string"!=typeof e[0])throw new Error(`Expected an expression operator but received: ${JSON.stringify(e)}`);const i=Sg[e[0]];if(void 0===i)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return i.getReturnType(e.slice(1))}function Tg(t){return Math.log2(t)%1==0}function Eg(t){const e=t.toString();return e.includes(".")?e:e+".0"}function Cg(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(Eg).join(", ")})`}function Rg(t){const e=gs(t).slice();return e.length<4&&e.push(1),Cg(e.map((function(t,e){return e<3?t/255:t})))}function bg(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Pg(t,e){return Eg(bg(t,e))}function Ig(t,e,i){if(Array.isArray(e)&&"string"==typeof e[0]){const n=Sg[e[0]];if(void 0===n)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return n.toGlsl(t,e.slice(1),i)}const n=wg(e);if((n&fg)>0)return Eg(e);if((n&_g)>0)return e.toString();if((n&pg)>0&&(void 0===i||i==pg))return Pg(t,e.toString());if((n&mg)>0&&(void 0===i||i==mg))return Rg(e);if((n&yg)>0)return Cg(e);throw new Error(`Unexpected expression ${e} (expected type ${i})`)}function Lg(t){if(!(wg(t)&fg))throw new Error(`A numeric value was expected, got ${JSON.stringify(t)} instead`)}function Fg(t){for(let e=0;ee)throw new Error(`At most ${e} arguments were expected, got ${t.length} instead`)}function Gg(t){if(t.length%2!=0)throw new Error(`An even amount of arguments was expected, got ${t} instead`)}function kg(t,e){if(!Tg(e))throw new Error(`Could not infer only one type from the following expression: ${JSON.stringify(t)}`)}function jg(t){return"u_var_"+t}Sg.get={getReturnType:function(t){return xg},toGlsl:function(t,e){Og(e,1),Mg(e[0]);const i=e[0].toString();t.attributes.includes(i)||t.attributes.push(i);return(t.inFragmentShader?"v_":"a_")+i}},Sg.var={getReturnType:function(t){return xg},toGlsl:function(t,e){Og(e,1),Mg(e[0]);const i=e[0].toString();return t.variables.includes(i)||t.variables.push(i),jg(i)}};const Bg="u_paletteTextures";Sg.palette={getReturnType:function(t){return mg},toGlsl:function(t,e){Og(e,2),Lg(e[0]);const i=Ig(t,e[0]),n=e[1];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const r=n.length,s=new Uint8Array(4*r);for(let t=0;tIg(e,t))).join(` ${t} `),n=`(${n})`,n}}}Sg.band={getReturnType:function(t){return fg},toGlsl:function(t,e){Ng(e,1),Dg(e,3);const i=e[0];if(!(zg in t.functions)){let e="";const i=t.bandCount||1;for(let t=0;tIg(t,e))).join(" * ")})`}},Sg["/"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} / ${Ig(t,e[1])})`}},Sg["+"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Ng(e,2),Fg(e),`(${e.map((e=>Ig(t,e))).join(" + ")})`}},Sg["-"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} - ${Ig(t,e[1])})`}},Sg.clamp={getReturnType:function(t){return fg},toGlsl:function(t,e){Og(e,3),Fg(e);const i=Ig(t,e[1]),n=Ig(t,e[2]);return`clamp(${Ig(t,e[0])}, ${i}, ${n})`}},Sg["%"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,2),Fg(e),`mod(${Ig(t,e[0])}, ${Ig(t,e[1])})`}},Sg["^"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,2),Fg(e),`pow(${Ig(t,e[0])}, ${Ig(t,e[1])})`}},Sg.abs={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`abs(${Ig(t,e[0])})`}},Sg.floor={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`floor(${Ig(t,e[0])})`}},Sg.round={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`floor(${Ig(t,e[0])} + 0.5)`}},Sg.ceil={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`ceil(${Ig(t,e[0])})`}},Sg.sin={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`sin(${Ig(t,e[0])})`}},Sg.cos={getReturnType:function(t){return fg},toGlsl:function(t,e){return Og(e,1),Fg(e),`cos(${Ig(t,e[0])})`}},Sg.atan={getReturnType:function(t){return fg},toGlsl:function(t,e){return Ng(e,1),Dg(e,2),Fg(e),2===e.length?`atan(${Ig(t,e[0])}, ${Ig(t,e[1])})`:`atan(${Ig(t,e[0])})`}},Sg[">"]={getReturnType:function(t){return _g},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} > ${Ig(t,e[1])})`}},Sg[">="]={getReturnType:function(t){return _g},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} >= ${Ig(t,e[1])})`}},Sg["<"]={getReturnType:function(t){return _g},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} < ${Ig(t,e[1])})`}},Sg["<="]={getReturnType:function(t){return _g},toGlsl:function(t,e){return Og(e,2),Fg(e),`(${Ig(t,e[0])} <= ${Ig(t,e[1])})`}},Sg["=="]=Ug("=="),Sg["!="]=Ug("!="),Sg["!"]={getReturnType:function(t){return _g},toGlsl:function(t,e){return Og(e,1),Ag(e[0]),`(!${Ig(t,e[0])})`}},Sg.all=Xg("&&"),Sg.any=Xg("||"),Sg.between={getReturnType:function(t){return _g},toGlsl:function(t,e){Og(e,3),Fg(e);const i=Ig(t,e[1]),n=Ig(t,e[2]),r=Ig(t,e[0]);return`(${r} >= ${i} && ${r} <= ${n})`}},Sg.array={getReturnType:function(t){return yg},toGlsl:function(t,e){Ng(e,2),Dg(e,4),Fg(e);const i=e.map((function(e){return Ig(t,e,fg)}));return`vec${e.length}(${i.join(", ")})`}},Sg.color={getReturnType:function(t){return mg},toGlsl:function(t,e){Ng(e,3),Dg(e,4),Fg(e);const i=e;3===e.length&&i.push(1);const n=e.map((function(e,i){return Ig(t,e,fg)+(i<3?" / 255.0":"")}));return`vec${e.length}(${n.join(", ")})`}},Sg.interpolate={getReturnType:function(t){let e=mg|fg;for(let i=3;i=1;i-=2){o=`(${r} == ${Ig(t,e[i])} ? ${Ig(t,e[i+1],n)} : ${o||s})`}return o}},Sg.case={getReturnType:function(t){let e=xg;for(let i=1;i=0;i-=2){s=`(${Ig(t,e[i])} ? ${Ig(t,e[i+1],n)} : ${s||r})`}return s}};class Vg{constructor(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}addUniform(t){return this.uniforms.push(t),this}addAttribute(t){return this.attributes.push(t),this}addVarying(t,e,i){return this.varyings.push({name:t,type:e,expression:i}),this}setSizeExpression(t){return this.sizeExpression=t,this}setRotationExpression(t){return this.rotationExpression=t,this}setSymbolOffsetExpression(t){return this.offsetExpression=t,this}setColorExpression(t){return this.colorExpression=t,this}setTextureCoordinateExpression(t){return this.texCoordExpression=t,this}setFragmentDiscardExpression(t){return this.discardExpression=t,this}setSymbolRotateWithView(t){return this.rotateWithView=t,this}getSizeExpression(){return this.sizeExpression}getOffsetExpression(){return this.offsetExpression}getColorExpression(){return this.colorExpression}getTextureCoordinateExpression(){return this.texCoordExpression}getFragmentDiscardExpression(){return this.discardExpression}getSymbolVertexShader(t){const e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix";let i=this.attributes,n=this.varyings;return t&&(i=i.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\n${i.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n mat4 offsetMatrix = ${e};\n vec2 halfSize = ${this.sizeExpression} * 0.5;\n vec2 offset = ${this.offsetExpression};\n float angle = ${this.rotationExpression};\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = ${this.texCoordExpression};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n${n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`}getSymbolFragmentShader(t){const e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"";let i=this.varyings;return t&&(i=i.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${i.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n if (${this.discardExpression}) { discard; }\n gl_FragColor = ${this.colorExpression};\n gl_FragColor.rgb *= gl_FragColor.a;\n${e}\n}`}}function Wg(t){const e=t.symbol,i=void 0!==e.size?e.size:1,n=e.color||"white",r=e.textureCoord||[0,0,1,1],s=e.offset||[0,0],o=void 0!==e.opacity?e.opacity:1,a=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{},functions:{}},h=Ig(l,i,yg|fg),c=Ig(l,s,yg),u=Ig(l,r,yg),d=Ig(l,a,fg),g={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap,functions:{}},f=Ig(g,n,mg),p=Ig(g,o,fg);let m="1.0";const _=`vec2(${Ig(g,i,yg|fg)}).x`;switch(e.symbolType){case"square":case"image":break;case"circle":m=`(1.0-smoothstep(1.-4./${_},1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))`;break;case"triangle":const t="(v_quadCoord*2.-1.)",i=`(atan(${t}.x,${t}.y))`;m=`(1.0-smoothstep(.5-3./${_},.5,cos(floor(.5+${i}/2.094395102)*2.094395102-${i})*length(${t})))`;break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}const y=(new Vg).setSizeExpression(`vec2(${h})`).setRotationExpression(d).setSymbolOffsetExpression(c).setTextureCoordinateExpression(u).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression(`vec4(${f}.rgb, ${f}.a * ${p} * ${m})`);if(t.filter){const e=Ig(g,t.filter,_g);y.setFragmentDiscardExpression(`!${e}`)}const x={};if(g.variables.forEach((function(e){const i=jg(e);y.addUniform(`float ${i}`),x[i]=function(){if(!t.variables||void 0===t.variables[e])throw new Error(`The following variable is missing from the style: ${e}`);let i=t.variables[e];return"string"==typeof i&&(i=bg(l,i)),void 0!==i?i:-9999999}})),"image"===e.symbolType&&e.src){const t=new Image;t.crossOrigin=void 0===e.crossOrigin?"anonymous":e.crossOrigin,t.src=e.src,y.addUniform("sampler2D u_texture").setColorExpression(y.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),x.u_texture=t}return g.attributes.forEach((function(t){l.attributes.includes(t)||l.attributes.push(t),y.addVarying(`v_${t}`,"float",`a_${t}`)})),l.attributes.forEach((function(t){y.addAttribute(`float a_${t}`)})),{builder:y,attributes:l.attributes.map((function(t){return{name:t,callback:function(e,i){let n=i[t];return"string"==typeof n&&(n=bg(l,n)),void 0!==n?n:-9999999}}})),uniforms:x}}class Zg{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ll(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Zg({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 z()}getImage(t){return z()}getHitDetectionImage(){return z()}getPixelRatio(t){return 1}getImageState(){return z()}getImageSize(){return z()}getOrigin(){return z()}getSize(){return z()}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_=ll(t)}listenImageChange(t){z()}load(){z()}unlistenImageChange(t){z()}}var Yg=Zg;class Kg extends Yg{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=void 0!==t.radius?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new Kg({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=_t(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 ts}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(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,r=void 0===this.radius2_?n:this.radius2_;if(n0,6),Ft(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),69);const a=void 0!==t.src?Jr:ts;if(this.color_=void 0!==t.color?gs(t.color):null,this.iconImage_=nf(s,o,void 0!==this.imgSize_?this.imgSize_:null,this.crossOrigin_,a,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.width_=t.width,this.height_=t.height,void 0!==this.width_||void 0!==this.height_){const t=this.getImage(1),e=()=>{this.updateScaleFromWidthAndHeight(this.width_,this.height_)};t.width>0?this.updateScaleFromWidthAndHeight(this.width_,this.height_):t.addEventListener("load",e)}}clone(){const t=this.getScale();return new sf({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:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode(),width:this.width_,height:this.height_})}updateScaleFromWidthAndHeight(t,e){const i=this.getImage(1);void 0!==t&&void 0!==e?super.setScale([t/i.width,e/i.height]):void 0!==t?super.setScale([t/i.width,t/i.width]):void 0!==e?super.setScale([e/i.height,e/i.height]):super.setScale([1,1])}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[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("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){return this.width_}getHeight(){return this.height_}setWidth(t){this.width_=t,this.updateScaleFromWidthAndHeight(t,this.height_)}setHeight(t){this.height_=t,this.updateScaleFromWidthAndHeight(this.width_,t)}setScale(t){super.setScale(t);const e=this.getImage(1);if(e){const i=Array.isArray(t)?t[0]:t;void 0!==i&&(this.width_=i*e.width);const n=Array.isArray(t)?t[1]:t;void 0!==n&&(this.height_=n*e.height)}}listenImageChange(t){this.iconImage_.addEventListener(w,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(w,t)}}var of=sf;class af{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?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 af({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 lf=af;class hf{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ff,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new hf({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){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=ff,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function cf(t){let e;if("function"==typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{Ft("function"==typeof t.getZIndex,41);i=[t]}e=function(){return i}}return e}let uf=null;function df(t,e){if(!uf){const t=new Qg({color:"rgba(255,255,255,0.4)"}),e=new lf({color:"#3399CC",width:1.25});uf=[new hf({image:new $g({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return uf}function gf(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new hf({fill:new Qg({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new hf({stroke:new lf({color:e,width:5})}),new hf({stroke:new lf({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new hf({image:new $g({radius:6,fill:new Qg({color:i}),stroke:new lf({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function ff(t){return t.getGeometry()}var pf=hf;class mf{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=ll(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new Qg({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new mf({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_=ll(void 0!==t?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 _f=mf;function yf(t){return new pf({fill:xf(t,""),stroke:vf(t,""),text:Sf(t),image:wf(t)})}function xf(t,e){const i=t[e+"fill-color"];if(i)return new Qg({color:i})}function vf(t,e){const i=t[e+"stroke-width"],n=t[e+"stroke-color"];if(i||n)return new lf({width:i,color:n,lineCap:t[e+"stroke-line-cap"],lineJoin:t[e+"stroke-line-join"],lineDash:t[e+"stroke-line-dash"],lineDashOffset:t[e+"stroke-line-dash-offset"],miterLimit:t[e+"stroke-miter-limit"]})}function Sf(t){const e=t["text-value"];if(!e)return;return new _f({text:e,font:t["text-font"],maxAngle:t["text-max-angle"],offsetX:t["text-offset-x"],offsetY:t["text-offset-y"],overflow:t["text-overflow"],placement:t["text-placement"],scale:t["text-scale"],rotateWithView:t["text-rotate-with-view"],rotation:t["text-rotation"],textAlign:t["text-align"],justify:t["text-justify"],textBaseline:t["text-baseline"],padding:t["text-padding"],fill:xf(t,"text-"),backgroundFill:xf(t,"text-background-"),stroke:vf(t,"text-"),backgroundStroke:vf(t,"text-background-")})}function wf(t){const e=t["icon-src"],i=t["icon-img"];if(e||i){return new of({src:e,img:i,imgSize:t["icon-img-size"],anchor:t["icon-anchor"],anchorOrigin:t["icon-anchor-origin"],anchorXUnits:t["icon-anchor-x-units"],anchorYUnits:t["icon-anchor-y-units"],color:t["icon-color"],crossOrigin:t["icon-cross-origin"],offset:t["icon-offset"],displacement:t["icon-displacement"],opacity:t["icon-opacity"],scale:t["icon-scale"],rotation:t["icon-rotation"],rotateWithView:t["icon-rotate-with-view"],size:t["icon-size"],declutterMode:t["icon-declutter-mode"]})}const n=t["shape-points"];if(n){const e="shape-";return new qg({points:n,fill:xf(t,e),stroke:vf(t,e),radius:t["shape-radius"],radius1:t["shape-radius1"],radius2:t["shape-radius2"],angle:t["shape-angle"],displacement:t["shape-displacement"],rotation:t["shape-rotation"],rotateWithView:t["shape-rotate-with-view"],scale:t["shape-scale"],declutterMode:t["shape-declutter-mode"]})}const r=t["circle-radius"];if(r){const e="circle-";return new $g({radius:r,fill:xf(t,e),stroke:vf(t,e),displacement:t["circle-displacement"],scale:t["circle-scale"],rotation:t["circle-rotation"],rotateWithView:t["circle-rotate-with-view"],declutterMode:t["circle-declutter-mode"]})}}var Tf=class{constructor(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0}insertItem(t){const e={prev:void 0,next:void 0,data:t},i=this.head_;if(i){const t=i.next;e.prev=i,e.next=t,i.next=e,t&&(t.prev=e),i===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&(e.next=e,e.prev=e);this.head_=e,this.length_++}removeItem(){const t=this.head_;if(t){const e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.head_=e||i,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=i?this.head_.prev:this.head_),this.length_--}}firstItem(){if(this.head_=this.first_,this.head_)return this.head_.data}lastItem(){if(this.head_=this.last_,this.head_)return this.head_.data}nextItem(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data}getNextItem(){if(this.head_&&this.head_.next)return this.head_.next.data}prevItem(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data}getPrevItem(){if(this.head_&&this.head_.prev)return this.head_.prev.data}getCurrItem(){if(this.head_)return this.head_.data}setFirstItem(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)}concat(t){if(t.head_){if(this.head_){const e=this.head_.next;this.head_.next=t.first_,t.first_.prev=this.head_,e.prev=t.last_,t.last_.next=e,this.length_+=t.length_}else this.head_=t.head_,this.first_=t.first_,this.last_=t.last_,this.length_=t.length_;t.head_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}}getLength(){return this.length_}};const Ef={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Cf={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Rf(t,e){let i,n;for(let r=0;rt.maxTileCol||u.tileRowt.maxTileRow)return}Object.assign(u,_);const d=i.replace(/\{(\w+?)\}/g,(function(t,e){return u[e]}));return Xl(y,d)}}}function If(t){return Ul(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=Rf(e.links,t.mediaType);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=bf(e.links,t.mediaType,t.supportedMediaTypes)}if(e.tileMatrixSet)return Pf(t,e.tileMatrixSet,n,i);const r=e.links.find((t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return Ul(Xl(t.url,s)).then((function(e){return Pf(t,e,n,i)}))}(t,e)}))}var Lf=class extends Ah{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});If({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Qi(t),this.setState("error")}};var Ff=class extends zu{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"});If({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Qi(t),this.setState("error")}};const Mf="renderOrder";var Af=class extends ks{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_=void 0!==t.declutter&&t.declutter,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Mf)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Uh(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(Mf,t)}setStyle(t){let e;if(void 0===t)e=df;else if(null===t)e=null;else if("function"==typeof t)e=t;else if(t instanceof pf)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let e=0;e80*i){n=s=t[0],r=o=t[1];for(var f=i;fs&&(s=a),l>o&&(o=l);h=0!==(h=Math.max(s-n,o-r))?32767/h:0}return zf(d,g,i,n,r,h,0),g}function jf(t,e,i,n,r){var s,o;if(r===hp(t,e,i,n)>0)for(s=e;s=e;s-=n)o=op(s,t[s],t[s+1],o);return o&&tp(o,o.next)&&(ap(o),o=o.next),o}function Bf(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!tp(n,n.next)&&0!==Qf(n.prev,n,n.next))n=n.next;else{if(ap(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function zf(t,e,i,n,r,s,o){if(t){!o&&s&&function(t,e,i,n){var r=t;do{0===r.z&&(r.z=qf(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,s,o,a,l,h=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(o>1)}(r)}(t,n,r,s);for(var a,l,h=t;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Xf(t,n,r,s):Uf(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),ap(t),t=l.next,h=l.next;else if((t=l)===h){o?1===o?zf(t=Vf(Bf(t),e,i),e,i,n,r,s,2):2===o&&Wf(t,e,i,n,r,s):zf(Bf(t),e,i,n,r,s,1);break}}}function Uf(t){var e=t.prev,i=t,n=t.next;if(Qf(e,i,n)>=0)return!1;for(var r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=rs?r>o?r:o:s>o?s:o,g=a>l?a>h?a:h:l>h?l:h,f=n.next;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=g&&$f(r,a,s,l,o,h,f.x,f.y)&&Qf(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Xf(t,e,i,n){var r=t.prev,s=t,o=t.next;if(Qf(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,d=o.y,g=al?a>h?a:h:l>h?l:h,m=c>u?c>d?c:d:u>d?u:d,_=qf(g,f,e,i,n),y=qf(p,m,e,i,n),x=t.prevZ,v=t.nextZ;x&&x.z>=_&&v&&v.z<=y;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=m&&x!==r&&x!==o&&$f(a,c,l,u,h,d,x.x,x.y)&&Qf(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=g&&v.x<=p&&v.y>=f&&v.y<=m&&v!==r&&v!==o&&$f(a,c,l,u,h,d,v.x,v.y)&&Qf(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=_;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=m&&x!==r&&x!==o&&$f(a,c,l,u,h,d,x.x,x.y)&&Qf(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=g&&v.x<=p&&v.y>=f&&v.y<=m&&v!==r&&v!==o&&$f(a,c,l,u,h,d,v.x,v.y)&&Qf(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Vf(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!tp(r,s)&&ep(r,n,n.next,s)&&rp(r,s)&&rp(s,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(s.i/i|0),ap(n),ap(n.next),n=t=s),n=n.next}while(n!==t);return Bf(n)}function Wf(t,e,i,n,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Jf(o,a)){var l=sp(o,a);return o=Bf(o,o.next),l=Bf(l,l.next),zf(o,e,i,n,r,s,0),void zf(l,e,i,n,r,s,0)}a=a.next}o=o.next}while(o!==t)}function Zf(t,e){return t.x-e.x}function Yf(t,e){var i=function(t,e){var i,n=e,r=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o&&(o=a,i=n.x=n.x&&n.x>=c&&r!==n.x&&$f(si.x||n.x===i.x&&Kf(i,n)))&&(i=n,d=l)),n=n.next}while(n!==h);return i}(t,e);if(!i)return e;var n=sp(i,t);return Bf(n,n.next),Bf(i,i.next)}function Kf(t,e){return Qf(t.prev,t,e.prev)<0&&Qf(e.next,t,t.next)<0}function qf(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Hf(t){var e=t,i=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function Jf(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ep(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(rp(t,e)&&rp(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Qf(t.prev,t,e.prev)||Qf(t,e.prev,e))||tp(t,e)&&Qf(t.prev,t,t.next)>0&&Qf(e.prev,e,e.next)>0)}function Qf(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function tp(t,e){return t.x===e.x&&t.y===e.y}function ep(t,e,i,n){var r=np(Qf(t,e,i)),s=np(Qf(t,e,n)),o=np(Qf(i,n,t)),a=np(Qf(i,n,e));return r!==s&&o!==a||(!(0!==r||!ip(t,i,e))||(!(0!==s||!ip(t,n,e))||(!(0!==o||!ip(i,t,n))||!(0!==a||!ip(i,e,n)))))}function ip(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function np(t){return t>0?1:t<0?-1:0}function rp(t,e){return Qf(t.prev,t,t.next)<0?Qf(t,e,t.next)>=0&&Qf(t,t.prev,e)>=0:Qf(t,e,t.prev)<0||Qf(t,t.next,e)<0}function sp(t,e){var i=new lp(t.i,t.x,t.y),n=new lp(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function op(t,e,i,n){var r=new lp(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function ap(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function lp(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hp(t,e,i,n){for(var r=0,s=e,o=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i};const cp=[],up={vertexPosition:0,indexPosition:0};function dp(t,e,i,n,r){t[e+0]=i,t[e+1]=n,t[e+2]=r}function gp(t,e){const i=256,n=255;return(e=e||[])[0]=Math.floor(t/i/i/i)/n,e[1]=Math.floor(t/i/i)%i/n,e[2]=Math.floor(t/i)%i/n,e[3]=t%i/n,e}function fp(t){let e=0;const i=256,n=255;return e+=Math.round(t[0]*i*i*i*n),e+=Math.round(t[1]*i*i*n),e+=Math.round(t[2]*i*n),e+=Math.round(t[3]*n),e}function pp(){const t='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:\'`renderMode` must be `"hybrid"` or `"vector"`\',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var i=o;function a(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function s(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],a=t[1],s=t[2],u=t[3],f=t[4],x=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*x-u*f)/n,e[5]=-(o*x-a*f)/n,e}new Array(6);var u={};function f(e,t,n){n=n||2;var r,o,i,a,s,u,f,l=t&&t.length,c=l?t[0]*n:e.length,v=x(e,0,c,n,!0),d=[];if(!v||v.next===v.prev)return d;if(l&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o80*n){r=i=e[0],o=a=e[1];for(var y=n;yi&&(i=s),u>a&&(a=u);f=0!==(f=Math.max(i-r,a-o))?32767/f:0}return h(v,d,n,r,o,f,0),d}function x(e,t,n,r,o){var i,a;if(o===B(e,t,n,r)>0)for(i=t;i=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&M(a,a.next)&&(z(a),a=a.next),a}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function h(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,u,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,f=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?v(e,r,o,i):c(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),z(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?h(e=d(l(e),t,n),t,n,r,o,i,2):2===a&&y(e,t,n,r,o,i):h(l(e),t,n,r,o,i,1);break}}}function c(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,f=r.y,x=oi?o>a?o:a:i>a?i:a,c=s>u?s>f?s:f:u>f?u:f,v=r.next;v!==t;){if(v.x>=x&&v.x<=h&&v.y>=l&&v.y<=c&&A(o,s,i,u,a,f,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function v(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,f=a.x,x=o.y,l=i.y,h=a.y,c=su?s>f?s:f:u>f?u:f,y=x>l?x>h?x:h:l>h?l:h,p=m(c,v,t,n,r),b=m(d,y,t,n,r),g=e.prevZ,w=e.nextZ;g&&g.z>=p&&w&&w.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;w&&w.z<=b;){if(w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function d(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&S(o,i)&&S(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function y(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&E(a,s)){var u=U(a,s);return a=l(a,a.next),u=l(u,u.next),h(a,t,n,r,o,i,0),void h(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function p(e,t){return e.x-t.x}function b(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x=r.x&&r.x>=x&&o!==r.x&&A(in.x||r.x===n.x&&g(n,r)))&&(n=r,h=u)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=U(n,e);return l(r,r.next),l(n,n.next)}function g(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(S(e,t)&&S(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),a=I(Z(n,r,e)),s=I(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==a||!T(n,e,r))||!(0!==s||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function S(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function U(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function k(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,a=n-r;i0&&(r+=e[o-1].length,n.holes.push(r))}return n};const N=[],P={vertexPosition:0,indexPosition:0};function C(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=N;f.length=o;for(let n=0;n0?u:2*Math.PI-u}const g=null!==o;let m=0,w=0;if(null!==r){m=b(d,y,a(x,[...[e[r],e[r+1]]]))}if(g){w=b(y,d,a(x,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,m,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function L(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const f=e[a++];let x=0;const l=new Array(f-1);for(let t=0;t{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),f=new Float32Array(s);let x;for(let e=0;e0?a+(n-1)*r:null,n{const e=t.data;if(e.type===Nf){const i=e.projectionTransform;e.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,Yt(this.invertRenderTransform_,this.renderTransform_),e.hitDetection?this.hitRenderInstructions_=new Float32Array(t.data.renderInstructions):(this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.generateBuffersRun===this.generateBuffersRun_&&(this.ready=!0)),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const s=this.getLayer().getSource();this.sourceListenKeys_=[N(s,nc,this.handleSourceFeatureAdded_,this),N(s,rc,this.handleSourceFeatureChanged_,this),N(s,oc,this.handleSourceFeatureDelete_,this),N(s,sc,this.handleSourceFeatureClear_,this)],s.forEachFeature((t=>{this.featureCache_[X(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitProgram_=this.helper.getProgram(this.hitFragmentShader_,this.hitVertexShader_),this.hitRenderTarget_=new Jd(this.helper))}handleSourceFeatureAdded_(t){const e=t.feature;this.featureCache_[X(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(t){const e=t.feature;this.featureCache_[X(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}handleSourceFeatureDelete_(t){const e=t.feature;delete this.featureCache_[X(e)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState.projection,n=this.getLayer().getSource().getWrapX()&&i.canWrapX(),r=i.getExtent(),s=t.extent,o=n?De(r):null,a=n?Math.ceil((s[2]-r[2])/o)+1:1,l=n?Math.floor((s[0]-r[0])/o):0;let h=l;const c=this.indicesBuffer_.getSize();do{this.helper.makeProjectionTransform(t,this.currentTransform_),Wt(this.currentTransform_,h*o,0),kt(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(t),this.helper.drawElements(0,c)}while(++h{const r=e.data;r.id===n&&(this.worker_.removeEventListener("message",o),t.verticesBufferTransform=r.renderInstructionsTransform,Yt(t.invertVerticesBufferTransform,t.verticesBufferTransform),t.verticesBuffer.fromArrayBuffer(r.vertexBuffer),this.helper_.flushBufferData(t.verticesBuffer),t.indicesBuffer.fromArrayBuffer(r.indexBuffer),this.helper_.flushBufferData(t.indicesBuffer),t.renderInstructions=new Float32Array(r.renderInstructions),i())};this.worker_.addEventListener("message",o)}};const xp={SEGMENT_START:"a_segmentStart",SEGMENT_END:"a_segmentEnd",PARAMETERS:"a_parameters"};var vp=class extends yp{constructor(t,e,i,n,r){super(t,e,i,n,r),this.attributes=[{name:xp.SEGMENT_START,size:2,type:Xd.FLOAT},{name:xp.SEGMENT_END,size:2,type:Xd.FLOAT},{name:xp.PARAMETERS,size:1,type:Xd.FLOAT}].concat(r.map((function(t){return{name:"a_"+t.name,size:1,type:Xd.FLOAT}})))}generateRenderInstructions(t){const e=2*t.verticesCount+(1+this.customAttributes.length)*t.geometriesCount;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const i=[];let n=0;for(const e in t.entries){const r=t.entries[e];for(let e=0,s=r.flatCoordss.length;ethis.addGeometry_(t,e)));break;case"MultiPolygon":t.getPolygons().map((t=>this.addGeometry_(t,e)));break;case"MultiLineString":t.getLineStrings().map((t=>this.addGeometry_(t,e)));break;case"MultiPoint":t.getPoints().map((t=>this.addGeometry_(t,e)));break;case"Polygon":const s=t;r=this.addFeatureEntryInPolygonBatch_(e),i=s.getFlatCoordinates(),n=i.length/2;const o=s.getLinearRingCount(),a=s.getEnds().map(((t,e,i)=>e>0?(t-i[e-1])/2:t/2));this.polygonBatch.verticesCount+=n,this.polygonBatch.ringsCount+=o,this.polygonBatch.geometriesCount++,r.flatCoordss.push(i),r.ringsVerticesCounts.push(a),r.verticesCount+=n,r.ringsCount+=o,s.getLinearRings().map((t=>this.addGeometry_(t,e)));break;case"Point":const l=t;r=this.addFeatureEntryInPointBatch_(e),i=l.getFlatCoordinates(),this.pointBatch.geometriesCount++,r.flatCoordss.push(i);break;case"LineString":case"LinearRing":const h=t;r=this.addFeatureEntryInLineStringBatch_(e),i=h.getFlatCoordinates(),n=i.length/2,this.lineStringBatch.verticesCount+=n,this.lineStringBatch.geometriesCount++,r.flatCoordss.push(i),r.verticesCount+=n}}changeFeature(t){this.clearFeatureEntryInPointBatch_(t),this.clearFeatureEntryInPolygonBatch_(t),this.clearFeatureEntryInLineStringBatch_(t);const e=t.getGeometry();e&&this.addGeometry_(e,t)}removeFeature(t){this.clearFeatureEntryInPointBatch_(t),this.clearFeatureEntryInPolygonBatch_(t),this.clearFeatureEntryInLineStringBatch_(t)}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0}};const wp={POSITION:"a_position",INDEX:"a_index"};var Tp=class extends yp{constructor(t,e,i,n,r){super(t,e,i,n,r),this.attributes=[{name:wp.POSITION,size:2,type:Xd.FLOAT},{name:wp.INDEX,size:1,type:Xd.FLOAT}].concat(r.map((function(t){return{name:"a_"+t.name,size:1,type:Xd.FLOAT}})))}generateRenderInstructions(t){const e=(2+this.customAttributes.length)*t.geometriesCount;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const i=[];let n=0;for(const e in t.entries){const r=t.entries[e];for(let e=0,s=r.flatCoordss.length;e 0.93) return normalPx - tangentPx;\n float halfAngle = joinAngle / 2.0;\n vec2 angleBisectorNormal = vec2(\n sin(halfAngle) * normalPx.x + cos(halfAngle) * normalPx.y,\n -cos(halfAngle) * normalPx.x + sin(halfAngle) * normalPx.y\n );\n float length = 1.0 / sin(halfAngle);\n return angleBisectorNormal * length;\n }\n\n void main(void) {\n float anglePrecision = 1500.0;\n float paramShift = 10000.0;\n v_angleStart = fract(a_parameters / paramShift) * paramShift / anglePrecision;\n v_angleEnd = fract(floor(a_parameters / paramShift + 0.5) / paramShift) * paramShift / anglePrecision;\n float vertexNumber = floor(a_parameters / paramShift / paramShift + 0.0001);\n vec2 tangentPx = worldToPx(a_segmentEnd) - worldToPx(a_segmentStart);\n tangentPx = normalize(tangentPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 offsetPx = getOffsetDirection(normalPx * normalDir, tangentDir * tangentPx, angle) * a_width * 0.5;\n vec2 position = vertexNumber < 1.5 ? a_segmentStart : a_segmentEnd;\n gl_Position = u_projectionMatrix * vec4(position, 0.0, 1.0) + pxToScreen(offsetPx);\n v_segmentStart = worldToPx(a_segmentStart);\n v_segmentEnd = worldToPx(a_segmentEnd);\n v_color = ${bp}\n v_opacity = a_opacity;\n v_width = a_width;\n }`,Fp="\n precision mediump float;\n uniform float u_pixelRatio;\n varying vec2 v_segmentStart;\n varying vec2 v_segmentEnd;\n varying float v_angleStart;\n varying float v_angleEnd;\n varying vec3 v_color;\n varying float v_opacity;\n varying float v_width;\n\n float segmentDistanceField(vec2 point, vec2 start, vec2 end, float radius) {\n vec2 startToPoint = point - start;\n vec2 startToEnd = end - start;\n float ratio = clamp(dot(startToPoint, startToEnd) / dot(startToEnd, startToEnd), 0.0, 1.0);\n float dist = length(startToPoint - ratio * startToEnd);\n return 1.0 - smoothstep(radius - 1.0, radius, dist);\n }\n\n void main(void) {\n vec2 v_currentPoint = gl_FragCoord.xy / u_pixelRatio;\n gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n gl_FragColor *= segmentDistanceField(v_currentPoint, v_segmentStart, v_segmentEnd, v_width);\n }",Mp=`\n precision mediump float;\n uniform mat4 u_projectionMatrix;\n uniform mat4 u_offsetScaleMatrix;\n attribute vec2 a_position;\n attribute float a_index;\n attribute float a_color;\n attribute float a_opacity;\n varying vec2 v_texCoord;\n varying vec3 v_color;\n varying float v_opacity;\n\n void main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n float size = 6.0;\n float offsetX = a_index == 0.0 || a_index == 3.0 ? -size / 2.0 : size / 2.0;\n float offsetY = a_index == 0.0 || a_index == 1.0 ? -size / 2.0 : size / 2.0;\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n v_texCoord = vec2(u, v);\n v_color = ${bp}\n v_opacity = a_opacity;\n }`,Ap="\n precision mediump float;\n varying vec3 v_color;\n varying float v_opacity;\n\n void main(void) {\n gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n }";function Op(t){return Object.keys(t).map((e=>({name:e,callback:t[e]})))}var Np=class extends rg{constructor(t,e){const i=e.uniforms||{},n=[1,0,0,1,0,0];i[Nd]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.sourceRevision_=-1,this.previousExtent_=[1/0,1/0,-1/0,-1/0],this.currentTransform_=n;const r={color:function(){return Rp("#ddd")},opacity:function(){return 1},...e.fill&&e.fill.attributes},s={color:function(){return Rp("#eee")},opacity:function(){return 1},width:function(){return 1.5},...e.stroke&&e.stroke.attributes},o={color:function(){return Rp("#eee")},opacity:function(){return 1},...e.point&&e.point.attributes};this.fillVertexShader_=e.fill&&e.fill.vertexShader||Pp,this.fillFragmentShader_=e.fill&&e.fill.fragmentShader||Ip,this.fillAttributes_=Op(r),this.strokeVertexShader_=e.stroke&&e.stroke.vertexShader||Lp,this.strokeFragmentShader_=e.stroke&&e.stroke.fragmentShader||Fp,this.strokeAttributes_=Op(s),this.pointVertexShader_=e.point&&e.point.vertexShader||Mp,this.pointFragmentShader_=e.point&&e.point.fragmentShader||Ap,this.pointAttributes_=Op(o),this.worker_=pp(),this.batch_=new Sp;const a=this.getLayer().getSource();this.batch_.addFeatures(a.getFeatures()),this.sourceListenKeys_=[N(a,nc,this.handleSourceFeatureAdded_,this),N(a,rc,this.handleSourceFeatureChanged_,this),N(a,oc,this.handleSourceFeatureDelete_,this),N(a,sc,this.handleSourceFeatureClear_,this)]}afterHelperCreated(){this.polygonRenderer_=new Cp(this.helper,this.worker_,this.fillVertexShader_,this.fillFragmentShader_,this.fillAttributes_),this.pointRenderer_=new Tp(this.helper,this.worker_,this.pointVertexShader_,this.pointFragmentShader_,this.pointAttributes_),this.lineStringRenderer_=new vp(this.helper,this.worker_,this.strokeVertexShader_,this.strokeFragmentShader_,this.strokeAttributes_)}handleSourceFeatureAdded_(t){const e=t.feature;this.batch_.addFeature(e)}handleSourceFeatureChanged_(t){const e=t.feature;this.batch_.changeFeature(e)}handleSourceFeatureDelete_(t){const e=t.feature;this.batch_.removeFeature(e)}handleSourceFeatureClear_(){this.batch_.clear()}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const i=this.getLayer().getSource(),n=t.viewState.projection,r=i.getWrapX()&&n.canWrapX(),s=n.getExtent(),o=t.extent,a=r?De(s):null,l=r?Math.ceil((o[2]-s[2])/a)+1:1;let h=r?Math.floor((o[0]-s[0])/a):0;do{this.polygonRenderer_.render(this.batch_.polygonBatch,this.currentTransform_,t,h*a),this.lineStringRenderer_.render(this.batch_.lineStringBatch,this.currentTransform_,t,h*a),this.pointRenderer_.render(this.batch_.pointBatch,this.currentTransform_,t,h*a)}while(++h{l--,this.ready=l<=0,this.getLayer().changed()};this.polygonRenderer_.rebuild(this.batch_.polygonBatch,t,"Polygon",h),this.lineStringRenderer_.rebuild(this.batch_.lineStringBatch,t,"LineString",h),this.pointRenderer_.rebuild(this.batch_.pointBatch,t,"Point",h),this.previousExtent_=t.extent.slice()}return this.helper.makeProjectionTransform(t,this.currentTransform_),this.helper.prepareDraw(t),!0}forEachFeatureAtCoordinate(t,e,i,n,r){}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach((function(t){G(t)})),this.sourceListenKeys_=null,super.disposeInternal()}};const Dp=0,Gp=1,kp=2,jp=3,Bp=4,zp=5,Up=6,Xp=7,Vp=8,Wp=9,Zp=10,Yp=11,Kp=12,qp=[Vp],Hp=[Kp],$p=[Gp],Jp=[jp];var Qp=class extends Vl{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 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;oo&&(this.instructions.push([Bp,o,l,t,i,nr]),this.hitDetectionInstructions.push([Bp,o,l,t,n||i,nr]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),l=this.coordinates.length,this.instructions.push([Bp,o,l,t,i]),this.hitDetectionInstructions.push([Bp,o,l,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[Dp,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Dp,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[Zp,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Yp,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;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!d(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Xp,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=se(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;re(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}};var tm=class extends Qp{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,s=this.appendFlatPointCoordinates(i,n);this.instructions.push([Up,r,s,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([Up,r,s,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,s=this.appendFlatPointCoordinates(i,n);this.instructions.push([Up,r,s,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([Up,r,s,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 em=class extends Qp{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,s=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[Wp,r,s];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0===n||void 0===r)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Yp,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,to,0],$p);const s=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(s,0,s.length,o),this.hitDetectionInstructions.push(Hp),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0===n||void 0===r)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Yp,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],$p);const s=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride();let l=0;for(let t=0,e=s.length;tt&&(y>_&&(_=y,p=x,m=o),y=0,x=o-r)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>_?[x,o]:[p,m]}const rm={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};var sm=class extends Qp{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 s=this.coordinates;let o=s.length;const a=t.getType();let l=null,h=t.getStride();if("line"!==r.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){let i=r.overflow?null:[];switch(a){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),h=2;break;case"Polygon":l=t.getFlatInteriorPoint(),r.overflow||i.push(l[2]/this.resolution),h=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,n=e.length;t{const n=s[2*(t+i)]===l[i*h]&&s[2*(t+i)+1]===l[i*h+1];return n||--t,n}))}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 c=r.padding;if(c!=oo&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],n=r.padding[3];r.scale[0]<0&&(e=-e,n=-n),r.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([Up,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==oo?oo:c.map((function(t){return t*u})),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/u;this.hitDetectionInstructions.push([Up,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,c,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),this.endGeometry(e)}else{if(!Ge(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(l=t.getFlatCoordinates(),"LineString"==a)i=[l.length];else if("MultiLineString"==a)i=t.getEnds();else if("Polygon"==a)i=t.getEnds().slice(0,1);else if("MultiPolygon"==a){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else b=v>C;const P=Math.PI,I=[],L=w+n===e;let F;if(m=0,_=T,d=t[e=w],g=t[e+1],L){y(),F=Math.atan2(g-p,d-f),b&&(F+=F>0?-P:P);const t=(C+v)/2,e=(R+S)/2;return I[0]=[t,e,(E-s)/2,F,r],I}for(let t=0,u=(r=r.replace(/\n/g," ")).length;t0?-P:P),void 0!==F){let t=v-F;if(t+=t>P?-2*P:t<-P?2*P:0,Math.abs(t)>o)return null}F=v;const S=t;let w=0;for(;t0&&t.push("\n",""),t.push(e,""),t}var xm=class{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_=[1,0,0,1,0,0],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 s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=Array.isArray(t),u=a.justify?rm[a.justify]:_m(Array.isArray(t)?t[0]:t,a.textAlign||ro),d=n&&s.lineWidth?s.lineWidth:0,g=c?t:t.split("\n").reduce(ym,[]),{width:f,height:p,widths:m,heights:_,lineWidths:y}=_o(a,g),x=f+d,v=[],S=(x+2)*h[0],w=(p+d)*h[1],T={width:S<0?Math.floor(S):Math.ceil(S),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",d),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const E=.5-u;let C=u*x+E*d;const R=[],b=[];let P,I=0,L=0,F=0,M=0;for(let t=0,e=g.length;tt?t-l:r,x=s+h>e?e-h:s,v=g[3]+y*u[0]+g[1],S=g[0]+x*u[1]+g[2],w=m-g[3],T=_-g[0];let E;return(f||0!==c)&&(um[0]=w,fm[0]=w,um[1]=T,dm[1]=T,dm[0]=w+v,gm[0]=dm[0],gm[1]=T+S,fm[1]=gm[1]),0!==c?(E=Zt([1,0,0,1,0,0],i,n,1,1,c,-i,-n),zt(E,um),zt(E,dm),zt(E,gm),zt(E,fm),de(Math.min(um[0],dm[0],gm[0],fm[0]),Math.min(um[1],dm[1],gm[1],fm[1]),Math.max(um[0],dm[0],gm[0],fm[0]),Math.max(um[1],dm[1],gm[1],fm[1]),cm)):de(Math.min(w,w+v),Math.min(T,T+S),Math.max(w,w+v),Math.max(T,T+S),cm),d&&(m=Math.round(m),_=Math.round(_)),{drawImageX:m,drawImageY:_,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:cm[0],minY:cm[1],maxX:cm[2],maxY:cm[3],value:p},canvasTransform:E,scale:u}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=t.canvas,c=o?o[2]*n.scale[0]/2:0;return l.minX-c<=h.width/e&&l.maxX+c>=0&&l.minY-c<=h.height/e&&l.maxY+c>=0&&(a&&this.replayTextBackground_(t,um,dm,gm,fm,s,o),yo(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=zt(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],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=_m(Array.isArray(t)?t[0]:t,r.textAlign||ro),h=rm[r.textBaseline||so],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}}execute_(t,e,i,n,r,s,o,a){let l;this.pixelCoordinates_&&d(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Ln(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Bt(this.renderedTransform_,i));let h=0;const c=n.length;let u,g,f,p,m,_,y,x,v,S,w,T,E=0,C=0,R=0,b=null,P=null;const I=this.coordinateCache_,L=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:L},A=this.instructions!=n||this.overlaps?0:200;let O,N,D,G;for(;hA&&(this.fill_(t),C=0),R>A&&(t.stroke(),R=0),C||R||(t.beginPath(),p=NaN,m=NaN),++h;break;case kp:E=i[1];const n=l[E],c=l[E+1],d=l[E+2]-n,k=l[E+3]-c,j=Math.sqrt(d*d+k*k);t.moveTo(n+j,c),t.arc(n,c,j,0,2*Math.PI,!0),++h;break;case jp:t.closePath(),++h;break;case Bp:E=i[1],u=i[2];const B=i[3],z=i[4],U=6==i.length?i[5]:void 0;M.geometry=B,M.feature=O,h in I||(I[h]=[]);const X=I[h];U?U(l,E,u,2,X):(X[0]=l[E],X[1]=l[E+1],X.length=2),z(X,M),++h;break;case Up:E=i[1],u=i[2],x=i[3],g=i[4],f=i[5];let V=i[6];const W=i[7],Z=i[8],Y=i[9],K=i[10];let q=i[11];const H=i[12];let $=i[13];const J=i[14],Q=i[15];if(!x&&i.length>=20){v=i[19],S=i[20],w=i[21],T=i[22];const t=this.drawLabelWithPointPlacement_(v,S,w,T);x=t.label,i[3]=x;const e=i[23];g=(t.anchorX-e)*this.pixelRatio,i[4]=g;const n=i[24];f=(t.anchorY-n)*this.pixelRatio,i[5]=f,V=x.height,i[6]=V,$=x.width,i[13]=$}let tt,et,it,nt;i.length>25&&(tt=i[25]),i.length>17?(et=i[16],it=i[17],nt=i[18]):(et=oo,it=!1,nt=!1),K&&F?q+=L:K||F||(q-=L);let rt=0;for(;Ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"Image"!==g&&"Text"!==g||s.includes(t)){const i=(d[a]-3)/4,s=n-i%o,l=n-(i/o|0),h=r(t,e,s*s+l*l);if(h)return h}c.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let m,_,y,x,v;for(p.sort(l),m=p.length-1;m>=0;--m){const t=p[m].toString();for(y=this.executorsByZIndex_[t],_=vm.length-1;_>=0;--_)if(g=vm[_],x=y[g],void 0!==x&&(v=x.executeHitDetection(c,a,i,f,u),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Ln(o,0,8,2,t,o),o}isEmpty(){return v(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let h,c,u,d,g,f;for(a.sort(l),this.maxExtent_&&(t.save(),this.clip(t,i)),s=s||vm,o&&a.reverse(),h=0,c=a.length;h{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];zt(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*Em,h=t[1]*Em;a.push(this.getRenderTransform(e,i,n,Em,l,h,0).slice());const c=o.getSource(),u=r.getExtent();if(c.getWrapX()&&r.canWrapX()&&!le(u,s)){let t=s[0];const r=De(u);let o,c=0;for(;tu[2];)++c,o=r*c,a.push(this.getRenderTransform(e,i,n,Em,l,h,o).slice()),t-=r}this.hitDetectionImageData_=Cm(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n)}e(Rm(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const s=X(t),o=l[s];if(o){if(!0!==o&&ic=n.forEachFeatureAtCoordinate(t,s,o,i,h,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}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[Wo],r=t.viewHints[Zo],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,g=e.getRevision(),f=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Yl);const m=l.center.slice(),_=re(a,f*c),y=_.slice(),x=[_.slice()],v=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!le(v,t.extent)){const t=De(v),e=Math.max(De(_)/2,t);_[0]=v[0]-e,_[2]=v[2]+e,Xi(m,h);const i=Xe(x[0],h);i[0]v[0]&&i[2]>v[2]&&x.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==g&&this.renderedRenderOrder_==p&&le(this.wrappedRenderedExtent_,_))return d(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new am(ql(c,u),_,c,u);let w;this.getLayer().getDeclutter()&&(w=new am(ql(c,u),_,c,u));const T=Sn();let E;if(T){for(let t=0,e=x.length;t{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,C,i,S,E,w);R=R&&!e}},P=En(_,h),I=i.getFeaturesInExtent(P);p&&I.sort(p);for(let t=0,e=I.length;t{if(g.getState()!==ts)return;this.image_=d?null:g;const t=g.getResolution(),n=g.getPixelRatio(),r=t*e/n;this.renderedResolution=r,this.coordinateToVectorPixelTransform_=Zt(this.coordinateToVectorPixelTransform_,a/2,l/2,1/r,-1/r,0,-i.center[0],-i.center[1])})),g.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}};const Im={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Lm={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Fm=class extends pu{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.tmpTransform_=[1,0,0,1,0,0]}prepareTile(t,e,i){let n;const r=t.getState();return r!==Q&&r!==tt||(this.updateExecutorGroup_(t,e,i),this.tileImageNeedsRender_(t)&&(n=!0)),n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState,o=s.resolution,a=s.projection,l=this.getLayer(),h=l.getSource().getTile(t,e,i,r,a),c=n.viewHints,u=!(c[Wo]||c[Zo]);!u&&h.wantedResolution||(h.wantedResolution=o);return this.prepareTile(h,r,a)&&(u||Date.now()-n.time<8)&&"vector"!==l.getRenderMode()&&this.renderTileImage_(h,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?X(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=n.getDeclutter(),c=l.getTileGrid(),u=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),g=X(n);delete t.hitDetectionImageData[g],t.executorGroups[g]=[],h&&(t.declutterExecutorGroups[g]=[]),a.dirty=!1;for(let i=0,r=d.length;i{const r=n===p?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,a=n.length;e{const n=this.getLayer(),r=X(n),s=n.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,h=s.getTileGridForProjection(o),c=zt(this.renderedPixelToCoordinateTransform_,t.slice()),u=h.getTileCoordForCoordAndResolution(c,l);let d;for(let t=0,e=this.renderedTiles.length;t0)return void e([]);const g=Oe(h.getTileCoordExtent(d.wrappedTileCoord)),f=[(c[0]-g[0])/l,(g[1]-c[1])/l],p=d.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let m=d.hitDetectionImageData[r];if(!m){const t=ll(h.getTileSize(h.getZForResolution(l,s.zDirection))),e=this.renderedRotation_;m=Cm(t,[this.getRenderTransform(h.getTileCoordCenter(d.wrappedTileCoord),l,0,Em,t[0]*Em,t[1]*Em,0)],p,n.getStyleFunction(),h.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(n).renderedResolution,e),d.hitDetectionImageData[r]=m}e(Rm(f,p,m))}))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t){const e=this.context,i=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();const n=t.viewHints,r=!(n[Wo]||n[Zo]),s=this.renderedTiles;for(let e=0,i=s.length;e=0;--e)n[e].execute(this.context,1,this.getTileRenderTransform(i,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=i}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(u,this.tmpExtent)[0]-d[0];return kt(Xt(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[Wo]||i[Zo]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=r.getOpacity();const a=Lm[s],l=e.viewState,h=l.rotation,c=r.getSource(),u=c.getTileGridForProjection(l.projection).getZForResolution(l.resolution,c.zDirection),d=this.renderedTiles,g=[],f=[];let p=!0;for(let i=d.length-1;i>=0;--i){const s=d[i];p=p&&!s.getReplayState(r).dirty;const o=s.executorGroups[X(r)].filter((t=>t.hasExecutors(a)));if(0===o.length)continue;const l=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let m=!1;const _=o[0].getClipCoords(l);if(_){for(let e=0,i=g.length;e=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||Ee(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i1?o:2,s=s||new Array(o);for(let e=0;e>1;r1?new Km(i,"XY",r):new Ar(i,"XY",n);default:throw new Error("Invalid geometry type:"+e)}}Hm.prototype.getEndss=Hm.prototype.getEnds,Hm.prototype.getFlatCoordinates=Hm.prototype.getOrientedFlatCoordinates;var Jm=Hm;let Qm=null;function t_(t){Qm=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n0&&c.length>0;)f=c.pop(),r=l.pop(),o=h.pop(),_=f.toString(),_ in u||(n.push(o[0],o[1]),u[_]=!0),p=c.pop(),s=l.pop(),a=h.pop(),m=(f+p)/2,d=t(m),g=e(d),yi(g[0],g[1],o[0],o[1],a[0],a[1]){const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new pf({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new _f({font:"12px Calibri,sans-serif",textAlign:"right",fill:new Qg({color:"rgba(0,0,0,1)"}),stroke:new lf({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(As,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:a_,this.setSource(new uc({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new H,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new pf({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&Xe(i,this.projection_),this.loadedExtent_&&(_e(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=Ae(this.getExtent()||[-1/0,-1/0,1/0,1/0],t);if(this.renderedExtent_&&me(this.renderedExtent_,r)&&this.renderedResolution_===e)return;if(this.renderedExtent_=r,this.renderedResolution_=e,ke(r))return;const s=Pe(r),o=e*e/4;(!this.projection_||!fn(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(r,s,e,o);let a,l=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(l+=this.meridians_.length),this.parallelsLabels_&&(l+=this.parallels_.length);l>this.featurePool_.length;)a=new Ot,this.featurePool_.push(a);const h=n.getFeaturesCollection();h.clear();let c,u,d=0;for(c=0,u=this.meridians_.length;cMath.PI/2}const d=Jl(t);for(let t=a;t<=l;++t){let i,n,c,g,f=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,c=this.meridiansLabels_.length;n=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[_i(e[0],this.minX_,this.maxX_),_i(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let c=_i(h[0],this.minLon_,this.maxLon_),u=_i(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,f,p,m,_=t;s||(_=[_i(t[0],this.minX_,this.maxX_),_i(t[1],this.minY_,this.maxY_),_i(t[2],this.minX_,this.maxX_),_i(t[3],this.minY_,this.maxY_)]);const y=Ue(_,this.toLonLatTransform_,void 0,8);let x=y[3],v=y[2],S=y[1],w=y[0];if(s||(ae(_,this.bottomLeft_)&&(w=this.minLon_,S=this.minLat_),ae(_,this.bottomRight_)&&(v=this.maxLon_,S=this.minLat_),ae(_,this.topLeft_)&&(w=this.minLon_,x=this.maxLat_),ae(_,this.topRight_)&&(v=this.maxLon_,x=this.maxLat_),x=_i(x,u,this.maxLat_),v=_i(v,c,this.maxLon_),S=_i(S,this.minLat_,u),w=_i(w,this.minLon_,c)),c=Math.floor(c/r)*r,m=_i(c,this.minLon_,this.maxLon_),f=this.addMeridian_(m,S,x,n,t,0),g=0,s)for(;(m-=r)>=w&&g++n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=_i(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],c=this.meridiansLabels_[i].geom;return c.setCoordinates(h),c}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=s_(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new zm(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=_i(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],c=this.parallelsLabels_[i].geom;return c.setCoordinates(h),c}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=an("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=mn(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}};const h_="blur",c_="gradient",u_="radius",d_=["#00f","#0ff","#0f0","#ff0","#f00"];var g_=class extends Af{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this.gradient_=null,this.addChangeListener(c_,this.handleGradientChanged_),this.setGradient(t.gradient?t.gradient:d_),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.weightFunction_="string"==typeof i?function(t){return t.get(i)}:i,this.setRenderOrder(null)}getBlur(){return this.get(h_)}getGradient(){return this.get(c_)}getRadius(){return this.get(u_)}handleGradientChanged_(){this.gradient_=function(t){const e=1,i=256,n=_t(e,i),r=n.createLinearGradient(0,0,e,i),s=1/(t.length-1);for(let e=0,i=t.length;e{const e=this.weightFunction_(t);return void 0!==e?_i(e,0,1):1}}],vertexShader:"\n precision mediump float;\n uniform mat4 u_projectionMatrix;\n uniform mat4 u_offsetScaleMatrix;\n uniform float u_size;\n attribute vec2 a_position;\n attribute float a_index;\n attribute float a_weight;\n\n varying vec2 v_texCoord;\n varying float v_weight;\n\n void main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n v_texCoord = vec2(u, v);\n v_weight = a_weight;\n }",fragmentShader:"\n precision mediump float;\n uniform float u_blurSlope;\n\n varying vec2 v_texCoord;\n varying float v_weight;\n\n void main(void) {\n vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n gl_FragColor = vec4(alpha, alpha, alpha, alpha);\n }",hitVertexShader:"\n precision mediump float;\n uniform mat4 u_projectionMatrix;\n uniform mat4 u_offsetScaleMatrix;\n uniform float u_size;\n attribute vec2 a_position;\n attribute float a_index;\n attribute float a_weight;\n attribute vec4 a_hitColor;\n\n varying vec2 v_texCoord;\n varying float v_weight;\n varying vec4 v_hitColor;\n\n void main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n v_texCoord = vec2(u, v);\n v_hitColor = a_hitColor;\n v_weight = a_weight;\n }",hitFragmentShader:"\n precision mediump float;\n uniform float u_blurSlope;\n\n varying vec2 v_texCoord;\n varying float v_weight;\n varying vec4 v_hitColor;\n\n void main(void) {\n vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n if (alpha < 0.05) {\n discard;\n }\n\n gl_FragColor = v_hitColor;\n }",uniforms:{u_size:()=>2*(this.get(u_)+this.get(h_)),u_blurSlope:()=>this.get(u_)/Math.max(1,this.get(h_))},postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}};var f_=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?an(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=an(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)}getType(){return z()}readFeature(t,e){return z()}readFeatures(t,e){return z()}readGeometry(t,e){return z()}readProjection(t){return z()}writeFeature(t,e){return z()}writeFeatures(t,e){return z()}writeGeometry(t,e){return z()}};function p_(t,e,i){const n=i?an(i.featureProjection):null,r=i?an(i.dataProjection):null;let s;if(s=n&&r&&!fn(n,r)?(e?t.clone():t).transform(e?n:r,e?r:n):t,e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i */ read:function(t,e,i,n,r){var s,o,a=8*r-n-1,l=(1<>1,c=-7,u=i?r-1:0,d=i?-1:1,g=t[e+u];for(u+=d,s=g&(1<<-c)-1,g>>=-c,c+=a;c>0;s=256*s+t[e+u],u+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+u],u+=d,c-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(g?-1:1);o+=Math.pow(2,n),s-=h}return(g?-1:1)*o*Math.pow(2,s-n)},write:function(t,e,i,n,r,s){var o,a,l,h=8*s-r-1,c=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,f=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,r),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;t[i+g]=255&a,g+=f,a/=256,r-=8);for(o=o<0;t[i+g]=255&o,g+=f,o/=256,h-=8);t[i+g-f]|=128*p}},y_=v_,x_=__;function v_(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}v_.Varint=0,v_.Fixed64=1,v_.Bytes=2,v_.Fixed32=5;var S_=4294967296,w_=1/S_,T_="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function E_(t){return t.type===v_.Bytes?t.readVarint()+t.pos:t.pos+1}function C_(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function R_(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function b_(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function k_(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}v_.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,s=this.pos;this.type=7&n,t(r,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=D_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=k_(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=D_(this.buf,this.pos)+D_(this.buf,this.pos+4)*S_;return this.pos+=8,t},readSFixed64:function(){var t=D_(this.buf,this.pos)+k_(this.buf,this.pos+4)*S_;return this.pos+=8,t},readFloat:function(){var t=x_.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=x_.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,s=i.buf;if(r=s[i.pos++],n=(112&r)>>4,r<128)return C_(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return C_(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return C_(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return C_(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return C_(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return C_(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&T_?function(t,e,i){return T_.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(s=t[r+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===c?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((h=(15&l)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((h=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==v_.Bytes)return t.push(this.readVarint(e));var i=E_(this);for(t=t||[];this.pos127;);else if(e===v_.Bytes)this.pos=this.readVarint()+this.pos;else if(e===v_.Fixed32)this.pos+=4;else{if(e!==v_.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&R_(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),x_.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),x_.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&R_(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,v_.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,b_,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,P_,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,F_,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,I_,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,L_,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,M_,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,A_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,O_,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,N_,e)},writeBytesField:function(t,e){this.writeTag(t,v_.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,v_.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,v_.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,v_.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,v_.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,v_.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,v_.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,v_.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,v_.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,v_.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function j_(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(B_,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function B_(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function z_(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos>3}o--,1===s||2===s?(a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2):7===s?h>c&&(i.push(i[c],i[c+1]),h+=2):Ft(!1,59)}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,l.length);if(this.featureClass_===Jm)r=new this.featureClass_(h,a,l,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Fr(a,l);t=e.length>1?new Km(a,"XY",e):new Ar(a,"XY",l)}else t="Point"===h?new dr(a,"XY"):"LineString"===h?new zm(a,"XY"):"MultiPoint"===h?new Wm(a,"XY"):"MultiLineString"===h?new Xm(a,"XY",l):null;r=new(0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=p_(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=an((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new y_(t),s=r.readFields(j_,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t{i.setState("ready")})).catch((t=>{this.dispatchEvent(new W_(t));this.getSource().setState("error")})),void 0===this.getBackground()&&olms.applyBackground(this,t.styleUrl,{accessToken:this.accessToken})}};var Y_=class extends Af{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new Pm(this)}};var K_=class extends ks{constructor(t){super(Object.assign({},t)),this.parseResult_=Wg(t.style),this.styleVariables_=t.style.variables||{},this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new mp(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitVertexShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolFragmentShader(!0),uniforms:this.parseResult_.uniforms,attributes:this.parseResult_.attributes})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}};function q_(t,e){const i=`\n attribute vec2 ${og.TEXTURE_COORD};\n uniform mat4 ${sg.TILE_TRANSFORM};\n uniform float ${sg.TEXTURE_PIXEL_WIDTH};\n uniform float ${sg.TEXTURE_PIXEL_HEIGHT};\n uniform float ${sg.TEXTURE_RESOLUTION};\n uniform float ${sg.TEXTURE_ORIGIN_X};\n uniform float ${sg.TEXTURE_ORIGIN_Y};\n uniform float ${sg.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${og.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${sg.TEXTURE_ORIGIN_X} + ${sg.TEXTURE_RESOLUTION} * ${sg.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${sg.TEXTURE_ORIGIN_Y} - ${sg.TEXTURE_RESOLUTION} * ${sg.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${sg.TILE_TRANSFORM} * vec4(${og.TEXTURE_COORD}, ${sg.DEPTH}, 1.0);\n }\n `,n={inFragmentShader:!0,variables:[],attributes:[],stringLiteralsMap:{},functions:{},bandCount:e},r=[];if(void 0!==t.color){const e=Ig(n,t.color,mg);r.push(`color = ${e};`)}if(void 0!==t.contrast){const e=Ig(n,t.contrast,fg);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=Ig(n,t.exposure,fg);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=Ig(n,t.saturation,fg);r.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=Ig(n,t.gamma,fg);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=Ig(n,t.brightness,fg);r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=n.variables.length;if(o>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${sg.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${sg.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${sg.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${sg.TRANSITION_ALPHA};\n }`,uniforms:s,paletteTextures:n.paletteTextures}}class H_ extends fu{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.cacheSize_=i,this.styleVariables_=this.style_.variables||{},this.addChangeListener(Is,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=q_(this.style_,this.getSourceBandCount_());return new gg(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.cacheSize_,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=q_(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}H_.prototype.dispose;var $_=H_;const J_="addfeatures";class Q_ extends r{constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}var ty=class extends Sa{constructor(t){t=t||{},super({handleEvent:f}),this.on,this.once,this.un,this.readAsBuffer_=!1,this.formats_=[];const e=t.formatConstructors?t.formatConstructors:[];for(let t=0,i=e.length;t0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new Q_(J_,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[N(e,I,this.handleDrop,this),N(e,b,this.handleStop,this),N(e,P,this.handleStop,this),N(e,I,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.registerListeners_(),this.getActive()&&!t&&this.unregisterListeners_(),super.setActive(t)}setMap(t){this.unregisterListeners_(),super.setMap(t),this.getActive()&&this.registerListeners_()}tryReadFeatures_(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(G),this.dropListenKeys_=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1}handleDownEvent(t){return!!Ga(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}};const iy="drawstart",ny="drawend",ry="drawabort";class sy extends r{constructor(t,e){super(t),this.feature=e}}function oy(t,e){return xi(t[0],t[1],e[0],e[1])}function ay(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function ly(t,e,i){let n,r;eo){return oy(fy(t,n),fy(t,r))}let a=0;if(n=i?n-=i:n<0&&(n+=i);let s=n+1;s>=i&&(s-=i);const o=t[n],a=o[0],l=o[1],h=t[s];return[a+(h[0]-a)*r,l+(h[1]-l)*r]}function py(){const t=gf();return function(e,i){return t[e.getGeometry().getType()]}}var my=class extends Ea{constructor(t){const e=t;e.stopDown||(e.stopDown=p),super(e),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:f,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=function(t,e,i){const n=e||new Am([NaN,NaN]),r=Tn(t[0],i),s=ji(r,Tn(t[t.length-1],i));n.setCenterAndRadius(r,Math.sqrt(s),this.geometryLayout_);const o=Sn();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=dr:"LineString"===t?e=zm:"Polygon"===t&&(e=Ar),i=function(i,n,r){return n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n}}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new i_({source:new uc({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:py(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:Oa,this.freehandCondition_,t.freehand?this.freehandCondition_=La:this.freehandCondition_=t.freehandCondition?t.freehandCondition:Na,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(ya,this.updateState_)}setTrace(t){let e;e=t?!0===t?La:t:Ma,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===E&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===Ro.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===Ro.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===Ro.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===Ro.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===Ro.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===Ro.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===Ro.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout((()=>{this.handlePointerMove_(new Co(Ro.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=ne([e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_])]),n=this.traceSource_.getFeaturesInExtent(i);if(0===n.length)return;const r=function(t,e){const i=[];for(let n=0;nt.endIndex||!i&&et.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e=s;--e)n.push(ay(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex&&Bi(e.startPx,t.pixel)i.startIndex?hi.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const t=fy(h.coordinates,l);Bi(i.getPixelFromCoordinate(t),e.startPx)>n&&(c=!1)}if(c){const t=h.coordinates,e=t.length,i=h.startIndex,n=l;if(ithis.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const s=this.mode_;if("Point"===s)i=!0;else if("Circle"===s)i=2===this.sketchCoords_.length;else if("LineString"===s)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===s){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,r=[t[0][0],t[0][t[0].length-2]],r=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,s=r.length;n=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):"Polygon"===s&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new Wm([e])):"MultiLineString"===this.type_?t.setGeometry(new Xm([e])):"MultiPolygon"===this.type_&&t.setGeometry(new Km([e])),this.dispatchEvent(new sy(ny,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new sy(ry,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;er?o[1]:o[0]),a}}return null}handlePointerMove_(t){const e=t.pixel,i=t.map;let n=this.snapToVertex_(e,i);n||(n=i.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)}createOrUpdateExtentFeature_(t){let e=this.extentFeature_;return e?t?e.setGeometry(Nr(t)):e.setGeometry(void 0):(e=new Ot(t?Nr(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e}createOrUpdatePointerFeature_(t){let e=this.vertexFeature_;if(e){e.getGeometry().setCoordinates(t)}else e=new Ot(new dr(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e);return e}handleEvent(t){return!t.originalEvent||!this.condition_(t)||(t.type!=Ro.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(t),super.handleEvent(t),!1)}handleDownEvent(t){const e=t.pixel,i=t.map,n=this.getExtentInternal();let r=this.snapToVertex_(e,i);const s=function(t){let e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(r&&n){const t=r[0]==n[0]||r[0]==n[2]?r[0]:null,e=r[1]==n[1]||r[1]==n[3]?r[1]:null;null!==t&&null!==e?this.pointerHandler_=Sy(s(r)):null!==t?this.pointerHandler_=wy(s([t,n[1]]),s([t,n[3]])):null!==e&&(this.pointerHandler_=wy(s([n[0],e]),s([n[2],e])))}else r=i.getCoordinateFromPixelInternal(e),this.setExtent([r[0],r[1],r[0],r[1]]),this.pointerHandler_=Sy(r);return!0}handleDragEvent(t){if(this.pointerHandler_){const e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}}handleUpEvent(t){this.pointerHandler_=null;const e=this.getExtentInternal();return e&&0!==Ce(e)||this.setExtent(null),!1}setMap(t){this.extentOverlay_.setMap(t),this.vertexOverlay_.setMap(t),super.setMap(t)}getExtent(){return En(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.extent_}setExtent(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new yy(this.extent_))}};function Ey(t){return parseFloat(t)}function Cy(t){return function(t){return Ci(t,5)}(t).toString()}function Ry(t,e){return!isNaN(t)&&t!==Ey(Cy(e))}var by=class extends Sa{constructor(t){let e;super(),e=!0===(t=Object.assign({animate:!0,params:["x","y","z","r","l"],replace:!1,prefix:""},t||{})).animate?{duration:250}:t.animate?t.animate:null,this.animationOptions_=e,this.params_=t.params.reduce(((t,e)=>(t[e]=!0,t)),{}),this.replace_=t.replace,this.prefix_=t.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this)}getParamName_(t){return this.prefix_?this.prefix_+t:t}get_(t,e){return t.get(this.getParamName_(e))}set_(t,e,i){e in this.params_&&t.set(this.getParamName_(e),i)}delete_(t,e){e in this.params_&&t.delete(this.getParamName_(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.unregisterListeners_(e),t&&(this.initial_=!0,this.updateState_(),this.registerListeners_(t)))}registerListeners_(t){this.listenerKeys_.push(N(t,Oo,this.updateUrl_,this),N(t.getLayerGroup(),w,this.updateUrl_,this),N(t,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(t){for(let t=0,e=this.listenerKeys_.length;t=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n=0;--t)this.insertVertex_(r[t],s)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n.getCenter(),r=i.featureSegments[0],s=i.featureSegments[1];r.segment[0]=e,r.segment[1]=e,s.segment[0]=e,s.segment[1]=e,this.rBush_.update(fe(e),r);let o=n;const a=Sn();if(a){const e=t.map.getView().getProjection();o=o.clone().transform(a,e),o=Dr(o).transform(e,a)}this.rBush_.update(o.getExtent(),s)}else this.rBush_.update(ne(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new My(Fy,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),s=function(t,e){return Oy(n,t,r)-Oy(n,e,r)};let o,a;if(this.hitDetection_){const i="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{const n=i||t.getGeometry();if("Point"===n.getType()&&t instanceof Ot&&this.features_.getArray().includes(t)){a=n;const e=a.getFlatCoordinates().slice(0,2);o=[{feature:t,geometry:a,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!o){const t=En(re(Cn(fe(n,Py),r),e.getView().getResolution()*this.pixelTolerance_,Py),r);o=this.rBush_.getInExtent(t)}if(o&&o.length>0){const i=o.sort(s)[0],l=i.segment;let h=Ny(n,i,r);const c=e.getPixelFromCoordinate(h);let u=Bi(t,c);if(a||u<=this.pixelTolerance_){const t={};if(t[X(l)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-n[0],this.delta_[1]=h[1]-n[1]),"Circle"===i.geometry.getType()&&1===i.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(l[0]),r=e.getPixelFromCoordinate(l[1]),s=ji(c,n),a=ji(c,r);u=Math.sqrt(Math.min(s,a)),this.snappedToVertex_=u<=this.pixelTolerance_,this.snappedToVertex_&&(h=s>a?l[1]:l[0]),this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);const d={};d[X(i.geometry)]=!0;for(let e=1,i=o.length;e=0;--o)r=t[o],u=r[0],d=X(u.feature),u.depth&&(d+="-"+u.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=u,e[d].index=u.index):1==r[1]&&(e[d].left=u,e[d].index=u.index+1);for(d in e){switch(c=e[d].right,l=e[d].left,a=e[d].index,h=a-1,u=void 0!==l?l:c,h<0&&(h=0),s=u.geometry,n=s.getCoordinates(),i=n,g=!1,s.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),g=!0);break;case"LineString":n.length>2&&(n.splice(a,1),g=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),g=!0,0===a&&(i.pop(),i.push(i[0]),h=i.length-1))}if(g){this.setGeometryCoordinates_(s,n);const e=[];if(void 0!==l&&(this.rBush_.remove(l),e.push(l.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==l&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:h,segment:e};this.rBush_.insert(ne(t.segment),t)}this.updateSegmentIndices_(s,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return g}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||d(r.depth,i))&&r.index>e&&(r.index+=n)}))}};const ky="select";class jy extends r{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const By={};class zy extends Sa{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:Aa,this.addCondition_=t.addCondition?t.addCondition:Ma,this.removeCondition_=t.removeCondition?t.removeCondition:Ma,this.toggleCondition_=t.toggleCondition?t.toggleCondition:Na,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:f,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=gf();return u(t.Polygon,t.LineString),u(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new H,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=f;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[X(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[X(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(Z,this.boundAddFeature_),this.features_.addEventListener(Y,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(Z,this.boundAddFeature_),this.features_.removeEventListener(Y,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find((function(t){if(t instanceof i_&&t.getSource()&&t.getSource().hasFeature(e))return t}));t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=X(t);e in By||(By[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof zy&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=X(t);t.setStyle(By[i]),delete By[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[X(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,o=this.getFeatures(),a=[],l=[];if(r){x(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof Ot&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);i>-1?l.splice(i,1):(o.remove(e),a.push(e))}0!==l.length&&o.extend(l)}else{s.forEachFeatureAtPixel(t.pixel,((t,r)=>{if(t instanceof Ot&&this.filter_(t,r))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,r),l.push(t)),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new jy(ky,l,a,t)),!0}}var Uy=zy;function Xy(t){return t.feature?t.feature:t.element?t.element:void 0}const Vy=[];var Wy=class extends Ea{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=f),e.stopDown||(e.stopDown=p),super(e),this.source_=t.source?t.source:null,this.vertex_=void 0===t.vertex||t.vertex,this.edge_=void 0===t.edge||t.edge,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.rBush_=new ic,this.GEOMETRY_SEGMENTERS_={Point:this.segmentPointGeometry_.bind(this),LineString:this.segmentLineStringGeometry_.bind(this),LinearRing:this.segmentLineStringGeometry_.bind(this),Polygon:this.segmentPolygonGeometry_.bind(this),MultiPoint:this.segmentMultiPointGeometry_.bind(this),MultiLineString:this.segmentMultiLineStringGeometry_.bind(this),MultiPolygon:this.segmentMultiPolygonGeometry_.bind(this),GeometryCollection:this.segmentGeometryCollectionGeometry_.bind(this),Circle:this.segmentCircleGeometry_.bind(this)}}addFeature(t,e){e=void 0===e||e;const i=X(t),n=t.getGeometry();if(n){const e=this.GEOMETRY_SEGMENTERS_[n.getType()];if(e){this.indexedFeaturesExtents_[i]=n.getExtent([1/0,1/0,-1/0,-1/0]);const r=[];if(e(r,n),1===r.length)this.rBush_.insert(ne(r[0]),{feature:t,segment:r[0]});else if(r.length>1){const e=r.map((t=>ne(t))),i=r.map((e=>({feature:t,segment:e})));this.rBush_.load(e,i)}}}e&&(this.featureChangeListenerKeys_[i]=N(t,w,this.handleFeatureChange_,this))}forEachFeatureAdd_(t){this.addFeature(t)}forEachFeatureRemove_(t){this.removeFeature(t)}getFeatures_(){let t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e&&(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel),super.handleEvent(t)}handleFeatureAdd_(t){const e=Xy(t);this.addFeature(e)}handleFeatureRemove_(t){const e=Xy(t);this.removeFeature(e)}handleFeatureChange_(t){const e=t.target;if(this.handlingDownUpSequence){const t=X(e);t in this.pendingFeatures_||(this.pendingFeatures_[t]=e)}else this.updateFeature_(e)}handleUpEvent(t){const e=Object.values(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1}removeFeature(t,e){const i=void 0===e||e,n=X(t),r=this.indexedFeaturesExtents_[n];if(r){const e=this.rBush_,i=[];e.forEachInExtent(r,(function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t)e.remove(i[t])}i&&(G(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(t){const e=this.getMap(),i=this.featuresListenerKeys_,n=this.getFeatures_();e&&(i.forEach(G),i.length=0,n.forEach(this.forEachFeatureRemove_.bind(this))),super.setMap(t),t&&(this.features_?i.push(N(this.features_,Z,this.handleFeatureAdd_,this),N(this.features_,Y,this.handleFeatureRemove_,this)):this.source_&&i.push(N(this.source_,nc,this.handleFeatureAdd_,this),N(this.source_,oc,this.handleFeatureRemove_,this)),n.forEach(this.forEachFeatureAdd_.bind(this)))}snapTo(t,e,i){const n=i.getView().getProjection(),r=Tn(e,n),s=En(re(ne([r]),i.getView().getResolution()*this.pixelTolerance_),n),o=this.rBush_.getInExtent(s),a=o.length;if(0===a)return null;let l,h=1/0;const c=this.pixelTolerance_*this.pixelTolerance_,u=()=>{if(l){const e=i.getPixelFromCoordinate(l);if(ji(t,e)<=c)return{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])]}}return null};if(this.vertex_){for(let t=0;t{const e=Tn(t,n),i=ji(r,e);i{t.push([e])}))}segmentMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e{if(t instanceof Ot&&this.filter_(t,e)&&(!this.features_||this.features_.getArray().includes(t)))return t}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}};function $y(t,e,i,n,r,s){void 0!==r?s=void 0!==s?s:0:(r=[],s=0);let o=e;for(;o=0;e--)r.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:r}}};function ix(t,e){if(!t)return null;let i;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths){i=1===t.paths.length?"LineString":"MultiLineString"}else if(t.rings){const e=t,n=nx(e),r=function(t,e){const i=[],n=[],r=[];let s,o;for(s=0,o=t.length;s=0;s--){const i=n[s][0];if(le(new cr(i).getExtent(),new cr(t).getExtent())){n[s].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===r.length?(i="Polygon",t=Object.assign({},t,{rings:r[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:r}))}return p_((0,tx[i])(t),!1,e)}function nx(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function rx(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function sx(t,e){return(0,ex[t.getType()])(p_(t,!0,e),e)}var ox=class extends Qy{constructor(t){t=t||{},super(),this.geometryName_=t.geometryName}readFeatureFromObject(t,e,i){const n=t,r=ix(n.geometry,e),s=new Ot;if(this.geometryName_&&s.setGeometryName(this.geometryName_),s.setGeometry(r),n.attributes){s.setProperties(n.attributes,!0);const t=n.attributes[i];void 0!==t&&s.setId(t)}return s}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let r=0,s=n.length;r0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=ad(t);return this.readFeaturesFromDocument(i,e)}return sd(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&u(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return z()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=ad(t);return this.readGeometryFromDocument(i,e)}return sd(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(!t)return null;if("string"==typeof t){const e=ad(t);return this.readProjectionFromDocument(e)}return sd(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(t,e){return null}};const lx="http://www.opengis.net/gml",hx=/^\s*$/;class cx extends ax{constructor(t){super(),t=t||{},this.featureType=t.featureType,this.featureNS=t.featureNS,this.srsName=t.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:hd(this.readFeaturesInternal),featureMembers:cd(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(t,e){const i=t.localName;let n=null;if("FeatureCollection"==i)n=vd([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i||"member"==i){const r=e[0];let s=r.featureType,o=r.featureNS;const a="p",l="p0";if(!s&&t.childNodes){s=[],o={};for(let e=0,i=t.childNodes.length;e0){t={_content_:t};for(let e=0;e0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=vd(void 0,kS,t,e);if(i){e[e.length-1][0]=i}}});function CS(t,e){const i=vd({},yS,t,e),n=vd([null],ES,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i0;let o;const a=r.href;let l,h,c;a?o=a:s&&(o=Bv);let u="bottom-left";const d=i.hotSpot;let g;d?(l=[d.x,d.y],h=d.xunits,c=d.yunits,u=d.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(l=Dv,h=Gv,c=kv):o.includes("arrow-reverse")?(l=[54,42],h=Gv,c=kv):o.includes("paddle")&&(l=[32,1],h=Gv,c=kv));const f=r.x,p=r.y;let m;void 0!==f&&void 0!==p&&(g=[f,p]);const _=r.w,y=r.h;let x;void 0!==_&&void 0!==y&&(m=[_,y]);const v=i.heading;void 0!==v&&(x=wi(v));const S=i.scale,w=i.color;if(s){o==Bv&&(m=jv);const t=new of({anchor:l,anchorOrigin:u,anchorXUnits:h,anchorYUnits:c,crossOrigin:this.crossOrigin_,offset:g,offsetOrigin:"bottom-left",rotation:x,scale:S,size:m,src:this.iconUrlFunction_(o),color:w}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===Jr||i===Qr){const n=function(){const i=t.getImageState();if(i!==Jr&&i!==Qr){const i=t.getSize();if(i&&2==i.length){const n=Hv(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===Jr&&t.load()}}else if(2==i.length){const n=Hv(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=Uv},LabelStyle:function(t,e){const i=vd({},aS,t,e);if(!i)return;const n=e[e.length-1],r=new _f({fill:new Qg({color:"color"in i?i.color:Nv}),scale:i.scale});n.textStyle=r},LineStyle:function(t,e){const i=vd({},lS,t,e);if(!i)return;const n=e[e.length-1],r=new lf({color:"color"in i?i.color:Nv,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=vd({},hS,t,e);if(!i)return;const n=e[e.length-1],r=new Qg({color:"color"in i?i.color:Nv});n.fillStyle=r;const s=i.fill;void 0!==s&&(n.fill=s);const o=i.outline;void 0!==o&&(n.outline=o)}});function bS(t,e){const i=vd({},RS,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:zv;const r=i.fill;let s;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=Uv&&(s=i.imageStyle):s=Xv;const o="textStyle"in i?i.textStyle:Zv,a="strokeStyle"in i?i.strokeStyle:Wv,l=i.outline;return void 0===l||l?[new pf({fill:n,image:s,stroke:a,text:o,zIndex:void 0})]:[new pf({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Dm(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:s,stroke:a,text:o,zIndex:void 0}),new pf({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Dm(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function PS(t,e){const i=e.length,n=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let t=0;t0){const t=_d(r,o);wd(n,hw,uw,[{names:o,values:t}],i)}const u=i[0];let d=e.getGeometry();d&&(d=p_(d,!0,u)),wd(n,hw,tw,[d],i)}const gw=yd(bv,["extrude","tessellate","altitudeMode","coordinates"]),fw=yd(bv,{extrude:gd(vx),tessellate:gd(vx),altitudeMode:gd(Cx),coordinates:gd((function(t,e,i){const n=i[i.length-1],r=n.layout,s=n.stride;let o;"XY"==r||"XYM"==r?o=2:"XYZ"==r||"XYZM"==r?o=3:Ft(!1,34);const a=e.length;let l="";if(a>0){l+=e[0];for(let t=1;t0;else{const e=t.getType();a="Point"===e||"MultiPoint"===e}}a&&(l=s.get("name"),a=a&&!!l,a&&/&[^&]+;/.test(l)&&(Kv||(Kv=document.createElement("textarea")),Kv.innerHTML=l,l=Kv.value));let c=i;if(t?c=t:e&&(c=Jv(e,i,n)),a){const t=function(t,e){const i=[0,0];let n="start";const r=t.getImage();if(r){const t=r.getSize();if(t&&2==t.length){const e=r.getScaleArray(),s=r.getAnchor();i[0]=e[0]*(t[0]-s[0]),i[1]=e[1]*(t[1]/2-s[1]),n="left"}}let s=t.getText();s?(s=s.clone(),s.setFont(s.getFont()||Zv.getFont()),s.setScale(s.getScale()||Zv.getScale()),s.setFill(s.getFill()||Zv.getFill()),s.setStroke(s.getStroke()||Vv)):s=Zv.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);return new pf({image:r,text:s})}(c[0],l);if(h.length>0){t.setGeometry(new Dm(h));return[t,new pf({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null})].concat(c.slice(1))}return t}return c}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(t)}return delete i.Style,n.setProperties(i,!0),n}readSharedStyle_(t,e){const i=t.getAttribute("id");if(null!==i){const n=bS.call(this,t,e);if(n){let e,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){e=new URL("#"+i,r).href}else e="#"+i;this.sharedStyles_[e]=n}}}readSharedStyleMap_(t,e){const i=t.getAttribute("id");if(null===i)return;const n=sS.call(this,t,e);if(!n)return;let r,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){r=new URL("#"+i,s).href}else r="#"+i;this.sharedStyles_[r]=n}readFeatureFromNode(t,e){if(!bv.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!bv.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&u(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=ad(t);return this.readNameFromDocument(e)}return sd(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(bv.includes(e.namespaceURI)&&"name"==e.localName)return xx(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(bv.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=ad(t);u(e,this.readNetworkLinksFromDocument(i))}else sd(t)?u(e,this.readNetworkLinksFromDocument(t)):u(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&u(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(bv.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=vd({},Lv,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!bv.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||u(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=ad(t);u(e,this.readRegionFromDocument(i))}else sd(t)?u(e,this.readRegionFromDocument(t)):u(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&u(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(bv.includes(i.namespaceURI)&&"Region"==i.localName){const t=vd({},Mv,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!bv.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||u(e,this.readRegionFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=id(bv[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",Rv[0]),i.setAttributeNS(n,"xmlns:xsi",ed),i.setAttributeNS(ed,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const r={node:i},s={};t.length>1?s.Document=t:1==t.length&&(s.Placemark=t[0]);const o=Av[i.namespaceURI],a=_d(s,o);return wd(r,Ov,md,a,[e],o,this),i}};const Rw=[null],bw=yd(Rw,{nd:function(t,e){e[e.length-1].ndrefs.push(t.getAttribute("ref"))},tag:Lw}),Pw=yd(Rw,{node:function(t,e){const i=e[0],n=e[e.length-1],r=t.getAttribute("id"),s=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))];n.nodes[r]=s;const o=vd({tags:{}},Iw,t,e);if(!v(o.tags)){const t=new dr(s);p_(t,!1,i);const e=new Ot(t);void 0!==r&&e.setId(r),e.setProperties(o.tags,!0),n.features.push(e)}},way:function(t,e){const i=vd({id:t.getAttribute("id"),ndrefs:[],tags:{}},bw,t,e);e[e.length-1].ways.push(i)}});const Iw=yd(Rw,{tag:Lw});function Lw(t,e){e[e.length-1].tags[t.getAttribute("k")]=t.getAttribute("v")}var Fw=class extends ax{constructor(){super(),this.dataProjection=an("EPSG:4326")}readFeaturesFromNode(t,e){if(e=this.getReadOptions(t,e),"osm"==t.localName){const i=vd({nodes:{},ways:[],features:[]},Pw,t,[e]);for(let t=0;t>1):i>>1}return e}function iT(t){let e="";for(let i=0,n=t.length;i=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e),i}var sT=class extends vv{constructor(t){super(),t=t||{},this.dataProjection=an("EPSG:4326"),this.factor_=t.factor?t.factor:1e5,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY"}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e);return new Ot(i)}readFeaturesFromText(t,e){return[this.readFeatureFromText(t,e)]}readGeometryFromText(t,e){const i=Dn(this.geometryLayout_),n=$w(t,i,this.factor_);$y(n,0,n.length,i,n);const r=nr(n,0,n.length,i);return p_(new zm(r,this.geometryLayout_),!1,this.adaptOptions(e))}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):(Ft(!1,40),"")}writeFeaturesText(t,e){return this.writeFeatureText(t[0],e)}writeGeometryText(t,e){const i=(t=p_(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return $y(i,0,i.length,n,i),Hw(i,n,this.factor_)}};const oT={Point:function(t,e,i){const n=t.coordinates;e&&i&&uT(n,e,i);return new dr(n)},LineString:function(t,e){const i=aT(t.arcs,e);return new zm(i)},Polygon:function(t,e){const i=[];for(let n=0,r=t.arcs.length;n0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e=0;--e)i.push(t[e].slice(0))}return i}function lT(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t=2,57)}};var pT=class extends fT{constructor(t){super("And",Array.prototype.slice.call(arguments))}};var mT=class extends gT{constructor(t,e,i){if(super("BBOX"),this.geometryName=t,this.extent=e,4!==e.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");this.srsName=i}};var _T=class extends gT{constructor(t,e,i,n){super(t),this.geometryName=e||"the_geom",this.geometry=i,this.srsName=n}};var yT=class extends _T{constructor(t,e,i){super("Contains",t,e,i)}};var xT=class extends _T{constructor(t,e,i,n,r){super("DWithin",t,e,r),this.distance=i,this.unit=n}};var vT=class extends _T{constructor(t,e,i){super("Disjoint",t,e,i)}};var ST=class extends gT{constructor(t,e){super(t),this.propertyName=e}};var wT=class extends ST{constructor(t,e,i){super("During",t),this.begin=e,this.end=i}};var TT=class extends ST{constructor(t,e,i,n){super(t,e),this.expression=i,this.matchCase=n}};var ET=class extends TT{constructor(t,e,i){super("PropertyIsEqualTo",t,e,i)}};var CT=class extends TT{constructor(t,e){super("PropertyIsGreaterThan",t,e)}};var RT=class extends TT{constructor(t,e){super("PropertyIsGreaterThanOrEqualTo",t,e)}};var bT=class extends _T{constructor(t,e,i){super("Intersects",t,e,i)}};var PT=class extends ST{constructor(t,e,i){super("PropertyIsBetween",t),this.lowerBoundary=e,this.upperBoundary=i}};var IT=class extends ST{constructor(t,e,i,n,r,s){super("PropertyIsLike",t),this.pattern=e,this.wildCard=void 0!==i?i:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==r?r:"!",this.matchCase=s}};var LT=class extends ST{constructor(t){super("PropertyIsNull",t)}};var FT=class extends TT{constructor(t,e){super("PropertyIsLessThan",t,e)}};var MT=class extends TT{constructor(t,e){super("PropertyIsLessThanOrEqualTo",t,e)}};var AT=class extends gT{constructor(t){super("Not"),this.condition=t}};var OT=class extends TT{constructor(t,e,i){super("PropertyIsNotEqualTo",t,e,i)}};var NT=class extends fT{constructor(t){super("Or",Array.prototype.slice.call(arguments))}};var DT=class extends gT{constructor(t){super("ResourceId"),this.rid=t}};var GT=class extends _T{constructor(t,e,i){super("Within",t,e,i)}};function kT(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(pT,e))}function jT(t,e,i){return new mT(t,e,i)}const BT={"http://www.opengis.net/gml":{boundedBy:dd(ux.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:hd(ux.prototype.readFeaturesInternal)}},zT={"http://www.opengis.net/wfs":{totalInserted:dd(_x),totalUpdated:dd(_x),totalDeleted:dd(_x)},"http://www.opengis.net/wfs/2.0":{totalInserted:dd(_x),totalUpdated:dd(_x),totalDeleted:dd(_x)}},UT={"http://www.opengis.net/wfs":{TransactionSummary:dd(QT,"transactionSummary"),InsertResults:dd(nE,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:dd(QT,"transactionSummary"),InsertResults:dd(nE,"insertIds")}},XT={"http://www.opengis.net/wfs":{PropertyName:gd(Cx)},"http://www.opengis.net/wfs/2.0":{PropertyName:gd(Cx)}},VT={"http://www.opengis.net/wfs":{Insert:gd(rE),Update:gd(lE),Delete:gd(aE),Property:gd(hE),Native:gd(cE)},"http://www.opengis.net/wfs/2.0":{Insert:gd(rE),Update:gd(lE),Delete:gd(aE),Property:gd(hE),Native:gd(cE)}},WT="feature",ZT="http://www.w3.org/2000/xmlns/",YT={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},KT={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},qT={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},HT={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},$T={"2.0.0":Nx,"1.1.0":Fx,"1.0.0":Px};function JT(t,e,i,n){wd(n,VT,pd(t),e,i)}function QT(t,e){return vd({},zT,t,e)}const tE={"http://www.opengis.net/ogc":{FeatureId:hd((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:hd((function(t,e){return t.getAttribute("fid")}))}};function eE(t,e){xd(tE,t,e)}const iE={"http://www.opengis.net/wfs":{Feature:eE},"http://www.opengis.net/wfs/2.0":{Feature:eE}};function nE(t,e){return vd([],iE,t,e)}function rE(t,e,i){const n=i[i.length-1],r=n.featureType,s=n.featureNS,o=n.gmlVersion,a=id(s,r);t.appendChild(a),2===o?Px.prototype.writeFeatureElement(a,e,i):3===o?Fx.prototype.writeFeatureElement(a,e,i):Nx.prototype.writeFeatureElement(a,e,i)}function sE(t,e,i){const n=i[i.length-1].version,r=YT[n],s=id(r,"Filter"),o=id(r,"FeatureId");s.appendChild(o),o.setAttribute("fid",e),t.appendChild(s)}function oE(t,e){const i=(t=t||WT)+":";return e.startsWith(i)?e:i+e}function aE(t,e,i){const n=i[i.length-1];Ft(void 0!==e.getId(),26);const r=n.featureType,s=n.featurePrefix,o=n.featureNS,a=oE(s,r);t.setAttribute("typeName",a),t.setAttributeNS(ZT,"xmlns:"+s,o);const l=e.getId();void 0!==l&&sE(t,l,i)}function lE(t,e,i){const n=i[i.length-1];Ft(void 0!==e.getId(),27);const r=n.version,s=n.featureType,o=n.featurePrefix,a=n.featureNS,l=oE(o,s),h=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(ZT,"xmlns:"+o,a);const c=e.getId();if(void 0!==c){const s=e.getKeys(),o=[];for(let t=0,i=s.length;t{const r=this.combineBboxAndFilter(n.geometryName,n.bbox,t.srsName,t.filter);Object.assign(i,{geometryName:n.geometryName,filter:r}),PE(e,[n.name],[i])}));return e}combineBboxAndFilter(t,e,i,n){const r=jT(t,e,i);return n?kT(n,r):r}writeTransaction(t,e,i,n){const r=[],s=n.version?n.version:this.version_,o=id(KT[s],"Transaction");let a;o.setAttribute("service","WFS"),o.setAttribute("version",s),n&&(a=n.gmlOptions?n.gmlOptions:{},n.handle&&o.setAttribute("handle",n.handle)),o.setAttributeNS(ed,"xsi:schemaLocation",HT[s]);const l=function(t,e,i,n){const r=n.featurePrefix?n.featurePrefix:WT;let s;"1.0.0"===i?s=2:"1.1.0"===i?s=3:"2.0.0"===i&&(s=3.2);return Object.assign({node:t},{version:i,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:r,gmlVersion:s,hasZ:n.hasZ,srsName:n.srsName},e)}(o,a,s,n);return t&&JT("Insert",t,r,l),e&&JT("Update",e,r,l),i&&JT("Delete",i,r,l),n.nativeElements&&JT("Native",n.nativeElements,r,l),o}readProjectionFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null}readProjectionFromNode(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(let e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){const t=[{}];return this.gmlFormat_.readGeometryElement(e,t),an(t.pop().srsName)}return null}};const FE=1,ME=2,AE=3,OE=4,NE=5,DE=6,GE=7,kE=15,jE=16,BE=17;class zE{constructor(t){this.view_=t,this.pos_=0,this.initialized_=!1,this.isLittleEndian_=!1,this.hasZ_=!1,this.hasM_=!1,this.srid_=null,this.layout_="XY"}readUint8(){return this.view_.getUint8(this.pos_++)}readUint32(t){return this.view_.getUint32((this.pos_+=4)-4,void 0!==t?t:this.isLittleEndian_)}readDouble(t){return this.view_.getFloat64((this.pos_+=8)-8,void 0!==t?t:this.isLittleEndian_)}readPoint(){const t=[];return t.push(this.readDouble()),t.push(this.readDouble()),this.hasZ_&&t.push(this.readDouble()),this.hasM_&&t.push(this.readDouble()),t}readLineString(){const t=this.readUint32(),e=[];for(let i=0;i0,i=this.readUint32(e),n=Math.floor((268435455&i)/1e3),r=Boolean(2147483648&i)||1===n||3===n,s=Boolean(1073741824&i)||2===n||3===n,o=Boolean(536870912&i),a=(268435455&i)%1e3,l=["XY",r?"Z":"",s?"M":""].join(""),h=o?this.readUint32(e):null;if(void 0!==t&&t!==a)throw new Error("Unexpected WKB geometry type "+a);if(this.initialized_){if(this.isLittleEndian_!==e)throw new Error("Inconsistent endian");if(this.layout_!==l)throw new Error("Inconsistent geometry layout");if(h&&this.srid_!==h)throw new Error("Inconsistent coordinate system (SRID)")}else this.isLittleEndian_=e,this.hasZ_=r,this.hasM_=s,this.layout_=l,this.srid_=h,this.initialized_=!0;return a}readWkbPayload(t){switch(t){case FE:return this.readPoint();case ME:return this.readLineString();case AE:case BE:return this.readPolygon();case OE:return this.readMultiPoint();case NE:return this.readMultiLineString();case DE:case kE:case jE:return this.readMultiPolygon();case GE:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+t+" is found")}}readWkbBlock(t){return this.readWkbPayload(this.readWkbHeader(t))}readWkbCollection(t,e){const i=this.readUint32(),n=[];for(let r=0;r({[e]:t[i]}))));for(const t of this.layout_)this.writeDouble(t in i?i[t]:this.nodata_[t])}writeLineString(t,e){this.writeUint32(t.length);for(let i=0;it+e[0]),0),e=new ArrayBuffer(t),i=new DataView(e);let n=0;return this.writeQueue_.forEach((t=>{switch(t[0]){case 1:i.setUint8(n,t[1]);break;case 4:i.setUint32(n,t[1],this.isLittleEndian_);break;case 8:i.setFloat64(n,t[1],this.isLittleEndian_)}n+=t[0]})),e}}function XE(t){return"string"==typeof t?function(t){const e=new Uint8Array(t.length/2);for(let i=0;inew Ot({geometry:t})))}readGeometry(t,e){const i=XE(t);if(!i)return null;const n=new zE(i).readGeometry();return this.viewCache_=i,e=this.getReadOptions(t,e),this.viewCache_=null,p_(n,!1,e)}readProjection(t){const e=this.viewCache_||XE(t);if(!e)return;const i=new zE(e);return i.readWkbHeader(),i.getSrid()&&an("EPSG:"+i.getSrid())||void 0}writeFeature(t,e){return this.writeGeometry(t.getGeometry(),e)}writeFeatures(t,e){return this.writeGeometry(new Dm(t.map((t=>t.getGeometry()))),e)}writeGeometry(t,e){e=this.adaptOptions(e);const i=new UE({layout:this.layout_,littleEndian:this.littleEndian_,ewkb:this.ewkb_,nodata:{Z:this.nodataZ_,M:this.nodataM_}});let n=Number.isInteger(this.srid_)?Number(this.srid_):null;if(!1!==this.srid_&&!Number.isInteger(this.srid_)){const t=e.dataProjection&&an(e.dataProjection);if(t){const e=t.getCode();e.startsWith("EPSG:")&&(n=Number(e.substring(5)))}}i.writeGeometry(p_(t,!0,e),n);const r=i.getBuffer();return this.hex_?function(t){const e=new Uint8Array(t);return Array.from(e.values()).map((t=>(t<16?"0":"")+Number(t).toString(16).toUpperCase())).join("")}(r):r}};const WE={POINT:dr,LINESTRING:zm,POLYGON:Ar,MULTIPOINT:Wm,MULTILINESTRING:Xm,MULTIPOLYGON:Km},ZE="EMPTY",YE=0,KE=1,qE=2,HE=3,$E=4,JE=5,QE=6,tC={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class eC{constructor(t){this.wkt=t,this.index_=-1}isAlpha_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=qE;else if(","==t)i=JE;else if(")"==t)i=HE;else if(this.isNumeric_(t)||"-"==t)i=$E,n=this.readNumber_();else if(this.isAlpha_(t))i=KE,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=QE}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class iC{constructor(t){this.lexer_=t,this.token_={position:0,type:YE},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(KE)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(qE)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(JE));if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(qE)){const t=this.parsePoint_();if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(qE)){const t=this.parsePointList_();if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(qE)){const t=this.parseLineStringTextList_();if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(qE)){let t;if(t=this.token_.type==qE?this.parsePointTextList_():this.parsePointList_(),this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(qE)){const t=this.parseLineStringTextList_();if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(qE)){const t=this.parsePolygonTextList_();if(this.match(HE))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i0&&(n+=" "+e)}return 0===i.length?n+" "+ZE:n+"("+i+")"}var lC=class extends vv{constructor(t){super(),t=t||{},this.splitCollection_=void 0!==t.splitCollection&&t.splitCollection}parse_(t){const e=new eC(t);return new iC(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),n=new Ot;return n.setGeometry(i),n}readFeaturesFromText(t,e){let i=[];const n=this.readGeometryFromText(t,e);i=this.splitCollection_&&"GeometryCollection"==n.getType()?n.getGeometriesArray():[n];const r=[];for(let t=0,e=i.length;tc*oR||h>u*oR?this.resetExtent_():le(s,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2;Be(n,1/(Math.pow(2,s/2)*aR)),r.fitInternal(Nr(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenterInternal(),h=n.getResolution(),c=r.getResolution(),u=i[0]*h/c,d=i[1]*h/c;if(o.setPosition(l),a){a.style.width=u+"px",a.style.height=d+"px";const t="rotate("+s+"rad)";a.style.transform=t}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=D(this.ovmap_,Mo,(function(t){delete this.ovmapPostrenderKey_,this.updateBox_()}),this))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(Ys),this.collapsed_?St(this.collapseLabel_,this.label_):St(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}};const hR="units",cR=[1,2,5],uR=25.4/.28;var dR=class extends ga{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+Vs,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(hR,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(hR)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(hR,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let s=ln(i,t.resolution,e,r);const o=this.minWidth_*(this.dpi_||uR)/uR,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||uR)/uR:void 0;let l=o*s,h="";if("degrees"==n){const t=Ye.degrees;l*=t,l=a){c=g,u=f,d=p;break}if(u>=o)break;g=c,f=u,p=d,++m}const _=this.scaleBar_?this.createScaleBar(u,c,h):c.toFixed(d<0?-d:0)+" "+h;this.renderedHTML_!=_&&(this.innerElement_.innerHTML=_,this.renderedHTML_=_),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n
`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"")}a.push(this.createStepText(s,t,!0,e,i));return(this.scaleBarText_?`
`+r+"
":"")+a.join("")}createMarker(t){return`
`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`
`+s+"
"}getScaleForResolution(){return ln(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||uR)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}};const gR=0,fR=1;var pR=class extends ga{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=gR,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+Vs;const r=this.element;r.className=e+" "+"ol-unselectable "+Zs,r.appendChild(i),r.addEventListener(Po,this.handleDraggerStart_.bind(this),!1),r.addEventListener(bo,this.handleDraggerDrag_.bind(this),!1),r.addEventListener(Io,this.handleDraggerEnd_.bind(this),!1),r.addEventListener(C,this.handleContainerClick_.bind(this),!1),i.addEventListener(C,n,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=fR,this.widthLimit_=e-o):(this.direction_=gR,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:nt})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(N(i,bo,t,this),N(i,Io,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){if(this.dragging_){this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0}}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==fR?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=this.direction_===fR?t/this.widthLimit_:e/this.heightLimit_,_i(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){return _i(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}};var mR=class extends ga{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.extent=t.extent?t.extent:null;const e=void 0!==t.className?t.className:"ol-zoom-extent",i=void 0!==t.label?t.label:"E",n=void 0!==t.tipLabel?t.tipLabel:"Fit to extent",r=document.createElement("button");r.setAttribute("type","button"),r.title=n,r.appendChild("string"==typeof i?document.createTextNode(i):i),r.addEventListener(C,this.handleClick_.bind(this),!1);const s=e+" "+"ol-unselectable "+Zs,o=this.element;o.className=s,o.appendChild(r)}handleClick_(t){t.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(Nr(e))}},_R={};return _R.AssertionError=i,_R.Collection=H,_R.Collection.CollectionEvent=q,_R.DataTile=Lt,_R.DataTile.asArrayLike=Rt,_R.DataTile.asImageLike=Ct,_R.DataTile.toArray=Pt,_R.Disposable=o,_R.Feature=Ot,_R.Feature.createStyleFunction=At,_R.Geolocation=Hr,_R.Geolocation.GeolocationError=qr,_R.Image=rs,_R.Image.listenImage=ns,_R.ImageBase=$r,_R.ImageCanvas=ss,_R.ImageTile=os,_R.Kinetic=as,_R.Map=ul,_R.MapBrowserEvent=Co,_R.MapBrowserEventHandler=Fo,_R.MapEvent=Eo,_R.Object=W,_R.Object.ObjectEvent=V,_R.Observable=B,_R.Observable.unByKey=j,_R.Overlay=_l,_R.Tile=ot,_R.TileCache=Rl,_R.TileQueue=Xo,_R.TileQueue.getTilePriority=Vo,_R.TileRange=Il,_R.TileRange.createOrUpdate=Pl,_R.VectorRenderTile=Fl,_R.VectorTile=Ml,_R.View=da,_R.View.createCenterConstraint=aa,_R.View.createResolutionConstraint=la,_R.View.createRotationConstraint=ha,_R.View.isNoopAnimation=ca,_R.array={},_R.array.ascending=l,_R.array.binarySearch=a,_R.array.equals=d,_R.array.extend=u,_R.array.isSorted=g,_R.array.linearFindNearest=h,_R.array.remove=function(t,e){const i=t.indexOf(e),n=i>-1;return n&&t.splice(i,1),n},_R.array.reverseSubArray=c,_R.array.stableSort=function(t,e){const i=t.length,n=Array(t.length);let r;for(r=0;rHi.info||console.log(...t)},_R.console.setLevel=function(t){$i=Hi[t]},_R.console.warn=Ji,_R.control={},_R.control.Attribution=fa,_R.control.Control=ga,_R.control.FullScreen=iR,_R.control.MousePosition=sR,_R.control.OverviewMap=lR,_R.control.Rotate=pa,_R.control.ScaleLine=dR,_R.control.Zoom=ma,_R.control.ZoomSlider=pR,_R.control.ZoomToExtent=mR,_R.control.defaults={},_R.control.defaults.defaults=_a,_R.coordinate={},_R.coordinate.add=Fi,_R.coordinate.closestOnCircle=Mi,_R.coordinate.closestOnSegment=Ai,_R.coordinate.createStringXY=function(t){return function(e){return Ui(e,t)}},_R.coordinate.degreesToStringHDMS=Oi,_R.coordinate.distance=Bi,_R.coordinate.equals=Di,_R.coordinate.format=Ni,_R.coordinate.getWorldsAway=Vi,_R.coordinate.rotate=Gi,_R.coordinate.scale=ki,_R.coordinate.squaredDistance=ji,_R.coordinate.squaredDistanceToSegment=zi,_R.coordinate.toStringHDMS=function(t,e){return t?Oi("NS",t[1],e)+" "+Oi("EW",t[0],e):""},_R.coordinate.toStringXY=Ui,_R.coordinate.wrapX=Xi,_R.css={},_R.css.CLASS_COLLAPSED=Ys,_R.css.CLASS_CONTROL=Zs,_R.css.CLASS_HIDDEN=Us,_R.css.CLASS_SELECTABLE=Xs,_R.css.CLASS_UNSELECTABLE=Vs,_R.css.CLASS_UNSUPPORTED=Ws,_R.css.getFontParameters=Hs,_R.dom={},_R.dom.createCanvasContext2D=_t,_R.dom.outerHeight=vt,_R.dom.outerWidth=xt,_R.dom.releaseCanvas=yt,_R.dom.removeChildren=Tt,_R.dom.removeNode=wt,_R.dom.replaceChildren=Et,_R.dom.replaceNode=St,_R.easing={},_R.easing.easeIn=it,_R.easing.easeOut=nt,_R.easing.inAndOut=rt,_R.easing.linear=st,_R.easing.upAndDown=function(t){return t<.5?rt(2*t):1-rt(2*(t-.5))},_R.events={},_R.events.Event=r,_R.events.Event.preventDefault=function(t){t.preventDefault()},_R.events.Event.stopPropagation=n,_R.events.Target=S,_R.events.condition={},_R.events.condition.all=Ca,_R.events.condition.altKeyOnly=Ra,_R.events.condition.altShiftKeysOnly=ba,_R.events.condition.always=La,_R.events.condition.click=function(t){return t.type==Ro.CLICK},_R.events.condition.doubleClick=function(t){return t.type==Ro.DBLCLICK},_R.events.condition.focus=Pa,_R.events.condition.focusWithTabindex=Ia,_R.events.condition.mouseActionButton=Fa,_R.events.condition.mouseOnly=Ga,_R.events.condition.never=Ma,_R.events.condition.noModifierKeys=Oa,_R.events.condition.penOnly=function(t){const e=t.originalEvent;return Ft(void 0!==e,56),"pen"===e.pointerType},_R.events.condition.platformModifierKeyOnly=function(t){const e=t.originalEvent;return!e.altKey&&(dt?e.metaKey:e.ctrlKey)&&!e.shiftKey},_R.events.condition.pointerMove=function(t){return"pointermove"==t.type},_R.events.condition.primaryAction=ka,_R.events.condition.shiftKeyOnly=Na,_R.events.condition.singleClick=Aa,_R.events.condition.targetNotEditable=Da,_R.events.condition.touchOnly=function(t){const e=t.originalEvent;return Ft(void 0!==e,56),"touch"===e.pointerType},_R.events.listen=N,_R.events.listenOnce=D,_R.events.unlistenByKey=G,_R.extent={},_R.extent.applyTransform=Ue,_R.extent.approximatelyEquals=_e,_R.extent.boundingExtent=ne,_R.extent.buffer=re,_R.extent.clone=se,_R.extent.closestSquaredDistanceXY=oe,_R.extent.containsCoordinate=ae,_R.extent.containsExtent=le,_R.extent.containsXY=he,_R.extent.coordinateRelationship=ce,_R.extent.createEmpty=ue,_R.extent.createOrUpdate=de,_R.extent.createOrUpdateEmpty=ge,_R.extent.createOrUpdateFromCoordinate=fe,_R.extent.createOrUpdateFromCoordinates=function(t,e){return ve(ge(e),t)},_R.extent.createOrUpdateFromFlatCoordinates=pe,_R.extent.createOrUpdateFromRings=function(t,e){return we(ge(e),t)},_R.extent.equals=me,_R.extent.extend=ye,_R.extent.extendCoordinate=xe,_R.extent.extendCoordinates=ve,_R.extent.extendFlatCoordinates=Se,_R.extent.extendRings=we,_R.extent.extendXY=Te,_R.extent.forEachCorner=Ee,_R.extent.getArea=Ce,_R.extent.getBottomLeft=Re,_R.extent.getBottomRight=be,_R.extent.getCenter=Pe,_R.extent.getCorner=Ie,_R.extent.getEnlargedArea=function(t,e){const i=Math.min(t[0],e[0]),n=Math.min(t[1],e[1]);return(Math.max(t[2],e[2])-i)*(Math.max(t[3],e[3])-n)},_R.extent.getForViewAndSize=Le,_R.extent.getHeight=Me,_R.extent.getIntersection=Ae,_R.extent.getIntersectionArea=function(t,e){return Ce(Ae(t,e))},_R.extent.getMargin=function(t){return De(t)+Me(t)},_R.extent.getRotatedViewport=Fe,_R.extent.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]},_R.extent.getTopLeft=Oe,_R.extent.getTopRight=Ne,_R.extent.getWidth=De,_R.extent.intersects=Ge,_R.extent.intersectsSegment=ze,_R.extent.isEmpty=ke,_R.extent.returnOrUpdate=je,_R.extent.scaleFromCenter=Be,_R.extent.wrapAndSliceX=Ve,_R.extent.wrapX=Xe,_R.featureloader={},_R.featureloader.loadFeaturesXhr=Dl,_R.featureloader.setWithCredentials=function(t){Nl=t},_R.featureloader.xhr=Gl,_R.format={},_R.format.EsriJSON=ox,_R.format.Feature=f_,_R.format.Feature.transformExtentWithOptions=m_,_R.format.Feature.transformGeometryWithOptions=p_,_R.format.GML=Ax,_R.format.GML2=Px,_R.format.GML3=Fx,_R.format.GML32=Nx,_R.format.GMLBase=ux,_R.format.GMLBase.GMLNS=lx,_R.format.GPX=pv,_R.format.GeoJSON=yv,_R.format.IGC=Cv,_R.format.IIIFInfo=jc,_R.format.JSONFeature=Qy,_R.format.KML=Cw,_R.format.KML.getDefaultFillStyle=function(){return zv},_R.format.KML.getDefaultImageStyle=function(){return Xv},_R.format.KML.getDefaultStrokeStyle=function(){return Wv},_R.format.KML.getDefaultStyle=function(){return Yv},_R.format.KML.getDefaultStyleArray=function(){return qv},_R.format.KML.getDefaultTextStyle=function(){return Zv},_R.format.KML.readFlatCoordinates=tS,_R.format.MVT=X_,_R.format.OSMXML=Fw,_R.format.OWS=qw,_R.format.Polyline=sT,_R.format.Polyline.decodeDeltas=$w,_R.format.Polyline.decodeFloats=Qw,_R.format.Polyline.decodeSignedIntegers=eT,_R.format.Polyline.decodeUnsignedIntegers=nT,_R.format.Polyline.encodeDeltas=Hw,_R.format.Polyline.encodeFloats=Jw,_R.format.Polyline.encodeSignedIntegers=tT,_R.format.Polyline.encodeUnsignedInteger=rT,_R.format.Polyline.encodeUnsignedIntegers=iT,_R.format.TextFeature=vv,_R.format.TopoJSON=dT,_R.format.WFS=LE,_R.format.WFS.writeFilter=function(t,e){const i=id(IE(e=e||"1.1.0"),"Filter"),n={node:i};return Object.assign(n,{version:e,filter:t}),gE(i,t,[n]),i},_R.format.WKB=VE,_R.format.WKT=lC,_R.format.WMSCapabilities=MC,_R.format.WMSGetFeatureInfo=AC,_R.format.WMTSCapabilities=qC,_R.format.XML=Mw,_R.format.XMLFeature=ax,_R.format.filter={},_R.format.filter.And=pT,_R.format.filter.Bbox=mT,_R.format.filter.Comparison=ST,_R.format.filter.ComparisonBinary=TT,_R.format.filter.Contains=yT,_R.format.filter.DWithin=xT,_R.format.filter.Disjoint=vT,_R.format.filter.During=wT,_R.format.filter.EqualTo=ET,_R.format.filter.Filter=gT,_R.format.filter.GreaterThan=CT,_R.format.filter.GreaterThanOrEqualTo=RT,_R.format.filter.Intersects=bT,_R.format.filter.IsBetween=PT,_R.format.filter.IsLike=IT,_R.format.filter.IsNull=LT,_R.format.filter.LessThan=FT,_R.format.filter.LessThanOrEqualTo=MT,_R.format.filter.LogicalNary=fT,_R.format.filter.Not=AT,_R.format.filter.NotEqualTo=OT,_R.format.filter.Or=NT,_R.format.filter.ResourceId=DT,_R.format.filter.Spatial=_T,_R.format.filter.Within=GT,_R.format.filter.and=kT,_R.format.filter.bbox=jT,_R.format.filter.between=function(t,e,i){return new PT(t,e,i)},_R.format.filter.contains=function(t,e,i){return new yT(t,e,i)},_R.format.filter.disjoint=function(t,e,i){return new vT(t,e,i)},_R.format.filter.during=function(t,e,i){return new wT(t,e,i)},_R.format.filter.dwithin=function(t,e,i,n,r){return new xT(t,e,i,n,r)},_R.format.filter.equalTo=function(t,e,i){return new ET(t,e,i)},_R.format.filter.greaterThan=function(t,e){return new CT(t,e)},_R.format.filter.greaterThanOrEqualTo=function(t,e){return new RT(t,e)},_R.format.filter.intersects=function(t,e,i){return new bT(t,e,i)},_R.format.filter.isNull=function(t){return new LT(t)},_R.format.filter.lessThan=function(t,e){return new FT(t,e)},_R.format.filter.lessThanOrEqualTo=function(t,e){return new MT(t,e)},_R.format.filter.like=function(t,e,i,n,r,s){return new IT(t,e,i,n,r,s)},_R.format.filter.not=function(t){return new AT(t)},_R.format.filter.notEqualTo=function(t,e,i){return new OT(t,e,i)},_R.format.filter.or=function(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(NT,e))},_R.format.filter.resourceId=function(t){return new DT(t)},_R.format.filter.within=function(t,e,i){return new GT(t,e,i)},_R.format.xlink={},_R.format.xlink.readHref=Aw,_R.format.xsd={},_R.format.xsd.readBoolean=dx,_R.format.xsd.readBooleanString=gx,_R.format.xsd.readDateTime=fx,_R.format.xsd.readDecimal=px,_R.format.xsd.readDecimalString=mx,_R.format.xsd.readNonNegativeIntegerString=yx,_R.format.xsd.readPositiveInteger=_x,_R.format.xsd.readString=xx,_R.format.xsd.writeBooleanTextNode=vx,_R.format.xsd.writeCDATASection=Sx,_R.format.xsd.writeDateTimeTextNode=wx,_R.format.xsd.writeDecimalTextNode=Tx,_R.format.xsd.writeNonNegativeIntegerTextNode=Ex,_R.format.xsd.writeStringTextNode=Cx,_R.functions={},_R.functions.FALSE=p,_R.functions.TRUE=f,_R.functions.VOID=m,_R.functions.memoizeOne=_,_R.functions.toPromise=y,_R.geom={},_R.geom.Circle=Am,_R.geom.Geometry=Nn,_R.geom.GeometryCollection=Dm,_R.geom.LineString=zm,_R.geom.LinearRing=cr,_R.geom.MultiLineString=Xm,_R.geom.MultiPoint=Wm,_R.geom.MultiPolygon=Km,_R.geom.Point=dr,_R.geom.Polygon=Ar,_R.geom.Polygon.circular=Or,_R.geom.Polygon.fromCircle=Dr,_R.geom.Polygon.fromExtent=Nr,_R.geom.Polygon.makeRegular=Gr,_R.geom.SimpleGeometry=kn,_R.geom.SimpleGeometry.getStrideForLayout=Dn,_R.geom.SimpleGeometry.transformGeom2D=Gn,_R.geom.flat={},_R.geom.flat.area={},_R.geom.flat.area.linearRing=or,_R.geom.flat.area.linearRings=ar,_R.geom.flat.area.linearRingss=lr,_R.geom.flat.center={},_R.geom.flat.center.linearRingss=Zm,_R.geom.flat.closest={},_R.geom.flat.closest.arrayMaxSquaredDelta=zn,_R.geom.flat.closest.assignClosestArrayPoint=Vn,_R.geom.flat.closest.assignClosestMultiArrayPoint=Wn,_R.geom.flat.closest.assignClosestPoint=Xn,_R.geom.flat.closest.maxSquaredDelta=Bn,_R.geom.flat.closest.multiArrayMaxSquaredDelta=Un,_R.geom.flat.contains={},_R.geom.flat.contains.linearRingContainsExtent=gr,_R.geom.flat.contains.linearRingContainsXY=fr,_R.geom.flat.contains.linearRingsContainsXY=pr,_R.geom.flat.contains.linearRingssContainsXY=mr,_R.geom.flat.deflate={},_R.geom.flat.deflate.deflateCoordinate=Zn,_R.geom.flat.deflate.deflateCoordinates=Yn,_R.geom.flat.deflate.deflateCoordinatesArray=Kn,_R.geom.flat.deflate.deflateMultiCoordinatesArray=qn,_R.geom.flat.flip={},_R.geom.flat.flip.flipXY=$y,_R.geom.flat.geodesic={},_R.geom.flat.geodesic.greatCircleArc=function(t,e,i,n,r,s){const o=an("EPSG:4326"),a=Math.cos(wi(e)),l=Math.sin(wi(e)),h=Math.cos(wi(n)),c=Math.sin(wi(n)),u=Math.cos(wi(i-t)),d=Math.sin(wi(i-t)),g=l*c+a*h*u;return n_((function(e){if(1<=g)return[i,n];const r=e*Math.acos(g),s=Math.cos(r),o=Math.sin(r),f=d*h,p=a*c-l*h*u,m=Math.atan2(f,p),_=Math.asin(l*s+a*o*Math.cos(m));return[Si(wi(t)+Math.atan2(Math.sin(m)*o*a,s-l*Math.sin(_))),Si(_)]}),mn(o,r),s)},_R.geom.flat.geodesic.meridian=r_,_R.geom.flat.geodesic.parallel=s_,_R.geom.flat.inflate={},_R.geom.flat.inflate.inflateCoordinates=nr,_R.geom.flat.inflate.inflateCoordinatesArray=rr,_R.geom.flat.inflate.inflateMultiCoordinatesArray=sr,_R.geom.flat.interiorpoint={},_R.geom.flat.interiorpoint.getInteriorPointOfArray=_r,_R.geom.flat.interiorpoint.getInteriorPointsOfMultiArray=yr,_R.geom.flat.interpolate={},_R.geom.flat.interpolate.interpolatePoint=Gm,_R.geom.flat.interpolate.lineStringCoordinateAtM=km,_R.geom.flat.interpolate.lineStringsCoordinateAtM=jm,_R.geom.flat.intersectsextent={},_R.geom.flat.intersectsextent.intersectsLineString=vr,_R.geom.flat.intersectsextent.intersectsLineStringArray=Sr,_R.geom.flat.intersectsextent.intersectsLinearRing=wr,_R.geom.flat.intersectsextent.intersectsLinearRingArray=Tr,_R.geom.flat.intersectsextent.intersectsLinearRingMultiArray=Er,_R.geom.flat.length={},_R.geom.flat.length.lineStringLength=hm,_R.geom.flat.length.linearRingLength=function(t,e,i,n){let r=hm(t,e,i,n);const s=t[i-n]-t[e],o=t[i-n+1]-t[e+1];return r+=Math.sqrt(s*s+o*o),r},_R.geom.flat.orient={},_R.geom.flat.orient.inflateEnds=Fr,_R.geom.flat.orient.linearRingIsClockwise=Rr,_R.geom.flat.orient.linearRingsAreOriented=br,_R.geom.flat.orient.linearRingssAreOriented=Pr,_R.geom.flat.orient.orientLinearRings=Ir,_R.geom.flat.orient.orientLinearRingsArray=Lr,_R.geom.flat.reverse={},_R.geom.flat.reverse.coordinates=Cr,_R.geom.flat.segments={},_R.geom.flat.segments.forEach=xr,_R.geom.flat.simplify={},_R.geom.flat.simplify.douglasPeucker=Hn,_R.geom.flat.simplify.douglasPeuckerArray=$n,_R.geom.flat.simplify.douglasPeuckerMultiArray=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l3&&!!or(t,e,i,n)},_R.geom.flat.transform={},_R.geom.flat.transform.rotate=Fn,_R.geom.flat.transform.scale=Mn,_R.geom.flat.transform.transform2D=Ln,_R.geom.flat.transform.translate=An,_R.has={},_R.has.DEVICE_PIXEL_RATIO=gt,_R.has.FIREFOX=lt,_R.has.IMAGE_DECODE=pt,_R.has.MAC=dt,_R.has.PASSIVE_EVENT_LISTENERS=mt,_R.has.SAFARI=ht,_R.has.SAFARI_BUG_237906=ct,_R.has.WEBKIT=ut,_R.has.WORKER_OFFSCREEN_CANVAS=ft,_R.interaction={},_R.interaction.DoubleClickZoom=wa,_R.interaction.DragAndDrop=ty,_R.interaction.DragAndDrop.DragAndDropEvent=Q_,_R.interaction.DragBox=Ya,_R.interaction.DragBox.DragBoxEvent=Za,_R.interaction.DragPan=ja,_R.interaction.DragRotate=Ba,_R.interaction.DragRotateAndZoom=ey,_R.interaction.DragZoom=Ka,_R.interaction.Draw=my,_R.interaction.Draw.DrawEvent=sy,_R.interaction.Draw.createBox=function(){return function(t,e,i){const n=ne([t[0],t[t.length-1]].map((function(t){return Tn(t,i)}))),r=[[Re(n),be(n),Ne(n),Oe(n),Re(n)]];e?e.setCoordinates(r):e=new Ar(r);const s=Sn();return s&&e.transform(i,s),e}},_R.interaction.Draw.createRegularPolygon=function(t,e){return function(i,n,r){const s=Tn(i[0],r),o=Tn(i[i.length-1],r),a=Math.sqrt(ji(s,o));n=n||Dr(new Am(s),t);let l=e;if(!e&&0!==e){const t=o[0]-s[0],e=o[1]-s[1];l=Math.atan2(e,t)}Gr(n,s,a,l);const h=Sn();return h&&n.transform(r,h),n}},_R.interaction.Extent=Ty,_R.interaction.Extent.ExtentEvent=yy,_R.interaction.Interaction=Sa,_R.interaction.Interaction.pan=xa,_R.interaction.Interaction.zoomByDelta=va,_R.interaction.KeyboardPan=Qa,_R.interaction.KeyboardZoom=tl,_R.interaction.Link=by,_R.interaction.Modify=Gy,_R.interaction.Modify.ModifyEvent=My,_R.interaction.MouseWheelZoom=el,_R.interaction.PinchRotate=il,_R.interaction.PinchZoom=nl,_R.interaction.Pointer=Ea,_R.interaction.Pointer.centroid=Ta,_R.interaction.Select=Uy,_R.interaction.Select.SelectEvent=jy,_R.interaction.Snap=Wy,_R.interaction.Translate=Hy,_R.interaction.Translate.TranslateEvent=qy,_R.interaction.defaults={},_R.interaction.defaults.defaults=rl,_R.layer={},_R.layer.Base=Fs,_R.layer.BaseImage=su,_R.layer.BaseTile=fu,_R.layer.BaseVector=Af,_R.layer.Graticule=l_,_R.layer.Group=To,_R.layer.Group.GroupEvent=vo,_R.layer.Heatmap=g_,_R.layer.Image=uu,_R.layer.Layer=ks,_R.layer.Layer.inView=Gs,_R.layer.MapboxVector=Z_,_R.layer.Tile=mu,_R.layer.Vector=i_,_R.layer.VectorImage=Y_,_R.layer.VectorTile=V_,_R.layer.WebGLPoints=K_,_R.layer.WebGLTile=$_,_R.loadingstrategy={},_R.loadingstrategy.all=kl,_R.loadingstrategy.bbox=function(t,e){return[t]},_R.loadingstrategy.tile=function(t){return function(e,i,n){const r=t.getZForResolution(bn(i,n)),s=t.getTileRangeForExtentAndZ(Cn(e,n),r),o=[],a=[r,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(En(t.getTileCoordExtent(a),n));return o}},_R.math={},_R.math.ceil=Pi,_R.math.clamp=_i,_R.math.floor=bi,_R.math.lerp=Ei,_R.math.modulo=Ti,_R.math.round=Ri,_R.math.solveLinearSystem=vi,_R.math.squaredDistance=xi,_R.math.squaredSegmentDistance=yi,_R.math.toDegrees=Si,_R.math.toFixed=Ci,_R.math.toRadians=wi,_R.net={},_R.net.ClientError=zl,_R.net.ResponseError=Bl,_R.net.getJSON=Ul,_R.net.jsonp=jl,_R.net.overrideXHR=function(t){"undefined"!=typeof XMLHttpRequest&&(Ol=XMLHttpRequest),global.XMLHttpRequest=t},_R.net.resolveUrl=Xl,_R.net.restoreXHR=function(){global.XMLHttpRequest=Ol},_R.obj={},_R.obj.clear=x,_R.obj.isEmpty=v,_R.proj={},_R.proj.Projection=Ke,_R.proj.Units={},_R.proj.Units.METERS_PER_UNIT=Ye,_R.proj.Units.fromCode=Ze,_R.proj.addCommon=In,_R.proj.addCoordinateTransforms=gn,_R.proj.addEquivalentProjections=hn,_R.proj.addEquivalentTransforms=cn,_R.proj.addProjection=sn,_R.proj.addProjections=on,_R.proj.clearAllProjections=function(){ci(),fi()},_R.proj.clearUserProjection=function(){xn=null},_R.proj.cloneTransform=nn,_R.proj.createProjection=un,_R.proj.createSafeCoordinateTransform=Pn,_R.proj.createTransformFromCoordinateTransform=dn,_R.proj.disableCoordinateWarning=en,_R.proj.epsg3857={},_R.proj.epsg3857.EXTENT=$e,_R.proj.epsg3857.HALF_SIZE=He,_R.proj.epsg3857.MAX_SAFE_Y=Qe,_R.proj.epsg3857.PROJECTIONS=ei,_R.proj.epsg3857.RADIUS=qe,_R.proj.epsg3857.WORLD_EXTENT=Je,_R.proj.epsg3857.fromEPSG4326=ii,_R.proj.epsg3857.toEPSG4326=ni,_R.proj.epsg4326={},_R.proj.epsg4326.EXTENT=si,_R.proj.epsg4326.METERS_PER_UNIT=oi,_R.proj.epsg4326.PROJECTIONS=li,_R.proj.epsg4326.RADIUS=ri,_R.proj.equivalent=fn,_R.proj.fromLonLat=function(t,e){return en(),_n(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")},_R.proj.fromUserCoordinate=Tn,_R.proj.fromUserExtent=Cn,_R.proj.fromUserResolution=bn,_R.proj.get=an,_R.proj.getPointResolution=ln,_R.proj.getTransform=mn,_R.proj.getTransformFromProjections=pn,_R.proj.getUserProjection=Sn,_R.proj.identityTransform=rn,_R.proj.proj4={},_R.proj.proj4.fromEPSGCode=async function(t){"string"==typeof t&&(t=parseInt(t.split(":").pop(),10));const e=Qm;if(!e)throw new Error("Proj4 must be registered first with register(proj4)");const i="EPSG:"+t;return e.defs(i)||(e.defs(i,await e_(t)),t_(e)),an(i)},_R.proj.proj4.getEPSGLookup=function(){return e_},_R.proj.proj4.isRegistered=function(){return!!Qm},_R.proj.proj4.register=t_,_R.proj.proj4.setEPSGLookup=function(t){e_=t},_R.proj.proj4.unregister=function(){Qm=null},_R.proj.projections={},_R.proj.projections.add=di,_R.proj.projections.clear=ci,_R.proj.projections.get=ui,_R.proj.setUserProjection=vn,_R.proj.toLonLat=function(t,e){const i=_n(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=Ti(n+180,360)-180),i},_R.proj.toUserCoordinate=wn,_R.proj.toUserExtent=En,_R.proj.toUserResolution=Rn,_R.proj.transform=_n,_R.proj.transformExtent=yn,_R.proj.transformWithProjections=function(t,e,i){return pn(e,i)(t)},_R.proj.transforms={},_R.proj.transforms.add=pi,_R.proj.transforms.clear=fi,_R.proj.transforms.get=mi,_R.proj.transforms.remove=function(t,e){const i=t.getCode(),n=e.getCode(),r=gi[i][n];return delete gi[i][n],v(gi[i])&&delete gi[i],r},_R.proj.useGeographic=function(){vn("EPSG:4326")},_R.render={},_R.render.Box=za,_R.render.Event=zs,_R.render.Feature=Jm,_R.render.Feature.toFeature=function(t,e){const i=t.getId(),n=$m(t),r=t.getProperties(),s=new Ot;return void 0!==e&&s.setGeometryName(e),s.setGeometry(n),void 0!==i&&s.setId(i),s.setProperties(r,!0),s},_R.render.Feature.toGeometry=$m,_R.render.VectorContext=Vl,_R.render.canvas={},_R.render.canvas.Builder=Qp,_R.render.canvas.BuilderGroup=am,_R.render.canvas.Executor=xm,_R.render.canvas.ExecutorGroup=Tm,_R.render.canvas.ExecutorGroup.getPixelIndexArray=wm,_R.render.canvas.ImageBuilder=tm,_R.render.canvas.Immediate=Wl,_R.render.canvas.Instruction={},_R.render.canvas.Instruction.beginPathInstruction=$p,_R.render.canvas.Instruction.closePathInstruction=Jp,_R.render.canvas.Instruction.fillInstruction=qp,_R.render.canvas.Instruction.strokeInstruction=Hp,_R.render.canvas.LineStringBuilder=em,_R.render.canvas.PolygonBuilder=im,_R.render.canvas.TextBuilder=sm,_R.render.canvas.checkedFonts=ao,_R.render.canvas.defaultFillStyle=Js,_R.render.canvas.defaultFont=$s,_R.render.canvas.defaultLineCap=Qs,_R.render.canvas.defaultLineDash=to,_R.render.canvas.defaultLineDashOffset=0,_R.render.canvas.defaultLineJoin=eo,_R.render.canvas.defaultLineWidth=1,_R.render.canvas.defaultMiterLimit=io,_R.render.canvas.defaultPadding=oo,_R.render.canvas.defaultStrokeStyle=no,_R.render.canvas.defaultTextAlign=ro,_R.render.canvas.defaultTextBaseline=so,_R.render.canvas.drawImageOrLabel=yo,_R.render.canvas.getTextDimensions=_o,_R.render.canvas.hitdetect={},_R.render.canvas.hitdetect.HIT_DETECT_RESOLUTION=Em,_R.render.canvas.hitdetect.createHitDetectionImageData=Cm,_R.render.canvas.hitdetect.hitDetect=Rm,_R.render.canvas.measureAndCacheTextWidth=mo,_R.render.canvas.measureTextHeight=go,_R.render.canvas.measureTextWidth=po,_R.render.canvas.registerFont=uo,_R.render.canvas.rotateAtOffset=function(t,e,i,n){0!==e&&(t.translate(i,n),t.rotate(e),t.translate(-i,-n))},_R.render.canvas.textHeights=co,_R.render.getRenderPixel=function(t,e){return zt(t.inversePixelTransform,e.slice(0))},_R.render.getVectorContext=Jl,_R.render.toContext=function(t,e){const i=t.canvas,n=(e=e||{}).pixelRatio||gt,r=e.size;r&&(i.width=r[0]*n,i.height=r[1]*n,i.style.width=r[0]+"px",i.style.height=r[1]+"px");const s=[0,0,i.width,i.height],o=Xt([1,0,0,1,0,0],n,n);return new Wl(t,n,s,o,0)},_R.render.webgl={},_R.render.webgl.BatchRenderer=yp,_R.render.webgl.LineStringBatchRenderer=vp,_R.render.webgl.MixedGeometryBatch=Sp,_R.render.webgl.PointBatchRenderer=Tp,_R.render.webgl.PolygonBatchRenderer=Cp,_R.render.webgl.utils={},_R.render.webgl.utils.colorDecodeId=fp,_R.render.webgl.utils.colorEncodeId=gp,_R.render.webgl.utils.getBlankImageData=function(){const t=document.createElement("canvas").getContext("2d").createImageData(1,1);return t.data[0]=255,t.data[1]=255,t.data[2]=255,t.data[3]=255,t},_R.render.webgl.utils.writeLineSegmentToBuffers=function(t,e,i,n,r,s,o,a,l,h){const c=5+a.length,u=s.length/c,d=[t[e+0],t[e+1]],g=[t[i],t[i+1]],f=zt(h,[...d]),p=zt(h,[...g]);function m(t,e,i){const n=1e4;return Math.round(1500*e)+Math.round(1500*i)*n+t*n*n}function _(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o],l=0===n||0===o?0:Math.acos(_i(a[0]*r[0]+a[1]*r[1],-1,1));return a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}const y=null!==r;let x=0,v=0;if(null!==n){x=_(f,p,zt(h,[...[t[n],t[n+1]]]))}if(y){v=_(p,f,zt(h,[...[t[r],t[r+1]]]))}s.push(d[0],d[1],g[0],g[1],m(0,x,v)),s.push(...a),s.push(d[0],d[1],g[0],g[1],m(1,x,v)),s.push(...a),s.push(d[0],d[1],g[0],g[1],m(2,x,v)),s.push(...a),s.push(d[0],d[1],g[0],g[1],m(3,x,v)),s.push(...a),o.push(u,u+1,u+2,u+1,u+3,u+2)},_R.render.webgl.utils.writePointFeatureToBuffers=function(t,e,i,n,r,s){const o=3+r,a=t[e+0],l=t[e+1],h=cp;h.length=r;for(let i=0;i1?"projection"in e?i.TileMatrixSetLink.findIndex((function(t){const i=n.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,r=an(i),s=an(e.projection);return r&&s?fn(r,s):i==e.projection})):i.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,r<0&&(r=0);const s=i.TileMatrixSetLink[r].TileMatrixSet,o=i.TileMatrixSetLink[r].TileMatrixSetLimits;let a=i.Format[0];"format"in e&&(a=e.format),r=i.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),r<0&&(r=0);const l=i.Style[r].Identifier,h={};"Dimension"in i&&i.Dimension.forEach((function(t,e,i){const n=t.Identifier;let r=t.Default;void 0===r&&(r=t.Value[0]),h[n]=r}));const c=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==s}));let u;const d=c.SupportedCRS;if(d&&(u=an(d)),"projection"in e){const t=an(e.projection);t&&(u&&!fn(t,u)||(u=t))}let g=!1;const f="ne"==u.getAxisOrientation().substr(0,2);let p=c.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:p.MatrixWidth-1,MaxTileRow:p.MatrixHeight-1};if(o){m=o[o.length-1];const t=c.TileMatrix.find((t=>t.Identifier===m.TileMatrix||c.Identifier+":"+t.Identifier===m.TileMatrix));t&&(p=t)}const _=28e-5*p.ScaleDenominator/u.getMetersPerUnit(),y=f?[p.TopLeftCorner[1],p.TopLeftCorner[0]]:p.TopLeftCorner,x=p.TileWidth*_,v=p.TileHeight*_;let S=c.BoundingBox;S&&f&&(S=[S[1],S[0],S[3],S[2]]);let w=[y[0]+x*m.MinTileCol,y[1]-v*(1+m.MaxTileRow),y[0]+x*(1+m.MaxTileCol),y[1]-v*m.MinTileRow];if(void 0!==S&&!le(S,w)){const t=i.WGS84BoundingBox,e=an("EPSG:4326").getExtent();if(w=S,t)g=t[0]===e[0]&&t[2]===e[2];else{const t=yn(S,c.SupportedCRS,"EPSG:4326");g=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const T=Wu(c,w,o),E=[];let C=e.requestEncoding;if(C=void 0!==C?C:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;t{const n=t.toString();if(!i.containsKey(n)){const r=e(t);i.set(n,r)}a.push(i.get(n))})),a}},_R.source.wms={},_R.source.wms.DEFAULT_VERSION=tu,_R.sphere={},_R.sphere.DEFAULT_RADIUS=Wi,_R.sphere.getArea=function t(e,i){const n=(i=i||{}).radius||Wi,r=i.projection||"EPSG:3857",s=e.getType();"GeometryCollection"!==s&&(e=e.clone().transform(r,"EPSG:4326"));let o,a,l,h,c,u,d=0;switch(s){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(o=e.getCoordinates(),d=Math.abs(Ki(o[0],n)),l=1,h=o.length;l