(()=>{"use strict";var t={874:t=>{t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(()=>{const t=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},e="propertychange",n=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function s(t,e){return t>e?1:t0?s-1:s}return n-1}if(i>0){for(let i=1;i0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=h,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},d="change",g="contextmenu",_="click",p="keydown",m="keypress",f="touchmove",v="wheel";function y(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function x(t,e,i,n){return y(t,e,i,n,!0)}function C(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),c(t))}class E extends u{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(d)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new F(M,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new F(I,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new F(I,i,t)),this.dispatchEvent(new F(M,e,t))}updateLength_(){this.set(L,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;is&&(l|=q.RIGHT),ar&&(l|=q.ABOVE),l===q.UNKNOWN&&(l=q.INTERSECTING),l}function J(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function tt(t){return J(1/0,1/0,-1/0,-1/0,t)}function et(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function it(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function nt(t,e,i,n,s){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function yt(t){return t[2].0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(s=Math.min(Math.max(0,s),1))]},xt.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,s=t[2]/255,r=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92),o=.019330818715591*i+.11919477979462*n+.95053215224966*s;return[(.41239079926595*i+.35758433938387*n+.18048078840183*s)*(e=e||Ct.whitepoint[2].E)[0],r*e[1],o*e[2]]};const Et=Ct,wt={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,s,r,o,a,l,h,c,u;return r=t[0],o=t[1],a=t[2],0===r?[0,0,0]:(e=e||"D65",i=i||2,n=o/(13*r)+4*(h=Et.whitepoint[i][e][0])/(h+15*(c=Et.whitepoint[i][e][1])+3*(u=Et.whitepoint[i][e][2]))||0,s=a/(13*r)+9*c/(h+15*c+3*u)||0,[9*(l=r>8?c*Math.pow((r+16)/116,3):c*r*.0011070564598794539)*n/(4*s)||0,l,l*(12-3*n-20*s)/(4*s)||0])}};Et.luv=function(t,e,i){var n,s,r,o,a,l,h,c,u,d,g;e=e||"D65",i=i||2,d=4*(h=Et.whitepoint[i][e][0])/(h+15*(c=Et.whitepoint[i][e][1])+3*(u=Et.whitepoint[i][e][2])),g=9*c/(h+15*c+3*u),n=4*(o=t[0])/(o+15*(a=t[1])+3*(l=t[2]))||0,s=9*a/(o+15*a+3*l)||0;var _=a/c;return[r=_<=.008856451679035631?903.2962962962961*_:116*Math.pow(_,1/3)-16,13*r*(n-d),13*r*(s-g)]},wt.lchuv=function(t){var e=t[0],i=t[1],n=t[2],s=Math.sqrt(i*i+n*n),r=360*Math.atan2(n,i)/2/Math.PI;return r<0&&(r+=360),[e,s,r]},Et.lchuv=function(t){return wt.lchuv(Et.luv(t))};var Tt=i(874);const Rt=function(t){var e,i,n=[],s=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),Tt[t])n=Tt[t].slice(),i="rgb";else if("transparent"===t)s=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var r=t.slice(1),o=r.length;s=1,o<=4?(n=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],4===o&&(s=parseInt(r[3]+r[3],16)/255)):(n=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],8===o&&(s=parseInt(r[6]+r[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),s=(n=n.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==bt[t])return bt[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:s}};var bt={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};const Pt={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,s,r,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[r=255*l,r,r];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),s=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,r=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,s[h++]=255*r;return s}};function St(t,e,i){return Math.min(Math.max(t,e),i)}function Mt(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return It(t,e,i,n)}function It(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Lt(t){return t*Math.PI/180}function Ft(t,e){const i=t%e;return i*e<0?i+e:i}function At(t,e,i){return t+i*(e-t)}function zt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function kt(t,e){return Math.floor(zt(t,e))}function Dt(t,e){return Math.ceil(zt(t,e))}xt.hsl=function(t){var e,i,n=t[0]/255,s=t[1]/255,r=t[2]/255,o=Math.min(n,s,r),a=Math.max(n,s,r),l=a-o;return a===o?e=0:n===a?e=(s-r)/l:s===a?e=2+(r-n)/l:r===a&&(e=4+(n-s)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};const Ot=1024,Nt={};let jt=0;function Gt(t){return Array.isArray(t)?t:function(t){if(Nt.hasOwnProperty(t))return Nt[t];if(jt>=Ot){let t=0;for(const e in Nt)0==(3&t++)&&(delete Nt[e],--jt)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=Rt(t);if(!i.space)return[];const n="h"===i.space[0]?Pt.min:xt.min,s="h"===i.space[0]?Pt.max:xt.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],n[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],n[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],n[2]),s[2]),"h"===i.space[0]&&(e=Pt.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return function(t){t[0]=St(t[0]+.5|0,0,255),t[1]=St(t[1]+.5|0,0,255),t[2]=St(t[2]+.5|0,0,255),t[3]=St(t[3],0,1)}(e),Nt[t]=e,++jt,e}(t)}function Kt(t,e,i){return e+":"+t+":"+(i?function(t){return"string"==typeof t?t:function(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}(t)}(i):"null")}const Zt=new class{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Kt(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=Kt(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}},Xt="opacity",Vt="visible",Ut="extent",Wt="zIndex",qt="maxResolution",Yt="minResolution",Bt="maxZoom",Ht="minZoom",Qt="source",$t=class extends S{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Xt]=void 0!==t.opacity?t.opacity:1,Z("number"==typeof e[Xt],"Layer opacity must be a number"),e[Vt]=void 0===t.visible||t.visible,e[Wt]=t.zIndex,e[qt]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Yt]=void 0!==t.minResolution?t.minResolution:0,e[Ht]=void 0!==t.minZoom?t.minZoom:-1/0,e[Bt]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=St(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return T()}getLayerStatesArray(t){return T()}getExtent(){return this.get(Ut)}getMaxResolution(){return this.get(qt)}getMinResolution(){return this.get(Yt)}getMinZoom(){return this.get(Ht)}getMaxZoom(){return this.get(Bt)}getOpacity(){return this.get(Xt)}getSourceState(){return T()}getVisible(){return this.get(Vt)}getZIndex(){return this.get(Wt)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ut,t)}setMaxResolution(t){this.set(qt,t)}setMinResolution(t){this.set(Yt,t)}setMaxZoom(t){this.set(Bt,t)}setMinZoom(t){this.set(Ht,t)}setOpacity(t){Z("number"==typeof t,"Layer opacity must be a number"),this.set(Xt,t)}setVisible(t){this.set(Vt,t)}setZIndex(t){this.set(Wt,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Jt="precompose",te="rendercomplete",ee={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},ie=42,ne=256,se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},re=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||se[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},oe=6378137,ae=Math.PI*oe,le=[-ae,-ae,ae,ae],he=[-180,-85,180,85],ce=oe*Math.log(Math.tan(Math.PI/2));class ue extends re{constructor(t){super({code:t,units:"m",extent:le,global:!0,worldExtent:he,getPointResolution:function(t,e){return t/Math.cosh(e[1]/oe)}})}}const de=[new ue("EPSG:3857"),new ue("EPSG:102100"),new ue("EPSG:102113"),new ue("EPSG:900913"),new ue("http://www.opengis.net/def/crs/EPSG/0/3857"),new ue("http://www.opengis.net/gml/srs/epsg.xml#3857")];const ge=[-180,-90,180,90],_e=6378137*Math.PI/180;class pe extends re{constructor(t,e){super({code:t,units:"degrees",extent:ge,axisOrientation:e,global:!0,metersPerUnit:_e,worldExtent:ge})}}const me=[new pe("CRS:84"),new pe("EPSG:4326","neu"),new pe("urn:ogc:def:crs:OGC:1.3:CRS84"),new pe("urn:ogc:def:crs:OGC:2:84"),new pe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new pe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new pe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let fe={},ve={};function ye(t,e,i){const n=t.getCode(),s=e.getCode();n in ve||(ve[n]={}),ve[n][s]=i}function xe(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ce(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}const Ee=6371008.8;function we(t,e,i){i=i||Ee;const n=Lt(t[1]),s=Lt(e[1]),r=(s-n)/2,o=Lt(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const Te={info:1,warn:2,error:3,none:4};let Re=Te.info;function be(...t){Re>Te.warn||console.warn(...t)}let Pe=!0;function Se(t,e){if(void 0!==e)for(let i=0,n=t.length;i=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Pe=!1,be("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Xe(t,e){return t}var Ve,Ue,We;function qe(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,_=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),_>p&&(_=(p+_)/2,p=_);let m=St(n[0],d,g),f=St(n[1],_,p);if(o&&i&&s){const t=30*s;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),f+=-t*Math.log(1+Math.max(0,_-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[m,f]}}function Ye(t){return t}function Be(t,e,i,n){const s=ft(e)/i[0],r=gt(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function He(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),St(n,i/2,2*e)}function Qe(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?Be(t,n,a,s):t;return i&&l?He(r,o,e):St(r,e,o)}}}function $e(t){if(void 0!==t)return 0}function Je(t){if(void 0!==t)return t}function ti(t){return Math.pow(t,3)}function ei(t){return 1-ti(1-t)}function ii(t){return 3*t*t-2*t*t*t}function ni(t){return t}Ae(de),Ae(me),Ve=de,Ue=function(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;sce?i=ce:i<-ce&&(i=-ce),e[s+1]=i}return e},We=function(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return T()}closestPointXY(t,e,i,n){return T()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return T()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&tt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){T()}scale(t,e,i){T()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return T()}getType(){return T()}applyTransform(t){T()}intersectsExtent(t){return T()}translate(t,e){T()}transform(t,e){const i=Le(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=gt(o)/gt(r);return V(si,o[0],o[3],a,-a,0,0,0),function(t,e,i,n,s,r){r=r||[];let o=0;for(let e=0;e1)u=i;else{if(d>0){for(let s=0;ss&&(s=a),r=i,o=n}return s}function ci(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=It(o,a,t[e],t[e+1]),d0&&_>d)&&(g<0&&p0&&p>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function _i(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;eo&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+nr&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Ei(t,e,i,n,s,r){if(0===i.length)return!1;if(!Ci(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||function(t,e,i,n,r){let o;for(e+=n;e=o&&p<=l),n||!(r&q.RIGHT)||s&q.RIGHT||(m=g-(d-l)*_,n=m>=a&&m<=h),n||!(r&q.BELOW)||s&q.BELOW||(p=d-(g-a)/_,n=p>=o&&p<=l),n||!(r&q.LEFT)||s&q.LEFT||(m=g-(d-o)*_,n=m>=a&&m<=h)}return n}(s,a,l),o)return o;var a,l;return!1}(t,e,i,n));var o,a}function Ti(t,e,i,n,s){return!!(wi(t,e,i,n,s)||Ci(t,e,i,n,s[0],s[1])||Ci(t,e,i,n,s[0],s[3])||Ci(t,e,i,n,s[2],s[1])||Ci(t,e,i,n,s[2],s[3]))}function Ri(t,e,i,n){for(;e0}function Pi(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;rv&&(c=(u+d)/2,Ei(t,e,i,n,c,p)&&(f=c,v=s)),u=d}return isNaN(f)&&(f=r[o]),a?(a.push(f,p,v),a):[f,p,v]}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yi(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new fi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;ru&&g1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Ft(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Li(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,r;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Ce(i,t-this.getRotation()),r=e,(s=i)[0]+=+r[0],s[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();return void 0!==n&&void 0!==s&&(i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ke(t,this.getProjection()):t}getCenterInternal(){return this.get(ee.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return e=this.calculateExtentInternal(t),this.getProjection(),e;var e}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Z(e,"The view center is not defined");const i=this.getResolution();Z(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Z(void 0!==n,"The view rotation is not defined"),ut(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ee.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Xe(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ft(t)/e[0],n=gt(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ee.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Ai(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=r(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=St(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,St(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Z(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))Z(!yt(t),"Cannot fit empty extent provided as `geometry`"),i=Ii(Xe(t,this.getProjection()));else if("Circle"===t.getType()){const e=Xe(t.getExtent(),this.getProjection());i=Ii(e),i.rotate(this.getRotation(),ht(e))}else{const e=Ge();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const Di=class extends $t{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Qt,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Qt)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(C(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=y(t,d,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof zi?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const s=this.getExtent();return ki(n,e.viewState)&&(!s||vt(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof zi?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(C(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(C(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=y(t,Jt,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Z(!e.some((function(t){return t.layer===i.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}),this),this.mapRenderKey_=y(this,d,t.render,t),this.changed())}setSource(t){this.set(Qt,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function Oi(t,e){Zt.expire()}const Ni=class extends n{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){T()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;V(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),U(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let l;const h=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=h.projection,d=function(t,e){if(e.canWrapX()){const i=ft(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||ft(n),s=Math.floor((t[0]-n[0])/i)),s}(t,e,i);n&&(t[0]-=n*i)}return t}(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=ft(u.getExtent());g.push([-t,0],[t,0])}const _=e.layerStatesArray,p=_.length,m=[],f=[];for(let n=0;n=0;--s){const r=_[s],u=r.layer;if(u.hasRenderer()&&ki(r,h)&&o.call(a,u)){const s=u.getRenderer(),o=u.getSource();if(s&&o){const a=o.getWrapX()?d:t,h=c.bind(null,r.managed);f[0]=a[0]+g[n][0],f[1]=a[1]+g[n][1],l=s.forEachFeatureAtCoordinate(f,e,i,h,m)}if(l)return l}}if(0===m.length)return;const v=1/m.length;return m.forEach(((t,e)=>t.distanceSq+=e*v)),m.sort(((t,e)=>t.distanceSq-e.distanceSq)),m.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,a,this,s,r)}getMap(){return this.map_}renderFrame(t){T()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Zt.canExpireCache()&&t.postRenderFunctions.push(Oi)}},ji=class extends t{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},Gi="ol-hidden",Ki="ol-unselectable",Zi="ol-control",Xi="ol-collapsed";new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i");function Vi(t,e,i,n){let s;return s=i&&i.length?i.shift():j?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}function Ui(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Wi(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function qi(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}const Yi=new S;!function(){const t=["monospace","serif"];t.length}();const Bi=class extends Ni{constructor(t){super(t),this.fontChangeListenerKey_=y(Yi,e,t.redrawText.bind(t)),this.element_=document.createElement("div");const i=this.element_.style;i.position="absolute",i.width="100%",i.height="100%",i.zIndex="0",this.element_.className=Ki+" ol-layers";const n=t.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new ji(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){C(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Jt,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let s=null;for(let r=0,o=e.length;r=0;--i)e[i].renderDeclutter(t);e.length=0}};class Hi extends t{constructor(t,e){super(t),this.layer=e}}const Qi="layers";class $i extends $t{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Qi,this.handleLayersChanged_),i?Array.isArray(i)?i=new A(i.slice(),{unique:!0}):Z("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new A(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(C),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(y(t,M,this.handleLayersAdd_,this),y(t,I,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(C);c(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{this.clickTimeoutId_=void 0;const e=new en(nn.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==nn.POINTERUP||e.type==nn.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=nn.POINTERDOWN&&e.type!=nn.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new en(nn.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(C),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new en(nn.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(y(t,nn.POINTERMOVE,this.handlePointerMove_,this),y(t,nn.POINTERUP,this.handlePointerUp_,this),y(this.element_,nn.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(y(this.element_.getRootNode(),nn.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new en(nn.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new en(nn.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(C(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(f,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(C(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(C),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},on="postrender",an="loadstart",ln="loadend",hn="layergroup",cn="size",un="target",dn="view",gn=1/0,_n=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,c(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){Z(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=gn&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;for(;t>1;){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=rt;){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o0;)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),0!==i||s in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++r,n.load())}},mn=class extends S{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){qi(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&qi(this.element);for(let t=0,e=this.listenerKeys.length;te.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!o(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:ei}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Gi);t||0!==i?t&&0!==i&&this.element.classList.remove(Gi):this.element.classList.add(Gi)}this.label_.style.transform=t}this.rotation_=i}},yn=class extends mn{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof r?document.createTextNode(r):r),h.addEventListener(_,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(_,this.handleClick_.bind(this,-i),!1);const u=e+" "+Ki+" "+Zi,d=this.element;d.className=u,d.appendChild(h),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ei})):e.setZoom(n)}}},xn="active";function Cn(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ei})}const En=class extends S{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(xn)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(xn,t)}setMap(t){this.map_=t}},wn=class extends En{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==nn.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;Cn(n.getView(),r,s,this.duration_),i.preventDefault(),e=!0}return!e}};function Tn(t){const e=t.length;let i=0,n=0;for(let s=0;s0}}else if(t.type==nn.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==nn.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function bn(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},On=class extends Rn{constructor(t){t=t||{},super({stopDown:l}),this.condition_=t.condition?t.condition:Pn,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!zn(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===$e)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){return!zn(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!zn(t)&&(!(!In(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},Nn=class extends n{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Mi([i])}getGeometry(){return this.geometry_}};class jn extends t{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Gn=class extends Rn{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Nn(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:In,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new jn("boxdrag",t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new jn(e?"boxend":"boxcancel",t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new jn("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}},Kn=class extends Gn{constructor(t){super({condition:(t=t||{}).condition?t.condition:Fn,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),s=e.getResolution()/n;i=i.clone(),i.scale(s*s)}e.fitInternal(i,{duration:this.duration_,easing:ei})}},Zn="ArrowLeft",Xn="ArrowRight",Vn="ArrowDown",Un=class extends En{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Ln(t)&&An(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==p){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Vn||n==Zn||n==Xn||"ArrowUp"==n)){const s=t.map.getView(),r=s.getResolution()*this.pixelDelta_;let o=0,a=0;n==Vn?a=-r:n==Zn?o=-r:n==Xn?o=r:a=r;const l=[o,a];Ce(l,s.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:ni,center:t.getConstrainedCenter(s)})}}(s,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Wn=class extends En{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return O?e.metaKey:e.ctrlKey}(t)&&An(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==p||t.type==m){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_;Cn(s.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},qn=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},Yn=class extends En{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Mn;this.condition_=t.onFocusOnly?bn(Sn,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==v)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==v&&(n=i.deltaY,k&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=N),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.lastDelta_=n;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const r=e.getView();if("trackpad"===this.mode_&&!r.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=s,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-St(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Cn(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},Bn=class extends Rn{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=l),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==$e&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(Tn(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},Hn=class extends Rn{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=l),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Tn(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Qn(t){return t[0]>0&&t[1]>0}function $n(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}function Jn(t){t instanceof Di?t.setMapInternal(null):t instanceof Ji&&t.getLayers().forEach(Jn)}function ts(t,e){if(t instanceof Di)t.setMapInternal(e);else if(t instanceof Ji){const i=t.getLayers().getArray();for(let t=0,n=i.length;t{const r=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,r)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(d,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}};let rs=null;const os=class extends ss{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;rs||(rs=Vi(1,1,void 0,{willReadFrequently:!0})),rs.clearRect(0,0,1,1);try{rs.drawImage(t,e,i,1,1,0,0,1,1),n=rs.getImageData(0,0,1,1).data}catch(t){return rs=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&o(Gt(t.style.backgroundColor),Gt(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=Vi();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=pt(i),s=mt(i),r=lt(i),o=at(i);X(e.coordinateToPixelTransform,n),X(e.coordinateToPixelTransform,s),X(e.coordinateToPixelTransform,r),X(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;X(a,n),X(a,s),X(a,r),X(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new ji(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_("prerender",t,e)}postRender(t,e){this.dispatchRenderEvent_("postrender",t,e)}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return V(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},as=class extends u{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(d)}release(){3===this.state&&this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let t=this.interimTile;if(!t)return this;do{if(2==t.getState())return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){let t=this.interimTile;if(!t)return;let e=this;do{if(2==t.getState()){t.interimTile=null;break}1==t.getState()?e=t:0==t.getState()?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){T()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:ti(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}},ls=class extends as{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=Vi(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4,this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let s=!0,r=!1,o=!1;const a=[x(n,"load",(function(){o=!0,r||e()}))];return n.src&&G?(r=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(o?e():i())}))):a.push(x(n,"error",i)),function(){s=!1,a.forEach(C)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}},hs=class{constructor(t,e,i,n,s,r){this.sourceProj_=t,this.targetProj_=e;let o={};const a=Oe(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ft(n)>=ft(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ft(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ft(this.targetProj_.getExtent()):null;const l=pt(i),h=mt(i),c=lt(i),u=at(i),d=this.transformInv_(l),g=this.transformInv_(h),_=this.transformInv_(c),p=this.transformInv_(u),m=10+(r?Math.max(0,Math.ceil(Math.log2(ot(i)/(r*r*256*256)))):0);if(this.addQuad_(l,h,c,u,d,g,_,p,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&c<1;let g=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(g=ft(Y([t,e,i,n]))/this.targetWorldWidth_>.25||g),!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)),!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!vt(h,this.maxSourceExtent_))return;let _=0;if(!(g||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(_=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=_&&2!=_&&4!=_&&8!=_)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;r=d?(Ft(s[0],u)+Ft(o[0],u))/2-Ft(n[0],u):(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,s,r,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,s,c,d,a,l-1),this.addQuad_(h,e,i,u,c,r,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&_)&&this.addTriangle_(t,i,n,s,o,a),0==(14&_)&&this.addTriangle_(t,i,e,s,o,r),_&&(0==(13&_)&&this.addTriangle_(e,n,t,r,a,s),0==(7&_)&&this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const s=e.source;it(t,s[0]),it(t,s[1]),it(t,s[2])})),t}getTriangles(){return this.triangles_}};let cs;const us=[];function ds(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function gs(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function _s(t,e,i,n){const s=Ne(i,e,t);let r=Fe(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const l=t.getExtent();if(!l||H(l,s)){const e=Fe(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}const ps=class extends as{constructor(t,e,i,n,s,r,o,a,l,h,c,u){super(s,0,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const p=g?_t(d,g):d;if(0===ot(p))return void(this.state=4);const m=t.getExtent();m&&(_=_?_t(_,m):m);const f=n.getResolution(this.wrappedTileCoord_[0]),v=function(t,e,i,n){const s=ht(i);let r=_s(t,e,s,n);return(!isFinite(r)||r<=0)&&rt(i,(function(i){return r=_s(t,e,i,n),isFinite(r)&&r>0})),r}(t,i,p,f);if(!isFinite(v)||v<=0)return void(this.state=4);const y=void 0!==h?h:.5;if(this.triangulation_=new hs(t,i,p,_,v*y,f),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(v);let x=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(x[1]=St(x[1],_[1],_[3]),x[3]=St(x[3],_[1],_[3])):x=_t(x,_)),ot(x)){const t=e.getTileRangeForExtentAndZ(x,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=l(this.sourceZ_,e,i,o);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&2==e.getState()&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,s,r,o,a,l,h,c,u,d){const g=Vi(Math.round(i*t),Math.round(i*e),us);if(u||(g.imageSmoothingEnabled=!1),0===l.length)return g.canvas;function _(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;if(l.forEach((function(t,e,i){var n,s;n=p,(s=t.extent)[0]n[2]&&(n[2]=s[2]),s[1]n[3]&&(n[3]=s[3])})),!d||1!==l.length||0!==h){const t=ft(p),e=gt(p);m=Vi(Math.round(i*t/n),Math.round(i*e/n),us),u||(m.imageSmoothingEnabled=!1);const s=i/n;l.forEach((function(t,e,i){const n=t.extent[0]-p[0],r=-(t.extent[3]-p[3]),o=ft(t.extent),a=gt(t.extent);t.image.width>0&&t.image.height>0&&m.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*s,r*s,o*s,a*s)}))}const f=pt(o);return a.getTriangles().forEach((function(t,e,s){const o=t.source,a=t.target;let h=o[0][0],c=o[0][1],d=o[1][0],v=o[1][1],y=o[2][0],x=o[2][1];const C=_((a[0][0]-f[0])/r),E=_(-(a[0][1]-f[1])/r),w=_((a[1][0]-f[0])/r),T=_(-(a[1][1]-f[1])/r),R=_((a[2][0]-f[0])/r),b=_(-(a[2][1]-f[1])/r),P=h,S=c;h=0,c=0,d-=P,v-=S,y-=P,x-=S;const M=function(t){const e=t.length;for(let i=0;is&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}([[d,v,0,0,w-C],[y,x,0,0,R-C],[0,0,d,v,T-E],[0,0,y,x,b-E]]);if(!M)return;if(g.save(),g.beginPath(),function(){if(void 0===cs){const t=Vi(6,6,us);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",ds(t,4,5,4,0),ds(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;cs=gs(e,0)||gs(e,4)||gs(e,8),Ui(t),us.push(t.canvas)}return cs}()||!u){g.moveTo(w,T);const t=4,e=C-w,i=E-T;for(let n=0;n{const i=e.getState();if(0==i||1==i){t++;const i=y(e,d,(function(n){const s=e.getState();2!=s&&3!=s&&4!=s||(C(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){0==t.getState()&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(C),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Ui(this.canvas_.getContext("2d")),us.push(this.canvas_),this.canvas_=null),super.release()}};class ms{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function fs(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new ms(t,e,i,n)}const vs=ms,ys=class extends os{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new vs(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return 2==i||4==i||3==i&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer();let a=o.getSource().getTile(t,e,i,s,r);return 3==a.getState()&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(a)||(a=a.getInterimTile()),a}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=X(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!H(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,a=e.viewState,l=i.getRenderSource(),h=l.getTileGridForProjection(a.projection),c=l.getTilePixelRatio(e.pixelRatio);for(let t=h.getZForResolution(a.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=l.getTile(t,e[1],e[2],r,o);if(!(i instanceof ls||i instanceof ps)||i instanceof ps&&4===i.getState())return null;if(2!==i.getState())continue;const s=h.getOrigin(t),u=$n(h.getTileSize(t)),d=h.getResolution(t),g=Math.floor(c*((n[0]-s[0])/d-e[1]*u[0])),_=Math.floor(c*((s[1]-n[1])/d-e[2]*u[1])),p=Math.round(c*l.getGutterForProjection(a.projection));return this.getImageData(i.getImage(),g+p,_+p)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),_=g.getZForResolution(o,u.zDirection),p=g.getResolution(_);let m=t.extent;const f=t.viewState.resolution,v=u.getTilePixelRatio(h),y=Math.round(ft(m)/f*h),x=Math.round(gt(m)/f*h),C=i.extent&&Xe(i.extent);C&&(m=_t(m,Xe(i.extent)));const E=p*y/2/v,w=p*x/2/v,T=[a[0]-E,a[1]-w,a[0]+E,a[1]+w],R=g.getTileRangeForExtentAndZ(m,_),P={};P[_]={};const S=this.createLoadedTileFinder(u,r,P),M=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;const L=l?dt(n.center,f,l,t.size):void 0;for(let e=R.minX;e<=R.maxX;++e)for(let n=R.minY;n<=R.maxY;++n){if(l&&!g.tileCoordIntersectsViewport([_,e,n],L))continue;const s=this.getTile(_,e,n,t);if(this.isDrawableTile(s)){const e=b(this);if(2==s.getState()){P[_][s.tileCoord.toString()]=s;let t=s.inTransition(e);t&&1!==i.opacity&&(s.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(s)||(this.newTiles_=!0)}if(1===s.getAlpha(e,t.time))continue}const r=g.getTileCoordChildTileRange(s.tileCoord,I,M);let o=!1;r&&(o=S(_+1,r)),o||g.forEachTileCoordParentTileRange(s.tileCoord,S,I,M)}const F=p/o*h/v;V(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-y/2,-x/2);const A=function(t){const e="matrix("+t.join(", ")+")";if(j)return e;const i=W||(W=document.createElement("div"));return i.style.transform=e,i.style.transform}(this.pixelTransform);this.useContainer(e,A,this.getBackground(t));const z=this.context,k=z.canvas;U(this.inversePixelTransform,this.pixelTransform),V(this.tempTransform,y/2,x/2,F,F,0,-y/2,-x/2),k.width!=y||k.height!=x?(k.width=y,k.height=x):this.containerReused||z.clearRect(0,0,y,x),C&&this.clipUnrotated(z,t,C),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,t),this.renderedTiles.length=0;let D,O,N,G=Object.keys(P).map(Number);G.sort(s),1!==i.opacity||this.containerReused&&!u.getOpaque(t.viewState.projection)?(D=[],O=[]):G=G.reverse();for(let e=G.length-1;e>=0;--e){const i=G[e],n=u.getTilePixelSize(i,h,r),s=g.getResolution(i)/p,o=n[0]*s*F,a=n[1]*s*F,l=g.getTileCoordForCoordAndZ(pt(T),i),c=g.getTileCoordExtent(l),d=X(this.tempTransform,[v*(c[0]-T[0])/p,v*(T[3]-c[3])/p]),m=v*u.getGutterForProjection(r),f=P[i];for(const e in f){const n=f[e],s=n.tileCoord,r=l[1]-s[1],h=Math.round(d[0]-(r-1)*o),c=l[2]-s[2],g=Math.round(d[1]-(c-1)*a),p=Math.round(d[0]-r*o),v=Math.round(d[1]-c*a),y=h-p,x=g-v,C=_===i,E=C&&1!==n.getAlpha(b(this),t.time);let w=!1;if(!E)if(D){N=[p,v,p+y,v,p+y,v+x,p,v+x];for(let t=0,e=D.length;t0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Z(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return Z(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Z(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}};function Cs(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Es(t,e,i){return t+"/"+e+"/"+i}function ws(t){return Es(t[0],t[1],t[2])}const Ts=class extends xs{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey().split("/").map(Number)[0];this.forEach((e=>{e.tileCoord[0]!==t&&(this.remove(ws(e.tileCoord)),e.release())}))}};function Rs(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}const bs=class extends S{constructor(t){super(),this.projection=Le(t.projection),this.attributions_=Rs(t.attributions),this.attributionsCollapsible_=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Rs(t),this.changed()}setState(t){this.state_=t,this.changed()}},Ps=[0,0,0],Ss=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Z(function(t,e,i){const n=((t,e)=>e-t)||s;return t.every((function(e,i){if(0===i)return!0;const s=n(t[i-1],e);return!(s>0||0===s)}))}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new vs(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),s=fs(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,l,i),e(l,s))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let t=0;ti||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}};function zs(t,e){const i=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,(function(){const t=o[0],i=e.getFullTileRange(t);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()}))}}class ks extends As{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===ks.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=b(e),n=e.getState();let s;1==n?(this.tileLoadingKeys_[i]=!0,s="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=s&&this.dispatchEvent(new Fs(s,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let s=0;sthis.getTileInternal(t,e,i,n,r)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return _.key=c,l?(_.interimTile=l,_.refreshInterimChain(),o.replace(h,_)):o.set(h,_),_}getTileInternal(t,e,i,n,s){let r=null;const o=Es(t,e,i),a=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=a){const l=r;r=this.createTile_(t,e,i,n,s,a),0==l.getState()?r.interimTile=l.interimTile:r.interimTile=l,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.createTile_(t,e,i,n,s,a),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=Le(t);if(i){const t=b(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}};new class extends S{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Ji({layers:t.layers});let s,r,o;return i[hn]=n,i[un]=t.target,i[dn]=t.view instanceof zi?t.view:new zi,void 0!==t.controls&&(Array.isArray(t.controls)?s=new A(t.controls.slice()):(Z("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new A(t.interactions.slice()):(Z("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new A(t.overlays.slice()):(Z("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new A,{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:N,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver((()=>this.updateSize())),this.controls=e.controls||function(t){t=t||{};const e=new A;return(void 0===t.zoom||t.zoom)&&e.push(new yn(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vn(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new fn(t.attributionOptions)),e}(),this.interactions=e.interactions||function(t){t=t||{};const e=new A,i=new qn(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new On),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new wn({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Dn({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Bn),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Hn({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Un),e.push(new Wn({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Yn({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Kn({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new pn(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(hn,this.handleLayerGroupChanged_),this.addChangeListener(dn,this.handleViewChanged_),this.addChangeListener(cn,this.handleSizeChanged_),this.addChangeListener(un,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof zi||t.view.then((function(t){i.setView(new zi(t))})),this.controls.addEventListener(M,(t=>{t.element.setMap(this)})),this.controls.addEventListener(I,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(M,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(I,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(M,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(I,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){ts(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:a,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof Ji?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:a,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],s=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/n,(r.clientY-e.top)/s]}getTarget(){return this.get(un)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ke(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?X(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(hn)}setLayers(t){const e=this.getLayerGroup();if(t instanceof A)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[0]||e[1]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Hi("removelayer",e)),this.set(hn,t)}setSize(t){this.set(cn,t)}setTarget(t){this.set(un,t)}setView(t){if(!t||t instanceof zi)return void this.set(dn,t);this.set(dn,new zi);const e=this;t.then((function(t){e.setView(new zi(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),s=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(s)||(e=[n,s],!Qn(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&be("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&o(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}({target:"map",layers:[new class extends ns{constructor(t){super(t)}createRenderer(){return new ys(this)}}({source:new class extends Ns{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||Le("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Is(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Ss(n)}({extent:Ls(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}({url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"})})],view:new zi({center:[0,0],zoom:2})})})()})();