diff --git a/dist/main.js b/dist/main.js index 618932a5e9..a5d1ec9cac 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1 +1 @@ -!function(){"use strict";var t="layergroup",e="size",i="target",n="view";const r="ol-hidden",s="ol-unselectable",o="ol-unsupported",a="ol-control",l="ol-collapsed",h=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"),u=["style","variant","weight","size","lineHeight","family"],c=function(t){const e=t.match(h);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=u.length;te?1:te?-1:0}function $(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;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0)}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]=it,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}class at extends ot{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(T)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Et(vt,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Et(wt,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 Et(wt,i,t)),this.dispatchEvent(new Et(vt,e,t))}updateLength_(){this.set(bt,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i{this.clickTimeoutId_=void 0;const e=new Tt(Rt.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Rt.POINTERUP||e.type==Rt.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!=Rt.POINTERDOWN&&e.type!=Rt.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Tt(Rt.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(N),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 Tt(Rt.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(G(t,Rt.POINTERMOVE,this.handlePointerMove_,this),G(t,Rt.POINTERUP,this.handlePointerUp_,this),G(this.element_,Rt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(G(this.element_.getRootNode(),Rt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Tt(Rt.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 Tt(Rt.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_&&(N(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(L,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(N(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(N),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var kt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function At(t,e){if(!t)throw new Error(e)}const Pt=1/0;class Lt{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,O(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!=Pt&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e)),(t=>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(T,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===kt.LOADED||i===kt.ERROR||i===kt.EMPTY){i!==kt.ERROR&&e.removeEventListener(T,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==kt.IDLE||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}var Ot=0,zt=1,Gt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function jt(t,e,i){return Math.min(Math.max(t,e),i)}function Nt(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 Xt(t,e,i,n)}function Xt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function Ut(t){return 180*t/Math.PI}function qt(t){return t*Math.PI/180}function Wt(t,e){const i=t%e;return i*e<0?i+e:i}function Bt(t,e,i){return t+i*(e-t)}function Vt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Yt(t,e){return Math.floor(Vt(t,e))}function Kt(t,e){return Math.ceil(Vt(t,e))}function Zt(t,e,i){if(t>=e&&tp&&(d=(p+d)/2,p=d),g>f&&(g=(f+g)/2,f=g);let m=jt(n[0],d,p),_=jt(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),_+=-t*Math.log(1+Math.max(0,g-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[m,_]}}function Ht(t){return t}var Jt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Qt(t){const e=ae();for(let i=0,n=t.length;ir&&(l|=Jt.RIGHT),as&&(l|=Jt.ABOVE),l===Jt.UNKNOWN&&(l=Jt.INTERSECTING),l}function ae(){return[1/0,1/0,-1/0,-1/0]}function le(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 he(t){return le(1/0,1/0,-1/0,-1/0,t)}function ue(t,e){const i=t[0],n=t[1];return le(i,n,i,n,e)}function ce(t,e,i,n,r){return fe(he(r),t,e,i,n)}function de(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function pe(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function ge(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function fe(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ke(t){return t[2]=i[2])){const e=Me(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Le(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];Pe(t,e);const r=Me(n);if(Me(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function De(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 Oe(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 ze(t,e){if(e.canWrapX()){const i=Me(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;e.canWrapX()&&(t[0]n[2])&&(i=i||Me(n),r=Math.floor((t[0]-n[0])/i));return r}(t,e,i);n&&(t[0]-=n*i)}return t}function Ge(t){return Math.pow(t,3)}function je(t){return 1-Ge(1-t)}function Ne(t){return 3*t*t-2*t*t*t}function Xe(t){return t}const Ue=6371008.8;function qe(t,e,i){i=i||Ue;const n=qt(t[1]),r=qt(e[1]),s=(r-n)/2,o=qt(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 We(...t){console.warn(...t)}const Be={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Ve{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_||Be[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 Ye=6378137,Ke=Math.PI*Ye,Ze=[-Ke,-Ke,Ke,Ke],$e=[-180,-85,180,85],He=Ye*Math.log(Math.tan(Math.PI/2));class Je extends Ve{constructor(t){super({code:t,units:"m",extent:Ze,global:!0,worldExtent:$e,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Ye)}})}}const Qe=[new Je("EPSG:3857"),new Je("EPSG:102100"),new Je("EPSG:102113"),new Je("EPSG:900913"),new Je("http://www.opengis.net/def/crs/EPSG/0/3857"),new Je("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ti(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;iHe?n=He:n<-He&&(n=-He),e[i+1]=n}return e}function ei(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;iAi&&(e=Ai);const n=qt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=qt(t),u=qt(Oi(i.number)),c=Mi/Math.sqrt(1-ci*r**2),d=gi*s**2,p=s*Zt(h-u,-Math.PI,Math.PI),g=p*p,f=g*p,m=f*p,_=m*p,y=_*p,x=Mi*(wi*n-bi*Math.sin(2*n)+Ei*Math.sin(4*n)-Si*Math.sin(6*n)),v=ui*c*(p+f/6*(1-a+d)+_/120*(5-18*a+l+72*d-58*gi))+5e5;let w=ui*(x+c*o*(g/2+m/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*gi)));return i.north||(w+=1e7),[v,w]}function Oi(t){return 6*(t-1)-180+3}const zi=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Gi(t){let e=0;for(const i of zi){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function ji(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ui=!1,We("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function on(t,e){return t}function an(t,e){return t}var ln,hn,un;Ki(Qe),Ki(si),ln=Qe,hn=ti,un=ei,si.forEach((function(t){ln.forEach((function(e){li(t,e,hn),li(e,t,un)}))}));const cn=new Array(6);function dn(t){return gn(t,1,0,0,1,0,0)}function pn(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 gn(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 fn(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 mn(t,e,i){return pn(t,gn(cn,e,0,0,i,0,0))}function _n(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 yn(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 xn=[1e6,1e6,1e6,1e6,2,2];function vn(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l{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 lt()}closestPointXY(t,e,i,n){return lt()}containsXY(t,e){return 0===this.closestPointXY(t,e,En,Number.MIN_VALUE)}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 lt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&he(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){lt()}scale(t,e,i){lt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return lt()}getType(){return lt()}applyTransform(t){lt()}intersectsExtent(t){return lt()}translate(t,e){lt()}transform(t,e){const i=Vi(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ce(o)/Ce(s);_n(bn,o[0],o[3],a,-a,0,0,0);const l=vn(t,0,t.length,r,bn,n),h=tn(i,e);return h?h(l,l,r):l}:tn(i,e);return this.applyTransform(n),this}}class Cn extends Sn{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ce(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return lt()}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().length1)c=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function An(t,e,i,n,r){for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],p=t[i+1];for(let e=s+n;eo&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n0&&g>d)&&(p<0&&f0&&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 Bn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;ls&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function $n(t,e,i,n,r,s){if(0===i.length)return!1;if(!Zn(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e_&&(h=(u+c)/2,$n(t,e,i,n,h,g)&&(m=h,_=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,g,_),o):[m,g,_]}function Jn(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Qn(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=oe(t,e),s=oe(t,i);if(r===Jt.INTERSECTING||s===Jt.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&Jt.ABOVE&&!(r&Jt.ABOVE)&&(f=d-(p-h)/g,n=f>=o&&f<=l),n||!(s&Jt.RIGHT)||r&Jt.RIGHT||(m=p-(d-l)*g,n=m>=a&&m<=h),n||!(s&Jt.BELOW)||r&Jt.BELOW||(f=d-(p-a)/g,n=f>=o&&f<=l),n||!(s&Jt.LEFT)||r&Jt.LEFT||(m=p-(d-o)*g,n=m>=a&&m<=h)}return n}(r,t,e)})))}function er(t,e,i,n,r){return!!tr(t,e,i,n,r)||(!!Zn(t,e,i,n,r[0],r[1])||(!!Zn(t,e,i,n,r[0],r[3])||(!!Zn(t,e,i,n,r[2],r[1])||!!Zn(t,e,i,n,r[2],r[3]))))}function ir(t,e,i,n,r){if(!er(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e0}function sr(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;su&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[zt]>0}cancelAnimations(){let t;this.setHint(Ot,-this.hints_[Ot]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Wt(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(Ot,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&vr(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]],Oe(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?rn(t,this.getProjection()):t}getCenterInternal(){return this.get(Gt.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 on(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"),Ee(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(Gt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(an(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Me(t)/e[0],n=Ce(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(Gt.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=br(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=$(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=jt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,jt(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(!ke(t),"Cannot fit empty extent provided as `geometry`");i=cr(an(t,this.getProjection()))}else if("Circle"===t.getType()){const e=an(t.getExtent(),this.getProjection());i=cr(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;te.getAttributions(t))));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach((t=>i.add(t))):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some((t=>!1===t.getSource()?.getAttributionsCollapsible()));this.setCollapsible(t)}return Array.from(i)}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=>rt((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Q(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:je}):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(r);t||0!==i?t&&0!==i&&this.element.classList.remove(r):this.element.classList.add(r)}this.label_.style.transform=t}this.rotation_=i}}class Cr extends pt{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",o=void 0!==t.zoomInLabel?t.zoomInLabel:"+",l=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",h=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",u=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(M,this.handleClick_.bind(this,i),!1);const d=document.createElement("button");d.className=r,d.setAttribute("type","button"),d.title=u,d.appendChild("string"==typeof l?document.createTextNode(l):l),d.addEventListener(M,this.handleClick_.bind(this,-i),!1);const p=e+" "+s+" "+a,g=this.element;g.className=p,g.appendChild(c),g.appendChild(d),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:je})):e.setZoom(n)}}}class Tr{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Rr="active";class Ir extends dt{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(Rr)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Rr,t)}setMap(t){this.map_=t}}function Mr(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:je})}class Fr extends Ir{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==Rt.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;Mr(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}}function kr(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0}}else if(t.type==Rt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Rt.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 Ur(t){const e=t.length;let i=0,n=0;for(let r=0;r0&&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 Wr extends Xr{constructor(t){t=t||{},super({stopDown:et}),this.condition_=t.condition?t.condition:Ar,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!jr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===fr)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(!jr(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!jr(t))return!1;if(Dr(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class Br extends Y{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(){if(!this.map_)return;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 ur([i])}getGeometry(){return this.geometry_}}const Vr="boxstart",Yr="boxdrag",Kr="boxend",Zr="boxcancel";class $r extends st{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Hr extends Xr{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Br(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Dr,this.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.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new $r(Yr,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new $r(e?Kr:Zr,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!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 $r(Vr,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new $r(Zr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new $r(Zr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Jr extends Hr{constructor(t){super({condition:(t=t||{}).condition?t.condition:zr,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:je})}}var Qr="ArrowLeft",ts="ArrowUp",es="ArrowRight",is="ArrowDown";class ns extends Ir{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Or(t)&&Gr(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==k){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==is||n==Qr||n==es||n==ts)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==is?a=-s:n==Qr?o=-s:n==es?o=s:a=s;const l=[o,a];Oe(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:Xe,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}class rs extends Ir{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return f?e.metaKey:e.ctrlKey}(t)&&Gr(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==k||t.type==A){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;Mr(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class ss extends Ir{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:Lr;this.condition_=t.onFocusOnly?kr(Pr,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_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==D)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel),t.type==D&&(n=i.deltaY,p&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=m),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_?e.getCoordinateFromPixel(this.lastAnchor_):null),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=-jt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Mr(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,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 os extends Xr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=et),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!==fr&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Ur(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}}class as extends Xr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=et),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(Ur(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}}var ls="opacity",hs="visible",us="extent",cs="zIndex",ds="maxResolution",ps="minResolution",gs="maxZoom",fs="minZoom",ms="source",_s="map";class ys extends dt{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[ls]=void 0!==t.opacity?t.opacity:1,At("number"==typeof e[ls],"Layer opacity must be a number"),e[hs]=void 0===t.visible||t.visible,e[cs]=t.zIndex,e[ds]=void 0!==t.maxResolution?t.maxResolution:1/0,e[ps]=void 0!==t.minResolution?t.minResolution:0,e[fs]=void 0!==t.minZoom?t.minZoom:-1/0,e[gs]=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=jt(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 lt()}getLayerStatesArray(t){return lt()}getExtent(){return this.get(us)}getMaxResolution(){return this.get(ds)}getMinResolution(){return this.get(ps)}getMinZoom(){return this.get(fs)}getMaxZoom(){return this.get(gs)}getOpacity(){return this.get(ls)}getSourceState(){return lt()}getVisible(){return this.get(hs)}getZIndex(){return this.get(cs)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(us,t)}setMaxResolution(t){this.set(ds,t)}setMinResolution(t){this.set(ps,t)}setMaxZoom(t){this.set(gs,t)}setMinZoom(t){this.set(fs,t)}setOpacity(t){At("number"==typeof t,"Layer opacity must be a number"),this.set(ls,t)}setVisible(t){this.set(hs,t)}setZIndex(t){this.set(cs,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class xs extends st{constructor(t,e){super(t),this.layer=e}}const vs="layers";class ws extends ys{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(vs,this.handleLayersChanged_),i?Array.isArray(i)?i=new St(i.slice(),{unique:!0}):At("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new St(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(N),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(G(t,vt,this.handleLayersAdd_,this),G(t,wt,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(N);O(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{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;if(!t&&i&&(t=i.getView()),e=t instanceof xr?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return Is(n,e.viewState)&&(!r||Fe(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof xr?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}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(_s,t)}getMapInternal(){return this.get(_s)}setMap(t){this.mapPrecomposeKey_&&(N(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(N(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=G(t,Ss,this.handlePrecompose_,this),this.mapRenderKey_=G(this,T,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);At(!e.some((t=>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)}setSource(t){this.set(ms,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function Is(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}function Ms(t,e,i=0,n=t.length-1,r=ks){for(;n>i;){if(n-i>600){const 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);Ms(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(Fs(t,i,e),r(t[n],s)>0&&Fs(t,i,n);o0;)a--}0===r(t[i],s)?Fs(t,i,a):(a++,Fs(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Fs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function ks(t,e){return te?1:0}let As=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(!qs(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Ws(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ls(i,this.toBBox),Ls(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Ws([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ls(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=Ds(t,0,o,this.toBBox),a=Ds(t,o,i,this.toBBox),l=Xs(e,a),h=js(e)+js(a);l=e;n--){const e=t.children[n];Os(o,t.leaf?r(e):e),a+=Ns(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Os(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():Ls(t[i],this.toBBox)}};function Ps(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Ws(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Bs(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;Ms(t,o,e,i,r),s.push(e,o,o,i)}}function Vs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ys,Ks;var Zs=Vs(Ks?Ys:(Ks=1,Ys={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]})),$s={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};var Hs={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},Js={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 Qs(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(),Zs[t])n=Zs[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!==$s[t])return $s[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]?Js.min:Hs.min,r="h"===i.space[0]?Js.max:Hs.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=Js.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}Hs.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]};var to={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]}}};to.max=to.whitepoint[2].D65,to.rgb=function(t,e){e=e||to.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))]},Hs.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||to.whitepoint[2].E)[0],s*e[1],o*e[2]]};var eo={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=to.whitepoint[i][e][0])/(h+15*(u=to.whitepoint[i][e][1])+3*(c=to.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]}};to.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=to.whitepoint[i][e][0])/(h+15*(u=to.whitepoint[i][e][1])+3*(c=to.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 io={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 eo.xyz(io.luv(t))}};eo.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]},to.lchuv=function(t){return eo.lchuv(to.luv(t))};const no=[NaN,NaN,NaN,0];const ro=1024,so={};let oo=0;function ao(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function lo(t){const e=to.lchuv(Hs.xyz(t));return e[3]=t[3],e}function ho(t){if("none"===t)return no;if(so.hasOwnProperty(t))return so[t];if(oo>=ro){let t=0;for(const e in so)0==(3&t++)&&(delete so[e],--oo)}const e=Qs(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 co(e),so[t]=e,++oo,e}function uo(t){return Array.isArray(t)?t:ho(t)}function co(t){return t[0]=jt(t[0]+.5|0,0,255),t[1]=jt(t[1]+.5|0,0,255),t[2]=jt(t[2]+.5|0,0,255),t[3]=jt(t[3],0,1),t}function po(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)+")"}function go(t){return t[0]>0&&t[1]>0}function fo(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let mo=0;const _o=1<",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",Has:"has"},Lo={[Po.Get]:Xo(zo(1,1/0),Do),[Po.Var]:Xo(zo(1,1),(function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new Mo(xo,n)]})),[Po.Has]:Xo(zo(1,1/0),Do),[Po.Id]:Xo((function(t,e,i){i.featureId=!0}),Oo),[Po.Concat]:Xo(zo(2,1/0),jo(xo)),[Po.GeometryType]:Xo((function(t,e,i){i.geometryType=!0}),Oo),[Po.LineMetric]:Xo(Oo),[Po.Resolution]:Xo(Oo),[Po.Zoom]:Xo(Oo),[Po.Time]:Xo(Oo),[Po.Any]:Xo(zo(2,1/0),jo(_o)),[Po.All]:Xo(zo(2,1/0),jo(_o)),[Po.Not]:Xo(zo(1,1),jo(_o)),[Po.Equal]:Xo(zo(2,2),jo(Eo)),[Po.NotEqual]:Xo(zo(2,2),jo(Eo)),[Po.GreaterThan]:Xo(zo(2,2),jo(yo)),[Po.GreaterThanOrEqualTo]:Xo(zo(2,2),jo(yo)),[Po.LessThan]:Xo(zo(2,2),jo(yo)),[Po.LessThanOrEqualTo]:Xo(zo(2,2),jo(yo)),[Po.Multiply]:Xo(zo(2,1/0),Go),[Po.Coalesce]:Xo(zo(2,1/0),Go),[Po.Divide]:Xo(zo(2,2),jo(yo)),[Po.Add]:Xo(zo(2,1/0),jo(yo)),[Po.Subtract]:Xo(zo(2,2),jo(yo)),[Po.Clamp]:Xo(zo(3,3),jo(yo)),[Po.Mod]:Xo(zo(2,2),jo(yo)),[Po.Pow]:Xo(zo(2,2),jo(yo)),[Po.Abs]:Xo(zo(1,1),jo(yo)),[Po.Floor]:Xo(zo(1,1),jo(yo)),[Po.Ceil]:Xo(zo(1,1),jo(yo)),[Po.Round]:Xo(zo(1,1),jo(yo)),[Po.Sin]:Xo(zo(1,1),jo(yo)),[Po.Cos]:Xo(zo(1,1),jo(yo)),[Po.Atan]:Xo(zo(1,2),jo(yo)),[Po.Sqrt]:Xo(zo(1,1),jo(yo)),[Po.Match]:Xo(zo(4,1/0),No,(function(t,e,i){const n=t.length-1,r=xo|yo|_o,s=Ao(t[1],r,i),o=Ao(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;ee){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function Go(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s{for(let e=0;e{for(let e=0;e{const i=t.args;let r=e.properties[n];for(let t=1,e=i.length;tt.variables[n];case Po.Has:return e=>{const i=t.args;if(!(n in e.properties))return!1;let r=e.properties[n];for(let t=1,e=i.length;tt.featureId;case Po.GeometryType:return t=>t.geometryType;case Po.Concat:{const e=t.args.map((t=>Wo(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case Po.Resolution:return t=>t.resolution;case Po.Any:case Po.All:case Po.Between:case Po.In:case Po.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case Po.In:return t=>{const e=r[0](t);for(let i=1;i!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t);case Po.Equal:case Po.NotEqual:case Po.LessThan:case Po.LessThanOrEqualTo:case Po.GreaterThan:case Po.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=Wo(t.args[0]),r=Wo(t.args[1]);switch(i){case Po.Equal:return t=>n(t)===r(t);case Po.NotEqual:return t=>n(t)!==r(t);case Po.LessThan:return t=>n(t)n(t)<=r(t);case Po.GreaterThan:return t=>n(t)>r(t);case Po.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t);case Po.Multiply:case Po.Divide:case Po.Add:case Po.Subtract:case Po.Clamp:case Po.Mod:case Po.Pow:case Po.Abs:case Po.Floor:case Po.Ceil:case Po.Round:case Po.Sin:case Po.Cos:case Po.Atan:case Po.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{let e=1;for(let i=0;ir[0](t)/r[1](t);case Po.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case Po.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case Po.Mod:return t=>r[0](t)%r[1](t);case Po.Pow:return t=>Math.pow(r[0](t),r[1](t));case Po.Abs:return t=>Math.abs(r[0](t));case Po.Floor:return t=>Math.floor(r[0](t));case Po.Ceil:return t=>Math.ceil(r[0](t));case Po.Round:return t=>Math.round(r[0](t));case Po.Sin:return t=>Math.sin(r[0](t));case Po.Cos:return t=>Math.cos(r[0](t));case Po.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case Po.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t);case Po.Case:return function(t,e){const i=t.args.length,n=new Array(i);for(let e=0;e{for(let e=0;e{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?Vo(e,r,s,o,i,l):Bo(e,r,s,o,i,l);s=i,o=l}return o}}(t);case Po.ToString:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{const i=r[0](e);return t.args[0].type===vo?po(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Bo(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 Vo(t,e,i,n,r,s){if(0===r-i)return n;const o=lo(n),a=lo(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return co(function(t){const e=to.rgb(io.xyz(t));return e[3]=t[3],e}([Bo(t,e,i,o[0],r,a[0]),Bo(t,e,i,o[1],r,a[1]),o[2]+Bo(t,e,i,0,r,l),Bo(t,e,i,n[3],r,s[3])]))}var Yo={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Ko extends ot{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?Yo.IDLE:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(T)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Yo.IDLE&&this.loader){this.state=Yo.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;rt((()=>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||x&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Yo.LOADED})).catch((t=>{this.state=Yo.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Zo(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(((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)}))}(t)}function $o(t,e,i){return e+":"+t+":"+(i?uo(i):"null")}const Ho=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}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=$o(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=$o(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const s=$o(t,e,i),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Yo.IDLE&&n.load(),n.getImageState()===Yo.LOADING?n.ready().then((()=>{this.patternCache_[s]=E().createPattern(n.getImage(1),"repeat")})):this.patternCache_[s]=E().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Jo=null;class Qo extends ot{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?Yo.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_===Yo.LOADED){Jo||(Jo=w(1,1,void 0,{willReadFrequently:!0})),Jo.drawImage(this.image_,0,0);try{Jo.getImageData(0,0,1,1),this.tainted_=!1}catch{Jo=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(T)}handleImageError_(){this.imageState_=Yo.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Yo.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=w(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_===Yo.IDLE){this.image_||this.initializeImage_(),this.imageState_=Yo.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Zo(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_!==Yo.LOADED)return;const e=this.image_,i=w(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=function(t){return"string"==typeof t?t:po(t)}(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise((t=>{if(this.imageState_===Yo.LOADED||this.imageState_===Yo.ERROR)t();else{const e=()=>{this.imageState_!==Yo.LOADED&&this.imageState_!==Yo.ERROR||(this.removeEventListener(T,e),t())};this.addEventListener(T,e)}}))),this.ready_}}function ta(t,e,i,n,r,s){let o=void 0===e?void 0:Ho.get(e,i,r);return o||(o=new Qo(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ho.set(e,i,r,o,s)),s&&o&&!Ho.getPattern(e,i,r)&&Ho.set(e,i,r,o,s),o}function ea(t){return t?Array.isArray(t)?po(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ho.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Ho.getPattern(e,void 0,t.color);if(i)return i;const n=Ho.get(t.src,"anonymous",null);if(n.getImageState()!==Yo.LOADED)return null;const r=w(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]),ta(r.canvas,e,void 0,Yo.LOADED,t.color,!0),Ho.getPattern(e,void 0,t.color)}(t):t:null}const ia="10px sans-serif",na="#000",ra="round",sa=[],oa="round",aa="#000",la="center",ha="middle",ua=[0,0,0,0],ca=new dt;let da,pa=null;const ga={},fa=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;hMath.max(e,ya(t,i))),0);return i[e]=n,n}function va(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;tthis.imageState_=Yo.LOADED)),this.render()}clone(){const t=this.getScale(),e=new ba({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){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ho.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=w(r,r);this.draw_(e,s,t),n=s.canvas,Ho.set(i,null,null,new Qo(n,void 0,null,Yo.LOADED,null))}return n}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{this.patternImage_=null})),e.getImageState()===Yo.IDLE&&e.load(),e.getImageState()===Yo.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?ut(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:uo(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function Ca(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 Ta extends wa{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||ut(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=Yo.IDLE:void 0!==s&&(o="complete"in s?s.complete?s.src?Yo.LOADED:Yo.IDLE:Yo.LOADING:Yo.LOADED),this.color_=void 0!==t.color?uo(t.color):null,this.iconImage_=ta(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,this.initialOptions_,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(Ca(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Ca(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 Ta({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()==Yo.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()==Yo.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(T,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(T,t)}ready(){return this.iconImage_.ready()}}class Ra{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 Ra({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 Ia{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ka,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 Ia({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_=ka,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let Ma=null;function Fa(t,e){if(!Ma){const t=new Sa({color:"rgba(255,255,255,0.4)"}),e=new Ra({color:"#3399CC",width:1.25});Ma=[new Ia({image:new Ea({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Ma}function ka(t){return t.getGeometry()}class Aa{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=fo(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 Sa({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 Aa({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),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_}getKeepUpright(){return this.keepUpright_}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}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=fo(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}}function Pa(t){return!0}function La(t){const e=ko(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;rnull;n=Ua(t,e+"fill-color",i)}if(!n)return null;const r=new Sa;return function(t){const e=n(t);return e===no?null:(r.setColor(e),r)}}function Ga(t,e,i){const n=ja(t,e+"stroke-width",i),r=Ua(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Na(t,e+"stroke-line-cap",i),o=Na(t,e+"stroke-line-join",i),a=qa(t,e+"stroke-line-dash",i),l=ja(t,e+"stroke-line-dash-offset",i),h=ja(t,e+"stroke-miter-limit",i),u=new Ra;return function(t){if(r){const e=r(t);if(e===no)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 ja(t,e,i){if(!(e in t))return;const n=qo(t[e],yo,i);return function(t){return Qa(n(t),e)}}function Na(t,e,i){if(!(e in t))return null;const n=qo(t[e],xo,i);return function(t){return Ja(n(t),e)}}function Xa(t,e,i){if(!(e in t))return null;const n=qo(t[e],_o,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Ua(t,e,i){if(!(e in t))return null;const n=qo(t[e],vo,i);return function(t){return tl(n(t),e)}}function qa(t,e,i){if(!(e in t))return null;const n=qo(t[e],wo,i);return function(t){return Ha(n(t),e)}}function Wa(t,e,i){if(!(e in t))return null;const n=qo(t[e],wo,i);return function(t){const i=Ha(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Ba(t,e,i){if(!(e in t))return null;const n=qo(t[e],wo,i);return function(t){return el(n(t),e)}}function Va(t,e,i){if(!(e in t))return null;const n=qo(t[e],wo|yo,i);return function(t){return function(t,e){if("number"==typeof t)return t;return el(t,e)}(n(t),e)}}function Ya(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 Ka(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 Za(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 $a(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 Ha(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function el(t,e){const i=Ha(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const il="renderOrder";class nl extends Rs{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(il)}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 As(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(il,t)}setStyle(t){this.style_=void 0===t?Fa:t;const e=function(t){if(void 0===t)return Fa;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Ia)return t;if(!Array.isArray(t))return Da([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Ia){const i=new Array(e);for(let n=0;n=0;--r){const s=g[r],c=s.layer;if(c.hasRenderer()&&Is(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);_[0]=a[0]+p[n][0],_[1]=a[1]+p[n][1],l=r.forEachFeatureAtCoordinate(_,e,i,h,m)}if(l)return l}}if(0===m.length)return;const y=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*y)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,tt,this,r,s)}getMap(){return this.map_}renderFrame(t){lt()}scheduleExpireIconCache(t){Ho.canExpireCache()&&t.postRenderFunctions.push(ol)}}function ol(t,e){Ho.expire()}class al extends sl{constructor(t){super(t),this.fontChangeListenerKey_=G(ca,V,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=s+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new rl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){N(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Ss,t);const e=t.layerStatesArray.sort(((t,e)=>t.zIndex-e.zIndex));e.some((t=>t.layer instanceof nl&&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=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}}function ll(t){t instanceof Rs?t.setMapInternal(null):t instanceof ws&&t.getLayers().forEach(ll)}function hl(t,e){if(t instanceof Rs)t.setMapInternal(e);else if(t instanceof ws){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=s.controls||function(t){t=t||{};const e=new St;return(void 0===t.zoom||t.zoom)&&e.push(new Cr(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new Sr(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new Er(t.attributionOptions)),e}(),this.interactions=s.interactions||function(t){t=t||{};const e=new St,i=new Tr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Wr),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Fr({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new qr({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new os),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new as({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new ns),e.push(new rs({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new ss({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Jr({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=s.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Dt(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(t,this.handleLayerGroupChanged_),this.addChangeListener(n,this.handleViewChanged_),this.addChangeListener(e,this.handleSizeChanged_),this.addChangeListener(i,this.handleTargetChanged_),this.setProperties(s.values);const o=this;!r.view||r.view instanceof xr||r.view.then((function(t){o.setView(new xr(t))})),this.controls.addEventListener(vt,(t=>{t.element.setMap(this)})),this.controls.addEventListener(wt,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(vt,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(wt,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(vt,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(wt,(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){hl(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:tt,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 ws?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:tt,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(i)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return rn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?fn(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(t)}setLayers(t){const e=this.getLayerGroup();if(t instanceof St)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Ot]||e[zt]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(e){const i=this.getLayerGroup();i&&this.handleLayerRemove_(new xs("removelayer",i)),this.set(t,e)}setSize(t){this.set(e,t)}setTarget(t){this.set(i,t)}setView(t){if(!t||t instanceof xr)return void this.set(n,t);this.set(n,new xr);const e=this;t.then((function(t){e.setView(new xr(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=[Math.max(0,n),Math.max(0,r)],!go(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&We("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&Q(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}class cl extends dt{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 cl(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_&&(N(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=G(t,T,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_()}}function dl(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e>1;rt.clone()))}function _l(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a{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=Xn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Un(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Bn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new El(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}El.prototype.getFlatCoordinates=El.prototype.getOrientedFlatCoordinates;class Sl{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 Cl extends Sl{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Vt(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=vn(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;tt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:oa,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:ea(t||aa)}}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:ea(t||na)}}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:ra,lineDash:n||sa,lineDashOffset:r||0,lineJoin:void 0!==s?s:oa,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:ea(t||aa)}}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:ia,textAlign:void 0!==u?u:la,textBaseline:void 0!==c?c:ha},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 Tl=.5,Rl={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()!=Yo.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()!=Yo.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;a0;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)Al(t,l,i,e,o);else{(0,Rl[l.getType()])(t,l,i,e,o,s)}}(t,e,i,n,s,o,a),c}function Al(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Dl(t,e){return function(i,n,r,s,o){const a=this;Ll(t,e,i,n,r,(function(t,e){a.addFeatures(t),void 0!==s&&s(t)}),o||it)}}function Ol(t,e){return[[-1/0,-1/0,1/0,1/0]]}function zl(t,e){return[t]}class Gl{constructor(t){this.rbush_=new As(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_[ut(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;nt):null}var Xl="addfeature",Ul="changefeature",ql="clear",Wl="removefeature",Bl="featuresloadstart",Vl="featuresloadend",Yl="featuresloaderror";class Kl extends st{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Zl extends jl{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_=it,this.format_=t.format||null,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_=Dl(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Ol;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Gl:null,this.loadedExtentsRtree_=new Gl,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 St(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=ut(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 Kl(Xl,t))}setupChangeEvents_(t,e){e instanceof El||(this.featureChangeKeys_[t]=[G(e,T,this.handleFeatureChange_,this),G(e,V,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 El){const n=this.idIndex_[t];n instanceof El?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{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(wt,(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(N)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach((t=>{this.removeFeatureInternal(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 Kl(ql);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 El||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 El||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(),z(this.nullGeometryFeatures_)||J(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=Le(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||tt,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof El?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Kl(Vl,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Kl(Yl))})),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_,i=e.forEachInExtent(t,(function(e){if(de(e.extent,t))return e}));i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;ia&&(this.instructions.push([th,a,h,t,i,Gn,r]),this.hitDetectionInstructions.push([th,a,h,t,n||i,Gn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([th,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([th,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[$l,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[$l,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,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[oh,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[ah,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!Q(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[nh,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ee(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;te(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class gh extends ph{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(ch),this.hitDetectionInstructions.push(ch);for(let r=0;r=t){const e=(t-a+c)/c,d=Bt(i,h,e),p=Bt(n,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function mh(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,g,f=i,m=i,_=0,y=0,x=i;for(o=i;ot&&(y>_&&(_=y,f=x,m=o),y=0,x=o-r)),a=l,c=p,d=g),h=i,u=n}return y+=l,y>_?[x,o]:[f,m]}const _h={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const yh={Circle:gh,Default:ph,Image:class extends ph{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&&!ne(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([ih,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([ih,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{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!=ua&&(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([ih,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,c==ua?ua: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=na,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([ih,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_?na: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(!Fe(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;tt[2]}else I=w>T;const M=Math.PI,F=[],k=E+n===e;let A;if(_=0,y=S,p=t[e=E],g=t[e+1],k){x(),A=Math.atan2(g-m,p-f),I&&(A+=A>0?-M:M);const t=(T+w)/2,e=(R+b)/2;return F[0]=[t,e,(C-s)/2,A,r],F}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t0?-M:M),void 0!==A){let t=d-A;if(t+=t>M?-2*M:t<-M?2*M:0,Math.abs(t)>o)return null}A=d;const w=t;let b=0;for(;t{if("function"==typeof E()[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);pushFunction(t){this.instructions_[this.zIndex+this.offset_].push(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i0&&t.push("\n",""),t.push(e,""),t}class kh{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 wh: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=a.justify?_h[a.justify]:Mh(Array.isArray(t)?t[0]:t,a.textAlign||la),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Fh,[]),{width:p,height:g,widths:f,heights:m,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,l=0;continue}const d=e[h+1]||t.font,p=ya(d,c);i.push(p),o+=p;const g=ma(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),y=p+c,x=[],v=(y+2)*h[0],w=(g+c)*h[1],b={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",c),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const E=.5-u;let S=u*y+E*c;const C=[],T=[];let R,I=0,M=0,F=0,k=0;for(let t=0,e=d.length;tt?t-l:r,x=s+h>e?e-h:s,v=p[3]+y*c[0]+p[1],w=p[0]+x*c[1]+p[2],b=m-p[3],E=_-p[0];let S;return(g||0!==u)&&(Eh[0]=b,Th[0]=b,Eh[1]=E,Sh[1]=E,Sh[0]=b+v,Ch[0]=Sh[0],Ch[1]=E+w,Th[1]=Ch[1]),0!==u?(S=_n([1,0,0,1,0,0],i,n,1,1,u,-i,-n),fn(S,Eh),fn(S,Sh),fn(S,Ch),fn(S,Th),le(Math.min(Eh[0],Sh[0],Ch[0],Th[0]),Math.min(Eh[1],Sh[1],Ch[1],Th[1]),Math.max(Eh[0],Sh[0],Ch[0],Th[0]),Math.max(Eh[1],Sh[1],Ch[1],Th[1]),bh)):le(Math.min(b,b+v),Math.min(E,E+w),Math.max(b,b+v),Math.max(E,E+w),bh),d&&(m=Math.round(m),_=Math.round(_)),{drawImageX:m,drawImageY:_,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:bh[0],minY:bh[1],maxX:bh[2],maxY:bh[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,Eh,Sh,Ch,Th,s,o),va(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=fn(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=Mh(Array.isArray(t)?t[0]:t,r.textAlign||la),h=_h[r.textBaseline||ha],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&Q(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=vn(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,c=i,u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const p=n.length;let g,f,m,_,y,x,v,w,b,E,S,C,T,R=0,I=0,M=0,F=null,k=null;const A=this.coordinateCache_,P=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:P},O=this.instructions!=n||this.overlaps?0:200;let z,G,j,N;for(;dO&&(this.fill_(t),I=0),M>O&&(t.stroke(),M=0),I||M||(t.beginPath(),y=NaN,x=NaN),++d;break;case Jl:R=i[1];const n=h[R],u=h[R+1],c=h[R+2]-n,p=h[R+3]-u,X=Math.sqrt(c*c+p*p);t.moveTo(n+X,u),t.arc(n,u,X,0,2*Math.PI,!0),++d;break;case Ql:t.closePath(),++d;break;case th:R=i[1],g=i[2];const U=i[3],q=i[4],W=i[5];D.geometry=U,D.feature=z,d in A||(A[d]=[]);const B=A[d];W?W(h,R,g,2,B):(B[0]=h[R],B[1]=h[R+1],B.length=2),l&&(l.zIndex=i[6]),q(B,D),++d;break;case ih:R=i[1],g=i[2],b=i[3],f=i[4],m=i[5];let V=i[6];const Y=i[7],K=i[8],Z=i[9],$=i[10];let H=i[11];const J=i[12];let Q=i[13];_=i[14]||"declutter";const tt=i[15];if(!b&&i.length>=20){E=i[19],S=i[20],C=i[21],T=i[22];const t=this.drawLabelWithPointPlacement_(E,S,C,T);b=t.label,i[3]=b;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];m=(t.anchorY-n)*this.pixelRatio,i[5]=m,V=b.height,i[6]=V,Q=b.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=ua,nt=!1,rt=!1),$&&L?H+=P:$||L||(H-=P);let st=0;for(;R!Ph.includes(t)));class Dh{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 kh(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;ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const g=Object.keys(this.executorsByZIndex_).map(Number);let f,m,_,y,x;for(g.sort(K),f=g.length-1;f>=0;--f){const t=g[f].toString();for(_=this.executorsByZIndex_[t],m=Ah.length-1;m>=0;--m)if(d=Ah[m],y=_[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,p,u),x))return x}}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 vn(o,0,8,2,t,o),o}isEmpty(){return z(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?Z:K),s=s||Ah;const l=Ah.length;for(let h=0,u=a.length;hp.execute(t,e,i,n,r,o))):p.execute(c,e,i,n,r,o),g&&c.restore(),s){s.offset();const t=a[h]*l+u;this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(K);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}}const Oh={};const zh=.5;function Gh(t,e,i,n,r,s,o,a,l){const h=l?on(r):r,u=w(t[0]*zh,t[1]*zh);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new Cl(u,zh,r,null,o,a,l?Ji(nn,l):null),p=i.length,g=Math.floor(16777215/p),f={};for(let t=1;t<=p;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*g).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;tthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return lt()}getData(t){return null}prepareFrame(t){return lt()}renderFrame(t,e){return lt()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Yo.LOADED&&e.getState()!==Yo.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Yo.LOADED&&e!=Yo.ERROR&&t.addEventListener(T,this.boundHandleImageChange_),e==Yo.IDLE&&(t.load(),e=t.getState()),e==Yo.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Xh=[];let Uh=null;class qh extends Nh{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.frameState=null}getImageData(t,e,i){let n;Uh||(Uh=w(1,1,void 0,{willReadFrequently:!0})),Uh.clearRect(0,0,1,1);try{Uh.drawImage(t,e,i,1,1,0,0,1,1),n=Uh.getImageData(0,0,1,1).data}catch{return Uh=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&&Q(uo(t.style.backgroundColor),uo(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=w();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=Re(i),r=Ie(i),s=ve(i),o=xe(i);fn(e.coordinateToPixelTransform,n),fn(e.coordinateToPixelTransform,r),fn(e.coordinateToPixelTransform,s),fn(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;fn(a,n),fn(a,r),fn(a,s),fn(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()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(Me(i)/n*s),a=Math.round(Ce(i)/n*s);_n(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),yn(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.map(((t,e)=>Math.round(t*xn[e])/xn[e])).join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new rl(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(bs,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Es,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new wh),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(bs,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Es,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 _n(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Wh extends qh{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,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.renderedFrameDeclutter_,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[Ot]||p[zt]),f=this.context,m=Math.round(Me(n)/o*d),_=Math.round(Ce(n)/o*d),y=u.getWrapX()&&a.canWrapX(),x=y?Me(h):null,v=y?Math.ceil((n[2]-h[2])/x)+1:1;let w=y?Math.floor((n[0]-h[0])/x):0;do{let n=this.getRenderTransform(s,o,0,d,m,_,w*x);e.declutter&&(n=n.slice(0)),t.execute(f,[f.canvas.width,f.canvas.height],n,l,g,void 0===i?Ah:i?Ph:Lh,i?c&&e.declutter[c]:void 0)}while(++w{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*zh,h=t[1]*zh;a.push(this.getRenderTransform(e,i,n,zh,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!re(c,s)){let t=s[0];const r=Me(c);let o,u=0;for(;tc[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,zh,l,h,o).slice()),t-=r}this.hitDetectionImageData_=Gh(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Ml(i,this.renderedPixelRatio_),null)}e(jh(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=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,(function(t,e,i){const s=ut(t),o=l[s];if(o){if(!0!==o&&it.value)):null)}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[Ot],r=t.viewHints[zt],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),p=e.getRenderBuffer();let g=e.getRenderOrder();void 0===g&&(g=Il);const f=l.center.slice(),m=te(a,p*u),_=m.slice(),y=[m.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!re(x,t.extent)){const t=Me(x),e=Math.max(Me(m)/2,t);m[0]=x[0]-e,m[2]=x[2]+e,ze(f,h);const i=Pe(y[0],h);i[0]x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==g&&this.renderedFrameDeclutter_===!!t.declutter&&re(this.wrappedRenderedExtent_,m))return Q(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=f,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const v=new xh(Fl(u,c),m,u,c);for(let t=0,e=y.length;t{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,w,n,v,undefined,this.getLayer().getDeclutter(),i);b=b&&!e}},S=on(m),C=i.getFeaturesInExtent(S);g&&C.sort(g);for(let t=0,e=C.length;tt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){lt()}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:Ge(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Kh extends Yh{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=kt.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=kt.ERROR,this.unlistenImage_(),this.image_=function(){const t=w(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=kt.LOADED:this.state=kt.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==kt.ERROR&&(this.state=kt.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==kt.IDLE&&(this.state=kt.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=[j(n,P,(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(j(n,R,i)),function(){r=!1,a.forEach(N)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class Zh{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function $h(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Zh(t,e,i,n)}const Hh=[];class Jh extends Yh{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=w(1,1,Hh)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=ut(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(){this.context_&&(S(this.context_),Hh.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Qh=class extends Yh{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}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==kt.IDLE&&(this.setState(kt.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(kt.ERROR)}setFeatures(t){this.features_=t,this.setState(kt.LOADED)}setLoader(t){this.loader_=t}};class tu{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=cl,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Vi(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Vi(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 lt()}readFeature(t,e){return lt()}readFeatures(t,e){return lt()}readGeometry(t,e){return lt()}readProjection(t){return lt()}writeFeature(t,e){return lt()}writeFeatures(t,e){return lt()}writeGeometry(t,e){return lt()}}function eu(t,e,i){const n=i?Vi(i.featureProjection):null,r=i?Vi(i.dataProjection):null;let s=t;if(n&&r&&!Hi(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(tn(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;inu({...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 eu(new El(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(or(t,0,e,i)||lr(t=t.slice(),0,e,i),t):(sr(t,0,e,i)||ar(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 ru(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>ru(t,e)));return new fl(i)}return eu(new(0,iu[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}class su extends tu{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(ou(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(ou(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return lt()}readFeaturesFromObject(t,e){return lt()}readGeometry(t,e){return this.readGeometryFromObject(ou(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return lt()}readProjection(t){return this.readProjectionFromObject(ou(t))}readProjectionFromObject(t){return lt()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return lt()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return lt()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return lt()}}function ou(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}class au extends su{constructor(t){t=t||{},super(),this.dataProjection=Vi(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Vi(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=lu(i.geometry);if(this.featureClass===El)return nu({geometry:n,id:i.id,properties:i.properties},e);const r=new cl;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(ru(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=o.width)return null;const h=Ce(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);this.prepareContainer(t,e);const f=this.context.canvas.width,m=this.context.canvas.height,_=this.getRenderContext(t);let y=!1,x=!0;if(l.extent){const e=an(l.extent,u.projection);x=Fe(e,t.extent),y=x&&!re(e,t.extent),y&&this.clipUnrotated(_,t,e)}const v=i.getImage(),w=_n(this.tempTransform,f/2,m/2,p,g,0,a*(n[0]-c[0])/s,a*(c[1]-n[3])/o);this.renderedResolution=o*h/a;const b=v.width*w[0],E=v.height*w[3];if(this.getLayer().getSource().getInterpolate()||(_.imageSmoothingEnabled=!1),this.preRender(_,t),x&&b>=.5&&E>=.5){const t=w[4],e=w[5],i=l.opacity;1!==i&&(_.save(),_.globalAlpha=i),_.drawImage(v,0,0,+v.width,+v.height,t,e,b,E),1!==i&&_.restore()}return this.postRender(this.context,t),y&&_.restore(),_.imageSmoothingEnabled=!0,this.container}}class cu extends Rs{constructor(t){super(t=t||{})}}class du extends cu{constructor(t){super(t)}createRenderer(){return new uu(this)}getData(t){return super.getData(t)}}const pu=4294967296,gu=1/pu,fu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class mu{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pu;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pu;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return _u(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return _u(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return _u(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return _u(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return _u(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return _u(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&fu?fu.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?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){const 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(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&yu(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&yu(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,xu,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,vu,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Eu,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,wu,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,bu,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Su,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Cu,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Tu,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Ru,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function _u(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function yu(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function xu(t,e){for(let i=0;i>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===El)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=hr(a,l);t=e.length>1?new wl(a,"XY",e):new ur(a,"XY",l)}else t="Point"===h?new Yn(a,"XY"):"LineString"===h?new yl(a,"XY"):"MultiPoint"===h?new vl(a,"XY"):"MultiLineString"===h?new xl(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=eu(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=Vi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new mu(t),s=r.readFields(Mu,{}),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>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 ku(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos2||Math.abs(t[4*e+3]-191.25)>2}function Uu(t,e,i,n){const r=en(i,e,t);let s=Yi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||ne(l,r)){const e=Yi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function qu(t,e,i,n){const r=we(i);let s=Uu(t,e,r,n);return(!isFinite(s)||s<=0)&&_e(i,(function(i){return s=Uu(t,e,i,n),isFinite(s)&&s>0})),s}function Wu(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const g=w(Math.round(i*t),Math.round(i*e),ju);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 _;l.forEach((function(t,e,i){pe(m,t.extent)}));const y=i/n,x=(c?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(_=w(Math.round(Me(m)*y),Math.round(Ce(m)*y),ju),c||(_.imageSmoothingEnabled=!1),r&&p){const t=(r[0]-m[0])*y,e=-(r[3]-m[3])*y,i=Me(r)*y,n=Ce(r)*y;_.rect(t,e,i,n),_.clip()}l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){_.save();const e=(t.clipExtent[0]-m[0])*y,i=-(t.clipExtent[3]-m[3])*y,n=Me(t.clipExtent)*y,r=Ce(t.clipExtent)*y;_.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),_.clip()}const e=(t.extent[0]-m[0])*y,i=-(t.extent[3]-m[3])*y,n=Me(t.extent)*y,r=Ce(t.extent)*y;_.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&_.restore()}}))}const v=Re(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 y=f((r[0][0]-v[0])/s),b=f(-(r[0][1]-v[1])/s),E=f((r[1][0]-v[0])/s),C=f(-(r[1][1]-v[1])/s),T=f((r[2][0]-v[0])/s),R=f(-(r[2][1]-v[1])/s),I=o,M=a;o=0,a=0,h-=I,u-=M,d-=I,p-=M;const F=function(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,E-y],[d,p,0,0,T-y],[0,0,h,u,C-b],[0,0,d,p,R-b]]);if(!F)return;if(g.save(),g.beginPath(),function(){if(void 0===Gu){const t=w(6,6,ju);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Nu(t,4,5,4,0),Nu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Gu=Xu(e,0)||Xu(e,4)||Xu(e,8),S(t),ju.push(t.canvas)}return Gu}()||!c){g.moveTo(E,C);const t=4,e=y-E,i=b-C;for(let n=0;nfn(o,en(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const r=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(r);for(let s=0;s=o?t[s+i]:r[i]}return e}):tn(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Me(n)>=Me(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Me(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Me(this.targetProj_.getExtent()):null;const u=Re(i),c=Ie(i),d=ve(i),p=xe(i),g=this.transformInv_(u),f=this.transformInv_(c),m=this.transformInv_(d),_=this.transformInv_(p),y=10+(s?Math.max(0,Math.ceil(Math.log2(ye(i)/(s*s*256*256)))):0);if(this.addQuad_(u,c,d,p,g,f,m,_,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&u<1;let p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){p=Me(Qt([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])&&!Fe(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=(Wt(r[0],c)+Wt(o[0],c))/2-Wt(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;ge(t,r[0]),ge(t,r[1]),ge(t,r[2])})),t}getTriangles(){return this.triangles_}}function Vu(t,e,i,n,r,s,o){const a=1/(t-e),l=1/(i-n),h=1/(r-s);return(o=o??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*h,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*l,o[14]=(s+r)*h,o[15]=1,o}function Yu(t,e,i,n,r){return(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*n,r[9]=t[9]*n,r[10]=t[10]*n,r[11]=t[11]*n,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}class Ku{constructor(t){this.gl_=t,this.program_=$u(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"),this.positionLocation=t.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=t.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=t.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=t.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=t.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.positions),t.STATIC_DRAW),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.texcoords),t.STATIC_DRAW)}drawImage(t,e,i,n,r,s,o,a,l,h,u,c,d){const p=this.gl_;void 0===a&&(a=n),void 0===l&&(l=r),void 0===s&&(s=e),void 0===o&&(o=i),void 0===h&&(h=s),void 0===u&&(u=o),void 0===c&&(c=p.canvas.width),void 0===d&&(d=p.canvas.height),p.bindTexture(p.TEXTURE_2D,t),p.useProgram(this.program_),p.bindBuffer(p.ARRAY_BUFFER,this.positionBuffer),p.enableVertexAttribArray(this.positionLocation),p.vertexAttribPointer(this.positionLocation,2,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,this.texcoordBuffer),p.enableVertexAttribArray(this.texcoordLocation),p.vertexAttribPointer(this.texcoordLocation,2,p.FLOAT,!1,0,0);let g=Vu(0,c,0,d,-1,1);g=function(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,g,f,m;return t===(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])?(r[12]=t[0]*e+t[4]*i+t[8]*n+t[12],r[13]=t[1]*e+t[5]*i+t[9]*n+t[13],r[14]=t[2]*e+t[6]*i+t[10]*n+t[14],r[15]=t[3]*e+t[7]*i+t[11]*n+t[15]):(s=t[0],o=t[1],a=t[2],l=t[3],h=t[4],u=t[5],c=t[6],d=t[7],p=t[8],g=t[9],f=t[10],m=t[11],r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=h,r[5]=u,r[6]=c,r[7]=d,r[8]=p,r[9]=g,r[10]=f,r[11]=m,r[12]=s*e+h*i+p*n+t[12],r[13]=o*e+u*i+g*n+t[13],r[14]=a*e+c*i+f*n+t[14],r[15]=l*e+d*i+m*n+t[15]),r}(g,a,l,0),g=Yu(g,h,u,1),p.uniformMatrix4fv(this.matrixLocation,!1,g);let f=(m=n/e,_=r/i,y=0,(x=x??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=1,x[1]=0,x[2]=0,x[3]=0,x[4]=0,x[5]=1,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1,x[11]=0,x[12]=m,x[13]=_,x[14]=y,x[15]=1,x);var m,_,y,x;f=Yu(f,s/e,o/i,1),p.uniformMatrix4fv(this.textureMatrixLocation,!1,f),p.uniform1i(this.textureLocation,0),p.drawArrays(p.TRIANGLES,0,this.positions.length/2)}}function Zu(t,e,i){const n=t.createShader(e);if(null===n)throw new Error("Shader compilation failed");if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(n);if(null===e)throw new Error("Shader info log creation failed");throw new Error(e)}return n}function $u(t,e,i){const n=t.createProgram(),r=Zu(t,t.VERTEX_SHADER,i),s=Zu(t,t.FRAGMENT_SHADER,e);if(null===n)throw new Error("Program creation failed");if(t.attachShader(n,r),t.attachShader(n,s),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){if(null===t.getProgramInfoLog(n))throw new Error("Program info log creation failed");throw new Error}return n}const Hu=[];function Ju(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const g=Math.round(n*e),f=Math.round(n*i);let m,_;if(t.canvas.width=g,t.canvas.height=f,_=t.createTexture(),t.bindTexture(t.TEXTURE_2D,_),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,g,f,0,t.RGBA,u,null),m=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,m),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,_,0),null===m)throw new Error("Could not create framebuffer");if(null===_)throw new Error("Could not create texture");if(0===l.length)return{width:g,height:f,framebuffer:m,texture:_};const y=[1/0,1/0,-1/0,-1/0];let x,v,w;l.forEach((function(t,e,i){pe(y,t.extent)}));const b=1/r;{if(x=t.createTexture(),null===_)throw new Error("Could not create texture");v=Math.round(Me(y)*b),w=Math.round(Ce(y)*b);const e=t.getParameter(t.MAX_TEXTURE_SIZE),i=Math.max(v,w),n=i>e?e/i:1,r=Math.round(v*n),s=Math.round(w*n);t.bindTexture(t.TEXTURE_2D,x),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,s,0,t.RGBA,u,null);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0);const a=new Ku(t);l.forEach((function(e,i,l){const u=(e.extent[0]-y[0])*b*n,c=-(e.extent[3]-y[3])*b*n,p=Me(e.extent)*b*n,g=Ce(e.extent)*b*n;if(t.bindFramebuffer(t.FRAMEBUFFER,o),t.viewport(0,0,r,s),e.clipExtent){const i=(e.clipExtent[0]-y[0])*b*n,r=-(e.clipExtent[3]-y[3])*b*n,s=Me(e.clipExtent)*b*n,o=Ce(e.clipExtent)*b*n;t.enable(t.SCISSOR_TEST),t.scissor(d?i:Math.round(i),d?r:Math.round(r),d?s:Math.round(i+s)-Math.round(i),d?o:Math.round(r+o)-Math.round(r))}a.drawImage(e.texture,e.width,e.height,h,h,e.width-2*h,e.height-2*h,d?u:Math.round(u),d?c:Math.round(c),d?p:Math.round(u+p)-Math.round(u),d?g:Math.round(c+g)-Math.round(c),r,s),t.disable(t.SCISSOR_TEST)})),t.deleteFramebuffer(o)}const E=Re(o),S=Re(y),C=t=>{const e=(t[0][0]-E[0])/s*n,i=-(t[0][1]-E[1])/s*n;return{u1:(t[1][0]-E[0])/s*n,v1:-(t[1][1]-E[1])/s*n,u0:e,v0:i,u2:(t[2][0]-E[0])/s*n,v2:-(t[2][1]-E[1])/s*n}};t.bindFramebuffer(t.FRAMEBUFFER,m),t.viewport(0,0,g,f);{const e=[],i=[],n=$u(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n");t.useProgram(n);const s=t.getUniformLocation(n,"u_texture");t.bindTexture(t.TEXTURE_2D,x),t.uniform1i(s,0),a.getTriangles().forEach((function(t,n,s){const o=t.source,a=t.target,{u1:l,v1:h,u0:u,v0:c,u2:d,v2:p}=C(a),g=(o[0][0]-S[0])/r/v,f=-(o[0][1]-S[1])/r/w,m=(o[1][0]-S[0])/r/v,_=-(o[1][1]-S[1])/r/w,y=(o[2][0]-S[0])/r/v,x=-(o[2][1]-S[1])/r/w;e.push(l,h,u,c,d,p),i.push(m,_,g,f,y,x)}));const o=Vu(0,g,f,0,-1,1),l=t.getUniformLocation(n,"u_matrix");t.uniformMatrix4fv(l,!1,o);const h=t.getAttribLocation(n,"a_position"),u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.vertexAttribPointer(h,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h);const c=t.getAttribLocation(n,"a_texcoord"),d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.drawArrays(t.TRIANGLES,0,e.length/2)}if(c){const e=$u(t,"\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n","\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n");t.useProgram(e);const i=Vu(0,g,f,0,-1,1),n=t.getUniformLocation(e,"u_matrix");t.uniformMatrix4fv(n,!1,i);const r=Array.isArray(c)?c:[0,0,0,255],s=t.getUniformLocation(e,"u_val");t.uniform4fv(s,r);const o=t.getAttribLocation(e,"a_position"),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const h=a.getTriangles().reduce((function(t,e){const i=e.target,{u1:n,v1:r,u0:s,v0:o,u2:a,v2:l}=C(i);return t.concat([n,r,s,o,s,o,a,l,a,l,n,r])}),[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(h),t.STATIC_DRAW),t.drawArrays(t.LINES,0,h.length/2)}return{width:g,height:f,framebuffer:m,texture:_}}class Qu extends zu{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.renderEdges_=void 0!==t.renderEdges&&t.renderEdges,this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),n=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?n?Te(i,n):i:n;const r=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),s=this.targetTileGrid_.getExtent();let o=this.sourceTileGrid_.getExtent();const a=s?Te(r,s):r;if(0===ye(a))return void(this.state=kt.EMPTY);i&&(o=o?Te(o,i):i);const l=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,u=qu(e,h,a,l);if(!isFinite(u)||u<=0)return void(this.state=kt.EMPTY);const c=void 0!==t.errorThreshold?t.errorThreshold:.5;if(this.triangulation_=new Bu(e,h,a,o,u*c,l,t.transformMatrix),0===this.triangulation_.getTriangles().length)return void(this.state=kt.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(u);let d=this.triangulation_.calculateSourceExtent();if(o&&(e.canWrapX()?(d[1]=jt(d[1],o[1],o[3]),d[3]=jt(d[3],o[1],o[3])):d=Te(d,o)),ye(d)){let n=0,r=0;e.canWrapX()&&(n=Me(i),r=Math.floor((d[0]-i[0])/n));Le(d.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=kt.EMPTY)}else this.state=kt.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach((i=>{const n=i.tile;if(!n||n.getState()!==kt.LOADED)return;const r=n.getSize(),s=this.gutter_;let o;const a=(l=n.getData())instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Float32Array||l instanceof DataView?l:null;var l;a?o=a:(e=!0,o=function(t){Du||(Du=w(t.width,t.height,void 0,{willReadFrequently:!0}));const e=Du.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),Du.clearRect(0,0,i,n),Du.drawImage(t,0,0),Du.getImageData(0,0,i,n).data}(Pu(n.getData())));const h=[r[0]+2*s,r[1]+2*s],u=o instanceof Float32Array,c=h[0]*h[1],d=u?Float32Array:Uint8ClampedArray,p=new d(o.buffer),g=d.BYTES_PER_ELEMENT,f=g*p.length/c,m=p.byteLength/h[1],_=Math.floor(m/g/h[0]),y=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);y[0]+=i.offset,y[2]+=i.offset;const x=this.clipExtent_?.slice();x&&(x[0]+=i.offset,x[2]+=i.offset),t.push({extent:y,clipExtent:x,data:p,dataType:d,bytesPerPixel:f,pixelSize:h,bandCount:_})})),this.sourceTiles_.length=0,0===t.length)return this.state=kt.ERROR,void this.changed();const i=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(i),r="number"==typeof n?n:n[0],s="number"==typeof n?n:n[1],o=r*this.pixelRatio_,a=s*this.pixelRatio_,l=this.targetTileGrid_.getResolution(i),h=this.sourceTileGrid_.getResolution(this.sourceZ_),u=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),c=t[0].bandCount,d=new t[0].dataType(c*o*a),p=function(t,e,i,n){let r;return r=i&&i.length?i.shift():_?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("webgl",n)}(o,a,Hu,{premultipliedAlpha:!1,antialias:!1});let g;const f=p.RGBA;let m;if(t[0].dataType==Float32Array){m=p.FLOAT,p.getExtension("WEBGL_color_buffer_float"),p.getExtension("OES_texture_float"),p.getExtension("EXT_float_blend");g=null!==p.getExtension("OES_texture_float_linear")&&this.interpolate}else m=p.UNSIGNED_BYTE,g=this.interpolate;for(let e=Math.ceil(c/4)-1;e>=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==kt.IDLE&&i!==kt.LOADING)return;t++;const n=G(e,T,(()=>{const i=e.getState();i!=kt.LOADED&&i!=kt.ERROR&&i!=kt.EMPTY||(N(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==kt.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(N),this.sourcesListenerKeys_=null}}class tc extends Yh{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,kt.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,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const f=p?Te(d,p):d;if(0===ye(f))return void(this.state=kt.EMPTY);const m=t.getExtent();m&&(g=g?Te(g,m):m);const _=n.getResolution(this.wrappedTileCoord_[0]),y=qu(t,i,f,_);if(!isFinite(y)||y<=0)return void(this.state=kt.EMPTY);const x=void 0!==h?h:.5;if(this.triangulation_=new Bu(t,i,f,g,y*x,_),0===this.triangulation_.getTriangles().length)return void(this.state=kt.EMPTY);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(v[1]=jt(v[1],g[1],g[3]),v[3]=jt(v[3],g[1],g[3])):v=Te(v,g)),ye(v)){let i=0,n=0;t.canWrapX()&&(i=Me(m),n=Math.floor((v[0]-m[0])/i));Le(v.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=l(this.sourceZ_,t,e,o);if(r){const t=n*i;this.sourceTiles_.push({tile:r,offset:t})}}++n})),0===this.sourceTiles_.length&&(this.state=kt.EMPTY)}else this.state=kt.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==kt.LOADED){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=kt.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_=Wu(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=kt.LOADED}this.changed()}load(){if(this.state==kt.IDLE){this.state=kt.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==kt.IDLE||i==kt.LOADING){t++;const i=G(e,T,(n=>{const r=e.getState();r!=kt.LOADED&&r!=kt.ERROR&&r!=kt.EMPTY||(N(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==kt.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(N),this.sourcesListenerKeys_=null}release(){this.canvas_&&(S(this.canvas_.getContext("2d")),ju.push(this.canvas_),this.canvas_=null),super.release()}}class ec{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Y&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}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}}function ic(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function nc(t,e,i,n){return`${t},${function(t,e,i){return t+"/"+e+"/"+i}(e,i,n)}`}function rc(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function sc(t,e,i){const n=t[i];return!!n&&n.delete(e)}function oc(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Te(e,an(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Te(e,i))}return e}class ac extends qh{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision_,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Zh(0,0,0,0),this.tempTileCoord_=ic(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new ec(i),this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=nc(s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{if(a=s.getTile(t,e,i,n.pixelRatio,n.viewState.projection),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=fn(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ne(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==kt.LOADED)continue;const h=a.getOrigin(t),u=fo(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Kh||r instanceof tc)d=r.getImage();else{if(!(r instanceof zu))continue;if(d=Pu(r.getData()),!d)continue}const p=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),g=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),f=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+f,g+f)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedRevision_?this.renderedRevision_!==i&&(this.renderedRevision_=i,this.renderedSourceKey_===e.getKey()&&this.tileCache_.clear()):this.renderedRevision_=i,!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=ut(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,g=p?Se(s.center,s.resolution,p,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(p&&!l.tileCoordIntersectsViewport([r,e,o],g))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!rc(n,i,r))continue;const a=i.getKey();if(u[a]=!0,i.getState()===kt.IDLE&&!t.tileQueue.isKeyQueued(a)){const n=ic(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t0&&setTimeout((()=>{this.enqueueTiles(t,C,d-1,E,S-1)}),0),!(d in E))return this.container;const T=ut(this),R=t.time;for(const e of E[d]){const n=e.getState();if((e instanceof tc||e instanceof Qu)&&n===kt.EMPTY)continue;const r=e.tileCoord;if(n===kt.LOADED){if(1===e.getAlpha(T,R)){e.endTransition(T);continue}}n!==kt.IDLE&&(i=!1),n!==kt.ERROR&&(this.renderComplete=!1);if(this.findStaleTile_(r,E)){sc(E,e,d),t.animate=!0;continue}if(this.findAltTiles_(c,r,d+1,E))continue;const s=c.getMinZoom();for(let t=d-1;t>=s;--t){if(this.findAltTiles_(c,r,t,E))break}}const I=p/o*l/m,M=this.getRenderContext(t);_n(this.tempTransform,_/2,y/2,I,I,0,-_/2,-y/2),n.extent&&this.clipUnrotated(M,t,x),u.getInterpolate()||(M.imageSmoothingEnabled=!1),this.preRender(M,t);const F=Object.keys(E).map(Number);let k;F.sort(K);const A=[],P=[];for(let e=F.length-1;e>=0;--e){const i=F[e],n=u.getTilePixelSize(i,l,s),r=c.getResolution(i)/p,o=n[0]*r*I,a=n[1]*r*I,h=c.getTileCoordForCoordAndZ(Re(b),i),d=c.getTileCoordExtent(h),g=fn(this.tempTransform,[m*(d[0]-b[0])/p,m*(b[3]-d[3])/p]),f=m*u.getGutterForProjection(s);for(const e of E[i]){if(e.getState()!==kt.LOADED)continue;const n=e.tileCoord,r=h[1]-n[1],s=Math.round(g[0]-(r-1)*o),l=h[2]-n[2],c=Math.round(g[1]-(l-1)*a),d=Math.round(g[0]-r*o),p=Math.round(g[1]-l*a),m=s-d,_=c-p,y=1===F.length;let x=!1;k=[d,p,d+m,p,d+m,p+_,d,p+_];for(let t=0,e=A.length;t{const i=ut(u),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache()};t.postRenderFunctions.push(e)}return this.renderComplete||i||(t.animate=!0),this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof zu){if(l=Pu(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=ut(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()}updateUsedTiles(t,e,i){const n=ut(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var lc="preload",hc="useInterimTilesOnError";class uc extends Rs{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(lc)}setPreload(t){this.set(lc,t)}getUseInterimTilesOnError(){return this.get(hc)}setUseInterimTilesOnError(t){this.set(hc,t)}getData(t){return super.getData(t)}}class cc extends uc{constructor(t){super(t)}createRenderer(){return new ac(this,{cacheSize:this.getCacheSize()})}}function dc(t){return Array.isArray(t)?Math.min(...t):t}class pc extends Ko{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?Te(i,l):i,u=Uu(t,e,we(h),n),c=new Bu(t,e,h,a,.5*u,n),d=c.calculateSourceExtent(),p=ke(d)?null:s(d,u,r),g=p?Yo.IDLE:Yo.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==Yo.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==Yo.LOADED){const t=Me(this.targetExtent_)/this.targetResolution_,e=Ce(this.targetExtent_)/this.targetResolution_;this.canvas_=Wu(t,e,this.sourcePixelRatio_,dc(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==Yo.IDLE){this.state=Yo.LOADING,this.changed();const t=this.sourceImage_.getState();t==Yo.LOADED||t==Yo.ERROR?this.reproject_():(this.sourceListenerKey_=G(this.sourceImage_,T,(t=>{const e=this.sourceImage_.getState();e!=Yo.LOADED&&e!=Yo.ERROR||(this.unlistenSource_(),this.reproject_())})),this.sourceImage_.load())}}unlistenSource_(){N(this.sourceListenerKey_),this.sourceListenerKey_=null}}const gc="imageloadstart",fc="imageloadend",mc="imageloaderror";class _c extends st{constructor(t,e){super(t),this.image=e}}class yc extends jl{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[$(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Hi(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Hi(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&de(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new pc(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=Kt(Me(t)/r,4),a=Kt(Ce(t)/r,4),l=Kt((n-1)*o/2,4),h=o+2*l,u=Kt((n-1)*a/2,4);return Ee(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_&&re(this.wantedExtent_,r)||re(this.image.getExtent(),r))&&(this.wantedResolution_&&dc(this.wantedResolution_)===s||dc(this.image.getResolution())===s)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new Ko(r,s,i,this.loader),this.image.addEventListener(T,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Yo.LOADING:this.loading=!0,i=gc;break;case Yo.LOADED:this.loading=!1,i=fc;break;case Yo.ERROR:this.loading=!1,i=mc;break;default:return}this.hasListener(i)&&this.dispatchEvent(new _c(i,e))}}const xc=[0,0,0];class vc{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,At(function(t,e,i){const n=e||K;return t.every((function(e,i){if(0===i)return!0;const r=n(t[i-1],e);return!(r>0||0===r)}))}(this.resolutions_,((t,e)=>e-t)),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new Zh(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=$h(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Tc extends st{constructor(t,e){super(t),this.tile=e}}function Rc(t){return function(e){const i=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=i.length,l=i[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:n,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sthis.getTileInternal(t,e,i,n,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return c.key=a,c}getTileInternal(t,e,i,n,r){const s=this.getKey();return this.createTile_(t,e,i,n,r,s)}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Vi(t);if(i){const t=ut(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Kc(t,e){t.getImage().src=e}class Zc extends Yc{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:Vi("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_"+ut(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+"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{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=Vi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Ji(e,i);n=Ae(t.bounds,r)}const r=Sc(i),s=t.minzoom||0,o=bc({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=Uc(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return Fe(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}const $c={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Hc={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class Jc extends ac{constructor(t,e){super(t,e),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}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState.resolution,o=n.viewHints;return!!(o[Ot]||o[zt])&&r.wantedResolution||(r.wantedResolution=s),r}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=ut(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let i=0,r=d.length;it.value)):null;let m;t:for(let e=0,n=d.length;e{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=fn(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find((t=>t.tileCoord.toString()===u&&t.getState()===kt.LOADED));if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!re(o,l.getTileCoordExtent(c.tileCoord))&&ze(h,s);const d=ut(n),p=Re(l.getTileCoordExtent(c.wrappedTileCoord)),g=[(h[0]-p[0])/a,(p[1]-h[1])/a],f=c.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let m=c.hitDetectionImageData[d];if(!m){const t=fo(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=Gh(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,zh,t[0]*zh,t[1]*zh,0)],f,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(jh(g,f,m))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==kt.LOADED)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,Ph,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=ut(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.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()})),e[t].length=0)}))}))}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.tempExtent)[0]-d[0];return pn(mn(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[Ot]||i[zt]);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?Hc[s].filter((t=>!Ph.includes(t))):Hc[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=[],_=ut(r);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[_].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let w,b=t;if(v){w=new wh,b=w.getContext();for(let t=0,e=g.length;t{const r=this.tileUrlFunction(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?kt.IDLE:kt.EMPTY,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===kt.LOADED||n===kt.ERROR){const e=s.getKey();e in i.errorTileKeys?s.getState()===kt.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===kt.ERROR?i.errorTileKeys[e]=!0:s.removeEventListener(T,t),0===i.loadingSourceTiles&&i.setState(z(i.errorTileKeys)?kt.LOADED:kt.ERROR)}};s.addEventListener(T,t),i.loadingSourceTiles++}o===kt.IDLE&&(s.extent=l.getTileCoordExtent(n),s.projection=e,s.resolution=l.getResolution(n[0]),s.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===kt.ERROR))?kt.ERROR:kt.LOADED)}return i.sourceTiles}removeSourceTiles(t){const e=t.sourceTiles;for(let t=0,i=e.length;t{h=h&&!this.tileUrlFunction(t,n,r)}))}const u=new Jh(s,h?kt.EMPTY:kt.IDLE,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return u.key=this.getKey(),u}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=_r+1;for(let t=n.length;t255?255:t}function od(t){return t<0?0:t>1?1:t}function ad(t){return"%"===t[t.length-1]?sd(parseFloat(t)/100*255):sd(parseInt(t))}function ld(t){return"%"===t[t.length-1]?od(parseFloat(t)/100):od(parseFloat(t))}function hd(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{nd={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in rd)return rd[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=ld(o.pop());case"rgb":return 3!==o.length?null:[ad(o[0]),ad(o[1]),ad(o[2]),a];case"hsla":if(4!==o.length)return null;a=ld(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=ld(o[1]),u=ld(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[sd(255*hd(d,c,l+1/3)),sd(255*hd(d,c,l)),sd(255*hd(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class ud{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 ud)return t;if("string"!=typeof t)return;const e=nd(t);return e?new ud(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]}}ud.black=new ud(0,0,0,1),ud.white=new ud(1,1,1,1),ud.transparent=new ud(0,0,0,0),ud.red=new ud(1,0,0,1),ud.blue=new ud(0,0,1,1);var cd=ud;function dd(t){return"object"==typeof t?["literal",t]:t}function pd(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,dd(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],vd(t[1])]:[t[0],dd(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function xd(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function vd(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`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const zd=[Cd,Td,Rd,Id,Md,Pd,Fd,Dd(kd),Ld];function Gd(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Gd(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 zd)if(!Gd(t,e))return null}return`Expected ${Od(t)} but found ${Od(e)} instead.`}function jd(t,e){return e.some((e=>e.kind===t.kind))}function Nd(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 Xd{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 Ud{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 qd{constructor(t){this.sections=t}static fromString(t){return new qd([new Ud(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 qd?t:qd.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 Wd{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Wd({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Bd(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 Vd(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 cd)return!0;if(t instanceof Xd)return!0;if(t instanceof qd)return!0;if(t instanceof Wd)return!0;if(Array.isArray(t)){for(const e of t)if(!Vd(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Vd(t[e]))return!1;return!0}return!1}function Yd(t){if(null===t)return Cd;if("string"==typeof t)return Rd;if("boolean"==typeof t)return Id;if("number"==typeof t)return Td;if(t instanceof cd)return Md;if(t instanceof Xd)return Ad;if(t instanceof qd)return Pd;if(t instanceof Wd)return Ld;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Yd(e);if(i){if(i===t)continue;i=kd;break}i=t}return Dd(i||kd,e)}return Fd}function Kd(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof cd||t instanceof qd||t instanceof Wd?t.toString():JSON.stringify(t)}class Zd{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(!Vd(t[1]))return e.error("invalid value");const i=t[1];let n=Yd(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 Zd(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 cd?["rgba"].concat(this.value.toArray()):this.value instanceof qd?this.value.serialize():this.value}}var $d=Zd;var Hd=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Jd={string:Rd,number:Td,boolean:Id,object:Fd};class Qd{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 Jd)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Jd[i],n++}else r=kd;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=Dd(r,s)}else i=Jd[r];const s=[];for(;nt.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 tp=Qd;class ep{constructor(t){this.type=Pd,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,Td),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,Dd(Rd)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,Md),!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,kd);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 ep(n)}evaluate(t){return new qd(this.sections.map((e=>{const i=e.content.evaluate(t);return Yd(i)===Ld?new Ud("",i,null,null,null):new Ud(Kd(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 ip{constructor(t){this.type=Ld,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Rd);return i?new ip(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Wd.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 np={"to-boolean":Id,"to-color":Md,"to-number":Td,"to-string":Rd};class rp{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=np[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Bd(e[0],e[1],e[2],e[3]),!i))return new cd(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Hd(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 Hd(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?qd.fromString(Kd(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Wd.fromString(Kd(this.args[0].evaluate(t))):Kd(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 ep([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ip(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var sp=rp;const op=["Unknown","Point","LineString","Polygon"];var ap=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?op[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]=cd.parse(t)),e}};class lp{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=lp.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 zp(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(Od).join(", ")})`:`(${Od(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function gp(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*cp),Math.round(n*s*cp)]}function fp(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 mp(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 _p(t,e){let i=!1;for(let n=0,r=e.length;n0&&c<0||u<0&&c>0}function vp(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]&&!(!xp(t,e,i,n)||!xp(i,n,t,e));var o,a}function wp(t,e,i){for(const n of i)for(let i=0;ii[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}dp(e,t)}function Rp(t,e,i,n){const r=Math.pow(2,n.z)*cp,s=[n.x*cp,n.y*cp],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]];Tp(n,e,i,r),o.push(n)}return o}function Ip(t,e,i,n){const r=Math.pow(2,n.z)*cp,s=[n.x*cp,n.y*cp],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]];dp(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)Tp(n,e,i,r)}return o}class Mp{constructor(t,e){this.type=Id,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(Vd(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!kp(t)&&(e=!1)})),e}function Ap(t){if(t instanceof hp&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ap(t)&&(e=!1)})),e}function Pp(t,e){if(t instanceof hp&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Pp(t,e)&&(i=!1)})),i}class Lp{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 Lp(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 Dp=Lp;class Op{constructor(t,e=[],i,n=new Sd,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 tp(e,[t]):"coerce"===i?new sp(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 $d)&&"resolvedImage"!==n.type.kind&&Gp(n)){const t=new ap;try{n=new $d(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 Op(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new bd(i,t))}checkSubtype(t,e){const i=Gd(t,e);return i&&this.error(i),i}}var zp=Op;function Gp(t){if(t instanceof Dp)return Gp(t.boundExpression);if(t instanceof hp&&"error"===t.name)return!1;if(t instanceof up)return!1;if(t instanceof Fp)return!1;const e=t instanceof sp||t instanceof tp;let i=!0;return t.eachChild((t=>{i=e?i&&Gp(t):i&&t instanceof $d})),!!i&&(kp(t)&&Pp(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function jp(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||ee))throw new Hd("Input is not a number.");o=a-1}return 0}class Np{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,Td);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=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 Np(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[jp(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;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var Xp=Np,Up=qp;function qp(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}qp.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},qp.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},qp.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},qp.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},qp.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Wp=id(Up);function Bp(t,e,i){return t*(1-i)+e*i}var Vp=Object.freeze({__proto__:null,number:Bp,color:function(t,e,i){return new cd(Bp(t.r,e.r,i),Bp(t.g,e.g,i),Bp(t.b,e.b,i),Bp(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>Bp(t,e[n],i)))}});const Yp=.95047,Kp=1,Zp=1.08883,$p=4/29,Hp=6/29,Jp=3*Hp*Hp,Qp=Hp*Hp*Hp,tg=Math.PI/180,eg=180/Math.PI;function ig(t){return t>Qp?Math.pow(t,1/3):t/Jp+$p}function ng(t){return t>Hp?t*t*t:Jp*(t-$p)}function rg(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function sg(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function og(t){const e=sg(t.r),i=sg(t.g),n=sg(t.b),r=ig((.4124564*e+.3575761*i+.1804375*n)/Yp),s=ig((.2126729*e+.7151522*i+.072175*n)/Kp);return{l:116*s-16,a:500*(r-s),b:200*(s-ig((.0193339*e+.119192*i+.9503041*n)/Zp)),alpha:t.a}}function ag(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=Kp*ng(e),i=Yp*ng(i),n=Zp*ng(n),new cd(rg(3.2404542*i-1.5371385*e-.4985314*n),rg(-.969266*i+1.8760108*e+.041556*n),rg(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function lg(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const hg={forward:og,reverse:ag,interpolate:function(t,e,i){return{l:Bp(t.l,e.l,i),a:Bp(t.a,e.a,i),b:Bp(t.b,e.b,i),alpha:Bp(t.alpha,e.alpha,i)}}},ug={forward:function(t){const{l:e,a:i,b:n}=og(t),r=Math.atan2(n,i)*eg;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*tg,i=t.c;return ag({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:lg(t.h,e.h,i),c:Bp(t.c,e.c,i),l:Bp(t.l,e.l,i),alpha:Bp(t.alpha,e.alpha,i)}}};class cg{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=dg(e,t.base,i,n);else if("linear"===t.name)r=dg(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Wp(s[0],s[1],s[2],s[3]).solve(dg(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,Td),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Md:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=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 cg(a,i,n,r,o):e.error(`Type ${Od(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=jp(e,n),o=e[s],a=e[s+1],l=cg.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?Vp[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?ug.reverse(ug.interpolate(ug.forward(h),ug.forward(u),l)):hg.reverse(hg.interpolate(hg.forward(h),hg.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;tGd(n,t.type)));return new gg(s?kd: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 Wd&&!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 fg=gg;class mg{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=i.length)throw new Hd(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Hd(`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 xg=yg;class vg{constructor(t,e){this.type=Id,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,kd),n=e.parse(t[2],2,kd);return i&&n?jd(i.type,[Id,Rd,Td,Cd,kd])?new vg(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Od(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!Nd(e,["boolean","string","number","null"]))throw new Hd(`Expected first argument to be of type boolean, string, number or null, but found ${Od(Yd(e))} instead.`);if(!Nd(i,["string","array"]))throw new Hd(`Expected second argument to be of type array or string, but found ${Od(Yd(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 wg=vg;class bg{constructor(t,e,i){this.type=Td,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,kd),n=e.parse(t[2],2,kd);if(!i||!n)return null;if(!jd(i.type,[Id,Rd,Td,Cd,kd]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Od(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Td);return r?new bg(i,n,r):null}return new bg(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Nd(e,["boolean","string","number","null"]))throw new Hd(`Expected first argument to be of type boolean, string, number or null, but found ${Od(Yd(e))} instead.`);if(!Nd(i,["string","array"]))throw new Hd(`Expected second argument to be of type array or string, but found ${Od(Yd(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 Eg=bg;class Sg{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;oNumber.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,Yd(t)))return null}else i=Yd(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,kd);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 Sg(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Yd(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 Cg=Sg;class Tg{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;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Rg=Tg;class Ig{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,kd),n=e.parse(t[2],2,Td);if(!i||!n)return null;if(!jd(i.type,[Dd(kd),Rd,kd]))return e.error(`Expected first argument to be of type array or string, but found ${Od(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Td);return r?new Ig(i.type,i,n,r):null}return new Ig(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Nd(e,["string","array"]))throw new Hd(`Expected first argument to be of type array or string, but found ${Od(Yd(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 Mg=Ig;function Fg(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 kg(t,e,i,n){return 0===n.compare(e,i)}function Ag(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=Id,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,kd);if(!s)return null;if(!Fg(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Od(s.type)}'.`);let o=e.parse(t[2],2,kd);if(!o)return null;if(!Fg(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Od(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Od(s.type)}' and '${Od(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new tp(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new tp(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,Ad),!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=Yd(s),i=Yd(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Hd(`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=Yd(s),i=Yd(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 Pg=Ag("==",(function(t,e,i){return e===i}),kg),Lg=Ag("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!kg(0,e,i,n)})),Dg=Ag("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),zg=Ag("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),Gg=Ag(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class jg{constructor(t,e,i,n,r,s){this.type=Rd,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,Td);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,Rd),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,Rd),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,Rd),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,Td),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,Td),!l)?null:new jg(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 Ng{constructor(t){this.type=Td,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 ${Od(i.type)} instead.`):new Ng(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 Hd(`Expected value to be of type string or array, but found ${Od(Yd(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Xg={"==":Pg,"!=":Lg,">":Og,"<":Dg,">=":Gg,"<=":zg,array:tp,at:xg,boolean:tp,case:Rg,coalesce:fg,collator:up,format:ep,image:ip,in:wg,"index-of":Eg,interpolate:pg,"interpolate-hcl":pg,"interpolate-lab":pg,length:Ng,let:_g,literal:$d,match:Cg,number:tp,"number-format":jg,object:tp,slice:Mg,step:Xp,string:tp,"to-boolean":sp,"to-color":sp,"to-number":sp,"to-string":sp,var:Dp,within:Fp};function Ug(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=Bd(e,i,n,s);if(o)throw new Hd(o);return new cd(e/255*s,i/255*s,n/255*s,s)}function qg(t,e){return t in e}function Wg(t,e){const i=e[t];return void 0===i?null:i}function Bg(t){return{type:t}}hp.register(Xg,{error:[{kind:"error"},[Rd],(t,[e])=>{throw new Hd(e.evaluate(t))}],typeof:[Rd,[kd],(t,[e])=>Od(Yd(e.evaluate(t)))],"to-rgba":[Dd(Td,4),[Md],(t,[e])=>e.evaluate(t).toArray()],rgb:[Md,[Td,Td,Td],Ug],rgba:[Md,[Td,Td,Td,Td],Ug],has:{type:Id,overloads:[[[Rd],(t,[e])=>qg(e.evaluate(t),t.properties())],[[Rd,Fd],(t,[e,i])=>qg(e.evaluate(t),i.evaluate(t))]]},get:{type:kd,overloads:[[[Rd],(t,[e])=>Wg(e.evaluate(t),t.properties())],[[Rd,Fd],(t,[e,i])=>Wg(e.evaluate(t),i.evaluate(t))]]},"feature-state":[kd,[Rd],(t,[e])=>Wg(e.evaluate(t),t.featureState||{})],properties:[Fd,[],t=>t.properties()],"geometry-type":[Rd,[],t=>t.geometryType()],id:[kd,[],t=>t.id()],zoom:[Td,[],t=>t.globals.zoom],pitch:[Td,[],t=>t.globals.pitch||0],"distance-from-center":[Td,[],t=>t.distanceFromCenter()],"heatmap-density":[Td,[],t=>t.globals.heatmapDensity||0],"line-progress":[Td,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Td,[],t=>t.globals.skyRadialProgress||0],accumulated:[kd,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Td,Bg(Td),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[Td,Bg(Td),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:Td,overloads:[[[Td,Td],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Td],(t,[e])=>-e.evaluate(t)]]},"/":[Td,[Td,Td],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Td,[Td,Td],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Td,[],()=>Math.LN2],pi:[Td,[],()=>Math.PI],e:[Td,[],()=>Math.E],"^":[Td,[Td,Td],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[Td,[Td],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Td,[Td],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Td,[Td],(t,[e])=>Math.log(e.evaluate(t))],log2:[Td,[Td],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Td,[Td],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Td,[Td],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Td,[Td],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Td,[Td],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Td,[Td],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Td,[Td],(t,[e])=>Math.atan(e.evaluate(t))],min:[Td,Bg(Td),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Td,Bg(Td),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Td,[Td],(t,[e])=>Math.abs(e.evaluate(t))],round:[Td,[Td],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Td,[Td],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Td,[Td],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Id,[Rd,kd],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Id,[kd],(t,[e])=>t.id()===e.value],"filter-type-==":[Id,[Rd],(t,[e])=>t.geometryType()===e.value],"filter-<":[Id,[Rd,kd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[Id,[Rd,kd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[Id,[kd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Id,[Rd,kd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[Id,[kd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Id,[Rd,kd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[Id,[kd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Id,[kd],(t,[e])=>e.value in t.properties()],"filter-has-id":[Id,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Id,[Dd(Rd)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Id,[Dd(kd)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Id,[Rd,Dd(kd)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Id,[Rd,Dd(kd)],(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:Id,overloads:[[[Id,Id],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Bg(Id),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Id,overloads:[[[Id,Id],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Bg(Id),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Id,[Id],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Id,[Rd],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Rd,[Rd],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Rd,[Rd],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Rd,Bg(kd),(t,e)=>e.map((e=>Kd(e.evaluate(t)))).join("")],"resolved-locale":[Rd,[Ad],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Vg=Xg;function Yg(t){return{result:"success",value:t}}function Kg(t){return{result:"error",value:t}}function Zg(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class $g{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ap,this._defaultValue=e?function(t){return"color"===t.type&&(Zg(t.default)||Array.isArray(t.default))?new cd(0,0,0,0):"color"===t.type?cd.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 Hd(`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 Hg(t,e){const i=new zp(Vg,[],e?function(t){const e={color:Md,string:Rd,number:Td,enum:Rd,boolean:Id,formatted:Pd,resolvedImage:Ld};if("array"===t.type)return Dd(e[t.value]||kd,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?Yg(new $g(n,e)):Kg(i.errors)}class Jg{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ap(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 Qg{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ap(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?pg.interpolationFactor(this.interpolationType,t,e,i):0}}function tf(t,e){if("error"===(t=Hg(t,e)).result)return t;const i=t.value.expression,n=kp(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return Kg([new bd("","data expressions not supported")]);const r=Pp(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Kg([new bd("","zoom expressions not supported")]);const s=ef(i);if(!s&&!r)return Kg([new bd("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof bd)return Kg([s]);if(s instanceof pg&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Kg([new bd("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Yg(new Jg(n?"constant":"source",t.value));const o=s instanceof pg?s.interpolation:void 0;return Yg(new Qg(n?"camera":"composite",t.value,s.labels,o))}function ef(t){let e=null;if(t instanceof _g)e=ef(t.result);else if(t instanceof fg){for(const i of t.args)if(e=ef(i),e)break}else(t instanceof Xp||t instanceof pg)&&t.input instanceof hp&&"zoom"===t.input.name&&(e=t);return e instanceof bd||t.eachChild((t=>{const i=ef(t);i instanceof bd?e=i:!e&&i?e=new bd("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new bd("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function nf(t){if(Array.isArray(t))return t.map(nf);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=nf(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var rf={$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 sf(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(!sf(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function of(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};sf(t)||(t=pf(t));const i=t;let n=!0;try{n=function(t){if(!hf(t))return t;let e=nf(t);return lf(e),e=af(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=rf[`filter_${e}`],s=Hg(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=Hg(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=!kp(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:df(n),needFeature:!!l}}function af(t){if(!Array.isArray(t))return t;const e=function(t){if(uf.has(t[0]))for(let e=1;eaf(t)))}function lf(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function cf(t,e){return te?1:0}function df(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?gf(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(pf))):"all"===e?["all"].concat(t.slice(1).map(pf)):"none"===e?["all"].concat(t.slice(1).map(pf).map(_f)):"in"===e?ff(t[1],t.slice(2)):"!in"===e?_f(ff(t[1],t.slice(2))):"has"===e?mf(t[1]):"!has"===e?_f(mf(t[1])):"within"!==e||t}function gf(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 ff(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(cf)]]:["filter-in-small",t,["literal",e]]}}function mf(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function _f(t){return["!",t]}var yf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xf(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return yf.forEach((t=>{t in e&&(i[t]=e[t])})),i}function vf(t){t=t.slice();const e=Object.create(null);for(let i=0;i1?c[c.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||g+"-"+d==p){o=r?o:wf[p],c.pop(),g&&p.startsWith(g)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var f=c.join(bf).replace("Klokantech Noto Sans","Noto Sans");-1!==f.indexOf(bf)&&(f='"'+f+'"'),l.push(f)}n=Sf[t]=[a,o,l]}return n[0]+bf+n[1]+bf+e+"px"+(i?"/"+i:"")+bf+n[2]}));const Tf="https://api.mapbox.com";function Rf(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function If(t,e){const i=Rf(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`${Tf}/styles/v1/${r}?&access_token=${e}`}const Mf=["a","b","c","d"];function Ff(t,e,i,n){const r=new URL(t,n),s=Rf(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),[decodeURI(r.href)]):[decodeURI(r.href)];if("mapbox.satellite"===s){const t=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${t}.webp?access_token=${e}`]}return Mf.map((t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`))}const kf={},Af={};let Pf=0;function Lf(t){return t.id||(t.id=Pf++),t.id}function Df(t){let e=kf[t.id];return e||(e={},kf[Lf(t)]=e),e}function Of(t){return t*Math.PI/180}const zf=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Gf(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 jf(t,e){let i=0;const n=e.length;for(;ir)).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 Xf[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete Xf[e],Promise.reject(new Error("Error fetching source "+e))})))));return Xf[e]=[r,s],s}function qf(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return Uf("Style",t=If(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const Wf={};function Bf(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=Wf[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof Qh)t.setLoader(((e,i,r)=>{rt((()=>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(kt.ERROR)))}))}));else{const e=t.getImage();rt((()=>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(kt.ERROR))):e.src=i}))}});const o=t.url;if(o&&!t.tiles){const n=Ff(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:n}),tileLoadFunction:s});else{const t={};r=Uf("Source",n[0],i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),Ff(n,i.accessToken,i.accessTokenParam||"access_token",t.request.url)[0]})),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}")),Ff(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)[0]}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s});Wf[n]=r}return r}function Vf(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Gf(r[0],r[1]),o=s.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,r[0],r[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;t0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),s}function Yf(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Kf(t,e,i){const n=Gf(e.width,e.height),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;t0?(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 Zf=Array(256).join(" ");function $f(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=Zf.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Hf;function Jf(){return Hf||(Hf=Gf(1,1).getContext("2d")),Hf}function Qf(t,e){return Jf().measureText(t).width+(t.length-1)*e}const tm={};function em(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=Jf();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(Qf(i,n)<.35*r){const r=t>0?Qf(l[t-1],n):1/0,s=t.7*r&&Qf(s,n)<.6*r){const o=i.split(" "),a=o.pop();Qf(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=$f(s,n),tm[r]=s}return s}const im=/font-family: ?([^;]*);/,nm=/("|')/g;let rm;function sm(t){if(!rm){rm={};const t=document.styleSheets;for(let e=0,i=t.length;e`${t.key}: ${t.message}`)).join(", "));return i.value},um={},cm={zoom:0};let dm,pm;function gm(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]||um)[i];const r=rf[`${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 Vg);if(!s&&Zg(n)&&(n=pd(n,r),s=!0),s){const t=hm(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=cd.parse(n)),l[i]=function(){return n}}var h;return cm.zoom=n,l[i](cm,r,o)}function fm(t,e,i,n,r){if(!gm(t,"layout",`${n}-allow-overlap`,e,i,r))return"declutter";return gm(t,"layout",`${n}-ignore-placement`,e,i,r)?"none":"obstacle"}function mm(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=of(e).filter),cm.zoom=n,r[t](cm,i)}function _m(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 ym=/\{[^{}}]*\}/g;function xm(t,e){return t.replace(ym,(function(t){return e[t.slice(1,-1)]||""}))}const vm={};function wm(t,e,i,n=zf,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(vm[function(t,e){return Lf(t)+"."+ut(e)}(e,t)]=Array.from(arguments),s)if("undefined"!=typeof Image){const e=new Image;let i;rt((()=>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=vf(e.layers),d={},p=[],g={},f={},m=Df(e),_=function(t){let e=Af[t.id];return e||(e={},Af[Lf(t)]=e),e}(e);let y;for(let t=0,n=c.length;t=R.maxzoom)continue;const k=R.filter;if(!k||mm(I,k,S,b,_)){let n,c,_,y,I,k;const A=d.index;if(3==E&&("fill"==R.type||"fill-extrusion"==R.type))if(c=gm(R,"paint",R.type+"-opacity",b,S,m,C),R.type+"-pattern"in F){const t=gm(R,"paint",R.type+"-pattern",b,S,m,C);if(t){const e="string"==typeof t?xm(t,p):t.toString();if(l&&r&&r[e]){++T,k=w[T],k&&k.getFill()&&!k.getStroke()&&!k.getText()||(k=new Ia({fill:new Sa}),w[T]=k),_=k.getFill(),k.setZIndex(A);const t=e+"."+c;let i=f[t];if(!i){const n=r[e],s=Gf(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"),f[t]=i}_.setColor(i)}}}else n=_m(gm(R,"paint",R.type+"-color",b,S,m,C),c),R.type+"-outline-color"in F&&(I=_m(gm(R,"paint",R.type+"-outline-color",b,S,m,C),c)),I||(I=n),(n||I)&&(++T,k=w[T],(!k||n&&!k.getFill()||!n&&k.getFill()||I&&!k.getStroke()||!I&&k.getStroke()||k.getText())&&(k=new Ia({fill:n?new Sa:void 0,stroke:I?new Ra:void 0}),w[T]=k),n&&(_=k.getFill(),_.setColor(n)),I&&(y=k.getStroke(),y.setColor(I),y.setWidth(.5)),k.setZIndex(A));if(1!=E&&"line"==R.type){n="line-pattern"in F?void 0:_m(gm(R,"paint","line-color",b,S,m,C),gm(R,"paint","line-opacity",b,S,m,C));const t=gm(R,"paint","line-width",b,S,m,C);n&&t>0&&(++T,k=w[T],k&&k.getStroke()&&!k.getFill()&&!k.getText()||(k=new Ia({stroke:new Ra}),w[T]=k),y=k.getStroke(),y.setLineCap(gm(R,"layout","line-cap",b,S,m,C)),y.setLineJoin(gm(R,"layout","line-join",b,S,m,C)),y.setMiterLimit(gm(R,"layout","line-miter-limit",b,S,m,C)),y.setColor(n),y.setWidth(t),y.setLineDash(F["line-dasharray"]?gm(R,"paint","line-dasharray",b,S,m,C).map((function(e){return e*t})):null),k.setZIndex(A))}let P,L,D,O,z,G,j,N,X,U=!1,q=null,W=0;if((1==E||2==E)&&"icon-image"in M){const e=gm(R,"layout","icon-image",b,S,m,C);if(e){let n;P="string"==typeof e?xm(e,p):e.toString();const o=a?a(t,P):void 0;if(l&&r&&r[P]||o){const t=gm(R,"layout","icon-rotation-alignment",b,S,m,C);if(2==E){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();pm||(dm=[NaN,NaN],pm=new El("Point",dm,[],2,{},void 0)),n=pm,dm[0]=i[0],dm[1]=i[1];if("line"===gm(R,"layout","symbol-placement",b,S,m,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l){W=Math.atan2(s-a,o-r);break}}}}}}if(2!==E||n){const e=gm(R,"layout","icon-size",b,S,m,C),i=void 0!==F["icon-color"]?gm(R,"paint","icon-color",b,S,m,C):null;if(!i||0!==i.a){const n=gm(R,"paint","icon-halo-color",b,S,m,C),s=gm(R,"paint","icon-halo-width",b,S,m,C);let a=`${P}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),L=g[a],!L){const c=fm(R,b,S,"icon",m);let d;"icon-offset"in M&&(d=gm(R,"layout","icon-offset",b,S,m,C).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]),L=new Ta(i)}else{const o=r[P];let a,g,f;s?o.sdf?(a=Vf(Kf(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=Vf(l,o,s,n):(o.sdf?(u||(u=Kf(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]),L=new Ta({color:p,img:a,imgSize:h,size:g,offset:f,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:d,declutterMode:c})}g[a]=L}}L&&(++T,k=w[T],k&&k.getImage()&&!k.getFill()&&!k.getStroke()||(k=new Ia,w[T]=k),k.setGeometry(n),L.setRotation(W+Of(gm(R,"layout","icon-rotate",b,S,m,C))),L.setOpacity(gm(R,"paint","icon-opacity",b,S,m,C)),L.setAnchor(lm[gm(R,"layout","icon-anchor",b,S,m,C)]),k.setImage(L),q=k.getText(),k.setText(void 0),k.setZIndex(A),U=!0,D=!1)}else D=!0}}}if(1==E&&"circle"===R.type){++T,k=w[T],k&&k.getImage()&&!k.getFill()&&!k.getStroke()||(k=new Ia,w[T]=k);const t="circle-radius"in F?gm(R,"paint","circle-radius",b,S,m,C):5,e=_m(gm(R,"paint","circle-stroke-color",b,S,m,C),gm(R,"paint","circle-stroke-opacity",b,S,m,C)),i=gm(R,"paint","circle-translate",b,S,m,C),n=_m(gm(R,"paint","circle-color",b,S,m,C),gm(R,"paint","circle-opacity",b,S,m,C)),r=gm(R,"paint","circle-stroke-width",b,S,m,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];L=g[s],L||(L=new Ea({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new Ra({width:r,color:e}):void 0,fill:n?new Sa({color:n}):void 0,declutterMode:"none"}),g[s]=L),k.setImage(L),q=k.getText(),k.setText(void 0),k.setGeometry(void 0),k.setZIndex(A),U=!0}if("text-field"in M){j=Math.round(gm(R,"layout","text-size",b,S,m,C));const t=gm(R,"layout","text-font",b,S,m,C);G=gm(R,"layout","text-line-height",b,S,m,C),z=Cf(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,j,G),z.includes("sans-serif")||(z+=",sans-serif"),N=gm(R,"layout","text-letter-spacing",b,S,m,C),X=gm(R,"layout","text-max-width",b,S,m,C);const i=gm(R,"layout","text-field",b,S,m,C);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=Cf(o?o(r):r,j*(i.scale||1),G);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==E)return e.push($f(a,N),s),e;a=em(a,s,X,N).split("\n");for(let t=0,i=a.length;t0&&e.push("\n",""),e.push(a[t],s);return e}),[]):xm(i,p).trim(),c=gm(R,"paint","text-opacity",b,S,m,C)}if(O&&c&&!D){U||(++T,k=w[T],k&&k.getText()&&!k.getFill()&&!k.getStroke()||(k=new Ia,w[T]=k),k.setImage(void 0),k.setGeometry(void 0));const t=fm(R,b,S,"text",m);k.getText()||k.setText(q),q=k.getText(),(!q||"getDeclutterMode"in q&&q.getDeclutterMode()!==t)&&(q=new Aa({padding:[2,2,2,2],declutterMode:t}),k.setText(q));const e=gm(R,"layout","text-transform",b,S,m,C);"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==E?$f(O,N):em(O,z,X,N);if(q.setText(i),q.setFont(z),q.setRotation(Of(gm(R,"layout","text-rotate",b,S,m,C))),"function"==typeof q.setKeepUpright){const t=gm(R,"layout","text-keep-upright",b,S,m,C);q.setKeepUpright(t)}const n=gm(R,"layout","text-anchor",b,S,m,C),r=U||1==E?"point":gm(R,"layout","symbol-placement",b,S,m,C);let s;if("line-center"===r?(q.setPlacement("line"),s="center"):q.setPlacement(r),"line"===r&&"function"==typeof q.setRepeat){const t=gm(R,"layout","symbol-spacing",b,S,m,C);q.setRepeat(2*t)}q.setOverflow("point"===r);let o=gm(R,"paint","text-halo-width",b,S,m,C);const a=gm(R,"layout","text-offset",b,S,m,C),l=gm(R,"paint","text-translate",b,S,m,C);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=gm(R,"layout","text-rotation-alignment",b,S,m,C);q.setRotateWithView("map"==t)}else q.setMaxAngle(Of(gm(R,"layout","text-max-angle",b,S,m,C))*O.length/i.length),q.setRotateWithView(!1);q.setTextAlign(s);let d="middle";0==n.indexOf("bottom")?(d="bottom",h=-o-.5*(G-1)*j):0==n.indexOf("top")&&(d="top",h=o+.5*(G-1)*j),q.setTextBaseline(d);const p=gm(R,"layout","text-justify",b,S,m,C);q.setJustify("auto"===p?void 0:p),q.setOffsetX(a[0]*j+u+l[0]),q.setOffsetY(a[1]*j+h+l[1]),v.setColor(_m(gm(R,"paint","text-color",b,S,m,C),c)),q.setFill(v);const g=_m(gm(R,"paint","text-halo-color",b,S,m,C),c);if(g&&o>0){x.setColor(g),o*=2;const t=.5*j;x.setWidth(o<=t?o:t),q.setStroke(x)}else q.setStroke(void 0);const f=gm(R,"layout","text-padding",b,S,m,C),_=q.getPadding();f!==_[0]&&(_[0]=f,_[1]=f,_[2]=f,_[3]=f),k.setZIndex(A)}}}return T>-1?(w.length=T+1,w):void 0};return t.setStyle(b),t.set("mapbox-source",y),t.set("mapbox-layers",p),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),b}function bm(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),_=e.highlightColor,y=e.shadowColor,x=e.accentColor,v=e.encoding;let w,b,E,S,C,T,R,I,M,F,k,A,P,L,D,O,z,G,j,N,X,U;function q(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(C=0===b?0:b-1,T=b===h?h:b+1,w=0;w<=l;++w)E=0===w?0:w-1,S=w===l?l:w+1,R=4*(b*n+E),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*q(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*q(u,v),F=(M-I)/a,R=4*(C*n+w),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*q(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*q(u,v),k=(M-I)/a,P=Math.atan2(k,-F),P=P<0?d-P:P>d?c-P+d:d-P,A=Math.atan(Math.sqrt(F*F+k*k)),U=m*Math.cos(A)+f*Math.sin(A)*Math.cos(g-P),L=Math.cos(A),D=255*U,j=Math.min(Math.max(2*e.sunEl,0),1),N=1.875-1.75*e.opacity,X=.5!==e.opacity?d*((Math.pow(N,A)-1)/(Math.pow(N,d)-1)):A,z={r:(1-L)*x.r*j*255,g:(1-L)*x.g*j*255,b:(1-L)*x.b*j*255,a:(1-L)*x.a*j*255},O=Math.abs(((P+g)/Math.PI+.5)%2-1),G={r:(_.r*(1-O)+y.r*O)*D,g:(_.g*(1-O)+y.g*O)*D,b:(_.b*(1-O)+y.b*O)*D,a:(_.a*(1-O)+y.a*O)*D},R=4*(b*n+w),o[R]=z.r*(1-O)+G.r,o[R+1]=z.g*(1-O)+G.g,o[R+2]=z.b*(1-O)+G.b,o[R+3]=s[R+3]*e.opacity*j*Math.sin(X);return new ImageData(o,n,r)}function Em(t,e=512){return t.getExtent()?bc({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():zf}function Sm(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 Cm(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:If(s,a.accessToken),a=Sm(s,a)),new Promise((function(i,n){qf(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof Bh||t instanceof Qc))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof Qc?"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 Qc)return Fm(e.sources[o],s,a).then((function(e){const i=t.getSource();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()===ed&&i.setTileLoadFunction(e.getTileLoadFunction()),Hi(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e);const n=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&n.getMinZoom()>0&&t.setMaxResolution(Nf(Math.max(0,n.getMinZoom()-1e-12),n.getResolutions()))}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=Pm(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=Vi(a.projection).getUnits();"m"!==t&&(r=zf.map((e=>e/Be[t])))}f=wm(t,e,l,r,p,g,((t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){const i=t.toString();if(i in om)return om[i];const n=[];for(let e=0,i=t.length;e=1.5?.5:1;const i=.5==d?"@2x":"";let r=t.origin+t.pathname+i+".json"+t.search;new Promise((function(e,i){Uf("Sprite",r,a).then(e).catch((function(n){r=t.origin+t.pathname+".json"+t.search,Uf("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 Tm={};function Rm(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function Im(t,e,i){const n=new Zc({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=Vi(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=$i([i[0],i[1]],e),n=$i([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return Vi(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new vc({origin:l?Re(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:Em(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 Mm(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 Rs({source:new jl({}),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=jf(e,i.resolutions||zf);let l;const h=gm(r,"paint","background-color",a,Tm,n);return void 0!==o["background-opacity"]&&(l=gm(r,"paint","background-opacity",a,Tm,n)),"none"==s.visibility?void 0:_m(h,l)}(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function Fm(t,e,i){return new Promise((function(n,r){Bf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=Im(t,e,i);s.tileLoadFunction=r,s.format=new Iu,n(new td(s))})).catch(r)}))}function km(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Am(t,e,i){const n=new cc;return function(t,e,i){return new Promise((function(n,r){Bf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new Zc({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=Im(t,e,i).tileGrid,i.projection&&(s.projection=Vi(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=km(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 Pm(t,e,i){const n=i.projection?new au({dataProjection:i.projection}):new au,r=t.data,s={};if("string"==typeof r){const[s]=Ff(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=km(i);return s.replace(n,`${t.join(",")}`)},r=new Zl({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{Uf("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:zl});return r.set("mapbox-source",t),r}const o=new Zl({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{Uf("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 Zl(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function Lm(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=gm(t,"paint","raster-opacity",i,Tm,n);e.setOpacity(r)}(t,e,n,i))}}function Dm(t,e,i,n){const r=Df(t),s=t.layers,o=i.type,a=i.source||Rm(s,i.ref),l=t.sources[a];let h;if("background"==o)h=Mm(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new Qc({declutter:!0,visible:!1});return Fm(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=Am(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",Lm(i,h,r));else if("geojson"==l.type)h=function(t,e,i){return new Bh({declutter:!0,source:Pm(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=Am(t,e,i);return new du({source:new Pc({operationType:"image",operation:bm,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=Yi(n.projection||"EPSG:3857",t.resolution,we(t.extent),"m");const s=jf(t.resolution,n.resolutions||zf);e.encoding=l.encoding,e.vert=5*gm(i,"paint","hillshade-exaggeration",s,Tm,r),e.sunAz=gm(i,"paint","hillshade-illumination-direction",s,Tm,r),e.sunEl=35,e.opacity=.3,e.highlightColor=gm(i,"paint","hillshade-highlight-color",s,Tm,r),e.shadowColor=gm(i,"paint","hillshade-shadow-color",s,Tm,r),e.accentColor=gm(i,"paint","hillshade-accent-color",s,Tm,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function Om(t,e,i,n,r,s={}){let o=24,a=0;const l=i.layers;for(let t=0,i=l.length;t0||i>0)&&t.setMaxResolution(Math.min(Nf(Math.max(0,o-1e-12),zf),Nf(Math.max(0,i-1e-12),e.getResolutions()))),a<24&&t.setMinResolution(Nf(a,zf))}}else o>0&&t.setMaxResolution(Nf(Math.max(0,o-1e-12),zf));u instanceof Zl||u instanceof td?Cm(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=vf(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 zm=[{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}],Gm=document.getElementById("map"),jm=new ul({target:Gm,view:new xr(zm[Math.random()*zm.length|0])});jm.addControl(new class extends pt{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(M,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${s} ${a}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(_t(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():xt(t)}(i):xt(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_?(C(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(ft)):(C(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(mt)),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(i,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(i,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e1&&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 l(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=[],o=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(),r[t])n=r[t].slice(),i="rgb";else if("transparent"===t)o=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var a=t.slice(1),l=a.length;o=1,l<=4?(n=[parseInt(a[0]+a[0],16),parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16)],4===l&&(o=parseInt(a[3]+a[3],16)/255)):(n=[parseInt(a[0]+a[1],16),parseInt(a[2]+a[3],16),parseInt(a[4]+a[5],16)],8===l&&(o=parseInt(a[6]+a[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 h=e[1],u="cmyk"===(i=h.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),o=(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!==s[t])return s[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>u?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:o}}(t);if(!i.space)return[];const n="h"===i.space[0]?a.min:o.min,l="h"===i.space[0]?a.max:o.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],n[0]),l[0]),e[1]=Math.min(Math.max(i.values[1],n[1]),l[1]),e[2]=Math.min(Math.max(i.values[2],n[2]),l[2]),"h"===i.space[0]&&(e=a.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}o.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]};var h={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]}}};h.max=h.whitepoint[2].D65,h.rgb=function(t,e){e=e||h.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))]},o.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||h.whitepoint[2].E)[0],s*e[1],o*e[2]]};var u={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,u,c,d;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*(u=h.whitepoint[i][e][0])/(u+15*(c=h.whitepoint[i][e][1])+3*(d=h.whitepoint[i][e][2]))||0,r=a/(13*s)+9*c/(u+15*c+3*d)||0,[9*(l=s>8?c*Math.pow((s+16)/116,3):c*s*.0011070564598794539)*n/(4*r)||0,l,l*(12-3*n-20*r)/(4*r)||0]}};h.luv=function(t,e,i){var n,r,s,o,a,l,u,c,d,p,g;e=e||"D65",i=i||2,p=4*(u=h.whitepoint[i][e][0])/(u+15*(c=h.whitepoint[i][e][1])+3*(d=h.whitepoint[i][e][2])),g=9*c/(u+15*c+3*d),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 f=a/c;return[s=f<=.008856451679035631?903.2962962962961*f:116*Math.pow(f,1/3)-16,13*s*(n-p),13*s*(r-g)]};var c={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 u.xyz(c.luv(t))}};function d(t,e,i){return Math.min(Math.max(t,e),i)}function p(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 g(t,e,i,n)}function g(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function f(t){return 180*t/Math.PI}function m(t){return t*Math.PI/180}function _(t,e){const i=t%e;return i*e<0?i+e:i}function y(t,e,i){return t+i*(e-t)}function x(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function v(t,e){return Math.floor(x(t,e))}function w(t,e){return Math.ceil(x(t,e))}function b(t,e,i){if(t>=e&&t=S){let t=0;for(const e in C)0==(3&t++)&&(delete C[e],--T)}const e=l(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 k(e),C[t]=e,++T,e}function F(t){return Array.isArray(t)?t:M(t)}function k(t){return t[0]=d(t[0]+.5|0,0,255),t[1]=d(t[1]+.5|0,0,255),t[2]=d(t[2]+.5|0,0,255),t[3]=d(t[3],0,1),t}function A(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}const P="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",L=P.includes("firefox");P.includes("safari")&&!P.includes("chrom")&&(P.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(P));const D=P.includes("webkit")&&!P.includes("edge"),O=P.includes("macintosh"),z="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,G="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,j="undefined"!=typeof Image&&Image.prototype.decode,N="function"==typeof createImageBitmap,X=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}();function U(t,e,i,n){let r;return r=i&&i.length?i.shift():G?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let q;function W(){return q||(q=U(1,1)),q}function B(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function V(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}var Y="change",K="error",Z="contextmenu",$="click",H="dblclick",J="keydown",Q="keypress",tt="load",et="touchmove",it="wheel";class nt{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function rt(t,e){return t>e?1:te?-1:0}function ot(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;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0)}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]=dt,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}function xt(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function vt(t,e,i,n){return xt(t,e,i,n,!0)}function wt(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ft(t))}class bt extends yt{constructor(t,e,n,r){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state="function"==typeof r?i.IDLE:r,this.image_=null,this.loader="function"==typeof r?r:null}changed(){this.dispatchEvent(Y)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==i.IDLE&&this.loader){this.state=i.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;gt((()=>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||N&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=i.LOADED})).catch((t=>{this.state=i.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Et(t,e){return e&&(t.src=e),t.src&&j?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(((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)}))}(t)}function St(t,e,i){return e+":"+t+":"+(i?F(i):"null")}const Ct=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}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=St(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=St(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,n,r,s){const o=St(t,e,n),a=o in this.cache_;this.cache_[o]=r,s&&(r.getImageState()===i.IDLE&&r.load(),r.getImageState()===i.LOADING?r.ready().then((()=>{this.patternCache_[o]=W().createPattern(r.getImage(1),"repeat")})):this.patternCache_[o]=W().createPattern(r.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Tt=null;class Rt extends yt{constructor(t,e,n,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=s,this.imageState_=void 0===r?i.IDLE:r,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_===i.LOADED){Tt||(Tt=U(1,1,void 0,{willReadFrequently:!0})),Tt.drawImage(this.image_,0,0);try{Tt.getImageData(0,0,1,1),this.tainted_=!1}catch{Tt=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(Y)}handleImageError_(){this.imageState_=i.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=i.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_===i.IDLE){this.image_||this.initializeImage_(),this.imageState_=i.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Et(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_!==i.LOADED)return;const e=this.image_,n=U(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=n.canvas;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=function(t){return"string"==typeof t?t:A(t)}(this.color_),n.fillRect(0,0,r.width/t,r.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise((t=>{if(this.imageState_===i.LOADED||this.imageState_===i.ERROR)t();else{const e=()=>{this.imageState_!==i.LOADED&&this.imageState_!==i.ERROR||(this.removeEventListener(Y,e),t())};this.addEventListener(Y,e)}}))),this.ready_}}function It(t,e,i,n,r,s){let o=void 0===e?void 0:Ct.get(e,i,r);return o||(o=new Rt(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ct.set(e,i,r,o,s)),s&&o&&!Ct.getPattern(e,i,r)&&Ct.set(e,i,r,o,s),o}function Mt(t){return t?Array.isArray(t)?A(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ct.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,n=Ct.getPattern(e,void 0,t.color);if(n)return n;const r=Ct.get(t.src,"anonymous",null);if(r.getImageState()!==i.LOADED)return null;const s=U(t.size[0],t.size[1]);return s.drawImage(r.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),It(s.canvas,e,void 0,i.LOADED,t.color,!0),Ct.getPattern(e,void 0,t.color)}(t):t:null}var Ft="propertychange";class kt extends yt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Y)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;rMath.max(e,ae(t,i))),0);return i[e]=n,n}function he(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;t0&&t[1]>0}function ce(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class de{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ce(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new de({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 At()}getImage(t){return At()}getHitDetectionImage(){return At()}getPixelRatio(t){return 1}getImageState(){return At()}getImageSize(){return At()}getOrigin(){return At()}getSize(){return At()}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_=ce(t)}listenImageChange(t){At()}load(){At()}unlistenImageChange(t){At()}ready(){return Promise.resolve()}}class pe extends de{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.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()?i.LOADING:i.LOADED,this.imageState_===i.LOADING&&this.ready().then((()=>this.imageState_=i.LOADED)),this.render()}clone(){const t=this.getScale(),e=new pe({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){const e=this.fill_?.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let r=Ct.get(n,null,null)?.getImage(1);if(!r){const e=this.renderOptions_,s=Math.ceil(e.size*t),o=U(s,s);this.draw_(e,o,t),r=o.canvas,Ct.set(n,null,null,new Rt(r,void 0,null,i.LOADED,null))}return r}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{this.patternImage_=null})),e.getImageState()===i.IDLE&&e.load(),e.getImageState()===i.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Lt(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:F(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function me(t,e){if(!t)throw new Error(e)}function _e(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 ye extends de{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,r=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:r,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,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 o=void 0!==t.img?t.img:null;let a,l=t.src;if(me(!(void 0!==l&&o),"`image` and `src` cannot be provided at the same time"),void 0!==l&&0!==l.length||!o||(l=o.src||Lt(o)),me(void 0!==l&&l.length>0,"A defined and non-empty `src` or `image` must be provided"),me(!((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?a=i.IDLE:void 0!==o&&(a="complete"in o?o.complete?o.src?i.LOADED:i.IDLE:i.LOADING:i.LOADED),this.color_=void 0!==t.color?F(t.color):null,this.iconImage_=It(o,l,this.crossOrigin_,a,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,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(_e(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(_e(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 ye({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()==i.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()==i.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Y,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Y,t)}ready(){return this.iconImage_.ready()}}class xe extends Ot{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new xe(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(wt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=xt(t,Y,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{me("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_()}}var ve={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function we(t){const e=Me();for(let i=0,n=t.length;ir&&(l|=ve.RIGHT),as&&(l|=ve.ABOVE),l===ve.UNKNOWN&&(l=ve.INTERSECTING),l}function Me(){return[1/0,1/0,-1/0,-1/0]}function Fe(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 Fe(1/0,1/0,-1/0,-1/0,t)}function Ae(t,e){const i=t[0],n=t[1];return Fe(i,n,i,n,e)}function Pe(t,e,i,n,r){return ze(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 De(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Oe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function ze(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Qe(t){return t[2]=i[2])){const e=He(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function ii(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];ei(t,e);const r=He(n);if(He(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function ni(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;os&&(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 oi(t,e,i,n,r,s){if(0===i.length)return!1;if(!si(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e_&&(h=(u+c)/2,oi(t,e,i,n,h,g)&&(m=h,_=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,g,_),o):[m,g,_]}function li(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e>1;r0}function pi(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;eo&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n0&&g>d)&&(p<0&&f0&&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 bi(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ri(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 Ii(t,e){if(e.canWrapX()){const i=He(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;e.canWrapX()&&(t[0]n[2])&&(i=i||He(n),r=Math.floor((t[0]-n[0])/i));return r}(t,e,i);n&&(t[0]-=n*i)}return t}const Mi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Fi{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_||Mi[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 ki=6378137,Ai=Math.PI*ki,Pi=[-Ai,-Ai,Ai,Ai],Li=[-180,-85,180,85],Di=ki*Math.log(Math.tan(Math.PI/2));class Oi extends Fi{constructor(t){super({code:t,units:"m",extent:Pi,global:!0,worldExtent:Li,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ki)}})}}const zi=[new Oi("EPSG:3857"),new Oi("EPSG:102100"),new Oi("EPSG:102113"),new Oi("EPSG:900913"),new Oi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Oi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Gi(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;iDi?n=Di:n<-Di&&(n=-Di),e[i+1]=n}return e}function ji(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i_n&&(e=_n);const n=m(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=m(t),u=m(wn(i.number)),c=gn/Math.sqrt(1-Zi*r**2),d=Ji*s**2,p=s*b(h-u,-Math.PI,Math.PI),g=p*p,f=g*p,_=f*p,y=_*p,x=y*p,v=gn*(on*n-an*Math.sin(2*n)+ln*Math.sin(4*n)-hn*Math.sin(6*n)),w=Ki*c*(p+f/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*Ji))+5e5;let E=Ki*(v+c*o*(g/2+_/24*(5-a+9*d+4*d**2)+x/720*(61-58*a+l+600*d-330*Ji)));return i.north||(E+=1e7),[w,E]}function wn(t){return 6*(t-1)-180+3}const bn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function En(t){let e=0;for(const i of bn){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function Sn(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Mn=!1,Ci("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Vn(t,e){return t}function Yn(t,e){return t}var Kn,Zn,$n;Dn(zi),Dn(qi),Kn=zi,Zn=Gi,$n=ji,qi.forEach((function(t){Kn.forEach((function(e){Vi(t,e,Zn),Vi(e,t,$n)}))}));const Hn=new Array(6);function Jn(t){return tr(t,1,0,0,1,0,0)}function Qn(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 tr(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 er(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 ir(t,e,i){return Qn(t,tr(Hn,e,0,0,i,0,0))}function nr(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 rr(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;me(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 sr=[1e6,1e6,1e6,1e6,2,2];const or=[1,0,0,1,0,0],ar=[NaN,NaN];class lr extends Ot{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=pt(((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 At()}closestPointXY(t,e,i,n){return At()}containsXY(t,e){return 0===this.closestPointXY(t,e,ar,Number.MIN_VALUE)}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 At()}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){At()}scale(t,e,i){At()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return At()}getType(){return At()}applyTransform(t){At()}intersectsExtent(t){return At()}translate(t,e){At()}transform(t,e){const i=Pn(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ye(o)/Ye(s);nr(or,o[0],o[3],a,-a,0,0,0);const l=Ei(t,0,t.length,r,or,n),h=Xn(i,e);return h?h(l,l,r):l}:Xn(i,e);return this.applyTransform(n),this}}class hr extends lr{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 At()}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().lengtht.clone()))}function _r(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e1)c=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function wr(t,e,i,n,r){for(let s=0,o=i.length;s=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Ir(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=Ie(t,e),s=Ie(t,i);if(r===ve.INTERSECTING||s===ve.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&ve.ABOVE&&!(r&ve.ABOVE)&&(f=d-(p-h)/g,n=f>=o&&f<=l),n||!(s&ve.RIGHT)||r&ve.RIGHT||(m=p-(d-l)*g,n=m>=a&&m<=h),n||!(s&ve.BELOW)||r&ve.BELOW||(f=d-(p-a)/g,n=f>=o&&f<=l),n||!(s&ve.LEFT)||r&ve.LEFT||(m=p-(d-o)*g,n=m>=a&&m<=h)}return n}(r,t,e)})))}function Fr(t,e,i,n,r){return!!Mr(t,e,i,n,r)||(!!si(t,e,i,n,r[0],r[1])||(!!si(t,e,i,n,r[0],r[3])||(!!si(t,e,i,n,r[2],r[1])||!!si(t,e,i,n,r[2],r[3]))))}function kr(t,e,i,n,r){if(!Fr(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;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=yi(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=xi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=bi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Xr(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}Xr.prototype.getFlatCoordinates=Xr.prototype.getOrientedFlatCoordinates;class Ur{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 Ur({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 qr{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Vr,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 qr({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_=Vr,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let Wr=null;function Br(t,e){if(!Wr){const t=new fe({color:"rgba(255,255,255,0.4)"}),e=new Ur({color:"#3399CC",width:1.25});Wr=[new qr({image:new ge({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Wr}function Vr(t){return t.getGeometry()}class Yr{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=ce(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 fe({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 Yr({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),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_}getKeepUpright(){return this.keepUpright_}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}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ce(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var Kr={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},Zr="add",$r="remove";const Hr="length";class Jr extends _t{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Qr extends Ot{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;t0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Jr(Zr,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Jr($r,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 Jr($r,i,t)),this.dispatchEvent(new Jr(Zr,e,t))}updateLength_(){this.set(Hr,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;it*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Zt,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Mt(t||$t)}}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:Mt(t||Vt)}}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:Yt,lineDash:n||Kt,lineDashOffset:r||0,lineJoin:void 0!==s?s:Zt,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Mt(t||$t)}}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:Bt,textAlign:void 0!==u?u:Ht,textBaseline:void 0!==c?c:Jt},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 as=.5,ls={Point:function(t,e,n,r,s,o){const a=n.getImage(),l=n.getText(),h=l&&l.getText(),u=o&&a&&h?{}:void 0;if(a){if(a.getImageState()!=i.LOADED)return;const o=t.getBuilder(n.getZIndex(),"Image");o.setImageStyle(a,u),o.drawPoint(e,r,s)}if(h){const i=t.getBuilder(n.getZIndex(),"Text");i.setTextStyle(l,u),i.drawText(e,r,s)}},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,n,r,s,o){const a=n.getImage(),l=a&&0!==a.getOpacity(),h=n.getText(),u=h&&h.getText(),c=o&&l&&u?{}:void 0;if(l){if(a.getImageState()!=i.LOADED)return;const o=t.getBuilder(n.getZIndex(),"Image");o.setImageStyle(a,c),o.drawMultiPoint(e,r,s)}if(u){const i=t.getBuilder(n.getZIndex(),"Text");i.setTextStyle(h,c),i.drawText(e,r,s)}},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;a0;return d&&Promise.all(h).then((()=>s(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)ps(t,l,i,e,o);else{(0,ls[l.getType()])(t,l,i,e,o,s)}}(t,e,n,r,o,a,l),d}function ps(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function ms(t,e){return function(i,n,r,s,o){const a=this;fs(t,e,i,n,r,(function(t,e){a.addFeatures(t),void 0!==s&&s(t)}),o||dt)}}function _s(t,e){return[[-1/0,-1/0,1/0,1/0]]}function ys(t,e){return[t]}function xs(t,e,i=0,n=t.length-1,r=ws){for(;n>i;){if(n-i>600){const 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);xs(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(vs(t,i,e),r(t[n],s)>0&&vs(t,i,n);o0;)a--}0===r(t[i],s)?vs(t,i,a):(a++,vs(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function vs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function ws(t,e){return te?1:0}let bs=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(!Ps(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Ls(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ss(i,this.toBBox),Ss(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Ls([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ss(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=Cs(t,0,o,this.toBBox),a=Cs(t,o,i,this.toBBox),l=ks(e,a),h=Ms(e)+Ms(a);l=e;n--){const e=t.children[n];Ts(o,t.leaf?r(e):e),a+=Fs(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ts(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():Ss(t[i],this.toBBox)}};function Es(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Ls(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ds(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;xs(t,o,e,i,r),s.push(e,o,o,i)}}class Os{constructor(t){this.rbush_=new bs(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_[Lt(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;nt):null}var js="addfeature",Ns="changefeature",Xs="clear",Us="removefeature",qs="featuresloadstart",Ws="featuresloadend",Bs="featuresloaderror";class Vs extends _t{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Ys extends zs{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_=dt,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(me(this.format_,"`format` must be set when `url` is set"),this.loader_=ms(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:_s;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Os:null,this.loadedExtentsRtree_=new Os,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 Qr(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Lt(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 Vs(js,t))}setupChangeEvents_(t,e){e instanceof Xr||(this.featureChangeKeys_[t]=[xt(e,Y,this.handleFeatureChange_,this),xt(e,Ft,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 Xr){const n=this.idIndex_[t];n instanceof Xr?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(me(!(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{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener($r,(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(wt)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach((t=>{this.removeFeatureInternal(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 Vs(Xs);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 Xr||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 Xr||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(),mt(this.nullGeometryFeatures_)||lt(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=ii(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||ut,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Xr?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Vs(Ws,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Vs(Bs))})),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_,i=e.forEachInExtent(t,(function(e){if(Le(e.extent,t))return e}));i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;ia&&(this.instructions.push([to,a,h,t,i,Sr,r]),this.hitDetectionInstructions.push([to,a,h,t,n||i,Sr,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([to,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([to,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[$s,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[$s,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,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[oo,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[ao,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!ht(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[no,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Ee(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;be(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class fo extends go{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(co),this.hitDetectionInstructions.push(co);for(let r=0;r=t){const e=(t-a+c)/c,d=y(i,h,e),p=y(n,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function _o(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,g,f=i,m=i,_=0,y=0,x=i;for(o=i;ot&&(y>_&&(_=y,f=x,m=o),y=0,x=o-r)),a=l,c=p,d=g),h=i,u=n}return y+=l,y>_?[x,o]:[f,m]}const yo={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const xo={Circle:fo,Default:go,Image:class extends go{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&&!Ce(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([io,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([io,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{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!=Qt&&(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([io,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,c==Qt?Qt: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=Vt,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([io,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_?Vt: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(!Je(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;tt[2]}else M=b>R;const F=Math.PI,k=[],A=S+n===e;let P;if(_=0,x=C,p=t[e=S],g=t[e+1],A){v(),P=Math.atan2(g-m,p-f),M&&(P+=P>0?-F:F);const t=(R+b)/2,e=(I+E)/2;return k[0]=[t,e,(T-s)/2,P,r],k}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t0?-F:F),void 0!==P){let t=d-P;if(t+=t>F?-2*F:t<-F?2*F:0,Math.abs(t)>o)return null}P=d;const b=t;let E=0;for(;t{if("function"==typeof W()[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);pushFunction(t){this.instructions_[this.zIndex+this.offset_].push(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i0&&t.push("\n",""),t.push(e,""),t}class Ao{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 bo: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=a.justify?yo[a.justify]:Fo(Array.isArray(t)?t[0]:t,a.textAlign||Ht),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(ko,[]),{width:p,height:g,widths:f,heights:m,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,l=0;continue}const d=e[h+1]||t.font,p=ae(d,c);i.push(p),o+=p;const g=se(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),y=p+c,x=[],v=(y+2)*h[0],w=(g+c)*h[1],b={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",c),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const E=.5-u;let S=u*y+E*c;const C=[],T=[];let R,I=0,M=0,F=0,k=0;for(let t=0,e=d.length;tt?t-l:r,x=s+h>e?e-h:s,v=p[3]+y*c[0]+p[1],w=p[0]+x*c[1]+p[2],b=m-p[3],E=_-p[0];let S;return(g||0!==u)&&(So[0]=b,Ro[0]=b,So[1]=E,Co[1]=E,Co[0]=b+v,To[0]=Co[0],To[1]=E+w,Ro[1]=To[1]),0!==u?(S=nr([1,0,0,1,0,0],i,n,1,1,u,-i,-n),er(S,So),er(S,Co),er(S,To),er(S,Ro),Fe(Math.min(So[0],Co[0],To[0],Ro[0]),Math.min(So[1],Co[1],To[1],Ro[1]),Math.max(So[0],Co[0],To[0],Ro[0]),Math.max(So[1],Co[1],To[1],Ro[1]),Eo)):Fe(Math.min(b,b+v),Math.min(E,E+w),Math.max(b,b+v),Math.max(E,E+w),Eo),d&&(m=Math.round(m),_=Math.round(_)),{drawImageX:m,drawImageY:_,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Eo[0],minY:Eo[1],maxX:Eo[2],maxY:Eo[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,So,Co,To,Ro,s,o),he(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=er(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=Fo(Array.isArray(t)?t[0]:t,r.textAlign||Ht),h=yo[r.textBaseline||Jt],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&ht(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,c=i,u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const p=n.length;let g,f,m,_,y,x,v,w,b,E,S,C,T,R=0,I=0,M=0,F=null,k=null;const A=this.coordinateCache_,P=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:P},O=this.instructions!=n||this.overlaps?0:200;let z,G,j,N;for(;dO&&(this.fill_(t),I=0),M>O&&(t.stroke(),M=0),I||M||(t.beginPath(),y=NaN,x=NaN),++d;break;case Js:R=i[1];const n=h[R],u=h[R+1],c=h[R+2]-n,p=h[R+3]-u,X=Math.sqrt(c*c+p*p);t.moveTo(n+X,u),t.arc(n,u,X,0,2*Math.PI,!0),++d;break;case Qs:t.closePath(),++d;break;case to:R=i[1],g=i[2];const U=i[3],q=i[4],W=i[5];D.geometry=U,D.feature=z,d in A||(A[d]=[]);const B=A[d];W?W(h,R,g,2,B):(B[0]=h[R],B[1]=h[R+1],B.length=2),l&&(l.zIndex=i[6]),q(B,D),++d;break;case io:R=i[1],g=i[2],b=i[3],f=i[4],m=i[5];let V=i[6];const Y=i[7],K=i[8],Z=i[9],$=i[10];let H=i[11];const J=i[12];let Q=i[13];_=i[14]||"declutter";const tt=i[15];if(!b&&i.length>=20){E=i[19],S=i[20],C=i[21],T=i[22];const t=this.drawLabelWithPointPlacement_(E,S,C,T);b=t.label,i[3]=b;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];m=(t.anchorY-n)*this.pixelRatio,i[5]=m,V=b.height,i[6]=V,Q=b.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=Qt,nt=!1,rt=!1),$&&L?H+=P:$||L||(H-=P);let st=0;for(;R!Lo.includes(t)));class Oo{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 Ao(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;ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const g=Object.keys(this.executorsByZIndex_).map(Number);let f,m,_,y,x;for(g.sort(rt),f=g.length-1;f>=0;--f){const t=g[f].toString();for(_=this.executorsByZIndex_[t],m=Po.length-1;m>=0;--m)if(d=Po[m],y=_[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,p,u),x))return x}}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 Ei(o,0,8,2,t,o),o}isEmpty(){return mt(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?st:rt),s=s||Po;const l=Po.length;for(let h=0,u=a.length;hp.execute(t,e,i,n,r,o))):p.execute(c,e,i,n,r,o),g&&c.restore(),s){s.offset();const t=a[h]*l+u;this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(rt);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}}const zo={};const Go=.5;function jo(t,e,i,n,r,s,o,a,l){const h=l?Vn(r):r,u=U(t[0]*Go,t[1]*Go);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new os(u,Go,r,null,o,a,l?jn(qn,l):null),p=i.length,g=Math.floor(16777215/p),f={};for(let t=1;t<=p;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*g).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;tthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return At()}getData(t){return null}prepareFrame(t){return At()}renderFrame(t,e){return At()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==i.LOADED&&e.getState()!==i.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=i.LOADED&&e!=i.ERROR&&t.addEventListener(Y,this.boundHandleImageChange_),e==i.IDLE&&(t.load(),e=t.getState()),e==i.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const qo=[];let Wo=null;class Bo extends Uo{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.frameState=null}getImageData(t,e,i){let n;Wo||(Wo=U(1,1,void 0,{willReadFrequently:!0})),Wo.clearRect(0,0,1,1);try{Wo.drawImage(t,e,i,1,1,0,0,1,1),n=Wo.getImageData(0,0,1,1).data}catch{return Wo=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&&ht(F(t.style.backgroundColor),F(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=Ze(i),r=$e(i),s=Ue(i),o=Xe(i);er(e.coordinateToPixelTransform,n),er(e.coordinateToPixelTransform,r),er(e.coordinateToPixelTransform,s),er(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;er(a,n),er(a,r),er(a,s),er(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()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(He(i)/n*s),a=Math.round(Ye(i)/n*s);nr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),rr(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.map(((t,e)=>Math.round(t*sr[e])/sr[e])).join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Xo(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ts,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(es,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new bo),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ts,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(es,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 nr(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Vo extends Bo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,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.renderedFrameDeclutter_,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[Ks]||p[Zs]),f=this.context,m=Math.round(He(n)/o*d),_=Math.round(Ye(n)/o*d),y=u.getWrapX()&&a.canWrapX(),x=y?He(h):null,v=y?Math.ceil((n[2]-h[2])/x)+1:1;let w=y?Math.floor((n[0]-h[0])/x):0;do{let n=this.getRenderTransform(s,o,0,d,m,_,w*x);e.declutter&&(n=n.slice(0)),t.execute(f,[f.canvas.width,f.canvas.height],n,l,g,void 0===i?Po:i?Lo:Do,i?c&&e.declutter[c]:void 0)}while(++w{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*Go,h=t[1]*Go;a.push(this.getRenderTransform(e,i,n,Go,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Te(c,s)){let t=s[0];const r=He(c);let o,u=0;for(;tc[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,Go,l,h,o).slice()),t-=r}this.hitDetectionImageData_=jo(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,us(i,this.renderedPixelRatio_),null)}e(No(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=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,(function(t,e,i){const s=Lt(t),o=l[s];if(o){if(!0!==o&&it.value)):null)}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[Ks],r=t.viewHints[Zs],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),p=e.getRenderBuffer();let g=e.getRenderOrder();void 0===g&&(g=hs);const f=l.center.slice(),m=be(a,p*u),_=m.slice(),y=[m.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!Te(x,t.extent)){const t=He(x),e=Math.max(He(m)/2,t);m[0]=x[0]-e,m[2]=x[2]+e,Ii(f,h);const i=ei(y[0],h);i[0]x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==d&&this.renderedRenderOrder_==g&&this.renderedFrameDeclutter_===!!t.declutter&&Te(this.wrappedRenderedExtent_,m))return ht(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=f,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const v=new vo(cs(u,c),m,u,c);for(let t=0,e=y.length;t{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,w,n,v,undefined,this.getLayer().getDeclutter(),i);b=b&&!e}},S=Vn(m),C=i.getFeaturesInExtent(S);g&&C.sort(g);for(let t=0,e=C.length;t",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",Has:"has"},ca={[ua.Get]:ya(ga(1,1/0),da),[ua.Var]:ya(ga(1,1),(function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new oa($o,n)]})),[ua.Has]:ya(ga(1,1/0),da),[ua.Id]:ya((function(t,e,i){i.featureId=!0}),pa),[ua.Concat]:ya(ga(2,1/0),ma($o)),[ua.GeometryType]:ya((function(t,e,i){i.geometryType=!0}),pa),[ua.LineMetric]:ya(pa),[ua.Resolution]:ya(pa),[ua.Zoom]:ya(pa),[ua.Time]:ya(pa),[ua.Any]:ya(ga(2,1/0),ma(Ko)),[ua.All]:ya(ga(2,1/0),ma(Ko)),[ua.Not]:ya(ga(1,1),ma(Ko)),[ua.Equal]:ya(ga(2,2),ma(ta)),[ua.NotEqual]:ya(ga(2,2),ma(ta)),[ua.GreaterThan]:ya(ga(2,2),ma(Zo)),[ua.GreaterThanOrEqualTo]:ya(ga(2,2),ma(Zo)),[ua.LessThan]:ya(ga(2,2),ma(Zo)),[ua.LessThanOrEqualTo]:ya(ga(2,2),ma(Zo)),[ua.Multiply]:ya(ga(2,1/0),fa),[ua.Coalesce]:ya(ga(2,1/0),fa),[ua.Divide]:ya(ga(2,2),ma(Zo)),[ua.Add]:ya(ga(2,1/0),ma(Zo)),[ua.Subtract]:ya(ga(2,2),ma(Zo)),[ua.Clamp]:ya(ga(3,3),ma(Zo)),[ua.Mod]:ya(ga(2,2),ma(Zo)),[ua.Pow]:ya(ga(2,2),ma(Zo)),[ua.Abs]:ya(ga(1,1),ma(Zo)),[ua.Floor]:ya(ga(1,1),ma(Zo)),[ua.Ceil]:ya(ga(1,1),ma(Zo)),[ua.Round]:ya(ga(1,1),ma(Zo)),[ua.Sin]:ya(ga(1,1),ma(Zo)),[ua.Cos]:ya(ga(1,1),ma(Zo)),[ua.Atan]:ya(ga(1,2),ma(Zo)),[ua.Sqrt]:ya(ga(1,1),ma(Zo)),[ua.Match]:ya(ga(4,1/0),_a,(function(t,e,i){const n=t.length-1,r=$o|Zo|Ko,s=ha(t[1],r,i),o=ha(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;ee){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function fa(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s{for(let e=0;e{for(let e=0;e{const i=t.args;let r=e.properties[n];for(let t=1,e=i.length;tt.variables[n];case ua.Has:return e=>{const i=t.args;if(!(n in e.properties))return!1;let r=e.properties[n];for(let t=1,e=i.length;tt.featureId;case ua.GeometryType:return t=>t.geometryType;case ua.Concat:{const e=t.args.map((t=>wa(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case ua.Resolution:return t=>t.resolution;case ua.Any:case ua.All:case ua.Between:case ua.In:case ua.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case ua.In:return t=>{const e=r[0](t);for(let i=1;i!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t);case ua.Equal:case ua.NotEqual:case ua.LessThan:case ua.LessThanOrEqualTo:case ua.GreaterThan:case ua.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=wa(t.args[0]),r=wa(t.args[1]);switch(i){case ua.Equal:return t=>n(t)===r(t);case ua.NotEqual:return t=>n(t)!==r(t);case ua.LessThan:return t=>n(t)n(t)<=r(t);case ua.GreaterThan:return t=>n(t)>r(t);case ua.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t);case ua.Multiply:case ua.Divide:case ua.Add:case ua.Subtract:case ua.Clamp:case ua.Mod:case ua.Pow:case ua.Abs:case ua.Floor:case ua.Ceil:case ua.Round:case ua.Sin:case ua.Cos:case ua.Atan:case ua.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{let e=1;for(let i=0;ir[0](t)/r[1](t);case ua.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case ua.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case ua.Mod:return t=>r[0](t)%r[1](t);case ua.Pow:return t=>Math.pow(r[0](t),r[1](t));case ua.Abs:return t=>Math.abs(r[0](t));case ua.Floor:return t=>Math.floor(r[0](t));case ua.Ceil:return t=>Math.ceil(r[0](t));case ua.Round:return t=>Math.round(r[0](t));case ua.Sin:return t=>Math.sin(r[0](t));case ua.Cos:return t=>Math.cos(r[0](t));case ua.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case ua.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t);case ua.Case:return function(t,e){const i=t.args.length,n=new Array(i);for(let e=0;e{for(let e=0;e{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?Ea(e,r,s,o,i,l):ba(e,r,s,o,i,l);s=i,o=l}return o}}(t);case ua.ToString:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let e=0;e{const i=r[0](e);return t.args[0].type===Ho?A(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function ba(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 Ea(t,e,i,n,r,s){if(0===r-i)return n;const o=I(n),a=I(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return k(function(t){const e=h.rgb(c.xyz(t));return e[3]=t[3],e}([ba(t,e,i,o[0],r,a[0]),ba(t,e,i,o[1],r,a[1]),o[2]+ba(t,e,i,0,r,l),ba(t,e,i,n[3],r,s[3])]))}function Sa(t){return!0}function Ca(t){const e=la(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;rnull;n=Pa(t,e+"fill-color",i)}if(!n)return null;const r=new fe;return function(t){const e=n(t);return e===E?null:(r.setColor(e),r)}}function Ma(t,e,i){const n=Fa(t,e+"stroke-width",i),r=Pa(t,e+"stroke-color",i);if(!n&&!r)return null;const s=ka(t,e+"stroke-line-cap",i),o=ka(t,e+"stroke-line-join",i),a=La(t,e+"stroke-line-dash",i),l=Fa(t,e+"stroke-line-dash-offset",i),h=Fa(t,e+"stroke-miter-limit",i),u=new Ur;return function(t){if(r){const e=r(t);if(e===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 Fa(t,e,i){if(!(e in t))return;const n=va(t[e],Zo,i);return function(t){return Wa(n(t),e)}}function ka(t,e,i){if(!(e in t))return null;const n=va(t[e],$o,i);return function(t){return qa(n(t),e)}}function Aa(t,e,i){if(!(e in t))return null;const n=va(t[e],Ko,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Pa(t,e,i){if(!(e in t))return null;const n=va(t[e],Ho,i);return function(t){return Ba(n(t),e)}}function La(t,e,i){if(!(e in t))return null;const n=va(t[e],Jo,i);return function(t){return Ua(n(t),e)}}function Da(t,e,i){if(!(e in t))return null;const n=va(t[e],Jo,i);return function(t){const i=Ua(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Oa(t,e,i){if(!(e in t))return null;const n=va(t[e],Jo,i);return function(t){return Va(n(t),e)}}function za(t,e,i){if(!(e in t))return null;const n=va(t[e],Jo|Zo,i);return function(t){return function(t,e){if("number"==typeof t)return t;return Va(t,e)}(n(t),e)}}function Ga(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 ja(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 Na(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 Xa(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 Ua(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Va(t,e){const i=Ua(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var Ya={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ka(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 p=t[0]+l/2+u,g=t[2]-l/2+u,f=t[1]+h/2+c,m=t[3]-h/2+c;p>g&&(p=(g+p)/2,g=p),f>m&&(f=(m+f)/2,m=f);let _=d(n[0],p,g),y=d(n[1],f,m);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,p-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),y+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[_,y]}}function Za(t){return t}function $a(t){return Math.pow(t,3)}function Ha(t){return 1-$a(1-t)}function Ja(t){return 3*t*t-2*t*t*t}function Qa(t){return t}function tl(t,e,i,n){const r=He(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 el(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),d(n,i/2,2*e)}function il(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?tl(t,n,a,r):t;return i&&l?el(s,o,e):d(s,e,o)}}}function nl(t){if(void 0!==t)return 0}function rl(t){if(void 0!==t)return t}const sl=42,ol=256;class al extends Ot{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=On(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&&Fn(),t.center&&(t.center=Bn(t.center,this.projection_)),t.extent&&(t.extent=Yn(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in Ya)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const r=28,s=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:r;const l=void 0!==t.zoomFactor?t.zoomFactor:s,h=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,p=On(t.projection,"EPSG:3857"),g=p.getExtent();let f=t.constrainOnlyCenter,m=t.extent;h||m||!p.isGlobal()||(f=!1,m=g);if(void 0!==t.resolutions){const r=t.resolutions;i=r[o],n=void 0!==r[a]?r[a]:r[r.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?tl(l,i,o,n):l;if(a)return e?el(r,u,h):d(r,h,u);const c=Math.min(u,r),p=Math.floor(ot(t,c,s));return t[p]>u&&p1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[Zs]>0}cancelAnimations(){let t;this.setHint(Ks,-this.hints_[Ks]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?_(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(Ks,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&ll(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]],Ri(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?Wn(t,this.getProjection()):t}getCenterInternal(){return this.get(Ya.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 Vn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();me(e,"The view center is not defined");const i=this.getResolution();me(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return me(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(Ya.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Yn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=He(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(Ya.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=ul(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=ot(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=d(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,d(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(me(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){me(!Qe(t),"Cannot fit empty extent provided as `geometry`");i=Gr(Yn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Yn(t.getExtent(),this.getProjection());i=Gr(e),i.rotate(this.getRotation(),qe(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{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;if(!t&&i&&(t=i.getView()),e=t instanceof al?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return El(n,e.viewState)&&(!r||Je(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof al?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}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(vl,t)}getMapInternal(){return this.get(vl)}setMap(t){this.mapPrecomposeKey_&&(wt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(wt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=xt(t,is,this.handlePrecompose_,this),this.mapRenderKey_=xt(this,Y,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);me(!e.some((t=>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)}setSource(t){this.set(xl,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function El(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const Sl="renderOrder";class Cl extends bl{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(Sl)}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 bs(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Sl,t)}setStyle(t){this.style_=void 0===t?Br:t;const e=function(t){if(void 0===t)return Br;if(!t)return null;if("function"==typeof t)return t;if(t instanceof qr)return t;if(!Array.isArray(t))return Ta([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof qr){const i=new Array(e);for(let n=0;nt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){At()}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:$a(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Ml extends Il{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=Kr.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=Kr.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=Kr.LOADED:this.state=Kr.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==Kr.ERROR&&(this.state=Kr.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Kr.IDLE&&(this.state=Kr.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=[vt(n,tt,(function(){o=!0,s||e()}))];return n.src&&j?(s=!0,n.decode().then((function(){r&&e()})).catch((function(t){r&&(o?e():i())}))):a.push(vt(n,K,i)),function(){r=!1,a.forEach(wt)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class Fl{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class kl extends _t{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Al extends kl{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 Pl={SINGLECLICK:"singleclick",CLICK:$,DBLCLICK:H,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ll="pointermove",Dl="pointerdown";class Ol extends yt{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_=xt(i,Dl,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=xt(i,Ll,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(et,this.boundHandleTouchMove_,!!X&&{passive:!1})}emulateClick_(t){let e=new Al(Pl.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Al(Pl.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Al(Pl.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Pl.POINTERUP||e.type==Pl.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!=Pl.POINTERDOWN&&e.type!=Pl.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Al(Pl.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(wt),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 Al(Pl.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(xt(t,Pl.POINTERMOVE,this.handlePointerMove_,this),xt(t,Pl.POINTERUP,this.handlePointerUp_,this),xt(this.element_,Pl.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(xt(this.element_.getRootNode(),Pl.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Al(Pl.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 Al(Pl.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_&&(wt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(et,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(wt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(wt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var zl="postrender",Gl="movestart",jl="moveend",Nl="loadstart",Xl="loadend",Ul="layergroup",ql="size",Wl="target",Bl="view";const Vl=1/0;class Yl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ft(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){me(!(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!=Vl&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e)),(t=>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(Y,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Kr.LOADED||i===Kr.ERROR||i===Kr.EMPTY){i!==Kr.ERROR&&e.removeEventListener(Y,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==Kr.IDLE||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}class Zl extends Ot{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(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;te.getAttributions(t))));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach((t=>i.add(t))):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some((t=>!1===t.getSource()?.getAttributionsCollapsible()));this.setCollapsible(t)}return Array.from(i)}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=>gt((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ht(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Ha}):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(zt);t||0!==i?t&&0!==i&&this.element.classList.remove(zt):this.element.classList.add(zt)}this.label_.style.transform=t}this.rotation_=i}}class Jl extends Zl{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($,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($,this.handleClick_.bind(this,-i),!1);const c=e+" "+Gt+" "+Nt,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:Ha})):e.setZoom(n)}}}var Ql="active";class th extends Ot{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(Ql)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Ql,t)}setMap(t){this.map_=t}}function eh(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:Ha})}class ih extends th{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==Pl.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;eh(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}}function nh(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0}}else if(t.type==Pl.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Pl.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 gh(t){const e=t.length;let i=0,n=0;for(let r=0;r0&&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 mh extends ph{constructor(t){t=t||{},super({stopDown:ct}),this.condition_=t.condition?t.condition:rh,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!ch(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===nl)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(!ch(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!ch(t))return!1;if(ah(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class _h extends nt{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(){if(!this.map_)return;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 zr([i])}getGeometry(){return this.geometry_}}const yh="boxstart",xh="boxdrag",vh="boxend",wh="boxcancel";class bh extends _t{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Eh extends ph{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new _h(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??ah,this.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.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new bh(xh,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new bh(e?vh:wh,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!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 bh(yh,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bh(wh,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bh(wh,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Sh extends Eh{constructor(t){super({condition:(t=t||{}).condition?t.condition:hh,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:Ha})}}var Ch="ArrowLeft",Th="ArrowUp",Rh="ArrowRight",Ih="ArrowDown";class Mh extends th{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return lh(t)&&uh(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==J){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Ih||n==Ch||n==Rh||n==Th)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Ih?a=-s:n==Ch?o=-s:n==Rh?o=s:a=s;const l=[o,a];Ri(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:Qa,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}class Fh extends th{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return O?e.metaKey:e.ctrlKey}(t)&&uh(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==J||t.type==Q){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;eh(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class kh extends th{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:oh;this.condition_=t.onFocusOnly?nh(sh,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_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==it)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel),t.type==it&&(n=i.deltaY,L&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=z),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_?e.getCoordinateFromPixel(this.lastAnchor_):null),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=-d(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),eh(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,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 Ah extends ph{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=ct),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!==nl&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(gh(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}}class Ph extends ph{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=ct),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(gh(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}}class Lh extends _t{constructor(t,e){super(t),this.layer=e}}const Dh="layers";class Oh extends wl{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(Dh,this.handleLayersChanged_),i?Array.isArray(i)?i=new Qr(i.slice(),{unique:!0}):me("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Qr(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(wt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(xt(t,Zr,this.handleLayersAdd_,this),xt(t,$r,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(wt);ft(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t=0;--r){const s=g[r],c=s.layer;if(c.hasRenderer()&&El(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);_[0]=a[0]+p[n][0],_[1]=a[1]+p[n][1],l=r.forEachFeatureAtCoordinate(_,e,i,h,m)}if(l)return l}}if(0===m.length)return;const y=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*y)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,ut,this,r,s)}getMap(){return this.map_}renderFrame(t){At()}scheduleExpireIconCache(t){Ct.canExpireCache()&&t.postRenderFunctions.push(Gh)}}function Gh(t,e){Ct.expire()}class jh extends zh{constructor(t){super(t),this.fontChangeListenerKey_=xt(te,Ft,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Gt+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Xo(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){wt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(is,t);const e=t.layerStatesArray.sort(((t,e)=>t.zIndex-e.zIndex));e.some((t=>t.layer instanceof Cl&&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=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}}function Nh(t){t instanceof bl?t.setMapInternal(null):t instanceof Oh&&t.getLayers().forEach(Nh)}function Xh(t,e){if(t instanceof bl)t.setMapInternal(e);else if(t instanceof Oh){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||function(t){t=t||{};const e=new Qr;return(void 0===t.zoom||t.zoom)&&e.push(new Jl(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new Hl(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new $l(t.attributionOptions)),e}(),this.interactions=e.interactions||function(t){t=t||{};const e=new Qr,i=new Fl(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new mh),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new ih({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new fh({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Ah),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Ph({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Mh),e.push(new Fh({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new kh({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Sh({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Kl(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ul,this.handleLayerGroupChanged_),this.addChangeListener(Bl,this.handleViewChanged_),this.addChangeListener(ql,this.handleSizeChanged_),this.addChangeListener(Wl,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof al||t.view.then((function(t){i.setView(new al(t))})),this.controls.addEventListener(Zr,(t=>{t.element.setMap(this)})),this.controls.addEventListener($r,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(Zr,(t=>{t.element.setMap(this)})),this.interactions.addEventListener($r,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(Zr,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener($r,(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){Xh(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:ut,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 Oh?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:ut,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(Wl)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Wn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?er(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(Ul)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Qr)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Ks]||e[Zs]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Lh("removelayer",e)),this.set(Ul,t)}setSize(t){this.set(ql,t)}setTarget(t){this.set(Wl,t)}setView(t){if(!t||t instanceof al)return void this.set(Bl,t);this.set(Bl,new al);const e=this;t.then((function(t){e.setView(new al(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=[Math.max(0,n),Math.max(0,r)],!ue(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Ci("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&ht(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}class qh{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Wh(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new qh(t,e,i,n)}const Bh=[];class Vh extends Il{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=U(1,1,Bh)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=Lt(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(){this.context_&&(B(this.context_),Bh.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Yh=class extends Il{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}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Kr.IDLE&&(this.setState(Kr.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(Kr.ERROR)}setFeatures(t){this.features_=t,this.setState(Kr.LOADED)}setLoader(t){this.loader_=t}};class Kh{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=xe,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Pn(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Pn(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 At()}readFeature(t,e){return At()}readFeatures(t,e){return At()}readGeometry(t,e){return At()}readProjection(t){return At()}writeFeature(t,e){return At()}writeFeatures(t,e){return At()}writeGeometry(t,e){return At()}}function Zh(t,e,i){const n=i?Pn(i.featureProjection):null,r=i?Pn(i.dataProjection):null;let s=t;if(n&&r&&!Gn(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(Xn(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;iHh({...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 Zh(new Xr(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(gi(t,0,e,i)||mi(t=t.slice(),0,e,i),t):(pi(t,0,e,i)||fi(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 Jh(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>Jh(t,e)));return new fr(i)}return Zh(new(0,$h[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}class Qh extends Kh{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(tu(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(tu(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return At()}readFeaturesFromObject(t,e){return At()}readGeometry(t,e){return this.readGeometryFromObject(tu(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return At()}readProjection(t){return this.readProjectionFromObject(tu(t))}readProjectionFromObject(t){return At()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return At()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return At()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return At()}}function tu(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}class eu extends Qh{constructor(t){t=t||{},super(),this.dataProjection=Pn(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Pn(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=iu(i.geometry);if(this.featureClass===Xr)return Hh({geometry:n,id:i.id,properties:i.properties},e);const r=new xe;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Jh(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=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);this.prepareContainer(t,e);const f=this.context.canvas.width,m=this.context.canvas.height,_=this.getRenderContext(t);let y=!1,x=!0;if(l.extent){const e=Yn(l.extent,u.projection);x=Je(e,t.extent),y=x&&!Te(e,t.extent),y&&this.clipUnrotated(_,t,e)}const v=i.getImage(),w=nr(this.tempTransform,f/2,m/2,p,g,0,a*(n[0]-c[0])/s,a*(c[1]-n[3])/o);this.renderedResolution=o*h/a;const b=v.width*w[0],E=v.height*w[3];if(this.getLayer().getSource().getInterpolate()||(_.imageSmoothingEnabled=!1),this.preRender(_,t),x&&b>=.5&&E>=.5){const t=w[4],e=w[5],i=l.opacity;1!==i&&(_.save(),_.globalAlpha=i),_.drawImage(v,0,0,+v.width,+v.height,t,e,b,E),1!==i&&_.restore()}return this.postRender(this.context,t),y&&_.restore(),_.imageSmoothingEnabled=!0,this.container}}class su extends bl{constructor(t){super(t=t||{})}}class ou extends su{constructor(t){super(t)}createRenderer(){return new ru(this)}getData(t){return super.getData(t)}}const au=4294967296,lu=1/au,hu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class uu{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*au;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*au;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return cu(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return cu(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return cu(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return cu(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return cu(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return cu(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&hu?hu.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?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){const 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(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&du(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&du(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,pu,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,gu,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,_u,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,fu,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,mu,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,yu,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,xu,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,vu,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,wu,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function cu(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function du(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function pu(t,e){for(let i=0;i>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===Xr)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=_i(a,l);t=e.length>1?new jr(a,"XY",e):new zr(a,"XY",l)}else t="Point"===h?new Dr(a,"XY"):"LineString"===h?new Pr(a,"XY"):"MultiPoint"===h?new Or(a,"XY"):"MultiLineString"===h?new Lr(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Zh(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=Pn((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new uu(t),s=r.readFields(Eu,{}),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>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 Cu(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos2||Math.abs(t[4*e+3]-191.25)>2}function Ou(t,e,i,n){const r=Un(i,e,t);let s=Ln(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Ce(l,r)){const e=Ln(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function zu(t,e,i,n){const r=qe(i);let s=Ou(t,e,r,n);return(!isFinite(s)||s<=0)&&je(i,(function(i){return s=Ou(t,e,i,n),isFinite(s)&&s>0})),s}function Gu(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),Pu);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 _;l.forEach((function(t,e,i){De(m,t.extent)}));const y=i/n,x=(c?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(_=U(Math.round(He(m)*y),Math.round(Ye(m)*y),Pu),c||(_.imageSmoothingEnabled=!1),r&&p){const t=(r[0]-m[0])*y,e=-(r[3]-m[3])*y,i=He(r)*y,n=Ye(r)*y;_.rect(t,e,i,n),_.clip()}l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){_.save();const e=(t.clipExtent[0]-m[0])*y,i=-(t.clipExtent[3]-m[3])*y,n=He(t.clipExtent)*y,r=Ye(t.clipExtent)*y;_.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),_.clip()}const e=(t.extent[0]-m[0])*y,i=-(t.extent[3]-m[3])*y,n=He(t.extent)*y,r=Ye(t.extent)*y;_.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&_.restore()}}))}const v=Ze(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 y=f((r[0][0]-v[0])/s),w=f(-(r[0][1]-v[1])/s),b=f((r[1][0]-v[0])/s),E=f(-(r[1][1]-v[1])/s),S=f((r[2][0]-v[0])/s),C=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;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-y],[d,p,0,0,S-y],[0,0,h,u,E-w],[0,0,d,p,C-w]]);if(!I)return;if(g.save(),g.beginPath(),function(){if(void 0===Au){const t=U(6,6,Pu);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Lu(t,4,5,4,0),Lu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Au=Du(e,0)||Du(e,4)||Du(e,8),B(t),Pu.push(t.canvas)}return Au}()||!c){g.moveTo(b,E);const t=4,e=y-b,i=w-E;for(let n=0;ner(o,Un(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const r=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(r);for(let s=0;s=o?t[s+i]:r[i]}return e}):Xn(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&He(n)>=He(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?He(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?He(this.targetProj_.getExtent()):null;const u=Ze(i),c=$e(i),d=Ue(i),p=Xe(i),g=this.transformInv_(u),f=this.transformInv_(c),m=this.transformInv_(d),_=this.transformInv_(p),y=10+(s?Math.max(0,Math.ceil(Math.log2(Ne(i)/(s*s*256*256)))):0);if(this.addQuad_(u,c,d,p,g,f,m,_,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&u<1;let p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){p=He(we([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])&&!Je(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=(_(r[0],c)+_(o[0],c))/2-_(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;Oe(t,r[0]),Oe(t,r[1]),Oe(t,r[2])})),t}getTriangles(){return this.triangles_}}function Nu(t,e,i,n,r,s,o){const a=1/(t-e),l=1/(i-n),h=1/(r-s);return(o=o??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*h,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*l,o[14]=(s+r)*h,o[15]=1,o}function Xu(t,e,i,n,r){return(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*n,r[9]=t[9]*n,r[10]=t[10]*n,r[11]=t[11]*n,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}class Uu{constructor(t){this.gl_=t,this.program_=Wu(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"),this.positionLocation=t.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=t.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=t.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=t.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=t.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.positions),t.STATIC_DRAW),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.texcoords),t.STATIC_DRAW)}drawImage(t,e,i,n,r,s,o,a,l,h,u,c,d){const p=this.gl_;void 0===a&&(a=n),void 0===l&&(l=r),void 0===s&&(s=e),void 0===o&&(o=i),void 0===h&&(h=s),void 0===u&&(u=o),void 0===c&&(c=p.canvas.width),void 0===d&&(d=p.canvas.height),p.bindTexture(p.TEXTURE_2D,t),p.useProgram(this.program_),p.bindBuffer(p.ARRAY_BUFFER,this.positionBuffer),p.enableVertexAttribArray(this.positionLocation),p.vertexAttribPointer(this.positionLocation,2,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,this.texcoordBuffer),p.enableVertexAttribArray(this.texcoordLocation),p.vertexAttribPointer(this.texcoordLocation,2,p.FLOAT,!1,0,0);let g=Nu(0,c,0,d,-1,1);g=function(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,g,f,m;return t===(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])?(r[12]=t[0]*e+t[4]*i+t[8]*n+t[12],r[13]=t[1]*e+t[5]*i+t[9]*n+t[13],r[14]=t[2]*e+t[6]*i+t[10]*n+t[14],r[15]=t[3]*e+t[7]*i+t[11]*n+t[15]):(s=t[0],o=t[1],a=t[2],l=t[3],h=t[4],u=t[5],c=t[6],d=t[7],p=t[8],g=t[9],f=t[10],m=t[11],r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=h,r[5]=u,r[6]=c,r[7]=d,r[8]=p,r[9]=g,r[10]=f,r[11]=m,r[12]=s*e+h*i+p*n+t[12],r[13]=o*e+u*i+g*n+t[13],r[14]=a*e+c*i+f*n+t[14],r[15]=l*e+d*i+m*n+t[15]),r}(g,a,l,0),g=Xu(g,h,u,1),p.uniformMatrix4fv(this.matrixLocation,!1,g);let f=(m=n/e,_=r/i,y=0,(x=x??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=1,x[1]=0,x[2]=0,x[3]=0,x[4]=0,x[5]=1,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1,x[11]=0,x[12]=m,x[13]=_,x[14]=y,x[15]=1,x);var m,_,y,x;f=Xu(f,s/e,o/i,1),p.uniformMatrix4fv(this.textureMatrixLocation,!1,f),p.uniform1i(this.textureLocation,0),p.drawArrays(p.TRIANGLES,0,this.positions.length/2)}}function qu(t,e,i){const n=t.createShader(e);if(null===n)throw new Error("Shader compilation failed");if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(n);if(null===e)throw new Error("Shader info log creation failed");throw new Error(e)}return n}function Wu(t,e,i){const n=t.createProgram(),r=qu(t,t.VERTEX_SHADER,i),s=qu(t,t.FRAGMENT_SHADER,e);if(null===n)throw new Error("Program creation failed");if(t.attachShader(n,r),t.attachShader(n,s),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){if(null===t.getProgramInfoLog(n))throw new Error("Program info log creation failed");throw new Error}return n}const Bu=[];function Vu(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const g=Math.round(n*e),f=Math.round(n*i);let m,_;if(t.canvas.width=g,t.canvas.height=f,_=t.createTexture(),t.bindTexture(t.TEXTURE_2D,_),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,g,f,0,t.RGBA,u,null),m=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,m),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,_,0),null===m)throw new Error("Could not create framebuffer");if(null===_)throw new Error("Could not create texture");if(0===l.length)return{width:g,height:f,framebuffer:m,texture:_};const y=[1/0,1/0,-1/0,-1/0];let x,v,w;l.forEach((function(t,e,i){De(y,t.extent)}));const b=1/r;{if(x=t.createTexture(),null===_)throw new Error("Could not create texture");v=Math.round(He(y)*b),w=Math.round(Ye(y)*b);const e=t.getParameter(t.MAX_TEXTURE_SIZE),i=Math.max(v,w),n=i>e?e/i:1,r=Math.round(v*n),s=Math.round(w*n);t.bindTexture(t.TEXTURE_2D,x),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,s,0,t.RGBA,u,null);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0);const a=new Uu(t);l.forEach((function(e,i,l){const u=(e.extent[0]-y[0])*b*n,c=-(e.extent[3]-y[3])*b*n,p=He(e.extent)*b*n,g=Ye(e.extent)*b*n;if(t.bindFramebuffer(t.FRAMEBUFFER,o),t.viewport(0,0,r,s),e.clipExtent){const i=(e.clipExtent[0]-y[0])*b*n,r=-(e.clipExtent[3]-y[3])*b*n,s=He(e.clipExtent)*b*n,o=Ye(e.clipExtent)*b*n;t.enable(t.SCISSOR_TEST),t.scissor(d?i:Math.round(i),d?r:Math.round(r),d?s:Math.round(i+s)-Math.round(i),d?o:Math.round(r+o)-Math.round(r))}a.drawImage(e.texture,e.width,e.height,h,h,e.width-2*h,e.height-2*h,d?u:Math.round(u),d?c:Math.round(c),d?p:Math.round(u+p)-Math.round(u),d?g:Math.round(c+g)-Math.round(c),r,s),t.disable(t.SCISSOR_TEST)})),t.deleteFramebuffer(o)}const E=Ze(o),S=Ze(y),C=t=>{const e=(t[0][0]-E[0])/s*n,i=-(t[0][1]-E[1])/s*n;return{u1:(t[1][0]-E[0])/s*n,v1:-(t[1][1]-E[1])/s*n,u0:e,v0:i,u2:(t[2][0]-E[0])/s*n,v2:-(t[2][1]-E[1])/s*n}};t.bindFramebuffer(t.FRAMEBUFFER,m),t.viewport(0,0,g,f);{const e=[],i=[],n=Wu(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n");t.useProgram(n);const s=t.getUniformLocation(n,"u_texture");t.bindTexture(t.TEXTURE_2D,x),t.uniform1i(s,0),a.getTriangles().forEach((function(t,n,s){const o=t.source,a=t.target,{u1:l,v1:h,u0:u,v0:c,u2:d,v2:p}=C(a),g=(o[0][0]-S[0])/r/v,f=-(o[0][1]-S[1])/r/w,m=(o[1][0]-S[0])/r/v,_=-(o[1][1]-S[1])/r/w,y=(o[2][0]-S[0])/r/v,x=-(o[2][1]-S[1])/r/w;e.push(l,h,u,c,d,p),i.push(m,_,g,f,y,x)}));const o=Nu(0,g,f,0,-1,1),l=t.getUniformLocation(n,"u_matrix");t.uniformMatrix4fv(l,!1,o);const h=t.getAttribLocation(n,"a_position"),u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.vertexAttribPointer(h,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h);const c=t.getAttribLocation(n,"a_texcoord"),d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.drawArrays(t.TRIANGLES,0,e.length/2)}if(c){const e=Wu(t,"\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n","\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n");t.useProgram(e);const i=Nu(0,g,f,0,-1,1),n=t.getUniformLocation(e,"u_matrix");t.uniformMatrix4fv(n,!1,i);const r=Array.isArray(c)?c:[0,0,0,255],s=t.getUniformLocation(e,"u_val");t.uniform4fv(s,r);const o=t.getAttribLocation(e,"a_position"),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const h=a.getTriangles().reduce((function(t,e){const i=e.target,{u1:n,v1:r,u0:s,v0:o,u2:a,v2:l}=C(i);return t.concat([n,r,s,o,s,o,a,l,a,l,n,r])}),[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(h),t.STATIC_DRAW),t.drawArrays(t.LINES,0,h.length/2)}return{width:g,height:f,framebuffer:m,texture:_}}class Yu extends ku{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.renderEdges_=void 0!==t.renderEdges&&t.renderEdges,this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),n=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?n?Ke(i,n):i:n;const r=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),s=this.targetTileGrid_.getExtent();let o=this.sourceTileGrid_.getExtent();const a=s?Ke(r,s):r;if(0===Ne(a))return void(this.state=Kr.EMPTY);i&&(o=o?Ke(o,i):i);const l=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,u=zu(e,h,a,l);if(!isFinite(u)||u<=0)return void(this.state=Kr.EMPTY);const c=void 0!==t.errorThreshold?t.errorThreshold:.5;if(this.triangulation_=new ju(e,h,a,o,u*c,l,t.transformMatrix),0===this.triangulation_.getTriangles().length)return void(this.state=Kr.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(u);let p=this.triangulation_.calculateSourceExtent();if(o&&(e.canWrapX()?(p[1]=d(p[1],o[1],o[3]),p[3]=d(p[3],o[1],o[3])):p=Ke(p,o)),Ne(p)){let n=0,r=0;e.canWrapX()&&(n=He(i),r=Math.floor((p[0]-i[0])/n));ii(p.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=Kr.EMPTY)}else this.state=Kr.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach((i=>{const n=i.tile;if(!n||n.getState()!==Kr.LOADED)return;const r=n.getSize(),s=this.gutter_;let o;const a=(l=n.getData())instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Float32Array||l instanceof DataView?l:null;var l;a?o=a:(e=!0,o=function(t){Mu||(Mu=U(t.width,t.height,void 0,{willReadFrequently:!0}));const e=Mu.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),Mu.clearRect(0,0,i,n),Mu.drawImage(t,0,0),Mu.getImageData(0,0,i,n).data}(Ru(n.getData())));const h=[r[0]+2*s,r[1]+2*s],u=o instanceof Float32Array,c=h[0]*h[1],d=u?Float32Array:Uint8ClampedArray,p=new d(o.buffer),g=d.BYTES_PER_ELEMENT,f=g*p.length/c,m=p.byteLength/h[1],_=Math.floor(m/g/h[0]),y=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);y[0]+=i.offset,y[2]+=i.offset;const x=this.clipExtent_?.slice();x&&(x[0]+=i.offset,x[2]+=i.offset),t.push({extent:y,clipExtent:x,data:p,dataType:d,bytesPerPixel:f,pixelSize:h,bandCount:_})})),this.sourceTiles_.length=0,0===t.length)return this.state=Kr.ERROR,void this.changed();const i=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(i),r="number"==typeof n?n:n[0],s="number"==typeof n?n:n[1],o=r*this.pixelRatio_,a=s*this.pixelRatio_,l=this.targetTileGrid_.getResolution(i),h=this.sourceTileGrid_.getResolution(this.sourceZ_),u=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),c=t[0].bandCount,d=new t[0].dataType(c*o*a),p=function(t,e,i,n){let r;return r=i&&i.length?i.shift():G?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("webgl",n)}(o,a,Bu,{premultipliedAlpha:!1,antialias:!1});let g;const f=p.RGBA;let m;if(t[0].dataType==Float32Array){m=p.FLOAT,p.getExtension("WEBGL_color_buffer_float"),p.getExtension("OES_texture_float"),p.getExtension("EXT_float_blend");g=null!==p.getExtension("OES_texture_float_linear")&&this.interpolate}else m=p.UNSIGNED_BYTE,g=this.interpolate;for(let e=Math.ceil(c/4)-1;e>=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==Kr.IDLE&&i!==Kr.LOADING)return;t++;const n=xt(e,Y,(()=>{const i=e.getState();i!=Kr.LOADED&&i!=Kr.ERROR&&i!=Kr.EMPTY||(wt(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==Kr.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(wt),this.sourcesListenerKeys_=null}}class Ku extends Il{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,Kr.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,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const p=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const m=g?Ke(p,g):p;if(0===Ne(m))return void(this.state=Kr.EMPTY);const _=t.getExtent();_&&(f=f?Ke(f,_):_);const y=n.getResolution(this.wrappedTileCoord_[0]),x=zu(t,i,m,y);if(!isFinite(x)||x<=0)return void(this.state=Kr.EMPTY);const v=void 0!==h?h:.5;if(this.triangulation_=new ju(t,i,m,f,x*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=Kr.EMPTY);this.sourceZ_=e.getZForResolution(x);let w=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(w[1]=d(w[1],f[1],f[3]),w[3]=d(w[3],f[1],f[3])):w=Ke(w,f)),Ne(w)){let i=0,n=0;t.canWrapX()&&(i=He(_),n=Math.floor((w[0]-_[0])/i));ii(w.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=l(this.sourceZ_,t,e,o);if(r){const t=n*i;this.sourceTiles_.push({tile:r,offset:t})}}++n})),0===this.sourceTiles_.length&&(this.state=Kr.EMPTY)}else this.state=Kr.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==Kr.LOADED){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=Kr.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_=Gu(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=Kr.LOADED}this.changed()}load(){if(this.state==Kr.IDLE){this.state=Kr.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==Kr.IDLE||i==Kr.LOADING){t++;const i=xt(e,Y,(n=>{const r=e.getState();r!=Kr.LOADED&&r!=Kr.ERROR&&r!=Kr.EMPTY||(wt(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==Kr.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(wt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(B(this.canvas_.getContext("2d")),Pu.push(this.canvas_),this.canvas_=null),super.release()}}class Zu{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof nt&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}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 me(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 me(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){me(!(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}}function $u(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Hu(t,e,i,n){return`${t},${function(t,e,i){return t+"/"+e+"/"+i}(e,i,n)}`}function Ju(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Qu(t,e,i){const n=t[i];return!!n&&n.delete(e)}function tc(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Ke(e,Yn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Ke(e,i))}return e}class ec extends Bo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision_,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new qh(0,0,0,0),this.tempTileCoord_=$u(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Zu(i),this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Hu(s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{if(a=s.getTile(t,e,i,n.pixelRatio,n.viewState.projection),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=er(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Ce(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==Kr.LOADED)continue;const h=a.getOrigin(t),u=ce(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Ml||r instanceof Ku)d=r.getImage();else{if(!(r instanceof ku))continue;if(d=Ru(r.getData()),!d)continue}const p=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),g=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),f=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+f,g+f)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedRevision_?this.renderedRevision_!==i&&(this.renderedRevision_=i,this.renderedSourceKey_===e.getKey()&&this.tileCache_.clear()):this.renderedRevision_=i,!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=Lt(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,g=p?Ve(s.center,s.resolution,p,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(p&&!l.tileCoordIntersectsViewport([r,e,o],g))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Ju(n,i,r))continue;const a=i.getKey();if(u[a]=!0,i.getState()===Kr.IDLE&&!t.tileQueue.isKeyQueued(a)){const n=$u(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t0&&setTimeout((()=>{this.enqueueTiles(t,C,d-1,E,S-1)}),0),!(d in E))return this.container;const T=Lt(this),R=t.time;for(const e of E[d]){const n=e.getState();if((e instanceof Ku||e instanceof Yu)&&n===Kr.EMPTY)continue;const r=e.tileCoord;if(n===Kr.LOADED){if(1===e.getAlpha(T,R)){e.endTransition(T);continue}}n!==Kr.IDLE&&(i=!1),n!==Kr.ERROR&&(this.renderComplete=!1);if(this.findStaleTile_(r,E)){Qu(E,e,d),t.animate=!0;continue}if(this.findAltTiles_(c,r,d+1,E))continue;const s=c.getMinZoom();for(let t=d-1;t>=s;--t){if(this.findAltTiles_(c,r,t,E))break}}const I=p/o*l/m,M=this.getRenderContext(t);nr(this.tempTransform,_/2,y/2,I,I,0,-_/2,-y/2),n.extent&&this.clipUnrotated(M,t,x),u.getInterpolate()||(M.imageSmoothingEnabled=!1),this.preRender(M,t);const F=Object.keys(E).map(Number);let k;F.sort(rt);const A=[],P=[];for(let e=F.length-1;e>=0;--e){const i=F[e],n=u.getTilePixelSize(i,l,s),r=c.getResolution(i)/p,o=n[0]*r*I,a=n[1]*r*I,h=c.getTileCoordForCoordAndZ(Ze(b),i),d=c.getTileCoordExtent(h),g=er(this.tempTransform,[m*(d[0]-b[0])/p,m*(b[3]-d[3])/p]),f=m*u.getGutterForProjection(s);for(const e of E[i]){if(e.getState()!==Kr.LOADED)continue;const n=e.tileCoord,r=h[1]-n[1],s=Math.round(g[0]-(r-1)*o),l=h[2]-n[2],c=Math.round(g[1]-(l-1)*a),d=Math.round(g[0]-r*o),p=Math.round(g[1]-l*a),m=s-d,_=c-p,y=1===F.length;let x=!1;k=[d,p,d+m,p,d+m,p+_,d,p+_];for(let t=0,e=A.length;t{const i=Lt(u),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache()};t.postRenderFunctions.push(e)}return this.renderComplete||i||(t.animate=!0),this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof ku){if(l=Ru(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=Lt(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()}updateUsedTiles(t,e,i){const n=Lt(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var ic="preload",nc="useInterimTilesOnError";class rc extends bl{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(ic)}setPreload(t){this.set(ic,t)}getUseInterimTilesOnError(){return this.get(nc)}setUseInterimTilesOnError(t){this.set(nc,t)}getData(t){return super.getData(t)}}class sc extends rc{constructor(t){super(t)}createRenderer(){return new ec(this,{cacheSize:this.getCacheSize()})}}function oc(t){return Array.isArray(t)?Math.min(...t):t}class ac extends bt{constructor(t,e,n,r,s,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const u=h?Ke(n,h):n,c=Ou(t,e,qe(u),r),d=new ju(t,e,u,l,.5*c,r),p=d.calculateSourceExtent(),g=Qe(p)?null:o(p,c,s),f=g?i.IDLE:i.EMPTY,m=g?g.getPixelRatio():1;super(n,r,m,f),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=d,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=g,this.sourcePixelRatio_=m,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==i.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==i.LOADED){const t=He(this.targetExtent_)/this.targetResolution_,e=Ye(this.targetExtent_)/this.targetResolution_;this.canvas_=Gu(t,e,this.sourcePixelRatio_,oc(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==i.IDLE){this.state=i.LOADING,this.changed();const t=this.sourceImage_.getState();t==i.LOADED||t==i.ERROR?this.reproject_():(this.sourceListenerKey_=xt(this.sourceImage_,Y,(t=>{const e=this.sourceImage_.getState();e!=i.LOADED&&e!=i.ERROR||(this.unlistenSource_(),this.reproject_())})),this.sourceImage_.load())}}unlistenSource_(){wt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const lc="imageloadstart",hc="imageloadend",uc="imageloaderror";class cc extends _t{constructor(t,e){super(t),this.image=e}}class dc extends zs{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[ot(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Gn(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Gn(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 ac(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=qe(t),o=w(He(t)/r,4),a=w(Ye(t)/r,4),l=w((n-1)*o/2,4),h=o+2*l,u=w((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_&&Te(this.wantedExtent_,r)||Te(this.image.getExtent(),r))&&(this.wantedResolution_&&oc(this.wantedResolution_)===s||oc(this.image.getResolution())===s)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=s,this.image=new bt(r,s,i,this.loader),this.image.addEventListener(Y,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case i.LOADING:this.loading=!0,n=lc;break;case i.LOADED:this.loading=!1,n=hc;break;case i.ERROR:this.loading=!1,n=uc;break;default:return}this.hasListener(n)&&this.dispatchEvent(new cc(n,e))}}const pc=[0,0,0];class gc{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,me(function(t,e,i){const n=e||rt;return t.every((function(e,i){if(0===i)return!0;const r=n(t[i-1],e);return!(r>0||0===r)}))}(this.resolutions_,((t,e)=>e-t)),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new qh(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=Wh(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class vc extends _t{constructor(t,e){super(t),this.tile=e}}function wc(t){return function(e){const i=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=i.length,l=i[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:n,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sthis.getTileInternal(t,e,i,n,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return c.key=a,c}getTileInternal(t,e,i,n,r){const s=this.getKey();return this.createTile_(t,e,i,n,r,s)}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Pn(t);if(i){const t=Lt(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Uc(t,e){t.getImage().src=e}class qc extends Xc{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:Pn("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_"+Lt(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+"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{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=Pn("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=jn(e,i);n=ti(t.bounds,r)}const r=yc(i),s=t.minzoom||0,o=mc({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=Oc(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return Je(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}const Wc={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Bc={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class Vc extends ec{constructor(t,e){super(t,e),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}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState.resolution,o=n.viewHints;return!!(o[Ks]||o[Zs])&&r.wantedResolution||(r.wantedResolution=s),r}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=Lt(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let i=0,r=d.length;it.value)):null;let m;t:for(let e=0,n=d.length;e{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=er(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find((t=>t.tileCoord.toString()===u&&t.getState()===Kr.LOADED));if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Te(o,l.getTileCoordExtent(c.tileCoord))&&Ii(h,s);const d=Lt(n),p=Ze(l.getTileCoordExtent(c.wrappedTileCoord)),g=[(h[0]-p[0])/a,(p[1]-h[1])/a],f=c.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let m=c.hitDetectionImageData[d];if(!m){const t=ce(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=jo(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,Go,t[0]*Go,t[1]*Go,0)],f,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(No(g,f,m))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==Kr.LOADED)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,Lo,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=Lt(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.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()})),e[t].length=0)}))}))}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.tempExtent)[0]-d[0];return Qn(ir(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[Ks]||i[Zs]);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?Bc[s].filter((t=>!Lo.includes(t))):Bc[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=[],_=Lt(r);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[_].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let w,b=t;if(v){w=new bo,b=w.getContext();for(let t=0,e=g.length;t{const r=this.tileUrlFunction(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?Kr.IDLE:Kr.EMPTY,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===Kr.LOADED||n===Kr.ERROR){const e=s.getKey();e in i.errorTileKeys?s.getState()===Kr.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===Kr.ERROR?i.errorTileKeys[e]=!0:s.removeEventListener(Y,t),0===i.loadingSourceTiles&&i.setState(mt(i.errorTileKeys)?Kr.LOADED:Kr.ERROR)}};s.addEventListener(Y,t),i.loadingSourceTiles++}o===Kr.IDLE&&(s.extent=l.getTileCoordExtent(n),s.projection=e,s.resolution=l.getResolution(n[0]),s.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===Kr.ERROR))?Kr.ERROR:Kr.LOADED)}return i.sourceTiles}removeSourceTiles(t){const e=t.sourceTiles;for(let t=0,i=e.length;t{h=h&&!this.tileUrlFunction(t,n,r)}))}const u=new Vh(s,h?Kr.EMPTY:Kr.IDLE,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return u.key=this.getKey(),u}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=sl+1;for(let t=n.length;t255?255:t}function td(t){return t<0?0:t>1?1:t}function ed(t){return"%"===t[t.length-1]?Qc(parseFloat(t)/100*255):Qc(parseInt(t))}function id(t){return"%"===t[t.length-1]?td(parseFloat(t)/100):td(parseFloat(t))}function nd(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{Hc={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Jc)return Jc[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=id(o.pop());case"rgb":return 3!==o.length?null:[ed(o[0]),ed(o[1]),ed(o[2]),a];case"hsla":if(4!==o.length)return null;a=id(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=id(o[1]),u=id(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[Qc(255*nd(d,c,l+1/3)),Qc(255*nd(d,c,l)),Qc(255*nd(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class rd{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 rd)return t;if("string"!=typeof t)return;const e=Hc(t);return e?new rd(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]}}rd.black=new rd(0,0,0,1),rd.white=new rd(1,1,1,1),rd.transparent=new rd(0,0,0,0),rd.red=new rd(1,0,0,1),rd.blue=new rd(0,0,1,1);var sd=rd;function od(t){return"object"==typeof t?["literal",t]:t}function ad(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,od(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],gd(t[1])]:[t[0],od(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function pd(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function gd(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`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const kd=[xd,vd,wd,bd,Ed,Rd,Sd,Md(Cd),Id];function Ad(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Ad(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 kd)if(!Ad(t,e))return null}return`Expected ${Fd(t)} but found ${Fd(e)} instead.`}function Pd(t,e){return e.some((e=>e.kind===t.kind))}function Ld(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 Dd{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 Od{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 zd{constructor(t){this.sections=t}static fromString(t){return new zd([new Od(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 zd?t:zd.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 Gd{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Gd({name:t,available:!1}):null}serialize(){return["image",this.name]}}function jd(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 Nd(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 sd)return!0;if(t instanceof Dd)return!0;if(t instanceof zd)return!0;if(t instanceof Gd)return!0;if(Array.isArray(t)){for(const e of t)if(!Nd(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Nd(t[e]))return!1;return!0}return!1}function Xd(t){if(null===t)return xd;if("string"==typeof t)return wd;if("boolean"==typeof t)return bd;if("number"==typeof t)return vd;if(t instanceof sd)return Ed;if(t instanceof Dd)return Td;if(t instanceof zd)return Rd;if(t instanceof Gd)return Id;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Xd(e);if(i){if(i===t)continue;i=Cd;break}i=t}return Md(i||Cd,e)}return Sd}function Ud(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof sd||t instanceof zd||t instanceof Gd?t.toString():JSON.stringify(t)}class qd{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(!Nd(t[1]))return e.error("invalid value");const i=t[1];let n=Xd(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 qd(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 sd?["rgba"].concat(this.value.toArray()):this.value instanceof zd?this.value.serialize():this.value}}var Wd=qd;var Bd=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Vd={string:wd,number:vd,boolean:bd,object:Sd};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.");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 Vd)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Vd[i],n++}else r=Cd;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=Md(r,s)}else i=Vd[r];const s=[];for(;nt.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 Kd=Yd;class Zd{constructor(t){this.type=Rd,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,vd),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,Md(wd)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,Ed),!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,Cd);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 Zd(n)}evaluate(t){return new zd(this.sections.map((e=>{const i=e.content.evaluate(t);return Xd(i)===Id?new Od("",i,null,null,null):new Od(Ud(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 $d{constructor(t){this.type=Id,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,wd);return i?new $d(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Gd.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 Hd={"to-boolean":bd,"to-color":Ed,"to-number":vd,"to-string":wd};class Jd{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=Hd[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:jd(e[0],e[1],e[2],e[3]),!i))return new sd(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Bd(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 Bd(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?zd.fromString(Ud(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Gd.fromString(Ud(this.args[0].evaluate(t))):Ud(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 Zd([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new $d(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Qd=Jd;const tp=["Unknown","Point","LineString","Polygon"];var ep=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?tp[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]=sd.parse(t)),e}};class ip{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=ip.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 kp(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(Fd).join(", ")})`:`(${Fd(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function lp(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*sp),Math.round(n*s*sp)]}function hp(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 up(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 cp(t,e){let i=!1;for(let n=0,r=e.length;n0&&c<0||u<0&&c>0}function gp(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]&&!(!pp(t,e,i,n)||!pp(i,n,t,e));var o,a}function fp(t,e,i){for(const n of i)for(let i=0;ii[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}op(e,t)}function wp(t,e,i,n){const r=Math.pow(2,n.z)*sp,s=[n.x*sp,n.y*sp],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]];vp(n,e,i,r),o.push(n)}return o}function bp(t,e,i,n){const r=Math.pow(2,n.z)*sp,s=[n.x*sp,n.y*sp],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]];op(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)vp(n,e,i,r)}return o}class Ep{constructor(t,e){this.type=bd,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(Nd(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!Cp(t)&&(e=!1)})),e}function Tp(t){if(t instanceof np&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Tp(t)&&(e=!1)})),e}function Rp(t,e){if(t instanceof np&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Rp(t,e)&&(i=!1)})),i}class Ip{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 Ip(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 Mp=Ip;class Fp{constructor(t,e=[],i,n=new yd,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 Kd(e,[t]):"coerce"===i?new Qd(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 Wd)&&"resolvedImage"!==n.type.kind&&Ap(n)){const t=new ep;try{n=new Wd(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 Fp(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new md(i,t))}checkSubtype(t,e){const i=Ad(t,e);return i&&this.error(i),i}}var kp=Fp;function Ap(t){if(t instanceof Mp)return Ap(t.boundExpression);if(t instanceof np&&"error"===t.name)return!1;if(t instanceof rp)return!1;if(t instanceof Sp)return!1;const e=t instanceof Qd||t instanceof Kd;let i=!0;return t.eachChild((t=>{i=e?i&&Ap(t):i&&t instanceof Wd})),!!i&&(Cp(t)&&Rp(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function Pp(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||ee))throw new Bd("Input is not a number.");o=a-1}return 0}class Lp{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,vd);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=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 Lp(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[Pp(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;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var Dp=Lp,Op=zp;function zp(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}zp.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},zp.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},zp.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},zp.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},zp.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Gp=$c(Op);function jp(t,e,i){return t*(1-i)+e*i}var Np=Object.freeze({__proto__:null,number:jp,color:function(t,e,i){return new sd(jp(t.r,e.r,i),jp(t.g,e.g,i),jp(t.b,e.b,i),jp(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>jp(t,e[n],i)))}});const Xp=.95047,Up=1,qp=1.08883,Wp=4/29,Bp=6/29,Vp=3*Bp*Bp,Yp=Bp*Bp*Bp,Kp=Math.PI/180,Zp=180/Math.PI;function $p(t){return t>Yp?Math.pow(t,1/3):t/Vp+Wp}function Hp(t){return t>Bp?t*t*t:Vp*(t-Wp)}function Jp(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qp(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tg(t){const e=Qp(t.r),i=Qp(t.g),n=Qp(t.b),r=$p((.4124564*e+.3575761*i+.1804375*n)/Xp),s=$p((.2126729*e+.7151522*i+.072175*n)/Up);return{l:116*s-16,a:500*(r-s),b:200*(s-$p((.0193339*e+.119192*i+.9503041*n)/qp)),alpha:t.a}}function eg(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=Up*Hp(e),i=Xp*Hp(i),n=qp*Hp(n),new sd(Jp(3.2404542*i-1.5371385*e-.4985314*n),Jp(-.969266*i+1.8760108*e+.041556*n),Jp(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function ig(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const ng={forward:tg,reverse:eg,interpolate:function(t,e,i){return{l:jp(t.l,e.l,i),a:jp(t.a,e.a,i),b:jp(t.b,e.b,i),alpha:jp(t.alpha,e.alpha,i)}}},rg={forward:function(t){const{l:e,a:i,b:n}=tg(t),r=Math.atan2(n,i)*Zp;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*Kp,i=t.c;return eg({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:ig(t.h,e.h,i),c:jp(t.c,e.c,i),l:jp(t.l,e.l,i),alpha:jp(t.alpha,e.alpha,i)}}};class sg{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=og(e,t.base,i,n);else if("linear"===t.name)r=og(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Gp(s[0],s[1],s[2],s[3]).solve(og(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,vd),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Ed:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=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 sg(a,i,n,r,o):e.error(`Type ${Fd(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=Pp(e,n),o=e[s],a=e[s+1],l=sg.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?Np[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?rg.reverse(rg.interpolate(rg.forward(h),rg.forward(u),l)):ng.reverse(ng.interpolate(ng.forward(h),ng.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;tAd(n,t.type)));return new lg(s?Cd: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 Gd&&!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 hg=lg;class ug{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=i.length)throw new Bd(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Bd(`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 pg=dg;class gg{constructor(t,e){this.type=bd,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,Cd),n=e.parse(t[2],2,Cd);return i&&n?Pd(i.type,[bd,wd,vd,xd,Cd])?new gg(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fd(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!Ld(e,["boolean","string","number","null"]))throw new Bd(`Expected first argument to be of type boolean, string, number or null, but found ${Fd(Xd(e))} instead.`);if(!Ld(i,["string","array"]))throw new Bd(`Expected second argument to be of type array or string, but found ${Fd(Xd(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 fg=gg;class mg{constructor(t,e,i){this.type=vd,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,Cd),n=e.parse(t[2],2,Cd);if(!i||!n)return null;if(!Pd(i.type,[bd,wd,vd,xd,Cd]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fd(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,vd);return r?new mg(i,n,r):null}return new mg(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Ld(e,["boolean","string","number","null"]))throw new Bd(`Expected first argument to be of type boolean, string, number or null, but found ${Fd(Xd(e))} instead.`);if(!Ld(i,["string","array"]))throw new Bd(`Expected second argument to be of type array or string, but found ${Fd(Xd(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 _g=mg;class yg{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;oNumber.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,Xd(t)))return null}else i=Xd(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,Cd);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 yg(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Xd(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 xg=yg;class vg{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;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var wg=vg;class bg{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,Cd),n=e.parse(t[2],2,vd);if(!i||!n)return null;if(!Pd(i.type,[Md(Cd),wd,Cd]))return e.error(`Expected first argument to be of type array or string, but found ${Fd(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,vd);return r?new bg(i.type,i,n,r):null}return new bg(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Ld(e,["string","array"]))throw new Bd(`Expected first argument to be of type array or string, but found ${Fd(Xd(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 Eg=bg;function Sg(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 Cg(t,e,i,n){return 0===n.compare(e,i)}function Tg(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=bd,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,Cd);if(!s)return null;if(!Sg(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Fd(s.type)}'.`);let o=e.parse(t[2],2,Cd);if(!o)return null;if(!Sg(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Fd(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Fd(s.type)}' and '${Fd(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Kd(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Kd(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,Td),!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=Xd(s),i=Xd(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Bd(`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=Xd(s),i=Xd(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 Rg=Tg("==",(function(t,e,i){return e===i}),Cg),Ig=Tg("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Cg(0,e,i,n)})),Mg=Tg("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),kg=Tg("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),Ag=Tg(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class Pg{constructor(t,e,i,n,r,s){this.type=wd,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,vd);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,wd),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,wd),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,wd),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,vd),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,vd),!l)?null:new Pg(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 Lg{constructor(t){this.type=vd,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 ${Fd(i.type)} instead.`):new Lg(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 Bd(`Expected value to be of type string or array, but found ${Fd(Xd(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Dg={"==":Rg,"!=":Ig,">":Fg,"<":Mg,">=":Ag,"<=":kg,array:Kd,at:pg,boolean:Kd,case:wg,coalesce:hg,collator:rp,format:Zd,image:$d,in:fg,"index-of":_g,interpolate:ag,"interpolate-hcl":ag,"interpolate-lab":ag,length:Lg,let:cg,literal:Wd,match:xg,number:Kd,"number-format":Pg,object:Kd,slice:Eg,step:Dp,string:Kd,"to-boolean":Qd,"to-color":Qd,"to-number":Qd,"to-string":Qd,var:Mp,within:Sp};function Og(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=jd(e,i,n,s);if(o)throw new Bd(o);return new sd(e/255*s,i/255*s,n/255*s,s)}function zg(t,e){return t in e}function Gg(t,e){const i=e[t];return void 0===i?null:i}function jg(t){return{type:t}}np.register(Dg,{error:[{kind:"error"},[wd],(t,[e])=>{throw new Bd(e.evaluate(t))}],typeof:[wd,[Cd],(t,[e])=>Fd(Xd(e.evaluate(t)))],"to-rgba":[Md(vd,4),[Ed],(t,[e])=>e.evaluate(t).toArray()],rgb:[Ed,[vd,vd,vd],Og],rgba:[Ed,[vd,vd,vd,vd],Og],has:{type:bd,overloads:[[[wd],(t,[e])=>zg(e.evaluate(t),t.properties())],[[wd,Sd],(t,[e,i])=>zg(e.evaluate(t),i.evaluate(t))]]},get:{type:Cd,overloads:[[[wd],(t,[e])=>Gg(e.evaluate(t),t.properties())],[[wd,Sd],(t,[e,i])=>Gg(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Cd,[wd],(t,[e])=>Gg(e.evaluate(t),t.featureState||{})],properties:[Sd,[],t=>t.properties()],"geometry-type":[wd,[],t=>t.geometryType()],id:[Cd,[],t=>t.id()],zoom:[vd,[],t=>t.globals.zoom],pitch:[vd,[],t=>t.globals.pitch||0],"distance-from-center":[vd,[],t=>t.distanceFromCenter()],"heatmap-density":[vd,[],t=>t.globals.heatmapDensity||0],"line-progress":[vd,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[vd,[],t=>t.globals.skyRadialProgress||0],accumulated:[Cd,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[vd,jg(vd),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[vd,jg(vd),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:vd,overloads:[[[vd,vd],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[vd],(t,[e])=>-e.evaluate(t)]]},"/":[vd,[vd,vd],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[vd,[vd,vd],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[vd,[],()=>Math.LN2],pi:[vd,[],()=>Math.PI],e:[vd,[],()=>Math.E],"^":[vd,[vd,vd],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[vd,[vd],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[vd,[vd],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[vd,[vd],(t,[e])=>Math.log(e.evaluate(t))],log2:[vd,[vd],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[vd,[vd],(t,[e])=>Math.sin(e.evaluate(t))],cos:[vd,[vd],(t,[e])=>Math.cos(e.evaluate(t))],tan:[vd,[vd],(t,[e])=>Math.tan(e.evaluate(t))],asin:[vd,[vd],(t,[e])=>Math.asin(e.evaluate(t))],acos:[vd,[vd],(t,[e])=>Math.acos(e.evaluate(t))],atan:[vd,[vd],(t,[e])=>Math.atan(e.evaluate(t))],min:[vd,jg(vd),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[vd,jg(vd),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[vd,[vd],(t,[e])=>Math.abs(e.evaluate(t))],round:[vd,[vd],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[vd,[vd],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[vd,[vd],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[bd,[wd,Cd],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[bd,[Cd],(t,[e])=>t.id()===e.value],"filter-type-==":[bd,[wd],(t,[e])=>t.geometryType()===e.value],"filter-<":[bd,[wd,Cd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[bd,[wd,Cd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[bd,[Cd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[bd,[wd,Cd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[bd,[Cd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[bd,[wd,Cd],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[bd,[Cd],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[bd,[Cd],(t,[e])=>e.value in t.properties()],"filter-has-id":[bd,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[bd,[Md(wd)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[bd,[Md(Cd)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[bd,[wd,Md(Cd)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[bd,[wd,Md(Cd)],(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:bd,overloads:[[[bd,bd],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[jg(bd),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:bd,overloads:[[[bd,bd],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[jg(bd),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[bd,[bd],(t,[e])=>!e.evaluate(t)],"is-supported-script":[bd,[wd],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[wd,[wd],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[wd,[wd],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[wd,jg(Cd),(t,e)=>e.map((e=>Ud(e.evaluate(t)))).join("")],"resolved-locale":[wd,[Td],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Ng=Dg;function Xg(t){return{result:"success",value:t}}function Ug(t){return{result:"error",value:t}}function qg(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class Wg{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ep,this._defaultValue=e?function(t){return"color"===t.type&&(qg(t.default)||Array.isArray(t.default))?new sd(0,0,0,0):"color"===t.type?sd.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 Bd(`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 Bg(t,e){const i=new kp(Ng,[],e?function(t){const e={color:Ed,string:wd,number:vd,enum:wd,boolean:bd,formatted:Rd,resolvedImage:Id};if("array"===t.type)return Md(e[t.value]||Cd,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?Xg(new Wg(n,e)):Ug(i.errors)}class Vg{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Tp(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 Yg{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Tp(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?ag.interpolationFactor(this.interpolationType,t,e,i):0}}function Kg(t,e){if("error"===(t=Bg(t,e)).result)return t;const i=t.value.expression,n=Cp(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return Ug([new md("","data expressions not supported")]);const r=Rp(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Ug([new md("","zoom expressions not supported")]);const s=Zg(i);if(!s&&!r)return Ug([new md("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof md)return Ug([s]);if(s instanceof ag&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Ug([new md("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Xg(new Vg(n?"constant":"source",t.value));const o=s instanceof ag?s.interpolation:void 0;return Xg(new Yg(n?"camera":"composite",t.value,s.labels,o))}function Zg(t){let e=null;if(t instanceof cg)e=Zg(t.result);else if(t instanceof hg){for(const i of t.args)if(e=Zg(i),e)break}else(t instanceof Dp||t instanceof ag)&&t.input instanceof np&&"zoom"===t.input.name&&(e=t);return e instanceof md||t.eachChild((t=>{const i=Zg(t);i instanceof md?e=i:!e&&i?e=new md("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new md("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function $g(t){if(Array.isArray(t))return t.map($g);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=$g(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var Hg={$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 Jg(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(!Jg(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function Qg(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Jg(t)||(t=af(t));const i=t;let n=!0;try{n=function(t){if(!nf(t))return t;let e=$g(t);return ef(e),e=tf(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=Hg[`filter_${e}`],s=Bg(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=Bg(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=!Cp(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:of(n),needFeature:!!l}}function tf(t){if(!Array.isArray(t))return t;const e=function(t){if(rf.has(t[0]))for(let e=1;etf(t)))}function ef(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function sf(t,e){return te?1:0}function of(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?lf(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(af))):"all"===e?["all"].concat(t.slice(1).map(af)):"none"===e?["all"].concat(t.slice(1).map(af).map(cf)):"in"===e?hf(t[1],t.slice(2)):"!in"===e?cf(hf(t[1],t.slice(2))):"has"===e?uf(t[1]):"!has"===e?cf(uf(t[1])):"within"!==e||t}function lf(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 hf(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(sf)]]:["filter-in-small",t,["literal",e]]}}function uf(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function cf(t){return["!",t]}var df=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function pf(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return df.forEach((t=>{t in e&&(i[t]=e[t])})),i}function gf(t){t=t.slice();const e=Object.create(null);for(let i=0;i1?c[c.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||g+"-"+d==p){o=r?o:ff[p],c.pop(),g&&p.startsWith(g)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var f=c.join(mf).replace("Klokantech Noto Sans","Noto Sans");-1!==f.indexOf(mf)&&(f='"'+f+'"'),l.push(f)}n=yf[t]=[a,o,l]}return n[0]+mf+n[1]+mf+e+"px"+(i?"/"+i:"")+mf+n[2]}));const vf="https://api.mapbox.com";function wf(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function bf(t,e){const i=wf(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`${vf}/styles/v1/${r}?&access_token=${e}`}const Ef=["a","b","c","d"];function Sf(t,e,i,n){const r=new URL(t,n),s=wf(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),[decodeURI(r.href)]):[decodeURI(r.href)];if("mapbox.satellite"===s){const t=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${t}.webp?access_token=${e}`]}return Ef.map((t=>`https://${t}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`))}const Cf={},Tf={};let Rf=0;function If(t){return t.id||(t.id=Rf++),t.id}function Mf(t){let e=Cf[t.id];return e||(e={},Cf[If(t)]=e),e}function Ff(t){return t*Math.PI/180}const kf=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Af(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 Pf(t,e){let i=0;const n=e.length;for(;ir)).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 Df[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete Df[e],Promise.reject(new Error("Error fetching source "+e))})))));return Df[e]=[r,s],s}function zf(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return Of("Style",t=bf(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const Gf={};function jf(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=Gf[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof Yh)t.setLoader(((e,i,r)=>{gt((()=>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(Kr.ERROR)))}))}));else{const e=t.getImage();gt((()=>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(Kr.ERROR))):e.src=i}))}});const o=t.url;if(o&&!t.tiles){const n=Sf(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:n}),tileLoadFunction:s});else{const t={};r=Of("Source",n[0],i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),Sf(n,i.accessToken,i.accessTokenParam||"access_token",t.request.url)[0]})),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}")),Sf(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)[0]}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s});Gf[n]=r}return r}function Nf(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Af(r[0],r[1]),o=s.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,r[0],r[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;t0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),s}function Xf(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Uf(t,e,i){const n=Af(e.width,e.height),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;t0?(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 qf=Array(256).join(" ");function Wf(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=qf.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Bf;function Vf(){return Bf||(Bf=Af(1,1).getContext("2d")),Bf}function Yf(t,e){return Vf().measureText(t).width+(t.length-1)*e}const Kf={};function Zf(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=Vf();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(Yf(i,n)<.35*r){const r=t>0?Yf(l[t-1],n):1/0,s=t.7*r&&Yf(s,n)<.6*r){const o=i.split(" "),a=o.pop();Yf(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=Wf(s,n),Kf[r]=s}return s}const $f=/font-family: ?([^;]*);/,Hf=/("|')/g;let Jf;function Qf(t){if(!Jf){Jf={};const t=document.styleSheets;for(let e=0,i=t.length;e`${t.key}: ${t.message}`)).join(", "));return i.value},rm={},sm={zoom:0};let om,am;function lm(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]||rm)[i];const r=Hg[`${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 Ng);if(!s&&qg(n)&&(n=ad(n,r),s=!0),s){const t=nm(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=sd.parse(n)),l[i]=function(){return n}}var h;return sm.zoom=n,l[i](sm,r,o)}function hm(t,e,i,n,r){if(!lm(t,"layout",`${n}-allow-overlap`,e,i,r))return"declutter";return lm(t,"layout",`${n}-ignore-placement`,e,i,r)?"none":"obstacle"}function um(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=Qg(e).filter),sm.zoom=n,r[t](sm,i)}function cm(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 dm=/\{[^{}}]*\}/g;function pm(t,e){return t.replace(dm,(function(t){return e[t.slice(1,-1)]||""}))}const gm={};function fm(t,e,i,n=kf,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(gm[function(t,e){return If(t)+"."+Lt(e)}(e,t)]=Array.from(arguments),s)if("undefined"!=typeof Image){const e=new Image;let i;gt((()=>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=gf(e.layers),d={},p=[],g={},f={},m=Mf(e),_=function(t){let e=Tf[t.id];return e||(e={},Tf[If(t)]=e),e}(e);let y;for(let t=0,n=c.length;t=R.maxzoom)continue;const k=R.filter;if(!k||um(I,k,S,b,_)){let n,c,_,y,I,k;const A=d.index;if(3==E&&("fill"==R.type||"fill-extrusion"==R.type))if(c=lm(R,"paint",R.type+"-opacity",b,S,m,C),R.type+"-pattern"in F){const t=lm(R,"paint",R.type+"-pattern",b,S,m,C);if(t){const e="string"==typeof t?pm(t,p):t.toString();if(l&&r&&r[e]){++T,k=w[T],k&&k.getFill()&&!k.getStroke()&&!k.getText()||(k=new qr({fill:new fe}),w[T]=k),_=k.getFill(),k.setZIndex(A);const t=e+"."+c;let i=f[t];if(!i){const n=r[e],s=Af(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"),f[t]=i}_.setColor(i)}}}else n=cm(lm(R,"paint",R.type+"-color",b,S,m,C),c),R.type+"-outline-color"in F&&(I=cm(lm(R,"paint",R.type+"-outline-color",b,S,m,C),c)),I||(I=n),(n||I)&&(++T,k=w[T],(!k||n&&!k.getFill()||!n&&k.getFill()||I&&!k.getStroke()||!I&&k.getStroke()||k.getText())&&(k=new qr({fill:n?new fe:void 0,stroke:I?new Ur:void 0}),w[T]=k),n&&(_=k.getFill(),_.setColor(n)),I&&(y=k.getStroke(),y.setColor(I),y.setWidth(.5)),k.setZIndex(A));if(1!=E&&"line"==R.type){n="line-pattern"in F?void 0:cm(lm(R,"paint","line-color",b,S,m,C),lm(R,"paint","line-opacity",b,S,m,C));const t=lm(R,"paint","line-width",b,S,m,C);n&&t>0&&(++T,k=w[T],k&&k.getStroke()&&!k.getFill()&&!k.getText()||(k=new qr({stroke:new Ur}),w[T]=k),y=k.getStroke(),y.setLineCap(lm(R,"layout","line-cap",b,S,m,C)),y.setLineJoin(lm(R,"layout","line-join",b,S,m,C)),y.setMiterLimit(lm(R,"layout","line-miter-limit",b,S,m,C)),y.setColor(n),y.setWidth(t),y.setLineDash(F["line-dasharray"]?lm(R,"paint","line-dasharray",b,S,m,C).map((function(e){return e*t})):null),k.setZIndex(A))}let P,L,D,O,z,G,j,N,X,U=!1,q=null,W=0;if((1==E||2==E)&&"icon-image"in M){const e=lm(R,"layout","icon-image",b,S,m,C);if(e){let n;P="string"==typeof e?pm(e,p):e.toString();const o=a?a(t,P):void 0;if(l&&r&&r[P]||o){const t=lm(R,"layout","icon-rotation-alignment",b,S,m,C);if(2==E){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();am||(om=[NaN,NaN],am=new Xr("Point",om,[],2,{},void 0)),n=am,om[0]=i[0],om[1]=i[1];if("line"===lm(R,"layout","symbol-placement",b,S,m,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l){W=Math.atan2(s-a,o-r);break}}}}}}if(2!==E||n){const e=lm(R,"layout","icon-size",b,S,m,C),i=void 0!==F["icon-color"]?lm(R,"paint","icon-color",b,S,m,C):null;if(!i||0!==i.a){const n=lm(R,"paint","icon-halo-color",b,S,m,C),s=lm(R,"paint","icon-halo-width",b,S,m,C);let a=`${P}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),L=g[a],!L){const c=hm(R,b,S,"icon",m);let d;"icon-offset"in M&&(d=lm(R,"layout","icon-offset",b,S,m,C).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]),L=new ye(i)}else{const o=r[P];let a,g,f;s?o.sdf?(a=Nf(Uf(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=Nf(l,o,s,n):(o.sdf?(u||(u=Uf(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]),L=new ye({color:p,img:a,imgSize:h,size:g,offset:f,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:d,declutterMode:c})}g[a]=L}}L&&(++T,k=w[T],k&&k.getImage()&&!k.getFill()&&!k.getStroke()||(k=new qr,w[T]=k),k.setGeometry(n),L.setRotation(W+Ff(lm(R,"layout","icon-rotate",b,S,m,C))),L.setOpacity(lm(R,"paint","icon-opacity",b,S,m,C)),L.setAnchor(im[lm(R,"layout","icon-anchor",b,S,m,C)]),k.setImage(L),q=k.getText(),k.setText(void 0),k.setZIndex(A),U=!0,D=!1)}else D=!0}}}if(1==E&&"circle"===R.type){++T,k=w[T],k&&k.getImage()&&!k.getFill()&&!k.getStroke()||(k=new qr,w[T]=k);const t="circle-radius"in F?lm(R,"paint","circle-radius",b,S,m,C):5,e=cm(lm(R,"paint","circle-stroke-color",b,S,m,C),lm(R,"paint","circle-stroke-opacity",b,S,m,C)),i=lm(R,"paint","circle-translate",b,S,m,C),n=cm(lm(R,"paint","circle-color",b,S,m,C),lm(R,"paint","circle-opacity",b,S,m,C)),r=lm(R,"paint","circle-stroke-width",b,S,m,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];L=g[s],L||(L=new ge({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new Ur({width:r,color:e}):void 0,fill:n?new fe({color:n}):void 0,declutterMode:"none"}),g[s]=L),k.setImage(L),q=k.getText(),k.setText(void 0),k.setGeometry(void 0),k.setZIndex(A),U=!0}if("text-field"in M){j=Math.round(lm(R,"layout","text-size",b,S,m,C));const t=lm(R,"layout","text-font",b,S,m,C);G=lm(R,"layout","text-line-height",b,S,m,C),z=xf(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,j,G),z.includes("sans-serif")||(z+=",sans-serif"),N=lm(R,"layout","text-letter-spacing",b,S,m,C),X=lm(R,"layout","text-max-width",b,S,m,C);const i=lm(R,"layout","text-field",b,S,m,C);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=xf(o?o(r):r,j*(i.scale||1),G);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==E)return e.push(Wf(a,N),s),e;a=Zf(a,s,X,N).split("\n");for(let t=0,i=a.length;t0&&e.push("\n",""),e.push(a[t],s);return e}),[]):pm(i,p).trim(),c=lm(R,"paint","text-opacity",b,S,m,C)}if(O&&c&&!D){U||(++T,k=w[T],k&&k.getText()&&!k.getFill()&&!k.getStroke()||(k=new qr,w[T]=k),k.setImage(void 0),k.setGeometry(void 0));const t=hm(R,b,S,"text",m);k.getText()||k.setText(q),q=k.getText(),(!q||"getDeclutterMode"in q&&q.getDeclutterMode()!==t)&&(q=new Yr({padding:[2,2,2,2],declutterMode:t}),k.setText(q));const e=lm(R,"layout","text-transform",b,S,m,C);"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==E?Wf(O,N):Zf(O,z,X,N);if(q.setText(i),q.setFont(z),q.setRotation(Ff(lm(R,"layout","text-rotate",b,S,m,C))),"function"==typeof q.setKeepUpright){const t=lm(R,"layout","text-keep-upright",b,S,m,C);q.setKeepUpright(t)}const n=lm(R,"layout","text-anchor",b,S,m,C),r=U||1==E?"point":lm(R,"layout","symbol-placement",b,S,m,C);let s;if("line-center"===r?(q.setPlacement("line"),s="center"):q.setPlacement(r),"line"===r&&"function"==typeof q.setRepeat){const t=lm(R,"layout","symbol-spacing",b,S,m,C);q.setRepeat(2*t)}q.setOverflow("point"===r);let o=lm(R,"paint","text-halo-width",b,S,m,C);const a=lm(R,"layout","text-offset",b,S,m,C),l=lm(R,"paint","text-translate",b,S,m,C);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=lm(R,"layout","text-rotation-alignment",b,S,m,C);q.setRotateWithView("map"==t)}else q.setMaxAngle(Ff(lm(R,"layout","text-max-angle",b,S,m,C))*O.length/i.length),q.setRotateWithView(!1);q.setTextAlign(s);let d="middle";0==n.indexOf("bottom")?(d="bottom",h=-o-.5*(G-1)*j):0==n.indexOf("top")&&(d="top",h=o+.5*(G-1)*j),q.setTextBaseline(d);const p=lm(R,"layout","text-justify",b,S,m,C);q.setJustify("auto"===p?void 0:p),q.setOffsetX(a[0]*j+u+l[0]),q.setOffsetY(a[1]*j+h+l[1]),v.setColor(cm(lm(R,"paint","text-color",b,S,m,C),c)),q.setFill(v);const g=cm(lm(R,"paint","text-halo-color",b,S,m,C),c);if(g&&o>0){x.setColor(g),o*=2;const t=.5*j;x.setWidth(o<=t?o:t),q.setStroke(x)}else q.setStroke(void 0);const f=lm(R,"layout","text-padding",b,S,m,C),_=q.getPadding();f!==_[0]&&(_[0]=f,_[1]=f,_[2]=f,_[3]=f),k.setZIndex(A)}}}return T>-1?(w.length=T+1,w):void 0};return t.setStyle(b),t.set("mapbox-source",y),t.set("mapbox-layers",p),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),b}function mm(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),_=e.highlightColor,y=e.shadowColor,x=e.accentColor,v=e.encoding;let w,b,E,S,C,T,R,I,M,F,k,A,P,L,D,O,z,G,j,N,X,U;function q(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(C=0===b?0:b-1,T=b===h?h:b+1,w=0;w<=l;++w)E=0===w?0:w-1,S=w===l?l:w+1,R=4*(b*n+E),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*q(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*q(u,v),F=(M-I)/a,R=4*(C*n+w),u[0]=s[R],u[1]=s[R+1],u[2]=s[R+2],u[3]=s[R+3],I=e.vert*q(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*q(u,v),k=(M-I)/a,P=Math.atan2(k,-F),P=P<0?d-P:P>d?c-P+d:d-P,A=Math.atan(Math.sqrt(F*F+k*k)),U=m*Math.cos(A)+f*Math.sin(A)*Math.cos(g-P),L=Math.cos(A),D=255*U,j=Math.min(Math.max(2*e.sunEl,0),1),N=1.875-1.75*e.opacity,X=.5!==e.opacity?d*((Math.pow(N,A)-1)/(Math.pow(N,d)-1)):A,z={r:(1-L)*x.r*j*255,g:(1-L)*x.g*j*255,b:(1-L)*x.b*j*255,a:(1-L)*x.a*j*255},O=Math.abs(((P+g)/Math.PI+.5)%2-1),G={r:(_.r*(1-O)+y.r*O)*D,g:(_.g*(1-O)+y.g*O)*D,b:(_.b*(1-O)+y.b*O)*D,a:(_.a*(1-O)+y.a*O)*D},R=4*(b*n+w),o[R]=z.r*(1-O)+G.r,o[R+1]=z.g*(1-O)+G.g,o[R+2]=z.b*(1-O)+G.b,o[R+3]=s[R+3]*e.opacity*j*Math.sin(X);return new ImageData(o,n,r)}function _m(t,e=512){return t.getExtent()?mc({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():kf}function ym(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 xm(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:bf(s,a.accessToken),a=ym(s,a)),new Promise((function(i,n){zf(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof Tl||t instanceof Yc))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof Yc?"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 Yc)return Sm(e.sources[o],s,a).then((function(e){const i=t.getSource();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()===Zc&&i.setTileLoadFunction(e.getTileLoadFunction()),Gn(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e);const n=t.getSource().getTileGrid();!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())&&n.getMinZoom()>0&&t.setMaxResolution(Lf(Math.max(0,n.getMinZoom()-1e-12),n.getResolutions()))}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=Rm(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=Pn(a.projection).getUnits();"m"!==t&&(r=kf.map((e=>e/Mi[t])))}f=fm(t,e,l,r,p,g,((t,e=a.webfonts)=>function(t,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){const i=t.toString();if(i in tm)return tm[i];const n=[];for(let e=0,i=t.length;e=1.5?.5:1;const i=.5==d?"@2x":"";let r=t.origin+t.pathname+i+".json"+t.search;new Promise((function(e,i){Of("Sprite",r,a).then(e).catch((function(n){r=t.origin+t.pathname+".json"+t.search,Of("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 vm={};function wm(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function bm(t,e,i){const n=new qc({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=Pn(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=zn([i[0],i[1]],e),n=zn([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return Pn(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new gc({origin:l?Ze(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:_m(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 Em(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 bl({source:new zs({}),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=Pf(e,i.resolutions||kf);let l;const h=lm(r,"paint","background-color",a,vm,n);return void 0!==o["background-opacity"]&&(l=lm(r,"paint","background-opacity",a,vm,n)),"none"==s.visibility?void 0:cm(h,l)}(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function Sm(t,e,i){return new Promise((function(n,r){jf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=bm(t,e,i);s.tileLoadFunction=r,s.format=new bu,n(new Kc(s))})).catch(r)}))}function Cm(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Tm(t,e,i){const n=new sc;return function(t,e,i){return new Promise((function(n,r){jf(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new qc({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=bm(t,e,i).tileGrid,i.projection&&(s.projection=Pn(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=Cm(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 Rm(t,e,i){const n=i.projection?new eu({dataProjection:i.projection}):new eu,r=t.data,s={};if("string"==typeof r){const[s]=Sf(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=Cm(i);return s.replace(n,`${t.join(",")}`)},r=new Ys({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{Of("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:ys});return r.set("mapbox-source",t),r}const o=new Ys({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{Of("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 Ys(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function Im(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=lm(t,"paint","raster-opacity",i,vm,n);e.setOpacity(r)}(t,e,n,i))}}function Mm(t,e,i,n){const r=Mf(t),s=t.layers,o=i.type,a=i.source||wm(s,i.ref),l=t.sources[a];let h;if("background"==o)h=Em(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new Yc({declutter:!0,visible:!1});return Sm(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=Tm(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",Im(i,h,r));else if("geojson"==l.type)h=function(t,e,i){return new Tl({declutter:!0,source:Rm(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=Tm(t,e,i);return new ou({source:new Rc({operationType:"image",operation:mm,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=Ln(n.projection||"EPSG:3857",t.resolution,qe(t.extent),"m");const s=Pf(t.resolution,n.resolutions||kf);e.encoding=l.encoding,e.vert=5*lm(i,"paint","hillshade-exaggeration",s,vm,r),e.sunAz=lm(i,"paint","hillshade-illumination-direction",s,vm,r),e.sunEl=35,e.opacity=.3,e.highlightColor=lm(i,"paint","hillshade-highlight-color",s,vm,r),e.shadowColor=lm(i,"paint","hillshade-shadow-color",s,vm,r),e.accentColor=lm(i,"paint","hillshade-accent-color",s,vm,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function Fm(t,e,i,n,r,s={}){let o=24,a=0;const l=i.layers;for(let t=0,i=l.length;t0||i>0)&&t.setMaxResolution(Math.min(Lf(Math.max(0,o-1e-12),kf),Lf(Math.max(0,i-1e-12),e.getResolutions()))),a<24&&t.setMinResolution(Lf(a,kf))}}else o>0&&t.setMaxResolution(Lf(Math.max(0,o-1e-12),kf));u instanceof Ys||u instanceof Kc?xm(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=gf(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 km=["fullscreenchange","webkitfullscreenchange"],Am="enterfullscreen",Pm="leavefullscreen";function Lm(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function Dm(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function Om(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}const zm=[{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}],Gm=document.getElementById("map"),jm=new Uh({target:Gm,view:new al(zm[Math.random()*zm.length|0])});jm.addControl(new class extends Zl{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($,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${Gt} ${Nt}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(Lm(e))if(Dm(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():Om(t)}(i):Om(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=Dm(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(V(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Am)):(V(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Pm)),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(Wl,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(Wl,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e