mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-12-18 22:42:26 +00:00
4 lines
494 KiB
JavaScript
4 lines
494 KiB
JavaScript
!function(){"use strict";class t{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var e="propertychange";class i{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function n(t,e){return t>e?1:t<e?-1:0}function r(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function s(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function o(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function a(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function l(){return!0}function h(){return!1}function u(){}function c(t){let e,i,n,r=!1;return function(){const s=Array.prototype.slice.call(arguments);return r&&this===n&&a(s,i)||(r=!0,n=this,i=s,e=t.apply(this,arguments)),e}}function d(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function p(t){for(const e in t)delete t[e]}function g(t){let e;for(e in t)return!1;return!e}class f extends i{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(e){const i="string"==typeof e,n=i?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const s=i?new t(e):e;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let l;n in o||(o[n]=0,a[n]=0),++o[n];for(let t=0,e=r.length;t<e;++t)if(l="handleEvent"in r[t]?r[t].handleEvent(s):r[t].call(this,s),!1===l||s.propagationStopped){l=!1;break}if(0==--o[n]){let t=a[n];for(delete a[n];t--;)this.removeEventListener(n,u);delete o[n]}return l}disposeInternal(){this.listeners_&&p(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=u,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}var m="change",y="error",_="contextmenu",x="click",v="dblclick",w="keydown",b="keypress",C="load",S="touchmove",E="wheel";function T(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 R(t,e,i,n){return T(t,e,i,n,!0)}function I(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),p(t))}class M extends f{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(m)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=T(this,t[r],e);return n}return T(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=R(this,t[r],e)}else i=R(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)I(t[e]);else I(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}function k(){throw new Error("Unimplemented abstract method.")}M.prototype.on,M.prototype.once,M.prototype.un;let F=0;function P(t){return t.ol_uid||(t.ol_uid=String(++F))}class L extends t{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class A extends M{constructor(t){super(),this.on,this.once,this.un,P(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,i){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new L(n,t,i)),n=e,this.hasListener(n)&&this.dispatchEvent(new L(n,t,i))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],g(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var D="postrender",O="movestart",z="moveend",j="loadstart",G="loadend";const N="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",q=N.includes("firefox");N.includes("safari")&&!N.includes("chrom")&&(N.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(N));const W=N.includes("webkit")&&!N.includes("edge"),X=N.includes("macintosh"),B="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,V="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,Y="undefined"!=typeof Image&&Image.prototype.decode,Z=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 U(t,e,i,n){let r;return r=i&&i.length?i.shift():V?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let $;function K(){return $||($=U(1,1)),$}function H(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function J(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Q(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}class tt extends A{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(){Q(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&Q(this.element);for(let t=0,e=this.listenerKeys.length;t<e;++t)I(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){(this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==u&&this.listenerKeys.push(T(t,D,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}}var et="layergroup",it="size",nt="target",rt="view";const st="ol-hidden",ot="ol-unselectable",at="ol-unsupported",lt="ol-control",ht="ol-collapsed",ut=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),ct=["style","variant","weight","size","lineHeight","family"],dt=function(t){const e=t.match(ut);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=ct.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[ct[t]]=n)}return i.families=i.family.split(/,\s?/),i},pt=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"],gt="enterfullscreen",ft="leavefullscreen";function mt(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function yt(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function _t(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}var xt="add",vt="remove";const wt="length";class bt extends t{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Ct extends A{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(wt)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new bt(xt,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new bt(vt,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 bt(vt,i,t)),this.dispatchEvent(new bt(xt,e,t))}updateLength_(){this.set(wt,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}var St="opacity",Et="visible",Tt="extent",Rt="zIndex",It="maxResolution",Mt="minResolution",kt="maxZoom",Ft="minZoom",Pt="source",Lt="map";function At(t,e){if(!t)throw new Error(e)}function Dt(t,e,i){return Math.min(Math.max(t,e),i)}function Ot(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 zt(t,e,i,n)}function zt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function jt(t){return t*Math.PI/180}function Gt(t,e){const i=t%e;return i*e<0?i+e:i}function Nt(t,e,i){return t+i*(e-t)}function qt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Wt(t,e){return Math.floor(qt(t,e))}function Xt(t,e){return Math.ceil(qt(t,e))}class Bt extends A{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[St]=void 0!==t.opacity?t.opacity:1,At("number"==typeof e[St],"Layer opacity must be a number"),e[Et]=void 0===t.visible||t.visible,e[Rt]=t.zIndex,e[It]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Mt]=void 0!==t.minResolution?t.minResolution:0,e[Ft]=void 0!==t.minZoom?t.minZoom:-1/0,e[kt]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=Dt(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return k()}getLayerStatesArray(t){return k()}getExtent(){return this.get(Tt)}getMaxResolution(){return this.get(It)}getMinResolution(){return this.get(Mt)}getMinZoom(){return this.get(Ft)}getMaxZoom(){return this.get(kt)}getOpacity(){return this.get(St)}getSourceState(){return k()}getVisible(){return this.get(Et)}getZIndex(){return this.get(Rt)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Tt,t)}setMaxResolution(t){this.set(It,t)}setMinResolution(t){this.set(Mt,t)}setMaxZoom(t){this.set(kt,t)}setMinZoom(t){this.set(Ft,t)}setOpacity(t){At("number"==typeof t,"Layer opacity must be a number"),this.set(St,t)}setVisible(t){this.set(Et,t)}setZIndex(t){this.set(Rt,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var Vt="prerender",Yt="postrender",Zt="precompose",Ut="postcompose",$t="rendercomplete",Kt=0,Ht=1,Jt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const Qt=42,te=256,ee={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ie{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_||ee[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 ne=6378137,re=Math.PI*ne,se=[-re,-re,re,re],oe=[-180,-85,180,85],ae=ne*Math.log(Math.tan(Math.PI/2));class le extends ie{constructor(t){super({code:t,units:"m",extent:se,global:!0,worldExtent:oe,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ne)}})}}const he=[new le("EPSG:3857"),new le("EPSG:102100"),new le("EPSG:102113"),new le("EPSG:900913"),new le("http://www.opengis.net/def/crs/EPSG/0/3857"),new le("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ue(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;r<n;r+=i){e[r]=re*t[r]/180;let i=ne*Math.log(Math.tan(Math.PI*(+t[r+1]+90)/360));i>ae?i=ae:i<-ae&&(i=-ae),e[r+1]=i}return e}function ce(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;r<n;r+=i)e[r]=180*t[r]/re,e[r+1]=360*Math.atan(Math.exp(t[r+1]/ne))/Math.PI-90;return e}const de=[-180,-90,180,90],pe=6378137*Math.PI/180;class ge extends ie{constructor(t,e){super({code:t,units:"degrees",extent:de,axisOrientation:e,global:!0,metersPerUnit:pe,worldExtent:de})}}const fe=[new ge("CRS:84"),new ge("EPSG:4326","neu"),new ge("urn:ogc:def:crs:OGC:1.3:CRS84"),new ge("urn:ogc:def:crs:OGC:2:84"),new ge("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ge("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ge("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let me={};let ye={};function _e(t,e,i){const n=t.getCode(),r=e.getCode();n in ye||(ye[n]={}),ye[n][r]=i}var xe={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ve(t){const e=Ie();for(let i=0,n=t.length;i<n;++i)De(e,t[i]);return e}function we(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function be(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Ce(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function Se(t,e){return Te(t,e[0],e[1])}function Ee(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Te(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Re(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=xe.UNKNOWN;return o<i?l|=xe.LEFT:o>r&&(l|=xe.RIGHT),a<n?l|=xe.BELOW:a>s&&(l|=xe.ABOVE),l===xe.UNKNOWN&&(l=xe.INTERSECTING),l}function Ie(){return[1/0,1/0,-1/0,-1/0]}function Me(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 ke(t){return Me(1/0,1/0,-1/0,-1/0,t)}function Fe(t,e){const i=t[0],n=t[1];return Me(i,n,i,n,e)}function Pe(t,e,i,n,r){return Oe(ke(r),t,e,i,n)}function Le(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Ae(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function De(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function Oe(t,e,i,n,r){for(;i<n;i+=r)ze(t,e[i],e[i+1]);return t}function ze(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function je(t,e){let i;return i=e(Ne(t)),i||(i=e(qe(t)),i||(i=e($e(t)),i||(i=e(Ue(t)),i||!1)))}function Ge(t){let e=0;return Je(t)||(e=Ke(t)*Ye(t)),e}function Ne(t){return[t[0],t[1]]}function qe(t){return[t[2],t[1]]}function We(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Xe(t,e){let i;if("bottom-left"===e)i=Ne(t);else if("bottom-right"===e)i=qe(t);else if("top-left"===e)i=Ue(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=$e(t)}return i}function Be(t,e,i,n,r){const[s,o,a,l,h,u,c,d]=Ve(t,e,i,n);return Me(Math.min(s,a,h,c),Math.min(o,l,u,d),Math.max(s,a,h,c),Math.max(o,l,u,d),r)}function Ve(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,u=s*o,c=s*a,d=t[0],p=t[1];return[d-l+c,p-h-u,d-l-c,p-h+u,d+l-c,p+h+u,d+l+c,p+h-u,d-l+c,p-h-u]}function Ye(t){return t[3]-t[1]}function Ze(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return He(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):ke(n),n}function Ue(t){return[t[0],t[3]]}function $e(t){return[t[2],t[3]]}function Ke(t){return t[2]-t[0]}function He(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Je(t){return t[2]<t[0]||t[3]<t[1]}function Qe(t,e,i,n){if(Je(t))return ke(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return Me(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}function ti(t,e){const i=e.getExtent(),n=We(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Ke(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function ei(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 ii(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 ni(t,e){if(e.canWrapX()){const i=Ke(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Ke(n),r=Math.floor((t[0]-n[0])/i));return r}(t,e,i);n&&(t[0]-=n*i)}return t}const ri=6371008.8;function si(t,e,i){i=i||ri;const n=jt(t[1]),r=jt(e[1]),s=(r-n)/2,o=jt(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 oi(...t){console.warn(...t)}let ai=!0;function li(t){ai=!(void 0===t||t)}function hi(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function ui(t,e){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function ci(t){!function(t,e){me[t]=e}(t.getCode(),t),_e(t,t,hi)}function di(t){return"string"==typeof t?me[e=t]||me[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null:t||null;var e}function pi(t,e,i,n){let r;const s=(t=di(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/ee[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=_i(t,di("EPSG:4326"));if(o===ui&&"degrees"!==s)r=e*t.getMetersPerUnit();else{let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);r=(si(t.slice(0,2),t.slice(2,4))+si(t.slice(4,6),t.slice(6,8)))/2}const a=n?ee[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function gi(t){!function(t){t.forEach(ci)}(t),t.forEach((function(e){t.forEach((function(t){e!==t&&_e(e,t,hi)}))}))}function fi(t,e){return t?"string"==typeof t?di(t):t:di(e)}function mi(t,e){return li(),vi(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function yi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return _i(t,e)===hi&&i}function _i(t,e){let i=function(t,e){let i;return t in ye&&e in ye[t]&&(i=ye[t][e]),i}(t.getCode(),e.getCode());return i||(i=ui),i}function xi(t,e){return _i(di(t),di(e))}function vi(t,e,i){return xi(e,i)(t,void 0,t.length)}let wi=null;function bi(t,e){return t}function Ci(t,e){return ai&&!ei(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(ai=!1,oi("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Si(t,e){return t}function Ei(t,e){return t}var Ti,Ri,Ii;function Mi(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,c=a?a[1]:0;let d=t[0]+l/2+u,p=t[2]-l/2+u,g=t[1]+h/2+c,f=t[3]-h/2+c;d>p&&(d=(p+d)/2,p=d),g>f&&(g=(f+g)/2,f=g);let m=Dt(n[0],d,p),y=Dt(n[1],g,f);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-p)/t),y+=-t*Math.log(1+Math.max(0,g-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[m,y]}}function ki(t){return t}function Fi(t,e,i,n){const r=Ke(e)/i[0],s=Ye(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Pi(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),Dt(n,i/2,2*e)}function Li(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Fi(t,n,a,r):t;return i&&l?Pi(s,o,e):Dt(s,e,o)}}}function Ai(t){if(void 0!==t)return 0}function Di(t){if(void 0!==t)return t}function Oi(t){return Math.pow(t,3)}function zi(t){return 1-Oi(1-t)}function ji(t){return 3*t*t-2*t*t*t}function Gi(t){return t}gi(he),gi(fe),Ti=he,Ri=ue,Ii=ce,fe.forEach((function(t){Ti.forEach((function(e){_e(t,e,Ri),_e(e,t,Ii)}))}));const Ni=new Array(6);function qi(t){return Xi(t,1,0,0,1,0,0)}function Wi(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],p=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*p+o,t[5]=n*d+s*p+a,t}function Xi(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 Bi(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 Vi(t,e,i){return Wi(t,Xi(Ni,e,0,0,i,0,0))}function Yi(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 Zi(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;At(0!==i,"Transformation matrix cannot be inverted");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}const Ui=[1e6,1e6,1e6,1e6,2,2];function $i(t){return"matrix("+t.map(((t,e)=>Math.round(t*Ui[e])/Ui[e])).join(", ")+")"}function Ki(t,e,i,n,r,s){s=s||[];let o=0;for(let a=e;a<i;a+=n){const e=t[a],i=t[a+1];s[o++]=r[0]*e+r[2]*i+r[4],s[o++]=r[1]*e+r[3]*i+r[5]}return s&&s.length!=o&&(s.length=o),s}function Hi(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],u=s[1];let c=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-u;o[c++]=h+e*a-i*l,o[c++]=u+e*l+i*a;for(let e=r+2;e<r+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}const Ji=[1,0,0,1,0,0];class Qi extends A{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=c(((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return k()}closestPointXY(t,e,i,n){return k()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return k()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&ke(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){k()}scale(t,e,i){k()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return k()}getType(){return k()}applyTransform(t){k()}intersectsExtent(t){return k()}translate(t,e){k()}transform(t,e){const i=di(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ye(o)/Ye(s);return Yi(Ji,o[0],o[3],a,-a,0,0,0),Ki(t,0,t.length,r,Ji,n),xi(i,e)(t,n,r)}:xi(i,e);return this.applyTransform(n),this}}class tn extends Qi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Pe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return k()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=nn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){k()}setLayout(t,e,i){let n;if(t)n=nn(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=en(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Hi(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=We(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[u++]=l+r*e,a[u++]=h+s*i;for(let e=o+2;e<o+n;++e)a[u++]=t[e]}a&&a.length!=u&&(a.length=u)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+r,o[a++]=t[l+1]+s;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}}function en(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function nn(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function rn(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,u=t[i+1]-l;let c;if(0===h&&0===u)c=e;else{const d=((r-a)*h+(s-l)*u)/(h*h+u*u);if(d>1)c=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=Nt(t[e+r],t[i+r],d);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function sn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=zt(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function on(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=sn(t,e,o,n,r),e=o}return r}function an(t,e,i,n,r,s,o,a,l,h,u){if(e==i)return h;let c,d;if(0===r){if(d=zt(o,a,t[e],t[e+1]),d<h){for(c=0;c<n;++c)l[c]=t[e+c];return l.length=n,d}return h}u=u||[NaN,NaN];let p=e+n;for(;p<i;)if(rn(t,p-n,p,n,o,a,u),d=zt(o,a,u[0],u[1]),d<h){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n,p+=n}else p+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(rn(t,i-n,e,n,o,a,u),d=zt(o,a,u[0],u[1]),d<h)){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function ln(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=an(t,e,d,n,r,s,o,a,l,h,u),e=d}return h}function hn(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function un(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=hn(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function cn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=un(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function dn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let u=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],p=t[i+1];for(let e=s+n;e<i;e+=n){const i=Ot(t[e],t[e+1],a,c,d,p);i>o&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n<u&&h.push(s,u),u+n<i&&h.push(u,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function pn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=dn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function gn(t,e){return e*Math.round(t/e)}function fn(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=gn(t[e],r),u=gn(t[e+1],r);e+=n,s[o++]=h,s[o++]=u;do{if(a=gn(t[e],r),l=gn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==u);for(;e<i;){const i=gn(t[e],r),c=gn(t[e+1],r);if(e+=n,i==a&&c==l)continue;const d=a-h,p=l-u,g=i-h,f=c-u;d*f==p*g&&(d<0&&g<d||d==g||d>0&&g>d)&&(p<0&&f<p||p==f||p>0&&f>p)?(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 mn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=fn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function yn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function _n(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=yn(t,e,a,n,r[s]),e=a}return r.length=s,r}function xn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:_n(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function vn(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=o*i-s*n,s=i,o=n}return r/2}function wn(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=vn(t,e,o,n),e=o}return r}class bn extends tn{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new bn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ce(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return vn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return yn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new bn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}class Cn extends tn{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Cn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=zt(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Fe(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Te(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i,n){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}function Sn(t,e,i,n,r){return!je(r,(function(r){return!En(t,e,i,n,r[0],r[1])}))}function En(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(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 Tn(t,e,i,n,r,s){if(0===i.length)return!1;if(!En(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(En(t,i[e-1],i[e],n,r,s))return!1;return!0}function Rn(t,e,i,r,s,o,a){let l,h,u,c,d,p,g;const f=s[o+1],m=[];for(let n=0,s=i.length;n<s;++n){const s=i[n];for(c=t[s-r],p=t[s-r+1],l=e;l<s;l+=r)d=t[l],g=t[l+1],(f<=p&&g<=f||p<=f&&f<=g)&&(u=(f-p)/(g-p)*(d-c)+c,m.push(u)),c=d,p=g}let y=NaN,_=-1/0;for(m.sort(n),c=m[0],l=1,h=m.length;l<h;++l){d=m[l];const n=Math.abs(d-c);n>_&&(u=(c+d)/2,Tn(t,e,i,r,u,f)&&(y=u,_=n)),c=d}return isNaN(y)&&(y=s[o]),a?(a.push(y,f,_),a):[y,f,_]}function In(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Rn(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function Mn(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function kn(t,e,i,n,r){const s=Oe([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!He(r,s)&&(!!Ee(r,s)||(s[0]>=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||Mn(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=Re(t,e),s=Re(t,i);if(r===xe.INTERSECTING||s===xe.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],p=i[1],g=(p-c)/(d-u);let f,m;s&xe.ABOVE&&!(r&xe.ABOVE)&&(f=d-(p-h)/g,n=f>=o&&f<=l),n||!(s&xe.RIGHT)||r&xe.RIGHT||(m=p-(d-l)*g,n=m>=a&&m<=h),n||!(s&xe.BELOW)||r&xe.BELOW||(f=d-(p-a)/g,n=f>=o&&f<=l),n||!(s&xe.LEFT)||r&xe.LEFT||(m=p-(d-o)*g,n=m>=a&&m<=h)}return n}(r,t,e)})))))}function Fn(t,e,i,n,r){return!!kn(t,e,i,n,r)||(!!En(t,e,i,n,r[0],r[1])||(!!En(t,e,i,n,r[0],r[3])||(!!En(t,e,i,n,r[2],r[1])||!!En(t,e,i,n,r[2],r[3]))))}function Pn(t,e,i,n,r){if(!Fn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(Sn(t,i[e-1],i[e],n,r)&&!kn(t,i[e-1],i[e],n,r))return!1;return!0}function Ln(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function An(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function Dn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=An(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function On(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!Dn(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function zn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=An(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&Ln(t,e,o,n),e=o}return e}function jn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=zn(t,e,i[s],n,r);return e}function Gn(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=An(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class Nn extends tn{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?o(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Nn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ce(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(on(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Tn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return wn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),zn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,_n(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=We(this.getExtent());this.flatInteriorPoint_=Rn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Cn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new bn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new bn(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Dn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=zn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=mn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Nn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Pn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=un(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function qn(t){if(Je(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new Nn(s,"XY",[s.length])}class Wn extends A{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=fi(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&&li(),t.center&&(t.center=Ci(t.center,this.projection_)),t.extent&&(t.extent=Ei(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in Jt)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,o=2;let a=void 0!==t.minZoom?t.minZoom:0,l=void 0!==t.maxZoom?t.maxZoom:s;const h=void 0!==t.zoomFactor?t.zoomFactor:o,u=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,d=void 0!==t.showFullExtent&&t.showFullExtent,p=fi(t.projection,"EPSG:3857"),g=p.getExtent();let f=t.constrainOnlyCenter,m=t.extent;u||m||!p.isGlobal()||(f=!1,m=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[a],n=void 0!==s[l]?s[l]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,o,a,l){if(void 0!==s){const h=t[0],u=t[t.length-1],c=i?Fi(h,i,a,n):h;if(l)return e?Pi(s,c,u):Dt(s,u,c);const d=Math.min(c,s),p=Math.floor(r(t,d,o));return t[p]>c&&p<t.length-1?t[p+1]:t[p]}}}(s,c,!f&&m,d):Li(i,n,c,!f&&m,d)}else{const r=(g?Math.max(Ke(g),Ye(g)):360*ee.degrees/p.getMetersPerUnit())/te/Math.pow(o,0),u=r/Math.pow(o,s-0);i=t.maxResolution,void 0!==i?a=0:i=r/Math.pow(h,a),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,l):r/Math.pow(h,l):u),l=a+Math.floor(Math.log(i/n)/Math.log(h)),n=i/Math.pow(h,l-a),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const u=r?Fi(e,r,l,s):e;if(h)return n?Pi(o,u,i):Dt(o,i,u);const c=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(t)-c),p=-a*(.5-c)+.5,g=Math.min(u,o),f=Math.floor(Math.log(e/g)/Math.log(t)+p),m=Math.max(d,f);return Dt(e/Math.pow(t,m),i,u)}}}(h,i,n,c,!f&&m,d):Li(i,n,c,!f&&m,d)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:a,zoomFactor:h}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Mi(t.extent,t.constrainOnlyCenter,e)}const e=fi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Mi(t,!1,!1)}return ki}(t),s=i.constraint,o=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(t){const e=void 0===t?jt(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===e?Di:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):Di}return Ai}(t);this.constraints_={center:n,resolution:s,rotation:o},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Ci(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Ci(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&Xn(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||ji,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Gt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Bn(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(Kt,1),this.updateAnimations_()}getAnimating(){return this.hints_[Kt]>0}getInteracting(){return this.hints_[Ht]>0}cancelAnimations(){let t;this.setHint(Kt,-this.hints_[Kt]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Xn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?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?Gt(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(Kt,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Xn(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]],ii(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?bi(t,this.getProjection()):t}getCenterInternal(){return this.get(Jt.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 Si(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();At(e,"The view center is not defined");const i=this.getResolution();At(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return At(void 0!==n,"The view rotation is not defined"),Be(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(Jt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ei(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Ke(t)/e[0],n=Ye(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(Jt.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=Vn(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 s=r(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+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=Dt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Dt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(At(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){At(!Je(t),"Cannot fit empty extent provided as `geometry`");i=qn(Ei(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Ei(t.getExtent(),this.getProjection());i=qn(e),i.rotate(this.getRotation(),We(e))}else i=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<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),d=We(o);d[0]+=(n[1]-n[3])/2*a,d[1]+=(n[0]-n[2])/2*a;const p=d[0]*c-d[1]*h,g=d[1]*c+d[0]*h,f=this.getConstrainedCenter([p,g],a),m=e.callback?e.callback:u;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},m):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Xn(m,!0))}centerOn(t,e,i){this.centerOnInternal(Ci(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Vn(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Vn(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=bi(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Ci(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Ci(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Ci(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(Jt.ROTATION)!==n&&this.set(Jt.ROTATION,n),this.get(Jt.RESOLUTION)!==s&&(this.set(Jt.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(Jt.CENTER)&&ei(this.get(Jt.CENTER),o)||this.set(Jt.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&ei(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:zi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ht,1)}endInteraction(t,e,i){i=i&&Ci(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Ht,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Xn(t,e){setTimeout((function(){t(e)}),0)}function Bn(t){return!(t.sourceCenter&&t.targetCenter&&!ei(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Vn(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]}function Yn(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Zn=class extends Bt{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(Pt,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(Pt)||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_&&(I(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=T(t,m,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;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof Wn?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const r=this.getExtent();return Yn(n,e.viewState)&&(!r||He(r,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 Wn?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Lt,t)}getMapInternal(){return this.get(Lt)}setMap(t){this.mapPrecomposeKey_&&(I(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(I(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=T(t,Zt,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);At(!e.some((function(t){return t.layer===i.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}),this),this.mapRenderKey_=T(this,m,t.render,t),this.changed())}setSource(t){this.set(Pt,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 Un(t,e,i,n,r){$n(t,e,i||0,n||t.length-1,r||Hn)}function $n(t,e,i,n,r){for(;n>i;){if(n-i>600){var s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);$n(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(Kn(t,i,e),r(t[n],u)>0&&Kn(t,i,n);c<d;){for(Kn(t,c,d),c++,d--;r(t[c],u)<0;)c++;for(;r(t[d],u)>0;)d--}0===r(t[i],u)?Kn(t,i,d):Kn(t,++d,n),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function Kn(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Hn(t,e){return t<e?-1:t>e?1:0}let Jn=class{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(!hr(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;hr(t,a)&&(e.leaf?i.push(o):lr(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!hr(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(hr(t,s)){if(e.leaf||lr(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=ur([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=Qn(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!lr(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=ur(t.slice(e,i+1)),tr(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=ur([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));cr(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);cr(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return tr(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,o=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],h=sr(l),u=(r=t,s=l,(Math.max(s.maxX,r.maxX)-Math.min(s.minX,r.minX))*(Math.max(s.maxY,r.maxY)-Math.min(s.minY,r.minY))-h);u<o?(o=u,n=h<n?h:n,i=l):u===o&&h<n&&(n=h,i=l)}e=i||e.children[0]}var r,s;return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),ir(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=ur(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,tr(i,this.toBBox),tr(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=ur([t,e]),this.data.height=t.height+1,this.data.leaf=!1,tr(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=er(t,0,o,this.toBBox),a=er(t,o,i,this.toBBox),l=ar(e,a),h=sr(e)+sr(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:nr,r=t.leaf?this.compareMinY:rr;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=er(t,0,e,r),o=er(t,i-e,i,r);let a=or(s)+or(o);for(let n=e;n<i-e;n++){const e=t.children[n];ir(s,t.leaf?r(e):e),a+=or(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];ir(o,t.leaf?r(e):e),a+=or(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)ir(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():tr(t[i],this.toBBox)}};function Qn(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function tr(t,e){er(t,0,t.children.length,e,t)}function er(t,e,i,n,r){r||(r=ur(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];ir(r,t.leaf?n(e):e)}return r}function ir(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function nr(t,e){return t.minX-e.minX}function rr(t,e){return t.minY-e.minY}function sr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function or(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ar(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function lr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function hr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function ur(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function cr(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;Un(t,o,e,i,r),s.push(e,o,o,i)}}var dr={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function pr(t){return t[0]>0&&t[1]>0}function gr(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class fr{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=gr(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new fr({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 k()}getImage(t){return k()}getHitDetectionImage(){return k()}getPixelRatio(t){return 1}getImageState(){return k()}getImageSize(){return k()}getOrigin(){return k()}getSize(){return k()}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_=gr(t)}listenImageChange(t){k()}load(){k()}unlistenImageChange(t){k()}ready(){return Promise.resolve()}}var mr={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},yr={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};yr.max=yr.whitepoint[2].D65,yr.rgb=function(t,e){e=e||yr.whitepoint[2].E;var i,n,r,s=t[0]/e[0],o=t[1]/e[1],a=t[2]/e[2];return n=-.96924363628087*s+1.87596750150772*o+.041555057407175*a,r=.055630079696993*s+-.20397695888897*o+1.056971514242878*a,i=(i=3.240969941904521*s+-1.537383177570093*o+-.498610760293*a)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:r*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},mr.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,r=t[2]/255,s=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92),o=.019330818715591*i+.11919477979462*n+.95053215224966*r;return[(.41239079926595*i+.35758433938387*n+.18048078840183*r)*(e=e||yr.whitepoint[2].E)[0],s*e[1],o*e[2]]};var _r=yr,xr={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,r,s,o,a,l,h,u,c;if(s=t[0],o=t[1],a=t[2],0===s)return[0,0,0];return e=e||"D65",i=i||2,n=o/(13*s)+4*(h=_r.whitepoint[i][e][0])/(h+15*(u=_r.whitepoint[i][e][1])+3*(c=_r.whitepoint[i][e][2]))||0,r=a/(13*s)+9*u/(h+15*u+3*c)||0,[9*(l=s>8?u*Math.pow((s+16)/116,3):u*s*.0011070564598794539)*n/(4*r)||0,l,l*(12-3*n-20*r)/(4*r)||0]}};_r.luv=function(t,e,i){var n,r,s,o,a,l,h,u,c,d,p;e=e||"D65",i=i||2,d=4*(h=_r.whitepoint[i][e][0])/(h+15*(u=_r.whitepoint[i][e][1])+3*(c=_r.whitepoint[i][e][2])),p=9*u/(h+15*u+3*c),n=4*(o=t[0])/(o+15*(a=t[1])+3*(l=t[2]))||0,r=9*a/(o+15*a+3*l)||0;var g=a/u;return[s=g<=.008856451679035631?903.2962962962961*g:116*Math.pow(g,1/3)-16,13*s*(n-d),13*s*(r-p)]};var vr={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return xr.xyz(vr.luv(t))}},wr=vr;function br(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}xr.lchuv=function(t){var e=t[0],i=t[1],n=t[2],r=Math.sqrt(i*i+n*n),s=360*Math.atan2(n,i)/2/Math.PI;return s<0&&(s+=360),[e,r,s]},_r.lchuv=function(t){return xr.lchuv(_r.luv(t))};var Cr=br({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Sr={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};var Er={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,r,s,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[s=255*l,s,s];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,s=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[h++]=255*s;return r}};function Tr(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=function(t){var e,i,n=[],r=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),Cr[t])n=Cr[t].slice(),i="rgb";else if("transparent"===t)r=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var s=t.slice(1),o=s.length;r=1,o<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===o&&(r=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===o&&(r=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),r=(n=n.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==Sr[t])return Sr[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:r}}(t);if(!i.space)return[];const n="h"===i.space[0]?Er.min:mr.min,r="h"===i.space[0]?Er.max:mr.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],n[0]),r[0]),e[1]=Math.min(Math.max(i.values[1],n[1]),r[1]),e[2]=Math.min(Math.max(i.values[2],n[2]),r[2]),"h"===i.space[0]&&(e=Er.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}mr.hsl=function(t){var e,i,n=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(n,r,s),a=Math.max(n,r,s),l=a-o;return a===o?e=0:n===a?e=(r-s)/l:r===a?e=2+(s-n)/l:s===a&&(e=4+(n-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};const Rr=1024,Ir={};let Mr=0;function kr(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Fr(t){const e=_r.lchuv(mr.xyz(t));return e[3]=t[3],e}function Pr(t){if(Ir.hasOwnProperty(t))return Ir[t];if(Mr>=Rr){let t=0;for(const e in Ir)0==(3&t++)&&(delete Ir[e],--Mr)}const e=Tr(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return Ar(e),Ir[t]=e,++Mr,e}function Lr(t){return Array.isArray(t)?t:Pr(t)}function Ar(t){return t[0]=Dt(t[0]+.5|0,0,255),t[1]=Dt(t[1]+.5|0,0,255),t[2]=Dt(t[2]+.5|0,0,255),t[3]=Dt(t[3],0,1),t}function Dr(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(1e3*t[3])/1e3)+")"}class Or extends f{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?dr.IDLE:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(m)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==dr.IDLE&&this.loader){this.state=dr.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;d((()=>this.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=dr.LOADED})).catch((t=>{this.state=dr.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function zr(t,e){return e&&(t.src=e),t.src&&Y?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):function(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}(t)}function jr(t,e,i){return e+":"+t+":"+(i?Lr(i):"null")}const Gr=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=jr(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=jr(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const s=jr(t,e,i),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===dr.IDLE&&n.load(),n.getImageState()===dr.LOADING?n.ready().then((()=>{this.patternCache_[s]=K().createPattern(n.getImage(1),"repeat")})):this.patternCache_[s]=K().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Nr=null;class qr extends f{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=void 0===n?dr.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===dr.LOADED){Nr||(Nr=U(1,1,void 0,{willReadFrequently:!0})),Nr.drawImage(this.image_,0,0);try{Nr.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Nr=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(m)}handleImageError_(){this.imageState_=dr.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=dr.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=U(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_===dr.IDLE){this.image_||this.initializeImage_(),this.imageState_=dr.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&zr(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==dr.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=function(t){return"string"==typeof t?t:Dr(t)}(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise((t=>{this.imageState_===dr.LOADED||this.imageState_===dr.ERROR?t():this.addEventListener(m,(function e(){this.imageState_!==dr.LOADED&&this.imageState_!==dr.ERROR||(this.removeEventListener(m,e),t())}))}))),this.ready_}}function Wr(t,e,i,n,r,s){let o=void 0===e?void 0:Gr.get(e,i,r);return o||(o=new qr(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,r),Gr.set(e,i,r,o,s)),s&&o&&!Gr.getPattern(e,i,r)&&Gr.set(e,i,r,o,s),o}function Xr(t){return t?Array.isArray(t)?Dr(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Gr.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Gr.getPattern(e,void 0,t.color);if(i)return i;const n=Gr.get(t.src,"anonymous",null);if(n.getImageState()!==dr.LOADED)return null;const r=U(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Wr(r.canvas,e,void 0,dr.LOADED,t.color,!0),Gr.getPattern(e,void 0,t.color)}(t):t:null}const Br="10px sans-serif",Vr="#000",Yr="round",Zr=[],Ur="round",$r="#000",Kr="center",Hr="middle",Jr=[0,0,0,0],Qr=new A;let ts,es=null;const is={},ns=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let r,s;function o(r,o,a){let l=!0;for(let h=0;h<i;++h){const i=e[h];if(s=os(r+" "+o+" "+t+i,n),a!=i){const e=os(r+" "+o+" "+t+a+","+i,n);l=l&&e!=s}}return!!l}function a(){let t=!0;const e=Qr.getKeys();for(let i=0,n=e.length;i<n;++i){const n=e[i];Qr.get(n)<100&&(o.apply(this,n.split("\n"))?(p(is),es=null,ts=void 0,Qr.set(n,100)):(Qr.set(n,Qr.get(n)+1,!0),t=!1))}t&&(clearInterval(r),r=void 0)}return function(t){const e=dt(t);if(!e)return;const i=e.families;for(let t=0,n=i.length;t<n;++t){const n=i[t],s=e.style+"\n"+e.weight+"\n"+n;void 0===Qr.get(s)&&(Qr.set(s,100,!0),o(e.style,e.weight,n)||(Qr.set(s,0,!0),void 0===r&&(r=setInterval(a,32))))}}}(),rs=function(){let t;return function(e){let i=is[e];if(null==i){if(V){const t=dt(e),n=ss(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);is[e]=i}return i}}();function ss(t,e){return es||(es=U(1,1)),t!=ts&&(es.font=t,ts=es.font),es.measureText(e)}function os(t,e){return ss(t,e).width}function as(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce(((e,i)=>Math.max(e,os(t,i))),0);return i[e]=n,n}function ls(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.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;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):u[0]<0||u[1]<0?(t.translate(l,h),t.scale(u[0],u[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*u[0],a*u[1]),t.restore()}class hs extends fr{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?dr.LOADING:dr.LOADED,this.imageState_===dr.LOADING&&this.ready().then((()=>this.imageState_=dr.LOADED)),this.render()}clone(){const t=this.getScale(),e=new hs({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=U(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),u=h/a;if("miter"===t&&u<=i)return u*e;const c=e/2/u,d=e/2*(l/h),p=Math.sqrt((n+c)*(n+c)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*p;const g=n*Math.sin(o),f=r-Math.sqrt(n*n-g*g),m=Math.sqrt(g*g+f*f)/g;if(m<=i){const t=m*e/2-r-n;return 2*Math.max(p,t)}return 2*p}createRenderOptions(){let t,e=Yr,i=Ur,n=0,r=null,s=0,o=0;this.stroke_&&(t=Xr(this.stroke_.getColor()??$r),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Ur,e=this.stroke_.getLineCap()??Yr,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius_,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvases_={},this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Vr),e.fillStyle=Xr(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=Lr(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=U(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius_;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Vr,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class us extends hs{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new us({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}class cs{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new cs({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Wr(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then((()=>{this.patternImage_=null})),e.getImageState()===dr.IDLE&&e.load(),e.getImageState()===dr.LOADING&&(this.patternImage_=e)}this.color_=t}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class ds{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new ds({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class ps{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ms,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new ps({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=ms,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let gs=null;function fs(t,e){if(!gs){const t=new cs({color:"rgba(255,255,255,0.4)"}),e=new ds({color:"#3399CC",width:1.25});gs=[new ps({image:new us({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return gs}function ms(t){return t.getGeometry()}var ys=ps;function _s(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class xs extends fr{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,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 s=void 0!==t.img?t.img:null;let o,a=t.src;if(At(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||P(s)),At(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),At(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=dr.IDLE:void 0!==s&&(o=s instanceof HTMLImageElement?s.complete?s.src?dr.LOADED:dr.IDLE:dr.LOADING:dr.LOADED),this.color_=void 0!==t.color?Lr(t.color):null,this.iconImage_=Wr(s,a,this.crossOrigin_,o,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,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(_s(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(_s(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new xs({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const 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(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==dr.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==dr.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(m,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(m,t)}ready(){return this.iconImage_.ready()}}class vs{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=gr(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new cs({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new vs({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=gr(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}let ws=0;const bs=0,Cs=1<<ws++,Ss=1<<ws++,Es=1<<ws++,Ts=1<<ws++,Rs=1<<ws++,Is=Math.pow(2,5)-1,Ms={[Cs]:"boolean",[Ss]:"number",[Es]:"string",[Ts]:"color",[Rs]:"number[]"},ks=Object.keys(Ms).map(Number).sort(n);function Fs(t){const e=[];for(const n of ks)(t&(i=n))===i&&e.push(Ms[n]);var i;return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Ps(t,e){return!!(t&e)}function Ls(t,e){return t===e}class As{constructor(t,e){this.type=t,this.value=e}}class Ds{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Os(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,style:{}}}function zs(t,e,i){switch(typeof t){case"boolean":return new As(Cs,t);case"number":return new As(Ss,t);case"string":{let e=Es;return function(t){try{return Pr(t),!0}catch(t){return!1}}(t)&&(e|=Ts),Ls(e&i,bs)||(e&=i),new As(e,t)}}if(!Array.isArray(t))throw new Error("Expression must be an array or a primitive value");if(0===t.length)throw new Error("Empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=Gs[n];if(!r)throw new Error(`Unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("Expected an array of numbers");let n=Rs;return 3!==t.length&&4!==t.length||(n|=Ts),i&&(n&=i),new As(n,t)}const js={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string"},Gs={[js.Get]:Vs((([t,e])=>void 0!==e?function(t){switch(t){case"string":return Es;case"color":return Ts;case"number":return Ss;case"boolean":return Cs;case"number[]":return Rs;default:throw new Error(`Unrecognized type hint: ${t}`)}}(e.value):Is),qs(1,2),(function(t,e){const i=zs(t[1],e);if(!(i instanceof As))throw new Error("Expected a literal argument for get operation");if("string"!=typeof i.value)throw new Error("Expected a string argument for get operation");if(e.properties.add(i.value),3===t.length){return[i,zs(t[2],e)]}return[i]})),[js.Var]:Vs((([t])=>t.type),qs(1,1),(function(t,e,i,n){const r=t[1];if("string"!=typeof r)throw new Error("Expected a string argument for var operation");if(e.variables.add(r),!("variables"in e.style)||void 0===e.style.variables[r])return[new As(Is,r)];const s=e.style.variables[r],o=zs(s,e);if(o.value=r,n&&!Ps(n,o.type))throw new Error(`The variable ${r} has type ${Fs(o.type)} but the following type was expected: ${Fs(n)}`);return[o]})),[js.Id]:Vs(Ss|Es,Ns,(function(t,e){e.featureId=!0})),[js.Concat]:Vs(Es,qs(2,1/0),Ws(Is)),[js.GeometryType]:Vs(Es,Ns,(function(t,e){e.geometryType=!0})),[js.Resolution]:Vs(Ss,Ns),[js.Zoom]:Vs(Ss,Ns),[js.Time]:Vs(Ss,Ns),[js.Any]:Vs(Cs,qs(2,1/0),Ws(Cs)),[js.All]:Vs(Cs,qs(2,1/0),Ws(Cs)),[js.Not]:Vs(Cs,qs(1,1),Ws(Cs)),[js.Equal]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.NotEqual]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.GreaterThan]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.GreaterThanOrEqualTo]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.LessThan]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.LessThanOrEqualTo]:Vs(Cs,qs(2,2),Ws(Is),Xs),[js.Multiply]:Vs((t=>{let e=Ss|Ts;for(let i=0;i<t.length;i++)e&=t[i].type;return e}),qs(2,1/0),Ws(Ss|Ts),Xs),[js.Coalesce]:Vs((t=>{let e=Is;for(let i=1;i<t.length;i+=2)e&=t[i].type;return e&=t[t.length-1].type,e}),qs(2,1/0),Ws(Is),Xs),[js.Divide]:Vs(Ss,qs(2,2),Ws(Ss)),[js.Add]:Vs(Ss,qs(2,1/0),Ws(Ss)),[js.Subtract]:Vs(Ss,qs(2,2),Ws(Ss)),[js.Clamp]:Vs(Ss,qs(3,3),Ws(Ss)),[js.Mod]:Vs(Ss,qs(2,2),Ws(Ss)),[js.Pow]:Vs(Ss,qs(2,2),Ws(Ss)),[js.Abs]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Floor]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Ceil]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Round]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Sin]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Cos]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Atan]:Vs(Ss,qs(1,2),Ws(Ss)),[js.Sqrt]:Vs(Ss,qs(1,1),Ws(Ss)),[js.Match]:Vs((t=>{let e=Is;for(let i=2;i<t.length;i+=2)e&=t[i].type;return e&=t[t.length-1].type,e}),qs(4,1/0),Bs,(function(t,e,i,n){const r=t.length-1,s=zs(t[1],e);let o=s.type;const a=zs(t[t.length-1],e);let l=void 0!==n?n&a.type:a.type;const h=new Array(r-2);for(let i=0;i<r-2;i+=2){const n=zs(t[i+2],e),r=zs(t[i+3],e);o&=n.type,l&=r.type,h[i]=n,h[i+1]=r}const u=Es|Ss|Cs;if(!Ps(u,o))throw new Error(`Expected an input of type ${Fs(u)} for the interpolate operation, got ${Fs(o)} instead`);if(Ls(l,bs))throw new Error("Could not find a common output type for the following match operation: "+JSON.stringify(t));for(let i=0;i<r-2;i+=2){const n=zs(t[i+2],e,o),r=zs(t[i+3],e,l);h[i]=n,h[i+1]=r}return[zs(t[1],e,o),...h,zs(t[t.length-1],e,l)]})),[js.Between]:Vs(Cs,qs(3,3),Ws(Ss)),[js.Interpolate]:Vs((t=>{let e=Ts|Ss;for(let i=3;i<t.length;i+=2)e&=t[i].type;return e}),qs(6,1/0),Bs,(function(t,e,i,n){const r=t[1];let s;switch(r[0]){case"linear":s=1;break;case"exponential":if(s=r[1],"number"!=typeof s)throw new Error(`Expected a number base for exponential interpolation, got ${JSON.stringify(s)} instead`);break;default:s=null}if(!s)throw new Error(`Invalid interpolation type: ${JSON.stringify(r)}`);s=zs(s,e);let o=zs(t[2],e);if(!Ps(Ss,o.type))throw new Error(`Expected an input of type number for the interpolate operation, got ${Fs(o.type)} instead`);o=zs(t[2],e,Ss);const a=new Array(t.length-3);for(let i=0;i<a.length;i+=2){let n=zs(t[i+3],e);if(!Ps(Ss,n.type))throw new Error(`Expected all stop input values in the interpolate operation to be of type number, got ${Fs(n.type)} at position ${i+2} instead`);let r=zs(t[i+4],e);if(!Ps(Ss|Ts,r.type))throw new Error(`Expected all stop output values in the interpolate operation to be a number or color, got ${Fs(r.type)} at position ${i+3} instead`);n=zs(t[i+3],e,Ss),r=zs(t[i+4],e,Ss|Ts),a[i]=n,a[i+1]=r}return[s,o,...a]})),[js.Case]:Vs((t=>{let e=Is;for(let i=1;i<t.length;i+=2)e&=t[i].type;return e&=t[t.length-1].type,e}),qs(3,1/0),(function(t,e){const i=t[0],n=t.length-1;if(n%2==0)throw new Error(`An odd amount of arguments was expected for operation ${i}, got ${JSON.stringify(n)} instead`)}),(function(t,e,i,n){const r=zs(t[t.length-1],e);let s=void 0!==n?n&r.type:r.type;const o=new Array(t.length-1);for(let i=0;i<o.length-1;i+=2){const n=zs(t[i+1],e),r=zs(t[i+2],e);if(!Ps(Cs,n.type))throw new Error(`Expected all conditions in the case operation to be of type boolean, got ${Fs(n.type)} at position ${i} instead`);s&=r.type,o[i]=n,o[i+1]=r}if(Ls(s,bs))throw new Error("Could not find a common output type for the following case operation: "+JSON.stringify(t));for(let i=0;i<o.length-1;i+=2)o[i+1]=zs(t[i+2],e,s);return o[o.length-1]=zs(t[t.length-1],e,s),o})),[js.In]:Vs(Cs,qs(2,2),(function(t,e){let i=t[2];if(!Array.isArray(i))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');if("string"==typeof i[0]){if("literal"!==i[0])throw new Error('For the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions.');if(!Array.isArray(i[1]))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');i=i[1]}let n=Es|Ss;const r=new Array(i.length);for(let t=0;t<r.length;t++){const s=zs(i[t],e);n&=s.type,r[t]=s}if(Ls(n,bs))throw new Error("Could not find a common type for the following in operation: "+JSON.stringify(t));const s=zs(t[1],e,n);return[s,...r]})),[js.Number]:Vs(Ss,qs(1,1/0),Ws(Is)),[js.String]:Vs(Es,qs(1,1/0),Ws(Is)),[js.Array]:Vs((t=>3===t.length||4===t.length?Rs|Ts:Rs),qs(1,1/0),Ws(Ss)),[js.Color]:Vs(Ts,qs(1,4),Ws(Ss)),[js.Band]:Vs(Ss,qs(1,3),Ws(Ss)),[js.Palette]:Vs(Ts,qs(2,2),(function(t,e){const i=zs(t[1],e,Ss);if(i.type!==Ss)throw new Error(`The first argument of palette must be an number, got ${Fs(i.type)} instead`);const n=t[2];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const r=new Array(n.length);for(let t=0;t<r.length;t++){const i=zs(n[t],e,Ts);if(!(i instanceof As))throw new Error(`The palette color at index ${t} must be a literal value`);if(!Ps(i.type,Ts))throw new Error(`The palette color at index ${t} should be of type color, got ${Fs(i.type)} instead`);r[t]=i}return[i,...r]})),[js.ToString]:Vs(Es,qs(1,1),Ws(Cs|Ss|Es|Ts))};function Ns(t,e){const i=t[0];if(1!==t.length)throw new Error(`Expected no arguments for ${i} operation`);return[]}function qs(t,e){return function(i,n){const r=i[0],s=i.length-1;if(t===e){if(s!==t){throw new Error(`Expected ${t} argument${1===t?"":"s"} for ${r}, got ${s}`)}}else if(s<t||s>e){throw new Error(`Expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${s}`)}}}function Ws(t){return function(e,i){const n=e[0],r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){const r=zs(e[o+1],i);if(!Ps(t,r.type)){const e=Fs(t),i=Fs(r.type);throw new Error(`Unexpected type for argument ${o} of ${n} operation, got ${e} but expected ${i}`)}r.type&=t,s[o]=r}return s}}function Xs(t,e,i){const n=t[0],r=t.length-1;let s=Is;for(let t=0;t<i.length;++t)s&=i[t].type;if(s===bs)throw new Error(`No common type could be found for arguments of ${n} operation`);const o=new Array(r);for(let i=0;i<r;++i)o[i]=zs(t[i+1],e,s);return o}function Bs(t,e){const i=t[0],n=t.length-1;if(n%2==1)throw new Error(`An even amount of arguments was expected for operation ${i}, got ${JSON.stringify(n)} instead`)}function Vs(t,...e){return function(i,n,r){const s=i[0];let o=[];for(let t=0;t<e.length;t++)o=e[t](i,n,o,r)||o;let a="function"==typeof t?t(o):t;if(void 0!==r){if(!Ps(a,r))throw new Error(`The following expression was expected to return ${Fs(r)}, but returns ${Fs(a)} instead: ${JSON.stringify(i)}`);a&=r}if(a===bs)throw new Error(`No matching type was found for the following expression: ${JSON.stringify(i)}`);return new Ds(a,s,...o)}}function Ys(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Ys(t.getGeometries()[0]);default:return""}}function Zs(t,e,i){const n=zs(t,i);if(!Ps(e,n.type)){const t=Fs(e),i=Fs(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return Us(n)}function Us(t,e){if(t instanceof As){if(t.type===Ts&&"string"==typeof t.value){const e=Pr(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case js.Number:case js.String:case js.Coalesce:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e<n;++e)r[e]=Us(t.args[e]);switch(i){case js.Coalesce:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case js.Number:case js.String:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t);case js.Get:case js.Var:return function(t,e){const i=t.args[0],n=i.value;switch(t.operator){case js.Get:return t=>t.properties[n];case js.Var:return t=>t.variables[n];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case js.Id:return t=>t.featureId;case js.GeometryType:return t=>t.geometryType;case js.Concat:{const e=t.args.map((t=>Us(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case js.Resolution:return t=>t.resolution;case js.Any:case js.All:case js.Between:case js.In:case js.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e<n;++e)r[e]=Us(t.args[e]);switch(i){case js.Any:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case js.All:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case js.Between:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case js.In:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case js.Not:return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t);case js.Equal:case js.NotEqual:case js.LessThan:case js.LessThanOrEqualTo:case js.GreaterThan:case js.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=Us(t.args[0]),r=Us(t.args[1]);switch(i){case js.Equal:return t=>n(t)===r(t);case js.NotEqual:return t=>n(t)!==r(t);case js.LessThan:return t=>n(t)<r(t);case js.LessThanOrEqualTo:return t=>n(t)<=r(t);case js.GreaterThan:return t=>n(t)>r(t);case js.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t);case js.Multiply:case js.Divide:case js.Add:case js.Subtract:case js.Clamp:case js.Mod:case js.Pow:case js.Abs:case js.Floor:case js.Ceil:case js.Round:case js.Sin:case js.Cos:case js.Atan:case js.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e<n;++e)r[e]=Us(t.args[e]);switch(i){case js.Multiply:return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case js.Divide:return t=>r[0](t)/r[1](t);case js.Add:return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case js.Subtract:return t=>r[0](t)-r[1](t);case js.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case js.Mod:return t=>r[0](t)%r[1](t);case js.Pow:return t=>Math.pow(r[0](t),r[1](t));case js.Abs:return t=>Math.abs(r[0](t));case js.Floor:return t=>Math.floor(r[0](t));case js.Ceil:return t=>Math.ceil(r[0](t));case js.Round:return t=>Math.round(r[0](t));case js.Sin:return t=>Math.sin(r[0](t));case js.Cos:return t=>Math.cos(r[0](t));case js.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case js.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t);case js.Case:return function(t,e){const i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=Us(t.args[e]);return t=>{for(let e=0;e<i-1;e+=2){if(n[e](t))return n[e+1](t)}return n[i-1](t)}}(t);case js.Match:return function(t,e){const i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=Us(t.args[e]);return t=>{const e=n[0](t);for(let r=1;r<i;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t);case js.Interpolate:return function(t,e){const i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=Us(t.args[e]);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=kr(l)),i>=r)return 2===a?l:h?Ks(e,r,s,o,i,l):$s(e,r,s,o,i,l);s=i,o=l}return o}}(t);case js.ToString:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e<n;++e)r[e]=Us(t.args[e]);if(i===js.ToString)return e=>{const i=r[0](e);return t.args[0].type===Ts?Dr(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function $s(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Ks(t,e,i,n,r,s){if(0===r-i)return n;const o=Fr(n),a=Fr(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return Ar(function(t){const e=_r.rgb(wr.xyz(t));return e[3]=t[3],e}([$s(t,e,i,o[0],r,a[0]),$s(t,e,i,o[1],r,a[1]),o[2]+$s(t,e,i,0,r,l),$s(t,e,i,n[3],r,s[3])]))}function Hs(t){return!0}function Js(t){const e=Os(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Zs(i.filter,Cs,e):Hs;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=to(i.style[n],e)}else o=[to(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}}return r}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=Ys(t.getGeometry())),i(n)}}function Qs(t){const e=Os(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=to(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function to(t,e){const i=eo(t,"",e),n=io(t,"",e),r=function(t,e){const i="text-",n=ro(t,i+"value",e);if(!n)return null;const r=eo(t,i,e),s=eo(t,i+"background-",e),o=io(t,i,e),a=io(t,i+"background-",e),l=ro(t,i+"font",e),h=no(t,i+"max-angle",e),u=no(t,i+"offset-x",e),c=no(t,i+"offset-y",e),d=so(t,i+"overflow",e),p=ro(t,i+"placement",e),g=no(t,i+"repeat",e),f=uo(t,i+"scale",e),m=so(t,i+"rotate-with-view",e),y=no(t,i+"rotation",e),_=ro(t,i+"align",e),x=ro(t,i+"justify",e),v=ro(t,i+"baseline",e),w=ao(t,i+"padding",e),b=fo(t,i+"declutter-mode"),C=new vs({declutterMode:b});return function(t){if(C.setText(n(t)),r&&C.setFill(r(t)),s&&C.setBackgroundFill(s(t)),o&&C.setStroke(o(t)),a&&C.setBackgroundStroke(a(t)),l&&C.setFont(l(t)),h&&C.setMaxAngle(h(t)),u&&C.setOffsetX(u(t)),c&&C.setOffsetY(c(t)),d&&C.setOverflow(d(t)),p){const e=p(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");C.setPlacement(e)}if(g&&C.setRepeat(g(t)),f&&C.setScale(f(t)),m&&C.setRotateWithView(m(t)),y&&C.setRotation(y(t)),_){const e=_(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");C.setJustify(e)}if(v){const e=v(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(e)}return w&&C.setPadding(w(t)),C}}(t,e),s=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",r=yo(t[n],n),s=lo(t,i+"anchor",e),o=uo(t,i+"scale",e),a=no(t,i+"opacity",e),l=lo(t,i+"displacement",e),h=no(t,i+"rotation",e),u=so(t,i+"rotate-with-view",e),c=po(t,i+"anchor-origin"),d=go(t,i+"anchor-x-units"),p=go(t,i+"anchor-y-units"),g=function(t,e){const i=t[e];if(void 0===i)return;return xo(i,e)}(t,i+"color"),f=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),m=function(t,e){const i=t[e];if(void 0===i)return;return mo(i,e)}(t,i+"offset"),y=po(t,i+"offset-origin"),_=co(t,i+"width"),x=co(t,i+"height"),v=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return gr(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),w=fo(t,i+"declutter-mode"),b=new xs({src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:p,color:g,crossOrigin:f,offset:m,offsetOrigin:y,height:x,width:_,size:v,declutterMode:w});return function(t){return a&&b.setOpacity(a(t)),l&&b.setDisplacement(l(t)),h&&b.setRotation(h(t)),u&&b.setRotateWithView(u(t)),o&&b.setScale(o(t)),s&&b.setAnchor(s(t)),b}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=_o(t[n],n),o=_o(t[r],r),a=eo(t,i,e),l=io(t,i,e),h=uo(t,i+"scale",e),u=lo(t,i+"displacement",e),c=no(t,i+"rotation",e),d=so(t,i+"rotate-with-view",e),p=co(t,i+"radius2"),g=co(t,i+"angle"),f=fo(t,i+"declutter-mode"),m=new hs({points:s,radius:o,radius2:p,angle:g,declutterMode:f});return function(t){return a&&m.setFill(a(t)),l&&m.setStroke(l(t)),u&&m.setDisplacement(u(t)),c&&m.setRotation(c(t)),d&&m.setRotateWithView(d(t)),h&&m.setScale(h(t)),m}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=eo(t,i,e),r=io(t,i,e),s=no(t,i+"radius",e),o=uo(t,i+"scale",e),a=lo(t,i+"displacement",e),l=no(t,i+"rotation",e),h=so(t,i+"rotate-with-view",e),u=fo(t,i+"declutter-mode"),c=new us({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e);return null}(t,e),o=no(t,"z-index",e);if(!(i||n||r||s||g(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new ys;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function eo(t,e,i){let n;if(n=e+"fill-pattern-src"in t?function(t,e,i){const n=ro(t,e+"pattern-src",i),r=ho(t,e+"pattern-offset",i),s=ho(t,e+"pattern-size",i),o=oo(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i):oo(t,e+"fill-color",i),!n)return null;const r=new cs;return function(t){const e=n(t);return"none"===e?null:(r.setColor(e),r)}}function io(t,e,i){const n=no(t,e+"stroke-width",i),r=oo(t,e+"stroke-color",i);if(!n&&!r)return null;const s=ro(t,e+"stroke-line-cap",i),o=ro(t,e+"stroke-line-join",i),a=ao(t,e+"stroke-line-dash",i),l=no(t,e+"stroke-line-dash-offset",i),h=no(t,e+"stroke-miter-limit",i),u=new ds;return function(t){if(r){const e=r(t);if("none"===e)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),u}}function no(t,e,i){if(!(e in t))return;const n=Zs(t[e],Ss,i);return function(t){return _o(n(t),e)}}function ro(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Es,i);return function(t){return yo(n(t),e)}}function so(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Cs,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function oo(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Ts|Es,i);return function(t){return xo(n(t),e)}}function ao(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Rs,i);return function(t){return mo(n(t),e)}}function lo(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Rs,i);return function(t){const i=mo(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function ho(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Rs,i);return function(t){return vo(n(t),e)}}function uo(t,e,i){if(!(e in t))return null;const n=Zs(t[e],Rs|Ss,i);return function(t){return function(t,e){if("number"==typeof t)return t;return vo(t,e)}(n(t),e)}}function co(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function po(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function go(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function fo(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function mo(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function yo(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function _o(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function xo(t,e){if("string"==typeof t)return t;const i=mo(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function vo(t,e){const i=mo(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const wo="renderOrder";class bo extends Zn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=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(wo)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new Jn(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(wo,t)}setStyle(t){this.style_=function(t){if(void 0===t)return fs;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ys)return t;if(!Array.isArray(t))return Qs([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof ys){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof ys))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Js(i)}const n=t;return Qs(n)}(t),this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(At("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(this.style_),this.changed()}}class Co extends i{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){k()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Yi(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Zi(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=ni(t.slice(),c),p=[[0,0]];if(c.canWrapX()&&n){const t=Ke(c.getExtent());p.push([-t,0],[t,0])}const g=e.layerStatesArray,f=g.length,m=[],y=[];for(let n=0;n<p.length;n++)for(let r=f-1;r>=0;--r){const s=g[r],c=s.layer;if(c.hasRenderer()&&Yn(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);y[0]=a[0]+p[n][0],y[1]=a[1]+p[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*_)),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,l,this,r,s)}getMap(){return this.map_}renderFrame(t){k()}scheduleExpireIconCache(t){Gr.canExpireCache()&&t.postRenderFunctions.push(So)}}function So(t,e){Gr.expire()}class Eo extends t{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}class To extends Co{constructor(t){super(t),this.fontChangeListenerKey_=T(Qr,e,t.redrawText.bind(t)),this.element_=document.createElement("div");const i=this.element_.style;i.position="absolute",i.width="100%",i.height="100%",i.zIndex="0",this.element_.className=ot+" ol-layers";const n=t.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Eo(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){I(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(Zt,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex}));e.some((t=>t.layer instanceof bo&&t.layer.getDeclutter()))&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!Yn(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),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(Ut,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}class Ro extends t{constructor(t,e){super(t),this.layer=e}}const Io="layers";class Mo extends Bt{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(Io,this.handleLayersChanged_),i?Array.isArray(i)?i=new Ct(i.slice(),{unique:!0}):At("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Ct(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(I),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(T(t,xt,this.handleLayersAdd_,this),T(t,vt,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(I);p(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new Ro("addlayer",i))}this.changed()}registerLayerListeners_(t){const i=[T(t,e,this.handleLayerChange_,this),T(t,m,this.handleLayerChange_,this)];t instanceof Mo&&i.push(T(t,"addlayer",this.handleLayerGroupAdd_,this),T(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[P(t)]=i}handleLayerGroupAdd_(t){this.dispatchEvent(new Ro("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ro("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ro("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=P(e);this.listenerKeys_[i].forEach(I),delete this.listenerKeys_[i],this.dispatchEvent(new Ro("removelayer",e)),this.changed()}getLayers(){return this.get(Io)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new Ro("removelayer",t[e]))}this.set(Io,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach((function(e){e.getLayersArray(t)})),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));const n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Ze(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}class ko extends t{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Fo extends ko{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var Po={SINGLECLICK:"singleclick",CLICK:x,DBLCLICK:v,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Lo="pointermove",Ao="pointerdown";class Do extends f{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=T(i,Ao,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=T(i,Lo,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(S,this.boundHandleTouchMove_,!!Z&&{passive:!1})}emulateClick_(t){let e=new Fo(Po.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Fo(Po.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Fo(Po.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Po.POINTERUP||e.type==Po.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!=Po.POINTERDOWN&&e.type!=Po.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Fo(Po.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(I),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 Fo(Po.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(T(t,Po.POINTERMOVE,this.handlePointerMove_,this),T(t,Po.POINTERUP,this.handlePointerUp_,this),T(this.element_,Po.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(T(this.element_.getRootNode(),Po.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Fo(Po.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 Fo(Po.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_&&(I(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(S,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(I(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(I),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Oo=1/0;class zo{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,p(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){At(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Oo&&(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<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){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;o<r;++o)s=e[o],a=t(s),a==Oo?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}}var jo={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Go extends zo{constructor(t,e){super((function(e){return t.apply(null,e)}),(function(t){return t[0].getKey()})),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(m,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===jo.LOADED||i===jo.ERROR||i===jo.EMPTY){i!==jo.ERROR&&e.removeEventListener(m,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i,n,r,s=0;for(;this.tilesLoading_<t&&s<e&&this.getCount()>0;)n=this.dequeue()[0],r=n.getKey(),i=n.getState(),i!==jo.IDLE||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}}var No=class extends tt{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(x,this.handleClick_.bind(this),!1);const l=e+" "+ot+" "+lt+(this.collapsed_&&this.collapsible_?" "+ht:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap((e=>e.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map((t=>d((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!a(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(ht),this.collapsed_?J(this.collapseLabel_,this.label_):J(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}};var qo=class extends tt{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(x,this.handleClick_.bind(this),!1);const o=e+" "+ot+" "+lt,a=this.element;a.className=o,a.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(st)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:zi}):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(st);t||0!==i?t&&0!==i&&this.element.classList.remove(st):this.element.classList.add(st)}this.label_.style.transform=t}this.rotation_=i}};var Wo=class extends tt{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(x,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(x,this.handleClick_.bind(this,-i),!1);const c=e+" "+ot+" "+lt,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:zi})):e.setZoom(n)}}};var Xo="active";class Bo extends A{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(Xo)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Xo,t)}setMap(t){this.map_=t}}function Vo(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:zi})}var Yo=class extends Bo{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==Po.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;Vo(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};class Zo extends Bo{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Po.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Po.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Po.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Po.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 Uo(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}function $o(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),i);++n);return i}}const Ko=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ho=function(t){return!t.map.getTargetElement().hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=t.map.getOwnerDocument().activeElement;return e.contains(i)}(t)},Jo=l,Qo=function(t){const e=t.originalEvent;return 0==e.button&&!(W&&X&&e.ctrlKey)},ta=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},ea=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ia=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},na=function(t){const e=t.originalEvent;return At(void 0!==e,"mapBrowserEvent must originate from a pointer event"),"mouse"==e.pointerType},ra=function(t){const e=t.originalEvent;return At(void 0!==e,"mapBrowserEvent must originate from a pointer event"),e.isPrimary&&0===e.button};var sa=class extends Zo{constructor(t){super({stopDown:h}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:$o(ta,ra);this.condition_=t.onFocusOnly?$o(Ho,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Uo(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();!function(t,e){t[0]*=e,t[1]*=e}(e,i.getResolution()),ii(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:zi})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const 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}};class oa extends Zo{constructor(t){t=t||{},super({stopDown:h}),this.condition_=t.condition?t.condition:Ko,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===Ai)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(Qo(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class aa extends i{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 Nn([i])}getGeometry(){return this.geometry_}}const la="boxstart",ha="boxdrag",ua="boxend",ca="boxcancel";class da extends t{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class pa extends Zo{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:Qo,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 ga=class extends pa{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:zi})}},fa="ArrowLeft",ma="ArrowUp",ya="ArrowRight",_a="ArrowDown";class xa extends Bo{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==w){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==_a||n==fa||n==ya||n==ma)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==_a?a=-s:n==fa?o=-s:n==ya?o=s:a=s;const l=[o,a];ii(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:Gi,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}var va=class extends Bo{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return X?e.metaKey:e.ctrlKey}(t)&&ia(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==w||t.type==b){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;Vo(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}};class wa{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],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 ba=class extends Bo{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:Jo;this.condition_=t.onFocusOnly?$o(Ho,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!==E)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==E&&(n=i.deltaY,q&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=B),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=-Dt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Vo(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)}};class Ca extends Zo{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=h),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!==Ai&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Uo(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 Sa=class extends Zo{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=h),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(Uo(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 instanceof Zn?t.setMapInternal(null):t instanceof Mo&&t.getLayers().forEach(Ea)}function Ta(t,e){if(t instanceof Zn)t.setMapInternal(e);else if(t instanceof Mo){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Ta(i[t],e)}}var Ra=class extends A{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Mo({layers:t.layers});let r,s,o;i[et]=n,i[nt]=t.target,i[rt]=t.view instanceof Wn?t.view:new Wn,void 0!==t.controls&&(Array.isArray(t.controls)?r=new Ct(t.controls.slice()):(At("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new Ct(t.interactions.slice()):(At("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new Ct(t.overlays.slice()):(At("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Ct;return{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:B,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver((()=>this.updateSize())),this.controls=e.controls||function(t){t=t||{};const e=new Ct;return(void 0===t.zoom||t.zoom)&&e.push(new Wo(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new qo(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new No(t.attributionOptions)),e}(),this.interactions=e.interactions||function(t){t=t||{};const e=new Ct,i=new wa(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new oa),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Yo({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 Ca),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Sa({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new xa),e.push(new va({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new ba({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new ga({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Go(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(et,this.handleLayerGroupChanged_),this.addChangeListener(rt,this.handleViewChanged_),this.addChangeListener(it,this.handleSizeChanged_),this.addChangeListener(nt,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof Wn||t.view.then((function(t){i.setView(new Wn(t))})),this.controls.addEventListener(xt,(t=>{t.element.setMap(this)})),this.controls.addEventListener(vt,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(xt,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(vt,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(xt,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(vt,(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){Ta(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:l,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 Mo?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:l,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(nt)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return bi(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Bi(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(et)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ct)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<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Ci(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Bi(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(it)}getView(){return this.get(rt)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return Oo;if(!t.wantedTiles[i][e.getKey()])return Oo;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Fo(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Ao||i===E||i===w){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target;if(this.overlayContainerStopEvent_.contains(n)||!(i===t?t.documentElement:i).contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=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[Kt]||e[Ht]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(!0===this.renderComplete_?(this.hasListener($t)&&this.renderer_.dispatchRenderEvent($t,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new ko(G,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new ko(j,this,t))));const i=this.postRenderFunctions_;for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)I(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(_,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(E,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,Q(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new To(this)),this.mapBrowserEventHandler_=new Do(this,this.moveTolerance_);for(const t in Po)this.mapBrowserEventHandler_.addEventListener(Po[t],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(_,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(E,this.boundHandleBrowserEvent_,!!Z&&{passive:!1});const t=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[T(t,w,this.handleBrowserEvent,this),T(t,b,this.handleBrowserEvent,this)];const i=e.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.observe(i.host),this.resizeObserver_.observe(e)}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(I(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(I(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=T(t,e,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=T(t,m,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(I),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ro("addlayer",t)),this.layerGroupPropertyListenerKeys_=[T(t,e,this.render,this),T(t,m,this.render,this),T(t,"addlayer",this.handleLayerAdd_,this),T(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Ea(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&pr(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Be(s.center,s.resolution,s.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:n,wantedTiles:{},mapId:P(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=Be(s.nextCenter,s.nextResolution,t,e)}}if(this.frameState_=r,this.renderer_.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n){(!this.previousExtent_||!Je(this.previousExtent_)&&!Le(r.extent,this.previousExtent_))&&(this.dispatchEvent(new ko(O,this,n)),this.previousExtent_=ke(this.previousExtent_))}this.previousExtent_&&!r.viewHints[Kt]&&!r.viewHints[Ht]&&!Le(r.extent,this.previousExtent_)&&(this.dispatchEvent(new ko(z,this,r)),be(r.extent,this.previousExtent_))}this.dispatchEvent(new ko(D,this,r)),this.renderComplete_=this.hasListener(j)||this.hasListener(G)||this.hasListener($t)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout((()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ro("removelayer",e)),this.set(et,t)}setSize(t){this.set(it,t)}setTarget(t){this.set(nt,t)}setView(t){if(!t||t instanceof Wn)return void this.set(rt,t);this.set(rt,new Wn);const e=this;t.then((function(t){e.setView(new Wn(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],!pr(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&oi("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&a(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};class Ia extends A{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 Ia(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_&&(I(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=T(t,m,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{At("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");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_()}}class Ma extends Qi{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(I),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(T(t[e],m,this.changed,this))}clone(){const t=new Ma(ka(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ce(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){ke(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)Ae(t,e[i].getExtent());return t}getGeometries(){return ka(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}if(n){return new Ma(e)}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=We(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(ka(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function ka(t){return t.map((t=>t.clone()))}var Fa=Ma;function Pa(t,e,i,r,s,o,a){let l,h;const u=(i-e)/r;if(1===u)l=e;else if(2===u)l=e,h=s;else if(0!==u){let o=t[e],a=t[e+1],u=0;const c=[0];for(let n=e+r;n<i;n+=r){const e=t[n],i=t[n+1];u+=Math.sqrt((e-o)*(e-o)+(i-a)*(i-a)),c.push(u),o=e,a=i}const d=s*u,p=function(t,e,i){let r,s;i=i||n;let o=0,a=t.length,l=!1;for(;o<a;)r=o+(a-o>>1),s=+i(t[r],e),s<0?o=r+1:(a=r,l=!s);return l?o:~o}(c,d);p<0?(h=(d-c[-p-2])/(c[-p-1]-c[-p-2]),l=e+(-p-2)*r):l=e+p*r}a=a>1?a:2,o=o||new Array(a);for(let e=0;e<a;++e)o[e]=void 0===l?NaN:void 0===h?t[l+e]:Nt(t[l+e],t[l+r+e],h);return o}function La(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const u=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(Nt(t[(a-1)*n+e],t[a*n+e],u));return o.push(r),o}function Aa(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}class Da extends tn{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){o(this.flatCoordinates,t),this.changed()}clone(){const t=new Da(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ce(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,La(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return yn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Pa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Aa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Da(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return kn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}class Oa extends tn{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t){o(i,e[t].getFlatCoordinates()),n.push(i.length)}const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){o(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Oa(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ce(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(on(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,r,s,o){if(o)return La(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return La(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return _n(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Da(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new Da(t.slice(r,o),i);n.push(a),r=o}return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,a=n.length;s<a;++s){const a=n[s];o(t,Pa(e,i,a,r,.5)),i=a}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=pn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Oa(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(kn(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=un(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}class za extends tn{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){o(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new za(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ce(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=zt(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return yn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Cn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new Cn(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i){if(Te(t,e[n],e[n+1]))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}function ja(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Pe(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}class Ga extends tn{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,a=e.getEnds();for(let t=0,e=a.length;t<e;++t)a[t]+=i;o(r,e.getFlatCoordinates()),s.push(a)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;o(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Ga(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Ce(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=on(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=ln(t,e,d,n,r,s,o,a,l,h,u),e=d[d.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Tn(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=wn(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),jn(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,xn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=ja(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=In(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new za(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;On(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=jn(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],u=[];o=mn(t,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Ga(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new Nn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new Nn(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(Pn(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=cn(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Na=[1,0,0,1,0,0];class qa{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Fe(this.flatCoordinates_):Pe(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=We(this.getExtent());this.flatInteriorPoints_=Rn(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Gn(this.flatCoordinates_,this.ends_),e=ja(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=In(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Pa(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=Pa(t,e,r,2,.5);o(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=di(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Ye(i)/Ye(e);Yi(Na,i[0],i[3],t,-t,0,0,0),Ki(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Na,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new qa(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=c(((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=dn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=pn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=mn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new qa(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}qa.prototype.getFlatCoordinates=qa.prototype.getOrientedFlatCoordinates;class Wa{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Xa(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Wa(t,e,i,n)}function Ba(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Va(t,e,i){return t+"/"+e+"/"+i}function Ya(t){return Va(t[0],t[1],t[2])}function Za(t){return t.split("/").map(Number)}const Ua=[0,0,0];var $a=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,At(function(t,e,i){const r=e||n;return t.every((function(e,n){if(0===n)return!0;const s=r(t[n-1],e);return!(s>0||i&&0===s)}))}(this.resolutions_,((t,e)=>e-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,At(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=Ue(i)),At(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,At(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:te,At(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map(((t,e)=>{const n=new Wa(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Xa(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){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return Xa(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return Xa(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);if(e<n)return Xa(o,o,a,a,i);return Xa(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Ua);const n=Ua[1],r=Ua[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ua);return Xa(n,Ua[1],r,Ua[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=gr(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=gr(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Me(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=gr(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],u=o*(a[1]-e)/i/l[1];return n?(h=Xt(h,5)-1,u=Xt(u,5)-1):(h=Wt(h,5),u=Wt(u,5)),Ba(s,h,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=gr(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Xt(l,5)-1,h=Xt(h,5)-1):(l=Wt(l,5),h=Wt(h,5)),Ba(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return Dt(r(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Fn(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};const Ka=0,Ha=1,Ja=2,Qa=3,tl=4,el=5,il=6,nl=7,rl=8,sl=9,ol=10,al=11,ll=12,hl=[rl],ul=[ll],cl=[Ha],dl=[Qa];class pl{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class gl extends pl{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Se(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],u=t[e+1];const c=this.tmpCoordinate_;let d,p,g,f=!0;for(d=e+n;d<i;d+=n)c[0]=t[d],c[1]=t[d+1],g=Re(l,c),g!==p?(f&&(o[a++]=h,o[a++]=u,f=!1),o[a++]=c[0],o[a++]=c[1]):g===xe.INTERSECTING?(o[a++]=c[0],o[a++]=c[1],f=!1):f=!0,h=c[0],u=c[1],p=g;return(r&&f||d===e+n)&&(o[a++]=h,o[a++]=u),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,u,c,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),c.push(i)}this.instructions.push([tl,a,c,t,i,xn,r]),this.hitDetectionInstructions.push([tl,a,c,t,n||i,xn,r]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([tl,a,u,t,i,_n,r]),this.hitDetectionInstructions.push([tl,a,u,t,n||i,_n,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([tl,a,h,t,i,yn,r]),this.hitDetectionInstructions.push([tl,a,h,t,n||i,yn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([tl,a,h,t,i,yn,r]),this.hitDetectionInstructions.push([tl,a,h,t,n||i,yn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([tl,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([tl,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Ka,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ka,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,o=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==nl?o=e:r==Ka&&(n[2]=e,s(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const e=t.getColor();i.fillPatternScale=e&&"object"==typeof e&&"src"in e?this.pixelRatio:1,i.fillStyle=Xr(e||Vr)}else i.fillStyle=void 0;if(e){const t=e.getColor();i.strokeStyle=Xr(t||$r);const n=e.getLineCap();i.lineCap=void 0!==n?n:Yr;const r=e.getLineDash();i.lineDash=r?r.slice():Zr;const s=e.getLineDashOffset();i.lineDashOffset=s||0;const o=e.getLineJoin();i.lineJoin=void 0!==o?o:Ur;const a=e.getWidth();i.lineWidth=void 0!==a?a:1;const l=e.getMiterLimit();i.miterLimit=void 0!==l?l:10,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[ol,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[al,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,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!a(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[nl,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=be(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;we(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var fl=class extends gl{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,i){if(!this.image_||this.maxExtent&&!Se(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([il,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([il,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Se(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([il,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([il,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};var ml=class extends gl{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=[sl,r,s];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([al,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Zr,0],cl);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ul),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([al,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Zr,0],cl);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinates_(a,h,o[t],l);this.hitDetectionInstructions.push(ul),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ul),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ul),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(cl)}};var yl=class extends gl{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const r=this.state,s=void 0!==r.fillStyle,o=void 0!==r.strokeStyle,a=i.length;this.instructions.push(cl),this.hitDetectionInstructions.push(cl);for(let r=0;r<a;++r){const s=i[r],a=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,s,n,!0,!o),h=[sl,a,l];this.instructions.push(h),this.hitDetectionInstructions.push(h),o&&(this.instructions.push(dl),this.hitDetectionInstructions.push(dl)),e=s}return s&&(this.instructions.push(hl),this.hitDetectionInstructions.push(hl)),o&&(this.instructions.push(ul),this.hitDetectionInstructions.push(ul)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle;if(void 0===r&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([ol,Vr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([al,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Zr,0]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[Ja,l];this.instructions.push(cl,h),this.hitDetectionInstructions.push(cl,h),void 0!==n.fillStyle&&(this.instructions.push(hl),this.hitDetectionInstructions.push(hl)),void 0!==n.strokeStyle&&(this.instructions.push(ul),this.hitDetectionInstructions.push(ul)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle;if(void 0===r&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([ol,Vr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([al,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Zr,0]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle;if(void 0===r&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([ol,Vr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([al,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Zr,0]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinatess_(a,h,o[t],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=gn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}};function _l(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],u=e[o+r+1],c=Math.sqrt((h-i)*(h-i)+(u-n)*(u-n));if(a+=c,a>=t){const e=(t-a+c)/c,d=Nt(i,h,e),p=Nt(n,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=c-a,e=Nt(i,h,t/c),d=Nt(n,u,t/c);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function xl(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,g,f=i,m=i,y=0,_=0,x=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(p=i-h,g=n-u,l=Math.sqrt(p*p+g*g),void 0!==c&&(_+=a,s=Math.acos((c*p+d*g)/(a*l)),s>t&&(_>y&&(y=_,f=x,m=o),_=0,x=o-r)),a=l,c=p,d=g),h=i,u=n}return _+=l,_>y?[x,o]:[f,m]}const vl={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const wl={Circle:yl,Default:gl,Image:fl,LineString:ml,Polygon:yl,Text:class extends gl{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Vr]={fillStyle:Vr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,u=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;u=2}const r=this.appendFlatPointCoordinates(h,u);if(r===a)return;if(n&&(r-a)/2!=h.length/u){let t=a/2;n=n.filter(((e,i)=>{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e,i);let c=s.padding;if(c!=Jr&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const d=this.pixelRatio;this.instructions.push([il,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,c==Jr?Jr:c.map((function(t){return t*d})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/d,g=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=Vr,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([il,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,c,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Vr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),s.backgroundFill&&(this.state.fillStyle=g,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!He(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,c=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?_l(r*this.resolution,h,d,n[t],u):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==c){const t=xl(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=u)o.push(r[t],r[t+1]);const p=o.length;d=n[t],this.drawChars_(a,p),a=p}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Kr,justify:e.justify,textBaseline:e.textBaseline||Hr,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=vl[n.textBaseline],h=this.textOffsetY_*a,u=this.text_,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([el,t,e,l,n.overflow,o,n.maxAngle,a,h,r,c*a,u,s,1,this.declutterMode_]),this.hitDetectionInstructions.push([el,t,e,l,n.overflow,o?Vr:o,n.maxAngle,a,h,r,c*a,u,s,1/a,this.declutterMode_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Xr(e.getColor()||Vr)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||Yr,r.lineDash=t?t.slice():Zr,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||Ur,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=Xr(s.getColor()||$r)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||Br;ns(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Hr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Jr,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),u=t.getRotateWithView(),c=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textRotation_=void 0===c?0:c,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:P(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+P(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}};class bl{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(void 0===r){r=new(0,wl[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}class Cl extends M{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return k()}getData(t){return null}prepareFrame(t){return k()}renderFrame(t,e){return k()}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){const e=t.target;e.getState()!==dr.LOADED&&e.getState()!==dr.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=dr.LOADED&&e!=dr.ERROR&&t.addEventListener(m,this.boundHandleImageChange_),e==dr.IDLE&&(t.load(),e=t.getState()),e==dr.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}class Sl{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(CanvasRenderingContext2D.prototype,{get:(t,e)=>{if("function"==typeof K()[e])return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e),this.pushMethodArgs_},set:(t,e,i)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(e,i),!0)})}pushMethodArgs_=(...t)=>(this.instructions_[this.zIndex+this.offset_].push(t),this);getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i<n;i+=2){const n=e[i],r=e[i+1];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}}))}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const El=[];let Tl=null;class Rl extends Cl{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.deferredContext_=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;Tl||(Tl=U(1,1,void 0,{willReadFrequently:!0})),Tl.clearRect(0,0,1,1);try{Tl.drawImage(t,e,i,1,1,0,0,1,1),n=Tl.getImageData(0,0,1,1).data}catch(t){return Tl=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&&a(Lr(t.style.backgroundColor),Lr(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&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=U();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=Ue(i),r=$e(i),s=qe(i),o=Ne(i);Bi(e.coordinateToPixelTransform,n),Bi(e.coordinateToPixelTransform,r),Bi(e.coordinateToPixelTransform,s),Bi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Bi(a,n),Bi(a,r),Bi(a,s),Bi(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 Eo(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Vt,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Yt,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Sl),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Vt,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Yt,this.context,t))}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 Yi(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Il(t,e,i,n,r,s,o,a,l,h,u,c){let d=t[e],p=t[e+1],g=0,f=0,m=0,y=0;function _(){g=d,f=p,d=t[e+=n],p=t[e+1],y+=m,m=Math.sqrt((d-g)*(d-g)+(p-f)*(p-f))}do{_()}while(e<i-n&&y+m<s);let x=0===m?0:(s-y)/m;const v=Nt(g,d,x),w=Nt(f,p,x),b=e-n,C=y,S=s+a*l(h,r,u);for(;e<i-n&&y+m<S;)_();x=0===m?0:(S-y)/m;const E=Nt(g,d,x),T=Nt(f,p,x);let R;if(c){const t=[v,w,E,T];Hi(t,0,4,2,c,t,t),R=t[0]>t[2]}else R=v>E;const I=Math.PI,M=[],k=b+n===e;let F;if(m=0,y=C,d=t[e=b],p=t[e+1],k){_(),F=Math.atan2(p-f,d-g),R&&(F+=F>0?-I:I);const t=(E+v)/2,e=(T+w)/2;return M[0]=[t,e,(S-s)/2,F,r],M}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t<c;){_();let v=Math.atan2(p-f,d-g);if(R&&(v+=v>0?-I:I),void 0!==F){let t=v-F;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}F=v;const w=t;let b=0;for(;t<c;++t){const o=a*l(h,r[R?c-t-1:t],u);if(e+n<i&&y+m<s+b+o/2)break;b+=o}if(t===w)continue;const C=R?r.substring(c-w,c-t):r.substring(w,t);x=0===m?0:(s+b/2-y)/m;const S=Nt(g,d,x),E=Nt(f,p,x);M.push([S,E,b/2,v,C]),s+=b}return M}const Ml=[1/0,1/0,-1/0,-1/0],kl=[],Fl=[],Pl=[],Ll=[];function Al(t){return t[3].declutterBox}const Dl=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Ol(t,e){return"start"===e?e=Dl.test(t)?"right":"left":"end"===e&&(e=Dl.test(t)?"left":"right"),vl[e]}function zl(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}class jl{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,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_={},this.zIndexContext_=r?new Sl:null}getZIndexContext(){return this.zIndexContext_}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?vl[a.justify]:Ol(Array.isArray(t)?t[0]:t,a.textAlign||Kr),d=n&&s.lineWidth?s.lineWidth:0,p=u?t:t.split("\n").reduce(zl,[]),{width:g,height:f,widths:m,heights:y,lineWidths:_}=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,p=os(d,c);i.push(p),o+=p;const g=rs(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,p),x=g+d,v=[],w=(x+2)*h[0],b=(f+d)*h[1],C={width:w<0?Math.floor(w):Math.ceil(w),height:b<0?Math.floor(b):Math.ceil(b),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",d),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-c;let E=c*x+S*d;const T=[],R=[];let I,M=0,k=0,F=0,P=0;for(let t=0,e=p.length;t<e;t+=2){const e=p[t];if("\n"===e){k+=M,M=0,E=c*x+S*d,++P;continue}const r=p[t+1]||a.font;r!==I&&(n&&T.push("font",r),i&&R.push("font",r),I=r),M=Math.max(M,y[F]);const s=[e,E+S*m[F]+c*(m[F]-_[P]),.5*(d+M)+k];E+=m[F],n&&T.push("strokeText",s),i&&R.push("fillText",s),++F}return Array.prototype.push.apply(v,T),Array.prototype.push.apply(v,R),this.labels_[r]=C,C}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,u,c,d,p,g,f){let m=i-(o*=c[0]),y=n-(a*=c[1]);const _=r+l>t?t-l:r,x=s+h>e?e-h:s,v=p[3]+_*c[0]+p[1],w=p[0]+x*c[1]+p[2],b=m-p[3],C=y-p[0];let S;return(g||0!==u)&&(kl[0]=b,Ll[0]=b,kl[1]=C,Fl[1]=C,Fl[0]=b+v,Pl[0]=Fl[0],Pl[1]=C+w,Ll[1]=Pl[1]),0!==u?(S=Yi([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Bi(S,kl),Bi(S,Fl),Bi(S,Pl),Bi(S,Ll),Me(Math.min(kl[0],Fl[0],Pl[0],Ll[0]),Math.min(kl[1],Fl[1],Pl[1],Ll[1]),Math.max(kl[0],Fl[0],Pl[0],Ll[0]),Math.max(kl[1],Fl[1],Pl[1],Ll[1]),Ml)):Me(Math.min(b,b+v),Math.min(C,C+w),Math.max(b,b+v),Math.max(C,C+w),Ml),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Ml[0],minY:Ml[1],maxX:Ml[2],maxY:Ml[3],value:f},canvasTransform:S,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,kl,Fl,Pl,Ll,s,o),ls(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Bi(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&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=Ol(Array.isArray(t)?t[0]:t,r.textAlign||Kr),h=vl[r.textBaseline||Hr],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,l){const h=this.zIndexContext_;let u;var c,d;this.pixelCoordinates_&&a(i,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ki(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,d=i,c[0]=d[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5]);let p=0;const g=n.length;let f,m,y,_,x,v,w,b,C,S,E,T,R,I=0,M=0,k=0,F=null,P=null;const L=this.coordinateCache_,A=this.viewRotation_,D=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},z=this.instructions!=n||this.overlaps?0:200;let j,G,N,q;for(;p<g;){const i=n[p];switch(i[0]){case Ka:j=i[1],q=i[3],j.getGeometry()?void 0===o||He(o,q.getExtent())?++p:p=i[2]+1:p=i[2],h&&(h.zIndex=i[4]);break;case Ha:M>z&&(this.fill_(t),M=0),k>z&&(t.stroke(),k=0),M||k||(t.beginPath(),x=NaN,v=NaN),++p;break;case Ja:I=i[1];const n=u[I],a=u[I+1],c=u[I+2]-n,d=u[I+3]-a,g=Math.sqrt(c*c+d*d);t.moveTo(n+g,a),t.arc(n,a,g,0,2*Math.PI,!0),++p;break;case Qa:t.closePath(),++p;break;case tl:I=i[1],f=i[2];const W=i[3],X=i[4],B=i[5];O.geometry=W,O.feature=j,p in L||(L[p]=[]);const V=L[p];B?B(u,I,f,2,V):(V[0]=u[I],V[1]=u[I+1],V.length=2),h&&(h.zIndex=i[6]),X(V,O),++p;break;case il:I=i[1],f=i[2],C=i[3],m=i[4],y=i[5];let Y=i[6];const Z=i[7],U=i[8],$=i[9],K=i[10];let H=i[11];const J=i[12];let Q=i[13];_=i[14]||"declutter";const tt=i[15];if(!C&&i.length>=20){S=i[19],E=i[20],T=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(S,E,T,R);C=t.label,i[3]=C;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const n=i[24];y=(t.anchorY-n)*this.pixelRatio,i[5]=y,Y=C.height,i[6]=Y,Q=C.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Jr,nt=!1,rt=!1),K&&D?H+=A:K||D||(H-=A);let st=0;for(;I<f;I+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(C.width,C.height,u[I],u[I+1],Q,Y,m,y,U,$,H,J,r,it,nt||rt,j),n=[t,e,C,i,Z,nt?F:null,rt?P:null];if(l){let t,e,r,s,o;if(tt){const i=f-I;if(!tt[i]){tt[i]={args:n,declutterMode:_};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=Al(t)}if(!t||"declutter"===e&&l.collides(r)||(s=!0),"declutter"===_&&l.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===_){const t=s&&o;s=t,o=t}s&&("none"!==e&&l.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==_&&l.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++p;break;case el:const ot=i[1],at=i[2],lt=i[3],ht=i[4];R=i[5];const ut=i[6],ct=i[7],dt=i[8];T=i[9];const pt=i[10];S=i[11],E=i[12];const gt=[i[13],i[13]];_=i[14]||"declutter";const ft=this.textStates[E],mt=ft.font,yt=[ft.scale[0]*ct,ft.scale[1]*ct];let _t;mt in this.widths_?_t=this.widths_[mt]:(_t={},this.widths_[mt]=_t);const xt=Aa(u,ot,at,2),vt=Math.abs(yt[0])*as(mt,S,_t);if(ht||vt<=xt){const i=Il(u,ot,at,2,S,(xt-vt)*Ol(S,this.textStates[E].textAlign),ut,Math.abs(yt[0]),as,mt,_t,D?0:this.viewRotation_);t:if(i){const n=[];let r,s,o,a,h;if(T)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],a=this.createLabel(o,E,"",T),m=h[2]+(yt[0]<0?-pt:pt),y=lt*a.height+2*(.5-lt)*pt*yt[1]/yt[0]-dt;const s=this.calculateImageOrLabelDimensions_(a.width,a.height,h[0],h[1],a.width,a.height,m,y,0,0,h[3],gt,!1,Jr,!1,j);if(l&&"declutter"===_&&l.collides(s.declutterBox))break t;n.push([t,e,a,s,1,null,null])}if(R)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],a=this.createLabel(o,E,R,""),m=h[2],y=lt*a.height-dt;const s=this.calculateImageOrLabelDimensions_(a.width,a.height,h[0],h[1],a.width,a.height,m,y,0,0,h[3],gt,!1,Jr,!1,j);if(l&&"declutter"===_&&l.collides(s.declutterBox))break t;n.push([t,e,a,s,1,null,null])}l&&"none"!==_&&l.load(n.map(Al));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++p;break;case nl:if(void 0!==s){j=i[1];const t=s(j,q);if(t)return t}++p;break;case rl:z?M++:this.fill_(t),++p;break;case sl:for(I=i[1],f=i[2],G=u[I],N=u[I+1],w=G+.5|0,b=N+.5|0,w===x&&b===v||(t.moveTo(G,N),x=w,v=b),I+=2;I<f;I+=2)G=u[I],N=u[I+1],w=G+.5|0,b=N+.5|0,I!=f-2&&w===x&&b===v||(t.lineTo(G,N),x=w,v=b);++p;break;case ol:F=i,this.alignAndScaleFill_=i[2],M&&(this.fill_(t),M=0,k&&(t.stroke(),k=0)),t.fillStyle=i[1],++p;break;case al:P=i,k&&(t.stroke(),k=0),this.setStrokeStyle_(t,i),++p;break;case ll:z?k++:t.stroke(),++p;break;default:++p}}M&&this.fill_(t),k&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}}const Gl=["Polygon","Circle","LineString","Image","Text","Default"],Nl=["Image","Text"],ql=Gl.filter((t=>!Nl.includes(t)));class Wl{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new jl(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,r,s,o){const a=2*(r=Math.round(r))+1,l=Yi(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=U(a,a,void 0,{willReadFrequently:!0}));const u=this.hitDetectionContext_;let c;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):h||u.clearRect(0,0,a,a),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],De(c,t),we(c,e*(this.renderBuffer_+r),c));const d=function(t){if(void 0!==Xl[t])return Xl[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)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;t<e;++t)n[t]&&r.push(...n[t]);return Xl[t]=r,r}(r);let p;function g(t,e){const i=u.getImageData(0,0,a,a).data;for(let n=0,l=d.length;n<l;n++)if(i[d[n]]>0){if(!o||"Image"!==p&&"Text"!==p||o.includes(t)){const i=(d[n]-3)/4,o=r-i%a,l=r-(i/a|0),h=s(t,e,o*o+l*l);if(h)return h}u.clearRect(0,0,a,a);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let m,y,_,x,v;for(f.sort(n),m=f.length-1;m>=0;--m){const t=f[m].toString();for(_=this.executorsByZIndex_[t],y=Gl.length-1;y>=0;--y)if(p=Gl[y],x=_[p],void 0!==x&&(v=x.executeHitDetection(u,l,i,g,c),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 Ki(o,0,8,2,t,o),o}isEmpty(){return g(this.executorsByZIndex_)}execute(t,e,i,r,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);let h,u,c,d,p,g;for(l.sort(n),o=o||Gl,a&&l.reverse(),h=0,u=l.length;h<u;++h){const n=l[h].toString();for(p=this.executorsByZIndex_[n],c=0,d=o.length;c<d;++c){const n=o[c];if(g=p[n],void 0!==g){const o=null===a?void 0:g.getZIndexContext(),u=o?o.getContext():t,c=this.maxExtent_&&"Image"!==n&&"Text"!==n;if(c&&(u.save(),this.clip(u,i)),g.execute(u,e,i,r,s,a),c&&u.restore(),o){o.offset();const t=l[h];this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(o)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(n);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach((t=>{t.draw(this.renderedContext_),t.clear()}))}}const Xl={};var Bl=class extends pl{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?qt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Ki(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Yi(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ki(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r){const s=this.context_,o=Ki(t,e,i,n,this.transform_,this.pixelCoordinates_);s.moveTo(o[0],o[1]);let a=o.length;r&&(a-=2);for(let t=2;t<a;t+=2)s.lineTo(o[t],o[t+1]);return r&&s.closePath(),i}drawRings_(t,e,i,n){for(let r=0,s=i.length;r<s;++r)e=this.moveToLineTo_(t,e,i[r],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),He(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Ki(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),He(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(He(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),He(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),He(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),a(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Kr;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Xr(e||Vr)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Zr;this.strokeState_={lineCap:void 0!==i?i:Yr,lineDash:1===this.pixelRatio_?l:l.map((t=>t*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Ur,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Xr(t||$r)}}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:Xr(t||Vr)}}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:Yr,lineDash:n||Zr,lineDashOffset:r||0,lineJoin:void 0!==s?s:Ur,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Xr(t||$r)}}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:Br,textAlign:void 0!==u?u:Kr,textBaseline:void 0!==c?c:Hr},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 Vl=.5;function Yl(t,e,i,r,s,o,a,l,h){const u=h?Si(s):s,c=U(t[0]*Vl,t[1]*Vl);c.imageSmoothingEnabled=!1;const d=c.canvas,p=new Bl(c,Vl,s,null,a,l,h?_i(wi,h):null),g=i.length,f=Math.floor(16777215/g),m={};for(let t=1;t<=g;++t){const e=i[t-1],n=e.getStyleFunction()||r;if(!n)continue;let s=n(e,o);if(!s)continue;Array.isArray(s)||(s=[s]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=s.length;t<i;++t){const i=s[t],n=i.getGeometryFunction()(e);if(!n||!He(u,n.getExtent()))continue;const r=i.clone(),o=r.getFill();o&&o.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const h=i.getImage();if(h){const t=h.getImageSize();if(!t)continue;const e=U(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new xs({img:i,anchor:h.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:h.getOrigin(),opacity:1,size:h.getSize(),scale:h.getScale(),rotation:h.getRotation(),rotateWithView:h.getRotateWithView()}))}const c=r.getZIndex()||0;let d=m[c];d||(d={},m[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const p=n.getType();if("GeometryCollection"===p){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[p.replace("Multi","")].push(n,r)}}const y=Object.keys(m).map(Number).sort(n);for(let t=0,i=y.length;t<i;++t){const i=m[y[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){p.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)p.setTransform(e[i]),p.drawGeometry(n[t])}}}return c.getImageData(0,0,d.width,d.height)}function Zl(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*Vl),s=Math.floor(Math.round(t[1])*Vl),o=4*(Dt(r,0,i.width-1)+Dt(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),u=Math.floor(16777215/e.length);h&&h%u==0&&n.push(e[h/u-1])}return n}const Ul=.5,$l={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=dr.LOADED)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=dr.LOADED)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,$l[o[a].getType()])(t,o[a],i,n,r,s)}},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}};function Kl(t,e){return parseInt(P(t),10)-parseInt(P(e),10)}function Hl(t,e){const i=Jl(t,e);return i*i}function Jl(t,e){return Ul*t/e}function Ql(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==dr.LOADED||e==dr.ERROR?t=!1:e==dr.IDLE&&h.load(),t&&l.push(h.ready())}const u=i.getFill();u&&u.loading()&&l.push(u.ready());const c=l.length>0;return c&&Promise.all(l).then((()=>r(null))),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)th(t,l,i,e,o);else{(0,$l[l.getType()])(t,l,i,e,o,s)}}(t,e,i,n,s,o,a),c}function th(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)th(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}class eh extends Rl{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,p=e.viewHints,g=!(p[Kt]||p[Ht]),f=this.context,m=Math.round(Ke(n)/o*d),y=Math.round(Ye(n)/o*d),_=u.getWrapX()&&a.canWrapX(),x=_?Ke(h):null,v=_?Math.ceil((n[2]-h[2])/x)+1:1;let w=_?Math.floor((n[0]-h[0])/x):0;do{const n=this.getRenderTransform(s,o,l,d,m,y,w*x);t.execute(f,[f.canvas.width,f.canvas.height],n,l,g,void 0===i?Gl:i?Nl:ql,i?c&&e.declutter[c]:void 0)}while(++w<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=U(this.context.canvas.width,this.context.canvas.height,El))}resetDrawContext_(){if(1!==this.opacity_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,H(this.context),El.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.resetDrawContext_())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];this.opacity_=n.opacity;const r=t.extent,s=t.viewState.resolution,o=Math.round(Ke(r)/s*i),a=Math.round(Ye(r)/s*i);Yi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/i,1/i,0,-o/2,-a/2),Zi(this.inversePixelTransform,this.pixelTransform);const l=$i(this.pixelTransform);this.useContainer(e,l,this.getBackground(t));const h=this.context,u=h.canvas,c=this.replayGroup_;let d=c&&!c.isEmpty();if(!d){if(!(this.getLayer().hasListener(Vt)||this.getLayer().hasListener(Yt)))return null}u.width!=o||u.height!=a?(u.width=o,u.height=a,u.style.transform!==l&&(u.style.transform=l)):this.containerReused||h.clearRect(0,0,o,a),this.setDrawContext_(),this.preRender(h,t);const p=t.viewState;p.projection;let g=!1;if(d&&n.extent&&this.clipping){const e=Ei(n.extent);d=He(e,t.extent),g=d&&!Ee(e,t.extent),g&&this.clipUnrotated(h,t,e)}return d&&this.renderWorlds(c,t,!this.getLayer().getDeclutter()&&void 0),g&&h.restore(),this.postRender(h,t),this.renderedRotation_!==p.rotation&&(this.renderedRotation_=p.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise((e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];Bi(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]*Vl,h=t[1]*Vl;a.push(this.getRenderTransform(e,i,n,Vl,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Ee(c,s)){let t=s[0];const r=Ke(c);let o,u=0;for(;t<c[0];)--u,o=r*u,a.push(this.getRenderTransform(e,i,n,Vl,l,h,o).slice()),t+=r;for(u=0,t=s[2];t>c[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,Vl,l,h,o).slice()),t-=r}this.hitDetectionImageData_=Yl(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Hl(i,this.renderedPixelRatio_),null)}e(Zl(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const s=P(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}};let u;const c=[this.replayGroup_],d=this.getLayer().getDeclutter();return c.some((n=>u=n.forEachFeatureAtCoordinate(t,s,o,i,h,d&&e.declutter[d]?e.declutter[d].all().map((t=>t.value)):null))),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Kt],r=t.viewHints[Ht],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,u=h.projection,c=h.resolution,d=t.pixelRatio,p=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=Kl);const m=h.center.slice(),y=we(l,g*c),_=y.slice(),x=[y.slice()],v=u.getExtent();if(i.getWrapX()&&u.canWrapX()&&!Ee(v,t.extent)){const t=Ke(v),e=Math.max(Ke(y)/2,t);y[0]=v[0]-e,y[2]=v[2]+e,ni(m,u);const i=ti(x[0],u);i[0]<v[0]&&i[2]<v[2]?x.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>v[0]&&i[2]>v[2]&&x.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==p&&this.renderedRenderOrder_==f&&Ee(this.wrappedRenderedExtent_,y))return a(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new bl(Jl(c,d),y,c,d);for(let t=0,e=x.length;t<e;++t)i.loadFeatures(x[t],c,u);const b=Hl(c,d);let C=!0;const S=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,c)),n){const e=this.renderFeature(t,b,n,w,undefined,this.getLayer().getDeclutter(),i);C=C&&!e}},E=Si(y),T=i.getFeaturesInExtent(E);f&&T.sort(f);for(let t=0,e=T.length;t<e;++t)S(T[t],t);this.renderedFeatures_=T,this.ready=C;const R=w.finish(),I=new Wl(y,c,d,i.getOverlaps(),R,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=p,this.renderedRenderOrder_=f,this.renderedExtent_=_,this.wrappedRenderedExtent_=y,this.renderedCenter_=m,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=I,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Ql(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Ql(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}}var ih=class extends bo{constructor(t){super(t)}createRenderer(){return new eh(this)}};class nh{constructor(t){this.rbush_=new Jn(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[P(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[P(s)]=o}this.rbush_.load(i)}remove(t){const e=P(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[P(e)];Le([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map((function(t){return t.value}))}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map((function(t){return t.value}))}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return g(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Me(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class rh extends A{constructor(t){super(),this.projection=di(t.projection),this.attributions_=sh(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_=sh(t),this.changed()}setState(t){this.state_=t,this.changed()}}function sh(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var oh="addfeature",ah="changefeature",lh="clear",hh="removefeature",uh="featuresloadstart",ch="featuresloadend",dh="featuresloaderror";function ph(t,e){return[[-1/0,-1/0,1/0,1/0]]}function gh(t,e){return[t]}let fh=!1;function mh(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=fh,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();let n;"json"==t?n=JSON.parse(a.responseText):"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 yh(t,e){return function(i,n,r,s,o){const a=this;mh(t,e,i,n,r,(function(t,e){a.addFeatures(t),void 0!==s&&s(t)}),o||u)}}class _h extends t{constructor(t,e,i){super(t),this.feature=e,this.features=i}}var xh=class extends rh{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_=u,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_&&(At(this.format_,"`format` must be set when `url` is set"),this.loader_=yh(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ph;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new nh:null,this.loadedExtentsRtree_=new nh,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 Ct(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=P(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 _h(oh,t))}setupChangeEvents_(t,i){i instanceof qa||(this.featureChangeKeys_[t]=[T(i,m,this.handleFeatureChange_,this),T(i,e,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof qa){const n=this.idIndex_[t];n instanceof qa?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(At(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=P(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=P(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(oh))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new _h(oh,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(oh,(function(i){e||(e=!0,t.push(i.feature),e=!1)})),this.addEventListener(hh,(function(i){e||(e=!0,t.remove(i.feature),e=!1)})),t.addEventListener(xt,(t=>{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(vt,(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(I)}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 _h(lh);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){const n=i.getGeometry();if(n instanceof qa||n.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){const n=i.getGeometry();if(n instanceof qa||n.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(),g(this.nullGeometryFeatures_)||o(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]]];ti(t,e);const n=Ke(i);if(Ke(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]<i[0])return[[t[0]+n,t[1],i[2],t[3]],[i[0],t[1],t[2],t[3]]];if(t[2]>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||l,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof qa?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}})),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=P(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new _h(ah,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:P(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&g(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];n.forEachInExtent(s,(function(t){return Ee(t.extent,s)}))||(++this.loadingExtentsCount_,this.dispatchEvent(new _h(uh)),this.loader_.call(this,s,e,i,(t=>{--this.loadingExtentsCount_,this.dispatchEvent(new _h(ch,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new _h(dh))})),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(Le(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeatures(t){const e=[];for(let i=0,n=t.length;i<n;++i){const n=t[i],r=this.removeFeatureInternal(n);r&&e.push(r)}e.length>0&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=P(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];if(!i)return;i.forEach(I),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.hasListener(hh)&&this.dispatchEvent(new _h(hh,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof qa&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){At(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(yh(t,this.format_))}};class vh extends Or{constructor(t,e,i,n,r){super(t,e,i,void 0!==r?dr.IDLE:dr.LOADED),this.loader_=void 0!==r?r:null,this.canvas_=n,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=dr.ERROR):this.state=dr.LOADED,this.changed()}load(){this.state==dr.IDLE&&(this.state=dr.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}class wh extends f{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(m)}release(){this.state===jo.ERROR&&this.setState(jo.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let t=this.interimTile;if(!t)return this;do{if(t.getState()==jo.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){let t=this.interimTile;if(!t)return;let e=this;do{if(t.getState()==jo.LOADED){t.interimTile=null;break}t.getState()==jo.LOADING?e=t:t.getState()==jo.IDLE?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==jo.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){k()}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:Oi(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class bh extends wh{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=jo.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=jo.ERROR,this.unlistenImage_(),this.image_=function(){const t=U(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=jo.LOADED:this.state=jo.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==jo.ERROR&&(this.state=jo.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==jo.IDLE&&(this.state=jo.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[R(n,C,(function(){o=!0,s||e()}))];return n.src&&Y?(s=!0,n.decode().then((function(){r&&e()})).catch((function(t){r&&(o?e():i())}))):a.push(R(n,y,i)),function(){r=!1,a.forEach(I)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}class Ch{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 At(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return At(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,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){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){At(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}class Sh extends Ch{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=Za(this.peekFirstKey())[0];this.forEach((e=>{e.tileCoord[0]!==t&&(this.remove(Ya(e.tileCoord)),e.release())}))}}const Eh=[];class Th extends wh{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=P(t);return e in this.context_||(this.context_[e]=U(1,1,Eh)),this.context_[e]}hasContext(t){return P(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=P(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];H(e),Eh.push(e.canvas),delete this.context_[t]}super.release()}}let Rh=class extends wh{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==jo.IDLE&&(this.setState(jo.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(jo.ERROR)}setFeatures(t){this.features_=t,this.setState(jo.LOADED)}setLoader(t){this.loader_=t}};function Ih(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);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()}))}}function Mh(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ih(t[r],e);return function(t){if(1===t.length)return t[0];return function(e,i,n){if(!e)return;const r=function(t){return(t[1]<<t[0])+t[2]}(e),s=Gt(r,t.length);return t[s](e,i,n)}}(n)}function kh(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}var Fh=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Ia,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?di(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=di(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return k()}readFeature(t,e){return k()}readFeatures(t,e){return k()}readGeometry(t,e){return k()}readProjection(t){return k()}writeFeature(t,e){return k()}writeFeatures(t,e){return k()}writeGeometry(t,e){return k()}};function Ph(t,e,i){const n=i?di(i.featureProjection):null,r=i?di(i.dataProjection):null;let s=t;if(n&&r&&!yi(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(xi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const Lh={Point:Cn,LineString:Da,Polygon:Nn,MultiPoint:za,MultiLineString:Oa,MultiPolygon:Ga};function Ah(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map((e=>Ah({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Ph(new qa(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(On(t,0,e,i)||jn(t=t.slice(),0,e,i),t):(Dn(t,0,e,i)||zn(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Dh(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>Dh(t,e)));return new Fa(i)}return Ph(new(0,Lh[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}class Oh extends Fh{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(zh(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(zh(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return k()}readFeaturesFromObject(t,e){return k()}readGeometry(t,e){return this.readGeometryFromObject(zh(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return k()}readProjection(t){return this.readProjectionFromObject(zh(t))}readProjectionFromObject(t){return k()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return k()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return k()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return k()}}function zh(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}function jh(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:en(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:en(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length,r=un(i,0,e,n);return{type:"Polygon",flatCoordinates:i,ends:r,layout:en(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:en(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[],r=un(n,0,e,i);return{type:"MultiLineString",flatCoordinates:n,ends:r,layout:en(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2,r=cn(i,0,e,n);return{type:"MultiPolygon",flatCoordinates:i,ends:r,layout:en(n)}}(t);break;case"GeometryCollection":i=function(t,e){const i=t.geometries.map((function(t){return jh(t)}));return i}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Gh(t,e){const i=(t=Ph(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t,e){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;e&&(i=e.rightHanded);return{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map((function(t){return Gh(t,e)}));return{type:"GeometryCollection",geometries:i}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}var Nh=class extends Oh{constructor(t){t=t||{},super(),this.dataProjection=di(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=di(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=jh(i.geometry);if(this.featureClass===qa)return Ah({geometry:n,id:i.id,properties:i.properties},e);const r=new Ia;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Dh(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){const i=jh(t);return Dh(i,e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=di(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=di("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=Gh(s,e),delete r[t.getGeometryName()]),g(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Gh(t,this.adaptOptions(e))}};class qh extends Zn{constructor(t){super(t=t||{})}}class Wh extends Rl{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,s=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=Ze(a,Ei(e.extent,n.projection))),!o[Kt]&&!o[Ht]&&!Je(a))if(s){const t=n.projection,e=s.getImage(a,r,i,t);e&&(this.loadImage(e)?this.image_=e:e.getState()===dr.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=Bi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Se(r,n))return null;const s=this.image_.getExtent(),o=this.image_.getImage(),a=Ke(s),l=Math.floor(o.width*((n[0]-s[0])/a));if(l<0||l>=o.width)return null;const h=Ye(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,o]=Array.isArray(r)?r:[r,r],a=i.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,u=t.viewState,c=u.center,d=u.resolution,p=h*s/(d*a),g=h*o/(d*a),f=t.extent,m=u.resolution,y=u.rotation,_=Math.round(Ke(f)/m*h),x=Math.round(Ye(f)/m*h);Yi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,y,-_/2,-x/2),Zi(this.inversePixelTransform,this.pixelTransform);const v=$i(this.pixelTransform);this.useContainer(e,v,this.getBackground(t));const w=this.getRenderContext(t),b=this.context.canvas;b.width!=_||b.height!=x?(b.width=_,b.height=x):this.containerReused||w.clearRect(0,0,_,x);let C=!1,S=!0;if(l.extent){const e=Ei(l.extent,u.projection);S=He(e,t.extent),C=S&&!Ee(e,t.extent),C&&this.clipUnrotated(w,t,e)}const E=i.getImage(),T=Yi(this.tempTransform,_/2,x/2,p,g,0,a*(n[0]-c[0])/s,a*(c[1]-n[3])/o);this.renderedResolution=o*h/a;const R=E.width*T[0],I=E.height*T[3];if(this.getLayer().getSource().getInterpolate()||(w.imageSmoothingEnabled=!1),this.preRender(w,t),S&&R>=.5&&I>=.5){const t=T[4],e=T[5],i=l.opacity;1!==i&&(w.save(),w.globalAlpha=i),w.drawImage(E,0,0,+E.width,+E.height,t,e,R,I),1!==i&&w.restore()}return this.postRender(this.context,t),C&&w.restore(),w.imageSmoothingEnabled=!0,v!==b.style.transform&&(b.style.transform=v),this.container}}var Xh=class extends qh{constructor(t){super(t)}createRenderer(){return new Wh(this)}getData(t){return super.getData(t)}},Bh={
|
||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||
read:function(t,e,i,n,r){var s,o,a=8*r-n-1,l=(1<<a)-1,h=l>>1,u=-7,c=i?r-1:0,d=i?-1:1,p=t[e+c];for(c+=d,s=p&(1<<-u)-1,p>>=-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*(p?-1:1);o+=Math.pow(2,n),s-=h}return(p?-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<<h)-1,c=u>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,g=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+p]=255&a,p+=g,a/=256,r-=8);for(o=o<<r|a,h+=r;h>0;t[i+p]=255&o,p+=g,o/=256,h-=8);t[i+p-g]|=128*f}},Vh=Zh,Yh=Bh;function Zh(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zh.Varint=0,Zh.Fixed64=1,Zh.Bytes=2,Zh.Fixed32=5;var Uh=4294967296,$h=1/Uh,Kh="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Hh(t){return t.type===Zh.Bytes?t.readVarint()+t.pos:t.pos+1}function Jh(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qh(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 tu(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function eu(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function iu(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function nu(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function ru(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function su(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function ou(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function au(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function lu(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function hu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function uu(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function cu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Zh.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>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=hu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=cu(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hu(this.buf,this.pos)+hu(this.buf,this.pos+4)*Uh;return this.pos+=8,t},readSFixed64:function(){var t=hu(this.buf,this.pos)+cu(this.buf,this.pos+4)*Uh;return this.pos+=8,t},readFloat:function(){var t=Yh.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Yh.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 Jh(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return Jh(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return Jh(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return Jh(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return Jh(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return Jh(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&&Kh?function(t,e,i){return Kh.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r<i;){var s,o,a,l=t[r],h=null,u=l>239?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!==Zh.Bytes)return t.push(this.readVarint(e));var i=Hh(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Zh.Bytes)return t.push(this.readSVarint());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Zh.Bytes)return t.push(this.readBoolean());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Zh.Bytes)return t.push(this.readFloat());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Zh.Bytes)return t.push(this.readDouble());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Zh.Bytes)return t.push(this.readFixed32());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Zh.Bytes)return t.push(this.readSFixed32());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Zh.Bytes)return t.push(this.readFixed64());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Zh.Bytes)return t.push(this.readSFixed64());var e=Hh(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Zh.Varint)for(;this.buf[this.pos++]>127;);else if(e===Zh.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zh.Fixed32)this.pos+=4;else{if(e!==Zh.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;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),uu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),uu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),uu(this.buf,-1&t,this.pos),uu(this.buf,Math.floor(t*$h),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),uu(this.buf,-1&t,this.pos),uu(this.buf,Math.floor(t*$h),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||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;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&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&&Qh(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Yh.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Yh.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<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Qh(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Zh.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tu,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,eu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,ru,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,lu,e)},writeBytesField:function(t,e){this.writeTag(t,Zh.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zh.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zh.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zh.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zh.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zh.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zh.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zh.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zh.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zh.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var du=br(Vh);class pu extends Fh{constructor(t){super(),t=t||{},this.dataProjection=new ie({code:"",units:"tile-pixels"}),this.featureClass_=t.featureClass?t.featureClass:qa,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,u=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(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;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}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_===qa)r=new this.featureClass_(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Gn(a,l);t=e.length>1?new Ga(a,"XY",e):new Nn(a,"XY",l)}else t="Point"===h?new Cn(a,"XY"):"LineString"===h?new Da(a,"XY"):"MultiPoint"===h?new za(a,"XY"):"MultiLineString"===h?new Oa(a,"XY",l):null;r=new(0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Ph(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=di((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new du(t),s=r.readFields(gu,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=yu(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}}function gu(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(fu,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function fu(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<r;)n=1===(t=i.readVarint()>>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 mu(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function yu(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(mu,r,n),r}class _u{constructor(t,e,i,n,r,s){this.sourceProj_=t,this.targetProj_=e;let o={};const a=xi(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()&&Ke(n)>=Ke(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ke(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ke(this.targetProj_.getExtent()):null;const l=Ue(i),h=$e(i),u=qe(i),c=Ne(i),d=this.transformInv_(l),p=this.transformInv_(h),g=this.transformInv_(u),f=this.transformInv_(c),m=10+(s?Math.max(0,Math.ceil(Math.log2(Ge(i)/(s*s*256*256)))):0);if(this.addQuad_(l,h,u,c,d,p,g,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<this.sourceWorldWidth_/2&&(e.source=i)}}))}o={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=ve([r,s,o,a]),u=this.sourceWorldWidth_?Ke(h)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){p=Ke(ve([t,e,i,n]))/this.targetWorldWidth_>.25||p}!d&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)}if(!p&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!He(h,this.maxSourceExtent_))return;let g=0;if(!(p||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)p=!0;else if(g=(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!=g&&2!=g&&4!=g&&8!=g)return;if(l>0){if(!p){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;if(d){s=(Gt(r[0],c)+Gt(o[0],c))/2-Gt(n[0],c)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];p=s*s+a*a>this.errorThresholdSquared_}if(p){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&g)&&this.addTriangle_(t,i,n,r,o,a),0==(14&g)&&this.addTriangle_(t,i,e,r,o,s),g&&(0==(13&g)&&this.addTriangle_(e,n,t,s,a,r),0==(7&g)&&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;De(t,r[0]),De(t,r[1]),De(t,r[2])})),t}getTriangles(){return this.triangles_}}let xu;const vu=[];function wu(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 bu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Cu(t,e,i,n){const r=vi(i,e,t);let s=pi(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||Se(l,r)){const e=pi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function Su(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const g=U(Math.round(i*t),Math.round(i*e),vu);if(c||(g.imageSmoothingEnabled=!1),0===l.length)return g.canvas;function f(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach((function(t,e,i){Ae(m,t.extent)}));const _=i/n,x=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=U(Math.round(Ke(m)*_),Math.round(Ye(m)*_),vu),c||(y.imageSmoothingEnabled=!1),r&&p){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=Ke(r)*_,n=Ye(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach((function(t,e,i){const n=(t.extent[0]-m[0])*_,r=-(t.extent[3]-m[3])*_,s=Ke(t.extent)*_,o=Ye(t.extent)*_;t.image.width>0&&t.image.height>0&&y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?n:Math.round(n),c?r:Math.round(r),c?s:Math.round(n+s)-Math.round(n),c?o:Math.round(r+o)-Math.round(r))}))}const v=Ue(o);return a.getTriangles().forEach((function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],p=n[2][1];const _=f((r[0][0]-v[0])/s),w=f(-(r[0][1]-v[1])/s),b=f((r[1][0]-v[0])/s),C=f(-(r[1][1]-v[1])/s),S=f((r[2][0]-v[0])/s),E=f(-(r[2][1]-v[1])/s),T=o,R=a;o=0,a=0,h-=T,u-=R,d-=T,p-=R;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(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<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-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}([[h,u,0,0,b-_],[d,p,0,0,S-_],[0,0,h,u,C-w],[0,0,d,p,E-w]]);if(!I)return;if(g.save(),g.beginPath(),function(){if(void 0===xu){const t=U(6,6,vu);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",wu(t,4,5,4,0),wu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;xu=bu(e,0)||bu(e,4)||bu(e,8),H(t),vu.push(t.canvas)}return xu}()||!c){g.moveTo(b,C);const t=4,e=_-b,i=w-C;for(let n=0;n<t;n++)g.lineTo(b+f((n+1)*e/t),C+f(n*i/(t-1))),n!=t-1&&g.lineTo(b+f((n+1)*e/t),C+f((n+1)*i/(t-1)));g.lineTo(S,E)}else g.moveTo(b,C),g.lineTo(_,w),g.lineTo(S,E);let M;if(g.clip(),g.transform(I[0],I[2],I[1],I[3],_,w),g.translate(m[0]-T,m[3]-R),y)M=y.canvas,g.scale(x,-x);else{const t=l[0],e=t.extent;M=t.image,g.scale(Ke(e)/M.width,-Ye(e)/M.height)}g.drawImage(M,0,0),g.restore()})),y&&(H(y),vu.push(y.canvas)),u&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach((function(t,e,i){const n=t.target,r=(n[0][0]-v[0])/s,o=-(n[0][1]-v[1])/s,a=(n[1][0]-v[0])/s,l=-(n[1][1]-v[1])/s,h=(n[2][0]-v[0])/s,u=-(n[2][1]-v[1])/s;g.beginPath(),g.moveTo(a,l),g.lineTo(r,o),g.lineTo(h,u),g.closePath(),g.stroke()})),g.restore()),g.canvas}function Eu(t){return Array.isArray(t)?Math.min(...t):t}class Tu extends Or{constructor(t,e,i,n,r,s,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const h=l?Ze(i,l):i,u=Cu(t,e,We(h),n),c=new _u(t,e,h,a,.5*u,n),d=c.calculateSourceExtent(),p=Je(d)?null:s(d,u,r),g=p?dr.IDLE:dr.EMPTY,f=p?p.getPixelRatio():1;super(i,n,f,g),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=c,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=p,this.sourcePixelRatio_=f,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==dr.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==dr.LOADED){const t=Ke(this.targetExtent_)/this.targetResolution_,e=Ye(this.targetExtent_)/this.targetResolution_;this.canvas_=Su(t,e,this.sourcePixelRatio_,Eu(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==dr.IDLE){this.state=dr.LOADING,this.changed();const t=this.sourceImage_.getState();t==dr.LOADED||t==dr.ERROR?this.reproject_():(this.sourceListenerKey_=T(this.sourceImage_,m,(function(t){const e=this.sourceImage_.getState();e!=dr.LOADED&&e!=dr.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}}unlistenSource_(){I(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Ru="imageloadstart",Iu="imageloadend",Mu="imageloaderror";class ku extends t{constructor(t,e){super(t),this.image=e}}class Fu extends rh{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.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){t=e[r(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||yi(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&yi(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Le(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Tu(r,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const r=function(t,e,i,n){const r=e/i,s=We(t),o=Xt(Ke(t)/r,4),a=Xt(Ye(t)/r,4),l=Xt((n-1)*o/2,4),h=o+2*l,u=Xt((n-1)*a/2,4);return Be(s,r,0,[h,a+2*u])}(t,e,i,1),s=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&Ee(this.wantedExtent_,r)||Ee(this.image.getExtent(),r))&&(this.wantedResolution_&&Eu(this.wantedResolution_)===s||Eu(this.image.getResolution())===s)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new Or(r,s,i,this.loader),this.image.addEventListener(m,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case dr.LOADING:this.loading=!0,i=Ru;break;case dr.LOADED:this.loading=!1,i=Iu;break;case dr.ERROR:this.loading=!1,i=Mu;break;default:return}this.hasListener(i)&&this.dispatchEvent(new ku(i,e))}}var Pu="preload",Lu="useInterimTilesOnError";class Au extends Zn{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(Pu)}setPreload(t){this.set(Pu,t)}getUseInterimTilesOnError(){return this.get(Lu)}setUseInterimTilesOnError(t){this.set(Lu,t)}getData(t){return super.getData(t)}}class Du extends wh{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,jo.IDLE,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const f=p?Ze(d,p):d;if(0===Ge(f))return void(this.state=jo.EMPTY);const m=t.getExtent();m&&(g=g?Ze(g,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=We(i);let s=Cu(t,e,r,n);return(!isFinite(s)||s<=0)&&je(i,(function(i){return s=Cu(t,e,i,n),isFinite(s)&&s>0})),s}(t,i,f,y);if(!isFinite(_)||_<=0)return void(this.state=jo.EMPTY);const x=void 0!==h?h:.5;if(this.triangulation_=new _u(t,i,f,g,_*x,y),0===this.triangulation_.getTriangles().length)return void(this.state=jo.EMPTY);this.sourceZ_=e.getZForResolution(_);let v=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(v[1]=Dt(v[1],g[1],g[3]),v[3]=Dt(v[3],g[1],g[3])):v=Ze(v,g)),Ge(v)){const t=e.getTileRangeForExtentAndZ(v,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=l(this.sourceZ_,e,i,o);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=jo.EMPTY)}else this.state=jo.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==jo.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=jo.ERROR;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_=Su(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=jo.LOADED}this.changed()}load(){if(this.state==jo.IDLE){this.state=jo.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==jo.IDLE||i==jo.LOADING){t++;const i=T(e,m,(function(n){const r=e.getState();r!=jo.LOADED&&r!=jo.ERROR&&r!=jo.EMPTY||(I(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()==jo.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(I),this.sourcesListenerKeys_=null}release(){this.canvas_&&(H(this.canvas_.getContext("2d")),vu.push(this.canvas_),this.canvas_=null),super.release()}}class Ou extends Rl{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 Wa(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==jo.LOADED||i==jo.EMPTY||i==jo.ERROR&&!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()==jo.ERROR&&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=Bi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Se(r,n))return null;const s=e.pixelRatio,o=e.viewState.projection,a=e.viewState,l=i.getRenderSource(),h=l.getTileGridForProjection(a.projection),u=l.getTilePixelRatio(e.pixelRatio);for(let t=h.getZForResolution(a.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=l.getTile(t,e[1],e[2],s,o);if(!(i instanceof bh||i instanceof Du)||i instanceof Du&&i.getState()===jo.EMPTY)return null;if(i.getState()!==jo.LOADED)continue;const r=h.getOrigin(t),c=gr(h.getTileSize(t)),d=h.getResolution(t),p=Math.floor(u*((n[0]-r[0])/d-e[1]*c[0])),g=Math.floor(u*((r[1]-n[1])/d-e[2]*c[1])),f=Math.round(u*l.getGutterForProjection(a.projection));return this.getImageData(i.getImage(),p+f,g+f)}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],r=t.viewState,s=r.projection,o=r.resolution,a=r.center,l=r.rotation,h=t.pixelRatio,u=this.getLayer(),c=u.getSource(),d=c.getRevision(),p=c.getTileGridForProjection(s),g=p.getZForResolution(o,c.zDirection),f=p.getResolution(g);let m=t.extent;const y=t.viewState.resolution,_=c.getTilePixelRatio(h),x=Math.round(Ke(m)/y*h),v=Math.round(Ye(m)/y*h),w=i.extent&&Ei(i.extent);w&&(m=Ze(m,Ei(i.extent)));const b=f*x/2/_,C=f*v/2/_,S=[a[0]-b,a[1]-C,a[0]+b,a[1]+C],E=p.getTileRangeForExtentAndZ(m,g),T={};T[g]={};const R=this.createLoadedTileFinder(c,s,T),I=this.tmpExtent,M=this.tmpTileRange_;this.newTiles_=!1;const k=l?Ve(r.center,y,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&&!p.tileCoordIntersectsViewport([g,e,n],k))continue;const r=this.getTile(g,e,n,t);if(this.isDrawableTile(r)){const e=P(this);if(r.getState()==jo.LOADED){T[g][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==i.opacity&&(r.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(r)||(this.newTiles_=!0)}if(1===r.getAlpha(e,t.time))continue}const s=p.getTileCoordChildTileRange(r.tileCoord,M,I);let o=!1;s&&(o=R(g+1,s)),o||p.forEachTileCoordParentTileRange(r.tileCoord,R,M,I)}const F=f/o*h/_;Yi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-v/2);const L=$i(this.pixelTransform);this.useContainer(e,L,this.getBackground(t));const A=this.getRenderContext(t),D=this.context.canvas;Zi(this.inversePixelTransform,this.pixelTransform),Yi(this.tempTransform,x/2,v/2,F,F,0,-x/2,-v/2),D.width!=x||D.height!=v?(D.width=x,D.height=v):this.containerReused||A.clearRect(0,0,x,v),w&&this.clipUnrotated(A,t,w),c.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,t),this.renderedTiles.length=0;let O,z,j,G=Object.keys(T).map(Number);G.sort(n),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(O=[],z=[]):G=G.reverse();for(let e=G.length-1;e>=0;--e){const i=G[e],n=c.getTilePixelSize(i,h,s),r=p.getResolution(i)/f,o=n[0]*r*F,a=n[1]*r*F,l=p.getTileCoordForCoordAndZ(Ue(S),i),u=p.getTileCoordExtent(l),d=Bi(this.tempTransform,[_*(u[0]-S[0])/f,_*(S[3]-u[3])/f]),m=_*c.getGutterForProjection(s),y=T[i];for(const e in y){const n=y[e],r=n.tileCoord,s=l[1]-r[1],h=Math.round(d[0]-(s-1)*o),u=l[2]-r[2],p=Math.round(d[1]-(u-1)*a),f=Math.round(d[0]-s*o),_=Math.round(d[1]-u*a),x=h-f,v=p-_,w=g===i,b=w&&1!==n.getAlpha(P(this),t.time);let C=!1;if(!b)if(O){j=[f,_,f+x,_,f+x,_+v,f,_+v];for(let t=0,e=O.length;t<e;++t)if(g!==i&&i<z[t]){const e=O[t];He([f,_,f+x,_+v],[e[0],e[3],e[4],e[7]])&&(C||(A.save(),C=!0),A.beginPath(),A.moveTo(j[0],j[1]),A.lineTo(j[2],j[3]),A.lineTo(j[4],j[5]),A.lineTo(j[6],j[7]),A.moveTo(e[6],e[7]),A.lineTo(e[4],e[5]),A.lineTo(e[2],e[3]),A.lineTo(e[0],e[1]),A.clip())}O.push(j),z.push(i)}else A.clearRect(f,_,x,v);this.drawTileImage(n,t,f,_,x,v,m,w),O&&!b?(C&&A.restore(),this.renderedTiles.unshift(n)):this.renderedTiles.push(n),this.updateUsedTiles(t.usedTiles,c,n)}}return this.renderedRevision=d,this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Le(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=h,this.renderedProjection=s,this.manageTilePyramid(t,c,p,h,s,m,g,u.getPreload()),this.scheduleExpireCache(t,c),this.postRender(this.context,t),i.extent&&A.restore(),A.imageSmoothingEnabled=!0,L!==D.style.transform&&(D.style.transform=L),this.container}drawTileImage(t,e,i,n,r,s,o,a){const l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=P(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),p=d!==h.globalAlpha;p&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),p&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=function(t,e,i){const n=P(t);n in i.usedTiles&&t.expireCache(i.viewState.projection,i.usedTiles[n])}.bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const n=P(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,r,s,o,a,l){const h=P(e);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=t.tileQueue,d=i.getMinZoom(),p=t.viewState.rotation,g=p?Ve(t.viewState.center,t.viewState.resolution,p,t.size):void 0;let f,m,y,_,x,v,w=0;for(v=d;v<=o;++v)for(m=i.getTileRangeForExtentAndZ(s,v,m),y=i.getResolution(v),_=m.minX;_<=m.maxX;++_)for(x=m.minY;x<=m.maxY;++x)p&&!i.tileCoordIntersectsViewport([v,_,x],g)||(o-v<=a?(++w,f=e.getTile(v,_,x,n,r),f.getState()==jo.IDLE&&(u[f.getKey()]=!0,c.isKeyQueued(f.getKey())||c.enqueue([f,h,i.getTileCoordCenter(f.tileCoord),y])),void 0!==l&&l(f)):e.useTile(v,_,x,r));e.updateCacheSize(w,r)}}class zu extends Au{constructor(t){super(t)}createRenderer(){return new Ou(this)}}function ju(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,n){const r=qu(t);return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=Nu(t,e,i);return new $a({extent:t,origin:Xe(t,n),resolutions:r,tileSize:i})}(r,e,i,n)}(t),t.setDefaultTileGrid(e)),e}function Gu(t){const e=t||{},i=e.extent||di("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Nu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new $a(n)}function Nu(t,e,i,n){e=void 0!==e?e:Qt,i=gr(void 0!==i?i:te);const r=Ye(t),s=Ke(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;t<o;++t)a[t]=n/Math.pow(2,t);return a}function qu(t){let e=(t=di(t)).getExtent();if(!e){const i=180*ee.degrees/t.getMetersPerUnit();e=Me(-i,-i,i,i)}return e}class Wu extends t{constructor(t,e){super(t),this.tile=e}}var Xu=class extends rh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&gr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new Sh(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let s,o,a,l=!0;for(let t=i.minX;t<=i.maxX;++t)for(let h=i.minY;h<=i.maxY;++h)o=Va(e,t,h),a=!1,r.containsKey(o)&&(s=r.get(o),a=s.getState()===jo.LOADED,a&&(a=!1!==n(s))),a||(l=!1);return l}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return k()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:ju(t)}getTileCacheForProjection(t){const e=this.getProjection();return At(null===e||yi(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=gr(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=qu(i);if(!Se(s,r)){const e=Ke(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(i,t,e)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||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){}};let Bu,Vu=!0;try{new ImageData(10,10)}catch(t){Vu=!1}function Yu(t){let e=!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,n){return e?new ImageData(t,i,n):{data:t,width:i,height:n}}return function(e){const n=e.buffers,r=e.meta,s=e.imageOps,o=e.width,a=e.height,l=n.length,h=n[0].byteLength;if(s){const e=new Array(l);for(let t=0;t<l;++t)e[t]=i(new Uint8ClampedArray(n[t]),o,a);return t(e,r).data.buffer}const u=new Uint8ClampedArray(h),c=new Array(l),d=new Array(l);for(let t=0;t<l;++t)c[t]=new Uint8ClampedArray(n[t]),d[t]=[0,0,0,0];for(let e=0;e<h;e+=4){for(let t=0;t<l;++t){const i=c[t];d[t][0]=i[e],d[t][1]=i[e+1],d[t][2]=i[e+2],d[t][3]=i[e+3]}const i=t(d,r);u[e]=i[0],u[e+1]=i[1],u[e+2]=i[2],u[e+3]=i[3]}return u.buffer}}function Zu(t,e){const i=Object.keys(t.lib||{}).map((function(e){return"const "+e+" = "+t.lib[e].toString()+";"})).concat(["const __minion__ = ("+Yu.toString()+")(",t.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),n=new Worker("undefined"==typeof Blob?"data:text/javascript;base64,"+Buffer.from(i.join("\n"),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return n.addEventListener("message",e),n}class Uu extends i{constructor(t){let e;super(),this._imageOps=!!t.imageOps,e=0===t.threads?0:this._imageOps?1:t.threads||1;const i=new Array(e);if(e)for(let n=0;n<e;++n)i[n]=Zu(t,this._onWorkerMessage.bind(this,n));else i[0]=function(t,e){const i=Yu(t.operation);let n=!1;return{postMessage:function(t){setTimeout((function(){n||e({data:{buffer:i(t),meta:t.meta}})}),0)},terminate:function(){n=!0}}}(t,this._onWorkerMessage.bind(this,0));this._workers=i,this._queue=[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}process(t,e,i){this._enqueue({inputs:t,meta:e,callback:i}),this._dispatch()}_enqueue(t){for(this._queue.push(t);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this._workers.length;if(this._running=r,1===r)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;s<r;++s){const r=s*o,a=[];for(let t=0,e=n.length;t<e;++t)a.push(n[t].slice(r,r+o));this._workers[s].postMessage({buffers:a,meta:t.meta,imageOps:this._imageOps,width:e,height:i},a)}}_onWorkerMessage(t,e){this.disposed||(this._dataLookup[t]=e.data,--this._running,0===this._running&&this._resolveJob())}_resolveJob(){const t=this._job,e=this._workers.length;let i,n;if(1===e)i=new Uint8ClampedArray(this._dataLookup[0].buffer),n=this._dataLookup[0].meta;else{const r=t.inputs[0].data.length;i=new Uint8ClampedArray(r),n=new Array(e);const s=4*Math.ceil(r/4/e);for(let t=0;t<e;++t){const e=this._dataLookup[t].buffer,r=t*s;i.set(new Uint8ClampedArray(e),r),n[t]=this._dataLookup[t].meta}}this._job=null,this._dataLookup={},t.callback(null,function(t,e,i){if(Vu)return new ImageData(t,e,i);Bu||(Bu=document.createElement("canvas").getContext("2d"));const n=Bu.createImageData(e,i);return n.data.set(t),n}(i,t.inputs[0].width,t.inputs[0].height),n),this._dispatch()}disposeInternal(){for(let t=0;t<this._workers.length;++t)this._workers[t].terminate();this._workers.length=0}}const $u="beforeoperations",Ku="afteroperations";class Hu extends t{constructor(t,e,i){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=i}}class Ju extends Fu{constructor(t){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=void 0!==t.operationType?t.operationType:"pixel",this.threads_=void 0!==t.threads?t.threads:1,this.layers_=function(t){const e=t.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=ec(t[n]);return i}(t.sources);const e=this.changed.bind(this);for(let t=0,i=this.layers_.length;t<i;++t)this.layers_[t].addEventListener(m,e);var i;this.useResolutions_=null!==t.resolutions,this.tileQueue_=new Go((function(){return 1}),this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:[1,0,0,1,0,0],declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:(i=this.layers_,i.map((function(t){return t.getLayerState()}))),pixelRatio:1,pixelToCoordinateTransform:[1,0,0,1,0,0],postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:P(this),renderTargets:{}},this.setAttributions((function(e){const i=[];for(let n=0,r=t.sources.length;n<r;++n){const r=t.sources[n],s=r instanceof rh?r:r.getSource();if(!s)continue;const o=s.getAttributions();if("function"==typeof o){const t=o(e);i.push.apply(i,t)}}return 0!==i.length?i:null})),void 0!==t.operation&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new Uu({operation:t,imageOps:"image"===this.operationType_,queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,i){const n=Object.assign({},this.frameState_);n.viewState=Object.assign({},n.viewState);const r=We(t);n.size[0]=Math.ceil(Ke(t)/e),n.size[1]=Math.ceil(Ye(t)/e),n.extent=[r[0]-n.size[0]*e/2,r[1]-n.size[1]*e/2,r[0]+n.size[0]*e/2,r[1]+n.size[1]*e/2],n.time=Date.now();const s=n.viewState;return s.center=r,s.projection=i,s.resolution=e,n}allSourcesReady_(){let t,e=!0;for(let i=0,n=this.layers_.length;i<n;++i)if(t=this.layers_[i].getSource(),!t||"ready"!==t.getState()){e=!1;break}return e}getImage(t,e,i,n){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const r=this.updateFrameState_(t,e,n);if(this.requestedFrameState_=r,this.renderedImageCanvas_){const t=this.renderedImageCanvas_.getResolution(),i=this.renderedImageCanvas_.getExtent();e===t&&Le(r.extent,i)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&this.getRevision()===this.renderedRevision_||this.processSources_(),r.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const t=this.requestedFrameState_,e=this.layers_.length,i=new Array(e);for(let n=0;n<e;++n){t.layerIndex=n,t.renderTargets={};const e=tc(this.layers_[n],t);if(!e)return;i[n]=e}const n={};this.dispatchEvent(new Hu($u,t,n)),this.processor_.process(i,n,this.onWorkerComplete_.bind(this,t))}onWorkerComplete_(t,e,i,n){if(e||!i)return;const r=t.extent,s=t.viewState.resolution;if(s!==this.requestedFrameState_.viewState.resolution||!Le(r,this.requestedFrameState_.extent))return;let o;if(this.renderedImageCanvas_)o=this.renderedImageCanvas_.getImage().getContext("2d");else{o=U(Math.round(Ke(r)/s),Math.round(Ye(r)/s)),this.renderedImageCanvas_=new vh(r,s,1,o.canvas)}o.putImageData(i,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new Hu(Ku,t,n))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let i=0,n=this.layers_.length;i<n;++i){if(e=this.layers_[i].getSource().getResolutions(t),e)break}return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}Ju.prototype.dispose;let Qu=null;function tc(t,e){const i=t.getRenderer();if(!i)throw new Error("Unsupported layer type: "+t);if(!i.prepareFrame(e))return null;const n=e.size[0],r=e.size[1];if(0===n||0===r)return null;const s=i.renderFrame(e,null);let o;if(s instanceof HTMLCanvasElement)o=s;else{if(s&&(o=s.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===n&&o.height===r){return o.getContext("2d").getImageData(0,0,n,r)}}if(Qu){const t=Qu.canvas;t.width!==n||t.height!==r?Qu=U(n,r,void 0,{willReadFrequently:!0}):Qu.clearRect(0,0,n,r)}else Qu=U(n,r,void 0,{willReadFrequently:!0});return Qu.drawImage(o,0,0,n,r),Qu.getImageData(0,0,n,r)}function ec(t){let e;return t instanceof rh?t instanceof Xu?e=new zu({source:t}):t instanceof Fu&&(e=new Xh({source:t})):e=t,e}var ic="tileloadstart",nc="tileloadend",rc="tileloaderror";class sc extends Xu{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===sc.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=P(e),n=e.getState();let r;n==jo.LOADING?(this.tileLoadingKeys_[i]=!0,r=ic):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==jo.ERROR?rc:n==jo.LOADED?nc:void 0),null!=r&&this.dispatchEvent(new Wu(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=kh(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Mh(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=Va(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}class oc extends sc{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:ac,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:bh,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!yi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!yi(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||yi(e,t)))return this.tileGrid;const i=P(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=ju(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||yi(e,t))return this.tileCache;const i=P(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Sh(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,n,r,s){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(o,void 0!==l?jo.IDLE:jo.EMPTY,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=s,h.addEventListener(m,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,r){const s=this.getProjection();if(!s||!r||yi(s,r))return this.getTileInternal(t,e,i,n,s||r);const o=this.getTileCacheForProjection(r),a=[t,e,i];let l;const h=Ya(a);o.containsKey(h)&&(l=o.get(h));const u=this.getKey();if(l&&l.key==u)return l;const c=this.getTileGridForProjection(s),d=this.getTileGridForProjection(r),p=this.getTileCoordForTileUrlFunction(a,r),g=new Du(s,c,r,d,a,p,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return g.key=u,l?(g.interimTile=l,g.refreshInterimChain(),o.replace(h,g)):o.set(h,g),g}getTileInternal(t,e,i,n,r){let s=null;const o=Va(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()==jo.IDLE?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=di(t);if(i){const t=P(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function ac(t,e){t.getImage().src=e}var lc=class extends oc{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:di("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 r=document.createElement("script"),s="olc_"+P(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+s;const a=setTimeout((function(){o(),i&&i()}),1e4);window[s]=function(t){clearTimeout(a),o(),e(t)},document.head.appendChild(r)}(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{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}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=di("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=_i(e,i);n=Qe(t.bounds,r)}const r=qu(i),s=t.minzoom||0,o=Gu({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=Mh(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return He(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}};const hc={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},uc={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class cc extends Ou{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}prepareTile(t,e,i){let n;const r=t.getState();return r!==jo.LOADED&&r!==jo.ERROR||(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[Kt]||u[Ht]);!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()?P(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),p=P(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let i=0,r=d.length;i<r;++i){const r=d[i];if(r.getState()!=jo.LOADED)continue;const g=r.tileCoord,f=u.getTileCoordExtent(g),m=Ze(c,f),y=we(m,n.getRenderBuffer()*o,this.tmpExtent),_=Le(f,m)?null:y,x=new bl(0,m,o,e),v=Hl(o,e),w=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,v,i,x,h,e);a.dirty=a.dirty||n}},b=r.getFeatures();s&&s!==a.renderedRenderOrder&&b.sort(s);for(let t=0,e=b.length;t<e;++t){const e=b[t];_&&!He(_,e.getGeometry().getExtent())||w.call(this,e,t)}const C=x.finish(),S="vector"!==n.getRenderMode()&&h&&1===d.length?null:m,E=new Wl(S,o,e,l.getOverlaps(),C,n.getRenderBuffer(),!!this.frameState?.declutter);t.executorGroups[p].push(E)}a.renderedRevision=r,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=ve([t]);we(h,s*i,h);const u={},c=function(t,e,i){let s=t.getId();void 0===s&&(s=P(t));const o=u[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return u[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return u[s]=!0,n(t,a,e);r.push(u[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},d=this.renderedTiles;let p;for(let n=0,r=d.length;!p&&n<r;++n){const r=d[n];if(!He(l.getTileCoordExtent(r.wrappedTileCoord),h))continue;const u=P(a),g=[r.executorGroups[u]],f=a.getDeclutter();g.some((n=>{const r=f?e.declutter[f].all().map((t=>t.value)):null;for(let e=0,a=n.length;e<a;++e){const a=n[e];if(p=a.forEachFeatureAtCoordinate(t,s,o,i,c,r),p)return!0}}))}return p}getFeatures(t){return new Promise(((e,i)=>{const n=this.getLayer(),r=P(n),s=n.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,h=s.getTileGridForProjection(o),u=Bi(this.renderedPixelToCoordinateTransform_,t.slice()),c=h.getTileCoordForCoordAndResolution(u,l);let d;for(let t=0,e=this.renderedTiles.length;t<e;++t)if(c.toString()===this.renderedTiles[t].tileCoord.toString()){if(d=this.renderedTiles[t],d.getState()===jo.LOADED){const t=h.getTileCoordExtent(d.tileCoord);s.getWrapX()&&o.canWrapX()&&!Ee(a,t)&&ni(u,o);break}d=void 0}if(!d||d.loadingSourceTiles>0)return void e([]);const p=Ue(h.getTileCoordExtent(d.wrappedTileCoord)),g=[(u[0]-p[0])/l,(p[1]-u[1])/l],f=d.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let m=d.hitDetectionImageData[r];if(!m){const t=gr(h.getTileSize(h.getZForResolution(l,s.zDirection))),e=this.renderedRotation_;m=Yl(t,[this.getRenderTransform(h.getTileCoordCenter(d.wrappedTileCoord),l,0,Vl,t[0]*Vl,t[1]*Vl,0)],f,n.getStyleFunction(),h.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(n).renderedResolution,e),d.hitDetectionImageData[r]=m}e(Zl(g,f,m))}))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[Kt]||r[Ht]),o=this.renderedTiles;for(let e=0,i=o.length;e<i;++e){const i=o[e],n=i.executorGroups[P(this.getLayer())],r=this.getLayer().getDeclutter();if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,[this.context.canvas.width,this.context.canvas.height],this.getTileRenderTransform(i,t),t.viewState.rotation,s,Nl,r?t.declutter[r]:void 0)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles.reduce(((t,e,i)=>(e.executorGroups[P(this.getLayer())].forEach((e=>t.push({executorGroup:e,index:i}))),t)),[]),i=e.map((({executorGroup:t})=>t.getDeferredZIndexContexts()));i.map((t=>Object.keys(t))).flat().sort(n).map(Number).forEach((t=>{i.forEach(((i,n)=>{i[t]&&i[t].forEach((t=>{const{executorGroup:i,index:r}=e[n],s=i.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}))}))}))}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),p=u.getTileCoordExtent(c,this.tmpExtent)[0]-d[0];return Wi(Vi(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,p))}postRender(t,e){const i=e.viewHints,n=!(i[Kt]||i[Ht]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?uc[s].filter((t=>!Nl.includes(t))):uc[s],h=e.viewState,u=h.rotation,c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),p=this.renderedTiles,g=[],f=[],m=[];let y=!0;for(let i=p.length-1;i>=0;--i){const s=p[i];y=y&&!s.getReplayState(r).dirty;const o=s.executorGroups[P(r)].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let _=!1;const x=o[0].getClipCoords(h);let v,w=t;if(x){a&&(v=new Sl,w=v.getContext());for(let t=0,e=g.length;t<e;++t)if(d!==c&&c<f[t]){const e=g[t];He([x[0],x[3],x[4],x[7]],[e[0],e[3],e[4],e[7]])&&(_||(w.save(),_=!0),w.beginPath(),w.moveTo(x[0],x[1]),w.lineTo(x[2],x[3]),w.lineTo(x[4],x[5]),w.lineTo(x[6],x[7]),w.moveTo(e[6],e[7]),w.lineTo(e[4],e[5]),w.lineTo(e[2],e[3]),w.lineTo(e[0],e[1]),w.clip())}g.push(x),f.push(c)}for(let e=0,i=o.length;e<i;++e){o[e].execute(t,[t.canvas.width,t.canvas.height],h,u,n,l)}_&&(w===t?w.restore():m[i]=v)}t.globalAlpha=o,this.ready=y,this.tileClipContexts_=m,super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Ql(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Ql(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[P(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const u=e.viewState.projection,c=l.getTileGridForProjection(u),d=c.getResolution(t.tileCoord[0]),p=e.pixelRatio/t.wantedResolution*d,g=c.getResolution(a),f=t.getContext(i);h=Math.round(Math.max(h,p/h));const m=l.getTilePixelSize(a,h,u);f.canvas.width=m[0],f.canvas.height=m[1];const y=h/p;if(1!==y){const t=qi(this.tmpTransform_);Vi(t,y,y),f.setTransform.apply(f,t)}const _=c.getTileCoordExtent(o,this.tmpExtent),x=p/g,v=qi(this.tmpTransform_);Vi(v,x,-x),function(t,e,i){Wi(t,Xi(Ni,1,0,0,1,e,i))}(v,-_[0],-_[3]);for(let t=0,e=s.length;t<e;++t){s[t].execute(f,[f.canvas.width*y,f.canvas.height*y],v,0,!0,hc[i.getRenderMode()],null)}n.renderedTileResolution=t.wantedResolution}}class dc extends bo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un;const i=t.renderMode||"hybrid";At("hybrid"==i||"vector"==i,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=i,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new cc(this)}getFeatures(t){return super.getFeatures(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Pu)}getUseInterimTilesOnError(){return this.get(Lu)}setPreload(t){this.set(Pu,t)}setUseInterimTilesOnError(t){this.set(Lu,t)}}class pc extends sc{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||qu(e),n=t.tileGrid||Gu({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:gc,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new Sh(this.tileCache.highWaterMark),this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Rh,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=Za(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==jo.LOADED)return;const s=i.getSourceTiles();for(let i=0,n=s.length;i<n;++i){const n=s[i],o=n.tileCoord;if(He(t,r.getTileCoordExtent(o))){const i=n.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();He(t,s.getExtent())&&e.push(r)}}}})),e}getOverlaps(){return this.overlaps_}clear(){this.tileCache.clear(),this.sourceTileCache.clear()}expireCache(t,e){const i=this.getTileCacheForProjection(t),n=Object.keys(e).reduce(((t,e)=>{const n=function(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return Va(e,i,n)}(e),r=i.peek(n);if(r){const e=r.sourceTiles;for(let i=0,n=e.length;i<n;++i)t[e[i].getKey()]=!0}return t}),{});super.expireCache(t,e),this.sourceTileCache.expireCache(n)}getSourceTiles(t,e,i){if(i.getState()===jo.IDLE){i.setState(jo.LOADING);const n=i.wrappedTileCoord,r=this.getTileGridForProjection(e),s=r.getTileCoordExtent(n),o=n[0],a=r.getResolution(o);we(s,-a,s);const l=this.tileGrid,h=l.getExtent();h&&Ze(s,h,s);const u=l.getZForResolution(a,this.zDirection);l.forEachTileCoord(s,u,(n=>{const r=this.tileUrlFunction(n,t,e),s=this.sourceTileCache.containsKey(r)?this.sourceTileCache.get(r):new this.tileClass(n,r?jo.IDLE:jo.EMPTY,r,this.format_,this.tileLoadFunction);i.sourceTiles.push(s);const o=s.getState();if(o<jo.LOADED){const t=e=>{this.handleTileChange(e);const n=s.getState();if(n===jo.LOADED||n===jo.ERROR){const e=s.getKey();e in i.errorTileKeys?s.getState()===jo.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===jo.ERROR?i.errorTileKeys[e]=!0:s.removeEventListener(m,t),0===i.loadingSourceTiles&&i.setState(g(i.errorTileKeys)?jo.LOADED:jo.ERROR)}};s.addEventListener(m,t),i.loadingSourceTiles++}o===jo.IDLE&&(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()===jo.ERROR))?jo.ERROR:jo.LOADED)}return i.sourceTiles}getTile(t,e,i,n,r){const s=Va(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);we(e,-c.getResolution(t),e),He(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);we(o,-i,o),e.forEachTileCoord(o,s,(t=>{d=d&&!this.tileUrlFunction(t,n,r)}))}const p=new Th(l,d?jo.EMPTY:jo.IDLE,h,this.getSourceTiles.bind(this,n,r));return p.key=o,a?(p.interimTile=a,p.refreshInterimChain(),this.tileCache.replace(s,p)):this.tileCache.set(s,p),p}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=Qt+1;for(let t=n.length;t<o;++t)n.push(n[t-1]/2),r.push(r[t-1]),s.push(s[t-1]);i=new $a({extent:t.getExtent(),origins:r,resolutions:n,tileSizes:s}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=gr(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}updateCacheSize(t,e){super.updateCacheSize(2*t,e),this.sourceTileCache.highWaterMark=this.getTileCacheForProjection(e).highWaterMark}}function gc(t,e){t.setLoader((function(i,n,r){mh(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))}))}function fc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mc,yc={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function _c(t){return(t=Math.round(t))<0?0:t>255?255:t}function xc(t){return t<0?0:t>1?1:t}function vc(t){return"%"===t[t.length-1]?_c(parseFloat(t)/100*255):_c(parseInt(t))}function wc(t){return"%"===t[t.length-1]?xc(parseFloat(t)/100):xc(parseFloat(t))}function bc(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{mc={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in yc)return yc[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=wc(o.pop());case"rgb":return 3!==o.length?null:[vc(o[0]),vc(o[1]),vc(o[2]),a];case"hsla":if(4!==o.length)return null;a=wc(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=wc(o[1]),u=wc(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[_c(255*bc(d,c,l+1/3)),_c(255*bc(d,c,l)),_c(255*bc(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class Cc{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof Cc)return t;if("string"!=typeof t)return;const e=mc(t);return e?new Cc(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}toArray01(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:i,a:n}=this;return[t,e,i,n]}}Cc.black=new Cc(0,0,0,1),Cc.white=new Cc(1,1,1,1),Cc.transparent=new Cc(0,0,0,0),Cc.red=new Cc(1,0,0,1),Cc.blue=new Cc(0,0,1,1);var Sc=Cc;function Ec(t){return"object"==typeof t?["literal",t]:t}function Tc(t,e){let i=t.stops;if(!i)return function(t,e){const 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];{const n=["color"===e.type?"to-color":e.type,i,Ec(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Lc(t[1])]:[t[0],Ec(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e<i.length;e++){const o=i[e],a=o[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],s.push(a)),r[a].push([o[0].value,o[1]])}const o=Pc({},e);if("exponential"===o){const i=[Rc(t),["linear"],["zoom"]];for(const t of s){Fc(i,t,Mc(n[t],e,r[t]),!1)}return i}{const t=["step",["zoom"]];for(const i of s){Fc(t,i,Mc(n[i],e,r[i]),!0)}return kc(t),t}}(t,e,i):s?function(t,e,i,n=["zoom"]){const r=Pc(t,e);let s,o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;s=[Rc(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)Fc(s,t[0],t[1],o);return kc(s),s}(t,e,i):Mc(t,e,i)}function Rc(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Ic(t,e){const i=Ec((n=t.default,r=e.default,void 0!==n?n:void 0!==r?r:void 0));var n,r;return void 0===i&&"resolvedImage"===e.type?"":i}function Mc(t,e,i){const n=Pc(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Ic(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)Fc(n,t[0],t[1],!1);return n.push(Ic(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)Fc(e,t[0],t[1],!0);return kc(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Ec(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[Rc(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)Fc(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,Ec(t.default)]}throw new Error(`Unknown property function type ${n}`)}function kc(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function Fc(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Pc(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Lc(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const 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<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}class Ac extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}var Dc=Ac;class Oc{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new Oc(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var zc=Oc;const jc={kind:"null"},Gc={kind:"number"},Nc={kind:"string"},qc={kind:"boolean"},Wc={kind:"color"},Xc={kind:"object"},Bc={kind:"value"},Vc={kind:"collator"},Yc={kind:"formatted"},Zc={kind:"resolvedImage"};function Uc(t,e){return{kind:"array",itemType:t,N:e}}function $c(t){if("array"===t.kind){const e=$c(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Kc=[jc,Gc,Nc,qc,Wc,Yc,Xc,Uc(Bc),Zc];function Hc(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Hc(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(const t of Kc)if(!Hc(t,e))return null}return`Expected ${$c(t)} but found ${$c(e)} instead.`}function Jc(t,e){return e.some((e=>e.kind===t.kind))}function Qc(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class td{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ed{constructor(t,e,i,n,r){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class id{constructor(t){this.sections=t}static fromString(t){return new id([new ed(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof id?t:id.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class nd{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new nd({name:t,available:!1}):null}serialize(){return["image",this.name]}}function rd(t,e,i,n){if(!("number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255)){return`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}return 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.`}function sd(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 Sc)return!0;if(t instanceof td)return!0;if(t instanceof id)return!0;if(t instanceof nd)return!0;if(Array.isArray(t)){for(const e of t)if(!sd(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!sd(t[e]))return!1;return!0}return!1}function od(t){if(null===t)return jc;if("string"==typeof t)return Nc;if("boolean"==typeof t)return qc;if("number"==typeof t)return Gc;if(t instanceof Sc)return Wc;if(t instanceof td)return Vc;if(t instanceof id)return Yc;if(t instanceof nd)return Zc;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=od(e);if(i){if(i===t)continue;i=Bc;break}i=t}return Uc(i||Bc,e)}return Xc}function ad(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Sc||t instanceof id||t instanceof nd?t.toString():JSON.stringify(t)}class ld{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!sd(t[1]))return e.error("invalid value");const i=t[1];let n=od(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new ld(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Sc?["rgba"].concat(this.value.toArray()):this.value instanceof id?this.value.serialize():this.value}}var hd=ld;var ud=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const cd={string:Nc,number:Gc,boolean:qc,object:Xc};class dd{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in cd)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=cd[i],n++}else r=Bc;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);s=t[2],n++}i=Uc(r,s)}else i=cd[r];const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,Bc);if(!i)return null;s.push(i)}return new dd(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Hc(this.type,od(i)))return i;if(e===this.args.length-1)throw new ud(`Expected value to be of type ${$c(this.type)}, but found ${$c(od(i))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}var pd=dd;class gd{constructor(t){this.type=Yc,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,Gc),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,Uc(Nc)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,Wc),!o))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=o}else{const s=e.parse(t[i],1,Bc);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new gd(n)}evaluate(t){return new id(this.sections.map((e=>{const i=e.content.evaluate(t);return od(i)===Zc?new ed("",i,null,null,null):new ed(ad(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class fd{constructor(t){this.type=Zc,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Nc);return i?new fd(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=nd.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const md={"to-boolean":qc,"to-color":Wc,"to-number":Gc,"to-string":Nc};class yd{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=md[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,Bc);if(!n)return null;r.push(n)}return new yd(n,r)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof Sc)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:rd(e[0],e[1],e[2],e[3]),!i))return new Sc(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ud(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new ud(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?id.fromString(ad(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?nd.fromString(ad(this.args[0].evaluate(t))):ad(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new gd([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new fd(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var _d=yd;const xd=["Unknown","Point","LineString","Polygon"];var vd=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?xd[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord,r=i*e-t[0],s=n*e-t[1];return this.featureDistanceData.bearing[0]*r+this.featureDistanceData.bearing[1]*s}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Sc.parse(t)),e}};class wd{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const i=t[0],n=wd.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new Kd(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+o.length,r);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new wd(i,r,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map($c).join(", ")})`:`(${$c(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push($c(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){wd.definitions=e;for(const i in e)t[i]=wd}}var bd=wd;class Cd{constructor(t,e,i){this.type=Vc,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,qc);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,qc);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,Nc),!s)?null:new Cd(n,r,s)}evaluate(t){return new td(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Sd=8192;function Ed(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Td(t,e){return!(t[0]<=e[0])&&(!(t[2]>=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function Rd(t,e){const i=(180+t[0])/360;const n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*Sd),Math.round(n*s*Sd)]}function Id(t,e,i){const 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 Md(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 kd(t,e){let i=!1;for(let n=0,r=e.length;n<r;n++){const r=e[n];for(let e=0,n=r.length;e<n-1;e++){if(Id(t,r[e],r[e+1]))return!1;Md(t,r[e],r[e+1])&&(i=!i)}}return i}function Fd(t,e){for(let i=0;i<e.length;i++)if(kd(t,e[i]))return!0;return!1}function Pd(t,e,i,n){const r=t[0]-i[0],s=t[1]-i[1],o=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],h=n[1]-i[1],u=r*h-l*s,c=o*h-l*a;return u>0&&c<0||u<0&&c>0}function Ld(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-i[0],n[1]-i[1]];return 0!=(o=s)[0]*(a=r)[1]-o[1]*a[0]&&!(!Pd(t,e,i,n)||!Pd(i,n,t,e));var o,a}function Ad(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(Ld(t,e,n[i],n[i+1]))return!0;return!1}function Dd(t,e){for(let i=0;i<t.length;++i)if(!kd(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Ad(t[i],t[i+1],e))return!1;return!0}function Od(t,e){for(let i=0;i<e.length;i++)if(Dd(t,e[i]))return!0;return!1}function zd(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=[];for(let n=0;n<t[r].length;n++){const o=Rd(t[r][n],i);Ed(e,o),s.push(o)}n.push(s)}return n}function jd(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=zd(t[r],e,i);n.push(s)}return n}function Gd(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Ed(e,t)}function Nd(t,e,i,n){const r=Math.pow(2,n.z)*Sd,s=[n.x*Sd,n.y*Sd],o=[];if(!t)return o;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Gd(n,e,i,r),o.push(n)}return o}function qd(t,e,i,n){const r=Math.pow(2,n.z)*Sd,s=[n.x*Sd,n.y*Sd],o=[];if(!t)return o;for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Ed(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const n of t)Gd(n,e,i,r)}return o}class Wd{constructor(t,e){this.type=qc,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(sd(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Wd(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Wd(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Wd(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if(!r)return!1;if("Polygon"===e.type){const s=zd(e.coordinates,n,r),o=Nd(t.geometry(),i,n,r);if(!Td(i,n))return!1;for(const t of o)if(!kd(t,s))return!1}if("MultiPolygon"===e.type){const s=jd(e.coordinates,n,r),o=Nd(t.geometry(),i,n,r);if(!Td(i,n))return!1;for(const t of o)if(!Fd(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if(!r)return!1;if("Polygon"===e.type){const s=zd(e.coordinates,n,r),o=qd(t.geometry(),i,n,r);if(!Td(i,n))return!1;for(const t of o)if(!Dd(t,s))return!1}if("MultiPolygon"===e.type){const s=jd(e.coordinates,n,r),o=qd(t.geometry(),i,n,r);if(!Td(i,n))return!1;for(const t of o)if(!Od(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Xd=Wd;function Bd(t){if(t instanceof bd){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Xd)return!1;let e=!0;return t.eachChild((t=>{e&&!Bd(t)&&(e=!1)})),e}function Vd(t){if(t instanceof bd&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Vd(t)&&(e=!1)})),e}function Yd(t,e){if(t instanceof bd&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Yd(t,e)&&(i=!1)})),i}class Zd{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Zd(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var Ud=Zd;class $d{constructor(t,e=[],i,n=new zc,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new pd(e,[t]):"coerce"===i?new _d(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", []].');const 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;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof hd)&&"resolvedImage"!==n.type.kind&&Hd(n)){const t=new vd;try{n=new hd(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}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.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new $d(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Dc(i,t))}checkSubtype(t,e){const i=Hc(t,e);return i&&this.error(i),i}}var Kd=$d;function Hd(t){if(t instanceof Ud)return Hd(t.boundExpression);if(t instanceof bd&&"error"===t.name)return!1;if(t instanceof Cd)return!1;if(t instanceof Xd)return!1;const e=t instanceof _d||t instanceof pd;let i=!0;return t.eachChild((t=>{i=e?i&&Hd(t):i&&t instanceof hd})),!!i&&(Bd(t)&&Yd(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function Jd(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;s=a+1}else{if(!(n>e))throw new ud("Input is not a number.");o=a-1}return 0}class Qd{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){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.");const i=e.parse(t[1],1,Gc);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Qd(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);return i[Jd(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var tp=Qd,ep=ip;function ip(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}ip.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},ip.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},ip.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},ip.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)<e)return r;var a=this.sampleCurveDerivativeX(r);if(Math.abs(a)<1e-6)break;r-=s/a}if((r=t)<(i=0))return i;if(r>(n=1))return n;for(;i<n;){if(s=this.sampleCurveX(r),Math.abs(s-t)<e)return r;t>s?i=r:n=r,r=.5*(n-i)+i}return r},ip.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var np=fc(ep);function rp(t,e,i){return t*(1-i)+e*i}var sp=Object.freeze({__proto__:null,number:rp,color:function(t,e,i){return new Sc(rp(t.r,e.r,i),rp(t.g,e.g,i),rp(t.b,e.b,i),rp(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>rp(t,e[n],i)))}});const op=.95047,ap=1,lp=1.08883,hp=4/29,up=6/29,cp=3*up*up,dp=up*up*up,pp=Math.PI/180,gp=180/Math.PI;function fp(t){return t>dp?Math.pow(t,1/3):t/cp+hp}function mp(t){return t>up?t*t*t:cp*(t-hp)}function yp(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _p(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function xp(t){const e=_p(t.r),i=_p(t.g),n=_p(t.b),r=fp((.4124564*e+.3575761*i+.1804375*n)/op),s=fp((.2126729*e+.7151522*i+.072175*n)/ap);return{l:116*s-16,a:500*(r-s),b:200*(s-fp((.0193339*e+.119192*i+.9503041*n)/lp)),alpha:t.a}}function vp(t){let 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=ap*mp(e),i=op*mp(i),n=lp*mp(n),new Sc(yp(3.2404542*i-1.5371385*e-.4985314*n),yp(-.969266*i+1.8760108*e+.041556*n),yp(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function wp(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const bp={forward:xp,reverse:vp,interpolate:function(t,e,i){return{l:rp(t.l,e.l,i),a:rp(t.a,e.a,i),b:rp(t.b,e.b,i),alpha:rp(t.alpha,e.alpha,i)}}},Cp={forward:function(t){const{l:e,a:i,b:n}=xp(t),r=Math.atan2(n,i)*gp;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*pp,i=t.c;return vp({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:wp(t.h,e.h,i),c:rp(t.c,e.c,i),l:rp(t.l,e.l,i),alpha:rp(t.alpha,e.alpha,i)}}};class Sp{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Ep(e,t.base,i,n);else if("linear"===t.name)r=Ep(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new np(s[0],s[1],s[2],s[3]).solve(Ep(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}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,Gc),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Wc:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Sp(a,i,n,r,o):e.error(`Type ${$c(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=Jd(e,n),o=e[s],a=e[s+1],l=Sp.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?sp[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?Cp.reverse(Cp.interpolate(Cp.forward(h),Cp.forward(u),l)):bp.reverse(bp.interpolate(bp.forward(h),bp.forward(u),l))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Ep(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}var Tp=Sp;class Rp{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}const s=n&&r.some((t=>Hc(n,t.type)));return new Rp(s?Bc:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(t),i&&i instanceof nd&&!i.available&&(e||(e=i),i=null,n===this.args.length))return e;if(null!==i)break}return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Ip=Rp;class Mp{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Mp(i,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,i]of this.bindings)t.push(e,i.serialize());return t.push(this.result.serialize()),t}}var kp=Mp;class Fp{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Gc),n=e.parse(t[2],2,Uc(e.expectedType||Bc));if(!i||!n)return null;const r=n.type;return new Fp(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new ud(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new ud(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ud(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Pp=Fp;class Lp{constructor(t,e){this.type=qc,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bc),n=e.parse(t[2],2,Bc);return i&&n?Jc(i.type,[qc,Nc,Gc,jc,Bc])?new Lp(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${$c(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!Qc(e,["boolean","string","number","null"]))throw new ud(`Expected first argument to be of type boolean, string, number or null, but found ${$c(od(e))} instead.`);if(!Qc(i,["string","array"]))throw new ud(`Expected second argument to be of type array or string, but found ${$c(od(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Ap=Lp;class Dp{constructor(t,e,i){this.type=Gc,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bc),n=e.parse(t[2],2,Bc);if(!i||!n)return null;if(!Jc(i.type,[qc,Nc,Gc,jc,Bc]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${$c(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Gc);return r?new Dp(i,n,r):null}return new Dp(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Qc(e,["boolean","string","number","null"]))throw new ud(`Expected first argument to be of type boolean, string, number or null, but found ${$c(od(e))} instead.`);if(!Qc(i,["string","array"]))throw new ud(`Expected second argument to be of type array or string, but found ${$c(od(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Op=Dp;class zp{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(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.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const h=e.concat(o);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,od(t)))return null}else i=od(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,Bc);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new zp(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(od(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)1===n.length?t.push(r(n[0])):t.push(n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}var jp=zp;class Gp{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const s=e.parse(t[r],r,qc);if(!s)return null;const o=e.parse(t[r+1],r+1,i);if(!o)return null;n.push([s,o]),i=i||o.type}const r=e.parse(t[t.length-1],t.length-1,i);return r?new Gp(i,n,r):null}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Np=Gp;class qp{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bc),n=e.parse(t[2],2,Gc);if(!i||!n)return null;if(!Jc(i.type,[Uc(Bc),Nc,Bc]))return e.error(`Expected first argument to be of type array or string, but found ${$c(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Gc);return r?new qp(i.type,i,n,r):null}return new qp(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Qc(e,["string","array"]))throw new ud(`Expected first argument to be of type array or string, but found ${$c(od(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var Wp=qp;function Xp(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Bp(t,e,i,n){return 0===n.compare(e,i)}function Vp(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=qc,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,Bc);if(!s)return null;if(!Xp(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${$c(s.type)}'.`);let o=e.parse(t[2],2,Bc);if(!o)return null;if(!Xp(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${$c(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${$c(s.type)}' and '${$c(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new pd(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new pd(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Vc),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=od(s),i=od(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ud(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=od(s),i=od(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const Yp=Vp("==",(function(t,e,i){return e===i}),Bp),Zp=Vp("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Bp(0,e,i,n)})),Up=Vp("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),$p=Vp(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),Kp=Vp("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),Hp=Vp(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class Jp{constructor(t,e,i,n,r,s){this.type=Nc,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Gc);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,Nc),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,Nc),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,Nc),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,Gc),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,Gc),!l)?null:new Jp(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.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]}}class Qp{constructor(t){this.type=Gc,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const 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 ${$c(i.type)} instead.`):new Qp(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ud(`Expected value to be of type string or array, but found ${$c(od(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const tg={"==":Yp,"!=":Zp,">":$p,"<":Up,">=":Hp,"<=":Kp,array:pd,at:Pp,boolean:pd,case:Np,coalesce:Ip,collator:Cd,format:gd,image:fd,in:Ap,"index-of":Op,interpolate:Tp,"interpolate-hcl":Tp,"interpolate-lab":Tp,length:Qp,let:kp,literal:hd,match:jp,number:pd,"number-format":Jp,object:pd,slice:Wp,step:tp,string:pd,"to-boolean":_d,"to-color":_d,"to-number":_d,"to-string":_d,var:Ud,within:Xd};function eg(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=rd(e,i,n,s);if(o)throw new ud(o);return new Sc(e/255*s,i/255*s,n/255*s,s)}function ig(t,e){return t in e}function ng(t,e){const i=e[t];return void 0===i?null:i}function rg(t){return{type:t}}bd.register(tg,{error:[{kind:"error"},[Nc],(t,[e])=>{throw new ud(e.evaluate(t))}],typeof:[Nc,[Bc],(t,[e])=>$c(od(e.evaluate(t)))],"to-rgba":[Uc(Gc,4),[Wc],(t,[e])=>e.evaluate(t).toArray()],rgb:[Wc,[Gc,Gc,Gc],eg],rgba:[Wc,[Gc,Gc,Gc,Gc],eg],has:{type:qc,overloads:[[[Nc],(t,[e])=>ig(e.evaluate(t),t.properties())],[[Nc,Xc],(t,[e,i])=>ig(e.evaluate(t),i.evaluate(t))]]},get:{type:Bc,overloads:[[[Nc],(t,[e])=>ng(e.evaluate(t),t.properties())],[[Nc,Xc],(t,[e,i])=>ng(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Bc,[Nc],(t,[e])=>ng(e.evaluate(t),t.featureState||{})],properties:[Xc,[],t=>t.properties()],"geometry-type":[Nc,[],t=>t.geometryType()],id:[Bc,[],t=>t.id()],zoom:[Gc,[],t=>t.globals.zoom],pitch:[Gc,[],t=>t.globals.pitch||0],"distance-from-center":[Gc,[],t=>t.distanceFromCenter()],"heatmap-density":[Gc,[],t=>t.globals.heatmapDensity||0],"line-progress":[Gc,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Gc,[],t=>t.globals.skyRadialProgress||0],accumulated:[Bc,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Gc,rg(Gc),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[Gc,rg(Gc),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:Gc,overloads:[[[Gc,Gc],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Gc],(t,[e])=>-e.evaluate(t)]]},"/":[Gc,[Gc,Gc],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Gc,[Gc,Gc],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Gc,[],()=>Math.LN2],pi:[Gc,[],()=>Math.PI],e:[Gc,[],()=>Math.E],"^":[Gc,[Gc,Gc],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[Gc,[Gc],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Gc,[Gc],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Gc,[Gc],(t,[e])=>Math.log(e.evaluate(t))],log2:[Gc,[Gc],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Gc,[Gc],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Gc,[Gc],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Gc,[Gc],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Gc,[Gc],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Gc,[Gc],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Gc,[Gc],(t,[e])=>Math.atan(e.evaluate(t))],min:[Gc,rg(Gc),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Gc,rg(Gc),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Gc,[Gc],(t,[e])=>Math.abs(e.evaluate(t))],round:[Gc,[Gc],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Gc,[Gc],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Gc,[Gc],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[qc,[Nc,Bc],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[qc,[Bc],(t,[e])=>t.id()===e.value],"filter-type-==":[qc,[Nc],(t,[e])=>t.geometryType()===e.value],"filter-<":[qc,[Nc,Bc],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[qc,[Bc],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[qc,[Nc,Bc],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[qc,[Bc],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[qc,[Nc,Bc],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[qc,[Bc],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[qc,[Nc,Bc],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[qc,[Bc],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[qc,[Bc],(t,[e])=>e.value in t.properties()],"filter-has-id":[qc,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[qc,[Uc(Nc)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[qc,[Uc(Bc)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[qc,[Nc,Uc(Bc)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[qc,[Nc,Uc(Bc)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:qc,overloads:[[[qc,qc],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[rg(qc),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:qc,overloads:[[[qc,qc],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[rg(qc),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[qc,[qc],(t,[e])=>!e.evaluate(t)],"is-supported-script":[qc,[Nc],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Nc,[Nc],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Nc,[Nc],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Nc,rg(Bc),(t,e)=>e.map((e=>ad(e.evaluate(t)))).join("")],"resolved-locale":[Nc,[Vc],(t,[e])=>e.evaluate(t).resolvedLocale()]});var sg=tg;function og(t){return{result:"success",value:t}}function ag(t){return{result:"error",value:t}}function lg(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class hg{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new vd,this._defaultValue=e?function(t){return"color"===t.type&&(lg(t.default)||Array.isArray(t.default))?new Sc(0,0,0,0):"color"===t.type?Sc.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ud(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function ug(t,e){const i=new Kd(sg,[],e?function(t){const e={color:Wc,string:Nc,number:Gc,enum:Nc,boolean:qc,formatted:Yc,resolvedImage:Zc};if("array"===t.type)return Uc(e[t.value]||Bc,t.length);return e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?og(new hg(n,e)):ag(i.errors)}class cg{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Vd(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}}class dg{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Vd(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?Tp.interpolationFactor(this.interpolationType,t,e,i):0}}function pg(t,e){if("error"===(t=ug(t,e)).result)return t;const i=t.value.expression,n=Bd(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return ag([new Dc("","data expressions not supported")]);const r=Yd(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return ag([new Dc("","zoom expressions not supported")]);const s=gg(i);if(!s&&!r)return ag([new Dc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Dc)return ag([s]);if(s instanceof Tp&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return ag([new Dc("",'"interpolate" expressions cannot be used with this property')]);if(!s)return og(new cg(n?"constant":"source",t.value));const o=s instanceof Tp?s.interpolation:void 0;return og(new dg(n?"camera":"composite",t.value,s.labels,o))}function gg(t){let e=null;if(t instanceof kp)e=gg(t.result);else if(t instanceof Ip){for(const i of t.args)if(e=gg(i),e)break}else(t instanceof tp||t instanceof Tp)&&t.input instanceof bd&&"zoom"===t.input.name&&(e=t);return e instanceof Dc||t.eachChild((t=>{const i=gg(t);i instanceof Dc?e=i:!e&&i?e=new Dc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Dc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function fg(t){if(Array.isArray(t))return t.map(fg);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=fg(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var mg={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},projection:{type:"projection"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"},"fill-extrusion-edge-radius":{type:"number",private:!0,default:0,minimum:0,maximum:1,"property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_symbol:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature","pitch","distance-from-center"]}},filter_fill:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_line:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_circle:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},"filter_fill-extrusion":{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_heatmap:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant",type:"number",private:!0,default:0,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant",type:"number",private:!0,default:3,minimum:0,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["fill-extrusion-edge-radius"]}},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:!1,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"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"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function yg(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(const e of t.slice(1))if(!yg(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function _g(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};yg(t)||(t=Eg(t));const i=t;let n=!0;try{n=function(t){if(!wg(t))return t;let e=fg(t);return vg(e),e=xg(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const r=mg[`filter_${e}`],s=ug(n,r);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,i)=>s.value.evaluate(t,e,{},i);let a=null,l=null;if(n!==i){const t=ug(i,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,i,n,r,s)=>t.value.evaluate(e,i,{},n,void 0,void 0,r,s),l=!Bd(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:Sg(n),needFeature:!!l}}function xg(t){if(!Array.isArray(t))return t;const e=function(t){if(bg.has(t[0]))for(let e=1;e<t.length;e++){if(wg(t[e]))return!0}return t}(t);return!0===e?e:e.map((t=>xg(t)))}function vg(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||wg(t[n]),i.push(t[n+1]);i.push(t[t.length-1])}else if("match"===t[0]){e=e||wg(t[1]);for(let e=2;e<t.length-1;e+=2)i.push(t[e+1]);i.push(t[t.length-1])}else if("step"===t[0]){e=e||wg(t[1]);for(let e=1;e<t.length-1;e+=2)i.push(t[e+1])}e&&(t.length=0,t.push("any",...i));for(let e=1;e<t.length;e++)vg(t[e])}function wg(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;var e;for(let e=1;e<t.length;e++){if(wg(t[e]))return!0}return!1}const bg=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Cg(t,e){return t<e?-1:t>e?1:0}function Sg(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Sg(t[e]))return!0;return!1}function Eg(t){if(!t)return!0;const e=t[0];if(t.length<=1)return"any"!==e;var i;return"=="===e?Tg(t[1],t[2],"=="):"!="===e?Mg(Tg(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Tg(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Eg))):"all"===e?["all"].concat(t.slice(1).map(Eg)):"none"===e?["all"].concat(t.slice(1).map(Eg).map(Mg)):"in"===e?Rg(t[1],t.slice(2)):"!in"===e?Mg(Rg(t[1],t.slice(2))):"has"===e?Ig(t[1]):"!has"===e?Mg(Ig(t[1])):"within"!==e||t}function Tg(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 Rg(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((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Cg)]]:["filter-in-small",t,["literal",e]]}}function Ig(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Mg(t){return["!",t]}var kg=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Fg(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return kg.forEach((t=>{t in e&&(i[t]=e[t])})),i}function Pg(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Fg(t[i],e[t[i].ref]));return t}var Lg={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},Ag=" ",Dg=/(italic|oblique)$/i,Og={},zg=fc((function(t,e,i){var n=Og[t];if(!n){Array.isArray(t)||(t=[t]);for(var r=400,s="normal",o=[],a=0,l=t.length;a<l;++a){var h=t[a].split(" "),u=h[h.length-1].toLowerCase();for(var c in"normal"==u||"italic"==u||"oblique"==u?(s=u,h.pop(),u=h[h.length-1].toLowerCase()):Dg.test(u)&&(u=u.replace(Dg,""),s=h[h.length-1].replace(u,"")),Lg){var d=h.length>1?h[h.length-2].toLowerCase():"";if(u==c||u==c.replace("-","")||d+"-"+u==c){r=Lg[c],h.pop(),d&&c.startsWith(d)&&h.pop();break}}"number"==typeof u&&(r=u);var p=h.join(Ag).replace("Klokantech Noto Sans","Noto Sans");-1!==p.indexOf(Ag)&&(p='"'+p+'"'),o.push(p)}n=Og[t]=[s,r,o]}return n[0]+Ag+n[1]+Ag+e+"px"+(i?"/"+i:"")+Ag+n[2]}));const jg="https://api.mapbox.com";function Gg(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function Ng(t,e){const i=Gg(t);if(!i)return decodeURI(new URL(t,location.href).href);const n="styles/";if(0!==i.indexOf(n))throw new Error(`unexpected style url: ${t}`);const r=i.slice(7);return`${jg}/styles/v1/${r}?&access_token=${e}`}function qg(t,e,i,n){const r=new URL(t,n),s=Gg(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),decodeURI(r.href)):decodeURI(r.href);if("mapbox.satellite"===s){return`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${e}`}return`https://{a-d}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`}const Wg={},Xg={};let Bg=0;function Vg(t){return t.id||(t.id=Bg++),t.id}function Yg(t){let e=Wg[t.id];return e||(e={},Wg[Vg(t)]=e),e}function Zg(t){return t*Math.PI/180}const Ug=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}(),$g=new $a({extent:di("EPSG:3857").getExtent(),resolutions:Ug});function Kg(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function Hg(t,e){let i=0;const n=e.length;for(;i<n;++i){if(e[i]<t&&i+1<n){const n=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(n)}}return n-1}const Jg={};function Qg(t,e,i={},n){if(e in Jg)return n&&(n.request=Jg[e][0]),Jg[e][1];const r=i.transformRequest&&i.transformRequest(e,t)||e,s=d((()=>r)).then((t=>(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),n&&(n.request=t),fetch(t).then((function(t){return delete Jg[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete Jg[e],Promise.reject(new Error("Error fetching source "+e))})))));return Jg[e]=[r,s],s}function tf(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return Qg("Style",t=Ng(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const ef={};function nf(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=ef[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof Rh)t.setLoader(((e,i,r)=>{d((()=>n)).then((i=>{fetch(i).then((t=>t.arrayBuffer())).then((i=>{const n=t.getFormat().readFeatures(i,{extent:e,featureProjection:r});t.setFeatures(n)})).catch((e=>t.setState(jo.ERROR)))}))}));else{const e=t.getImage();d((()=>n)).then((i=>{i instanceof Request?fetch(i).then((t=>t.blob())).then((t=>{const i=URL.createObjectURL(t);e.addEventListener("load",(()=>URL.revokeObjectURL(i))),e.addEventListener("error",(()=>URL.revokeObjectURL(i))),e.src=i})).catch((e=>t.setState(jo.ERROR))):e.src=i}))}});const o=t.url;if(o&&!t.tiles){const n=qg(o,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:kh(n)}),tileLoadFunction:s});else{const t={};r=Qg("Source",n,i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),qg(n,i.accessToken,i.accessTokenParam||"access_token",t.request.url)})),Promise.resolve({tileJson:e,tileLoadFunction:s})}))}}else t=Object.assign({},t,{tiles:t.tiles.map((function(n){return"tms"===t.scheme&&(n=n.replace("{y}","{-y}")),qg(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s});ef[n]=r}return r}function rf(t,e,i,n){const r=document.createElement("canvas"),s=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height];r.width=s[0],r.height=s[1];const o=r.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,s[0],s[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t<n;++t)for(let r=0,s=a.height;r<s;++r){l[4*(r*n+t)+3]>0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),r}function sf(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function of(t,e,i){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t<e;++t)for(let n=0,r=s.height;n<r;++n){const r=4*(n*e+t),s=.75,a=.1,l=sf(s-a,s+a,o[r+3]/255);l>0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const af=Array(256).join(" ");function lf(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=af.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t<e;++t)t>0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let hf;function uf(){return hf||(hf=Kg(1,1).getContext("2d")),hf}function cf(t,e){return uf().measureText(t).width+(t.length-1)*e}const df={};function pf(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t<o;++t)s.push(pf(r[t],e,i,n));return s.join("\n")}const r=i+","+e+","+t+","+n;let s=df[r];if(!s){const o=t.split(" ");if(o.length>1){const t=uf();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t<e;++t){const e=o[t],i=a+(a?" ":"")+e;cf(i,n)<=r?a=i:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,e=l.length;t<e&&e>1;++t){const i=l[t];if(cf(i,n)<.35*r){const r=t>0?cf(l[t-1],n):1/0,s=t<e-1?cf(l[t+1],n):1/0;l.splice(t,1),e-=1,r<s?(l[t-1]+=" "+i,t-=1):l[t]=i+" "+l[t]}}for(let t=0,e=l.length-1;t<e;++t){const i=l[t],s=l[t+1];if(cf(i,n)>.7*r&&cf(s,n)<.6*r){const o=i.split(" "),a=o.pop();cf(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=lf(s,n),df[r]=s}return s}const gf=/font-family: ?([^;]*);/,ff=/("|')/g;let mf;function yf(t){if(!mf){mf={};const t=document.styleSheets;for(let e=0,i=t.length;e<i;++e){const i=t[e];try{const t=i.rules||i.cssRules;if(t)for(let e=0,i=t.length;e<i;++e){const i=t[e];if(5==i.type){const t=i.cssText.match(gf);mf[t[1].replace(ff,"")]=!0}}}catch(t){}}}return t in mf}const _f={};function xf(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){const i=t.toString();if(i in _f)return _f[i];const n=[];for(let e=0,i=t.length;e<i;++e){t[e]=t[e].replace("Arial Unicode MS","Arial");const i=t[e],r=zg(i,1);ns(r);const s=r.split(" ");n.push([s.slice(3).join(" ").replace(/"/g,""),s[1],s[0]])}for(let t=0,i=n.length;t<i;++t){const i=n[t],r=i[0];if(!yf(r)&&100!==Qr.get(`${i[2]}\n${i[1]} \n${r}`)){const t=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",i[1]).replace("{-fontstyle}",i[2].replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",i[2]);if(!document.querySelector('link[href="'+t+'"]')){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}}}return _f[i]=t,t}const vf={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},wf={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},bf=function(t,e){const i=pg(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value},Cf={},Sf={zoom:0};let Ef,Tf;function Rf(t,e,i,n,r,s,o){const a=t.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[a]||(s[a]={});const l=s[a];if(!l[i]){let n=(t[e]||Cf)[i];const r=mg[`${e}_${t.type}`][i];void 0===n&&(n=r.default);let s=(h=n,Array.isArray(h)&&h.length>0&&"string"==typeof h[0]&&h[0]in sg);if(!s&&lg(n)&&(n=Tc(n,r),s=!0),s){const t=bf(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=Sc.parse(n)),l[i]=function(){return n}}var h;return Sf.zoom=n,l[i](Sf,r,o)}function If(t,e,i,n,r){if(!Rf(t,"layout",`${n}-allow-overlap`,e,i,r))return"declutter";return Rf(t,"layout",`${n}-ignore-placement`,e,i,r)?"none":"obstacle"}function Mf(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=_g(e).filter),Sf.zoom=n,r[t](Sf,i)}function kf(t,e){if(t){if(0===t.a||0===e)return;const 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}const Ff=/\{[^{}}]*\}/g;function Pf(t,e){return t.replace(Ff,(function(t){return e[t.slice(1,-1)]||""}))}const Lf={};function Af(t,e,i,n=Ug,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");let l,h,u;if(Lf[function(t,e){return Vg(t)+"."+P(e)}(e,t)]=Array.from(arguments),s)if("undefined"!=typeof Image){const e=new Image;let i;d((()=>s)).then((t=>{t instanceof Request?fetch(t).then((t=>t.blob())).then((t=>{i=URL.createObjectURL(t),e.src=i})).catch((()=>{})):(e.crossOrigin="anonymous",e.src=t,i&&URL.revokeObjectURL(i))})),e.onload=function(){l=e,h=[e.width,e.height],t.changed(),e.onload=null}}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:s}),t.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===s&&(l=t.data.image,h=[l.width,l.height])}))}const c=Pg(e.layers),p={},g=[],f={},m={},y=Yg(e),_=function(t){let e=Xg[t.id];return e||(e={},Xg[Vg(t)]=e),e}(e);let x;for(let t=0,n=c.length;t<n;++t){const n=c[t],r=n.id;if("string"==typeof i&&n.source==i||Array.isArray(i)&&-1!==i.indexOf(r)){const i=n["source-layer"];if(x){if(n.source!==x)throw new Error(`Layer "${r}" does not use source "${x}`)}else{x=n.source;const t=e.sources[x];if(!t)throw new Error(`Source "${x}" is not defined`);const i=t.type;if("vector"!==i&&"geojson"!==i)throw new Error(`Source "${x}" is not of type "vector" or "geojson", but "${i}"`)}let s=p[i];s||(s=[],p[i]=s),s.push({layer:n,index:t}),g.push(r)}}const v=new ds,w=new cs,b=[],C=function(i,s,c){const d=i.getProperties(),g=p[d.layer];if(!g)return;let x=n.indexOf(s);-1==x&&(x=Hg(s,n));const C=vf[i.getGeometry().getType()],S={id:i.getId(),properties:d,type:C},E=t.get("mapbox-featurestate")[i.getId()];let T=-1;for(let n=0,p=g.length;n<p;++n){const p=g[n],R=p.layer,I=R.id;if(void 0!==c&&c!==I)continue;const M=R.layout||Cf,k=R.paint||Cf;if("none"===M.visibility||"minzoom"in R&&x<R.minzoom||"maxzoom"in R&&x>=R.maxzoom)continue;const F=R.filter;if(!F||Mf(I,F,S,x,_)){let n,c,g,_,I,F;const P=p.index;if(3==C&&("fill"==R.type||"fill-extrusion"==R.type))if(c=Rf(R,"paint",R.type+"-opacity",x,S,y,E),R.type+"-pattern"in k){const t=Rf(R,"paint",R.type+"-pattern",x,S,y,E);if(t){const e="string"==typeof t?Pf(t,d):t.toString();if(l&&r&&r[e]){++T,F=b[T],F&&F.getFill()&&!F.getStroke()&&!F.getText()||(F=new ys({fill:new cs}),b[T]=F),g=F.getFill(),F.setZIndex(P);const t=e+"."+c;let i=m[t];if(!i){const n=r[e],s=Kg(n.width,n.height),o=s.getContext("2d");o.globalAlpha=c,o.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i=o.createPattern(s,"repeat"),m[t]=i}g.setColor(i)}}}else n=kf(Rf(R,"paint",R.type+"-color",x,S,y,E),c),R.type+"-outline-color"in k&&(I=kf(Rf(R,"paint",R.type+"-outline-color",x,S,y,E),c)),I||(I=n),(n||I)&&(++T,F=b[T],(!F||n&&!F.getFill()||!n&&F.getFill()||I&&!F.getStroke()||!I&&F.getStroke()||F.getText())&&(F=new ys({fill:n?new cs:void 0,stroke:I?new ds:void 0}),b[T]=F),n&&(g=F.getFill(),g.setColor(n)),I&&(_=F.getStroke(),_.setColor(I),_.setWidth(.5)),F.setZIndex(P));if(1!=C&&"line"==R.type){n="line-pattern"in k?void 0:kf(Rf(R,"paint","line-color",x,S,y,E),Rf(R,"paint","line-opacity",x,S,y,E));const t=Rf(R,"paint","line-width",x,S,y,E);n&&t>0&&(++T,F=b[T],F&&F.getStroke()&&!F.getFill()&&!F.getText()||(F=new ys({stroke:new ds}),b[T]=F),_=F.getStroke(),_.setLineCap(Rf(R,"layout","line-cap",x,S,y,E)),_.setLineJoin(Rf(R,"layout","line-join",x,S,y,E)),_.setMiterLimit(Rf(R,"layout","line-miter-limit",x,S,y,E)),_.setColor(n),_.setWidth(t),_.setLineDash(k["line-dasharray"]?Rf(R,"paint","line-dasharray",x,S,y,E).map((function(e){return e*t})):null),F.setZIndex(P))}let L,A,D,O,z,j,G,N,q,W=!1,X=null,B=0;if((1==C||2==C)&&"icon-image"in M){const e=Rf(R,"layout","icon-image",x,S,y,E);if(e){let n;L="string"==typeof e?Pf(e,d):e.toString();const o=a?a(t,L):void 0;if(l&&r&&r[L]||o){const t=Rf(R,"layout","icon-rotation-alignment",x,S,y,E);if(2==C){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();Tf||(Ef=[NaN,NaN],Tf=new qa("Point",Ef,[],2,{},void 0)),n=Tf,Ef[0]=i[0],Ef[1]=i[1];if("line"===Rf(R,"layout","symbol-placement",x,S,y,E)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e<r;e+=t){const r=n[e],s=n[e+1],o=n[e+t],a=n[e+t+1],l=Math.min(r,o),h=Math.min(s,a),u=Math.max(r,o),c=Math.max(s,a);if(i[0]>=l&&i[0]<=u&&i[1]>=h&&i[1]<=c){B=Math.atan2(s-a,o-r);break}}}}}}if(2!==C||n){const e=Rf(R,"layout","icon-size",x,S,y,E),i=void 0!==k["icon-color"]?Rf(R,"paint","icon-color",x,S,y,E):null;if(!i||0!==i.a){const n=Rf(R,"paint","icon-halo-color",x,S,y,E),s=Rf(R,"paint","icon-halo-width",x,S,y,E);let a=`${L}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),A=f[a],!A){const c=If(R,x,S,"icon",y);let d;"icon-offset"in M&&(d=Rf(R,"layout","icon-offset",x,S,y,E).slice(0),d[0]*=e,d[1]*=-e);let p=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:p,rotateWithView:"map"===t,displacement:d,declutterMode:c,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),A=new xs(i)}else{const o=r[L];let a,g,f;s?o.sdf?(a=rf(of(l,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),p=void 0):a=rf(l,o,s,n):(o.sdf?(u||(u=of(l,{x:0,y:0,width:h[0],height:h[1]},{r:1,g:1,b:1,a:1})),a=u):a=l,g=[o.width,o.height],f=[o.x,o.y]),A=new xs({color:p,img:a,imgSize:h,size:g,offset:f,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:d,declutterMode:c})}f[a]=A}}A&&(++T,F=b[T],F&&F.getImage()&&!F.getFill()&&!F.getStroke()||(F=new ys,b[T]=F),F.setGeometry(n),A.setRotation(B+Zg(Rf(R,"layout","icon-rotate",x,S,y,E))),A.setOpacity(Rf(R,"paint","icon-opacity",x,S,y,E)),A.setAnchor(wf[Rf(R,"layout","icon-anchor",x,S,y,E)]),F.setImage(A),X=F.getText(),F.setText(void 0),F.setZIndex(P),W=!0,D=!1)}else D=!0}}}if(1==C&&"circle"===R.type){++T,F=b[T],F&&F.getImage()&&!F.getFill()&&!F.getStroke()||(F=new ys,b[T]=F);const t="circle-radius"in k?Rf(R,"paint","circle-radius",x,S,y,E):5,e=kf(Rf(R,"paint","circle-stroke-color",x,S,y,E),Rf(R,"paint","circle-stroke-opacity",x,S,y,E)),i=Rf(R,"paint","circle-translate",x,S,y,E),n=kf(Rf(R,"paint","circle-color",x,S,y,E),Rf(R,"paint","circle-opacity",x,S,y,E)),r=Rf(R,"paint","circle-stroke-width",x,S,y,E),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];A=f[s],A||(A=new us({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new ds({width:r,color:e}):void 0,fill:n?new cs({color:n}):void 0,declutterMode:"none"}),f[s]=A),F.setImage(A),X=F.getText(),F.setText(void 0),F.setGeometry(void 0),F.setZIndex(P),W=!0}if("text-field"in M){G=Math.round(Rf(R,"layout","text-size",x,S,y,E));const t=Rf(R,"layout","text-font",x,S,y,E);j=Rf(R,"layout","text-line-height",x,S,y,E),z=zg(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,G,j),z.includes("sans-serif")||(z+=",sans-serif"),N=Rf(R,"layout","text-letter-spacing",x,S,y,E),q=Rf(R,"layout","text-max-width",x,S,y,E);const i=Rf(R,"layout","text-field",x,S,y,E);O="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce(((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=zg(o?o(r):r,G*(i.scale||1),j);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2!=C){a=pf(a,s,q,N).split("\n");for(let t=0,i=a.length;t<i;++t)t>0&&e.push("\n",""),e.push(a[t],s);return e}e.push(lf(a,N),s)}),[]):Pf(i,d).trim(),c=Rf(R,"paint","text-opacity",x,S,y,E)}if(O&&c&&!D){W||(++T,F=b[T],F&&F.getText()&&!F.getFill()&&!F.getStroke()||(F=new ys,b[T]=F),F.setImage(void 0),F.setGeometry(void 0));const t=If(R,x,S,"text",y);F.getText()||F.setText(X),X=F.getText(),(!X||"getDeclutterMode"in X&&X.getDeclutterMode()!==t)&&(X=new vs({padding:[2,2,2,2],declutterMode:t}),F.setText(X));const e=Rf(R,"layout","text-transform",x,S,y,E);"uppercase"==e?O=Array.isArray(O)?O.map(((t,e)=>e%2?t:t.toUpperCase())):O.toUpperCase():"lowercase"==e&&(O=Array.isArray(O)?O.map(((t,e)=>e%2?t:t.toLowerCase())):O.toLowerCase());const i=Array.isArray(O)?O:2==C?lf(O,N):pf(O,z,q,N);X.setText(i),X.setFont(z),X.setRotation(Zg(Rf(R,"layout","text-rotate",x,S,y,E)));const n=Rf(R,"layout","text-anchor",x,S,y,E),r=W||1==C?"point":Rf(R,"layout","symbol-placement",x,S,y,E);let s;if("line-center"===r?(X.setPlacement("line"),s="center"):X.setPlacement(r),"line"===r&&"function"==typeof X.setRepeat){const t=Rf(R,"layout","symbol-spacing",x,S,y,E);X.setRepeat(2*t)}X.setOverflow("point"===r);let o=Rf(R,"paint","text-halo-width",x,S,y,E);const a=Rf(R,"layout","text-offset",x,S,y,E),l=Rf(R,"paint","text-translate",x,S,y,E);let h=0,u=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",u=o):-1!==n.indexOf("right")&&(s="right",u=-o);const t=Rf(R,"layout","text-rotation-alignment",x,S,y,E);X.setRotateWithView("map"==t)}else X.setMaxAngle(Zg(Rf(R,"layout","text-max-angle",x,S,y,E))*O.length/i.length),X.setRotateWithView(!1);X.setTextAlign(s);let d="middle";0==n.indexOf("bottom")?(d="bottom",h=-o-.5*(j-1)*G):0==n.indexOf("top")&&(d="top",h=o+.5*(j-1)*G),X.setTextBaseline(d);const p=Rf(R,"layout","text-justify",x,S,y,E);X.setJustify("auto"===p?void 0:p),X.setOffsetX(a[0]*G+u+l[0]),X.setOffsetY(a[1]*G+h+l[1]),w.setColor(kf(Rf(R,"paint","text-color",x,S,y,E),c)),X.setFill(w);const g=kf(Rf(R,"paint","text-halo-color",x,S,y,E),c);if(g&&o>0){v.setColor(g),o*=2;const t=.5*G;v.setWidth(o<=t?o:t),X.setStroke(v)}else X.setStroke(void 0);const f=Rf(R,"layout","text-padding",x,S,y,E),m=X.getPadding();f!==m[0]&&(m[0]=f,m[1]=f,m[2]=f,m[3]=f),F.setZIndex(P)}}}return T>-1?(b.length=T+1,b):void 0};return t.setStyle(C),t.set("mapbox-source",x),t.set("mapbox-layers",g),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),C}function Df(t,e){const i=t[0],n=i.width,r=i.height,s=i.data,o=new Uint8ClampedArray(s.length),a=2*e.resolution,l=n-1,h=r-1,u=[0,0,0,0],c=2*Math.PI,d=Math.PI/2,p=Math.PI*e.sunEl/180,g=Math.PI*e.sunAz/180,f=Math.cos(p),m=Math.sin(p),y=e.highlightColor,_=e.shadowColor,x=e.accentColor,v=e.encoding;let w,b,C,S,E,T,R,I,M,k,F,P,L,A,D,O,z,j,G,N,q,W;function X(t,e="mapbox"){return"mapbox"===e?.1*(256*t[0]*256+256*t[1]+t[2])-1e4:"terrarium"===e?256*t[0]+t[1]+t[2]/256-32768:void 0}for(b=0;b<=h;++b)for(E=0===b?0:b-1,T=b===h?h:b+1,w=0;w<=l;++w)C=0===w?0:w-1,S=w===l?l:w+1,R=4*(b*n+C),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*X(u,v),R=4*(b*n+S),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],M=e.vert*X(u,v),k=(M-I)/a,R=4*(E*n+w),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*X(u,v),R=4*(T*n+w),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],M=e.vert*X(u,v),F=(M-I)/a,L=Math.atan2(F,-k),L=L<0?d-L:L>d?c-L+d:d-L,P=Math.atan(Math.sqrt(k*k+F*F)),W=m*Math.cos(P)+f*Math.sin(P)*Math.cos(g-L),A=Math.cos(P),D=255*W,G=Math.min(Math.max(2*e.sunEl,0),1),N=1.875-1.75*e.opacity,q=.5!==e.opacity?d*((Math.pow(N,P)-1)/(Math.pow(N,d)-1)):P,z={r:(1-A)*x.r*G*255,g:(1-A)*x.g*G*255,b:(1-A)*x.b*G*255,a:(1-A)*x.a*G*255},O=Math.abs(((L+g)/Math.PI+.5)%2-1),j={r:(y.r*(1-O)+_.r*O)*D,g:(y.g*(1-O)+_.g*O)*D,b:(y.b*(1-O)+_.b*O)*D,a:(y.a*(1-O)+_.a*O)*D},R=4*(b*n+w),o[R]=z.r*(1-O)+j.r,o[R+1]=z.g*(1-O)+j.g,o[R+2]=z.b*(1-O)+j.b,o[R+3]=s[R+3]*e.opacity*G*Math.sin(q);return new ImageData(o,n,r)}function Of(t,e=512){return t.getExtent()?Gu({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():Ug}function zf(t,e){if(!e.accessToken){e=Object.assign({},e);new URL(t).searchParams.forEach(((t,i)=>{e.accessToken=t,e.accessTokenParam=i}))}return e}function jf(t,e,i="",n={},r=void 0){let s,o,a,l,h=!0;return"string"==typeof i||Array.isArray(i)?l=i:(a=i,l=a.source||a.layers,n=a),"string"==typeof n?(s=n,a={}):(s=n.styleUrl,a=n),!1===a.updateSource&&(h=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:Ng(s,a.accessToken),a=zf(s,a)),new Promise((function(i,n){tf(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof ih||t instanceof dc))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof dc?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find((function(t){return t.id===l[0]})).source:l:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===u})),l=o),!o)return n(new Error(`No ${u} source found in the glStyle.`));function c(){if(!h)return Promise.resolve();if(t instanceof dc)return Xf(e.sources[o],s,a).then((function(e){const i=t.getSource();if(i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof i.setUrls&&"function"==typeof e.getUrls&&i.setUrls(e.getUrls()),i.format_||(i.format_=e.format_),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===gc&&i.setTileLoadFunction(e.getTileLoadFunction()),yi(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e),!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())){const e=t.getSource().getTileGrid();t.setMaxResolution(e.getResolution(e.getMinZoom()))}}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=Yf(i,s,a));const r=t.getSource();return r?n!==r&&(r.getAttributions()||r.setAttributions(n.getAttributions()),r.format_||(r.format_=n.getFormat()),r.url_=n.getUrl()):t.setSource(n),Promise.resolve()}let d,p,g,f;function m(){if(f||e.sprite&&!p)f?(t.setStyle(f),c().then(i).catch(n)):n(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=di(a.projection).getUnits();"m"!==t&&(r=Ug.map((e=>e/ee[t])))}f=Af(t,e,l,r,p,g,xf,a.getImage),t.getStyle()?c().then(i).catch(n):n(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=new URL(function(t,e,i){const n=Gg(t);if(!n)return decodeURI(new URL(t,i).href);const r="sprites/";if(0!==n.indexOf(r))throw new Error(`unexpected sprites url: ${t}`);const s=n.slice(8);return`${jg}/styles/v1/${s}/sprite?access_token=${e}`}(e.sprite,a.accessToken,s||location.href));d=window.devicePixelRatio>=1.5?.5:1;const i=.5==d?"@2x":"";let r=t.origin+t.pathname+i+".json"+t.search;new Promise((function(e,i){Qg("Sprite",r,a).then(e).catch((function(n){r=t.origin+t.pathname+".json"+t.search,Qg("Sprite",r,a).then(e).catch(i)}))})).then((function(e){if(void 0===e&&n(new Error("No sprites found.")),p=e,g=t.origin+t.pathname+i+".png"+t.search,a.transformRequest){const t=a.transformRequest(g,"SpriteImage")||g;(t instanceof Request||t instanceof Promise)&&(g=t)}m()})).catch((function(t){n(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))}))}else m()})).catch(n)}))}const Gf={};function Nf(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function qf(t,e,i){const n=new lc({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=di(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=mi([i[0],i[1]],e),n=mi([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return di(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new $a({origin:l?Ue(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:Of(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?c.urls=r.tiles:c.url=r.tiles,c}function Wf(t,e,i){const n=document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new Zn({source:new rh({}),render(r){const s=function(t,e,i,n){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};r.paint=o;const a=Hg(e,i.resolutions||Ug);let l;const h=Rf(r,"paint","background-color",a,Gf,n);return void 0!==o["background-opacity"]&&(l=Rf(r,"paint","background-opacity",a,Gf,n)),"none"==s.visibility?void 0:kf(h,l)}(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function Xf(t,e,i){return new Promise((function(n,r){nf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=qf(t,e,i);s.tileLoadFunction=r,s.format=new pu,n(new pc(s))})).catch(r)}))}function Bf(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Vf(t,e,i){const n=new zu;return function(t,e,i){return new Promise((function(n,r){nf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new lc({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=qf(t,e,i).tileGrid,i.projection&&(s.projection=di(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=Bf(i);let r=o(t,e,i);if(-1!=r.indexOf(n)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(n,e.toString())}return r})),s.set("mapbox-source",t),n(s)})).catch((function(t){r(t)}))}))}(t,e,i).then((function(t){n.setSource(t)})).catch((function(){n.setSource(void 0)})),n}function Yf(t,e,i){const n=i.projection?new Nh({dataProjection:i.projection}):new Nh,r=t.data,s={};if("string"==typeof r){const s=qg(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=Bf(i);return s.replace(n,`${t.join(",")}`)},r=new xh({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{Qg("GeoJSON","function"==typeof e?e(t,n,s):e,i).then((t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)})).catch((e=>{r.removeLoadedExtent(t),a()}))},strategy:gh});return r.set("mapbox-source",t),r}const o=new xh({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{Qg("GeoJSON",s,i).then((t=>{const e=o.getFormat().readFeatures(t,{featureProjection:n});o.addFeatures(e),r(e)})).catch((e=>{o.removeLoadedExtent(t),a()}))}});return o}s.features=n.readFeatures(r,{featureProjection:"EPSG:3857"});const o=new xh(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function Zf(t,e,i){let n=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==n&&(n=r.frameState.viewState.zoom,delete i[t.id],function(t,e,i,n){const r=Rf(t,"paint","raster-opacity",i,Gf,n);e.setOpacity(r)}(t,e,n,i))}}function Uf(t,e,i,n){const r=Yg(t),s=t.layers,o=i.type,a=i.source||Nf(s,i.ref),l=t.sources[a];let h;if("background"==o)h=Wf(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new dc({declutter:!0,visible:!1});return Xf(t,e,i).then((function(e){e.set("mapbox-source",t),n.setSource(e)})).catch((function(t){n.setSource(void 0)})),n}(l,e,n);else if("raster"==l.type)h=Vf(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",Zf(i,h,r));else if("geojson"==l.type)h=function(t,e,i){return new ih({declutter:!0,source:Yf(t,e,i),visible:!1})}(l,e,n);else if("raster-dem"==l.type&&"hillshade"==i.type){const t=function(t,e,i){const n=Vf(t,e,i);return new Xh({source:new Ju({operationType:"image",operation:Df,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=t.resolution;const s=Hg(t.resolution,n.resolutions||Ug);e.encoding=l.encoding,e.vert=5*Rf(i,"paint","hillshade-exaggeration",s,Gf,r),e.sunAz=Rf(i,"paint","hillshade-illumination-direction",s,Gf,r),e.sunEl=35,e.opacity=.3,e.highlightColor=Rf(i,"paint","hillshade-highlight-color",s,Gf,r),e.shadowColor=Rf(i,"paint","hillshade-shadow-color",s,Gf,r),e.accentColor=Rf(i,"paint","hillshade-accent-color",s,Gf,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function $f(t,e,i,n){const r=[];let s=null;if(e instanceof Ra){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=n.projection?di(n.projection):s.getProjection();s=new Wn(Object.assign(s.getProperties(),{maxResolution:Ug[0]/ee[t.getUnits()],projection:n.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter(mi(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(Ug[0]/ee[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:i,options:n});const o=t.layers;let a,l,h,u=[];for(let s=0,c=o.length;s<c;++s){const c=o[s],d=c.type;"heatmap"!=d?(h=c.source||Nf(o,c.ref),h&&h==l||(u.length&&(r.push(Kf(a,u,t,i,e,n)),u=[]),a=Uf(t,i,c,n),a instanceof ih||a instanceof dc||(u=[]),l=a.get("mapbox-source")),u.push(c.id)):console.debug(`layers[${s}].type "${d}" not supported`)}return r.push(Kf(a,u,t,i,e,n)),Promise.all(r)}function Kf(t,e,i,n,r,s={}){let o=24,a=0;const l=i.layers;for(let t=0,i=l.length;t<i;++t){const i=l[t];-1!==e.indexOf(i.id)&&(o=Math.min("minzoom"in i?i.minzoom:0,o),a=Math.max("maxzoom"in i?i.maxzoom:24,a))}return new Promise((function(l,h){const u=function(){const u=t.getSource();if(u&&"error"!==u.getState()){if("getTileGrid"in u){const e=u.getTileGrid();if(e){const i=e.getMinZoom();(o>0||i>0)&&t.setMaxResolution(Math.min($g.getResolution(o),e.getResolution(i))+1e-9),a<24&&t.setMinResolution($g.getResolution(a)+1e-9)}}else o>0&&t.setMaxResolution($g.getResolution(o)+1e-9);u instanceof xh||u instanceof pc?jf(t,i,e,Object.assign({styleUrl:n},s)).then((function(){!function(t,e){function i(){const i=e.get("mapbox-style");if(!i)return;const n=Pg(i.layers),r=t.get("mapbox-layers"),s=n.filter((function(t){return r.includes(t.id)})).some((function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility}));t.get("visible")!==s&&t.setVisible(s)}t.on("change",i),i()}(t,r),l()})).catch(h):l()}else h(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const c=r.getLayers();-1===c.getArray().indexOf(t)&&c.push(t),t.getSource()?u():t.once("change:source",u)}))}const Hf=[{center:[0,405e4],zoom:2},{center:[-10026264.955714773,3498225.377934253],zoom:12.3},{center:[-8120333.846364162,-5972314.327727663],zoom:10.15},{center:[12700564.586161729,2575397.3413926377],zoom:13.8},{center:[8976666.32253083,814262.3154676007],zoom:15.7},{center:[1284003.7367688504,5950927.737276901],zoom:11.19},{center:[-8468554.506387988,5696886.564463913],zoom:10.11},{center:[707717.3609533564,6361291.958635207],zoom:10.02},{center:[3345381.3050933336,-216864.19183635892],zoom:13.9},{center:[3318257.9642649507,-1786301.1175574847],zoom:6.1},{center:[19365301.097574536,-5033096.120372388],zoom:10.77},{center:[-13542913.807564376,5913315.884147839],zoom:11.59},{center:[9680854.2477813,3231923.470902604],zoom:8.06},{center:[-10341383.185823392,1826844.1155603195],zoom:9.27},{center:[3232422.751942559,5017252.706810253],zoom:12.25},{center:[-16373943.169136822,8651360.275919426],zoom:8.49},{center:[12475943.19806142,4172022.2635435928],zoom:9.91}],Jf=document.getElementById("map"),Qf=new Ra({target:Jf,view:new Wn(Hf[Math.random()*Hf.length|0])});Qf.addControl(new class extends tt{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⤢";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(x,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${ot} ${lt}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(mt(e))if(yt(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():_t(t)}(i):_t(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=yt(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(J(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(gt)):(J(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(ft)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(nt,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(nt,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e<i;++e)I(t[e]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();mt(i)?this.element.classList.remove(at):this.element.classList.add(at);for(let e=0,n=pt.length;e<n;++e)t.push(T(i,pt[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}),function(t,e,i={}){let n,r;if(r="string"==typeof t||t instanceof HTMLElement?new Ra({target:t}):t,"string"==typeof e){const t=e.startsWith("data:")?location.href:Ng(e,i.accessToken);i=zf(t,i),n=new Promise((function(n,s){tf(e,i).then((function(e){$f(e,r,t,i).then((function(){n(r)})).catch(s)})).catch((function(t){s(new Error(`Could not load ${e}: ${t.message}`))}))}))}else n=new Promise((function(t,n){$f(e,r,!i.styleUrl||i.styleUrl.startsWith("data:")?location.href:Ng(i.styleUrl,i.accessToken),i).then((function(){t(r)})).catch(n)}))}(Qf,"https://api.maptiler.com/maps/topo-v2/style.json?key=get_your_own_D6rA4zTHduk6KOKTXzGB"),Jf.onmouseover=function(){Jf.className="over"},Jf.onmouseout=function(){Jf.className=""}}();
|