var e={ADD:`add`,REMOVE:`remove`},t={PROPERTYCHANGE:`propertychange`},n={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},r=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function i(e,t,n){let r,i;n||=a;let o=0,s=e.length,c=!1;for(;o>1),i=+n(e[r],t),i<0?o=r+1:(s=r,c=!i);return c?o:~o}function a(e,t){return e>t?1:et?-1:0}function s(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i0?i-1:i}return r-1}if(n>0){for(let n=1;n0||n&&a===0)})}function f(){return!0}function p(){return!1}function m(){}function h(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!u(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function g(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}function _(e){for(let t in e)delete e[t]}function v(e){let t;for(t in e)return!1;return!t}var y=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},b=class extends r{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new y(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=m,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}};function x(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function S(e,t,n,r){return x(e,t,n,r,!0)}function C(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),_(e))}var w=class extends b{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(n.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i0;)this.pop()}extend(e){for(let t=0,n=e.length;tthis.getLength())throw Error(`Index out of bounds: `+t);this.unique_&&this.assertUnique_(n),this.array_.splice(t,0,n),this.updateLength_(),this.dispatchEvent(new ee(e.ADD,n,t))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n=this.getLength())return;let n=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new ee(e.REMOVE,n,t)),n}setAt(t,n){if(t>=this.getLength()){this.insertAt(t,n);return}if(t<0)throw Error(`Index out of bounds: `+t);this.unique_&&this.assertUnique_(n,t);let r=this.array_[t];this.array_[t]=n,this.dispatchEvent(new ee(e.REMOVE,r,t)),this.dispatchEvent(new ee(e.ADD,n,t))}updateLength_(){this.set(M.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;ri&&(c|=F.RIGHT),sa&&(c|=F.ABOVE),c===F.UNKNOWN&&(c=F.INTERSECTING),c}function pe(){return[1/0,1/0,-1/0,-1/0]}function me(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function he(e){return me(1/0,1/0,-1/0,-1/0,e)}function ge(e,t){let n=e[0],r=e[1];return me(n,r,n,r,t)}function _e(e,t,n,r,i){return xe(he(i),e,t,n,r)}function ve(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function ye(e,t){return t[0]e[2]&&(e[2]=t[2]),t[1]e[3]&&(e[3]=t[3]),e}function be(e,t){t[0]e[2]&&(e[2]=t[0]),t[1]e[3]&&(e[3]=t[1])}function xe(e,t,n,r,i){for(;nt[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Fe(e){return e[2]=o&&h<=c),!r&&a&F.RIGHT&&!(i&F.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&F.BELOW&&!(i&F.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&F.LEFT&&!(i&F.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Re(e,t,n,r){if(Fe(e))return he(n);let i=[];if(r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a=n[2])){let t=L(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Be(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];ze(e,t);let i=L(r);if(L(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function R(e,t,n){return Math.min(Math.max(e,t),n)}function Ve(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return He(e,t,n,r)}function He(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Ue(e){let t=e.length;for(let n=0;ni&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function We(e){return e*180/Math.PI}function Ge(e){return e*Math.PI/180}function Ke(e,t){let n=e%t;return n*t<0?n+t:n}function qe(e,t,n){return e+n*(t-e)}function Je(e,t){let n=10**t;return Math.round(e*n)/n}function Ye(e,t){return Math.floor(Je(e,t))}function Xe(e,t){return Math.ceil(Je(e,t))}function Ze(e,t,n){if(e>=t&&e$e.warn||console.warn(...e)}function nt(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function rt(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function it(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function at(e,t){return e[0]*=t,e[1]*=t,e}function ot(e,t){if(t.canWrapX()){let n=L(t.getExtent()),r=st(e,t,n);r&&(e[0]-=r*n)}return e}function st(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]r[2])&&(n||=L(r),i=Math.floor((e[0]-r[0])/n)),i}const ct={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var lt=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global===void 0?!1:e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ct[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}};const ut=6378137,dt=Math.PI*ut,ft=[-dt,-dt,dt,dt],pt=[-180,-85,180,85],mt=ut*Math.log(Math.tan(Math.PI/2));var ht=class extends lt{constructor(e){super({code:e,units:`m`,extent:ft,global:!0,worldExtent:pt,getPointResolution:function(e,t){return e/Math.cosh(t[1]/ut)}})}};const gt=[new ht(`EPSG:3857`),new ht(`EPSG:102100`),new ht(`EPSG:102113`),new ht(`EPSG:900913`),new ht(`http://www.opengis.net/def/crs/EPSG/0/3857`),new ht(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function _t(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nmt?r=mt:r<-mt&&(r=-mt),t[n+1]=r}return t}function vt(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nZt&&(t=Zt);let r=Ge(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=Ge(e),u=Ge(tn(n.number)),d=Jt/Math.sqrt(1-At*i**2),f=Nt*a**2,p=a*Ze(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=Jt*(Bt*r-Vt*Math.sin(2*r)+Ht*Math.sin(4*r)-Ut*Math.sin(6*r)),b=kt*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*Nt))+5e5,x=kt*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*Nt)));return n.north||(x+=1e7),[b,x]}function tn(e){return(e-1)*6-180+3}var nn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function rn(e){let t=0;for(let n of nn){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function an(e,t){return function(n,r,i,a){let o=n.length;i=i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i=s?t[o+e]:a[e]}return n})}function bn(e,t){return dn(),Tn(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function xn(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||Sn(e,t)===fn)&&n}function Sn(e,t){let n=e.getCode(),r=t.getCode(),i=Ot(n,r);if(i)return i;let a=null,o=null;for(let n of cn)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(o)if(a)i=Cn(a.inverse,o.forward);else{let e=Ot(n,s);e&&(i=Cn(e,o.forward))}else{let e=Ot(s,r);e&&(i=Cn(a.inverse,e))}return i&&(pn(e),pn(t),Dt(e,t,i)),i}function Cn(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function wn(e,t){return Sn(z(e),z(t))}function Tn(e,t,n){let r=wn(t,n);if(!r){let e=z(t).getCode(),r=z(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function En(e,t,n,r){return Re(e,wn(t,n),void 0,r)}var Dn=null;function On(){return Dn}function kn(e,t){return Dn?Tn(e,t,Dn):e}function An(e,t){return Dn?Tn(e,Dn,t):(un&&!rt(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(un=!1,tt(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e)}function jn(e,t){return Dn?En(e,t,Dn):e}function Mn(e,t){return Dn?En(e,Dn,t):e}function Nn(e,t){if(!Dn)return e;let n=z(t).getMetersPerUnit(),r=Dn.getMetersPerUnit();return n&&r?e*n/r:e}function Pn(){gn(gt),gn(St),_n(St,gt,_t,vt)}Pn();function Fn(){return[1,0,0,1,0,0]}function In(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function B(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function Ln(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function Rn(e,t){let n=zn(t);P(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function zn(e){return e[0]*e[3]-e[1]*e[2]}var Bn=[1e5,1e5,1e5,1e5,2,2];function Vn(e){return`matrix(`+e.join(`, `)+`)`}function Hn(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function Un(e,t){let n=Hn(e),r=Hn(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Bn[e])!==0)return!1;return!0}function Wn(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return D()}closestPointXY(e,t,n,r){return D()}containsXY(e,t){return this.closestPointXY(e,t,Yn,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return D()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&he(e),this.extentRevision_=this.getRevision()}return Ie(this.extent_,e)}rotate(e,t){D()}scale(e,t,n){D()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return D()}getType(){return D()}applyTransform(e){D()}intersectsExtent(e){return D()}translate(e,t){D()}transform(e,t){let n=z(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=I(o)/I(a);Ln(Jn,o[0],o[3],s,-s,0,0,0);let c=Wn(e,0,e.length,i,Jn,r),l=wn(n,t);return l?l(c,c,i):c}:wn(n,t);return this.applyTransform(r),this}},Zn=class extends Xn{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return _e(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return D()}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length1)d=n;else if(f>0){for(let i=0;ii&&(i=s),a=n,o=r}return i}function sr(e,t,n,r,i){for(let a=0,o=n.length;a0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;to&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r0&&m>f)&&(p<0&&h0&&h>p)){l=n,u=d;continue}a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d}return a[o++]=l,a[o++]=u,o}function Cr(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;ca&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function kr(e,t,n,r,i,a){if(n.length===0||!Or(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;tv&&(u=(d+f)/2,kr(e,t,n,r,u,h)&&(_=u,v=i)),d=f}return isNaN(_)&&(_=i[o]),s?(s.push(_,h,v),s):[_,h,v]}function Mr(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]?!0:Nr(e,t,n,r,function(e,t){return Le(i,e,t)}):!1}function Fr(e,t,n,r,i){for(let a=0,o=n.length;a0}function Vr(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a1?s:2,o||=Array(s);for(let t=0;t>1;i0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function yi(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}const bi=[NaN,NaN,NaN,0];var xi;function Si(){return xi||=H(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),xi}var Ci=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,wi=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ti=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ei=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Di(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function Oi(e){throw Error(`failed to parse "`+e+`" as color`)}function ki(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(wi)||e.match(Ci)||e.match(Ti);if(t){let e=t[4],n=100/255;return[R(Di(t[1],n)+.5|0,0,255),R(Di(t[2],n)+.5|0,0,255),R(Di(t[3],n)+.5|0,0,255),e===void 0?1:R(Di(e,100),0,1)]}Oi(e)}if(e.startsWith(`#`)){if(Ei.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Ii(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function Li(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Ri(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function zi(e){let t=Li(e[0]),n=Li(e[1]),r=Li(e[2]),i=Ri(t*.222488403+n*.716873169+r*.06060791),a=500*(Ri(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Ri(t*.016863605+n*.117638439+r*.865350722)),s=Math.atan2(o,a)*(180/Math.PI);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Bi(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Ii(t),a=Ii(t+n/500*Math.cos(r)),o=Ii(t-n/200*Math.sin(r)),s=Fi(a*3.021973625-i*1.617392459-o*.404875592),c=Fi(a*-.943766287+i*1.916279586+o*.027607165),l=Fi(a*.069407491-i*.22898585+o*1.159737864);return[R(s+.5|0,0,255),R(c+.5|0,0,255),R(l+.5|0,0,255),e[3]]}function Vi(e){if(e===`none`)return bi;if(Mi.hasOwnProperty(e))return Mi[e];if(Ni>=ji){let e=0;for(let t in Mi)e++&3||(delete Mi[t],--Ni)}let t=ki(e);t.length!==4&&Oi(e);for(let n of t)isNaN(n)&&Oi(e);return Mi[e]=t,++Ni,t}function Hi(e){return Array.isArray(e)?e:Vi(e)}function Ui(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function Wi(e,t,r){let i=e,a=!0,o=!1,s=!1,c=[S(i,n.LOAD,function(){s=!0,o||t()})];return i.src&&oi?(o=!0,i.decode().then(function(){a&&t()}).catch(function(e){a&&(s?t():r())})):c.push(S(i,n.ERROR,r)),function(){a=!1,c.forEach(C)}}function Gi(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Ki(e,t){return t&&(e.src=t),e.src&&oi?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Gi(e)}var qi=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 e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,n){let r=Ji(e,t,n);return r in this.cache_?this.cache_[r]:null}getPattern(e,t,n){let r=Ji(e,t,n);return r in this.patternCache_?this.patternCache_[r]:null}set(e,t,n,r,i){let a=Ji(e,t,n),o=a in this.cache_;this.cache_[a]=r,i&&(r.getImageState()===V.IDLE&&r.load(),r.getImageState()===V.LOADING?r.ready().then(()=>{this.patternCache_[a]=pi().createPattern(r.getImage(1),`repeat`)}):this.patternCache_[a]=pi().createPattern(r.getImage(1),`repeat`)),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function Ji(e,t,n){let r=n?Hi(n):`null`;return t+`:`+e+`:`+r}const Yi=new qi;var Xi=null,Zi=class extends b{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=i,this.imageState_=r===void 0?V.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===V.LOADED){Xi||=H(1,1,void 0,{willReadFrequently:!0}),Xi.drawImage(this.image_,0,0);try{Xi.getImageData(0,0,1,1),this.tainted_=!1}catch{Xi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(n.CHANGE)}handleImageError_(){this.imageState_=V.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=V.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=H(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===V.IDLE){this.image_||this.initializeImage_(),this.imageState_=V.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Ki(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==V.LOADED)return;let t=this.image_,n=H(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=Ai(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===V.LOADED||this.imageState_===V.ERROR)e();else{let t=()=>{(this.imageState_===V.LOADED||this.imageState_===V.ERROR)&&(this.removeEventListener(n.CHANGE,t),e())};this.addEventListener(n.CHANGE,t)}}),this.ready_}};function Qi(e,t,n,r,i,a){let o=t===void 0?void 0:Yi.get(t,n,i);return o||(o=new Zi(e,e&&`src`in e?e.src||void 0:t,n,r,i),Yi.set(t,n,i,o,a)),a&&o&&!Yi.getPattern(t,n,i)&&Yi.set(t,n,i,o,a),o}var $i=Zi;function ea(e){return e?Array.isArray(e)?Ui(e):typeof e==`object`&&`src`in e?ta(e):e:null}function ta(e){if(!e.offset||!e.size)return Yi.getPattern(e.src,`anonymous`,e.color);let t=e.src+`:`+e.offset,n=Yi.getPattern(t,void 0,e.color);if(n)return n;let r=Yi.get(e.src,`anonymous`,null);if(r.getImageState()!==V.LOADED)return null;let i=H(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),Qi(i.canvas,t,void 0,V.LOADED,e.color,!0),Yi.getPattern(t,void 0,e.color)}var na=class{drawCustom(e,t,n,r,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}};const ra=`ol-hidden`,ia=`ol-collapsed`;var aa=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-z0-9]+?)\\s*$`].join(``),`i`),oa=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`];const sa={normal:400,bold:700},ca=function(e){let t=e.match(aa);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=oa.length;ee.trim().replace(/^['"]|['"]$/g,``)),n},la=`#000`,ua=`round`,da=[],fa=`round`,pa=`#000`,ma=`center`,ha=[0,0,0,0],ga=new j;var _a=null,va;const ya={};var ba=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function xa(e,t,n){return`${e} ${t} 16px "${n}"`}const Sa=(function(){let e,t;async function n(e){await t.ready;let n=await t.load(e);if(n.length===0)return!1;let r=ca(e),i=r.families[0].toLowerCase(),a=r.weight;return n.some(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),n=sa[e.weight]||e.weight;return t===i&&e.style===r.style&&n==a})}async function r(){await t.ready;let i=!0,a=ga.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(_(ya),ga.set(t,100)):(r+=10,ga.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=ai?self.fonts:document.fonts;let i=ca(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(ba.has(e))continue;let t=xa(i.style,i.weight,e);ga.get(t)===void 0&&(ga.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),Ca=(function(){let e;return function(t){let n=ya[t];if(n==null){if(ai){let e=ca(t),r=wa(t,`Žg`);n=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);ya[t]=n}return n}})();function wa(e,t){return _a||=H(1,1),e!=va&&(_a.font=e,va=_a.font),_a.measureText(t)}function Ta(e,t){return wa(e,t).width}function Ea(e,t,n){if(t in n)return n[t];let r=t.split(` `).reduce((t,n)=>Math.max(t,Ta(e,n)),0);return n[t]=r,r}function Da(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===` `||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=Ta(f,d);n.push(p),o+=p;let m=Ca(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function Oa(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=e=>e.globalAlpha*=n:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),ka(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function ka(e,t){let n=e.contextInstructions;for(let e=0,r=n.length;ee*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?fa:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:ea(e||pa)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();t?this.textFillState_={fillStyle:ea(t.getColor()||la)}:this.textFillState_=null;let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?ua:t,lineDash:r||da,lineDashOffset:i||0,lineJoin:a===void 0?fa:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:ea(e||pa)}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?`10px sans-serif`:r,textAlign:u===void 0?ma:u,textBaseline:d===void 0?`middle`:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o===void 0?!1:o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},ja=.5,Ma={Point:Wa,LineString:Va,Polygon:Ka,MultiPoint:Ga,MultiLineString:Ha,MultiPolygon:Ua,GeometryCollection:Ba,Circle:Ia};function Na(e,t){return parseInt(k(e),10)-parseInt(k(t),10)}function Pa(e,t){let n=Fa(e,t);return n*n}function Fa(e,t){return ja*e/t}function Ia(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Circle`);s.setFillStrokeStyle(a,o),s.drawCircle(t,r,i)}let s=n.getText();if(s&&s.getText()){let i=e.getBuilder(n.getZIndex(),`Text`);i.setTextStyle(s),i.drawText(t,r)}}function La(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==V.LOADED||t==V.ERROR?e=!1:t==V.IDLE&&l.load(),e&&c.push(l.ready())}let u=n.getFill();u&&u.loading()&&c.push(u.ready());let d=c.length>0;return d&&Promise.all(c).then(()=>i(null)),Ra(e,t,n,r,a,o,s),d}function Ra(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())za(e,c,n,t,o);else{let r=Ma[c.getType()];r(e,c,n,t,o,a)}}function za(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function Ya(e,t){return function(n,r,i,a,o){Ja(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function Xa(e,t){return[[-1/0,-1/0,1/0,1/0]]}function Za(e,t,n,r){let i=[],a=pe();for(let o=0,s=n.length;oe.clone())}var eo=Qa,to=class e extends tr{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let t=e,n=[],r=[];for(let e=0,i=t.length;e{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=yr(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=br(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=Cr(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i);break;default:}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};ao.prototype.getFlatCoordinates=ao.prototype.getOrientedFlatCoordinates;var oo=ao;function so(e,t,n=0,r=e.length-1,i=lo){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);so(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(co(e,n,t),i(e[r],a)>0&&co(e,n,r);o0;)s--}i(e[n],a)===0?co(e,n,s):(s++,co(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function co(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function lo(e,t){return et?1:0}var uo=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!Co(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=wo(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,po(n,this.toBBox),po(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=wo([e,t]),this.data.height=e.height+1,this.data.leaf=!1,po(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=mo(e,0,o,this.toBBox),s=mo(e,o,n,this.toBBox),c=xo(t,s),l=vo(t)+vo(s);c=t;r--){let t=e.children[r];ho(o,e.leaf?i(t):t),s+=yo(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)ho(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():po(e[t],this.toBBox)}};function fo(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r=e.minX&&t.maxY>=e.minY}function wo(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function To(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;so(e,o,t,n,i),a.push(t,o,o,n)}}var Eo=class{constructor(e){this.rbush_=new uo(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[k(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;re):null}var ko=Do,Ao={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},jo=class extends y{constructor(e,t,n){super(e),this.feature=t,this.features=n}},Mo=class extends ko{constructor(e){e||={},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:`ready`,wrapX:e.wrapX===void 0?!0:e.wrapX}),this.on,this.once,this.un,this.loader_=m,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader===void 0?this.url_!==void 0&&(P(this.format_,"`format` must be set when `url` is set"),this.loader_=Ya(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?Xa:e.strategy;let t=e.useSpatialIndex===void 0?!0:e.useSpatialIndex;this.featuresRtree_=t?new Eo:null,this.loadedExtentsRtree_=new Eo,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new N(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=k(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let t=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new jo(Ao.ADDFEATURE,e))}setupChangeEvents_(e,r){r instanceof oo||(this.featureChangeKeys_[e]=[x(r,n.CHANGE,this.handleFeatureChange_,this),x(r,t.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let e=String(t.getId());if(!(e in this.idIndex_))this.idIndex_[e]=t;else if(t instanceof oo){let r=this.idIndex_[e];r instanceof oo?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(P(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let t=0,r=e.length;t{n||=(n=!0,this.addFeature(e.element),!1)}),t.addEventListener(e.REMOVE,e=>{n||=(n=!0,this.removeFeature(e.element),!1)}),this.featuresCollection_=t}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(C);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_)for(let e in this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)}),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e]);this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new jo(Ao.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof oo||r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof oo||r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),v(this.nullGeometryFeatures_)||l(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=Be(e,t);return[].concat(...n.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];return t||=f,this.featuresRtree_.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry(),c=o;if(o=t instanceof oo?0:t.closestPointXY(n,r,a,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new jo(Ao.FEATURESLOADEND,void 0,e))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new jo(Ao.FEATURESLOADERROR))}),r.insert(a,{extent:a.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(t){if(ve(t.extent,e))return t});n&&t.remove(n)}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n{this.patternImage_=null}),t.getImageState()===V.IDLE&&t.load(),t.getImageState()===V.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?k(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Hi(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Po=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){let t=this.getColor();return new e({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(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}};function Fo(e){return e[0]>0&&e[1]>0}function Io(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Lo(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Ro=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Lo(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({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 D()}getImage(e){return D()}getHitDetectionImage(){return D()}getPixelRatio(e){return 1}getImageState(){return D()}getImageSize(){return D()}getOrigin(){return D()}getSize(){return D()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Lo(e)}listenImageChange(e){D()}load(){D()}unlistenImageChange(e){D()}ready(){return Promise.resolve()}},zo=class e extends Ro{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView===void 0?!1:e.rotateWithView,rotation:e.rotation===void 0?0:e.rotation,scale:e.scale===void 0?1:e.scale,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill===void 0?null:e.fill,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle===void 0?0:e.angle,this.stroke_=e.stroke===void 0?null:e.stroke,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?V.LOADING:V.LOADED,this.imageState_===V.LOADING&&this.ready().then(()=>this.imageState_=V.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({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 n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=Yi.get(n,null,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=H(i,i);this.draw_(t,a,e),r=a.canvas,Yi.set(n,null,null,new $i(r,void 0,null,V.LOADED,null))}return r}getPixelRatio(e){return e}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(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(rs&&(this.instructions.push([U.CUSTOM,s,l,e,n,gr,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,gr,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([U.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,void 0,i]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[U.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[U.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[U.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[U.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&!u(e.currentLineDash,i)||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[U.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=se(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;oe(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ns=class extends ts{constructor(e,t,n,r){super(e,t,n,r),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(e,t,n){if(!this.image_||this.maxExtent&&!le(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i);this.instructions.push([U.DRAW_IMAGE,a,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([U.DRAW_IMAGE,a,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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;t=e){let t=(e-s+d)/d,f=qe(n,l,t),p=qe(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s0&&a.push(c),a}function os(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;de&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p,c>s?[l,d]:[a,o]}const ss={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};var cs={Circle:is,Default:ts,Image:ns,LineString:rs,Polygon:is,Text:class extends ts{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[la]={fillStyle:la},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){if(!Pe(this.maxExtent,e.getExtent()))return;let r;if(l=e.getFlatCoordinates(),c==`LineString`)r=[l.length];else if(c==`MultiLineString`)r=e.getEnds();else if(c==`Polygon`)r=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();r=[];for(let e=0,n=t.length;e{let r=o[(e+n)*2]===l[n*u]&&o[(e+n)*2+1]===l[n*u+1];return r||--e,r})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n);let p=a.padding;if(p!=ha&&(a.scale[0]<0||a.scale[1]<0)){let e=a.padding[0],t=a.padding[1],n=a.padding[2],r=a.padding[3];a.scale[0]<0&&(t=-t,r=-r),a.scale[1]<0&&(e=-e,n=-n),p=[e,t,n,r]}let m=this.pixelRatio;this.instructions.push([U.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==ha?ha:p.map(function(e){return e*m}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let h=1/m,g=d?d.slice(0):null;g&&(g[1]=la),this.hitDetectionInstructions.push([U.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[h,h],NaN,this.declutterMode_,this.declutterImageWithText_,p,g,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?la:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=ss[r.textBaseline],l=this.textOffsetY_*s,u=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([U.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,l,i,d*s,u,a,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([U.DRAW_CHARS,e,t,c,r.overflow,o&&la,r.maxAngle,s,l,i,d*s,u,a,1/s,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=ea(t.getColor()||`#000`)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():da,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=ea(a.getColor()||`#000`)}n=this.textState_;let o=e.getFont()||`10px sans-serif`;Sa(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||ha,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u===void 0?!1:u,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:k(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+k(r.fillStyle):``}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}},ls=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=cs[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function us(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(te[2]}else O=x>E;let k=Math.PI,A=[],j=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let M;if(j)return y(),M=Math.atan2(m-g,p-h),O&&(M+=M>0?-k:k),A[0]=[(E+x)/2,(D+S)/2,(T-a)/2,M,i],A;i=i.replace(/\n/g,` `);for(let e=0,d=i.length;e0?-k:k),M!==void 0){let e=f-M;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}M=f;let x=e,S=0;for(;e(this.push_(e),this)),this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(pi(),{get:(e,t)=>{if(typeof pi()[t]==`function`)return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n0&&e.push(` `,``),e.push(t,``),e}function xs(e,t,n){return n%2==0&&(e+=t),e}var Ss=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Fn(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new ds:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?ss[s.justify]:ys(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(` `).reduce(bs,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=Da(s,f),v=p+d,y=[],b=(v+2)*l[0],x=(m+d)*l[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:x<0?Math.floor(x):Math.ceil(x),contextInstructions:y};(l[0]!=1||l[1]!=1)&&y.push(`scale`,l),r&&(y.push(`strokeStyle`,a.strokeStyle),y.push(`lineWidth`,d),y.push(`lineCap`,a.lineCap),y.push(`lineJoin`,a.lineJoin),y.push(`miterLimit`,a.miterLimit),y.push(`setLineDash`,[a.lineDash]),y.push(`lineDashOffset`,a.lineDashOffset)),n&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],E=[],D=0,O=0,k=0,A=0,j;for(let e=0,t=f.length;ee?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(ps[0]=S,gs[0]=S,ps[1]=C,ms[1]=C,ms[0]=S+b,hs[0]=ms[0],hs[1]=C+x,gs[1]=hs[1]);let w;return u===0?me(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),fs):(w=Ln(Fn(),n,r,1,1,u,-n,-r),B(w,ps),B(w,ms),B(w,hs),B(w,gs),me(Math.min(ps[0],ms[0],hs[0],gs[0]),Math.min(ps[1],ms[1],hs[1],gs[1]),Math.max(ps[0],ms[0],hs[0],gs[0]),Math.max(ps[1],ms[1],hs[1],gs[1]),fs)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:fs[0],minY:fs[1],maxX:fs[2],maxY:fs[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0;return c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0&&(s&&this.replayTextBackground_(e,ps,ms,hs,gs,a,o),Oa(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=B(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let i=this.textStates[t],a=this.createLabel(e,t,r,n),o=this.strokeStates[n],s=this.pixelRatio,c=ys(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=ss[i.textBaseline||`middle`],u=o&&o.lineWidth?o.lineWidth:0;return{label:a,anchorX:c*(a.width/s-2*i.scale[0])+2*(.5-c)*u,anchorY:l*a.height/s+2*(.5-l)*u}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&u(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=Wn(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),In(this.renderedTransform_,n));let d=0,f=r.length,p=0,m,h,g,_,v,y,b,x,S,C,w,T,E,D=0,O=0,k=this.coordinateCache_,A=this.viewRotation_,j=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,M={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},ee=this.instructions!=r||this.overlaps?0:200,N,P,te,ne;for(;dee&&(this.fill_(e),D=0),O>ee&&(e.stroke(),O=0),!D&&!O&&(e.beginPath(),v=NaN,y=NaN),++d;break;case U.CIRCLE:p=n[1];let r=l[p],u=l[p+1],f=l[p+2],re=l[p+3],F=f-r,ie=re-u,ae=Math.sqrt(F*F+ie*ie);e.moveTo(r+ae,u),e.arc(r,u,ae,0,2*Math.PI,!0),++d;break;case U.CLOSE_PATH:e.closePath(),++d;break;case U.CUSTOM:p=n[1],m=n[2];let oe=n[3],se=n[4],ce=n[5];M.geometry=oe,M.feature=N,d in k||(k[d]=[]);let le=k[d];ce?ce(l,p,m,2,le):(le[0]=l[p],le[1]=l[p+1],le.length=2),c&&(c.zIndex=n[6]),se(le,M),++d;break;case U.DRAW_IMAGE:p=n[1],m=n[2],S=n[3],h=n[4],g=n[5];let ue=n[6],de=n[7],fe=n[8],pe=n[9],me=n[10],he=n[11],ge=n[12],_e=n[13];_=n[14]||`declutter`;let ve=n[15];if(!S&&n.length>=20){C=n[19],w=n[20],T=n[21],E=n[22];let e=this.drawLabelWithPointPlacement_(C,w,T,E);S=e.label,n[3]=S;let t=n[23];h=(e.anchorX-t)*this.pixelRatio,n[4]=h;let r=n[24];g=(e.anchorY-r)*this.pixelRatio,n[5]=g,ue=S.height,n[6]=ue,_e=S.width,n[13]=_e}let ye;n.length>25&&(ye=n[25]);let be,xe,Se;n.length>17?(be=n[16],xe=n[17],Se=n[18]):(be=ha,xe=null,Se=null),me&&j?he+=A:!me&&!j&&(he-=A);let Ce=0;for(;p!ws.includes(e));var Es=class{constructor(e,t,n,r,i,a,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Fn(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,o)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let i=e[n];for(let e in i){let n=i[e];r[e]=new Ss(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t0){if(!o||n===`none`||p!==`Image`&&p!==`Text`||o.includes(e)){let n=(f[c]-3)/4,a=r-n%s,o=r-(n/s|0),l=i(e,t,a*a+o*o);if(l)return l}u.clearRect(0,0,s,s);break}}let h=Object.keys(this.executorsByZIndex_).map(Number);h.sort(a);let g,_,v,y,b;for(g=h.length-1;g>=0;--g){let e=h[g].toString();for(v=this.executorsByZIndex_[e],_=Cs.length-1;_>=0;--_)if(p=Cs[_],y=v[p],y!==void 0&&(b=y.executeHitDetection(u,c,n,m,d),b))return b}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return Wn(o,0,8,2,e,o),o}isEmpty(){return v(this.executorsByZIndex_)}execute(e,t,n,r,i,s,c){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(c?o:a),s||=Cs;let u=Cs.length;for(let a=0,o=l.length;ap.execute(e,t,n,r,i,c)),d&&s.restore(),o){o.offset();let e=l[a]*u+Cs.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(o)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(a);for(let n=0,r=t.length;n{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},Ds={};function Os(e){if(Ds[e]!==void 0)return Ds[e];let t=e*2+1,n=e*e,r=Array(n+1);for(let i=0;i<=e;++i)for(let a=0;a<=e;++a){let o=i*i+a*a;if(o>n)break;let s=r[o];s||(s=[],r[o]=s),s.push(((e+i)*t+(e+a))*4+3),i>0&&s.push(((e-i)*t+(e+a))*4+3),a>0&&(s.push(((e+i)*t+(e-a))*4+3),i>0&&s.push(((e-i)*t+(e-a))*4+3))}let i=[];for(let e=0,t=r.length;e0,"A defined and non-empty `src` or `image` must be provided"),P(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?V.LOADED:V.IDLE:V.LOADING:V.LOADED):s=V.IDLE,this.color_=e.color===void 0?null:Hi(e.color),this.iconImage_=Qi(a,o,this.crossOrigin_,s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();this.setScale(As(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(As(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({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:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Qi(null,e,this.crossOrigin_,V.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==V.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==V.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(n.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(n.CHANGE,e)}ready(){return this.iconImage_.ready()}};const Ms=.5;function Ns(e,t,n,r,i,o,s,c,l){let u=l?jn(i,l):i,d=H(e[0]*Ms,e[1]*Ms);d.imageSmoothingEnabled=!1;let f=d.canvas,p=new Aa(d,Ms,i,null,s,c,l?Sn(On(),l):null),m=n.length,h=Math.floor((256*256*256-1)/m),g={};for(let e=1;e<=m;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let a=i(t,o);if(!a)continue;Array.isArray(a)||(a=[a]);let s=(e*h).toString(16).padStart(7,`#00000`);for(let e=0,n=a.length;ethis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return D()}getData(e){return null}prepareFrame(e){return D()}renderFrame(e,t){return D()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===V.LOADED||t.getState()===V.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=V.LOADED&&t!=V.ERROR&&e.addEventListener(n.CHANGE,this.boundHandleImageChange_),t==V.IDLE&&(e.load(),t=e.getState()),t==V.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Rs=[];var zs=null;function Bs(){zs=H(1,1,void 0,{willReadFrequently:!0})}var Vs=class extends Ls{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Fn(),this.pixelTransform=Fn(),this.inversePixelTransform=Fn(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){zs||Bs(),zs.clearRect(0,0,1,1);let r;try{zs.drawImage(e,t,n,1,1,0,0,1,1),r=zs.getImageData(0,0,1,1).data}catch{return zs=null,null}return r}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n){let r=this.getLayer().getClassName(),i,a;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&u(Hi(e.style.backgroundColor),Hi(n)))){let t=e.firstElementChild;yi(t)&&(a=t.getContext(`2d`))}if(a&&Un(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){i=ai?vi():document.createElement(`div`),i.className=r;let e=i.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,a=H();let t=a.canvas;i.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=i,this.context=a}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Me(n),i=Ne(n),a=Ee(n),o=Te(n);B(t.coordinateToPixelTransform,r),B(t.coordinateToPixelTransform,i),B(t.coordinateToPixelTransform,a),B(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;B(s,r),B(s,i),B(s,a),B(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=e.viewState.rotation,a=e.pixelRatio,o=Math.round(L(n)/r*a),s=Math.round(I(n)/r*a);Ln(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,i,-o/2,-s/2),Rn(this.inversePixelTransform,this.pixelTransform);let c=Vn(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){let e=this.context.canvas;e.width!=o||e.height!=s?(e.width=o,e.height=s):this.context.clearRect(0,0,o,s),c!==e.style.transform&&(e.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new Fs(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ei.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ei.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new ds),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ei.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ei.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return Ln(this.tempTransform,s,c,l,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Hs=class extends Vs{constructor(e){super(e),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_=pe(),this.wrappedRenderedExtent_=pe(),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(e,t,n){let r=t.extent,i=t.viewState,a=i.center,o=i.resolution,s=i.projection,c=i.rotation,l=s.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,p=t.viewHints,m=!(p[Yo.ANIMATING]||p[Yo.INTERACTING]),h=this.context,g=Math.round(L(r)/o*f),_=Math.round(I(r)/o*f),v=u.getWrapX()&&s.canWrapX(),y=v?L(l):null,b=v?Math.ceil((r[2]-l[2])/y)+1:1,x=v?Math.floor((r[0]-l[0])/y):0;do{let r=this.getRenderTransform(a,o,0,f,g,_,x*y);t.declutter&&(r=r.slice(0)),e.execute(h,[h.canvas.width,h.canvas.height],r,c,m,n===void 0?Cs:n?ws:Ts,n?d&&t.declutter[d]:void 0)}while(++x{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,a=this.wrappedRenderedExtent_,o=this.getLayer(),s=[],c=e[0]*Ms,l=e[1]*Ms;s.push(this.getRenderTransform(t,n,r,Ms,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!ue(d,a)){let e=a[0],i=L(d),o=0,u;for(;ed[2];)++o,u=i*o,s.push(this.getRenderTransform(t,n,r,Ms,c,l,u).slice()),e-=i}let f=On();this.hitDetectionImageData_=Ns(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,Pa(n,this.renderedPixelRatio_),f?i:null)}t(Ps(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;let a=t.viewState.resolution,o=t.viewState.rotation,s=this.getLayer(),c={},l=function(e,t,n){let a=k(e),o=c[a];if(o){if(o!==!0&&ne.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Yo.ANIMATING],i=e.viewHints[Yo.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let s=e.extent,c=e.viewState,l=c.projection,d=c.resolution,f=e.pixelRatio,p=t.getRevision(),m=t.getRenderBuffer(),h=t.getRenderOrder();h===void 0&&(h=Na);let g=c.center.slice(),_=oe(s,m*d),v=_.slice(),y=[_.slice()],b=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!ue(b,e.extent)){let e=L(b),t=Math.max(L(_)/2,e);_[0]=b[0]-t,_[2]=b[2]+t,ot(g,l);let n=ze(y[0],l);n[0]b[0]&&n[2]>b[2]&&y.push([n[0]-e,n[1],n[2]-e,n[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==p&&this.renderedRenderOrder_==h&&this.renderedFrameDeclutter_===!!e.declutter&&ue(this.wrappedRenderedExtent_,_))return u(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new ls(Fa(d,f),_,d,f),S=On(),C;if(S){for(let e=0,t=y.length;e{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,d)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},D=jn(_,l),O=n.getFeaturesInExtent(D);h&&O.sort(h);for(let e=0,t=O.length;e`,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`};var ic={[q.Get]:X(J(1,1/0),ac),[q.Var]:X(J(1,1),oc),[q.Has]:X(J(1,1/0),ac),[q.Id]:X(sc,uc),[q.Concat]:X(J(2,1/0),Y(Gs)),[q.GeometryType]:X(cc,uc),[q.LineMetric]:X(uc),[q.Resolution]:X(lc,uc),[q.Zoom]:X(lc,uc),[q.Time]:X(lc,uc),[q.Any]:X(J(2,1/0),Y(Ws)),[q.All]:X(J(2,1/0),Y(Ws)),[q.Not]:X(J(1,1),Y(Ws)),[q.Equal]:X(J(2,2),Y(Ys)),[q.NotEqual]:X(J(2,2),Y(Ys)),[q.GreaterThan]:X(J(2,2),Y(W)),[q.GreaterThanOrEqualTo]:X(J(2,2),Y(W)),[q.LessThan]:X(J(2,2),Y(W)),[q.LessThanOrEqualTo]:X(J(2,2),Y(W)),[q.Multiply]:X(J(2,1/0),dc),[q.Coalesce]:X(J(2,1/0),dc),[q.Divide]:X(J(2,2),Y(W)),[q.Add]:X(J(2,1/0),Y(W)),[q.Subtract]:X(J(2,2),Y(W)),[q.Clamp]:X(J(3,3),Y(W)),[q.Mod]:X(J(2,2),Y(W)),[q.Pow]:X(J(2,2),Y(W)),[q.Abs]:X(J(1,1),Y(W)),[q.Floor]:X(J(1,1),Y(W)),[q.Ceil]:X(J(1,1),Y(W)),[q.Round]:X(J(1,1),Y(W)),[q.Sin]:X(J(1,1),Y(W)),[q.Cos]:X(J(1,1),Y(W)),[q.Atan]:X(J(1,2),Y(W)),[q.Sqrt]:X(J(1,1),Y(W)),[q.Match]:X(J(4,1/0),pc,mc),[q.Between]:X(J(3,3),Y(W)),[q.Interpolate]:X(J(6,1/0),pc,hc),[q.Case]:X(J(3,1/0),fc,gc),[q.In]:X(J(2,2),_c),[q.Number]:X(J(1,1/0),Y(Ys)),[q.String]:X(J(1,1/0),Y(Ys)),[q.Array]:X(J(1,1/0),Y(W)),[q.Color]:X(J(1,4),Y(W)),[q.Band]:X(J(1,3),Y(W)),[q.Palette]:X(J(2,2),vc),[q.ToString]:X(J(1,1),Y(Ws|W|Gs|Ks))};function ac(e,t,n){let r=e.length-1,i=Array(r);for(let t=0;tt){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function dc(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;ae.featureId;case q.GeometryType:return e=>e.geometryType;case q.Concat:{let n=e.args.map(e=>Cc(e,t));return e=>``.concat(...n.map(t=>t(e).toString()))}case q.Resolution:return e=>e.resolution;case q.Any:case q.All:case q.Between:case q.In:case q.Not:return Dc(e,t);case q.Equal:case q.NotEqual:case q.LessThan:case q.LessThanOrEqualTo:case q.GreaterThan:case q.GreaterThanOrEqualTo:return Ec(e,t);case q.Multiply:case q.Divide:case q.Add:case q.Subtract:case q.Clamp:case q.Mod:case q.Pow:case q.Abs:case q.Floor:case q.Ceil:case q.Round:case q.Sin:case q.Cos:case q.Atan:case q.Sqrt:return Oc(e,t);case q.Case:return kc(e,t);case q.Match:return Ac(e,t);case q.Interpolate:return jc(e,t);case q.ToString:return Mc(e,t);default:throw Error(`Unsupported operator ${n}`)}}function wc(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;ee.variables[n];case q.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;er(e)===i(e);case q.NotEqual:return e=>r(e)!==i(e);case q.LessThan:return e=>r(e)r(e)<=i(e);case q.GreaterThan:return e=>r(e)>i(e);case q.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Dc(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case q.In:return e=>{let t=i[0](e);for(let n=1;n!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function Oc(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let t=1;for(let n=0;ni[0](e)/i[1](e);case q.Add:return e=>{let t=0;for(let n=0;ni[0](e)-i[1](e);case q.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(tr?r:t};case q.Mod:return e=>i[0](e)%i[1](e);case q.Pow:return e=>i[0](e)**+i[1](e);case q.Abs:return e=>Math.abs(i[0](e));case q.Floor:return e=>Math.floor(i[0](e));case q.Ceil:return e=>Math.ceil(i[0](e));case q.Round:return e=>Math.round(i[0](e));case q.Sin:return e=>Math.sin(i[0](e));case q.Cos:return e=>Math.cos(i[0](e));case q.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case q.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function kc(e,t){let n=e.args.length,r=Array(n);for(let i=0;i{for(let t=0;t{let t=r[0](e);for(let i=1;i{let t=r[0](e),i=r[1](e),a,o;for(let s=2;s=i)return s===2?c:l?Pc(t,i,a,o,n,c):Nc(t,i,a,o,n,c);a=n,o=c}return o}}function Mc(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let n=i[0](t);return e.args[0].type===Ks?Ui(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function Nc(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Pc(e,t,n,r,i,a){if(i-n===0)return r;let o=zi(r),s=zi(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Bi([Nc(e,t,n,o[0],i,s[0]),Nc(e,t,n,o[1],i,s[1]),o[2]+Nc(e,t,n,0,i,c),Nc(e,t,n,r[3],i,a[3])])}function Fc(e){return!0}function Ic(e){let t=rc(),n=Rc(e,t),r=xc();return function(e,i){if(r.properties=e.getPropertiesInternal(),r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}return t.geometryType&&(r.geometryType=bc(e.getGeometry())),n(r)}}function Lc(e){let t=rc(),n=e.length,r=Array(n);for(let i=0;inull;r=Zc(e,t+`fill-color`,n)}if(!r)return null;let i=new No;return function(e){let t=r(e);return t===bi?null:(i.setColor(t),i)}}function Vc(e,t,n){let r=qc(e,t+`stroke-width`,n),i=Zc(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=Jc(e,t+`stroke-line-cap`,n),o=Jc(e,t+`stroke-line-join`,n),s=Qc(e,t+`stroke-line-dash`,n),c=qc(e,t+`stroke-line-dash-offset`,n),l=qc(e,t+`stroke-miter-limit`,n),u=new Po;return function(e){if(i){let t=i(e);if(t===bi)return null;u.setColor(t)}if(r&&u.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);u.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);u.setLineJoin(t)}return s&&u.setLineDash(s(e)),c&&u.setLineDashOffset(c(e)),l&&u.setMiterLimit(l(e)),u}}function Hc(e,t){let n=`text-`,r=Jc(e,n+`value`,t);if(!r)return null;let i=Bc(e,n,t),a=Bc(e,n+`background-`,t),o=Vc(e,n,t),s=Vc(e,n+`background-`,t),c=Jc(e,n+`font`,t),l=qc(e,n+`max-angle`,t),u=qc(e,n+`offset-x`,t),d=qc(e,n+`offset-y`,t),f=Xc(e,n+`overflow`,t),p=Jc(e,n+`placement`,t),m=qc(e,n+`repeat`,t),h=tl(e,n+`scale`,t),g=Xc(e,n+`rotate-with-view`,t),_=qc(e,n+`rotation`,t),v=Jc(e,n+`align`,t),y=Jc(e,n+`justify`,t),b=Jc(e,n+`baseline`,t),x=Xc(e,n+`keep-upright`,t),S=Qc(e,n+`padding`,t),C=new Jo({declutterMode:cl(e,n+`declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function Uc(e,t){return`icon-src`in e?Wc(e,t):`shape-points`in e?Gc(e,t):`circle-radius`in e?Kc(e,t):null}function Wc(e,t){let n=`icon-`,r=n+`src`,i=dl(e[r],r),a=$c(e,n+`anchor`,t),o=tl(e,n+`scale`,t),s=qc(e,n+`opacity`,t),c=$c(e,n+`displacement`,t),l=qc(e,n+`rotation`,t),u=Xc(e,n+`rotate-with-view`,t),d=al(e,n+`anchor-origin`),f=ol(e,n+`anchor-x-units`),p=ol(e,n+`anchor-y-units`),m=ll(e,n+`color`),h=il(e,n+`cross-origin`),g=sl(e,n+`offset`),_=al(e,n+`offset-origin`),v=nl(e,n+`width`),y=new js({src:i,anchorOrigin:d,anchorXUnits:f,anchorYUnits:p,color:m,crossOrigin:h,offset:g,offsetOrigin:_,height:nl(e,n+`height`),width:v,size:rl(e,n+`size`),declutterMode:cl(e,n+`declutter-mode`)});return function(e){return s&&y.setOpacity(s(e)),c&&y.setDisplacement(c(e)),l&&y.setRotation(l(e)),u&&y.setRotateWithView(u(e)),o&&y.setScale(o(e)),a&&y.setAnchor(a(e)),y}}function Gc(e,t){let n=`shape-`,r=n+`points`,i=n+`radius`,a=fl(e[r],r),o=fl(e[i],i),s=Bc(e,n,t),c=Vc(e,n,t),l=tl(e,n+`scale`,t),u=$c(e,n+`displacement`,t),d=qc(e,n+`rotation`,t),f=Xc(e,n+`rotate-with-view`,t),p=new zo({points:a,radius:o,radius2:nl(e,n+`radius2`),angle:nl(e,n+`angle`),declutterMode:cl(e,n+`declutter-mode`)});return function(e){return s&&p.setFill(s(e)),c&&p.setStroke(c(e)),u&&p.setDisplacement(u(e)),d&&p.setRotation(d(e)),f&&p.setRotateWithView(f(e)),l&&p.setScale(l(e)),p}}function Kc(e,t){let n=`circle-`,r=Bc(e,n,t),i=Vc(e,n,t),a=qc(e,n+`radius`,t),o=tl(e,n+`scale`,t),s=$c(e,n+`displacement`,t),c=qc(e,n+`rotation`,t),l=Xc(e,n+`rotate-with-view`,t),u=new Bo({radius:5,declutterMode:cl(e,n+`declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function qc(e,t,n){if(!(t in e))return;let r=Sc(e[t],W,n);return function(e){return fl(r(e),t)}}function Jc(e,t,n){if(!(t in e))return null;let r=Sc(e[t],Gs,n);return function(e){return dl(r(e),t)}}function Yc(e,t,n){let r=Jc(e,t+`pattern-src`,n),i=el(e,t+`pattern-offset`,n),a=el(e,t+`pattern-size`,n),o=Zc(e,t+`color`,n);return function(e){return{src:r(e),offset:i&&i(e),size:a&&a(e),color:o&&o(e)}}}function Xc(e,t,n){if(!(t in e))return null;let r=Sc(e[t],Ws,n);return function(e){let n=r(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function Zc(e,t,n){if(!(t in e))return null;let r=Sc(e[t],Ks,n);return function(e){return pl(r(e),t)}}function Qc(e,t,n){if(!(t in e))return null;let r=Sc(e[t],qs,n);return function(e){return ul(r(e),t)}}function $c(e,t,n){if(!(t in e))return null;let r=Sc(e[t],qs,n);return function(e){let n=ul(r(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function el(e,t,n){if(!(t in e))return null;let r=Sc(e[t],qs,n);return function(e){return ml(r(e),t)}}function tl(e,t,n){if(!(t in e))return null;let r=Sc(e[t],qs|W,n);return function(e){return hl(r(e),t)}}function nl(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function rl(e,t){let n=e[t];if(n!==void 0){if(typeof n==`number`)return Lo(n);if(!Array.isArray(n)||n.length!==2||typeof n[0]!=`number`||typeof n[1]!=`number`)throw Error(`Expected a number or size array for ${t}`);return n}}function il(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function al(e,t){let n=e[t];if(n!==void 0){if(n!==`bottom-left`&&n!==`bottom-right`&&n!==`top-left`&&n!==`top-right`)throw Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return n}}function ol(e,t){let n=e[t];if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function sl(e,t){let n=e[t];if(n!==void 0)return ul(n,t)}function cl(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);if(n!==`declutter`&&n!==`obstacle`&&n!==`none`)throw Error(`Expected declutter, obstacle, or none for ${t}`);return n}}function ll(e,t){let n=e[t];if(n!==void 0)return pl(n,t)}function ul(e,t){if(!Array.isArray(e))throw Error(`Expected an array for ${t}`);let n=e.length;for(let r=0;r4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function ml(e,t){let n=ul(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function hl(e,t){return typeof e==`number`?e:ml(e,t)}var gl={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function _l(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*i,l=t?0:a[1]*i,u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=R(r[0],f,p),_=R(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function vl(e){return e}function yl(e){return e**3}function bl(e){return 1-yl(1-e)}function xl(e){return 3*e*e-2*e*e*e}function Sl(e){return e}function Cl(e,t,n,r){let i=L(t)/n[0],a=I(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function wl(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),R(r,n/2,t*2)}function Tl(e,t,n,r){return t=t===void 0?!0:t,(function(i,a,o,c){if(i!==void 0){let l=e[0],u=e[e.length-1],d=n?Cl(l,n,o,r):l;if(c)return t?wl(i,d,u):R(i,u,d);let f=Math.min(d,i),p=Math.floor(s(e,f,a));return e[p]>d&&p1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r0}getInteracting(){return this.hints_[Yo.INTERACTING]>0}cancelAnimations(){this.setHint(Yo.ANIMATING,-this.hints_[Yo.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter,this.targetCenter_=[e+c*(n-e),t+c*(r-t)]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?Ke(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(Yo.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&Pl(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],it(n,e-this.getRotation()),nt(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&kn(e,this.getProjection())}getCenterInternal(){return this.get(gl.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return jn(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();P(t,`The view center is not defined`);let n=this.getResolution();P(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return P(r!==void 0,`The view rotation is not defined`),ke(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(gl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Mn(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=L(e)/t[0],r=I(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(gl.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=zl(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=s(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=R(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+R(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(P(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))P(!Fe(e),"Cannot fit empty extent provided as `geometry`"),n=Jr(Mn(e,this.getProjection()));else if(e.getType()===`Circle`){let t=Mn(e.getExtent(),this.getProjection());n=Jr(t),n.rotate(this.getRotation(),De(t))}else{let t=On();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof Bl?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return Ul(r,t.viewState)&&(!i||Pe(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof Bl?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Z.MAP,e)}getMapInternal(){return this.get(Z.MAP)}setMap(e){this.mapPrecomposeKey_&&=(C(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(C(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=x(e,ei.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=x(this,n.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);P(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Z.SOURCE,e)}getRenderer(){return 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 Ul(e,t){if(!e.visible)return!1;let n=t.resolution;if(n=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}var Wl=Hl,Gl={RENDER_ORDER:`renderOrder`},Kl=class extends Wl{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating===void 0?!1:e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting===void 0?!1:e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Gl.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new uo(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Gl.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?Wo:e;let t=ql(e);this.styleFunction_=e===null?void 0:Ho(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function ql(e){if(e===void 0)return Wo;if(!e)return null;if(typeof e==`function`||e instanceof Ko)return e;if(!Array.isArray(e))return Lc([e]);if(e.length===0)return[];let t=e.length,n=e[0];if(n instanceof Ko){let n=Array(t);for(let r=0;re)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){D()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:yl(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Zl=class extends Xl{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r,this.src_=n,this.key=n,this.image_,ai?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,r!==null&&(this.image_.crossOrigin=r)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=Q.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=Q.ERROR,this.unlistenImage_(),this.image_=Ql(),this.changed()}handleImageLoad_(){if(ai)this.state=Q.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=Q.LOADED:this.state=Q.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==Q.ERROR&&(this.state=Q.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Q.IDLE&&(this.state=Q.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Wi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Ql(){let e=H(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var $l=Zl,eu=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},tu=class extends y{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},nu=class extends tu{constructor(e,t,n,r,i,a){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r===void 0?!1:r,this.activePointers=a}get pixel(){return this.pixel_||=this.map.getEventPixel(this.originalEvent),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||=this.map.getCoordinateFromPixel(this.pixel),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),`preventDefault`in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),`stopPropagation`in this.originalEvent&&this.originalEvent.stopPropagation()}},$={SINGLECLICK:`singleclick`,CLICK:n.CLICK,DBLCLICK:n.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},ru={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},iu=class extends b{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let r=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=r,this.pointerdownListenerKey_=x(r,ru.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=x(r,ru.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(n.TOUCHMOVE,this.boundHandleTouchMove_,si?{passive:!1}:!1)}emulateClick_(e){let t=new nu($.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new nu($.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new nu($.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==$.POINTERUP||t.type==$.POINTERCANCEL){for(let e in delete this.trackedTouches_[n],this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else (t.type==$.POINTERDOWN||t.type==$.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new nu($.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(C),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new nu($.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,`target`,{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(x(e,$.POINTERMOVE,this.handlePointerMove_,this),x(e,$.POINTERUP,this.handlePointerUp_,this),x(this.element_,$.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(x(this.element_.getRootNode(),$.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new nu($.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new nu($.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&=(C(this.relayedListenerKey_),null),this.element_.removeEventListener(n.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(C(this.pointerdownListenerKey_),null),this.dragListenerKeys_.forEach(C),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},au={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},ou={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},su=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){P(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t==1/0?!1:(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=ae;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;oe.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(n.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,r=t.getState();if(r===Q.LOADED||r===Q.ERROR||r===Q.EMPTY){r!==Q.ERROR&&t.removeEventListener(n.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===Q.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function lu(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return 1/0;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var uu=class extends j{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;et.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>g(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!u(t,this.renderedAttributions_)){gi(this.ulElement_);for(let e=0,n=t.length;e0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:bl}):e.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`;if(this.autoHide_){let e=this.element.classList.contains(ra);!e&&n===0?this.element.classList.add(ra):e&&n!==0&&this.element.classList.remove(ra)}this.label_.style.transform=e}this.rotation_=n}},pu=class extends uu{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,r=e.delta===void 0?1:e.delta,i=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,a=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,o=e.zoomInLabel===void 0?`+`:e.zoomInLabel,s=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,c=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,l=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(n.CLICK,this.handleClick_.bind(this,r),!1);let d=document.createElement(`button`);d.className=a,d.setAttribute(`type`,`button`),d.title=l,d.appendChild(typeof s==`string`?document.createTextNode(s):s),d.addEventListener(n.CLICK,this.handleClick_.bind(this,-r),!1);let f=t+` ol-unselectable ol-control`,p=this.element;p.className=f,p.appendChild(u),p.appendChild(d),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap().getView();if(!t)return;let n=t.getZoom();if(n!==void 0){let r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:bl})):t.setZoom(r)}}};function mu(e){e||={};let t=new N;return(e.zoom===void 0||e.zoom)&&t.push(new pu(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new fu(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new du(e.attributionOptions)),t}var hu={ACTIVE:`active`},gu=class extends j{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(hu.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(hu.ACTIVE,e)}setMap(e){this.map_=e}};function _u(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:Sl,center:e.getConstrainedCenter(i)})}}function vu(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(a);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:bl})}var yu=gu,bu=class extends yu{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==$.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;vu(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function xu(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r0);else if(e.type==$.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==$.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Pu(e){let t=e.length,n=0,r=0;for(let i=0;i0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Lu=class extends Fu{constructor(e){e||={},super({stopDown:p}),this.condition_=e.condition?e.condition:Su,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!ju(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Ol)return;let r=t.getSize(),i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return ju(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return ju(e)&&Eu(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Ru=class extends r{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left=`inherit`,e.top=`inherit`,e.width=`inherit`,e.height=`inherit`}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new qr([n])}getGeometry(){return this.geometry_}},zu={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},Bu=class extends y{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Vu=class extends Fu{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new Ru(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??Eu,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Bu(zu.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Bu(t?zu.BOXEND:zu.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Bu(zu.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Bu(zu.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Bu(zu.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},Hu=class extends Vu{constructor(e){e||={};let t=e.condition?e.condition:ku;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out===void 0?!1:e.out}onBoxEnd(e){let t=this.getMap().getView(),n=this.getGeometry();if(this.out_){let e=t.rotatedExtentForGeometry(n),r=t.getResolutionForExtentInternal(e),i=t.getResolution()/r;n=n.clone(),n.scale(i*i)}t.fitInternal(n,{duration:this.duration_,easing:bl})}},Uu={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Wu=class extends yu{constructor(e){super(),e||={},this.defaultCondition_=function(e){return Du(e)&&Au(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==n.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Uu.DOWN||r==Uu.LEFT||r==Uu.RIGHT||r==Uu.UP)){let i=e.map.getView(),a=i.getResolution()*this.pixelDelta_,o=0,s=0;r==Uu.DOWN?s=-a:r==Uu.LEFT?o=-a:r==Uu.RIGHT?o=a:s=a;let c=[o,s];it(c,i.getRotation()),_u(i,c,this.duration_),n.preventDefault(),t=!0}}return!t}},Gu=class extends yu{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!Ou(e)&&Au(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==n.KEYDOWN||e.type==n.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;vu(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Ku=40,qu=300,Ju=class extends yu{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0?!0:e.useAnchor,this.constrainResolution_=e.constrainResolution===void 0?!1:e.constrainResolution;let t=e.condition?e.condition:Tu;this.condition_=e.onFocusOnly?xu(wu,t):t,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;let e=this.getMap();e&&e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==n.WHEEL)return!0;let t=e.map,r=e.originalEvent;r.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Ku;break;case WheelEvent.DOM_DELTA_PAGE:i*=qu;break;default:}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`&&!(o.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-R(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),vu(t,n,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},Yu=class extends Fu{constructor(e){e||={};let t=e;t.stopDown||=p,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==Ol&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Pu(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Xu=class extends Fu{constructor(e){e||={};let t=e;t.stopDown||=p,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Pu(this.targetPointers))),s.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Zu(e){e||={};let t=new N,n=new eu(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new Lu),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new bu({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new Iu({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new Yu),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Xu({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Wu),t.push(new Gu({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new Ju({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new Hu({duration:e.zoomDuration})),t}var Qu={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},$u=class extends y{constructor(e,t){super(e),this.layer=t}},ed={LAYERS:`layers`},td=class r extends Vl{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ed.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new N(n.slice(),{unique:!0}):P(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new N(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(C),this.layersListenerKeys_.length=0;let t=this.getLayers();for(let n in this.layersListenerKeys_.push(x(t,e.ADD,this.handleLayersAdd_,this),x(t,e.REMOVE,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[n].forEach(C);_(this.listenerKeys_);let n=t.getArray();for(let e=0,t=n.length;e=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&Ul(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,f,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){D()}scheduleExpireIconCache(e){Yi.canExpireCache()&&e.postRenderFunctions.push(rd)}};function rd(e,t){Yi.expire()}var id=nd,ad=class extends id{constructor(e){super(e),this.fontChangeListenerKey_=x(ga,t.PROPERTYCHANGE,e.redrawText,e),this.element_=ai?vi():document.createElement(`div`);let n=this.element_.style;n.position=`absolute`,n.width=`100%`,n.height=`100%`,n.zIndex=`0`,this.element_.className=`ol-unselectable ol-layers`;let r=e.getViewport();r&&r.insertBefore(this.element_,r.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new Fs(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){C(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(ei.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof Jl&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=[],i=null;for(let a=0,o=t.length;a0)&&(e.fillStyle=r,e.fillRect(0,0,a.width,a.height)),yi(n)&&n.width>0){let r=t.style.opacity||n.style.opacity;e.globalAlpha=r===``?1:Number(r);let i=n.style.transform;if(i)e.setTransform(...Hn(i));else{let t=parseFloat(n.style.width)/n.width,r=parseFloat(n.style.height)/n.height;e.setTransform(t,0,0,r,0,0)}e.drawImage(n,0,0)}}e.globalAlpha=1,e.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(ei.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer.renderDeferred(e))}}};function od(e){if(e instanceof Wl){e.setMapInternal(null);return}e instanceof td&&e.getLayers().forEach(od)}function sd(e,t){if(e instanceof Wl){e.setMapInternal(t);return}if(e instanceof td){let n=e.getLayers().getArray();for(let e=0,r=n.length;ethis.updateSize())),this.controls=n.controls||(ai?new N:mu()),this.interactions=n.interactions||(ai?new N:Zu({onFocusOnly:!0})),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new cu(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ou.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ou.VIEW,this.handleViewChanged_),this.addChangeListener(ou.SIZE,this.handleSizeChanged_),this.addChangeListener(ou.TARGET,this.handleTargetChanged_),this.setProperties(n.values);let r=this;t.view&&!(t.view instanceof Bl)&&t.view.then(function(e){r.setView(new Bl(e))}),this.controls.addEventListener(e.ADD,e=>{e.element.setMap(this)}),this.controls.addEventListener(e.REMOVE,e=>{e.element.setMap(null)}),this.interactions.addEventListener(e.ADD,e=>{e.element.setMap(this)}),this.interactions.addEventListener(e.REMOVE,e=>{e.element.setMap(null)}),this.overlays_.addEventListener(e.ADD,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener(e.REMOVE,e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)}),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){sd(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?f:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof td?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?f:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(ou.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return kn(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?B(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ou.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof N){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t=0;n--){let r=t[n];if(!(r.getMap()!==this||!r.getActive()||!this.getTargetElement())&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;if(e){let t=e.viewHints;if(t[Yo.ANIMATING]||t[Yo.INTERACTING]){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}}t.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new $u(`removelayer`,t)),this.set(ou.LAYERGROUP,e)}setSize(e){this.set(ou.SIZE,e)}setTarget(e){this.set(ou.TARGET,e)}setView(e){if(!e||e instanceof Bl){this.set(ou.VIEW,e);return}this.set(ou.VIEW,new Bl);let t=this;e.then(function(e){t.setView(new Bl(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if(yi(e))n=e.width,r=e.height;else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!Fo(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&tt(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!u(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function ld(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new td({layers:e.layers});n[ou.LAYERGROUP]=r,n[ou.TARGET]=e.target,n[ou.VIEW]=e.view instanceof Bl?e.view:new Bl;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new N(e.controls.slice()):(P(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new N(e.interactions.slice()):(P(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new N:Array.isArray(e.overlays)?o=new N(e.overlays.slice()):(P(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var ud=cd,dd=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function fd(e,t,n,r,i){return i===void 0?new dd(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var pd=dd,md=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=re,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?z(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()===`tile-pixels`&&(n=z(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return D()}readFeature(e,t){return D()}readFeatures(e,t){return D()}readGeometry(e,t){return D()}readProjection(e){return D()}writeFeature(e,t){return D()}writeFeatures(e,t){return D()}writeGeometry(e,t){return D()}};function hd(e,t,n){let r=n?z(n.featureProjection):null,i=n?z(n.dataProjection):null,a=e;if(r&&i&&!xn(r,i)){t&&(a=e.clone());let n=t?r:i,o=t?i:r;n.getUnits()===`tile-pixels`?a.transform(n,o):a.applyTransform(wn(n,o))}if(t&&n&&n.decimals!==void 0){let t=10**n.decimals;a===e&&(a=e.clone()),a.applyTransform(function(e){for(let n=0,r=e.length;nvd({...e,geometry:t})).flat();let r=n.type===`MultiPolygon`?`Polygon`:n.type;if(r===`GeometryCollection`||r===`Circle`)throw Error(`Unsupported geometry type: `+r);let i=n.layout.length;return hd(new oo(r,r===`Polygon`?_d(n.flatCoordinates,n.ends,i):n.flatCoordinates,n.ends?.flat(),i,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function yd(e,t){if(!e)return null;if(Array.isArray(e))return new eo(e.map(e=>yd(e,t)));let n=gd[e.type];return hd(new n(e.flatCoordinates,e.layout||`XY`,e.ends),!1,t)}var bd=class extends md{constructor(){super()}getType(){return`json`}readFeature(e,t){return this.readFeatureFromObject(xd(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(xd(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return D()}readFeaturesFromObject(e,t){return D()}readGeometry(e,t){return this.readGeometryFromObject(xd(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return D()}readProjection(e){return this.readProjectionFromObject(xd(e))}readProjectionFromObject(e){return D()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return D()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return D()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return D()}};function xd(e){return typeof e==`string`?JSON.parse(e)||null:e===null?null:e}var Sd=bd,Cd=class extends Sd{constructor(e){e||={},super(),this.dataProjection=z(e.dataProjection?e.dataProjection:`EPSG:4326`),e.featureProjection&&(this.defaultFeatureProjection=z(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=[`application/geo+json`,`application/vnd.geo+json`]}readFeatureFromObject(e,t){let n=null;n=e.type===`Feature`?e:{type:`Feature`,geometry:e,properties:null};let r=wd(n.geometry,t);if(this.featureClass===oo)return vd({geometry:r,id:n.id,properties:n.properties},t);let i=new re;return this.geometryName_?i.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&i.setGeometryName(n.geometry_name),i.setGeometry(yd(r,t)),`id`in n&&i.setId(n.id),n.properties&&i.setProperties(n.properties,!0),i}readFeaturesFromObject(e,t){let n=e,r=null;if(n.type===`FeatureCollection`){let n=e;r=[];let i=n.features;for(let e=0,n=i.length;e2||Math.abs(e[t*4+3]-.75*255)>2}function Xd(){if(Kd===void 0){let e=H(6,6,qd);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,Jd(e,4,5,4,0),Jd(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;Kd=Yd(t,0)||Yd(t,4)||Yd(t,8),mi(e),qd.push(e.canvas)}return Kd}function Zd(e,t,n,r){let i=Tn(n,t,e),a=hn(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||le(c,i)){let t=hn(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function Qd(e,t,n,r){let i=Zd(e,t,De(n),r);return(!isFinite(i)||i<=0)&&Ce(n,function(n){return i=Zd(e,t,n,r),isFinite(i)&&i>0}),i}function $d(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=H(Math.round(n*e),Math.round(n*t),qd);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=pe();c.forEach(function(e,t,n){ye(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){if(_=H(Math.round(L(g)*v),Math.round(I(g)*v),qd),d||(_.imageSmoothingEnabled=!1),i&&p){let e=(i[0]-g[0])*v,t=-(i[3]-g[3])*v,n=L(i)*v,r=I(i)*v;_.rect(e,t,n,r),_.clip()}c.forEach(function(e,t,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){_.save();let t=(e.clipExtent[0]-g[0])*v,n=-(e.clipExtent[3]-g[3])*v,r=L(e.clipExtent)*v,i=I(e.clipExtent)*v;_.rect(d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),_.clip()}let t=(e.extent[0]-g[0])*v,n=-(e.extent[3]-g[3])*v,r=L(e.extent)*v,i=I(e.extent)*v;_.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),e.clipExtent&&_.restore()}})}let b=Me(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),E=o,D=s;o=0,s=0,l-=E,u-=D,f-=E,p-=D;let O=Ue([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!O)return;if(m.save(),m.beginPath(),Xd()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(O[0],O[2],O[1],O[3],v,x),m.translate(g[0]-E,g[3]-D);let k;if(_)k=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;k=e.image,m.scale(L(t)/k.width,-I(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&(mi(_),qd.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var ef=10,tf=.25,nf=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?yn(e=>B(o,Tn(e,this.targetProj_,this.sourceProj_))):wn(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&L(r)>=L(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?L(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?L(this.targetProj_.getExtent()):null;let l=Me(n),u=Ne(n),d=Ee(n),f=Te(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=ef+(a?Math.max(0,Math.ceil(Math.log2(we(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t,n,r){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){let n=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];n[0][0]-e>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-e>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-e>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);let r=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-r.5&&u<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=L(ie([e,t,n,r]))/this.targetWorldWidth_>tf||p),!f&&this.sourceProj_.isGlobal()&&u&&(p=u>tf||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Pe(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+(!isFinite(s[0])||!isFinite(s[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;a=f?(Ke(i[0],d)+Ke(o[0],d))/2-Ke(r[0],d):(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=pe();return this.triangles_.forEach(function(t,n,r){let i=t.source;be(e,i[0]),be(e,i[1]),be(e,i[2])}),e}getTriangles(){return this.triangles_}},rf=class extends Xl{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,Q.IDLE,d),this.renderEdges_=u===void 0?!1:u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?je(f,p):f;if(we(h)===0){this.state=Q.EMPTY;return}let g=e.getExtent();g&&(m=m?je(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=Qd(e,n,h,_);if(!isFinite(v)||v<=0){this.state=Q.EMPTY;return}if(this.triangulation_=new nf(e,n,h,m,v*(l===void 0?.5:l),_),this.triangulation_.getTriangles().length===0){this.state=Q.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let y=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(y[1]=R(y[1],m[1],m[3]),y[3]=R(y[3],m[1],m[3])):y=je(y,m)),!we(y))this.state=Q.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=L(g),r=Math.floor((y[0]-g[0])/n)),Be(y.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=c(this.sourceZ_,e,t,o);if(i){let e=r*n;this.sourceTiles_.push({tile:i,offset:e})}}++r}),this.sourceTiles_.length===0&&(this.state=Q.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==Q.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset),e.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=Q.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=$d(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=Q.LOADED}this.changed()}load(){if(this.state==Q.IDLE){this.state=Q.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let r=t.getState();if(r==Q.IDLE||r==Q.LOADING){e++;let r=x(t,n.CHANGE,n=>{let i=t.getState();(i==Q.LOADED||i==Q.ERROR||i==Q.EMPTY)&&(C(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},t,n){e.getState()==Q.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(C),this.sourcesListenerKeys_=null}release(){this.canvas_&&=(mi(this.canvas_.getContext(`2d`)),qd.push(this.canvas_),null),super.release()}},af=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof r&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return P(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_?n.value_:(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n,n.value_)}remove(e){let t=this.entries_[e];return P(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){P(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function of(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function sf(e,t,n){return e+`/`+t+`/`+n}function cf(e,t,n,r,i){return`${k(e)},${t},${sf(n,r,i)}`}function lf(e){return uf(e[0],e[1],e[2])}function uf(e,t,n){return(t<n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return a?a.containsXY(r,i):!0}function ff(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function pf(e,t,n){let r=e[n];return r?r.delete(t):!1}function mf(e,t){let n=e.layerStatesArray[e.layerIndex];n.extent&&(t=je(t,Mn(n.extent,e.viewState.projection)));let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=je(t,n))}return t}var hf=class extends Vs{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=pe(),this.tempTileRange_=new pd(0,0,0,0),this.tempTileCoord_=of(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new af(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new af(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource(),o=cf(a,a.getKey(),e,t,n),s;if(i.containsKey(o))s=i.get(o);else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||xn(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=B(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!le(i,r))return null;let a=t.viewState,o=n.getRenderSource(),s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==Q.LOADED)continue;let l=s.getOrigin(e),u=Lo(s.getTileSize(e)),d=s.getResolution(e),f;if(i instanceof $l||i instanceof rf)f=i.getImage();else if(i instanceof Gd){if(f=Hd(i.getData()),!f)continue}else continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,i){let a=e.viewState,o=this.getLayer(),s=o.getRenderSource(),c=s.getTileGridForProjection(a.projection),l=k(s);l in e.wantedTiles||(e.wantedTiles[l]={});let u=e.wantedTiles[l],d=o.getMapInternal(),f=Math.max(n-i,c.getMinZoom(),c.getZForResolution(Math.min(o.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):c.getResolution(0)),s.zDirection)),p=a.rotation,m=p?Ae(a.center,a.resolution,p,e.size):void 0;for(let i=n;i>=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!ff(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===Q.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=of(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys();for(let e=0;e0&&setTimeout(()=>{this.enqueueTiles(e,T,f-1,C,w-1)},0),!(f in C))return this.container;let E=k(this),D=e.time;for(let t of C[f]){let n=t.getState();if(n===Q.EMPTY)continue;let r=t.tileCoord;if(n===Q.LOADED&&t.getAlpha(E,D)===1){t.endTransition(E);continue}if(n!==Q.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,C)){pf(C,t,f),e.animate=!0;continue}if(this.findAltTiles_(d,r,f+1,C))continue;let i=d.getMinZoom();for(let e=f-1;e>=i&&!this.findAltTiles_(d,r,e,C);--e);}let O=p/o*c/g,A=this.getRenderContext(e);Ln(this.tempTransform,_/2,v/2,O,O,0,-_/2,-v/2),n.extent&&this.clipUnrotated(A,e,y),u.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,e);let j=Object.keys(C).map(Number);j.sort(a);let M,ee=[],N=[];for(let t=j.length-1;t>=0;--t){let n=j[t],r=u.getTilePixelSize(n,c,i),a=d.getResolution(n)/p,o=r[0]*a*O,s=r[1]*a*O,l=d.getTileCoordForCoordAndZ(Me(S),n),f=d.getTileCoordExtent(l),m=B(this.tempTransform,[g*(f[0]-S[0])/p,g*(S[3]-f[3])/p]),h=g*u.getGutterForProjection(i);for(let t of C[n]){if(t.getState()!==Q.LOADED)continue;let r=t.tileCoord,i=l[1]-r[1],a=Math.round(m[0]-(i-1)*o),c=l[2]-r[2],d=Math.round(m[1]-(c-1)*s),f=Math.round(m[0]-i*o),p=Math.round(m[1]-c*s),g=a-f,_=d-p,v=j.length===1,y=!1;M=[f,p,f+g,p,f+g,p+_,f,p+_];for(let e=0,t=ee.length;e{let n=k(u),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s){let c;if(e instanceof Gd){if(c=Hd(e.getData()),!c)throw Error(`Rendering array data is not yet supported`)}else c=this.getTileImage(e);if(!c)return;let l=this.getRenderContext(t),u=k(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(s?e.getAlpha(u,t.time):1),p=f!==l.globalAlpha;p&&(l.save(),l.globalAlpha=f),l.drawImage(c,o,o,c.width-2*o,c.height-2*o,n,r,i,a),p&&l.restore(),f===d.opacity?s&&e.endTransition(u):t.animate=!0}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=k(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},gf={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},_f=class extends Wl{constructor(e){e||={};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload===void 0?0:e.preload),this.setUseInterimTilesOnError(e.useInterimTilesOnError===void 0?!0:e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(gf.PRELOAD)}setPreload(e){this.set(gf.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(gf.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(gf.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},vf=class extends _f{constructor(e){super(e)}createRenderer(){return new hf(this,{cacheSize:this.getCacheSize()})}},yf=[0,0,0],bf=5,xf=class{constructor(e){this.minZoom=e.minZoom===void 0?0:e.minZoom,this.resolutions_=e.resolutions,P(d(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let e=0,n=this.resolutions_.length-1;e{let r=new pd(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(n){let e=this.getTileRangeForExtentAndZ(n,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r})}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=fd(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]this.maxZoom||t0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;ethis.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=cf(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=z(e);if(n){let e=k(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function Wf(e,t){if(ai){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`),fetch(t,{mode:r,credentials:i}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`))}).catch(()=>{e.getImage().dispatchEvent(new Event(`error`))});return}e.getImage().src=t}var Gf=Uf,Kf=class extends Gf{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Tf({extent:Of(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},qf=class extends Kf{constructor(e){e||={};let t;t=e.attributions===void 0?[`© OpenStreetMap contributors.`]:e.attributions;let n=e.crossOrigin===void 0?`anonymous`:e.crossOrigin,r=e.url===void 0?`https://tile.openstreetmap.org/{z}/{x}/{y}.png`:e.url;super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:n,interpolate:e.interpolate,maxZoom:e.maxZoom===void 0?19:e.maxZoom,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:(t,n)=>{let r=t.getImage();!ai&&r instanceof HTMLImageElement&&(r.referrerPolicy=`origin-when-cross-origin`),(e.tileLoadFunction||Wf)(t,n)},transition:e.transition,url:r,wrapX:e.wrapX,zDirection:e.zDirection})}};export{Bo as Circle,re as Feature,No as Fill,Vd as GeoJSON,qf as OSM,ud as OlMap,Er as Point,Po as Stroke,Ko as Style,vf as TileLayer,Yl as VectorLayer,Mo as VectorSource,Bl as View,pe as createEmpty,bn as fromLonLat}; //# sourceMappingURL=ol.min.js.map