!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ol={})}(this,(function(t){"use strict";var e={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function i(){throw new Error("Unimplemented abstract method.")}let n=0;function r(t){return t.ol_uid||(t.ol_uid=String(++n))}function s(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i}function o(t){return t[0]>0&&t[1]>0}function a(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 l(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class h{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=l(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new h({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 i()}getImage(t){return i()}getHitDetectionImage(){return i()}getPixelRatio(t){return 1}getImageState(){return i()}getImageSize(){return i()}getOrigin(){return i()}getSize(){return i()}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_=l(t)}listenImageChange(t){i()}load(){i()}unlistenImageChange(t){i()}}var u=h;const c={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 d extends Error{constructor(t){const e=c[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}var g=d;function p(t,e){if(!t)throw new g(e)}function f(t,e,i){return Math.min(Math.max(t,e),i)}function m(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return _(t,e,i,n)}function _(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function y(t){return 180*t/Math.PI}function v(t){return t*Math.PI/180}function x(t,e){const i=t%e;return i*e<0?i+e:i}function b(t,e,i){return t+i*(e-t)}function w(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function S(t,e){return Math.round(w(t,e))}function C(t,e){return Math.floor(w(t,e))}function E(t,e){return Math.ceil(w(t,e))}const T=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,R=/^([a-z]*)$|^hsla?\(.*\)$/i;function F(t){return"string"==typeof t?t:A(t)}function M(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 P=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;R.exec(t)&&(t=M(t));if(T.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),L(s)):t.startsWith("rgb(")?(s=t.slice(4,-1).split(",").map(Number),s.push(1),L(s)):p(!1,14);return s}(i),t[i]=n,++e}return n}}();function I(t){return Array.isArray(t)?t:P(t)}function L(t){return t[0]=f(t[0]+.5|0,0,255),t[1]=f(t[1]+.5|0,0,255),t[2]=f(t[2]+.5|0,0,255),t[3]=f(t[3],0,1),t}function A(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 k(t){return Array.isArray(t)?A(t):t}const O="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",D=O.includes("firefox"),G=O.includes("safari")&&!O.includes("chrom")&&(O.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(O)),z=O.includes("webkit")&&!O.includes("edge"),N=O.includes("macintosh"),j="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,U="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,B="undefined"!=typeof Image&&Image.prototype.decode,V=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 X(t,e,i,n){let r;return r=i&&i.length?i.shift():U?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}function W(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Y(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function Z(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function q(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function K(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function H(t){for(;t.lastChild;)t.removeChild(t.lastChild)}var $=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},J="propertychange";var Q=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function tt(t,e){return t>e?1:t0){for(r=1;r0?r-1:r:t[r-1]-e0)}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]=at,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}},ct={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function dt(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 gt(t,e,i,n){return dt(t,e,i,n,!0)}function pt(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),lt(t))}class ft extends ut{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ct.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;rMath.max(e,Xt(t,i))),0);return i[e]=n,n}function Yt(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;tthis.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=Qt(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=Qt(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};var ee=class extends ut{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=n}changed(){this.dispatchEvent(ct.CHANGE)}getExtent(){return this.extent}getImage(){return i()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){i()}},ie={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ne(t){const e=ce();for(let i=0,n=t.length;ir&&(l|=ie.RIGHT),as&&(l|=ie.ABOVE),l===ie.UNKNOWN&&(l=ie.INTERSECTING),l}function ce(){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 pe(t,e){const i=t[0],n=t[1];return de(i,n,i,n,e)}function fe(t,e,i,n,r){return ve(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){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function ye(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function ve(t,e,i,n,r){for(;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 Oe(t){return t[2]1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=Ae(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function ze(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[gt(n,ct.LOAD,(function(){o=!0,s||e()}))];return n.src&&B?(s=!0,n.decode().then((function(){r&&e()})).catch((function(t){r&&(o?e():i())}))):a.push(gt(n,ct.ERROR,i)),function(){r=!1,a.forEach(pt)}}var Ne=class extends ee{constructor(t,i,n,r,s,o,a){super(t,i,n,e.IDLE),this.src_=r,this.image_=new Image,null!==s&&(this.image_.crossOrigin=s),this.context_=a,this.unlisten_=null,this.state=e.IDLE,this.imageLoadFunction_=o}getImage(){if(this.state==e.LOADED&&this.context_&&!(this.image_ instanceof HTMLCanvasElement)){const t=this.context_.canvas;t.width=this.image_.width,t.height=this.image_.height,this.context_.drawImage(this.image_,0,0),this.image_=this.context_.canvas}return this.image_}handleImageError_(){this.state=e.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){void 0===this.resolution&&(this.resolution=Me(this.extent)/this.image_.height),this.state=e.LOADED,this.unlistenImage_(),this.changed()}load(){this.state!=e.IDLE&&this.state!=e.ERROR||(this.state=e.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=ze(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(t){this.image_=t,this.resolution=Me(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}};let je=null;class Ue extends ut{constructor(t,e,i,n,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=s,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===e.LOADED){je||(je=X(1,1,void 0,{willReadFrequently:!0})),je.drawImage(this.image_,0,0);try{je.getImageData(0,0,1,1),this.tainted_=!1}catch(t){je=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(ct.CHANGE)}handleImageError_(){this.imageState_=e.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=e.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=X(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===e.IDLE){this.image_||this.initializeImage_(),this.imageState_=e.LOADING;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=ze(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==e.LOADED)return;const i=this.image_,n=document.createElement("canvas");n.width=Math.ceil(i.width*t),n.height=Math.ceil(i.height*t);const r=n.getContext("2d");r.scale(t,t),r.drawImage(i,0,0),r.globalCompositeOperation="multiply",r.fillStyle=F(this.color_),r.fillRect(0,0,n.width/t,n.height/t),r.globalCompositeOperation="destination-in",r.drawImage(i,0,0),this.canvas_[t]=n}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}class Be extends u{constructor(t){const i=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,o=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:i,rotation:n,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:o,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const a=void 0!==t.img?t.img:null;this.imgSize_=t.imgSize;let l=t.src;p(!(void 0!==l&&a),4),p(!a||a&&this.imgSize_,5),void 0!==l&&0!==l.length||!a||(l=a.src||r(a)),p(void 0!==l&&l.length>0,6),p(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),69);const h=void 0!==t.src?e.IDLE:e.LOADED;if(this.color_=void 0!==t.color?I(t.color):null,this.iconImage_=function(t,e,i,n,r,s){let o=te.get(e,n,s);return o||(o=new Ue(t,e,i,n,r,s),te.set(e,n,s,o)),o}(a,l,void 0!==this.imgSize_?this.imgSize_:null,this.crossOrigin_,h,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(){let t=this.getScale();return t=Array.isArray(t)?t.slice():t,void 0===this.width_&&void 0===this.height_||(t=void 0),new Be({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,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(ct.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ct.CHANGE,t)}}var Ve=Be;class Xe extends xt{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 Xe(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_&&(pt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=dt(t,ct.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{p("function"==typeof t.getZIndex,41);e=[t]}return function(){return e}}(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_()}}var We=Xe;const Ye=new Array(6);function Ze(t){return Ke(t,1,0,0,1,0,0)}function qe(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],u=e[2],c=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function Ke(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 He(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 $e(t,e,i){return qe(t,Ke(Ye,e,0,0,i,0,0))}function Je(t,e,i){return qe(t,Ke(Ye,1,0,0,1,e,i))}function Qe(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 ti(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;p(0!==i,32);const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}let ei;function ii(t){const e="matrix("+t.join(", ")+")";if(U)return e;const i=ei||(ei=document.createElement("div"));return i.style.transform=e,i.style.transform}const ni={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ri=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_||ni[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 si=6378137,oi=Math.PI*si,ai=[-oi,-oi,oi,oi],li=[-180,-85,180,85],hi=si*Math.log(Math.tan(Math.PI/2));class ui extends ri{constructor(t){super({code:t,units:"m",extent:ai,global:!0,worldExtent:li,getPointResolution:function(t,e){return t/Math.cosh(e[1]/si)}})}}const ci=[new ui("EPSG:3857"),new ui("EPSG:102100"),new ui("EPSG:102113"),new ui("EPSG:900913"),new ui("http://www.opengis.net/def/crs/EPSG/0/3857"),new ui("http://www.opengis.net/gml/srs/epsg.xml#3857")];function di(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;rhi?i=hi:i<-hi&&(i=-hi),e[r+1]=i}return e}function gi(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;rr)return 1;if(r>e)return-1}return 0}function wi(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 Si(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],u=l-o,c=h-a,d=0===u&&0===c?0:(u*(i-o)+c*(n-a))/(u*u+c*c||0);let g,p;return d<=0?(g=o,p=a):d>=1?(g=l,p=h):(g=o+d*u,p=a+d*c),[g,p]}function Ci(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 Ei(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 Ti(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Ri(t,e){return Math.sqrt(Ti(t,e))}function Fi(t,e){return Ti(t,Si(t,e))}function Mi(t,e){if(e.canWrapX()){const i=Ae(e.getExtent()),n=Pi(t,e,i);n&&(t[0]-=n*i)}return t}function Pi(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||Ae(n),r=Math.floor((t[0]-n[0])/i)),r}const Ii=6371008.8;function Li(t,e,i){i=i||Ii;const n=v(t[1]),r=v(e[1]),s=(r-n)/2,o=v(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 Ai(t,e){let i=0;for(let n=0,r=t.length;nDi.warn||console.warn(...t)}let Ni=!0;function ji(t){Ni=!(void 0===t||t)}function Ui(t,e){if(void 0!==e)for(let i=0,n=t.length;i=o?e[s+t]:r[t]}return i}}function $i(t,e){return ji(),en(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function Ji(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return Qi(t,e)===Ui&&i}function Qi(t,e){let i=function(t,e){let i;return t in vi&&e in vi[t]&&(i=vi[t][e]),i}(t.getCode(),e.getCode());return i||(i=Bi),i}function tn(t,e){return Qi(Wi(t),Wi(e))}function en(t,e,i){return tn(e,i)(t,void 0,t.length)}function nn(t,e,i,n){return De(t,tn(e,i),void 0,n)}let rn=null;function sn(t){rn=Wi(t)}function on(){return rn}function an(t,e){return rn?en(t,e,rn):t}function ln(t,e){return rn?en(t,rn,e):(Ni&&!Ci(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ni=!1,zi("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function hn(t,e){return rn?nn(t,e,rn):t}function un(t,e){return rn?nn(t,rn,e):t}function cn(t,e){if(!rn)return t;const i=Wi(e).getUnits(),n=rn.getUnits();return i&&n?t*ni[i]/ni[n]:t}function dn(){Zi(ci),Zi(_i),qi(_i,ci,di,gi)}dn();var gn=Object.freeze({__proto__:null,METERS_PER_UNIT:ni,Projection:ri,disableCoordinateWarning:ji,cloneTransform:Ui,identityTransform:Bi,addProjection:Vi,addProjections:Xi,get:Wi,getPointResolution:Yi,addEquivalentProjections:Zi,addEquivalentTransforms:qi,clearAllProjections:function(){yi={},vi={}},createProjection:Ki,createTransformFromCoordinateTransform:Hi,addCoordinateTransforms:function(t,e,i,n){const r=Wi(t),s=Wi(e);xi(r,s,Hi(i)),xi(s,r,Hi(n))},fromLonLat:$i,toLonLat:function(t,e){const i=en(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=x(n+180,360)-180),i},equivalent:Ji,getTransformFromProjections:Qi,getTransform:tn,transform:en,transformExtent:nn,transformWithProjections:function(t,e,i){return Qi(e,i)(t)},setUserProjection:sn,clearUserProjection:function(){rn=null},getUserProjection:on,useGeographic:function(){sn("EPSG:4326")},toUserCoordinate:an,fromUserCoordinate:ln,toUserExtent:hn,fromUserExtent:un,toUserResolution:cn,fromUserResolution:function(t,e){if(!rn)return t;const i=Wi(e).getUnits(),n=rn.getUnits();return i&&n?t*ni[n]/ni[i]:t},createSafeCoordinateTransform:function(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=Ae(e);s=Pi(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=f(n[0],e[0],e[2]),n[1]=f(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*Ae(e.getExtent())),r}},addCommon:dn});function pn(t,e,i,n,r,s){s=s||[];let o=0;for(let a=e;a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||be(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)c=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function In(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],c=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;eo&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n0&&p>d)&&(g<0&&f0&&f>g)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function Gn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e>1;rs&&(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 Hn(t,e,i,n,r,s){if(0===i.length)return!1;if(!Kn(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||Wn(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=ue(t,e),s=ue(t,i);if(r===ie.INTERSECTING||s===ie.INTERSECTING)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],g=i[1],p=(g-c)/(d-u);let f,m;s&ie.ABOVE&&!(r&ie.ABOVE)&&(f=d-(g-h)/p,n=f>=o&&f<=l),n||!(s&ie.RIGHT)||r&ie.RIGHT||(m=g-(d-l)*p,n=m>=a&&m<=h),n||!(s&ie.BELOW)||r&ie.BELOW||(f=d-(g-a)/p,n=f>=o&&f<=l),n||!(s&ie.LEFT)||r&ie.LEFT||(m=g-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)})))))}function Jn(t,e,i,n,r){return!!$n(t,e,i,n,r)||(!!Kn(t,e,i,n,r[0],r[1])||(!!Kn(t,e,i,n,r[0],r[3])||(!!Kn(t,e,i,n,r[2],r[1])||!!Kn(t,e,i,n,r[2],r[3]))))}function Qn(t,e,i,n,r){if(!Jn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e_&&(h=(u+c)/2,Hn(t,e,i,n,h,p)&&(m=h,_=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,_),o):[m,p,_]}function ur(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o0}function gr(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s */ read:function(t,e,i,n,r){var s,o,a=8*r-n-1,l=(1<>1,u=-7,c=i?r-1:0,d=i?-1:1,g=t[e+c];for(c+=d,s=g&(1<<-u)-1,g>>=-u,u+=a;u>0;s=256*s+t[e+c],c+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+t[e+c],c+=d,u-=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,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,p=n?1:-1,f=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=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*l-1)*Math.pow(2,r),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+g]=255&a,g+=p,a/=256,r-=8);for(o=o<0;t[i+g]=255&o,g+=p,o/=256,h-=8);t[i+g-p]|=128*f}},Wr=Zr,Yr=Xr;function Zr(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zr.Varint=0,Zr.Fixed64=1,Zr.Bytes=2,Zr.Fixed32=5;var qr=4294967296,Kr=1/qr,Hr="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function $r(t){return t.type===Zr.Bytes?t.readVarint()+t.pos:t.pos+1}function Jr(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qr(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 ts(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function cs(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Zr.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=hs(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=cs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hs(this.buf,this.pos)+hs(this.buf,this.pos+4)*qr;return this.pos+=8,t},readSFixed64:function(){var t=hs(this.buf,this.pos)+cs(this.buf,this.pos+4)*qr;return this.pos+=8,t},readFloat:function(){var t=Yr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Yr.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 Jr(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return Jr(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return Jr(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return Jr(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return Jr(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return Jr(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&&Hr?function(t,e,i){return Hr.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+u>i)break;1===u?l<128&&(h=l):2===u?128==(192&(s=t[r+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===u?(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===u&&(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,u=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=u}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!==Zr.Bytes)return t.push(this.readVarint(e));var i=$r(this);for(t=t||[];this.pos127;);else if(e===Zr.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zr.Fixed32)this.pos+=4;else{if(e!==Zr.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&&Qr(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Yr.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Yr.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&&Qr(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Zr.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,ts,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,es,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,rs,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,is,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ns,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ss,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,os,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,as,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ls,e)},writeBytesField:function(t,e){this.writeTag(t,Zr.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zr.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zr.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zr.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zr.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zr.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zr.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zr.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zr.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zr.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function ds(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(gs,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function gs(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 ps(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>u&&(n.push(h),u=h),i.push(a,l),h+=2):7===s?h>u&&(i.push(i[u],i[u+1]),h+=2):p(!1,59)}h>u&&(n.push(h),u=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_===Er)r=new this.featureClass_(h,a,l,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=function(t,e){const i=[];let n=0,r=0;for(let s=0,o=e.length;s1?new wr(a,"XY",e):new _r(a,"XY",l)}else t="Point"===h?new or(a,"XY"):"LineString"===h?new ir(a,"XY"):"MultiPoint"===h?new lr(a,"XY"):"MultiLineString"===h?new rr(a,"XY",l):null;r=new(0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Gr(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=Wi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new Wr(t),s=r.readFields(ds,{}),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;t0;)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 xs(_s,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 xs(ys,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 xs(ys,i,t)),this.dispatchEvent(new xs(_s,e,t))}updateLength_(){this.set(vs,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;ig&&(d=(g+d)/2,g=d),p>m&&(p=(m+p)/2,m=p);let _=f(n[0],d,g),y=f(n[1],p,m);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[_,y]}}function Xs(t){return t}function Ws(t,e,i,n){const r=Ae(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 Ys(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),f(n,i/2,2*e)}function Zs(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Ws(t,n,a,r):t;return i&&l?Ys(s,o,e):f(s,e,o)}}}function qs(t){if(void 0!==t)return 0}function Ks(t){if(void 0!==t)return t}function Hs(t){return Math.pow(t,3)}function $s(t){return 1-Hs(1-t)}function Js(t){return 3*t*t-2*t*t*t}function Qs(t){return t}function to(t,e){setTimeout((function(){t(e)}),0)}function eo(t){return!(t.sourceCenter&&t.targetCenter&&!Ci(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function io(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*s-l*o,l*s+a*o]}var no=class extends xt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ki(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&ji(),t.center&&(t.center=ln(t.center,this.projection_)),t.extent&&(t.extent=un(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in js)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const r=28,s=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:r;const l=void 0!==t.zoomFactor?t.zoomFactor:s,h=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,d=Ki(t.projection,"EPSG:3857"),g=d.getExtent();let p=t.constrainOnlyCenter,m=t.extent;h||m||!d.isGlobal()||(p=!1,m=g);if(void 0!==t.resolutions){const r=t.resolutions;i=r[o],n=void 0!==r[a]?r[a]:r[r.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?Ws(l,i,o,n):l;if(a)return e?Ys(r,u,h):f(r,h,u);const c=Math.min(u,r),d=Math.floor(et(t,c,s));return t[d]>u&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[Ns]>0}cancelAnimations(){let t;this.setHint(zs,-this.hints_[zs]);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?x(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(zs,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&to(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();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Ei(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),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?an(t,this.getProjection()):t}getCenterInternal(){return this.get(js.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 hn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();p(e,1);const i=this.getResolution();p(void 0!==i,2);const n=this.getRotation();return p(void 0!==n,3),Re(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(js.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(un(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Ae(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(js.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=io(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()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}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=et(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=f(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,f(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(p(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){p(!Oe(t),25);i=yr(un(t,this.getProjection()))}else if("Circle"===t.getType()){const e=un(t.getExtent(),this.getProjection());i=yr(e),i.rotate(this.getRotation(),Ee(e))}else{const e=on();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;t=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var so=class extends Ls{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(Ps,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(Ps)||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_&&(pt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=dt(t,ct.CHANGE,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}isVisible(t){let e;e=t instanceof no?{viewState:t.getState(),extent:t.calculateExtent()}:t;const i=this.getExtent();return this.getVisible()&&ro(this.getLayerState(),e.viewState)&&(!i||ke(i,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof no?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}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(Is,t)}getMapInternal(){return this.get(Is)}setMap(t){this.mapPrecomposeKey_&&(pt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(pt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=dt(t,Os,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);p(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=dt(this,ct.CHANGE,t.render,t),this.changed())}setSource(t){this.set(Ps,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 oo(t,e){te.expire()}var ao=class extends Q{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){i()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Qe(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),ti(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function u(t,e,i,n){return r.call(s,e,t?i:null,n)}const c=h.projection,d=Mi(t.slice(),c),g=[[0,0]];if(c.canWrapX()&&n){const t=Ae(c.getExtent());g.push([-t,0],[t,0])}const p=e.layerStatesArray,f=p.length,m=[],_=[];for(let n=0;n=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&ro(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.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,st,this,r,s)}getMap(){return this.map_}renderFrame(t){i()}scheduleExpireIconCache(t){te.canExpireCache()&&t.postRenderFunctions.push(oo)}};var lo=class extends ${constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};var ho=class extends ao{constructor(t){super(t),this.fontChangeListenerKey_=dt(Gt,J,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=wt+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new lo(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){pt(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Os,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s=0;--e)n[e].renderDeclutter(t);!function(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))}}(this.element_,this.children_),this.dispatchRenderEvent(Ds,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}};class uo extends ${constructor(t,e){super(t),this.layer=e}}const co="layers";class go extends Ls{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(co,this.handleLayersChanged_),i?Array.isArray(i)?i=new bs(i.slice(),{unique:!0}):p("function"==typeof i.getArray,43):i=new bs(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(pt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(dt(t,_s,this.handleLayersAdd_,this),dt(t,ys,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(pt);lt(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{this.clickTimeoutId_=void 0;const e=new _o(yo.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==yo.POINTERUP||e.type==yo.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!=yo.POINTERDOWN&&e.type!=yo.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new _o(yo.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(pt),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 _o(yo.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(dt(t,yo.POINTERMOVE,this.handlePointerMove_,this),dt(t,yo.POINTERUP,this.handlePointerUp_,this),dt(this.element_,yo.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(dt(this.element_.getRootNode(),yo.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new _o(yo.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 _o(yo.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_&&(pt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(ct.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(pt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(pt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},wo="postrender",So="movestart",Co="moveend",Eo="loadstart",To="loadend",Ro={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const Fo=1/0;var Mo=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,lt(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){p(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=Fo&&(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!==Po||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}};class Do extends xt{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){K(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&K(this.element);for(let t=0,e=this.listenerKeys.length;te.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!rt(e,this.renderedAttributions_)){H(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:$s}):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(bt);t||0!==i?t&&0!==i&&this.element.classList.remove(bt):this.element.classList.add(bt)}this.label_.style.transform=t}this.rotation_=i}};var jo=class extends Do{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(ct.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(ct.CLICK,this.handleClick_.bind(this,-i),!1);const c=e+" "+wt+" "+St,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),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:$s})):e.setZoom(n)}}};var Uo="active";function Bo(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:$s})}var Vo=class extends xt{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(Uo)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Uo,t)}setMap(t){this.map_=t}};var Xo=class extends Vo{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==yo.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;Bo(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function Wo(t){const e=t.length;let i=0,n=0;for(let r=0;r0}}else if(t.type==yo.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==yo.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 Zo(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 oa=class extends Yo{constructor(t){t=t||{},super({stopDown:ot}),this.condition_=t.condition?t.condition:qo,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!na(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===qs)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(!na(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!na(t))return!1;if($o(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}};var aa=class extends Q{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 _r([i])}getGeometry(){return this.geometry_}};const la="boxstart",ha="boxdrag",ua="boxend",ca="boxcancel";class da extends ${constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}var ga=class extends Yo{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new aa(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:$o,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 da(ha,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 da(e?ua:ca,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 da(la,t.coordinate,t)),!0)}onBoxEnd(t){}};var pa=class extends ga{constructor(t){super({condition:(t=t||{}).condition?t.condition:ea,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:$s})}},fa=37,ma=38,_a=39,ya=40;var va=class extends Vo{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return ta(t)&&ia(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==ct.KEYDOWN){const i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(n==ya||n==fa||n==_a||n==ma)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==ya?a=-s:n==fa?o=-s:n==_a?o=s:a=s;const l=[o,a];Ei(l,r.getRotation()),function(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:Qs,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}};var xa=class extends Vo{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:ia,this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==ct.KEYDOWN||t.type==ct.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;Bo(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}};var ba=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],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_}};var wa=class extends Vo{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:Ho;this.condition_=t.onFocusOnly?Zo(Ko,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!==ct.WHEEL)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==ct.WHEEL&&(n=i.deltaY,D&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=j),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=-f(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Bo(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 Sa=class extends Yo{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=ot),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!==qs&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Wo(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 Ca=class extends Yo{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=ot),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(Wo(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 Ea(t){t=t||{};const e=new bs,i=new ba(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new oa);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Xo({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new sa({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Sa);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Ca({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new va),e.push(new xa({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new wa({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new pa({duration:t.zoomDuration})),e}function Ta(t){t instanceof so?t.setMapInternal(null):t instanceof po&&t.getLayers().forEach(Ta)}function Ra(t,e){if(t instanceof so)t.setMapInternal(e);else if(t instanceof po){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||function(t){t=t||{};const e=new bs;return(void 0===t.zoom||t.zoom)&&e.push(new jo(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new No(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new zo(t.attributionOptions)),e}(),this.interactions=e.interactions||Ea({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Oo(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ro.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ro.VIEW,this.handleViewChanged_),this.addChangeListener(Ro.SIZE,this.handleSizeChanged_),this.addChangeListener(Ro.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof no||t.view.then((function(t){i.setView(new no(t))})),this.controls.addEventListener(_s,(t=>{t.element.setMap(this)})),this.controls.addEventListener(ys,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(_s,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(ys,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(_s,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(ys,(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){Ra(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:st,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 po?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:st,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(Ro.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return an(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?He(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(Ro.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof bs)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[zs]||e[Ns]){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 uo("removelayer",e)),this.set(Ro.LAYERGROUP,t)}setSize(t){this.set(Ro.SIZE,t)}setTarget(t){this.set(Ro.TARGET,t)}setView(t){if(!t||t instanceof no)return void this.set(Ro.VIEW,t);this.set(Ro.VIEW,new no);const e=this;t.then((function(t){e.setView(new no(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],!o(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&zi("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&rt(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)}}};class Ma{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 Pa(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Ma(t,e,i,n)}var Ia=Ma;function La(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Aa(t,e,i){return t+"/"+e+"/"+i}function ka(t){return Aa(t[0],t[1],t[2])}function Oa(t){return t.split("/").map(Number)}function Da(t){return(t[1]<0||i&&0===s)}))}(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=Pa(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||et)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){i()}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:Hs(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}};var ja=class extends Na{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=Lo,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=Ao,this.unlistenImage_(),this.image_=function(){const t=X(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Lo:this.state=ko,this.unlistenImage_(),this.changed()}load(){this.state==Ao&&(this.state=Po,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Po&&(this.state=Io,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ze(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}};var Ua=class{constructor(t,e,i,n,r,s){this.sourceProj_=t,this.targetProj_=e;let o={};const a=tn(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Ae(n)==Ae(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ae(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ae(this.targetProj_.getExtent()):null;const l=Ie(i),h=Le(i),u=Ce(i),c=Se(i),d=this.transformInv_(l),g=this.transformInv_(h),p=this.transformInv_(u),f=this.transformInv_(c),m=10+(s?Math.max(0,Math.ceil(Math.log2(we(i)/(s*s*256*256)))):0);if(this.addQuad_(l,h,u,c,d,g,p,f,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-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&&u<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Ae(ne([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!ke(h,this.maxSourceExtent_))return;let p=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(p=(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!=p&&2!=p&&4!=p&&8!=p)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=(x(r[0],c)+x(o[0],c))/2-x(n[0],c)}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],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&p)&&this.addTriangle_(t,i,n,r,o,a),0==(14&p)&&this.addTriangle_(t,i,e,r,o,s),p&&(0==(13&p)&&this.addTriangle_(e,n,t,s,a,r),0==(7&p)&&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;ye(t,r[0]),ye(t,r[1]),ye(t,r[2])})),t}getTriangles(){return this.triangles_}};let Ba;const Va=[];function Xa(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Wa(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ya(t,e,i,n){const r=en(i,e,t);let s=Yi(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=Yi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function Za(t,e,i,n,r,s,o,a,l,h,u,c){const d=X(Math.round(i*t),Math.round(i*e),Va);if(c||(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 p=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){_e(p,t.extent)}));const f=Ae(p),m=Me(p),_=X(Math.round(i*f/n),Math.round(i*m/n),Va);c||(_.imageSmoothingEnabled=!1);const y=i/n;l.forEach((function(t,e,i){const n=t.extent[0]-p[0],r=-(t.extent[3]-p[3]),s=Ae(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 v=Ie(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],u=o[1][0],f=o[1][1],m=o[2][0],y=o[2][1];const x=g((a[0][0]-v[0])/s),b=g(-(a[0][1]-v[1])/s),w=g((a[1][0]-v[0])/s),S=g(-(a[1][1]-v[1])/s),C=g((a[2][0]-v[0])/s),E=g(-(a[2][1]-v[1])/s),T=l,R=h;l=0,h=0,u-=T,f-=R,m-=T,y-=R;const F=function(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}([[u,f,0,0,w-x],[m,y,0,0,C-x],[0,0,u,f,S-b],[0,0,m,y,E-b]]);if(F){if(d.save(),d.beginPath(),function(){if(void 0===Ba){const t=X(6,6,Va);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Xa(t,4,5,4,0),Xa(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ba=Wa(e,0)||Wa(e,4)||Wa(e,8),W(t),Va.push(t.canvas)}return Ba}()||!c){d.moveTo(w,S);const t=4,e=x-w,i=b-S;for(let n=0;n0})),s}(t,i,m,y);if(!isFinite(v)||v<=0)return void(this.state=ko);const x=void 0!==h?h:.5;if(this.triangulation_=new Ua(t,i,m,p,v*x,y),0===this.triangulation_.getTriangles().length)return void(this.state=ko);this.sourceZ_=e.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(b[1]=f(b[1],p[1],p[3]),b[3]=f(b[3],p[1],p[3])):b=Pe(b,p)),we(b)){const t=e.getTileRangeForExtentAndZ(b,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=ko)}else this.state=ko}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==Lo&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=Ao;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_=Za(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=Lo}this.changed()}load(){if(this.state==Po){this.state=Io,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==Po||i==Io){t++;const i=dt(e,ct.CHANGE,(function(n){const r=e.getState();r!=Lo&&r!=Ao&&r!=ko||(pt(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()==Po&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(pt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(W(this.canvas_.getContext("2d")),Va.push(this.canvas_),this.canvas_=null),super.release()}};var Ka=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 p(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 p(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){p(!(t in this.entries_),16);const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}};var Ha=class extends Ka{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=Oa(this.peekFirstKey())[0];this.forEach((e=>{e.tileCoord[0]!==t&&(this.remove(ka(e.tileCoord)),e.release())}))}},$a="tileloadstart",Ja="tileloadend",Qa="tileloaderror";function tl(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var el=class extends xt{constructor(t){super(),this.projection=Wi(t.projection),this.attributions_=tl(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_=tl(t),this.changed()}setState(t){this.state_=t,this.changed()}};function il(t){let e=t.getDefaultTileGrid();return e||(e=al(t),t.setDefaultTileGrid(e)),e}function nl(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=ll(i);if(!ae(s,r)){const e=Ae(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function rl(t,e,i,n){n=void 0!==n?n:"top-left";const r=ol(t,e,i);return new za({extent:t,origin:Te(t,n),resolutions:r,tileSize:i})}function sl(t){const e=t||{},i=e.extent||Wi("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:ol(i,e.maxZoom,e.tileSize,e.maxResolution)};return new za(n)}function ol(t,e,i,n){e=void 0!==e?e:Us,i=l(void 0!==i?i:Bs);const r=Me(t),s=Ae(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}};function dl(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);p(i,55);return(i.getHeight()-o[2]-1).toString()}))}}function gl(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 p.key=u,l?(p.interimTile=l,p.refreshInterimChain(),o.replace(h,p)):o.set(h,p),p}getTileInternal(t,e,i,n,r){let s=null;const o=Aa(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()==Po?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=Wi(t);if(i){const t=r(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}};var vl=class extends yl{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:Wi("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)!function(t,e,i,n){const s=document.createElement("script"),o="olc_"+r(e);function a(){delete window[o],s.parentNode.removeChild(s)}s.async=!0,s.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+o;const l=setTimeout((function(){a(),i&&i()}),1e4);window[o]=function(t){clearTimeout(l),a(),e(t)},document.head.appendChild(s)}(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):p(!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=Wi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Qi(e,i);n=De(t.bounds,r)}const r=ll(i),s=t.minzoom||0,o=sl({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=gl(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return ke(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}},xl="preload",bl="useInterimTilesOnError";var wl=class extends so{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(xl)}setPreload(t){this.set(xl,t)}getUseInterimTilesOnError(){return this.get(bl)}setUseInterimTilesOnError(t){this.set(bl,t)}getData(t){return super.getData(t)}};var Sl=class extends _t{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return i()}getData(t){return null}prepareFrame(t){return i()}renderFrame(t,e){return i()}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()===e.LOADED&&this.renderIfReadyAndVisible()}loadImage(t){let i=t.getState();return i!=e.LOADED&&i!=e.ERROR&&t.addEventListener(ct.CHANGE,this.boundHandleImageChange_),i==e.IDLE&&(t.load(),i=t.getState()),i==e.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Cl=[];let El=null;var Tl=class extends Sl{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;El||(El=X(1,1,void 0,{willReadFrequently:!0})),El.clearRect(0,0,1,1);try{El.drawImage(t,e,i,1,1,0,0,1,1),n=El.getImageData(0,0,1,1).data}catch(t){return El=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&&rt(I(t.style.backgroundColor),I(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=X();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=Ie(i),r=Le(i),s=Ce(i),o=Se(i);He(e.coordinateToPixelTransform,n),He(e.coordinateToPixelTransform,r),He(e.coordinateToPixelTransform,s),He(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;He(a,n),He(a,r),He(a,s),He(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 lo(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(As,t,e)}postRender(t,e){this.dispatchRenderEvent_(ks,t,e)}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return Qe(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};var Rl=class extends Tl{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 Ia(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==Lo||i==ko||i==Ao&&!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()==Ao&&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=He(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,h=i.getRenderSource(),u=h.getTileGridForProjection(a.projection),c=h.getTilePixelRatio(e.pixelRatio);for(let t=u.getZForResolution(a.resolution);t>=u.getMinZoom();--t){const e=u.getTileCoordForCoordAndZ(n,t),i=h.getTile(t,e[1],e[2],s,o);if(!(i instanceof ja||i instanceof qa)||i instanceof qa&&i.getState()===ko)return null;if(i.getState()!==Lo)continue;const r=u.getOrigin(t),d=l(u.getTileSize(t)),g=u.getResolution(t),p=Math.floor(c*((n[0]-r[0])/g-e[1]*d[0])),f=Math.floor(c*((r[1]-n[1])/g-e[2]*d[1])),m=Math.round(c*h.getGutterForProjection(a.projection));return this.getImageData(i.getImage(),p+m,f+m)}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,s=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,u=this.getLayer(),c=u.getSource(),d=c.getRevision(),g=c.getTileGridForProjection(s),p=g.getZForResolution(o,c.zDirection),f=g.getResolution(p);let m=t.extent;const _=t.viewState.resolution,y=c.getTilePixelRatio(h),v=Math.round(Ae(m)/_*h),x=Math.round(Me(m)/_*h),b=i.extent&&un(i.extent,s);b&&(m=Pe(m,un(i.extent,s)));const w=f*v/2/y,S=f*x/2/y,C=[a[0]-w,a[1]-S,a[0]+w,a[1]+S],E=g.getTileRangeForExtentAndZ(m,p),T={};T[p]={};const R=this.createLoadedTileFinder(c,s,T),F=this.tmpExtent,M=this.tmpTileRange_;this.newTiles_=!1;const P=l?Fe(n.center,_,l,t.size):void 0;for(let e=E.minX;e<=E.maxX;++e)for(let n=E.minY;n<=E.maxY;++n){if(l&&!g.tileCoordIntersectsViewport([p,e,n],P))continue;const s=this.getTile(p,e,n,t);if(this.isDrawableTile(s)){const e=r(this);if(s.getState()==Lo){T[p][s.tileCoord.toString()]=s;let t=s.inTransition(e);t&&1!==i.opacity&&(s.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(s)||(this.newTiles_=!0)}if(1===s.getAlpha(e,t.time))continue}const o=g.getTileCoordChildTileRange(s.tileCoord,M,F);let a=!1;o&&(a=R(p+1,o)),a||g.forEachTileCoordParentTileRange(s.tileCoord,R,M,F)}const I=f/o*h/y;Qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-v/2,-x/2);const L=ii(this.pixelTransform);this.useContainer(e,L,this.getBackground(t));const A=this.context,k=A.canvas;ti(this.inversePixelTransform,this.pixelTransform),Qe(this.tempTransform,v/2,x/2,I,I,0,-v/2,-x/2),k.width!=v||k.height!=x?(k.width=v,k.height=x):this.containerReused||A.clearRect(0,0,v,x),b&&this.clipUnrotated(A,t,b),c.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,t),this.renderedTiles.length=0;let O,D,G,z=Object.keys(T).map(Number);z.sort(tt),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(O=[],D=[]):z=z.reverse();for(let e=z.length-1;e>=0;--e){const i=z[e],n=c.getTilePixelSize(i,h,s),o=g.getResolution(i)/f,a=n[0]*o*I,l=n[1]*o*I,u=g.getTileCoordForCoordAndZ(Ie(C),i),d=g.getTileCoordExtent(u),m=He(this.tempTransform,[y*(d[0]-C[0])/f,y*(C[3]-d[3])/f]),_=y*c.getGutterForProjection(s),v=T[i];for(const e in v){const n=v[e],s=n.tileCoord,o=u[1]-s[1],h=Math.round(m[0]-(o-1)*a),d=u[2]-s[2],g=Math.round(m[1]-(d-1)*l),f=Math.round(m[0]-o*a),y=Math.round(m[1]-d*l),x=h-f,b=g-y,w=p===i,S=w&&1!==n.getAlpha(r(this),t.time);let C=!1;if(!S)if(O){G=[f,y,f+x,y,f+x,y+b,f,y+b];for(let t=0,e=O.length;ti;){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);Pl(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 u=t[e],c=i,d=n;for(Il(t,i,e),r(t[n],u)>0&&Il(t,i,n);c0;)d--}0===r(t[i],u)?Il(t,i,d):Il(t,++d,n),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function Il(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Ll(t,e){return te?1:0}class Al{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(!Xl(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=Wl(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ol(i,this.toBBox),Ol(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Wl([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ol(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=Dl(t,0,o,this.toBBox),a=Dl(t,o,i,this.toBBox),l=Bl(e,a),h=jl(e)+jl(a);l=e;n--){const e=t.children[n];Gl(o,t.leaf?r(e):e),a+=Ul(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Gl(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():Ol(t[i],this.toBBox)}}function kl(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Wl(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Yl(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;Ml(t,o,e,i,r),s.push(e,o,o,i)}}function Zl(t){return new Ar({fill:ql(t,""),stroke:Kl(t,""),text:Hl(t),image:$l(t)})}function ql(t,e){const i=t[e+"fill-color"];if(i)return new Jt({color:i})}function Kl(t,e){const i=t[e+"stroke-width"],n=t[e+"stroke-color"];if(i||n)return new Rr({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 Hl(t){const e=t["text-value"];if(!e)return;return new Or({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"],repeat:t["text-repeat"],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:ql(t,"text-"),backgroundFill:ql(t,"text-background-"),stroke:Kl(t,"text-"),backgroundStroke:Kl(t,"text-background-")})}function $l(t){const e=t["icon-src"],i=t["icon-img"];if(e||i){return new Ve({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 qt({points:n,fill:ql(t,e),stroke:Kl(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 Ht({radius:r,fill:ql(t,e),stroke:Kl(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"]})}}const Jl="renderOrder";var Ql=class extends so{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(Jl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Al(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(Jl,t)}setStyle(t){let e;if(void 0===t)e=Pr;else if(null===t)e=null;else if("function"==typeof t)e=t;else if(t instanceof Ar)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let e=0;eo&&(this.instructions.push([sh.CUSTOM,o,l,t,i,zn]),this.hitDetectionInstructions.push([sh.CUSTOM,o,l,t,n||i,zn]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),l=this.coordinates.length,this.instructions.push([sh.CUSTOM,o,l,t,i]),this.hitDetectionInstructions.push([sh.CUSTOM,o,l,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[sh.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[sh.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;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=[sh.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[sh.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"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&&!rt(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=[sh.END_GEOMETRY,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 lh=class extends ah{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([sh.DRAW_IMAGE,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([sh.DRAW_IMAGE,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([sh.DRAW_IMAGE,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([sh.DRAW_IMAGE,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 hh=class extends ah{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=[sh.MOVE_TO_LINE_TO,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([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,It,0],nh);const s=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(s,0,s.length,o),this.hitDetectionInstructions.push(ih),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([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],nh);const s=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride();let l=0;for(let t=0,e=s.length;t=t){const e=(t-a+c)/c,d=b(i,h,e),g=b(n,u,e);l.push(d,g),s.push(l),l=[d,g],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function dh(t,e,i,n,r){let s,o,a,l,h,u,c,d,g,p,f=i,m=i,_=0,y=0,v=i;for(o=i;ot&&(y>_&&(_=y,f=v,m=o),y=0,v=o-r)),a=l,c=g,d=p),h=i,u=n}return y+=l,y>_?[v,o]:[f,m]}const gh={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const ph={Circle:uh,Default:ah,Image:lh,LineString:hh,Polygon:uh,Text:class extends ah{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 u=r.padding;if(u!=Dt&&(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),u=[t,e,i,n]}const c=this.pixelRatio;this.instructions.push([sh.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,u==Dt?Dt:u.map((function(t){return t*c})),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/c;this.hitDetectionInstructions.push([sh.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,u,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),this.endGeometry(e)}else{if(!ke(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 F=x>T;const M=Math.PI,P=[],I=S+n===e;let L;if(m=0,_=C,d=t[e=S],g=t[e+1],I){y(),L=Math.atan2(g-f,d-p),F&&(L+=L>0?-M:M);const t=(T+x)/2,e=(R+w)/2;return P[0]=[t,e,(E-s)/2,L,r],P}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t0?-M:M),void 0!==L){let t=x-L;if(t+=t>M?-2*M:t<-M?2*M:0,Math.abs(t)>o)return null}L=x;const w=t;let S=0;for(;t0&&t.push("\n",""),t.push(e,""),t}var Th=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],u=Array.isArray(t),c=a.justify?gh[a.justify]:Ch(Array.isArray(t)?t[0]:t,a.textAlign||kt),d=n&&s.lineWidth?s.lineWidth:0,g=u?t:t.split("\n").reduce(Eh,[]),{width:p,height:f,widths:m,heights:_,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l;continue}const d=e[h+1]||t.font,g=Xt(d,c);i.push(g),o+=g;const p=Bt(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,g),v=p+d,x=[],b=(v+2)*h[0],w=(f+d)*h[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",d),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let E=c*v+C*d;const T=[],R=[];let F,M=0,P=0,I=0,L=0;for(let t=0,e=g.length;tt?t-l:r,v=s+h>e?e-h:s,x=g[3]+y*c[0]+g[1],b=g[0]+v*c[1]+g[2],w=m-g[3],S=_-g[0];let C;return(p||0!==u)&&(yh[0]=w,bh[0]=w,yh[1]=S,vh[1]=S,vh[0]=w+x,xh[0]=vh[0],xh[1]=S+b,bh[1]=xh[1]),0!==u?(C=Qe([1,0,0,1,0,0],i,n,1,1,u,-i,-n),He(C,yh),He(C,vh),He(C,xh),He(C,bh),de(Math.min(yh[0],vh[0],xh[0],bh[0]),Math.min(yh[1],vh[1],xh[1],bh[1]),Math.max(yh[0],vh[0],xh[0],bh[0]),Math.max(yh[1],vh[1],xh[1],bh[1]),_h)):de(Math.min(w,w+x),Math.min(S,S+b),Math.max(w,w+x),Math.max(S,S+b),_h),d&&(m=Math.round(m),_=Math.round(_)),{drawImageX:m,drawImageY:_,drawImageW:y,drawImageH:v,originX:l,originY:h,declutterBox:{minX:_h[0],minY:_h[1],maxX:_h[2],maxY:_h[3],value:f},canvasTransform:C,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=t.canvas,u=o?o[2]*n.scale[0]/2:0;return l.minX-u<=h.width/e&&l.maxX+u>=0&&l.minY-u<=h.height/e&&l.maxY+u>=0&&(a&&this.replayTextBackground_(t,yh,vh,xh,bh,s,o),Yt(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=He(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=Ch(Array.isArray(t)?t[0]:t,r.textAlign||kt),h=gh[r.textBaseline||Ot],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){let l;var h,u;this.pixelCoordinates_&&rt(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=pn(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),h=this.renderedTransform_,u=i,h[0]=u[0],h[1]=u[1],h[2]=u[2],h[3]=u[3],h[4]=u[4],h[5]=u[5]);let c=0;const d=n.length;let g,p,f,m,_,y,v,x,b,w,S,C,E=0,T=0,R=0,F=null,M=null;const P=this.coordinateCache_,I=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:I},k=this.instructions!=n||this.overlaps?0:200;let O,D,G,z;for(;ck&&(this.fill_(t),T=0),R>k&&(t.stroke(),R=0),T||R||(t.beginPath(),m=NaN,_=NaN),++c;break;case sh.CIRCLE:E=i[1];const n=l[E],h=l[E+1],u=l[E+2]-n,d=l[E+3]-h,N=Math.sqrt(u*u+d*d);t.moveTo(n+N,h),t.arc(n,h,N,0,2*Math.PI,!0),++c;break;case sh.CLOSE_PATH:t.closePath(),++c;break;case sh.CUSTOM:E=i[1],g=i[2];const j=i[3],U=i[4],B=6==i.length?i[5]:void 0;A.geometry=j,A.feature=O,c in P||(P[c]=[]);const V=P[c];B?B(l,E,g,2,V):(V[0]=l[E],V[1]=l[E+1],V.length=2),U(V,A),++c;break;case sh.DRAW_IMAGE:E=i[1],g=i[2],x=i[3],p=i[4],f=i[5];let X=i[6];const W=i[7],Y=i[8],Z=i[9],q=i[10];let K=i[11];const H=i[12];let $=i[13];const J=i[14],Q=i[15];if(!x&&i.length>=20){b=i[19],w=i[20],S=i[21],C=i[22];const t=this.drawLabelWithPointPlacement_(b,w,S,C);x=t.label,i[3]=x;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const n=i[24];f=(t.anchorY-n)*this.pixelRatio,i[5]=f,X=x.height,i[6]=X,$=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=Dt,it=!1,nt=!1),q&&L?K+=I:q||L||(K-=I);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"!==d&&"Text"!==d||s.includes(t)){const i=(c[a]-3)/4,s=n-i%o,l=n-(i/o|0),h=r(t,e,s*s+l*l);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let f,m,_,y,v;for(p.sort(tt),f=p.length-1;f>=0;--f){const t=p[f].toString();for(_=this.executorsByZIndex_[t],m=Rh.length-1;m>=0;--m)if(d=Rh[m],y=_[d],void 0!==y&&(v=y.executeHitDetection(h,a,i,g,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 pn(o,0,8,2,t,o),o}isEmpty(){return ht(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let l,h,u,c,d,g;for(a.sort(tt),this.maxExtent_&&(t.save(),this.clip(t,i)),s=s||Rh,o&&a.reverse(),l=0,h=a.length;lt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Lt,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:k(t||At)}}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:k(t||Mt)}}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:Pt,lineDash:n||It,lineDashOffset:r||0,lineJoin:void 0!==s?s:Lt,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:k(t||At)}}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(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:Ft,textAlign:void 0!==u?u:kt,textBaseline:void 0!==c?c:Ot},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 Ih=.5;function Lh(t,e,i,n,r,s,o){const a=X(t[0]*Ih,t[1]*Ih);a.imageSmoothingEnabled=!1;const l=a.canvas,h=new Ph(a,Ih,r,null,o),u=i.length,c=Math.floor(16777215/u),d={};for(let t=1;t<=u;++t){const e=i[t-1],o=e.getStyleFunction()||n;if(!n)continue;let a=o(e,s);if(!a)continue;Array.isArray(a)||(a=[a]);const l=(t*c).toString(16).padStart(7,"#00000");for(let t=0,i=a.length;t{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];He(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]*Ih,h=t[1]*Ih;a.push(this.getRenderTransform(e,i,n,Ih,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!le(c,s)){let t=s[0];const r=Ae(c);let o,u=0;for(;tc[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,Ih,l,h,o).slice()),t-=r}this.hitDetectionImageData_=Lh(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n)}e(Ah(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},u=function(t,e,i){const o=r(t),a=h[o];if(a){if(!0!==a&&ic=n.forEachFeatureAtCoordinate(t,o,a,i,u,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[zs],r=t.viewHints[Ns],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,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Dh);const f=l.center.slice(),m=re(a,g*u),_=m.slice(),y=[m.slice()],v=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!le(v,t.extent)){const t=Ae(v),e=Math.max(Ae(m)/2,t);m[0]=v[0]-e,m[2]=v[2]+e,Mi(f,h);const i=Ge(y[0],h);i[0]v[0]&&i[2]>v[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&le(this.wrappedRenderedExtent_,m))return rt(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=f,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new fh(zh(u,c),m,u,c);let b;this.getLayer().getDeclutter()&&(b=new fh(zh(u,c),m,u,c));const w=on();let S;if(w){for(let t=0,e=y.length;t{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,u)),i){const e=this.renderFeature(t,C,i,x,S,b);E=E&&!e}},R=hn(m,h),F=i.getFeaturesInExtent(R);p&&F.sort(p);for(let t=0,e=F.length;t=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 tu(t,e){return function(i,n,r,s,o){const a=this;Qh(t,e,i,n,r,(function(t,e){a.addFeatures(t),void 0!==s&&s(t)}),o||at)}}class eu extends ${constructor(t,e,i){super(t),this.feature=e,this.features=i}}var iu=class extends el{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=at,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(p(this.format_,7),this.loader_=tu(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:$h;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Vh:null,this.loadedExtentsRtree_=new Vh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new bs(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=r(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new eu(Xh,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[dt(e,ct.CHANGE,this.handleFeatureChange_,this),dt(e,J,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(p(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(ys,(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(pt)}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 eu(Yh);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(),ht(this.nullGeometryFeatures_)||nt(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=function(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]]];Ge(t,e);const n=Ae(i);if(Ae(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]}(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||st,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 eu(Kh,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new eu(Hh))})),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=r(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=r(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(pt),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new eu(Zh,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){p(this.format_,7),this.url_=t,this.setLoader(tu(t,this.format_))}};const nu={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},ru={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var su=class extends Rl{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!==Lo&&r!==Ao||(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),u=n.viewHints,c=!(u[zs]||u[Ns]);!c&&h.wantedResolution||(h.wantedResolution=o);return this.prepareTile(h,r,a)&&(c||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()?r(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(),s=n.getRevision(),o=n.getRenderOrder()||null,a=t.wantedResolution,l=t.getReplayState(n);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==s&&l.renderedRenderOrder==o)return;const h=n.getSource(),u=n.getDeclutter(),c=h.getTileGrid(),d=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),g=h.getSourceTiles(e,i,t),p=r(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],u&&(t.declutterExecutorGroups[p]=[]),l.dirty=!1;for(let i=0,r=g.length;i{const r=n===m?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,s=n.length;e{const n=this.getLayer(),s=r(n),o=n.getSource(),a=this.renderedProjection,h=a.getExtent(),u=this.renderedResolution,c=o.getTileGridForProjection(a),d=He(this.renderedPixelToCoordinateTransform_,t.slice()),g=c.getTileCoordForCoordAndResolution(d,u);let p;for(let t=0,e=this.renderedTiles.length;t0)return void e([]);const f=Ie(c.getTileCoordExtent(p.wrappedTileCoord)),m=[(d[0]-f[0])/u,(f[1]-d[1])/u],_=p.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let y=p.hitDetectionImageData[s];if(!y){const t=l(c.getTileSize(c.getZForResolution(u,o.zDirection))),e=this.renderedRotation_;y=Lh(t,[this.getRenderTransform(c.getTileCoordCenter(p.wrappedTileCoord),u,0,Ih,t[0]*Ih,t[1]*Ih,0)],_,n.getStyleFunction(),c.getTileCoordExtent(p.wrappedTileCoord),p.getReplayState(n).renderedResolution,e),p.hitDetectionImageData[s]=y}e(Ah(m,_,y))}))}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,s=!(n[zs]||n[Ns]),o=this.renderedTiles;for(let e=0,i=o.length;e=0;--e)n[e].execute(this.context,1,this.getTileRenderTransform(i,t),t.viewState.rotation,s,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),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),g=u.getTileCoordExtent(c,this.tmpExtent)[0]-d[0];return qe($e(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[zs]||i[Ns]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;const s=this.getLayer(),o=s.getRenderMode(),a=t.globalAlpha;t.globalAlpha=s.getOpacity();const l=ru[o],h=e.viewState,u=h.rotation,c=s.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),g=this.renderedTiles,p=[],f=[];let m=!0;for(let i=g.length-1;i>=0;--i){const o=g[i];m=m&&!o.getReplayState(s).dirty;const a=o.executorGroups[r(s)].filter((t=>t.hasExecutors(l)));if(0===a.length)continue;const h=this.getTileRenderTransform(o,e),c=o.tileCoord[0];let _=!1;const y=a[0].getClipCoords(h);if(y){for(let e=0,i=p.length;e{const n=function(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return Aa(e,i,n)}(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?Po:ko,r,this.format_,this.tileLoadFunction);i.sourceTiles.push(s);const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===Lo||n===Ao){const e=s.getKey();e in i.errorTileKeys?s.getState()===Lo&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===Ao?i.errorTileKeys[e]=!0:s.removeEventListener(ct.CHANGE,t),0===i.loadingSourceTiles&&i.setState(ht(i.errorTileKeys)?Lo:Ao)}};s.addEventListener(ct.CHANGE,t),i.loadingSourceTiles++}o===Po&&(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()===Ao))?Ao:Lo)}return i.sourceTiles}getTile(t,e,i,n,r){const s=Aa(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 u=this.getTileGrid().getExtent(),c=this.getTileGridForProjection(r);if(h&&u){const e=c.getTileCoordExtent(h);re(e,-c.getResolution(t),e),ke(u,e)||(h=null)}let d=!0;if(null!==h){const e=this.tileGrid,i=c.getResolution(t),s=e.getZForResolution(i,1),o=c.getTileCoordExtent(h);re(o,-i,o),e.forEachTileCoord(o,s,(t=>{d=d&&!this.tileUrlFunction(t,n,r)}))}const g=new hu(l,d?ko:Po,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=Us+1;for(let t=n.length;t255?255:t}function fu(t){return t<0?0:t>1?1:t}function mu(t){return"%"===t[t.length-1]?pu(parseFloat(t)/100*255):pu(parseInt(t))}function _u(t){return"%"===t[t.length-1]?fu(parseFloat(t)/100):fu(parseFloat(t))}function yu(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{du={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in gu)return gu[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var s=i.substr(0,n),o=i.substr(n+1,r-(n+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=_u(o.pop());case"rgb":return 3!==o.length?null:[mu(o[0]),mu(o[1]),mu(o[2]),a];case"hsla":if(4!==o.length)return null;a=_u(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=_u(o[1]),u=_u(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[pu(255*yu(d,c,l+1/3)),pu(255*yu(d,c,l)),pu(255*yu(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}var vu=function(t,e,i,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n};function xu(t){return"object"==typeof t?["literal",t]:t}function bu(t,e){var i=t.stops;if(!i)return function(t,e){var i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];var n=["color"===e.type?"to-color":e.type,i,xu(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}(t,e);var n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((function(t){return!r&&e.tokens&&"string"==typeof t[1]?[t[0],Fu(t[1])]:[t[0],xu(t[1])]})),n?function(t,e,i){for(var n={},r={},s=[],o=0;o3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Ru(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Fu(t){for(var e=["concat"],i=/{([^{}]+)}/g,n=0,r=i.exec(t);null!==r;r=i.exec(t)){var s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Vu=[Iu,Lu,Au,ku,Ou,Nu,Du,Uu(Gu),ju];function Xu(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Xu(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var i=0,n=Vu;i=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,i,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function Ju(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof vu)return!0;if(t instanceof Zu)return!0;if(t instanceof Ku)return!0;if(t instanceof Hu)return!0;if(Array.isArray(t)){for(var e=0,i=t;e2){var a=t[1];if("string"!=typeof a||!(a in nc)||"object"===a)return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=nc[a],n++}else s=Gu;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}i=Uu(s,o)}else i=nc[r];for(var l=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var sc=function(t){this.type=Nu,this.sections=t};sc.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");for(var n=[],r=!1,s=1;s<=t.length-1;++s){var o=t[s];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;var a=null;if(o["font-scale"]&&!(a=e.parse(o["font-scale"],1,Lu)))return null;var l=null;if(o["text-font"]&&!(l=e.parse(o["text-font"],1,Uu(Au))))return null;var h=null;if(o["text-color"]&&!(h=e.parse(o["text-color"],1,Ou)))return null;var u=n[n.length-1];u.scale=a,u.font=l,u.textColor=h}else{var c=e.parse(t[s],1,Gu);if(!c)return null;var d=c.type.kind;if("string"!==d&&"value"!==d&&"null"!==d&&"resolvedImage"!==d)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:c,scale:null,font:null,textColor:null})}}return new sc(n)},sc.prototype.evaluate=function(t){return new Ku(this.sections.map((function(e){var i=e.content.evaluate(t);return Qu(i)===ju?new qu("",i,null,null,null):new qu(tc(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},sc.prototype.eachChild=function(t){for(var e=0,i=this.sections;e-1),i},oc.prototype.eachChild=function(t){t(this.input)},oc.prototype.outputDefined=function(){return!1},oc.prototype.serialize=function(){return["image",this.input.serialize()]};var ac={"to-boolean":ku,"to-color":Ou,"to-number":Lu,"to-string":Au},lc=function(t,e){this.type=t,this.args=e};lc.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");for(var n=ac[i],r=[],s=1;s4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":$u(e[0],e[1],e[2],e[3])))return new vu(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ic(i||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,a=0,l=this.args;a=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function mc(t,e){var i,n=(180+t[0])/360,r=(i=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360),s=Math.pow(2,e.z);return[Math.round(n*s*gc),Math.round(r*s*gc)]}function _c(t,e,i){var n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function yc(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function vc(t,e){for(var i=!1,n=0,r=e.length;n0&&c<0||u<0&&c>0}function wc(t,e,i){for(var n=0,r=i;ni[2]){var r=.5*n,s=t[0]-i[0]>r?-n:i[0]-t[0]>r?n:0;0===s&&(s=t[0]-i[2]>r?-n:i[2]-t[0]>r?n:0),t[0]+=s}pc(e,t)}function Fc(t,e,i,n){var r=Math.pow(2,n.z)*gc,s=[n.x*gc,n.y*gc],o=[];if(!t)return o;for(var a=0,l=t;a=0)return!1;var i=!0;return t.eachChild((function(t){i&&!Ac(t,e)&&(i=!1)})),i}Pc.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(Ju(t[1])){var i=t[1];if("FeatureCollection"===i.type)for(var n=0;ne))throw new ic("Input is not a number.");o=a-1}return 0}Oc.prototype.parse=function(t,e,i,n,r){return void 0===r&&(r={}),e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)},Oc.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new rc(e,[t]):"coerce"===i?new lc(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var r=this.registry[n];if(r){var s=r.parse(t,this);if(!s)return null;if(this.expectedType){var o=this.expectedType,a=s.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==a.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(o,a))return null}else s=i(s,o,e.typeAnnotation||"coerce");else s=i(s,o,e.typeAnnotation||"assert")}if(!(s instanceof ec)&&"resolvedImage"!==s.type.kind&&Dc(s)){var l=new uc;try{s=new ec(s.type,s.evaluate(l))}catch(t){return this.error(t.message),null}}return s}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},Oc.prototype.concat=function(t,e,i){var n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new Oc(this.registry,n,e||null,r,this.errors)},Oc.prototype.error=function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Mu(n,t))},Oc.prototype.checkSubtype=function(t,e){var i=Xu(t,e);return i&&this.error(i),i};var zc=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,r=i;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var u=e.parse(a,h,r);if(!u)return null;r=r||u.type,n.push([o,u])}return new zc(r,i,n)},zc.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Gc(e,n)].evaluate(t)},zc.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Nc=jc;function jc(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=i,this.p2y=n}function Uc(t,e,i){return t*(1-i)+e*i}jc.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},jc.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},jc.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},jc.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},jc.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Bc=Object.freeze({__proto__:null,number:Uc,color:function(t,e,i){return new vu(Uc(t.r,e.r,i),Uc(t.g,e.g,i),Uc(t.b,e.b,i),Uc(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,n){return Uc(t,e[n],i)}))}}),Vc=.95047,Xc=1,Wc=1.08883,Yc=4/29,Zc=6/29,qc=3*Zc*Zc,Kc=Zc*Zc*Zc,Hc=Math.PI/180,$c=180/Math.PI;function Jc(t){return t>Kc?Math.pow(t,1/3):t/qc+Yc}function Qc(t){return t>Zc?t*t*t:qc*(t-Yc)}function td(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ed(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function id(t){var e=ed(t.r),i=ed(t.g),n=ed(t.b),r=Jc((.4124564*e+.3575761*i+.1804375*n)/Vc),s=Jc((.2126729*e+.7151522*i+.072175*n)/Xc);return{l:116*s-16,a:500*(r-s),b:200*(s-Jc((.0193339*e+.119192*i+.9503041*n)/Wc)),alpha:t.a}}function nd(t){var e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=Xc*Qc(e),i=Vc*Qc(i),n=Wc*Qc(n),new vu(td(3.2404542*i-1.5371385*e-.4985314*n),td(-.969266*i+1.8760108*e+.041556*n),td(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function rd(t,e,i){var n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}var sd={forward:id,reverse:nd,interpolate:function(t,e,i){return{l:Uc(t.l,e.l,i),a:Uc(t.a,e.a,i),b:Uc(t.b,e.b,i),alpha:Uc(t.alpha,e.alpha,i)}}},od={forward:function(t){var e=id(t),i=e.l,n=e.a,r=e.b,s=Math.atan2(r,n)*$c;return{h:s<0?s+360:s,c:Math.sqrt(n*n+r*r),l:i,alpha:t.a}},reverse:function(t){var e=t.h*Hc,i=t.c;return nd({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:rd(t.h,e.h,i),c:Uc(t.c,e.c,i),l:Uc(t.l,e.l,i),alpha:Uc(t.alpha,e.alpha,i)}}},ad=function(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(var s=0,o=r;s1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:a}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(r=e.parse(r,2,Lu)))return null;var l=[],h=null;"interpolate-hcl"===i||"interpolate-lab"===i?h=Ou:e.expectedType&&"value"!==e.expectedType.kind&&(h=e.expectedType);for(var u=0;u=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',g);var f=e.parse(d,p,h);if(!f)return null;h=h||f.type,l.push([c,f])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new ad(h,i,n,r,l):e.error("Type "+Bu(h)+" is not interpolatable.")},ad.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);var s=Gc(e,n),o=e[s],a=e[s+1],l=ad.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?Bc[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?od.reverse(od.interpolate(od.forward(h),od.forward(u),l)):sd.reverse(sd.interpolate(sd.forward(h),sd.forward(u),l))},ad.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e=i.length)throw new ic("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new ic("Array index must be an integer, but found "+e+" instead.");return i[e]},cd.prototype.eachChild=function(t){t(this.index),t(this.input)},cd.prototype.outputDefined=function(){return!1},cd.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var dd=function(t,e){this.type=ku,this.needle=t,this.haystack=e};dd.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Gu),n=e.parse(t[2],2,Gu);return i&&n?Wu(i.type,[ku,Au,Lu,Iu,Gu])?new dd(i,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Bu(i.type)+" instead"):null},dd.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!Yu(e,["boolean","string","number","null"]))throw new ic("Expected first argument to be of type boolean, string, number or null, but found "+Bu(Qu(e))+" instead.");if(!Yu(i,["string","array"]))throw new ic("Expected second argument to be of type array or string, but found "+Bu(Qu(i))+" instead.");return i.indexOf(e)>=0},dd.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},dd.prototype.outputDefined=function(){return!0},dd.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var gd=function(t,e,i){this.type=Lu,this.needle=t,this.haystack=e,this.fromIndex=i};gd.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Gu),n=e.parse(t[2],2,Gu);if(!i||!n)return null;if(!Wu(i.type,[ku,Au,Lu,Iu,Gu]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Bu(i.type)+" instead");if(4===t.length){var r=e.parse(t[3],3,Lu);return r?new gd(i,n,r):null}return new gd(i,n)},gd.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Yu(e,["boolean","string","number","null"]))throw new ic("Expected first argument to be of type boolean, string, number or null, but found "+Bu(Qu(e))+" instead.");if(!Yu(i,["string","array"]))throw new ic("Expected second argument to be of type array or string, but found "+Bu(Qu(i))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)},gd.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},gd.prototype.outputDefined=function(){return!1},gd.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var pd=function(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s};pd.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var r={},s=[],o=2;oNumber.MAX_SAFE_INTEGER)return h.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof d&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,Qu(d)))return null}else i=Qu(d);if(void 0!==r[String(d)])return h.error("Branch labels must be unique.");r[String(d)]=s.length}var g=e.parse(l,o,n);if(!g)return null;n=n||g.type,s.push(g)}var p=e.parse(t[1],1,Gu);if(!p)return null;var f=e.parse(t[t.length-1],t.length-1,n);return f?"value"!==p.type.kind&&e.concat(1).checkSubtype(i,p.type)?null:new pd(i,n,p,r,s,f):null},pd.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(Qu(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},pd.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},pd.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},pd.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],n={},r=0,s=Object.keys(this.cases).sort();r=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Gu),n=e.parse(t[2],2,Lu);if(!i||!n)return null;if(!Wu(i.type,[Uu(Gu),Au,Gu]))return e.error("Expected first argument to be of type array or string, but found "+Bu(i.type)+" instead");if(4===t.length){var r=e.parse(t[3],3,Lu);return r?new md(i.type,i,n,r):null}return new md(i.type,i,n)},md.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Yu(e,["string","array"]))throw new ic("Expected first argument to be of type array or string, but found "+Bu(Qu(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)},md.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},md.prototype.outputDefined=function(){return!1},md.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var xd=vd("==",(function(t,e,i){return e===i}),yd),bd=vd("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!yd(0,e,i,n)})),wd=vd("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),Cd=vd("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),Ed=vd(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0})),Td=function(t,e,i,n,r){this.type=Au,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r};Td.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Lu);if(!i)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var r=null;if(n.locale&&!(r=e.parse(n.locale,1,Au)))return null;var s=null;if(n.currency&&!(s=e.parse(n.currency,1,Au)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Lu)))return null;var a=null;return n["max-fraction-digits"]&&!(a=e.parse(n["max-fraction-digits"],1,Lu))?null:new Td(i,r,s,o,a)},Td.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Td.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Td.prototype.outputDefined=function(){return!1},Td.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Rd=function(t){this.type=Lu,this.input=t};Rd.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error("Expected argument of type string or array, but found "+Bu(i.type)+" instead."):new Rd(i):null},Rd.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ic("Expected value to be of type string or array, but found "+Bu(Qu(e))+" instead.")},Rd.prototype.eachChild=function(t){t(this.input)},Rd.prototype.outputDefined=function(){return!1},Rd.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Fd={"==":xd,"!=":bd,">":Sd,"<":wd,">=":Ed,"<=":Cd,array:rc,at:cd,boolean:rc,case:fd,coalesce:hd,collator:dc,format:sc,image:oc,in:dd,"index-of":gd,interpolate:ad,"interpolate-hcl":ad,"interpolate-lab":ad,length:Rd,let:ud,literal:ec,match:pd,number:rc,"number-format":Td,object:rc,slice:md,step:zc,string:rc,"to-boolean":lc,"to-color":lc,"to-number":lc,"to-string":lc,var:kc,within:Pc};function Md(t,e){var i=e[0],n=e[1],r=e[2],s=e[3];i=i.evaluate(t),n=n.evaluate(t),r=r.evaluate(t);var o=s?s.evaluate(t):1,a=$u(i,n,r,o);if(a)throw new ic(a);return new vu(i/255*o,n/255*o,r/255*o,o)}function Pd(t,e){return t in e}function Id(t,e){var i=e[t];return void 0===i?null:i}function Ld(t){return{type:t}}function Ad(t){return{result:"success",value:t}}function kd(t){return{result:"error",value:t}}function Od(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}cc.register(Fd,{error:[{kind:"error"},[Au],function(t,e){var i=e[0];throw new ic(i.evaluate(t))}],typeof:[Au,[Gu],function(t,e){return Bu(Qu(e[0].evaluate(t)))}],"to-rgba":[Uu(Lu,4),[Ou],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Ou,[Lu,Lu,Lu],Md],rgba:[Ou,[Lu,Lu,Lu,Lu],Md],has:{type:ku,overloads:[[[Au],function(t,e){return Pd(e[0].evaluate(t),t.properties())}],[[Au,Du],function(t,e){var i=e[0],n=e[1];return Pd(i.evaluate(t),n.evaluate(t))}]]},get:{type:Gu,overloads:[[[Au],function(t,e){return Id(e[0].evaluate(t),t.properties())}],[[Au,Du],function(t,e){var i=e[0],n=e[1];return Id(i.evaluate(t),n.evaluate(t))}]]},"feature-state":[Gu,[Au],function(t,e){return Id(e[0].evaluate(t),t.featureState||{})}],properties:[Du,[],function(t){return t.properties()}],"geometry-type":[Au,[],function(t){return t.geometryType()}],id:[Gu,[],function(t){return t.id()}],zoom:[Lu,[],function(t){return t.globals.zoom}],pitch:[Lu,[],function(t){return t.globals.pitch||0}],"distance-from-center":[Lu,[],function(t){return t.distanceFromCenter()}],"heatmap-density":[Lu,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Lu,[],function(t){return t.globals.lineProgress||0}],"sky-radial-progress":[Lu,[],function(t){return t.globals.skyRadialProgress||0}],accumulated:[Gu,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Lu,Ld(Lu),function(t,e){for(var i=0,n=0,r=e;n":[ku,[Au,Gu],function(t,e){var i=e[0],n=e[1],r=t.properties()[i.value],s=n.value;return typeof r==typeof s&&r>s}],"filter-id->":[ku,[Gu],function(t,e){var i=e[0],n=t.id(),r=i.value;return typeof n==typeof r&&n>r}],"filter-<=":[ku,[Au,Gu],function(t,e){var i=e[0],n=e[1],r=t.properties()[i.value],s=n.value;return typeof r==typeof s&&r<=s}],"filter-id-<=":[ku,[Gu],function(t,e){var i=e[0],n=t.id(),r=i.value;return typeof n==typeof r&&n<=r}],"filter->=":[ku,[Au,Gu],function(t,e){var i=e[0],n=e[1],r=t.properties()[i.value],s=n.value;return typeof r==typeof s&&r>=s}],"filter-id->=":[ku,[Gu],function(t,e){var i=e[0],n=t.id(),r=i.value;return typeof n==typeof r&&n>=r}],"filter-has":[ku,[Gu],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[ku,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[ku,[Uu(Au)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[ku,[Uu(Gu)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[ku,[Au,Uu(Gu)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[ku,[Au,Uu(Gu)],function(t,e){var i=e[0],n=e[1];return function(t,e,i,n){for(;i<=n;){var r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[i.value],n.value,0,n.value.length-1)}],all:{type:ku,overloads:[[[ku,ku],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)&&n.evaluate(t)}],[Ld(ku),function(t,e){for(var i=0,n=e;i-1}(e))return kd([new Mu("","zoom expressions not supported")]);var s=Ud(i);if(!s&&!r)return kd([new Mu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Mu)return kd([s]);if(s instanceof ad&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return kd([new Mu("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Ad(new zd(n?"constant":"source",t.value));var o=s instanceof ad?s.interpolation:void 0;return Ad(new Nd(n?"camera":"composite",t.value,s.labels,o))}function Ud(t){var e=null;if(t instanceof ud)e=Ud(t.result);else if(t instanceof hd)for(var i=0,n=t.args;i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function Xd(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,i=t.slice(1);e",">=","<","<=","to-boolean"]);function Hd(t,e){return te?1:0}function $d(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(var e=1;e"===i||"<="===i||">="===i?Qd(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(Jd))):"all"===i?["all"].concat(t.slice(1).map(Jd)):"none"===i?["all"].concat(t.slice(1).map(Jd).map(ig)):"in"===i?tg(t[1],t.slice(2)):"!in"===i?ig(tg(t[1],t.slice(2))):"has"===i?eg(t[1]):"!has"===i?ig(eg(t[1])):"within"!==i||t}function Qd(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function tg(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(Hd)]]:["filter-in-small",t,["literal",e]]}}function eg(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function ig(t){return["!",t]}var ng=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function rg(t,e){var i={};for(var n in t)"ref"!==n&&(i[n]=t[n]);return ng.forEach((function(t){t in e&&(i[t]=e[t])})),i}var sg={thin:100,hairline:100,"ultra-light":100,"extra-light":100,light:200,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,heavy:800,black:800,"extra-bold":800,"ultra-black":900,"extra-black":900,"ultra-bold":900,"heavy-black":900,fat:900,poster:900},og=" ",ag=/(italic|oblique)$/i,lg={},hg=function(t,e,i){var n=lg[t];if(!n){Array.isArray(t)||(t=[t]);for(var r=400,s="normal",o=[],a=0,l=t.length;a1?h[h.length-2].toLowerCase():"";if(u==c||u==c.replace("-","")||d+"-"+u==c){r=sg[c],h.pop(),d&&c.startsWith(d)&&h.pop();break}}"number"==typeof u&&(r=u);var g=h.join(og).replace("Klokantech Noto Sans","Noto Sans");-1!==g.indexOf(og)&&(g='"'+g+'"'),o.push(g)}n=lg[t]=[s,r,o]}return n[0]+og+n[1]+og+e+"px"+(i?"/"+i:"")+og+n[2]},ug="https://api.mapbox.com";function cg(t){var e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(e.length)}function dg(t,e){var i=cg(t);if(!i)return decodeURI(new URL(t,location.href).href);var n="styles/";if(0!==i.indexOf(n))throw new Error("unexpected style url: "+t);var r=i.slice(n.length);return ug+"/styles/v1/"+r+"?&access_token="+e}function gg(t,e,i,n){var r=new URL(t,n),s=cg(t);return s?"https://{a-d}.tiles.mapbox.com/v4/"+s+"/{z}/{x}/{y}.vector.pbf?access_token="+e:e?(r.searchParams.set(i,e),decodeURI(r.href)):decodeURI(r.href)}function pg(t){return t*Math.PI/180}var fg=function(){for(var t=[],e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function mg(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);var i=document.createElement("canvas");return i.width=t,i.height=e,i}var _g={};function yg(t,e,i){if(void 0===i&&(i={}),e in _g)return _g[e];var n=i.transformRequest&&i.transformRequest(e,t)||new Request(e);n.headers.get("Accept")||n.headers.set("Accept","application/json");var r=fetch(n).then((function(t){return delete _g[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete _g[e],Promise.reject(new Error("Error fetching source "+e))}));return _g[e]=r,r}var vg={};var xg,bg=Array(256).join(" ");function wg(t,e){if(e>=.05){for(var i="",n=t.split("\n"),r=bg.slice(0,Math.round(e/.1)),s=0,o=n.length;s0&&(i+="\n"),i+=n[s].split("").join(r);return i}return t}function Sg(){return xg||(xg=mg(1,1).getContext("2d")),xg}function Cg(t,e){return Sg().measureText(t).width+(t.length-1)*e}var Eg={};function Tg(t,e,i,n){if(-1!==t.indexOf("\n")){for(var r=t.split("\n"),s=[],o=0,a=r.length;o1){var c=Sg();c.font=e;for(var d=c.measureText("M").width*i,g="",p=[],f=0,m=u.length;f1;++v){var b=p[v];if(Cg(b,n)<.35*d){var w=v>0?Cg(p[v-1],n):1/0,S=v.7*d&&Cg(R,n)<.6*d){var F=T.split(" "),M=F.pop();Cg(M,n)<.2*d&&(p[C]=F.join(" "),p[C+1]=M+" "+R),E-=1}}h=p.join("\n")}else h=t;h=wg(h,n),Eg[l]=h}return h}var Rg,Fg=/font-family: ?([^;]*);/,Mg=/("|')/g;function Pg(t){if(!Rg){Rg={};for(var e=document.styleSheets,i=0,n=e.length;i0&&"string"==typeof l[0]&&l[0]in Fd);if(!d&&Od(u)&&(u=bu(u,c),d=!0),d){var g=Gg(u,c);h[i]=g.evaluate.bind(g)}else"color"==c.type&&(u=vu.parse(u)),h[i]=function(){return u}}return Ng.zoom=n,h[i](Ng,r,o)}function Ug(t,e,i,n){return jg(t,"layout","icon-allow-overlap",e,i,n)?jg(t,"layout","icon-ignore-placement",e,i,n)?"none":"obstacle":"declutter"}function Bg(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=Wd(e).filter),Ng.zoom=n,r[t](Ng,i)}function Vg(t,e){if(t){if(0===t.a||0===e)return;var i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}var Xg=/\{[^{}}]*\}/g;function Wg(t,e){return t.replace(Xg,(function(t){return e[t.slice(1,-1)]||""}))}function Yg(t,e,i,n,r,s,o){if(void 0===n&&(n=fg),void 0===r&&(r=void 0),void 0===s&&(s=void 0),void 0===o&&(o=void 0),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var a,l;if(s)if("undefined"!=typeof Image){var h=new Image;h.crossOrigin="anonymous",h.onload=function(){a=h,l=[h.width,h.height],t.changed(),h.onload=null},h.src=s}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var u=self;u.postMessage({action:"loadImage",src:s}),u.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===s&&(a=t.data.image,l=[a.width,a.height])}))}for(var c,d=function(t){t=t.slice();for(var e=Object.create(null),i=0;i=S.maxzoom)){var P=S.filter;if(!P||Bg(C,P,d,u,y)){var I=void 0,L=void 0,A=void 0,k=void 0,O=void 0,D=void 0,G=w.index;if(3==c&&("fill"==S.type||"fill-extrusion"==S.type))if(L=jg(S,"paint",S.type+"-opacity",u,d,_,p),S.type+"-pattern"in T){var z=jg(S,"paint",S.type+"-pattern",u,d,_,p);if(z){var N="string"==typeof z?Wg(z,s):z.toString();if(a&&r&&r[N]){++v,(D=M[v])&&D.getFill()&&!D.getStroke()&&!D.getText()||(D=new Ar({fill:new Jt}),M[v]=D),A=D.getFill(),D.setZIndex(G);var j=N+"."+L,U=m[j];if(!U){var B=r[N],V=mg(B.width,B.height),X=V.getContext("2d");X.globalAlpha=L,X.drawImage(a,B.x,B.y,B.width,B.height,0,0,B.width,B.height),U=X.createPattern(V,"repeat"),m[j]=U}A.setColor(U)}}}else I=Vg(jg(S,"paint",S.type+"-color",u,d,_,p),L),S.type+"-outline-color"in T&&(O=Vg(jg(S,"paint",S.type+"-outline-color",u,d,_,p),L)),O||(O=I),(I||O)&&(++v,(!(D=M[v])||I&&!D.getFill()||!I&&D.getFill()||O&&!D.getStroke()||!O&&D.getStroke()||D.getText())&&(D=new Ar({fill:I?new Jt:void 0,stroke:O?new Rr:void 0}),M[v]=D),I&&(A=D.getFill()).setColor(I),O&&((k=D.getStroke()).setColor(O),k.setWidth(.5)),D.setZIndex(G));if(1!=c&&"line"==S.type){I=!("line-pattern"in T)&&"line-color"in T?Vg(jg(S,"paint","line-color",u,d,_,p),jg(S,"paint","line-opacity",u,d,_,p)):void 0;var W=jg(S,"paint","line-width",u,d,_,p);I&&W>0&&(++v,(D=M[v])&&D.getStroke()&&!D.getFill()&&!D.getText()||(D=new Ar({stroke:new Rr}),M[v]=D),(k=D.getStroke()).setLineCap(jg(S,"layout","line-cap",u,d,_,p)),k.setLineJoin(jg(S,"layout","line-join",u,d,_,p)),k.setMiterLimit(jg(S,"layout","line-miter-limit",u,d,_,p)),k.setColor(I),k.setWidth(W),k.setLineDash(T["line-dasharray"]?jg(S,"paint","line-dasharray",u,d,_,p).map((function(t){return t*W})):null),D.setZIndex(G))}var Y=!1,Z=null,q=0,K=void 0,H=void 0,$=void 0;if((1==c||2==c)&&"icon-image"in E){var J=jg(S,"layout","icon-image",u,d,_,p);if(J){K="string"==typeof J?Wg(J,s):J.toString();var Q=void 0;if(a&&r&&r[K]){var tt=jg(S,"layout","icon-rotation-alignment",u,d,_,p);if(2==c){var et=e.getGeometry();if(et.getFlatMidpoint||et.getFlatMidpoints){var it=et.getExtent();if(Math.sqrt(Math.max(Math.pow((it[2]-it[0])/i,2),Math.pow((it[3]-it[1])/i,2)))>150){var nt="MultiLineString"===et.getType()?et.getFlatMidpoints():et.getFlatMidpoint();if(kg||(kg=new Er("Point",Ag=[NaN,NaN],[],{},null)),Q=kg,Ag[0]=nt[0],Ag[1]=nt[1],"line"===jg(S,"layout","symbol-placement",u,d,_,p)&&"map"===tt)for(var rt=et.getStride(),st=et.getFlatCoordinates(),ot=0,at=st.length-rt;ot=dt&&nt[0]<=pt&&nt[1]>=gt&&nt[1]<=ft){q=Math.atan2(ht-ct,ut-lt);break}}}}}if(2!==c||Q){var mt=jg(S,"layout","icon-size",u,d,_,p),_t=void 0!==T["icon-color"]?jg(S,"paint","icon-color",u,d,_,p):null;if(!_t||0!==_t.a){var yt=K+"."+mt;if(null!==_t&&(yt+="."+_t),!(H=f[yt])){var vt=r[K],xt=Ug(S,u,d,_);H=new Ve({color:_t?[255*_t.r,255*_t.g,255*_t.b,_t.a]:void 0,img:a,imgSize:l,size:[vt.width,vt.height],offset:[vt.x,vt.y],rotateWithView:"map"===tt,scale:mt/vt.pixelRatio,displacement:"icon-offset"in E?jg(S,"layout","icon-offset",u,d,_,p).map((function(t){return-t*vt.pixelRatio})):void 0,declutterMode:xt}),f[yt]=H}}H&&(++v,(D=M[v])&&D.getImage()&&!D.getFill()&&!D.getStroke()||(D=new Ar,M[v]=D),D.setGeometry(Q),H.setRotation(q+pg(jg(S,"layout","icon-rotate",u,d,_,p))),H.setOpacity(jg(S,"paint","icon-opacity",u,d,_,p)),H.setAnchor(Dg[jg(S,"layout","icon-anchor",u,d,_,p)]),D.setImage(H),Z=D.getText(),D.setText(void 0),D.setZIndex(G),Y=!0,$=!1)}else $=!0}}}if(1==c&&"circle"===S.type){++v,(D=M[v])&&D.getImage()&&!D.getFill()&&!D.getStroke()||(D=new Ar,M[v]=D);var bt="circle-radius"in T?jg(S,"paint","circle-radius",u,d,_,p):5,wt=Vg(jg(S,"paint","circle-stroke-color",u,d,_,p),jg(S,"paint","circle-stroke-opacity",u,d,_,p)),St=Vg(jg(S,"paint","circle-color",u,d,_,p),jg(S,"paint","circle-opacity",u,d,_,p)),Ct=jg(S,"paint","circle-stroke-width",u,d,_,p),Et=bt+"."+wt+"."+St+"."+Ct;(H=f[Et])||(H=new Ht({radius:bt,stroke:wt&&Ct>0?new Rr({width:Ct,color:wt}):void 0,fill:St?new Jt({color:St}):void 0,declutterMode:"none"}),f[Et]=H),D.setImage(H),Z=D.getText(),D.setText(void 0),D.setGeometry(void 0),D.setZIndex(G),Y=!0}var Tt=void 0,Rt=void 0,Ft=void 0,Mt=void 0,Pt=void 0,It=void 0;if("text-field"in E){Mt=Math.round(jg(S,"layout","text-size",u,d,_,p));var Lt=jg(S,"layout","text-font",u,d,_,p);Ft=jg(S,"layout","text-line-height",u,d,_,p),(Rt=hg(o?o(Lt):Lt,Mt,Ft)).includes("sans-serif")||(Rt+=",sans-serif"),Pt=jg(S,"layout","text-letter-spacing",u,d,_,p),It=jg(S,"layout","text-max-width",u,d,_,p);var At=jg(S,"layout","text-field",u,d,_,p);Tt="object"==typeof At&&At.sections?1===At.sections.length?At.toString():At.sections.reduce((function(t,e,i){var n=e.fontStack?e.fontStack.split(","):Lt,r=hg(o?o(n):n,Mt*(e.scale||1),Ft),s=e.text;if("\n"===s)return t.push("\n",""),t;if(2!=c){for(var a=0,l=(s=Tg(s,r,It,Pt).split("\n")).length;a0&&t.push("\n",""),t.push(s[a],r);return t}t.push(wg(s,Pt),r)}),[]):Wg(At,s).trim(),L=jg(S,"paint","text-opacity",u,d,_,p)}if(Tt&&L&&!$){Y||(++v,(D=M[v])&&D.getText()&&!D.getFill()&&!D.getStroke()||(D=new Ar,M[v]=D),D.setImage(void 0),D.setGeometry(void 0)),D.getText()||D.setText(Z||new Or({padding:[2,2,2,2]})),Z=D.getText();var kt=E["text-transform"];"uppercase"==kt?Tt=Array.isArray(Tt)?Tt.map((function(t,e){return e%2?t:t.toUpperCase()})):Tt.toUpperCase():"lowercase"==kt&&(Tt=Array.isArray(Tt)?Tt.map((function(t,e){return e%2?t:t.toLowerCase()})):Tt.toLowerCase());var Ot=Array.isArray(Tt)?Tt:2==c?wg(Tt,Pt):Tg(Tt,Rt,It,Pt);Z.setText(Ot),Z.setFont(Rt),Z.setRotation(pg(jg(S,"layout","text-rotate",u,d,_,p)));var Dt=jg(S,"layout","text-anchor",u,d,_,p),Gt=Y||1==c?"point":jg(S,"layout","symbol-placement",u,d,_,p);Z.setPlacement(Gt),Z.setOverflow("point"===Gt);var zt=jg(S,"paint","text-halo-width",u,d,_,p),Nt=jg(S,"layout","text-offset",u,d,_,p),jt=jg(S,"paint","text-translate",u,d,_,p),Ut=0,Bt=0;if("point"==Gt){var Vt="center";-1!==Dt.indexOf("left")?(Vt="left",Bt=zt):-1!==Dt.indexOf("right")&&(Vt="right",Bt=-zt),Z.setTextAlign(Vt);var Xt=jg(S,"layout","text-rotation-alignment",u,d,_,p);Z.setRotateWithView("map"==Xt)}else Z.setMaxAngle(pg(jg(S,"layout","text-max-angle",u,d,_,p))*Tt.length/Ot.length),Z.setTextAlign(),Z.setRotateWithView(!1);var Wt="middle";0==Dt.indexOf("bottom")?(Wt="bottom",Ut=-zt-.5*(Ft-1)*Mt):0==Dt.indexOf("top")&&(Wt="top",Ut=zt+.5*(Ft-1)*Mt),Z.setTextBaseline(Wt),Z.setOffsetX(Nt[0]*Mt+Bt+jt[0]),Z.setOffsetY(Nt[1]*Mt+Ut+jt[1]),F.setColor(Vg(jg(S,"paint","text-color",u,d,_,p),L)),Z.setFill(F);var Yt=Vg(jg(S,"paint","text-halo-color",u,d,_,p),L);if(Yt){R.setColor(Yt),zt*=2;var Zt=.5*Mt;R.setWidth(zt<=Zt?zt:Zt),Z.setStroke(R)}else Z.setStroke(void 0);var qt=jg(S,"layout","text-padding",u,d,_,p),Kt=Z.getPadding();qt!==Kt[0]&&(Kt[0]=qt,Kt[1]=qt,Kt[2]=qt,Kt[3]=qt),D.setZIndex(G)}}}}return v>-1?(M.length=v+1,M):void 0}};return t.setStyle(P),t.set("mapbox-source",c),t.set("mapbox-layers",p),t.set("mapbox-featurestate",{}),P}var Zg=new Br;const qg="element",Kg="map",Hg="offset",$g="position",Jg="positioning";var Qg=class extends xt{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(qg,this.handleElementChanged),this.addChangeListener(Kg,this.handleMapChanged),this.addChangeListener(Hg,this.handleOffsetChanged),this.addChangeListener($g,this.handlePositionChanged),this.addChangeListener(Jg,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(qg)}getId(){return this.id}getMap(){return this.get(Kg)||null}getOffset(){return this.get(Hg)}getPosition(){return this.get($g)}getPositioning(){return this.get(Jg)}handleElementChanged(){H(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(K(this.element),pt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=dt(t,wo,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(qg,t)}setMap(t){this.set(Kg,t)}setOffset(t){this.set(Hg,t)}setPosition(t){this.set($g,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get($g))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[Y(n),Z(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(Jg,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}};const tp="units",ep=[1,2,5],ip=25.4/.28;var np=class extends Do{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+" "+wt,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(tp,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(tp)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(tp,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=Yi(i,t.resolution,e,r);const o=this.minWidth_*(this.dpi_||ip)/ip,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||ip)/ip:void 0;let l=o*s,h="";if("degrees"==n){const t=ni.degrees;l*=t,l=a){u=g,c=f,d=m;break}if(c>=o)break;g=u,f=c,m=d,++_}const y=this.scaleBar_?this.createScaleBar(c,u,h):u.toFixed(d<0?-d:0)+" "+h;this.renderedHTML_!=y&&(this.innerElement_.innerHTML=y,this.renderedHTML_=y),this.renderedWidth_!=c&&(this.innerElement_.style.width=c+"px",this.renderedWidth_=c),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 Yi(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||ip)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}},rp={exports:{}},sp=Vr(Go),op=Vr(yt),ap=Vr(fo);!function(t,e){t.exports=function(t,e,i){t="default"in t?t.default:t,i="default"in i?i.default:i;const n="layer-switcher-";class r extends t{constructor(t){const e=Object.assign({},t),i=document.createElement("div");super({element:i,target:e.target}),this.activationMode=e.activationMode||"mouseover",this.startActive=!0===e.startActive,this.label=void 0!==e.label?e.label:"",this.collapseLabel=void 0!==e.collapseLabel?e.collapseLabel:"»",this.tipLabel=e.tipLabel?e.tipLabel:"Legend",this.collapseTipLabel=e.collapseTipLabel?e.collapseTipLabel:"Collapse legend",this.groupSelectStyle=r.getGroupSelectStyle(e.groupSelectStyle),this.reverse=!1!==e.reverse,this.mapListeners=[],this.hiddenClassName="ol-unselectable ol-control layer-switcher",r.isTouchDevice_()&&(this.hiddenClassName+=" touch"),this.shownClassName="shown",i.className=this.hiddenClassName,this.button=document.createElement("button"),i.appendChild(this.button),this.panel=document.createElement("div"),this.panel.className="panel",i.appendChild(this.panel),r.enableTouchScroll_(this.panel),i.classList.add(n+"group-select-style-"+this.groupSelectStyle),i.classList.add(n+"activation-mode-"+this.activationMode),"click"===this.activationMode?(i.classList.add("activationModeClick"),this.button.onclick=t=>{const e=t||window.event;this.element.classList.contains(this.shownClassName)?this.hidePanel():this.showPanel(),e.preventDefault()}):(this.button.onmouseover=()=>{this.showPanel()},this.button.onclick=t=>{const e=t||window.event;this.showPanel(),e.preventDefault()},this.panel.onmouseout=t=>{this.panel.contains(t.relatedTarget)||this.hidePanel()}),this.updateButton()}setMap(t){for(let t=0;t{this.hidePanel()}))))}showPanel(){this.element.classList.contains(this.shownClassName)||(this.element.classList.add(this.shownClassName),this.updateButton(),this.renderPanel()),this.dispatchEvent("show")}hidePanel(){this.element.classList.contains(this.shownClassName)&&(this.element.classList.remove(this.shownClassName),this.updateButton()),this.dispatchEvent("hide")}updateButton(){this.element.classList.contains(this.shownClassName)?(this.button.textContent=this.collapseLabel,this.button.setAttribute("title",this.collapseTipLabel),this.button.setAttribute("aria-label",this.collapseTipLabel)):(this.button.textContent=this.label,this.button.setAttribute("title",this.tipLabel),this.button.setAttribute("aria-label",this.tipLabel))}renderPanel(){this.dispatchEvent("render"),r.renderPanel(this.getMap(),this.panel,{groupSelectStyle:this.groupSelectStyle,reverse:this.reverse}),this.dispatchEvent("rendercomplete")}static renderPanel(t,e,i){const n=new Event("render");for(e.dispatchEvent(n),(i=i||{}).groupSelectStyle=r.getGroupSelectStyle(i.groupSelectStyle),r.ensureTopVisibleBaseLayerShown(t,i.groupSelectStyle);e.firstChild;)e.removeChild(e.firstChild);r.forEachRecursive(t,(function(t,e,i){t.set("indeterminate",!1)})),"children"===i.groupSelectStyle||"none"===i.groupSelectStyle?r.setGroupVisibility(t):"group"===i.groupSelectStyle&&r.setChildVisibility(t);const s=document.createElement("ul");e.appendChild(s),r.renderLayers_(t,t,s,i,(function(n){r.renderPanel(t,e,i)}));const o=new Event("rendercomplete");e.dispatchEvent(o)}static isBaseGroup(t){if(t instanceof i){const e=t.getLayers().getArray();return e.length&&"base"===e[0].get("type")}return!1}static setGroupVisibility(t){r.getGroupsAndLayers(t,(function(t){return t instanceof i&&!t.get("combine")&&!r.isBaseGroup(t)})).reverse().forEach((function(t){const e=t.getLayersArray().map((function(t){return t.getVisible()}));e.every((function(t){return!0===t}))?(t.setVisible(!0),t.set("indeterminate",!1)):e.every((function(t){return!1===t}))?(t.setVisible(!1),t.set("indeterminate",!1)):(t.setVisible(!0),t.set("indeterminate",!0))}))}static setChildVisibility(t){r.getGroupsAndLayers(t,(function(t){return t instanceof i&&!t.get("combine")&&!r.isBaseGroup(t)})).forEach((function(t){const e=t,i=e.getVisible(),n=e.get("indeterminate");e.getLayers().getArray().forEach((function(t){t.set("indeterminate",!1),i&&!n||!t.getVisible()||t.set("indeterminate",!0)}))}))}static ensureTopVisibleBaseLayerShown(t,e){let i;r.forEachRecursive(t,(function(t,e,n){"base"===t.get("type")&&t.getVisible()&&(i=t)})),i&&r.setVisible_(t,i,!0,e)}static getGroupsAndLayers(t,e){const i=[];return e=e||function(t,e,i){return!0},r.forEachRecursive(t,(function(t,n,r){t.get("title")&&e(t,n,r)&&i.push(t)})),i}static setVisible_(t,e,n,s){e.setVisible(n),n&&"base"===e.get("type")&&r.forEachRecursive(t,(function(t,i,n){t!=e&&"base"===t.get("type")&&t.setVisible(!1)})),e instanceof i&&!e.get("combine")&&"children"===s&&e.getLayers().forEach((i=>{r.setVisible_(t,i,e.getVisible(),s)}))}static renderLayer_(t,e,s,o,a){const l=document.createElement("li"),h=e.get("title"),u=r.uuid(),c=document.createElement("label");if(e instanceof i&&!e.get("combine")){const i=r.isBaseGroup(e);if(l.classList.add("group"),i&&l.classList.add(n+"base-group"),e.get("fold")){l.classList.add(n+"fold"),l.classList.add(n+e.get("fold"));const t=document.createElement("button");t.onclick=function(t){const i=t||window.event;r.toggleFold_(e,l),i.preventDefault()},l.appendChild(t)}if(!i&&"none"!=o.groupSelectStyle){const i=document.createElement("input");i.type="checkbox",i.id=u,i.checked=e.getVisible(),i.indeterminate=e.get("indeterminate"),i.onchange=function(i){const n=i.target;r.setVisible_(t,e,n.checked,o.groupSelectStyle),a(e)},l.appendChild(i),c.htmlFor=u}c.innerHTML=h,l.appendChild(c);const s=document.createElement("ul");l.appendChild(s),r.renderLayers_(t,e,s,o,a)}else{l.className="layer";const i=document.createElement("input");"base"===e.get("type")?i.type="radio":i.type="checkbox",i.id=u,i.checked=e.get("visible"),i.indeterminate=e.get("indeterminate"),i.onchange=function(i){const n=i.target;r.setVisible_(t,e,n.checked,o.groupSelectStyle),a(e)},l.appendChild(i),c.htmlFor=u,c.innerHTML=h;const n=t.getView().getResolution();if(n>=e.getMaxResolution()||ne.getMaxZoom())&&(c.className+=" disabled")}l.appendChild(c)}return l}static renderLayers_(t,e,i,n,s){let o=e.getLayers().getArray().slice();n.reverse&&(o=o.reverse());for(let e,a=0;a=0?t:"children"}}return window.ol&&window.ol.control&&(window.ol.control.LayerSwitcher=r),r}(sp,op,ap)}(rp);var lp=rp.exports;const hp="addfeatures";class up extends ${constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}var cp=class extends Vo{constructor(t){t=t||{},super({handleEvent:st}),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 up(hp,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[dt(e,ct.DROP,this.handleDrop,this),dt(e,ct.DRAGENTER,this.handleStop,this),dt(e,ct.DRAGOVER,this.handleStop,this),dt(e,ct.DROP,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(pt),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!!na(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}};const gp="drawstart",pp="drawend",fp="drawabort";class mp extends ${constructor(t,e){super(t),this.feature=e}}function _p(t,e){return _(t[0],t[1],e[0],e[1])}function yp(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function vp(t,e,i){let n,r;eo){return _p(Ep(t,n),Ep(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 Tp(){const t=Ir();return function(e,i){return t[e.getGeometry().getType()]}}var Rp=class extends Yo{constructor(t){const e=t;e.stopDown||(e.stopDown=ot),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:st,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 En([NaN,NaN]),r=ln(t[0],i),s=Ti(r,ln(t[t.length-1],i));n.setCenterAndRadius(r,Math.sqrt(s),this.geometryLayout_);const o=on();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=or:"LineString"===t?e=ir:"Polygon"===t&&(e=_r),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 Bh({source:new iu({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:Tp(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:ta,this.freehandCondition_,t.freehand?this.freehandCondition_=Ho:this.freehandCondition_=t.freehandCondition?t.freehandCondition:ea,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(Uo,this.updateState_)}setTrace(t){let e;e=t?!0===t?Ho:t:Jo,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===ct.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===yo.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===yo.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===yo.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===yo.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===yo.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===yo.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===yo.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 _o(yo.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(yp(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex&&Ri(e.startPx,t.pixel)i.startIndex?hi.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let u=h.ring;if(e.targetIndex===a&&u){const t=Ep(h.coordinates,l);Ri(i.getPixelFromCoordinate(t),e.startPx)>n&&(u=!1)}if(u){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 lr([e])):"MultiLineString"===this.type_?t.setGeometry(new rr([e])):"MultiPolygon"===this.type_&&t.setGeometry(new wr([e])),this.dispatchEvent(new mp(pp,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 mp(fp,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(yr(t)):e.setGeometry(void 0):(e=new We(t?yr(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 We(new or(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e);return e}handleEvent(t){return!t.originalEvent||!this.condition_(t)||(t.type!=yo.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_=Lp(s(r)):null!==t?this.pointerHandler_=Ap(s([t,n[1]]),s([t,n[3]])):null!==e&&(this.pointerHandler_=Ap(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_=Lp(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!==we(e)||this.setExtent(null),!1}setMap(t){this.extentOverlay_.setMap(t),this.vertexOverlay_.setMap(t),super.setMap(t)}getExtent(){return hn(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.extent_}setExtent(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new Mp(this.extent_))}};function Op(t){return parseFloat(t)}function Dp(t){return function(t){return w(t,5)}(t).toString()}function Gp(t,e){return!isNaN(t)&&t!==Op(Dp(e))}var zp=class extends Vo{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(dt(t,Co,this.updateUrl_,this),dt(t.getLayerGroup(),ct.CHANGE,this.updateUrl_,this),dt(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_(s[t],o)}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(pe(e),r);let o=n;const a=on();if(a){const e=t.map.getView().getProjection();o=o.clone().transform(a,e),o=vr(o).transform(e,a)}this.rBush_.update(o.getExtent(),s)}else this.rBush_.update(ne(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new Xp(Vp,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),s=e.getView().getProjection(),o=function(t,e){return Yp(n,t,s)-Yp(n,e,s)};let a,l;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 We&&this.features_.getArray().includes(t)){l=n;const e=l.getFlatCoordinates().slice(0,2);a=[{feature:t,geometry:l,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!a){const t=hn(re(un(pe(n,jp),s),e.getView().getResolution()*this.pixelTolerance_,jp),s);a=this.rBush_.getInExtent(t)}if(a&&a.length>0){const i=a.sort(o)[0],h=i.segment;let u=Zp(n,i,s);const c=e.getPixelFromCoordinate(u);let d=Ri(t,c);if(l||d<=this.pixelTolerance_){const t={};if(t[r(h)]=!0,this.snapToPointer_||(this.delta_[0]=u[0]-n[0],this.delta_[1]=u[1]-n[1]),"Circle"===i.geometry.getType()&&i.index===Np)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(u,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(h[0]),s=e.getPixelFromCoordinate(h[1]),o=Ti(c,n),l=Ti(c,s);d=Math.sqrt(Math.min(o,l)),this.snappedToVertex_=d<=this.pixelTolerance_,this.snappedToVertex_&&(u=o>l?h[1]:h[0]),this.createOrUpdateVertexFeature_(u,[i.feature],[i.geometry]);const g={};g[r(i.geometry)]=!0;for(let e=1,i=a.length;e=0;--a)s=t[a],d=s[0],g=r(d.feature),d.depth&&(g+="-"+d.depth.join("-")),g in e||(e[g]={}),0===s[1]?(e[g].right=d,e[g].index=d.index):1==s[1]&&(e[g].left=d,e[g].index=d.index+1);for(g in e){switch(c=e[g].right,h=e[g].left,l=e[g].index,u=l-1,d=void 0!==h?h:c,u<0&&(u=0),o=d.geometry,n=o.getCoordinates(),i=n,p=!1,o.getType()){case"MultiLineString":n[d.depth[0]].length>2&&(n[d.depth[0]].splice(l,1),p=!0);break;case"LineString":n.length>2&&(n.splice(l,1),p=!0);break;case"MultiPolygon":i=i[d.depth[1]];case"Polygon":i=i[d.depth[0]],i.length>4&&(l==i.length-1&&(l=0),i.splice(l,1),p=!0,0===l&&(i.pop(),i.push(i[0]),u=i.length-1))}if(p){this.setGeometryCoordinates_(o,n);const e=[];if(void 0!==h&&(this.rBush_.remove(h),e.push(h.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==h&&void 0!==c){const t={depth:d.depth,feature:d.feature,geometry:d.geometry,index:u,segment:e};this.rBush_.insert(ne(t.segment),t)}this.updateSegmentIndices_(o,l,d.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return p}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||rt(r.depth,i))&&r.index>e&&(r.index+=n)}))}};const Hp="select";class $p extends ${constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Jp={};class Qp extends Vo{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:Qo,this.addCondition_=t.addCondition?t.addCondition:Jo,this.removeCondition_=t.removeCondition?t.removeCondition:Jo,this.toggleCondition_=t.toggleCondition?t.toggleCondition:ea,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:st,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=Ir();return nt(t.Polygon,t.LineString),nt(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new bs,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=st;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[r(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[r(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(_s,this.boundAddFeature_),this.features_.addEventListener(ys,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(_s,this.boundAddFeature_),this.features_.removeEventListener(ys,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 Bh&&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=r(t);e in Jp||(Jp[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 Qp&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=r(t);t.setStyle(Jp[i]),delete Jp[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[r(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){lt(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof We&&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 We&&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 $p(Hp,l,a,t)),!0}}var tf=Qp;function ef(t){return t.feature?t.feature:t.element?t.element:void 0}const nf=[];var rf=class extends Yo{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=st),e.stopDown||(e.stopDown=ot),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 Vh,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=r(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]=dt(t,ct.CHANGE,this.handleFeatureChange_,this))}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=ef(t);this.addFeature(e)}handleFeatureRemove_(t){const e=ef(t);this.removeFeature(e)}handleFeatureChange_(t){const e=t.target;if(this.handlingDownUpSequence){const t=r(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=r(t),s=this.indexedFeaturesExtents_[n];if(s){const e=this.rBush_,i=[];e.forEachInExtent(s,(function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t)e.remove(i[t])}i&&(pt(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(t){const e=this.getMap(),i=this.featuresListenerKeys_,n=this.getFeatures_();e&&(i.forEach(pt),i.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(pt),this.featureChangeListenerKeys_={}),super.setMap(t),t&&(this.features_?i.push(dt(this.features_,_s,this.handleFeatureAdd_,this),dt(this.features_,ys,this.handleFeatureRemove_,this)):this.source_&&i.push(dt(this.source_,Xh,this.handleFeatureAdd_,this),dt(this.source_,Zh,this.handleFeatureRemove_,this)),n.forEach((t=>this.addFeature(t))))}snapTo(t,e,i){const n=i.getView().getProjection(),r=ln(e,n),s=hn(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 u=this.pixelTolerance_*this.pixelTolerance_,c=()=>{if(l){const e=i.getPixelFromCoordinate(l);if(Ti(t,e)<=u)return{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])]}}return null};if(this.vertex_){for(let t=0;t{const e=ln(t,n),i=Ti(r,e);i{t.push([e])}))}segmentMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e{if(t instanceof We&&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")}}},uf=Object.freeze({__proto__:null,DoubleClickZoom:Xo,DragAndDrop:cp,DragBox:ga,DragPan:sa,DragRotate:oa,DragRotateAndZoom:dp,DragZoom:pa,Draw:Rp,Extent:kp,Interaction:Vo,KeyboardPan:va,KeyboardZoom:xa,Link:zp,Modify:Kp,MouseWheelZoom:wa,PinchRotate:Sa,PinchZoom:Ca,Pointer:Yo,Select:tf,Snap:rf,Translate:hf,defaults:Ea});const cf="http://www.w3.org/2001/XMLSchema-instance";function df(t,e){return If().createElementNS(t,e)}function gf(t,e){return pf(t,e,[]).join("")}function pf(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):i.push(t.nodeValue);else{let n;for(n=t.firstChild;n;n=n.nextSibling)pf(n,e,i)}return i}function ff(t){return"documentElement"in t}function mf(t){return(new DOMParser).parseFromString(t,"application/xml")}function _f(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);if(void 0!==r){nt(n[n.length-1],r)}}}function yf(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);if(void 0!==r){n[n.length-1].push(r)}}}function vf(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);void 0!==r&&(n[n.length-1]=r)}}function xf(t,e,i){return function(n,r){const s=t.call(void 0!==i?i:this,n,r);if(void 0!==s){r[r.length-1][void 0!==e?e:n.localName]=s}}}function bf(t,e){return function(i,n,r){t.call(void 0!==e?e:this,i,n,r);r[r.length-1].node.appendChild(i)}}function wf(t,e){return function(i,n,r){const s=n[n.length-1].node;let o=t;void 0===o&&(o=r);return df(void 0!==e?e:s.namespaceURI,o)}}const Sf=wf();function Cf(t,e){const i=e.length,n=new Array(i);for(let r=0;r0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=mf(t);return this.readFeaturesFromDocument(i,e)}return ff(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&&nt(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return i()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=mf(t);return this.readGeometryFromDocument(i,e)}return ff(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=mf(t);return this.readProjectionFromDocument(e)}return ff(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}};function Af(t){return function(t){const e=/^\s*(true|1)|(false|0)\s*$/.exec(t);if(e)return void 0!==e[1]||!1;return}(gf(t,!1))}function kf(t){return function(t){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);if(e)return parseFloat(e[1]);return}(gf(t,!1))}function Of(t){return gf(t,!1).trim()}function Df(t,e){zf(t,e?"1":"0")}function Gf(t,e){const i=e.toPrecision();t.appendChild(If().createTextNode(i))}function zf(t,e){t.appendChild(If().createTextNode(e))}const Nf=["http://www.google.com/kml/ext/2.2"],jf=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],Uf={fraction:"fraction",pixels:"pixels",insetPixels:"pixels"},Bf=Ef(jf,{ExtendedData:Xm,Region:Wm,MultiGeometry:xf(Om,"geometry"),LineString:xf(Lm,"geometry"),LinearRing:xf(Am,"geometry"),Point:xf(Dm,"geometry"),Polygon:xf(zm,"geometry"),Style:xf(jm),StyleMap:function(t,e){const i=ym.call(this,t,e);if(!i)return;const n=e[e.length-1];Array.isArray(i)?n.Style=i:"string"==typeof i?n.styleUrl=i:p(!1,38)},address:xf(Of),description:xf(Of),name:xf(Of),open:xf(Af),phoneNumber:xf(Of),styleUrl:xf(fm),visibility:xf(Af)},Ef(Nf,{MultiTrack:xf((function(t,e){const i=Rf([],Em,t,e);if(!i)return;return new rr(i)}),"geometry"),Track:xf(Rm,"geometry")})),Vf=Ef(jf,{ExtendedData:Xm,Region:Wm,Link:function(t,e){Tf(Xf,t,e)},address:xf(Of),description:xf(Of),name:xf(Of),open:xf(Af),phoneNumber:xf(Of),visibility:xf(Af)}),Xf=Ef(jf,{href:xf(pm)}),Wf=Ef(jf,{LatLonAltBox:function(t,e){const i=Rf({},qm,t,e);if(!i)return;const n=e[e.length-1],r=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];n.extent=r,n.altitudeMode=i.altitudeMode,n.minAltitude=parseFloat(i.minAltitude),n.maxAltitude=parseFloat(i.maxAltitude)},Lod:function(t,e){const i=Rf({},Km,t,e);if(!i)return;const n=e[e.length-1];n.minLodPixels=parseFloat(i.minLodPixels),n.maxLodPixels=parseFloat(i.maxLodPixels),n.minFadeExtent=parseFloat(i.minFadeExtent),n.maxFadeExtent=parseFloat(i.maxFadeExtent)}}),Yf=Ef(jf,["Document","Placemark"]),Zf=Ef(jf,{Document:bf((function(t,e,i){Ff({node:t},t_,e_,e,i,void 0,this)})),Placemark:bf(E_)});let qf,Kf,Hf,$f,Jf,Qf,tm,em,im,nm=null,rm=null,sm=null,om=null,am=null,lm=null;function hm(t){return 32/Math.min(t[0],t[1])}function um(t){return t}function cm(t,e,i){return Array.isArray(t)?t:"string"==typeof t?cm(i[t],e,i):e}function dm(t){const e=gf(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){const t=i[1];return[parseInt(t.substr(6,2),16),parseInt(t.substr(4,2),16),parseInt(t.substr(2,2),16),parseInt(t.substr(0,2),16)/255]}}function gm(t){let e=gf(t,!1);const i=[];e=e.replace(/\s*,\s*/g,",");const n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;let r;for(;r=n.exec(e);){const t=parseFloat(r[1]),n=parseFloat(r[2]),s=r[3]?parseFloat(r[3]):0;i.push(t,n,s),e=e.substr(r[0].length)}if(""===e)return i}function pm(t){const e=gf(t,!1).trim();let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function fm(t){const e=gf(t,!1).trim().replace(/^(?!.*#)/,"#");let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function mm(t){return kf(t)}const _m=Ef(jf,{Pair:function(t,e){const i=Rf({},Ym,t,e,this);if(!i)return;const n=i.key;if(n&&"normal"==n){const t=i.styleUrl;t&&(e[e.length-1]=t);const n=i.Style;n&&(e[e.length-1]=n)}}});function ym(t,e){return Rf(void 0,_m,t,e,this)}const vm=Ef(jf,{Icon:xf((function(t,e){const i=Rf({},Fm,t,e);if(i)return i;return null})),color:xf(dm),heading:xf(kf),hotSpot:xf((function(t){const e=t.getAttribute("xunits"),i=t.getAttribute("yunits");let n;return n="insetPixels"!==e?"insetPixels"!==i?"bottom-left":"top-left":"insetPixels"!==i?"bottom-right":"top-right",{x:parseFloat(t.getAttribute("x")),xunits:Uf[e],y:parseFloat(t.getAttribute("y")),yunits:Uf[i],origin:n}})),scale:xf(mm)});const xm=Ef(jf,{color:xf(dm),scale:xf(mm)});const bm=Ef(jf,{color:xf(dm),width:xf(kf)});const wm=Ef(jf,{color:xf(dm),fill:xf(Af),outline:xf(Af)});const Sm=Ef(jf,{coordinates:vf(gm)});function Cm(t,e){return Rf(null,Sm,t,e)}const Em=Ef(Nf,{Track:yf(Rm)});const Tm=Ef(jf,{when:function(t,e){const i=e[e.length-1].whens,n=gf(t,!1),r=Date.parse(n);i.push(isNaN(r)?0:r)}},Ef(Nf,{coord:function(t,e){const i=e[e.length-1].coordinates,n=gf(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(r){const t=parseFloat(r[1]),e=parseFloat(r[2]),n=parseFloat(r[3]);i.push([t,e,n])}else i.push([])}}));function Rm(t,e){const i=Rf({coordinates:[],whens:[]},Tm,t,e);if(!i)return;const n=[],r=i.coordinates,s=i.whens;for(let t=0,e=Math.min(r.length,s.length);t0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=Rf(void 0,$m,t,e);if(i){e[e.length-1][0]=i}}});function zm(t,e){const i=Rf({},Im,t,e),n=Rf([null],Gm,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i0;let a;const l=s.href;let h,u,c;l?a=l:o&&(a=Qf);let d="bottom-left";const g=n.hotSpot;let p;g?(h=[g.x,g.y],u=g.xunits,c=g.yunits,d=g.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(a)&&(a.includes("pushpin")?(h=Kf,u=Hf,c=$f):a.includes("arrow-reverse")?(h=[54,42],u=Hf,c=$f):a.includes("paddle")&&(h=[32,1],u=Hf,c=$f));const f=s.x,m=s.y;let _;void 0!==f&&void 0!==m&&(p=[f,m]);const y=s.w,x=s.h;let b;void 0!==y&&void 0!==x&&(_=[y,x]);const w=n.heading;void 0!==w&&(b=v(w));const S=n.scale,C=n.color;if(o){a==Qf&&(_=Jf);const t=new Ve({anchor:h,anchorOrigin:d,anchorXUnits:u,anchorYUnits:c,crossOrigin:this.crossOrigin_,offset:p,offsetOrigin:"bottom-left",rotation:b,scale:S,size:_,src:this.iconUrlFunction_(a),color:C}),i=t.getScaleArray()[0],n=t.getSize();if(null===n){const n=t.getImageState();if(n===e.IDLE||n===e.LOADING){const r=function(){const n=t.getImageState();if(n!==e.IDLE&&n!==e.LOADING){const e=t.getSize();if(e&&2==e.length){const n=hm(e);t.setScale(i*n)}t.unlistenImageChange(r)}};t.listenImageChange(r),n===e.IDLE&&t.load()}}else if(2==n.length){const e=hm(n);t.setScale(i*e)}r.imageStyle=t}else r.imageStyle=tm},LabelStyle:function(t,e){const i=Rf({},xm,t,e);if(!i)return;const n=e[e.length-1],r=new Or({fill:new Jt({color:"color"in i?i.color:qf}),scale:i.scale});n.textStyle=r},LineStyle:function(t,e){const i=Rf({},bm,t,e);if(!i)return;const n=e[e.length-1],r=new Rr({color:"color"in i?i.color:qf,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=Rf({},wm,t,e);if(!i)return;const n=e[e.length-1],r=new Jt({color:"color"in i?i.color:qf});n.fillStyle=r;const s=i.fill;void 0!==s&&(n.fill=s);const o=i.outline;void 0!==o&&(n.outline=o)}});function jm(t,e){const i=Rf({},Nm,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:nm;const r=i.fill;let s;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=tm&&(s=i.imageStyle):s=rm;const o="textStyle"in i?i.textStyle:om,a="strokeStyle"in i?i.strokeStyle:sm,l=i.outline;return void 0===l||l?[new Ar({fill:n,image:s,stroke:a,text:o,zIndex:void 0})]:[new Ar({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Fn(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 Ar({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Fn(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 Um(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=Cf(r,o);Ff(n,w_,C_,[{names:o,values:t}],i)}const c=i[0];let d=e.getGeometry();d&&(d=Gr(d,!0,c)),Ff(n,w_,g_,[d],i)}const T_=Ef(jf,["extrude","tessellate","altitudeMode","coordinates"]),R_=Ef(jf,{extrude:bf(Df),tessellate:bf(Df),altitudeMode:bf(zf),coordinates:bf((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:p(!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)&&(im||(im=document.createElement("textarea")),im.innerHTML=l,l=im.value));let u=i;if(t?u=t:e&&(u=cm(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()||om.getFont()),s.setScale(s.getScale()||om.getScale()),s.setFill(s.getFill()||om.getFill()),s.setStroke(s.getStroke()||em)):s=om.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);const o=new Ar({image:r,text:s});return o}(u[0],l);if(h.length>0){t.setGeometry(new Fn(h));return[t,new Ar({geometry:u[0].getGeometry(),image:null,fill:u[0].getFill(),stroke:u[0].getStroke(),text:null})].concat(u.slice(1))}return t}return u}}(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=jm.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=ym.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(!jf.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!jf.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&&nt(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=mf(t);return this.readNameFromDocument(e)}return ff(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(jf.includes(e.namespaceURI)&&"name"==e.localName)return Of(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(jf.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=mf(t);nt(e,this.readNetworkLinksFromDocument(i))}else ff(t)?nt(e,this.readNetworkLinksFromDocument(t)):nt(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&nt(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(jf.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=Rf({},Vf,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!jf.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||nt(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=mf(t);nt(e,this.readRegionFromDocument(i))}else ff(t)?nt(e,this.readRegionFromDocument(t)):nt(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&nt(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(jf.includes(i.namespaceURI)&&"Region"==i.localName){const t=Rf({},Wf,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!jf.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||nt(e,this.readRegionFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=df(jf[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",Nf[0]),i.setAttributeNS(n,"xmlns:xsi",cf),i.setAttributeNS(cf,"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=Yf[i.namespaceURI],a=Cf(s,o);return Ff(r,Zf,Sf,a,[e],o,this),i}};const N_=34962,j_=34963,U_=35048,B_=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function V_(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!G},e);const i=B_.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 s=this.getGL(),o=t.size;if(s.bindFramebuffer(s.FRAMEBUFFER,e?e.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!e){const e=r(s.canvas);if(!t.renderTargets[e]){const i=s.getContextAttributes();i&&i.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),t.renderTargets[e]=!0}}s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),i&&i(s,t),s.drawArrays(s.TRIANGLES,0,6),n&&n(s,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 H_(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 $_="u_projectionMatrix",J_="u_offsetScaleMatrix",Q_="u_offsetRotateMatrix",ty="u_time",ey="u_zoom",iy="u_resolution",ny="u_sizePx",ry="u_pixelRatio",sy={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126},oy={};function ay(t){return"shared/"+t}let ly=0;class hy extends Q{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?ay(t.canvasCacheKey):function(){const t="unique/"+ly;return ly+=1,t}(),this.canvas_=function(t){let e=oy[t];if(!e){const i=document.createElement("canvas");i.style.position="absolute",i.style.left="0",e={users:0,canvas:i},oy[t]=e}return e.users+=1,e.canvas}(this.canvasCacheKey_),this.gl_=V_(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Z_,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(q_,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.uniformLocations_={},this.attribLocations_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms);const e=this.getGL();this.postProcessPasses_=t.postProcesses?t.postProcesses.map((function(t){return new K_({webGlContext:e,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})})):[new K_({webGlContext:e})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[];for(const e in t)this.uniforms_.push({name:e,value:t[e]});this.uniformLocations_={}}canvasCacheKeyMatches(t){return this.canvasCacheKey_===ay(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.getGL(),i=r(t);let n=this.bufferCache_[i];if(!n){n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n}e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.getGL();this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.getGL(),i=r(t),n=this.bufferCache_[i];n&&!e.isContextLost()&&e.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Z_,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(q_,this.boundHandleWebGLContextRestored_),function(t){const e=oy[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=V_(e.canvas).getExtension("WEBGL_lose_context");i&&i.loseContext(),delete oy[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,H_(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 Ze(e),Qe(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=function(t){let e=0;for(let i=0;ithis.size_[0]||e>=this.size_[1])return gy[0]=0,gy[1]=0,gy[2]=0,gy[3]=0,gy;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return gy[0]=this.data_[4*i],gy[1]=this.data_[4*i+1],gy[2]=this.data_[4*i+2],gy[3]=this.data_[4*i+3],gy}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)}};const fy="GENERATE_POINT_BUFFERS";var my={exports:{}};function _y(t,e,i){i=i||2;var n,r,s,o,a,l,h,u=e&&e.length,c=u?e[0]*i:t.length,d=yy(t,0,c,i,!0),g=[];if(!d||d.next===d.prev)return g;if(u&&(d=function(t,e,i,n){var r,s,o,a=[];for(r=0,s=e.length;r80*i){n=s=t[0],r=o=t[1];for(var p=i;ps&&(s=a),l>o&&(o=l);h=0!==(h=Math.max(s-n,o-r))?32767/h:0}return xy(d,g,i,n,r,h,0),g}function yy(t,e,i,n,r){var s,o;if(r===By(t,e,i,n)>0)for(s=e;s=e;s-=n)o=Ny(s,t[s],t[s+1],o);return o&&Ay(o,o.next)&&(jy(o),o=o.next),o}function vy(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Ay(n,n.next)&&0!==Ly(n.prev,n,n.next))n=n.next;else{if(jy(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function xy(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=Fy(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?wy(t,n,r,s):by(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),jy(t),t=l.next,h=l.next;else if((t=l)===h){o?1===o?xy(t=Sy(vy(t),e,i),e,i,n,r,s,2):2===o&&Cy(t,e,i,n,r,s):xy(vy(t),e,i,n,r,s,1);break}}}function by(t){var e=t.prev,i=t,n=t.next;if(Ly(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,u=rs?r>o?r:o:s>o?s:o,g=a>l?a>h?a:h:l>h?l:h,p=n.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=g&&Py(r,a,s,l,o,h,p.x,p.y)&&Ly(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function wy(t,e,i,n){var r=t.prev,s=t,o=t.next;if(Ly(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,h=o.x,u=r.y,c=s.y,d=o.y,g=al?a>h?a:h:l>h?l:h,m=u>c?u>d?u:d:c>d?c:d,_=Fy(g,p,e,i,n),y=Fy(f,m,e,i,n),v=t.prevZ,x=t.nextZ;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=g&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==o&&Py(a,u,l,c,h,d,v.x,v.y)&&Ly(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=g&&x.x<=f&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Py(a,u,l,c,h,d,x.x,x.y)&&Ly(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=g&&v.x<=f&&v.y>=p&&v.y<=m&&v!==r&&v!==o&&Py(a,u,l,c,h,d,v.x,v.y)&&Ly(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=g&&x.x<=f&&x.y>=p&&x.y<=m&&x!==r&&x!==o&&Py(a,u,l,c,h,d,x.x,x.y)&&Ly(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Sy(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!Ay(r,s)&&ky(r,n,n.next,s)&&Gy(r,s)&&Gy(s,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(s.i/i|0),jy(n),jy(n.next),n=t=s),n=n.next}while(n!==t);return vy(n)}function Cy(t,e,i,n,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Iy(o,a)){var l=zy(o,a);return o=vy(o,o.next),l=vy(l,l.next),xy(o,e,i,n,r,s,0),void xy(l,e,i,n,r,s,0)}a=a.next}o=o.next}while(o!==t)}function Ey(t,e){return t.x-e.x}function Ty(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>=u&&r!==n.x&&Py(si.x||n.x===i.x&&Ry(i,n)))&&(i=n,d=l)),n=n.next}while(n!==h);return i}(t,e);if(!i)return e;var n=zy(i,t);return vy(n,n.next),vy(i,i.next)}function Ry(t,e){return Ly(t.prev,t,e.prev)<0&&Ly(e.next,t,t.next)<0}function Fy(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 My(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 Iy(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&&ky(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Gy(t,e)&&Gy(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)&&(Ly(t.prev,t,e.prev)||Ly(t,e.prev,e))||Ay(t,e)&&Ly(t.prev,t,t.next)>0&&Ly(e.prev,e,e.next)>0)}function Ly(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ay(t,e){return t.x===e.x&&t.y===e.y}function ky(t,e,i,n){var r=Dy(Ly(t,e,i)),s=Dy(Ly(t,e,n)),o=Dy(Ly(i,n,t)),a=Dy(Ly(i,n,e));return r!==s&&o!==a||(!(0!==r||!Oy(t,i,e))||(!(0!==s||!Oy(t,n,e))||(!(0!==o||!Oy(i,t,n))||!(0!==a||!Oy(i,e,n)))))}function Oy(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 Dy(t){return t>0?1:t<0?-1:0}function Gy(t,e){return Ly(t.prev,t,t.next)<0?Ly(t,e,t.next)>=0&&Ly(t,t.prev,e)>=0:Ly(t,e,t.prev)<0||Ly(t,t.next,e)<0}function zy(t,e){var i=new Uy(t.i,t.x,t.y),n=new Uy(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 Ny(t,e,i,n){var r=new Uy(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 jy(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 Uy(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 By(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};var Xy=class extends dy{constructor(t,e){const i=e.uniforms||{},n=[1,0,0,1,0,0];i[$_]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.ready=!1,this.sourceRevision_=-1,this.verticesBuffer_=new Y_(N_,U_),this.hitVerticesBuffer_=new Y_(N_,U_),this.indicesBuffer_=new Y_(j_,U_),this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.program_,this.hitDetectionEnabled_=!(!e.hitFragmentShader||!e.hitVertexShader),this.hitVertexShader_=e.hitVertexShader,this.hitFragmentShader_=e.hitFragmentShader,this.hitProgram_;const s=e.attributes?e.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:sy.FLOAT}})):[];this.attributes=[{name:"a_position",size:2,type:sy.FLOAT},{name:"a_index",size:1,type:sy.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:sy.FLOAT},{name:"a_index",size:1,type:sy.FLOAT},{name:"a_hitColor",size:4,type:sy.FLOAT},{name:"a_featureUid",size:1,type:sy.FLOAT}].concat(s),this.customAttributes=e.attributes?e.attributes:[],this.previousExtent_=[1/0,1/0,-1/0,-1/0],this.currentTransform_=n,this.renderTransform_=[1,0,0,1,0,0],this.invertRenderTransform_=[1,0,0,1,0,0],this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.generateBuffersRun_=0,this.worker_=function(){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===fy){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,ti(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 o=this.getLayer().getSource();this.sourceListenKeys_=[dt(o,Xh,this.handleSourceFeatureAdded_,this),dt(o,Wh,this.handleSourceFeatureChanged_,this),dt(o,Zh,this.handleSourceFeatureDelete_,this),dt(o,Yh,this.handleSourceFeatureClear_,this)],o.forEachFeature((t=>{this.featureCache_[r(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 py(this.helper))}handleSourceFeatureAdded_(t){const e=t.feature;this.featureCache_[r(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(t){const e=t.feature;this.featureCache_[r(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}handleSourceFeatureDelete_(t){const e=t.feature;delete this.featureCache_[r(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?Ae(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 u=this.indicesBuffer_.getSize();do{this.helper.makeProjectionTransform(t,this.currentTransform_),Je(this.currentTransform_,h*o,0),qe(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(t),this.helper.drawElements(0,u)}while(++h{const e=this.weightFunction_(t);return void 0!==e?f(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(Zy)+this.get(Wy)),u_blurSlope:()=>this.get(Zy)/Math.max(1,this.get(Wy))},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 Hy=class extends so{constructor(t){super(t=t||{})}};var $y=class extends Tl{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const i=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,r=t.viewState,s=r.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(void 0!==i.extent&&(l=Pe(l,un(i.extent,r.projection))),!a[zs]&&!a[Ns]&&!Oe(l))if(o){const t=r.projection,i=o.getImage(l,s,n,t);i&&(this.loadImage(i)?this.image_=i:i.getState()===e.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=He(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ae(r,n))return null;const s=this.image_.getExtent(),o=this.getImage(),a=Ae(s),l=Math.floor(o.width*((n[0]-s[0])/a));if(l<0||l>=o.width)return null;const h=Me(s),u=Math.floor(o.height*((s[3]-n[1])/h));return u<0||u>=o.height?null:this.getImageData(o,l,u)}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,u=a*r/(l.resolution*s),c=t.extent,d=l.resolution,g=l.rotation,p=Math.round(Ae(c)/d*a),f=Math.round(Me(c)/d*a);Qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/a,1/a,g,-p/2,-f/2),ti(this.inversePixelTransform,this.pixelTransform);const m=ii(this.pixelTransform);this.useContainer(e,m,this.getBackground(t));const _=this.context,y=_.canvas;y.width!=p||y.height!=f?(y.width=p,y.height=f):this.containerReused||_.clearRect(0,0,p,f);let v=!1,x=!0;if(o.extent){const e=un(o.extent,l.projection);x=ke(e,t.extent),v=x&&!le(e,t.extent),v&&this.clipUnrotated(_,t,e)}const b=this.getImage(),w=Qe(this.tempTransform,p/2,f/2,u,u,0,s*(n[0]-h[0])/r,s*(h[1]-n[3])/r);this.renderedResolution=r*a/s;const S=b.width*w[0],C=b.height*w[3];if(this.getLayer().getSource().getInterpolate()||(_.imageSmoothingEnabled=!1),this.preRender(_,t),x&&S>=.5&&C>=.5){const t=w[4],e=w[5],i=o.opacity;let n;1!==i&&(n=_.globalAlpha,_.globalAlpha=i),_.drawImage(b,0,0,+b.width,+b.height,t,e,S,C),1!==i&&(_.globalAlpha=n)}return this.postRender(_,t),v&&_.restore(),_.imageSmoothingEnabled=!0,m!==y.style.transform&&(y.style.transform=m),this.container}};var Jy=class extends Hy{constructor(t){super(t)}createRenderer(){return new $y(this)}getData(t){return super.getData(t)}};var Qy=class extends ee{constructor(t,i,n,r,s,o,a){const l=t.getExtent(),h=i.getExtent(),u=h?Pe(n,h):n,c=Ya(t,i,Ee(u),r),d=new Ua(t,i,u,l,.5*c,r),g=o(d.calculateSourceExtent(),c,s),p=g?e.IDLE:e.EMPTY,f=g?g.getPixelRatio():1;super(n,r,f,p),this.targetProj_=i,this.maxSourceExtent_=l,this.triangulation_=d,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=g,this.sourcePixelRatio_=f,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==e.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==e.LOADED){const t=Ae(this.targetExtent_)/this.targetResolution_,e=Me(this.targetExtent_)/this.targetResolution_;this.canvas_=Za(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==e.IDLE){this.state=e.LOADING,this.changed();const t=this.sourceImage_.getState();t==e.LOADED||t==e.ERROR?this.reproject_():(this.sourceListenerKey_=dt(this.sourceImage_,ct.CHANGE,(function(t){const i=this.sourceImage_.getState();i!=e.LOADED&&i!=e.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}}unlistenSource_(){pt(this.sourceListenerKey_),this.sourceListenerKey_=null}};const tv="imageloadstart",ev="imageloadend",iv="imageloaderror";class nv extends ${constructor(t,e){super(t),this.image=e}}function rv(t,e){t.getImage().src=e}var sv=class extends el{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[et(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Ji(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Ji(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 Qy(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,n,r){return i()}handleImageChange(t){const i=t.target;let n;switch(i.getState()){case e.LOADING:this.loading=!0,n=tv;break;case e.LOADED:this.loading=!1,n=ev;break;case e.ERROR:this.loading=!1,n=iv;break;default:return}this.hasListener(n)&&this.dispatchEvent(new nv(n,i))}};var ov=class{constructor(t,e){this.name=t,this.data=e,this.texture_=null}getTexture(t){if(!this.texture_){const e=t.createTexture();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,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_}};const av="u_tileTextures",lv="u_texturePixelWidth",hv="u_texturePixelHeight",uv={NUMBER:1,STRING:2,COLOR:4,BOOLEAN:8,NUMBER_ARRAY:16,ANY:31,NONE:0},cv={};function dv(t){if("number"==typeof t)return uv.NUMBER;if("boolean"==typeof t)return uv.BOOLEAN;if("string"==typeof t)return e=t,R.test(e)&&(e=M(e)),T.test(e)||e.startsWith("rgba(")||e.startsWith("rgb(")?uv.COLOR|uv.STRING:uv.STRING;var e;if(!Array.isArray(t))throw new Error(`Unhandled value type: ${JSON.stringify(t)}`);const i=t;if(i.every((function(t){return"number"==typeof t})))return 3===i.length||4===i.length?uv.COLOR|uv.NUMBER_ARRAY:uv.NUMBER_ARRAY;if("string"!=typeof i[0])throw new Error(`Expected an expression operator but received: ${JSON.stringify(i)}`);const n=cv[i[0]];if(void 0===n)throw new Error(`Unrecognized expression operator: ${JSON.stringify(i)}`);return n.getReturnType(i.slice(1))}function gv(t){const e=t.toString();return e.includes(".")?e:e+".0"}function pv(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(gv).join(", ")})`}function fv(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function mv(t,e,i){if(Array.isArray(e)&&"string"==typeof e[0]){const n=cv[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=dv(e);if((n&uv.NUMBER)>0)return gv(e);if((n&uv.BOOLEAN)>0)return e.toString();if((n&uv.STRING)>0&&(void 0===i||i==uv.STRING))return function(t,e){return gv(fv(t,e))}(t,e.toString());if((n&uv.COLOR)>0&&(void 0===i||i==uv.COLOR))return function(t){const e=I(t).slice();return e.length<4&&e.push(1),pv(e.map((function(t,e){return e<3?t/255:t})))}(e);if((n&uv.NUMBER_ARRAY)>0)return pv(e);throw new Error(`Unexpected expression ${e} (expected type ${i})`)}function _v(t){if(!(dv(t)&uv.NUMBER))throw new Error(`A numeric value was expected, got ${JSON.stringify(t)} instead`)}function yv(t){for(let e=0;ee)throw new Error(`At most ${e} arguments were expected, got ${t.length} instead`)}function Cv(t){if(t.length%2!=0)throw new Error(`An even amount of arguments was expected, got ${t} instead`)}function Ev(t,e){if(i=e,Math.log2(i)%1!=0)throw new Error(`Could not infer only one type from the following expression: ${JSON.stringify(t)}`);var i}function Tv(t){return"u_var_"+t}cv.get={getReturnType:function(t){return uv.ANY},toGlsl:function(t,e){bv(e,1),vv(e[0]);const i=e[0].toString();t.attributes.includes(i)||t.attributes.push(i);return(t.inFragmentShader?"v_":"a_")+i}},cv.var={getReturnType:function(t){return uv.ANY},toGlsl:function(t,e){bv(e,1),vv(e[0]);const i=e[0].toString();return t.variables.includes(i)||t.variables.push(i),Tv(i)}};cv.palette={getReturnType:function(t){return uv.COLOR},toGlsl:function(t,e){bv(e,2),_v(e[0]);const i=mv(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;tmv(e,t))).join(` ${t} `),n=`(${n})`,n}}}cv.band={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){wv(e,1),Sv(e,3);const i=e[0];if(!(Rv in t.functions)){let e="";const i=t.bandCount||1;for(let t=0;tmv(t,e))).join(" * ")})`}},cv["/"]={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} / ${mv(t,e[1])})`}},cv["+"]={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return wv(e,2),yv(e),`(${e.map((e=>mv(t,e))).join(" + ")})`}},cv["-"]={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} - ${mv(t,e[1])})`}},cv.clamp={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){bv(e,3),yv(e);const i=mv(t,e[1]),n=mv(t,e[2]);return`clamp(${mv(t,e[0])}, ${i}, ${n})`}},cv["%"]={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,2),yv(e),`mod(${mv(t,e[0])}, ${mv(t,e[1])})`}},cv["^"]={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,2),yv(e),`pow(${mv(t,e[0])}, ${mv(t,e[1])})`}},cv.abs={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`abs(${mv(t,e[0])})`}},cv.floor={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`floor(${mv(t,e[0])})`}},cv.round={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`floor(${mv(t,e[0])} + 0.5)`}},cv.ceil={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`ceil(${mv(t,e[0])})`}},cv.sin={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`sin(${mv(t,e[0])})`}},cv.cos={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return bv(e,1),yv(e),`cos(${mv(t,e[0])})`}},cv.atan={getReturnType:function(t){return uv.NUMBER},toGlsl:function(t,e){return wv(e,1),Sv(e,2),yv(e),2===e.length?`atan(${mv(t,e[0])}, ${mv(t,e[1])})`:`atan(${mv(t,e[0])})`}},cv[">"]={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} > ${mv(t,e[1])})`}},cv[">="]={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} >= ${mv(t,e[1])})`}},cv["<"]={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} < ${mv(t,e[1])})`}},cv["<="]={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){return bv(e,2),yv(e),`(${mv(t,e[0])} <= ${mv(t,e[1])})`}},cv["=="]=Fv("=="),cv["!="]=Fv("!="),cv["!"]={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){return bv(e,1),xv(e[0]),`(!${mv(t,e[0])})`}},cv.all=Mv("&&"),cv.any=Mv("||"),cv.between={getReturnType:function(t){return uv.BOOLEAN},toGlsl:function(t,e){bv(e,3),yv(e);const i=mv(t,e[1]),n=mv(t,e[2]),r=mv(t,e[0]);return`(${r} >= ${i} && ${r} <= ${n})`}},cv.array={getReturnType:function(t){return uv.NUMBER_ARRAY},toGlsl:function(t,e){wv(e,2),Sv(e,4),yv(e);const i=e.map((function(e){return mv(t,e,uv.NUMBER)}));return`vec${e.length}(${i.join(", ")})`}},cv.color={getReturnType:function(t){return uv.COLOR},toGlsl:function(t,e){wv(e,3),Sv(e,4),yv(e);const i=e;3===e.length&&i.push(1);const n=e.map((function(e,i){return mv(t,e,uv.NUMBER)+(i<3?" / 255.0":"")}));return`vec${e.length}(${n.join(", ")})`}},cv.interpolate={getReturnType:function(t){let e=uv.COLOR|uv.NUMBER;for(let i=3;i=1;i-=2){o=`(${r} == ${mv(t,e[i])} ? ${mv(t,e[i+1],n)} : ${o||s})`}return o}},cv.case={getReturnType:function(t){let e=uv.ANY;for(let i=1;i=0;i-=2){s=`(${mv(t,e[i])} ? ${mv(t,e[i+1],n)} : ${s||r})`}return s}};class Pv{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}`}}var Iv=class extends so{constructor(t){super(Object.assign({},t)),this.parseResult_=function(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=mv(l,i,uv.NUMBER_ARRAY|uv.NUMBER),u=mv(l,s,uv.NUMBER_ARRAY),c=mv(l,r,uv.NUMBER_ARRAY),d=mv(l,a,uv.NUMBER),g={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap,functions:{}},p=mv(g,n,uv.COLOR),f=mv(g,o,uv.NUMBER);let m="1.0";const _=`vec2(${mv(g,i,uv.NUMBER_ARRAY|uv.NUMBER)}).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 Pv).setSizeExpression(`vec2(${h})`).setRotationExpression(d).setSymbolOffsetExpression(u).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression(`vec4(${p}.rgb, ${p}.a * ${f} * ${m})`);if(t.filter){const e=mv(g,t.filter,uv.BOOLEAN);y.setFragmentDiscardExpression(`!${e}`)}const v={};if(g.variables.forEach((function(e){const i=Tv(e);y.addUniform(`float ${i}`),v[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=fv(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)"),v.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=fv(l,n)),void 0!==n?n:-9999999}}})),uniforms:v}}(t.style),this.styleVariables_=t.style.variables||{},this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new Xy(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()}};var Lv=class extends yl{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:Wi("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;const i="https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(i).then((t=>t.json())).then((t=>this.handleImageryMetadataResponse(t)))}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=ll(this.getProjection()),r=this.hidpi_?2:1,s=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],o=sl({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:s});this.tileGrid=o;const a=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=pl(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;La(t[0],t[1],t[2],i);let s=n;return l&&(s+="&dpi=d1&device=mobile"),s.replace("{quadkey}",function(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}(i))}}))),e.imageryProviders){const t=Qi(Wi("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(ke(De([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 Av=class extends yl{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:sl({extent:ll(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_}};function kv(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 Ov=class extends sv{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:rv;super({attributions:t.attributions,interpolate:t.interpolate,projection:Wi(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new Ne(this.imageExtent_,void 0,1,this.url_,e,i,X(1,1)),this.imageSize_=t.imageSize?t.imageSize:null,this.image_.addEventListener(ct.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return ke(t,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(t){if(this.image_.getState()==e.LOADED){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=Ae(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=X(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 Dv="1.3.0",Gv=[101,101];var zv=class extends sv{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.context_=X(1,1),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:rv,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=Wi(i),s=this.getProjection();s&&s!==r&&(e=Ya(s,r,t,e),t=en(t,r,s));const o=Re(t,e,0,Gv),a={SERVICE:"WMS",VERSION:Dv,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(a,this.params_,n);const l=C((t[0]-o[0])/e,4),h=C((o[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=h,this.getRequestUrl_(o,Gv,1,s||r,a)}getLegendUrl(t,e){if(void 0===this.url_)return;const i={SERVICE:"WMS",VERSION:Dv,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),kv(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=Ee(t),o=Re(s,r,0,[E(Ae(t)/r,4),E(Me(t)/r,4)]),a=Re(s,r,0,[E(this.ratio_*Ae(t)/r,4),E(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:Dv,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Object.assign(h,this.params_),this.imageSize_[0]=S(Ae(a)/r,4),this.imageSize_[1]=S(Me(a)/r,4);const u=this.getRequestUrl_(a,this.imageSize_,i,n,h);return this.image_=new Ne(a,e,i,u,this.crossOrigin_,this.imageLoadFunction_,this.context_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(ct.CHANGE,this.handleImageChange.bind(this)),this.image_}getImageLoadFunction(){return this.imageLoadFunction_}getRequestUrl_(t,e,i,n,r){if(p(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:p(!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(","),kv(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||Dv;this.v13_=bi(t,"1.3")>=0}};var Nv=class extends Av{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:['© OpenStreetMap contributors.'];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 jv=class extends yl{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=Wi(i),o=this.getProjection();let a=this.getTileGrid();a||(a=this.getTileGridForProjection(r));const h=a.getZForResolution(e,this.zDirection),u=a.getTileCoordForCoordAndZ(t,h);if(a.getResolutions().length<=u[0])return;let c=a.getResolution(u[0]),d=a.getTileCoordExtent(u,this.tmpExtent_),g=l(a.getTileSize(u[0]),this.tmpSize);const p=this.gutter_;0!==p&&(g=s(g,p,this.tmpSize),d=re(d,c*p,d)),o&&o!==r&&(c=Ya(o,r,t,c),d=nn(d,r,o),t=en(t,r,o));const f={SERVICE:"WMS",VERSION:Dv,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(f,this.params_,n);const m=Math.floor((t[0]-d[0])/c),_=Math.floor((d[3]-t[1])/c);return f[this.v13_?"I":"X"]=m,f[this.v13_?"J":"Y"]=_,this.getRequestUrl_(u,g,d,1,o||r,f)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:Dv,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),kv(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:p(!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[x(Da(t),o.length)]}return kv(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||Dv;this.v13_=bi(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 o=n.getTileCoordExtent(t,this.tmpExtent_),h=l(n.getTileSize(t[0]),this.tmpSize);const u=this.gutter_;0!==u&&(h=s(h,u,this.tmpSize),o=re(o,r*u,o)),1!=e&&(h=a(h,e,this.tmpSize));const c={SERVICE:"WMS",VERSION:Dv,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(c,this.params_),this.getRequestUrl_(t,h,o,e,i,c)}};_t.unByKey=mt;let Uv={Control:Do,Zoom:jo,Attribution:zo,ScaleLine:np,LayerSwitcher:lp},Bv={GeoJSON:Br,KML:z_,MVT:ms},Vv={Group:po,Tile:Fl,Vector:Bh,VectorTile:ou,WebGLPoints:Iv,Heatmap:Ky,Image:Jy},Xv={LineString:ir,Point:or,MultiPoint:lr},Wv={Icon:Ve,Style:Ar,Text:Or,Stroke:Rr,Fill:Jt,Circle:Ht},Yv={OSM:Nv,XYZ:Av,TileWMS:jv,BingMaps:Lv,Vector:iu,VectorTile:uu,ImageWMS:zv,ImageStatic:Ov};t.Collection=bs,t.Feature=We,t.Map=Fa,t.Observable=_t,t.Overlay=Qg,t.View=no,t.applyStyle=function(t,e,i,n,r){var s,o,a;return void 0===i&&(i=""),void 0===n&&(n={}),void 0===r&&(r=void 0),"string"==typeof n?(s=n,a={}):(s=n.styleUrl,a=n),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:dg(s,a.accessToken),a=function(t,e){return e.accessToken||(e=Object.assign({},e),new URL(t).searchParams.forEach((function(t,i){e.accessToken=t,e.accessTokenParam=i}))),e}(s,a)),new Promise((function(n,l){(function(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return yg("Style",t=dg(t,e.accessToken),e);try{var i=JSON.parse(t);return Promise.resolve(i)}catch(t){return Promise.reject(t)}})(e,a).then((function(e){if(8!=e.version)return l(new Error("glStyle version 8 required."));if(!(t instanceof Bh||t instanceof ou))return l(new Error("Can only apply to VectorLayer or VectorTileLayer"));var h,u,c,d=t instanceof ou?"vector":"geojson";if(i?o=Array.isArray(i)?e.layers.find((function(t){return t.id===i[0]})).source:i:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===d})),i=o),!o)return l(new Error("No "+d+" source found in the glStyle."));function g(){if(t instanceof ou)return function(t,e,i){return new Promise((function(n,r){(function(t,e,i){void 0===i&&(i={});var n=[e,JSON.stringify(t)].toString(),r=vg[n];if(!r||i.transformRequest){var s=t.url;if(s&&!t.tiles){var o=gg(s,i.accessToken,i.accessTokenParam||"access_token",e||location.href);r=s.startsWith("mapbox://")?Promise.resolve(Object.assign({},t,{url:void 0,tiles:o})):yg("Source",o,i).then((function(t){for(var e=0,n=t.tiles.length;e